From 9ce0a37c3244e5c75b60a06d093017549063bb1a Mon Sep 17 00:00:00 2001
From: 06wj <06wj@163.com>
Date: Tue, 4 Jan 2022 15:17:55 +0800
Subject: [PATCH] publish 1.16.0
---
CHANGELOG.md | 18 +++
README.md | 4 +-
README_ZH.md | 4 +-
build/Hilo3d.js | 6 +-
build/Hilo3d.single.js | 4 +-
build/math.single.js | 4 +-
docs/AmbientLight.html | 8 ++
docs/Animation.html | 8 ++
docs/AnimationStates.html | 8 ++
docs/AreaLight.html | 8 ++
docs/AxisHelper.html | 8 ++
docs/AxisNetHelper.html | 8 ++
docs/BasicLoader.html | 8 ++
docs/BasicMaterial.html | 19 ++-
docs/BoxGeometry.html | 8 ++
docs/Buffer.html | 8 ++
docs/Cache.html | 8 ++
docs/Camera.html | 8 ++
docs/CameraHelper.html | 8 ++
docs/Class.html | 8 ++
docs/Color.html | 8 ++
docs/CubeTexture.html | 8 ++
docs/CubeTextureLoader.html | 8 ++
docs/DataTexture.html | 8 ++
docs/DirectionalLight.html | 8 ++
docs/Euler.html | 8 ++
docs/EulerNotifier.html | 8 ++
docs/EventMixin.html | 8 ++
docs/Fog.html | 8 ++
docs/Framebuffer.html | 8 ++
docs/Frustum.html | 8 ++
docs/GLTFLoader.html | 8 ++
docs/GLTFParser.html | 8 ++
docs/Geometry.html | 8 ++
docs/GeometryData.html | 8 ++
docs/GeometryMaterial.html | 19 ++-
docs/HDRLoader.html | 8 ++
docs/KTXLoader.html | 8 ++
docs/LazyTexture.html | 18 ++-
docs/Light.html | 8 ++
docs/LightManager.html | 8 ++
docs/LoadCache.html | 8 ++
docs/LoadQueue.html | 8 ++
docs/Loader.html | 8 ++
docs/Material.html | 8 ++
docs/Matrix3.html | 8 ++
docs/Matrix4.html | 8 ++
docs/Matrix4Notifier.html | 8 ++
docs/Mesh.html | 8 ++
docs/MeshPicker.html | 8 ++
docs/MorphGeometry.html | 8 ++
docs/Node.html | 8 ++
docs/OrthographicCamera.html | 8 ++
docs/PBRMaterial.html | 13 +-
docs/PerspectiveCamera.html | 8 ++
docs/Plane.html | 8 ++
docs/PlaneGeometry.html | 8 ++
docs/PointLight.html | 8 ++
docs/Program.html | 8 ++
docs/Quaternion.html | 8 ++
docs/Ray.html | 8 ++
docs/RenderInfo.html | 8 ++
docs/RenderList.html | 8 ++
docs/Shader.html | 8 ++
docs/ShaderMaterial.html | 8 ++
docs/ShaderMaterialLoader.html | 8 ++
docs/Skeleton.html | 10 +-
docs/SkinedMesh.html | 8 ++
docs/SphereGeometry.html | 8 ++
docs/SphericalHarmonics3.html | 8 ++
docs/SpotLight.html | 8 ++
docs/Stage.html | 8 ++
docs/Texture.html | 8 ++
docs/TextureLoader.html | 8 ++
docs/Ticker.html | 136 +++++++++++----------
docs/Tween.html | 8 ++
docs/Vector2.html | 8 ++
docs/Vector3.html | 8 ++
docs/Vector3Notifier.html | 8 ++
docs/Vector4.html | 8 ++
docs/VertexArrayObject.html | 8 ++
docs/WebGLRenderer.html | 8 ++
docs/WebGLResourceManager.html | 8 ++
docs/WebGLState.html | 8 ++
docs/WebGLSupport.html | 8 ++
docs/animation_Animation.js.html | 8 ++
docs/animation_AnimationStates.js.html | 8 ++
docs/browser.html | 8 ++
docs/camera_Camera.js.html | 8 ++
docs/camera_OrthographicCamera.js.html | 8 ++
docs/camera_PerspectiveCamera.js.html | 8 ++
docs/capabilities.html | 8 ++
docs/constants.html | 8 ++
docs/constants_Hilo.js.html | 8 ++
docs/constants_index.js.html | 8 ++
docs/constants_webgl.js.html | 8 ++
docs/constants_webglExtensions.js.html | 8 ++
docs/core_Class.js.html | 8 ++
docs/core_EventMixin.js.html | 8 ++
docs/core_Fog.js.html | 8 ++
docs/core_Mesh.js.html | 8 ++
docs/core_Node.js.html | 8 ++
docs/core_Skeleton.js.html | 10 +-
docs/core_SkinedMesh.js.html | 8 ++
docs/core_Stage.js.html | 8 ++
docs/core_Tween.js.html | 8 ++
docs/extensions.html | 8 ++
docs/geometry_BoxGeometry.js.html | 8 ++
docs/geometry_Geometry.js.html | 8 ++
docs/geometry_GeometryData.js.html | 8 ++
docs/geometry_MorphGeometry.js.html | 8 ++
docs/geometry_PlaneGeometry.js.html | 8 ++
docs/geometry_SphereGeometry.js.html | 8 ++
docs/glType.html | 8 ++
docs/global.html | 8 ++
docs/helper_AxisHelper.js.html | 8 ++
docs/helper_AxisNetHelper.js.html | 8 ++
docs/helper_CameraHelper.js.html | 8 ++
docs/index.html | 14 ++-
docs/light_AmbientLight.js.html | 8 ++
docs/light_AreaLight.js.html | 8 ++
docs/light_DirectionalLight.js.html | 8 ++
docs/light_Light.js.html | 8 ++
docs/light_LightManager.js.html | 8 ++
docs/light_PointLight.js.html | 8 ++
docs/light_SpotLight.js.html | 8 ++
docs/loader_BasicLoader.js.html | 8 ++
docs/loader_CubeTextureLoader.js.html | 8 ++
docs/loader_GLTFExtensions.js.html | 10 +-
docs/loader_GLTFLoader.js.html | 8 ++
docs/loader_GLTFParser.js.html | 8 ++
docs/loader_HDRLoader.js.html | 8 ++
docs/loader_KTXLoader.js.html | 8 ++
docs/loader_LoadCache.js.html | 8 ++
docs/loader_LoadQueue.js.html | 8 ++
docs/loader_Loader.js.html | 8 ++
docs/loader_ShaderMaterialLoader.js.html | 8 ++
docs/loader_TextureLoader.js.html | 8 ++
docs/log.html | 8 ++
docs/material_BasicMaterial.js.html | 10 +-
docs/material_GeometryMaterial.js.html | 8 ++
docs/material_Material.js.html | 8 ++
docs/material_PBRMaterial.js.html | 11 +-
docs/material_ShaderMaterial.js.html | 8 ++
docs/material_semantic.js.html | 26 ++++
docs/math.html | 8 ++
docs/math_Color.js.html | 8 ++
docs/math_Euler.js.html | 8 ++
docs/math_EulerNotifier.js.html | 8 ++
docs/math_Frustum.js.html | 8 ++
docs/math_Matrix3.js.html | 8 ++
docs/math_Matrix4.js.html | 8 ++
docs/math_Matrix4Notifier.js.html | 8 ++
docs/math_Plane.js.html | 8 ++
docs/math_Quaternion.js.html | 8 ++
docs/math_Ray.js.html | 8 ++
docs/math_Sphere.js.html | 8 ++
docs/math_SphericalHarmonics3.js.html | 8 ++
docs/math_Vector2.js.html | 8 ++
docs/math_Vector3.js.html | 8 ++
docs/math_Vector3Notifier.js.html | 8 ++
docs/math_Vector4.js.html | 8 ++
docs/math_math.js.html | 8 ++
docs/renderer_Buffer.js.html | 8 ++
docs/renderer_Framebuffer.js.html | 8 ++
docs/renderer_Program.js.html | 8 ++
docs/renderer_RenderInfo.js.html | 8 ++
docs/renderer_RenderList.js.html | 8 ++
docs/renderer_VertexArrayObject.js.html | 8 ++
docs/renderer_WebGLRenderer.js.html | 8 ++
docs/renderer_WebGLResourceManager.js.html | 8 ++
docs/renderer_WebGLState.js.html | 8 ++
docs/renderer_capabilities.js.html | 8 ++
docs/renderer_extensions.js.html | 8 ++
docs/renderer_glType.js.html | 8 ++
docs/renderer_logGLResource.js.html | 8 ++
docs/semantic.html | 90 ++++++++++++++
docs/shader_Shader.js.html | 8 ++
docs/texture_CubeTexture.js.html | 8 ++
docs/texture_DataTexture.js.html | 8 ++
docs/texture_LazyTexture.js.html | 9 ++
docs/texture_Texture.js.html | 8 ++
docs/util.html | 34 +++++-
docs/utils_Cache.js.html | 8 ++
docs/utils_MeshPicker.js.html | 8 ++
docs/utils_Ticker.js.html | 96 ++++++++++-----
docs/utils_WebGLSupport.js.html | 8 ++
docs/utils_browser.js.html | 8 ++
docs/utils_log.js.html | 8 ++
docs/utils_util.js.html | 10 +-
package.json | 2 +-
types/index.d.ts | 26 ++--
192 files changed, 1811 insertions(+), 128 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9fd7a961..13634558 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,21 @@
+# [1.16.0](https://github.com/hiloteam/Hilo3d/compare/1.15.20...1.16.0) (2022-01-04)
+
+
+### Bug Fixes
+
+* KHR_techniques_webgl parse texture bug ([f45879e](https://github.com/hiloteam/Hilo3d/commit/f45879ed7b826eb6049e14069120f0c2e3192f6b))
+* pbr shader texture lod bug ([8256991](https://github.com/hiloteam/Hilo3d/commit/825699140ccc44bf7b9bbc83769526a5fac9584c))
+* the nextTick callback of ticker should pass in the dt parameter ([db267cb](https://github.com/hiloteam/Hilo3d/commit/db267cb06d40bdb8ad63a3db7d14ca3ed1a43f71))
+* unlit material transparency bug ([1006c60](https://github.com/hiloteam/Hilo3d/commit/1006c60340c511a908fd90d5ef8f331b1749d468))
+
+
+### Features
+
+* add JOINT & WEIGHT semantic ([2a9da6a](https://github.com/hiloteam/Hilo3d/commit/2a9da6aa59113c8e5f0d7cd4df46a938cd2e7d15))
+* Add the function of dynamically modifying the targetFPS of the ticker ([e41f6cf](https://github.com/hiloteam/Hilo3d/commit/e41f6cf521040b0ffa0bf32b980eca1de0c15f84))
+
+
+
## [1.15.20](https://github.com/hiloteam/Hilo3d/compare/1.15.19...1.15.20) (2021-07-19)
diff --git a/README.md b/README.md
index ab0cfec9..d654f71d 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ English | [简体中文](./README_ZH.md)
* use script tag from a [cdn][cdn-url]
```
-
+
```
### Documentation
@@ -122,4 +122,4 @@ English | [简体中文](./README_ZH.md)
[size-image]:https://img.badgesize.io/hiloteam/hilo3d/master/build/Hilo3d.js.svg?compression=gzip&style=flat-square
[ci-url]:https://github.com/hiloteam/Hilo3d/actions?query=workflow%3A%22npm+test%22+branch%3Adev
[ci-image]:https://img.shields.io/github/workflow/status/hiloteam/Hilo3d/npm%20test?style=flat-square
-[cdn-url]: https://cdn.jsdelivr.net/npm/hilo3d@1.15.20/build/Hilo3d.js
+[cdn-url]: https://cdn.jsdelivr.net/npm/hilo3d@1.16.0/build/Hilo3d.js
diff --git a/README_ZH.md b/README_ZH.md
index 10d59586..a5e27184 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -23,7 +23,7 @@
* 使用 script 标签加载 [cdn][cdn-url]
```
-
+
```
### 文档
@@ -122,4 +122,4 @@
[size-image]:https://img.badgesize.io/hiloteam/hilo3d/master/build/Hilo3d.js.svg?compression=gzip&style=flat-square
[ci-url]:https://github.com/hiloteam/Hilo3d/actions?query=workflow%3A%22npm+test%22+branch%3Adev
[ci-image]:https://img.shields.io/github/workflow/status/hiloteam/Hilo3d/npm%20test?style=flat-square
-[cdn-url]: https://cdn.jsdelivr.net/npm/hilo3d@1.15.20/build/Hilo3d.js
+[cdn-url]: https://cdn.jsdelivr.net/npm/hilo3d@1.16.0/build/Hilo3d.js
diff --git a/build/Hilo3d.js b/build/Hilo3d.js
index 0dd2aaa4..bc474096 100644
--- a/build/Hilo3d.js
+++ b/build/Hilo3d.js
@@ -1,5 +1,5 @@
/*!
- * Hilo3d 1.15.20
+ * Hilo3d 1.16.0
* Copyright (c) 2017-present Alibaba Group Holding Ltd.
* @license MIT
*/
@@ -31,9 +31,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-"undefined"!=typeof self&&self,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=10)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setMatrixArrayType=function(t){e.ARRAY_TYPE=t},e.toRadian=function(t){return t*i},e.equals=function(t,e){return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))};var r=e.EPSILON=1e-6;e.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,e.RANDOM=Math.random;var i=Math.PI/180},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.len=e.sqrDist=e.dist=e.div=e.mul=e.sub=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=a,e.multiply=s,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t[3]=Math.min(e[3],n[3]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t[3]=Math.max(e[3],n[3]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t},e.distance=u,e.squaredDistance=c,e.length=h,e.squaredLength=f,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a;return s>0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=a*s),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.lerp=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=s+r*(n[2]-s),t[3]=o+r*(n[3]-o),t},e.random=function(t,e){var n,i,a,s,o,u;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{u=(a=2*r.RANDOM()-1)*a+(s=2*r.RANDOM()-1)*s}while(u>=1);var c=Math.sqrt((1-o)/u);return t[0]=e*n,t[1]=e*i,t[2]=e*a*c,t[3]=e*s*c,t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*s,t},e.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2],c=n[3],h=c*r+o*a-u*i,f=c*i+u*r-s*a,l=c*a+s*i-o*r,d=-s*r-o*i-u*a;return t[0]=h*c+d*-s+f*-u-l*-o,t[1]=f*c+d*-o+l*-s-h*-u,t[2]=l*c+d*-u+h*-o-f*-s,t[3]=e[3],t},e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function h(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}function f(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.len=h,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=4),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u1?0:i<-1?Math.PI:Math.acos(i)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],u=e[2];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-u)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function a(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function s(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function l(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function d(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}function m(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.sub=o,e.mul=u,e.div=c,e.dist=h,e.sqrDist=f,e.len=a,e.sqrLen=l,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=3),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;ur.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n},e.multiply=h,e.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+s*o,t[1]=i*u+a*o,t[2]=a*u-i*o,t[3]=s*u-r*o,t},e.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u-a*o,t[1]=i*u+s*o,t[2]=a*u+r*o,t[3]=s*u-i*o,t},e.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*o,t[1]=i*u-r*o,t[2]=a*u+s*o,t[3]=s*u-a*o,t},e.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},e.slerp=f,e.random=function(t){var e=r.RANDOM(),n=r.RANDOM(),i=r.RANDOM(),a=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*n),t[1]=a*Math.cos(2*Math.PI*n),t[2]=s*Math.sin(2*Math.PI*i),t[3]=s*Math.cos(2*Math.PI*i),t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a,o=s?1/s:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=a*o,t},e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.fromMat3=l,e.fromEuler=function(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var a=Math.sin(e),s=Math.cos(e),o=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);return t[0]=a*u*h-s*o*c,t[1]=s*o*h+a*u*c,t[2]=s*u*c-a*o*h,t[3]=s*u*h+a*o*c,t},e.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var r=o(n(0)),i=o(n(5)),a=o(n(2)),s=o(n(1));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function u(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function h(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+s*o+i*c-a*u,t[1]=i*h+s*u+a*o-r*c,t[2]=a*h+s*c+r*u-i*o,t[3]=s*h-r*o-i*u-a*c,t}function f(t,e,n,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=n[0],h=n[1],f=n[2],l=n[3],d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return(m=a*c+s*h+o*f+u*l)<0&&(m=-m,c=-c,h=-h,f=-f,l=-l),1-m>r.EPSILON?(d=Math.acos(m),_=Math.sin(d),p=Math.sin((1-i)*d)/_,g=Math.sin(i*d)/_):(p=1-i,g=i),t[0]=p*a+g*c,t[1]=p*s+g*h,t[2]=p*o+g*f,t[3]=p*u+g*l,t}function l(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+s]-e[3*s+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}e.clone=s.clone,e.fromValues=s.fromValues,e.copy=s.copy,e.set=s.set,e.add=s.add,e.mul=h,e.scale=s.scale,e.dot=s.dot,e.lerp=s.lerp;var d=e.length=s.length,m=(e.len=d,e.squaredLength=s.squaredLength),_=(e.sqrLen=m,e.normalize=s.normalize);e.exactEquals=s.exactEquals,e.equals=s.equals,e.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),n=a.fromValues(0,1,0);return function(r,i,s){var o=a.dot(i,s);return o<-.999999?(a.cross(t,e,i),a.len(t)<1e-6&&a.cross(t,n,i),a.normalize(t,t),c(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,_(r,r))}}(),e.sqlerp=function(){var t=u(),e=u();return function(n,r,i,a,s,o){return f(t,r,s,o),f(e,i,a,o),f(n,t,e,2*o*(1-o)),n}}(),e.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],_(e,l(e,t))}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.fromValues=function(t,e,n,i,a,s,o,u,c,h,f,l,d,m,_,p){var g=new r.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=n,g[3]=i,g[4]=a,g[5]=s,g[6]=o,g[7]=u,g[8]=c,g[9]=h,g[10]=f,g[11]=l,g[12]=d,g[13]=m,g[14]=_,g[15]=p,g},e.set=function(t,e,n,r,i,a,s,o,u,c,h,f,l,d,m,_,p){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t[9]=h,t[10]=f,t[11]=l,t[12]=d,t[13]=m,t[14]=_,t[15]=p,t},e.identity=i,e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],a=e[6],s=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=i,t[13]=s,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(i*y-r*N-a*R)*x,t[2]=(_*L-p*A+g*M)*x,t[3]=(l*A-f*L-d*M)*x,t[4]=(u*S-s*N-c*O)*x,t[5]=(n*N-i*S+a*O)*x,t[6]=(p*T-m*L-g*E)*x,t[7]=(h*L-l*T+d*E)*x,t[8]=(s*y-o*S+c*I)*x,t[9]=(r*S-n*y-a*I)*x,t[10]=(m*A-_*T+g*v)*x,t[11]=(f*T-h*A-d*v)*x,t[12]=(o*O-s*R-u*I)*x,t[13]=(n*R-r*O+i*I)*x,t[14]=(_*E-m*M-p*v)*x,t[15]=(h*M-f*E+l*v)*x,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15];return t[0]=o*(l*g-d*p)-f*(u*g-c*p)+_*(u*d-c*l),t[1]=-(r*(l*g-d*p)-f*(i*g-a*p)+_*(i*d-a*l)),t[2]=r*(u*g-c*p)-o*(i*g-a*p)+_*(i*c-a*u),t[3]=-(r*(u*d-c*l)-o*(i*d-a*l)+f*(i*c-a*u)),t[4]=-(s*(l*g-d*p)-h*(u*g-c*p)+m*(u*d-c*l)),t[5]=n*(l*g-d*p)-h*(i*g-a*p)+m*(i*d-a*l),t[6]=-(n*(u*g-c*p)-s*(i*g-a*p)+m*(i*c-a*u)),t[7]=n*(u*d-c*l)-s*(i*d-a*l)+h*(i*c-a*u),t[8]=s*(f*g-d*_)-h*(o*g-c*_)+m*(o*d-c*f),t[9]=-(n*(f*g-d*_)-h*(r*g-a*_)+m*(r*d-a*f)),t[10]=n*(o*g-c*_)-s*(r*g-a*_)+m*(r*c-a*o),t[11]=-(n*(o*d-c*f)-s*(r*d-a*f)+h*(r*c-a*o)),t[12]=-(s*(f*p-l*_)-h*(o*p-u*_)+m*(o*l-u*f)),t[13]=n*(f*p-l*_)-h*(r*p-i*_)+m*(r*l-i*f),t[14]=-(n*(o*p-u*_)-s*(r*p-i*_)+m*(r*u-i*o)),t[15]=n*(o*l-u*f)-s*(r*l-i*f)+h*(r*u-i*o),t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8],h=t[9],f=t[10],l=t[11],d=t[12],m=t[13],_=t[14],p=t[15];return(e*s-n*a)*(f*p-l*_)-(e*o-r*a)*(h*p-l*m)+(e*u-i*a)*(h*_-f*m)+(n*o-r*s)*(c*p-l*d)-(n*u-i*s)*(c*_-f*d)+(r*u-i*o)*(c*m-h*d)},e.multiply=a,e.translate=function(t,e,n){var r=n[0],i=n[1],a=n[2],s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*a+e[12],t[13]=e[1]*r+e[5]*i+e[9]*a+e[13],t[14]=e[2]*r+e[6]*i+e[10]*a+e[14],t[15]=e[3]*r+e[7]*i+e[11]*a+e[15]):(s=e[0],o=e[1],u=e[2],c=e[3],h=e[4],f=e[5],l=e[6],d=e[7],m=e[8],_=e[9],p=e[10],g=e[11],t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=h,t[5]=f,t[6]=l,t[7]=d,t[8]=m,t[9]=_,t[10]=p,t[11]=g,t[12]=s*r+h*i+m*a+e[12],t[13]=o*r+f*i+_*a+e[13],t[14]=u*r+l*i+p*a+e[14],t[15]=c*r+d*i+g*a+e[15]),t},e.scale=function(t,e,n){var r=n[0],i=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.rotate=function(t,e,n,i){var a,s,o,u,c,h,f,l,d,m,_,p,g,v,E,T,M,A,L,I,O,S,R,y,N=i[0],x=i[1],b=i[2],C=Math.sqrt(N*N+x*x+b*b);return C0?(n[0]=2*(c*u+l*i+h*o-f*a)/d,n[1]=2*(h*u+l*a+f*i-c*o)/d,n[2]=2*(f*u+l*o+c*a-h*i)/d):(n[0]=2*(c*u+l*i+h*o-f*a),n[1]=2*(h*u+l*a+f*i-c*o),n[2]=2*(f*u+l*o+c*a-h*i)),s(t,e,n),t},e.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},e.getScaling=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[4],s=e[5],o=e[6],u=e[8],c=e[9],h=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(a*a+s*s+o*o),t[2]=Math.sqrt(u*u+c*c+h*h),t},e.getRotation=function(t,e){var n=e[0]+e[5]+e[10],r=0;return n>0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},e.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3],u=i+i,c=a+a,h=s+s,f=i*u,l=i*c,d=i*h,m=a*c,_=a*h,p=s*h,g=o*u,v=o*c,E=o*h,T=r[0],M=r[1],A=r[2];return t[0]=(1-(m+p))*T,t[1]=(l+E)*T,t[2]=(d-v)*T,t[3]=0,t[4]=(l-E)*M,t[5]=(1-(f+p))*M,t[6]=(_+g)*M,t[7]=0,t[8]=(d+v)*A,t[9]=(_-g)*A,t[10]=(1-(f+m))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=a+a,h=s+s,f=o+o,l=a*c,d=a*h,m=a*f,_=s*h,p=s*f,g=o*f,v=u*c,E=u*h,T=u*f,M=r[0],A=r[1],L=r[2],I=i[0],O=i[1],S=i[2],R=(1-(_+g))*M,y=(d+T)*M,N=(m-E)*M,x=(d-T)*A,b=(1-(l+g))*A,C=(p+v)*A,P=(m+E)*L,w=(p-v)*L,H=(1-(l+_))*L;return t[0]=R,t[1]=y,t[2]=N,t[3]=0,t[4]=x,t[5]=b,t[6]=C,t[7]=0,t[8]=P,t[9]=w,t[10]=H,t[11]=0,t[12]=n[0]+I-(R*I+x*O+P*S),t[13]=n[1]+O-(y*I+b*O+w*S),t[14]=n[2]+S-(N*I+C*O+H*S),t[15]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[1]=h+g,t[2]=l-p,t[3]=0,t[4]=h-g,t[5]=1-c-m,t[6]=d+_,t[7]=0,t[8]=l+p,t[9]=d-_,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,e,n,r,i,a,s){var o=1/(n-e),u=1/(i-r),c=1/(a-s);return t[0]=2*a*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*u,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*u,t[10]=(s+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*a*2*c,t[15]=0,t},e.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),s=void 0;return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(s=1/(r-i),t[10]=(i+r)*s,t[14]=2*i*r*s):(t[10]=-1,t[14]=-2*r),t},e.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+o),c=2/(i+a);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(s-o)*u*.5,t[9]=(i-a)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},e.ortho=function(t,e,n,r,i,a,s){var o=1/(e-n),u=1/(r-i),c=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*u,t[14]=(s+a)*c,t[15]=1,t},e.lookAt=function(t,e,n,a){var s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=e[0],g=e[1],v=e[2],E=a[0],T=a[1],M=a[2],A=n[0],L=n[1],I=n[2];return Math.abs(p-A)0&&(h*=d=1/Math.sqrt(d),f*=d,l*=d);var m=u*l-c*f,_=c*h-o*l,p=o*f-u*h;return(d=m*m+_*_+p*p)>0&&(m*=d=1/Math.sqrt(d),_*=d,p*=d),t[0]=m,t[1]=_,t[2]=p,t[3]=0,t[4]=f*p-l*_,t[5]=l*m-h*p,t[6]=h*_-f*m,t[7]=0,t[8]=h,t[9]=f,t[10]=l,t[11]=0,t[12]=i,t[13]=a,t[14]=s,t[15]=1,t},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},e.subtract=o,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=t[9],d=t[10],m=t[11],_=t[12],p=t[13],g=t[14],v=t[15],E=e[0],T=e[1],M=e[2],A=e[3],L=e[4],I=e[5],O=e[6],S=e[7],R=e[8],y=e[9],N=e[10],x=e[11],b=e[12],C=e[13],P=e[14],w=e[15];return Math.abs(n-E)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-M)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-A)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(o-L)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(u-I)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-O)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(h-S)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-R)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(l-y)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(d-N)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(N))&&Math.abs(m-x)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(x))&&Math.abs(_-b)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(b))&&Math.abs(p-C)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(g-P)<=r.EPSILON*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(v-w)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(w))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function a(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=e[9],d=e[10],m=e[11],_=e[12],p=e[13],g=e[14],v=e[15],E=n[0],T=n[1],M=n[2],A=n[3];return t[0]=E*r+T*o+M*f+A*_,t[1]=E*i+T*u+M*l+A*p,t[2]=E*a+T*c+M*d+A*g,t[3]=E*s+T*h+M*m+A*v,E=n[4],T=n[5],M=n[6],A=n[7],t[4]=E*r+T*o+M*f+A*_,t[5]=E*i+T*u+M*l+A*p,t[6]=E*a+T*c+M*d+A*g,t[7]=E*s+T*h+M*m+A*v,E=n[8],T=n[9],M=n[10],A=n[11],t[8]=E*r+T*o+M*f+A*_,t[9]=E*i+T*u+M*l+A*p,t[10]=E*a+T*c+M*d+A*g,t[11]=E*s+T*h+M*m+A*v,E=n[12],T=n[13],M=n[14],A=n[15],t[12]=E*r+T*o+M*f+A*_,t[13]=E*i+T*u+M*l+A*p,t[14]=E*a+T*c+M*d+A*g,t[15]=E*s+T*h+M*m+A*v,t}function s(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=r+r,u=i+i,c=a+a,h=r*o,f=r*u,l=r*c,d=i*u,m=i*c,_=a*c,p=s*o,g=s*u,v=s*c;return t[0]=1-(d+_),t[1]=f+v,t[2]=l-g,t[3]=0,t[4]=f-v,t[5]=1-(h+_),t[6]=m+p,t[7]=0,t[8]=l+g,t[9]=m-p,t[10]=1-(h+d),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}e.mul=a,e.sub=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},e.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},e.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromValues=function(t,e,n,i,a,s,o,u,c){var h=new r.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=n,h[3]=i,h[4]=a,h[5]=s,h[6]=o,h[7]=u,h[8]=c,h},e.set=function(t,e,n,r,i,a,s,o,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else 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];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=h*s-o*c,l=-h*a+o*u,d=c*a-s*u,m=n*f+r*l+i*d;return m?(m=1/m,t[0]=f*m,t[1]=(-h*r+i*c)*m,t[2]=(o*r-i*s)*m,t[3]=l*m,t[4]=(h*n-i*u)*m,t[5]=(-o*n+i*a)*m,t[6]=d*m,t[7]=(-c*n+r*u)*m,t[8]=(s*n-r*a)*m,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8];return t[0]=s*h-o*c,t[1]=i*c-r*h,t[2]=r*o-i*s,t[3]=o*u-a*h,t[4]=n*h-i*u,t[5]=i*a-n*o,t[6]=a*c-s*u,t[7]=r*u-n*c,t[8]=n*s-r*a,t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8];return e*(c*a-s*u)+n*(-c*i+s*o)+r*(u*i-a*o)},e.multiply=i,e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=u,t[6]=l*r+d*s+c,t[7]=l*i+d*o+h,t[8]=l*a+d*u+f,t},e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=Math.sin(n),d=Math.cos(n);return t[0]=d*r+l*s,t[1]=d*i+l*o,t[2]=d*a+l*u,t[3]=d*s-l*r,t[4]=d*o-l*i,t[5]=d*u-l*a,t[6]=c,t[7]=h,t[8]=f,t},e.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[3]=h-g,t[6]=l+p,t[1]=h+g,t[4]=1-c-m,t[7]=d-_,t[2]=l-p,t[5]=d+_,t[8]=1-c-f,t},e.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(u*S-s*N-c*O)*x,t[2]=(s*y-o*S+c*I)*x,t[3]=(i*y-r*N-a*R)*x,t[4]=(n*N-i*S+a*O)*x,t[5]=(r*S-n*y-a*I)*x,t[6]=(_*L-p*A+g*M)*x,t[7]=(p*T-m*L-g*E)*x,t[8]=(m*A-_*T+g*v)*x,t):null},e.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=e[0],d=e[1],m=e[2],_=e[3],p=e[4],g=e[5],v=e[6],E=e[7],T=e[8];return Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-d)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-m)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(s-_)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(o-p)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(u-g)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-v)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(h-E)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-T)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(T))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1],m=n[2],_=n[3],p=n[4],g=n[5],v=n[6],E=n[7],T=n[8];return t[0]=l*r+d*s+m*c,t[1]=l*i+d*o+m*h,t[2]=l*a+d*u+m*f,t[3]=_*r+p*s+g*c,t[4]=_*i+p*o+g*h,t[5]=_*a+p*u+g*f,t[6]=v*r+E*s+T*c,t[7]=v*i+E*o+T*h,t[8]=v*a+E*u+T*f,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.sqrDist=e.dist=e.div=e.mul=e.sub=e.len=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},e.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},e.set=function(t,e,n){return t[0]=e,t[1]=n,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},e.subtract=a,e.multiply=s,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},e.distance=u,e.squaredDistance=c,e.length=h,e.squaredLength=f,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},e.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},e.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},e.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},e.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},e.rotate=function(t,e,n,r){var i=e[0]-n[0],a=e[1]-n[1],s=Math.sin(r),o=Math.cos(r);return t[0]=i*o-a*s+n[0],t[1]=i*s+a*o+n[1],t},e.angle=function(t,e){var n=t[0],r=t[1],i=e[0],a=e[1],s=n*n+r*r;s>0&&(s=1/Math.sqrt(s));var o=i*i+a*a;o>0&&(o=1/Math.sqrt(o));var u=(n*i+r*a)*s*o;return u>1?0:u<-1?Math.PI:Math.acos(u)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],a=e[0],s=e[1];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function h(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function f(t){var e=t[0],n=t[1];return e*e+n*n}e.len=h,e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=2),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,a=e[2]/n,s=e[3]/n,o=e[4],u=e[5],c=e[6],h=e[7],f=r*o+i*u+a*c+s*h;t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=(o-r*f)/n,t[5]=(u-i*f)/n,t[6]=(c-a*f)/n,t[7]=(h-s*f)/n}return t},e.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=e[0],l=e[1],d=e[2],m=e[3],_=e[4],p=e[5],g=e[6],v=e[7];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-m)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-_)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(u-p)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(c-g)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(h-v)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))};var r=s(n(0)),i=s(n(3)),a=s(n(4));function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e,n){var r=.5*n[0],i=.5*n[1],a=.5*n[2],s=e[0],o=e[1],u=e[2],c=e[3];return t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=r*c+i*u-a*o,t[5]=i*c+a*s-r*u,t[6]=a*c+r*o-i*s,t[7]=-r*s-i*o-a*u,t}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[4],u=n[5],c=n[6],h=n[7],f=e[4],l=e[5],d=e[6],m=e[7],_=n[0],p=n[1],g=n[2],v=n[3];return t[0]=r*v+s*_+i*g-a*p,t[1]=i*v+s*p+a*_-r*g,t[2]=a*v+s*g+r*p-i*_,t[3]=s*v-r*_-i*p-a*g,t[4]=r*h+s*o+i*c-a*u+f*v+m*_+l*g-d*p,t[5]=i*h+s*u+a*o-r*c+l*v+m*p+d*_-f*g,t[6]=a*h+s*c+r*u-i*o+d*v+m*g+f*p-l*_,t[7]=s*h-r*o-i*u-a*c+m*v-f*_-l*p-d*g,t}e.getReal=i.copy,e.setReal=i.copy,e.mul=c;var h=e.dot=i.dot,f=e.length=i.length,l=(e.len=f,e.squaredLength=i.squaredLength);e.sqrLen=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.fromValues=function(t,e,n,i,a,s){var o=new r.ARRAY_TYPE(6);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o[4]=a,o[5]=s,o},e.set=function(t,e,n,r,i,a,s){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=n*a-r*i;return u?(u=1/u,t[0]=a*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t[4]=(i*o-a*s)*u,t[5]=(r*s-n*o)*u,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=Math.sin(n),h=Math.cos(n);return t[0]=r*h+a*c,t[1]=i*h+s*c,t[2]=r*-c+a*h,t[3]=i*-c+s*h,t[4]=o,t[5]=u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r*c,t[1]=i*c,t[2]=a*h,t[3]=s*h,t[4]=o,t[5]=u,t},e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=r*c+a*h+o,t[5]=i*c+s*h+u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=e[0],h=e[1],f=e[2],l=e[3],d=e[4],m=e[5];return Math.abs(n-c)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-f)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-l)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-d)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(u-m)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(m))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1],f=n[2],l=n[3],d=n[4],m=n[5];return t[0]=r*c+a*h,t[1]=i*c+s*h,t[2]=r*f+a*l,t[3]=i*f+s*l,t[4]=r*d+a*m+o,t[5]=i*d+s*m+u,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*a-i*r;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-i*s,t[3]=n*s,t):null},e.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*o,t[1]=i*u+s*o,t[2]=r*-o+a*u,t[3]=i*-o+s*u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1];return t[0]=r*o,t[1]=i*o,t[2]=a*u,t[3]=s*u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=a,e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))},e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*o+a*u,t[1]=i*o+s*u,t[2]=r*c+a*h,t[3]=i*c+s*h,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.vec4=e.vec3=e.vec2=e.quat2=e.quat=e.mat4=e.mat3=e.mat2d=e.mat2=e.glMatrix=void 0;var r=d(n(0)),i=d(n(9)),a=d(n(8)),s=d(n(5)),o=d(n(4)),u=d(n(3)),c=d(n(7)),h=d(n(6)),f=d(n(2)),l=d(n(1));function d(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.glMatrix=r,e.mat2=i,e.mat2d=a,e.mat3=s,e.mat4=o,e.quat=u,e.quat2=c,e.vec2=h,e.vec3=f,e.vec4=l}])},function(t,e,n){"use strict";var r=function(){var t,e;try{t=Object.defineProperty,e=Object.defineProperties,t({},"$",{value:0})}catch(n){"__defineGetter__"in Object&&(t=function(t,e,n){return"value"in n&&(t[e]=n.value),"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),t},e=function(e,n){for(var r in n)n.hasOwnProperty(r)&&t(e,r,n[r]);return e})}var n=function(t){for(var n=1,r=arguments.length;n>1,s=n(t[a],e);if(0===s)return[a,a];s<0?r=a+1:i=a-1}return r>i?[i,r]:[r,i]}function v(t,e,n){var r=g(t,e,n);t.splice(r[1],0,e)}function E(t,e,n){return e<=t.length?t:new Array(e-t.length+1).join(n||"0")+t}function T(t){return t instanceof Float32Array?l:t instanceof Int8Array?o:t instanceof Uint8Array?u:t instanceof Int16Array?c:t instanceof Uint16Array?h:t instanceof Uint32Array?f:l}var M,A,L=(a(M={},o,Int8Array),a(M,u,Uint8Array),a(M,c,Int16Array),a(M,h,Uint16Array),a(M,f,Uint32Array),a(M,l,Float32Array),A=M,function(t){return A[t]||Float32Array});function I(t,e,n,r,i){if(t&&e){e.isGeometryData&&(e=e.data);for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return Array.isArray(t)||(t=Object.values(t)),t.reduce((function(t,n,r){return t.then((function(){return e(n,r)}))}),Promise.resolve())}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector3",isVector3:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec3.round(this.elements,this.elements),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},random:function(t){return r.vec3.random(this.elements,t),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r,i={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r=0,function(t){var e=++r;return t?e=t+"_"+e:e+="",e}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},degToRad:function(t){return t*this.DEG2RAD},radToDeg:function(t){return t*this.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};e.a=i},function(t,e,n){"use strict";var r,i=n(0),a=n(1),s=n(5),o=n(10),u=new s.a,c=new s.a,h=a.a.create({className:"Matrix4",isMatrix4:!0,constructor:function(){this.elements=i.mat4.create()},copy:function(t){return i.mat4.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return i.mat4.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this},identity:function(){return i.mat4.identity(this.elements),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this},fromRotationTranslationScaleOrigin:function(t,e,n,r){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this},lookAt:function(t,e,n){return t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this},targetTo:function(t,e,n){t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],h=n[1],f=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=h*m-f*d,g=f*l-o*m,v=o*d-h*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=h*m-f*d)*p+(g=f*l-(o+=1e-7)*m)*g+(v=o*d-h*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new h),this.determinant()<0&&(n.x*=-1),r.copy(this),u.inverse(n),r.scale(u),t.fromMat4(r),i&&i.set(0,0,0),this}});h.prototype.sub=h.prototype.subtract,h.prototype.mul=h.prototype.multiply,e.a=h},function(t,e,n){"use strict";var r=n(1),i=n(12),a=n(4),s=r.a.create({Extends:i.a,className:"Color",isColor:!0,r:{get:function(){return this.x},set:function(t){this.x=t}},g:{get:function(){return this.y},set:function(t){this.y=t}},b:{get:function(){return this.z},set:function(t){this.z=t}},a:{get:function(){return this.w},set:function(t){this.w=t}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;s.superclass.constructor.call(this,t,e,n,r)},toRGBArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t},fromUintArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e]/255,this.elements[1]=t[e+1]/255,this.elements[2]=t[e+2]/255,this.elements[3]=t[e+3]/255,this},fromHEX:function(t){return"number"==typeof t?t=Object(a.padLeft)(t.toString(16),6):("#"===t[0]&&(t=t.slice(1)),3===t.length&&(t=t.replace(/(\w)/g,"$1$1"))),this.elements[0]=parseInt(t.slice(0,2),16)/255,this.elements[1]=parseInt(t.slice(2,4),16)/255,this.elements[2]=parseInt(t.slice(4,6),16)/255,this},toHEX:function(){for(var t="",e=0;e<3;e++)t+=Object(a.padLeft)(Math.floor(255*this.elements[e]).toString(16),2);return t}});e.a=s},function(t,e,n){"use strict";var r=n(1).a.create({constructor:function(t,e,n){this.type=t,this.target=e,this.detail=n,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),i={_listeners:null,on:function(t,e,n){for(var r=this._listeners=this._listeners||{},i=r[t]=r[t]||[],a=0,s=i.length;a0){if(1===arguments.length)return delete this._listeners[t],this;for(var r=0,i=n.length;r0){var o=s.slice(0);if((n=n||new r(i,this,e))._stopped)return!1;for(var u=0;u-1&&s.splice(h,1)}}return!0}return!1}};e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(11),a=n(1),s=n(9),o=new i.a,u=a.a.create({Mixes:s.a,className:"Quaternion",isQuaternion:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.elements=r.quat.fromValues(t,e,n,i)},copy:function(t,e){return r.quat.copy(this.elements,t.elements),e||this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=this.elements;return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n||this.fire("update"),this},set:function(t,e,n,i,a){return r.quat.set(this.elements,t,e,n,i),a||this.fire("update"),this},identity:function(t){return r.quat.identity(this.elements),t||this.fire("update"),this},rotationTo:function(t,e,n){return r.quat.rotationTo(this.elements,t.elements,e.elements),n||this.fire("update"),this},setAxes:function(t,e,n,i){return r.quat.setAxes(this.elements,t.elements,e.elements,n.elements),i||this.fire("update"),this},setAxisAngle:function(t,e,n){return r.quat.setAxisAngle(this.elements,t.elements,e),n||this.fire("update"),this},getAxisAngle:function(t){return r.quat.getAxisAngle(t.elements,this.elements)},add:function(t,e){return r.quat.add(this.elements,this.elements,t.elements),e||this.fire("update"),this},multiply:function(t,e){return r.quat.multiply(this.elements,this.elements,t.elements),e||this.fire("update"),this},premultiply:function(t,e){return r.quat.multiply(this.elements,t.elements,this.elements),e||this.fire("update"),this},scale:function(t,e){return r.quat.scale(this.elements,this.elements,t),e||this.fire("update"),this},rotateX:function(t,e){return r.quat.rotateX(this.elements,this.elements,t),e||this.fire("update"),this},rotateY:function(t,e){return r.quat.rotateY(this.elements,this.elements,t),e||this.fire("update"),this},rotateZ:function(t,e){return r.quat.rotateZ(this.elements,this.elements,t),e||this.fire("update"),this},calculateW:function(t){return r.quat.calculateW(this.elements,this.elements),t||this.fire("update"),this},dot:function(t){return r.quat.dot(this.elements,t.elements)},lerp:function(t,e,n){return r.quat.lerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},slerp:function(t,e,n){return r.quat.slerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},sqlerp:function(t,e,n,i,a,s){return r.quat.sqlerp(this.elements,t.elements,e.elements,n.elements,i.elements,a),s||this.fire("update"),this},invert:function(t){return r.quat.invert(this.elements,this.elements),t||this.fire("update"),this},conjugate:function(t){return r.quat.conjugate(this.elements,this.elements),t||this.fire("update"),this},length:function(){return r.quat.length(this.elements)},squaredLength:function(){return r.quat.squaredLength(this.elements)},normalize:function(t){return r.quat.normalize(this.elements,this.elements),t||this.fire("update"),this},fromMat3:function(t,e){return r.quat.fromMat3(this.elements,t.elements),e||this.fire("update"),this},fromMat4:function(t,e){return o.fromMat4(t),this.fromMat3(o,e),this},exactEquals:function(t){return r.quat.exactEquals(this.elements,t.elements)},equals:function(t){return r.quat.equals(this.elements,t.elements)},fromEuler:function(t,e){var n=.5*t.x,r=.5*t.y,i=.5*t.z,a=t.order||"ZYX",s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),c=Math.cos(r),h=Math.sin(i),f=Math.cos(i),l=this.elements;return"XYZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"YXZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"ZXY"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"ZYX"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"YZX"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f-s*u*h):"XZY"===a&&(l[0]=s*c*f-o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f+s*u*h),e||this.fire("update"),this},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t,this.fire("update")}}});u.prototype.mul=u.prototype.multiply,u.prototype.len=u.prototype.length,u.prototype.sqrLen=u.prototype.squaredLength,e.a=u},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Matrix3",isMatrix3:!0,constructor:function(){this.elements=r.mat3.create()},copy:function(t){return r.mat3.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return r.mat3.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)n[r]=t[e+r];return this},set:function(t,e,n,i,a,s,o,u,c){return r.mat3.set(this.elements,t,e,n,i,a,s,o,u,c),this},identity:function(){return r.mat3.identity(this.elements),this},transpose:function(){return r.mat3.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.adjoint(this.elements,t.elements),this},determinant:function(){return r.mat3.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),r.mat3.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return r.mat3.translate(this.elements,this.elements,t.elements),this},rotate:function(t){return r.mat3.rotate(this.elements,this.elements,t),this},scale:function(t){return r.mat3.scale(this.elements,this.elements,t.elements),this},fromTranslation:function(t){return r.mat3.fromTranslation(this.elements,t.elements),this},fromRotation:function(t){return r.mat3.fromRotation(this.elements,t),this},fromScaling:function(t){return r.mat3.fromScaling(this.elements,t.elements),this},fromQuat:function(t){return r.mat3.fromQuat(this.elements,t.elements),this},normalFromMat4:function(t){return r.mat3.normalFromMat4(this.elements,t.elements),this},fromMat4:function(t){return r.mat3.fromMat4(this.elements,t.elements),this},frob:function(){return r.mat3.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),r.mat3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.mat3.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.mat3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.mat3.equals(t.elements,e.elements)},fromRotationTranslationScale:function(t,e,n,r,i){var a=Math.cos(t),s=Math.sin(t);return this.set(r*a,-i*s,0,r*s,i*a,0,e,n,1),this}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector4",isVector4:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.elements=r.vec4.fromValues(t,e,n,i)},copy:function(t){return r.vec4.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t[3+e]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],this},set:function(t,e,n,i){return r.vec4.set(this.elements,t,e,n,i),this},add:function(t,e){return e||(e=t,t=this),r.vec4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec4.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec4.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec4.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec4.ceil(this.elements,this.elements),this},floor:function(){return r.vec4.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec4.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec4.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec4.round(this.elements,this.elements),this},scale:function(t){return r.vec4.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec4.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec4.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec4.squaredDistance(t.elements,e.elements)},length:function(){return r.vec4.length(this.elements)},squaredLength:function(){return r.vec4.squaredLength(this.elements)},negate:function(){return r.vec4.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec4.inverse(this.elements,t.elements),this},normalize:function(){return r.vec4.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec4.dot(t.elements,e.elements)},lerp:function(t,e){return r.vec4.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return t=t||1,this.elements[0]=Math.random(),this.elements[1]=Math.random(),this.elements[2]=Math.random(),this.elements[3]=Math.random(),this.normalize(),this.scale(t),this},transformMat4:function(t){return r.vec4.transformMat4(this.elements,this.elements,t.elements),this},transformQuat:function(t){return r.vec4.transformQuat(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec4.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r=n(1),i=n(6),a=n(7),s=n(3),o=new a.a,u=i.a.DEG2RAD,c=i.a.RAD2DEG,h=r.a.create({className:"Euler",isEuler:!0,order:"ZYX",constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=new Float32Array([t,e,n]),this.updateDegrees()},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.elements[0]=t.x,this.elements[1]=t.y,this.elements[2]=t.z,this.order=t.order,this.updateDegrees(),this},set:function(t,e,n){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=n,this.updateDegrees(),this},setDegree:function(t,e,n){return this._degX=t,this._degY=e,this._degZ=n,this.updateRadians(),this},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e],this.elements[1]=t[e+1],this.elements[2]=t[e+2],this.updateDegrees(),this},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.elements[0],t[e+1]=this.elements[1],t[e+2]=this.elements[2],t},fromMat4:function(t,e){var n=t.elements,r=n[0],a=n[1],o=n[2],u=n[4],c=n[5],h=n[6],f=n[8],l=n[9],d=n[10];e=e||this.order,this.order=e;var m=i.a.clamp;return"XYZ"===e?(this.elements[1]=Math.asin(m(f,-1,1)),Math.abs(f)<.99999?(this.elements[0]=Math.atan2(-l,d),this.elements[2]=Math.atan2(-u,r)):(this.elements[0]=Math.atan2(h,c),this.elements[2]=0)):"YXZ"===e?(this.elements[0]=Math.asin(-m(l,-1,1)),Math.abs(l)<.99999?(this.elements[1]=Math.atan2(f,d),this.elements[2]=Math.atan2(a,c)):(this.elements[1]=Math.atan2(-o,r),this.elements[2]=0)):"ZXY"===e?(this.elements[0]=Math.asin(m(h,-1,1)),Math.abs(h)<.99999?(this.elements[1]=Math.atan2(-o,d),this.elements[2]=Math.atan2(-u,c)):(this.elements[1]=0,this.elements[2]=Math.atan2(a,r))):"ZYX"===e?(this.elements[1]=Math.asin(-m(o,-1,1)),Math.abs(o)<.99999?(this.elements[0]=Math.atan2(h,d),this.elements[2]=Math.atan2(a,r)):(this.elements[0]=0,this.elements[2]=Math.atan2(-u,c))):"YZX"===e?(this.elements[2]=Math.asin(m(a,-1,1)),Math.abs(a)<.99999?(this.elements[0]=Math.atan2(-l,c),this.elements[1]=Math.atan2(-o,r)):(this.elements[0]=0,this.elements[1]=Math.atan2(f,d))):"XZY"===e?(this.elements[2]=Math.asin(-m(u,-1,1)),Math.abs(u)<.99999?(this.elements[0]=Math.atan2(h,c),this.elements[1]=Math.atan2(f,r)):(this.elements[0]=Math.atan2(-l,d),this.elements[1]=0)):s.a.warn("Euler fromMat4() unsupported order: "+e),this.updateDegrees(),this},fromQuat:function(t,e){return o.fromQuat(t),this.fromMat4(o,e)},updateDegrees:function(){return this._degX=this.elements[0]*c,this._degY=this.elements[1]*c,this._degZ=this.elements[2]*c,this},updateRadians:function(){return this.elements[0]=this._degX*u,this.elements[1]=this._degY*u,this.elements[2]=this._degZ*u,this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*u}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*u}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*u}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*c}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*c}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*c}}});e.a=h},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector2",isVector2:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.elements=r.vec2.fromValues(t,e)},copy:function(t){return r.vec2.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],this},set:function(t,e){return r.vec2.set(this.elements,t,e),this},add:function(t,e){return e||(e=t,t=this),r.vec2.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec2.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec2.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec2.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec2.ceil(this.elements,this.elements),this},floor:function(){return r.vec2.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec2.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec2.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec2.round(this.elements,this.elements),this},scale:function(t){return r.vec2.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec2.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec2.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec2.squaredDistance(t.elements,e.elements)},length:function(){return r.vec2.length(this.elements)},squaredLength:function(){return r.vec2.squaredLength(this.elements)},negate:function(){return r.vec2.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec2.inverse(this.elements,t.elements),this},normalize:function(){return r.vec2.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec2.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec2.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec2.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return r.vec2.random(this.elements,t),this},transformMat3:function(t){return r.vec2.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec2.transformMat4(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec2.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec2.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){function r(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:4;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.indices=e,this.mode=n,this.attrs=[],this.attrIndexMap={}}return i(t,null,[{key:"cp",value:function(t){return t}},{key:"minus",value:function(t,e){return t-e}},{key:"plus",value:function(t,e){return t+e}},{key:"pp",value:function(t,e,n,r){return r-e-n+t}},{key:"depp",value:function(t,e,n,r){return e+n-t+r}},{key:"ATTR",get:function(){return s}},{key:"ATTR_NAME_ID",get:function(){return u}}]),i(t,[{key:"getAttrLength",value:function(){return this.attrs[0].data.length/this.attrs[0].itemCount}},{key:"attrIdToName",value:function(t){return o[t]||"OTHER"}},{key:"addAttr",value:function(t,e,n){s[t]?(this.attrIndexMap[t]=this.attrs.length,n||(n=f[t])):n||(n=1),this.attrs.push({name:t,itemCount:n,data:e})}},{key:"getAttr",value:function(t){if(this.attrIndexMap[t])return this.attrs[this.attrIndexMap[t]];for(var e=this.attrs.length-1;e>=0;e--){var n=this.attrs[e];if(n.name===t)return n}}},{key:"cal",value:function(t,e,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a=0;c--)o[u+c]=n.apply(null,i.map((function(t){return s[t*r.itemCount+c]})))}))}},{key:"quantize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attrs.forEach((function(e){if("JOINT"!==e.name&&0!=t[e.name]){var n=a.encode(e.data,t[e.name]||12);e.quantizationBit=n.quantizationBit,e.min=n.min,e.max=n.max,e.data=n.data}}))}},{key:"dequantize",value:function(){this.attrs.forEach((function(t){t.quantizationBit&&(t.data=a.decode(t.data,t.quantizationBit,t.min,t.max))}))}},{key:"convertTypedArray",value:function(){!this.indices||this.indices instanceof Array||(this.indices=Array.from(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array||t.data instanceof Float32Array||(t.data=Array.from(t.data))}))}},{key:"clearEBAttrs",value:function(){delete this.clers,delete this.holes,delete this.handles}},{key:"convertToTypedArray",value:function(){this.indices instanceof Array&&(this.getAttrLength()>65535?this.indices=new Uint32Array(this.indices):this.indices=new Uint16Array(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array&&(t.data=new Float32Array(t.data))}))}},{key:"prepareToWorkerSend",value:function(){return this.clearEBAttrs(),this.convertToTypedArray(),this.getAllBuffers()}},{key:"clone",value:function(){var e=new t(Array.from(this.indices),this.mode);return Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=Array.from(e.data),e})),e}},{key:"cloneStruct",value:function(){var e=new t;return e.mode=this.mode,this.indices&&(e.indices=[]),Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=[],e})),e}},{key:"toHilo3dGeometry",value:function(t,e){var n=e||new t.Geometry;return this.indices&&(this.indices.BYTES_PER_ELEMENT?n.indices=new t.GeometryData(this.indices,1):this.getAttrLength()>65535?n.indices=new t.GeometryData(new Uint32Array(this.indices),1):n.indices=new t.GeometryData(new Uint16Array(this.indices),1)),this.attrs.forEach((function(e){var r=c[e.name];r&&(e.data.BYTES_PER_ELEMENT?n[r]=new t.GeometryData(e.data,e.itemCount):n[r]=new t.GeometryData(new Float32Array(e.data),e.itemCount))})),n}},{key:"getAllBuffers",value:function(){var t=[];return this.indices.BYTES_PER_ELEMENT&&t.push(this.indices.buffer),this.attrs.forEach((function(e){e.data&&e.data.BYTES_PER_ELEMENT&&t.push(e.data.buffer)})),t}}],[{key:"fromGLTFPrimitive",value:function(e){var n=new t(e.indices,e.mode),r=e.attributes,i=0;for(var a in r.POSITION&&(i=r.POSITION.length/3),r)if(s[a]){var o=f[s[a]];i&&(o=r[a].length/i),n.addAttr(s[a],r[a],o)}else console.warn("Dont support attribute",a);return n}},{key:"fromHilo3dGeometry",value:function(e){var n=new t(e.indices.data,e.mode);for(var r in h)e[r]&&n.addAttr(h[r],e[r].data,e[r].size);return n}}]),t}();t.exports=l},function(t,e){var n={};function r(t){return n[t]||(n[t]=Math.pow(2,t)-1),n[t]}t.exports={cal:function(t,e,n,i){var a=r(i),s=n-e;return Math.round((t-e)/s*a)},encode:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=t.length,i=r(e),a=1/0,s=-1/0,o=0;o1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8,s=t.length,o=r(a),u=i-n||1,c=0;c1&&void 0!==arguments[1]?arguments[1]:8,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=t.length,s=r(e),o=i-n,u=new Float32Array(a),c=0;c1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=t.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return t instanceof Uint8Array&&(e=t.byteOffset,t=t.buffer),function(t){return new u[t.type](t).decompress()}(function(t,e){var n=new Uint8Array(t,e,4);if(65!==n[0]||77!==n[1]||67!==n[2])throw new Error("The file is not AMC format!");var r=c[n[3]].read(t,e+4);return r.geometry.type=n[3],r.geometry}(t,e))}var f,l=null,d=null;function m(t,e){return!l&&o()?(l=new s({wasmURL:t,memPages:e}),d=l.init()):d||Promise.resolve()}function _(t,e,n){if(l||m(e,n),!l||!l.isReady)return h(t);try{return l.decompress(t)}catch(e){return console.warn("wasm decompress error",e),h(t)}}var p=null;function g(t){return t=t||"https://g.alicdn.com/hilo/amc/0.1.27/worker.js",p||(!1===f||"undefined"==typeof Worker?Promise.reject("dont support web worker"):p=/^(?:http|blob|data:|\/\/)/.test(t)?new Promise((function(e,n){var r=new XMLHttpRequest;r.addEventListener("load",(function(){if("undefined"==typeof URL||"undefined"==typeof Blob)f=new Worker("data:application/javascript, ".concat(this.responseText));else{var t=URL.createObjectURL(new Blob([this.responseText]));f=new Worker(t)}f.onerror=function(t){console.log("web worker error",t),f=!1,n(t)},e(f)})),r.addEventListener("error",(function(t){return n(t)})),r.open("get",t,!0),r.send()})):new Promise((function(e,n){(f=new Worker(t)).onerror=function(t){console.log("web worker init error",t),f=!1,n(t)},e(f)})))}var v=0;function E(t,e,n,i){return e=e&&o(),t=new Uint8Array(t),g(i).then((function(i){return new Promise((function(a,s){var o=v++,u=function(e){if(e.data.id===o)if(i.removeEventListener("message",u),u=null,e.data.data){var n=e.data.data;n.constructor=r,n.__proto__=r.prototype,a(n)}else a(h(t))};i.addEventListener("message",u),i.postMessage({id:o,data:t,useWASM:e,wasmURL:n},[t.buffer])}))})).catch((function(r){return e?_(t,n):h(t)}))}t.exports={initWASM:m,initWorker:g,decompress:function(t,e,n){var r=o();return!r||t.byteLength>1048576?E(t,r,e,n):r?Promise.resolve(_(t,e)):Promise.resolve(h(t))},decompressWithJS:h,decompressWithWASM:_,decompressWithWorker:E,destory:function(){f&&(f.terminate(),f=null,p=null),l&&(l=null,d=null)}}},function(t,e,n){function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e=0;n-=2)e[t[n]]=t[n-1]}},{key:"mapBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex,i=this.currentVertex-n+1,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r,r=i,e[this.prevCorner(t[a])]=i++;this.currentVertex-=n}},{key:"mapHoleBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex-n+1,i=r,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r++,e[this.prevCorner(t[a])]=a?r:i;this.currentVertex-=n}},{key:"fixNegativeIndex",value:function(t){for(var e=t,n=this.indices;n[t]<0;){if(e===-n[-n[t]]||n[t]===n[-n[t]]){console.warn("dead loop bug!!"),n[s]=0;break}n[t]=n[-n[t]]}}},{key:"fixIndicesAndReadVertice",value:function(){for(var t,e=this.indices,n=this.handlesMap,r=this.clers,i=r.length,a=-1,s=[],u=0,c=0;u1&&void 0!==arguments[1]?arguments[1]:-1;if(!this.readedVertexMap[t]&&(this.readedVertexMap[t]=1,!this.noParallelogramPrediction)){var n=this.indices,r=this.geometry;-1===e?void 0!==this.lastReadVertexIndex&&r.cal(r,t,a.plus,this.lastReadVertexIndex,t):r.cal(r,t,a.depp,n[e],n[this.prevCorner(e)],n[this.nextCorner(e)],t),this.lastReadVertexIndex=t}}},{key:"markCorner",value:function(t,e){var n=this.indices;void 0===n[this.nextCorner(t)]&&(n[this.nextCorner(t)]=-this.prevCorner(e[0])),void 0===n[this.prevCorner(t)]&&(n[this.prevCorner(t)]=-this.nextCorner(e[e.length-1]))}},{key:"onFaceC",value:function(t){var e=this.indices,n=3*this.currentFace,r=this.currentVertex--;e[n]=r;var i=t.pop();return e[this.nextCorner(i)]=r,e[this.prevCorner(i)]=-this.nextCorner(t[t.length-1]),i=t.shift(),e[this.prevCorner(i)]=r,e[this.nextCorner(i)]=-this.prevCorner(t[0]),t.push(n),t}},{key:"onFaceL",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.unshift(e+2),t.push(e),t}},{key:"onFaceF",value:function(t,e){return t&&this.mapBoundary(t),this.onFaceE(null,e)}},{key:"onFaceE",value:function(t,e){var n=3*this.currentFace;return t&&e.push(t),[n+2,n+1,n]}},{key:"onFaceR",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.push(e+1,e),t}},{key:"onHandleEnd",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=this.handlesMap[this.currentFace],s=e.splice(0,t);return e.shift(),n.push(s),r[this.nextCorner(a)]=-(i+1),r[this.prevCorner(a)]=-this.nextCorner(s[s.length-1]),r[i]=-this.prevCorner(s[0]),e.push(i),e}},{key:"onHandleStart",value:function(t,e){for(var n,i=this.indices,a=3*this.currentFace,s=this.handlesMap[this.currentFace],o=e.length-1;o>=0;o--){var u=e[o].indexOf(s);if(u>=0){var c,h=(n=e.splice(o,1)[0]).splice(0,u);n.shift(),(c=n).push.apply(c,r(h));break}}return i[this.nextCorner(s)]=-(a+1),i[this.prevCorner(s)]=-this.nextCorner(n[n.length-1]),i[a]=-this.prevCorner(t[0]),(t=n.concat(t)).push(a),t}},{key:"onFaceS",value:function(t,e,n){var r=this.handlesMap,i=this.indices,a=3*this.currentFace;if(r[this.currentFace]){this.markCorner(t.pop(),t);var s=t.indexOf(r[this.currentFace]);t=s>=0?this.onHandleEnd(s,t,n):this.onHandleStart(t,n)}else{var o=t.pop();this.markCorner(o,t),i[a]=-this.nextCorner(o);var u=e.pop();this.markCorner(u.pop(),u),(t=u.concat(t)).push(a)}return t}},{key:"onFaceM",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=t.splice(0,this.holes[this.currentHole--]);this.mapHoleBoundary(a);var s=r[this.prevCorner(a[0])];r[i]=s;var o=t.pop();return r[this.prevCorner(o)]=-this.nextCorner(t[t.length-1]),r[this.nextCorner(o)]=s,o=t.shift(),r[this.prevCorner(o)]=s,r[this.nextCorner(o)]=-this.prevCorner(t[0]),t.push(i),t}},{key:"decompress",value:function(){this.readedVertexMap=new Uint8Array(this.vertexCount);var t=this.faceCount,e=this.indices=new Array(3*t);this.currentFace=t-1,this.currentVertex=this.vertexCount-1,this.currentHole=this.holes.length-1;for(var n,r=this.clers,i=[],a=[];this.currentFace>=0;){var s="onFace"+u[r[this.currentFace]];this[s]?n=this[s](n,i,a):console.warn("has no ".concat(s)),this.currentFace--}return this.mapBoundary(n),this.fixIndicesAndReadVertice(this.indices),this.geometry.indices=e,this.geometry.dequantize(),this.geometry}},{key:"_onDecompressFace",value:function(t,e){this.onDecompressFace&&this.onDecompressFace(t,e)}}])&&i(e.prototype,n),t}();t.exports=c},function(t,e){var n={C:0,R:1,L:2,S:3,E:4,M:5,F:6},r=[];for(var i in n)r[n[i]]=i;n.map=r,t.exports=n},function(t,e,n){var r=n(0);function i(t,e,n,r){return new t(e.slice(n,n+r*t.BYTES_PER_ELEMENT))}t.exports={read:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(t),a=new r,s=function(t,e){var n={};return n.version=t.getUint8(e++),n.faceCount=t.getUint32(e,!0),e+=4,n.vertexCount=t.getUint32(e,!0),e+=4,n.attrCount=t.getUint8(e++),n.noParallelogramPrediction=t.getUint8(e++),n.holesCount=t.getUint16(e,!0),e+=2,n.handlesCount=t.getUint16(e,!0),e+=2,n.headerBytes=15,n}(n,e);return e+=s.headerBytes,a.mode="CLERS",e=function(t,e,n,r){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wasmURL=e.wasmURL||"https://ossgw.alicdn.com/tmall-c3/tmx/70b8d82ccf33e97a124e54c2d6a3e0c7.wasm",this.memPages=e.memPages||256,this.memPages<256&&(this.memPages=256),this.isReady=!1}var e,n;return e=t,(n=[{key:"initASMJS",value:function(){this.isReady=!0,this.dv=new DataView(HEAP8.buffer),this.heap8=HEAP8,this.ins={exports:{__Z7AMCinitj:Module.__Z7AMCinitj,__Z12AMDecompressv:Module.__Z12AMDecompressv}}}},{key:"init",value:function(){var t=this,e=this.memory=new WebAssembly.Memory({initial:this.memPages});this.dv=new DataView(e.buffer);var n=this.heap8=new Uint8Array(e.buffer),r={global:{NaN:5,Infinity:6},env:{memoryBase:0,memory:e,_malloc:function(){return 2097152},_memset:function(t,e,r){return n.fill(e,t,t+r),t},_printf:function(t,e){for(var r=t;n[r];)r++;var i=String.fromCharCode.apply(String,function(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e65536?new Uint32Array(d):new Uint16Array(d);var m=new i(d);return h.forEach((function(t){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(t,3),r=n[0],i=n[1],a=n[2],s=new Float32Array(e.buffer.slice(a,a+u*i*4));m.addAttr(m.attrIdToName(r),s,i)})),m}}])&&r(e.prototype,n),t}();t.exports=a},function(t,e){var n;t.exports=function(){return void 0===n&&(n=function(){if("undefined"==typeof WebAssembly||"undefined"==typeof fetch||function(){if(!/iPad|iPhone|iPod/i.test(navigator.userAgent))return!1;if(/OS (\d+)_(\d+)_?(\d+)?/i.test(navigator.userAgent)){var t=Number(RegExp.$1),e=Number(RegExp.$2);if(11===t&&e>=3||t>11)return!1}return!0}())return!1;try{var t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)}catch(t){return console.log("err while check WebAssembly",t),!1}}()),n}}])},function(t,e,n){"use strict";var r=n(34),i=n.n(r),a=n(1),s=n(5),o=a.a.create({className:"Ray",isRay:!0,origin:{get:function(){return this._origin},set:function(t){this._origin=t,this._ray.origin=t.elements}},direction:{get:function(){return this._direction},set:function(t){this._direction=t,this._ray.direction=t.elements}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._ray=new i.a,this.origin=t.origin||new s.a(0,0,0),this.direction=t.direction||new s.a(0,0,-1)},set:function(t,e){return this.origin=t,this.direction=e,this},copy:function(t){this.origin.copy(t.origin),this.direction.copy(t.direction)},clone:function(){return new this.constructor({origin:this.origin.clone(),direction:this.direction.clone()})},fromCamera:function(t,e,n,r,i){t.isPerspectiveCamera?(t.worldMatrix.getTranslation(this.origin),this.direction.set(e,n,0),this.direction.copy(t.unprojectVector(this.direction,r,i)),this.direction.sub(this.origin).normalize()):t.isOrthographicCamera&&(this.origin.set(e,n,(t.near+t.far)/(t.near-t.far)),this.origin.copy(t.unprojectVector(this.origin,r,i)),this.direction.set(0,0,-1).transformDirection(t.worldMatrix).normalize())},transformMat4:function(t){this.origin.transformMat4(t),this.direction.transformDirection(t).normalize()},sortPoints:function(t,e){var n=this;e?t.sort((function(t,r){return n.squaredDistance(t[e])-n.squaredDistance(r[e])})):t.sort((function(t,e){return n.squaredDistance(t)-n.squaredDistance(e)}))},squaredDistance:function(t){return this.origin.squaredDistance(t)},distance:function(t){return this.origin.distance(t)},intersectsSphere:function(t,e){var n=this._ray.intersectsSphere(t,e);return this._getRes(n)},intersectsPlane:function(t,e){var n=this._ray.intersectsPlane(t,e);return this._getRes(n)},intersectsTriangle:function(t){var e=this._ray.intersectsTriangle(t);return this._getRes(e)},intersectsBox:function(t){var e=this._ray.intersectsBox(t);return this._getRes(e)},intersectsTriangleCell:function(t,e){var n=this._ray.intersectsTriangleCell(t,e);return this._getRes(n)},_getRes:function(t){return t?new s.a(t[0],t[1],t[2]):null}});e.a=o},function(t,e,n){"use strict";var r=n(0),i=n(1),a=n(9),s=n(5),o=i.a.create({Mixes:a.a,Extends:s.a,className:"Vector3Notifier",isVector3Notifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this.fire("update"),this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this.fire("update"),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this.fire("update"),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this.fire("update"),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this.fire("update"),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this.fire("update"),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this.fire("update"),this},round:function(){return r.vec3.round(this.elements,this.elements),this.fire("update"),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this.fire("update"),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this.fire("update"),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this.fire("update"),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this.fire("update"),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this.fire("update"),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this.fire("update"),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this.fire("update"),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},random:function(t){return r.vec3.random(this.elements,t),this.fire("update"),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this.fire("update"),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this.fire("update"),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this.fire("update"),this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this.fire("update"),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}}});e.a=o},function(t,e){t.exports="#define GLSLIFY 1\n#define HILO_FRONT_SIDE 1028\n#define HILO_BACK_SIDE 1029\n#define HILO_FRONT_AND_BACK_SIDE 1032\n#define HILO_PI 3.141592653589793\n#define HILO_INVERSE_PI 0.3183098861837907"},function(t,e,n){"use strict";var r=n(1),i=n(5),a=r.a.create({className:"Plane",isPlane:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=t,this.distance=e},copy:function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},clone:function(){return new this.constructor(this.normal.clone(),this.distance)},set:function(t,e,n,r){return this.normal.set(t,e,n),this.distance=r,this},normalize:function(){var t=1/this.normal.length();return this.normal.scale(t),this.distance*=t,this},distanceToPoint:function(t){return this.normal.dot(t)+this.distance},projectPoint:function(t){return(new i.a).copy(this.normal).scale(-this.distanceToPoint(t)).add(t)}});e.a=a},function(t,e,n){"use strict";var r=n(1),i=n(5),a=new i.a,s=r.a.create({className:"Sphere",isSphere:!0,radius:0,constructor:function(t){Object.assign(this,t),this.center||(this.center=new i.a(0,0,0))},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},fromPoints:function(t){for(var e=this.center,n=0,r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this.fire("update"),this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this.fire("update"),this},identity:function(){return i.mat4.identity(this.elements),this.fire("update"),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this.fire("update"),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this.fire("update"),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this.fire("update"),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},premultiply:function(t){return this.multiply(t,this),this.fire("update"),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this.fire("update"),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this.fire("update"),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this.fire("update"),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this.fire("update"),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this.fire("update"),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this.fire("update"),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this.fire("update"),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this.fire("update"),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this.fire("update"),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this.fire("update"),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this.fire("update"),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this.fire("update"),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this.fire("update"),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},fromRotationTranslationScaleOrigin:function(t,e,n,r,a){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),a||this.fire("update"),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this.fire("update"),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this.fire("update"),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this.fire("update"),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this.fire("update"),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this.fire("update"),this},lookAt:function(t,e,n){return t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},targetTo:function(t,e,n){t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],u=n[1],c=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=u*m-c*d,g=c*l-o*m,v=o*d-u*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=u*m-c*d)*p+(g=c*l-(o+=1e-7)*m)*g+(v=o*d-u*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this.fire("update"),this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new u.a),this.determinant()<0&&(n.x*=-1),r.copy(this),h.inverse(n),r.scale(h),t.fromMat4(r),i&&i.set(0,0,0),this}});e.a=l},function(t,e,n){"use strict";var r=n(1),i=n(9),a=n(6),s=n(13),o=a.a.DEG2RAD,u=a.a.RAD2DEG,c=r.a.create({Mixes:i.a,Extends:s.a,className:"EulerNotifier",isEulerNotifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;s.a.call(this,t,e,n)},updateDegrees:function(){return c.superclass.updateDegrees.call(this),this.fire("update"),this},updateRadians:function(){return c.superclass.updateRadians.call(this),this.fire("update"),this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*o,this.fire("update")}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*o,this.fire("update")}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*o,this.fire("update")}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*u,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*u,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*u,this.fire("update")}}});e.a=c},function(t,e,n){"use strict";var r=n(1),i=n(19),a=r.a.create({className:"Frustum",isFrustum:!0,constructor:function(){this.planes=[];for(var t=6;t--;)this.planes.push(new i.a)},copy:function(t){var e=t.planes;return this.planes.forEach((function(t,n){t.copy(e[n])})),this},clone:function(){var t=new this.constructor;return t.copy(this),t},fromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],s=n[3],o=n[4],u=n[5],c=n[6],h=n[7],f=n[8],l=n[9],d=n[10],m=n[11],_=n[12],p=n[13],g=n[14],v=n[15];return e[0].set(s-r,h-o,m-f,v-_).normalize(),e[1].set(s+r,h+o,m+f,v+_).normalize(),e[2].set(s+i,h+u,m+l,v+p).normalize(),e[3].set(s-i,h-u,m-l,v-p).normalize(),e[4].set(s-a,h-c,m-d,v-g).normalize(),e[5].set(s+a,h+c,m+d,v+g).normalize(),this},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n) 0.0) {\n attenuation *= max(min(1.0 - pow( distance / range, 4.0 ), 1.0), 0.0);\n }\n #else\n attenuation = 1.0/(info.x + info.y * distance + info.z * distance * distance);\n #endif\n\n return attenuation;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nfloat unpackFloat(vec4 rgbaDepth) {\n const vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n float depth = dot(rgbaDepth, bitShift);\n return depth;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nbool isOutOfRange(vec2 pos) {\n if (pos.x < 0.0 || pos.x > 1.0 || pos.y < 0.0 || pos.y > 1.0) {\n return true;\n }\n return false;\n}\n\nfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float bias, vec3 fragPos, mat4 lightSpaceMatrix) {\n vec4 fragPosLightSpace = lightSpaceMatrix * vec4(fragPos, 1.0);\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n projCoords = projCoords * 0.5 + 0.5;\n if (isOutOfRange(projCoords.xy)) {\n return 1.0;\n }\n float currentDepth = projCoords.z;\n float shadow = 0.0;\n vec2 texelSize = 1.0 / shadowMapSize;\n for (int x = -1; x <= 1; ++x) {\n for (int y = -1; y <= 1; ++y) {\n vec2 pos = projCoords.xy + vec2(x, y) * texelSize;\n if (isOutOfRange(pos)) {\n shadow += 1.0;\n } else {\n float pcfDepth = texture2D(shadowMap, pos).r;\n shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n }\n }\n }\n return 1.0 - shadow / 9.0;\n}\n\nfloat getShadow(samplerCube shadowMap, float bias, vec3 lightPos, vec3 position, vec2 camera, mat4 lightSpaceMatrix) {\n vec4 distanceVec = lightSpaceMatrix * vec4(position, 1.0) - lightSpaceMatrix * vec4(lightPos, 1.0);\n float currentDistance = length(distanceVec);\n vec3 direction = normalize(distanceVec).xyz;\n\n float shadow = 0.0;\n const float samples = 2.0;\n const float offset = 0.01;\n const float step = offset / (samples * 0.5);\n for(float x = -offset; x < offset; x +=step)\n {\n for(float y = -offset; y < offset; y +=step)\n {\n for(float z = -offset; z < offset; z +=step)\n {\n float closestDistance = camera[0] + (camera[1] - camera[0]) * unpackFloat(textureCube(shadowMap, direction + vec3(x, y, z)));\n if (closestDistance == camera[0]) {\n continue;\n }\n else if(currentDistance - bias > closestDistance)\n shadow += 1.0;\n }\n }\n }\n shadow /= (samples * samples * samples);\n\n return 1.0 - shadow;\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(64)+"\n\n#ifdef HILO_HAS_LIGHT\n #ifdef HILO_HAS_SPECULAR\n uniform float u_shininess;\n #ifdef HILO_SPECULAR_MAP\n uniform HILO_SAMPLER_2D u_specular;\n #else\n uniform vec4 u_specular;\n #endif\n #endif\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #else\n uniform vec4 u_emission;\n #endif\n #ifdef HILO_AMBIENT_MAP\n uniform HILO_SAMPLER_2D u_ambient;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform mat4 u_specularEnvMatrix;\n uniform float u_reflectivity;\n uniform float u_refractRatio;\n uniform float u_refractivity;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_FIX_MAX_BUG\n float hilo_max(float a, float b){\n if (a > b) {\n return a;\n }\n return b;\n }\n #define HILO_MAX(a, b) hilo_max(a, b);\n#else\n #define HILO_MAX(a, b) max(a, b);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_DIFFUSE_MAP)\n diffuse = HILO_TEXTURE_2D(u_diffuse);\n#elif defined(HILO_DIFFUSE_CUBE_MAP)\n diffuse = textureCube(u_diffuse, v_position);\n#elif defined(HILO_HAS_COLOR)\n diffuse = v_color;\n#else\n diffuse = u_diffuse;\n#endif\ncolor.a = diffuse.a;"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_LIGHT\n vec3 lightDiffuse = vec3(0, 0, 0);\n vec3 lightAmbient = vec3(0, 0, 0);\n vec3 viewPos = vec3(0, 0, 0);\n\n #ifdef HILO_AMBIENT_MAP\n lightAmbient = HILO_TEXTURE_2D(u_ambient).rgb;\n #else\n lightAmbient = diffuse.rgb;\n #endif\n\n #ifdef HILO_HAS_SPECULAR\n vec3 lightSpecular = vec3(0, 0, 0);\n #ifdef HILO_SPECULAR_MAP\n vec4 specular = HILO_TEXTURE_2D(u_specular);\n #else\n vec4 specular = u_specular;\n #endif\n #endif\n \n #ifdef HILO_EMISSION_MAP\n vec4 emission = HILO_TEXTURE_2D(u_emission);\n #else\n vec4 emission = u_emission;\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = -u_directionalLightsInfo[i];\n\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n\n float diff = getDiffuse(normal, lightDir);\n lightDiffuse += diff * u_directionalLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * u_directionalLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = -u_spotLightsDir[i];\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, normalize(distanceVec));\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n\n lightDiffuse += intensity * attenuation * shadow * diff * u_spotLightsColor[i];\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += intensity * attenuation * shadow * spec * u_spotLightsColor[i];\n #endif\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0;i < HILO_POINT_LIGHTS;i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, lightDir);\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n lightDiffuse += diff * attenuation * u_pointLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * attenuation * u_pointLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n #ifndef HILO_HAS_SPECULAR\n vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);\n #endif\n vec3 viewDir = normalize(vec3(0, 0, 0) - v_fragPos);\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuse.rgb, specular.rgb, sqrt(2.0/(u_shininess+2.0)), normal, viewDir, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_AMBIENT_LIGHTS\n color.rgb += u_ambientLightsColor * lightAmbient;\n #endif\n\n #if defined(HILO_SPECULAR_ENV_MAP) && defined(HILO_HAS_SPECULAR)\n vec3 I = normalize(v_fragPos - viewPos);\n if (u_reflectivity > 0.0) {\n vec3 R = reflect(I, normal);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_reflectivity;\n }\n if (u_refractivity > 0.0) {\n vec3 R = refract(I, normal, u_refractRatio);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_refractivity;\n }\n #endif\n\n color.rgb += lightDiffuse * diffuse.rgb;\n #ifdef HILO_HAS_SPECULAR\n color.rgb += lightSpecular * specular.rgb;\n #endif\n\n color.rgb += emission.rgb;\n#else\n color.rgb = diffuse.rgb;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_FOG\n float fogFactor = 1.0;\n\n #ifdef HILO_FOG_LINEAR\n fogFactor = (u_fogInfo.y - v_dist)/(u_fogInfo.y - u_fogInfo.x);\n #elif defined(HILO_FOG_EXP)\n fogFactor = exp(-abs(u_fogInfo * v_dist));\n #elif defined(HILO_FOG_EXP2)\n fogFactor = exp(-(u_fogInfo * v_dist) * (u_fogInfo * v_dist)); \n #endif\n \n fogFactor = clamp(fogFactor, 0.0, 1.0);\n color = mix(u_fogColor, color, fogFactor);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n uniform mat4 u_positionDecodeMat;\n #endif\n #ifdef HILO_NORMAL_QUANTIZED\n uniform mat4 u_normalDecodeMat;\n #endif\n #ifdef HILO_UV_QUANTIZED\n uniform mat3 u_uvDecodeMat;\n #endif\n #ifdef HILO_UV1_QUANTIZED\n uniform mat3 u_uv1DecodeMat;\n #endif\n\n vec2 unQuantize(vec2 data, mat3 decodeMat) {\n vec3 result = vec3(data, 1.0);\n result = decodeMat * result;\n return result.xy;\n }\n\n vec3 unQuantize(vec3 data, mat4 decodeMat) {\n vec4 result = vec4(data, 1.0);\n result = decodeMat * result;\n return result.xyz;\n }\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n attribute vec4 a_skinIndices;\n attribute vec4 a_skinWeights;\n #ifdef HILO_JOINT_MAT_MAP\n uniform sampler2D u_jointMatTexture;\n uniform vec2 u_jointMatTextureSize;\n mat4 getJointMat(float index) {\n index *= 4.0;\n float x = float(mod(index, u_jointMatTextureSize.x));\n float y = float(floor(index / u_jointMatTextureSize.x));\n float dx = 1.0 / float(u_jointMatTextureSize.x);\n float dy = 1.0 / float(u_jointMatTextureSize.y);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(u_jointMatTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(u_jointMatTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(u_jointMatTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(u_jointMatTexture, vec2(dx * (x + 3.5), y));\n mat4 mat = mat4(v1, v2, v3, v4);\n return mat;\n }\n\n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * getJointMat(indices.x);\n mat += weights.y * getJointMat(indices.y);\n mat += weights.z * getJointMat(indices.z);\n mat += weights.w * getJointMat(indices.w);\n return mat;\n }\n #else\n uniform mat4 u_jointMat[HILO_JOINT_COUNT];\n \n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * u_jointMat[int(indices.x)];\n mat += weights.y * u_jointMat[int(indices.y)];\n mat += weights.z * u_jointMat[int(indices.z)];\n mat += weights.w * u_jointMat[int(indices.w)];\n return mat;\n }\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n attribute vec2 a_texcoord0;\n varying vec2 v_texcoord0;\n #ifdef HILO_UV_MATRIX\n uniform mat3 u_uvMatrix;\n #endif\n#endif\n\n#ifdef HILO_HAS_TEXCOORD1\n attribute vec2 a_texcoord1;\n varying vec2 v_texcoord1;\n #ifdef HILO_UV_MATRIX1\n uniform mat3 u_uvMatrix1;\n #endif\n#endif\n\n#ifdef HILO_DIFFUSE_CUBE_MAP\n varying vec3 v_position;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n attribute vec3 a_normal;\n uniform mat3 u_normalMatrix;\n varying vec3 v_normal;\n\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n attribute vec4 a_tangent;\n varying mat3 v_TBN;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n uniform mat4 u_modelViewMatrix;\n #ifdef HILO_HAS_FOG\n varying float v_dist;\n #endif\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS) \n varying vec3 v_fragPos;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n uniform float u_morphWeights[HILO_MORPH_TARGET_COUNT];\n\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition0;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal0;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent0;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition1;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal1;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent1;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition2;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal2;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent2;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition3;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal3;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent3;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition4;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal4;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent4;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition5;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal5;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent5;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition6;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal6;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent6;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition7;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal7;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent7;\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n attribute vec3 a_color;\n #elif HILO_COLOR_SIZE == 4\n attribute vec4 a_color;\n #endif\n varying vec4 v_color;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n varying float v_fragDepth;\n #else\n uniform float u_logDepth;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n v_color = vec4(a_color, 1.0);\n #elif HILO_COLOR_SIZE == 4\n v_color = a_color;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n pos.xyz = unQuantize(pos.xyz, u_positionDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD0) && defined(HILO_UV_QUANTIZED)\n uv = unQuantize(uv, u_uvDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD1) && defined(HILO_UV1_QUANTIZED)\n uv1 = unQuantize(uv1, u_uv1DecodeMat);\n #endif\n #if defined(HILO_HAS_NORMAL) && defined(HILO_NORMAL_QUANTIZED)\n normal = unQuantize(normal, u_normalDecodeMat);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent0 * u_morphWeights[0];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent1 * u_morphWeights[1];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent2 * u_morphWeights[2];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent3 * u_morphWeights[3];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent4 * u_morphWeights[4];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent5 * u_morphWeights[5];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent6 * u_morphWeights[6];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent7 * u_morphWeights[7];\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n mat4 skinMat = getJointMat(a_skinWeights, a_skinIndices);\n pos = skinMat * pos;\n\n #ifdef HILO_HAS_NORMAL\n normal = mat3(skinMat) * normal;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n #ifdef HILO_UV_MATRIX\n v_texcoord0 = (u_uvMatrix * vec3(uv, 1.0)).xy;\n #else\n v_texcoord0 = uv;\n #endif\n#endif\n#ifdef HILO_HAS_TEXCOORD1\n #ifdef HILO_UV_MATRIX1\n v_texcoord1 = (u_uvMatrix1 * vec3(uv1, 1.0)).xy;\n #else\n v_texcoord1 = uv1;\n #endif\n#endif\n#ifdef HILO_DIFFUSE_CUBE_MAP\n v_position = pos.xyz;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n vec3 T = normalize(u_normalMatrix * tangent.xyz);\n vec3 N = normalize(u_normalMatrix * normal);\n T = normalize(T - dot(T, N) * N);\n vec3 B = cross(N, T) * tangent.w;\n v_TBN = mat3(T, B, N);\n #endif\n v_normal = normalize(u_normalMatrix * normal);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n vec3 fragPos = (u_modelViewMatrix * pos).xyz;\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS)\n v_fragPos = fragPos;\n #endif\n\n #ifdef HILO_HAS_FOG\n v_dist = length(fragPos);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n v_fragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2( max( 1e-6, gl_Position.w + 1.0 ) ) * u_logDepth - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n// https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/packDepth.frag\n// Packing a float in GLSL with multiplication and mod\n// http://blog.gradientstudios.com/2012/08/23/shadow-map-improvement\nvec4 packFloat(float depth) {\n const vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n\n // combination of mod and multiplication and division works better\n vec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);\n res -= res.xxyz * bit_mask;\n return res;\n}\n\n\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(86)+"\n"+n(64)+'\n\nuniform vec4 u_baseColor;\nuniform vec4 u_emissionFactor;\n\n#ifdef HILO_BASE_COLOR_MAP\n uniform HILO_SAMPLER_2D u_baseColorMap;\n#endif\n\n#ifdef HILO_NEED_WORLD_NORMAL\n uniform mat3 u_viewInverseNormalMatrix;\n#endif\n\n#ifdef HILO_HAS_LIGHT\n uniform float u_metallic;\n #ifdef HILO_METALLIC_MAP\n uniform HILO_SAMPLER_2D u_metallicMap;\n #endif\n uniform float u_roughness;\n #ifdef HILO_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_roughnessMap;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_metallicRoughnessMap;\n #endif\n #ifdef HILO_OCCLUSION_MAP\n uniform HILO_SAMPLER_2D u_occlusionMap;\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n uniform float u_occlusionStrength;\n #endif\n\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_DIFFUSE_ENV_MAP_CUBE\n uniform samplerCube u_diffuseEnvMap;\n #else\n uniform sampler2D u_diffuseEnvMap;\n #endif\n uniform float u_diffuseEnvIntensity;\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n uniform vec3 u_diffuseEnvSphereHarmonics3[9];\n uniform float u_diffuseEnvIntensity;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n uniform sampler2D u_brdfLUT;\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform float u_specularEnvIntensity;\n\n uniform float u_specularEnvMapMipCount;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n uniform vec4 u_specular;\n uniform float u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n uniform HILO_SAMPLER_2D u_specularGlossinessMap;\n #endif\n #endif\n\n #ifdef HILO_LIGHT_MAP\n uniform HILO_SAMPLER_2D u_lightMap;\n #endif\n\n #ifdef HILO_HAS_CLEARCOAT\n uniform float u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n uniform HILO_SAMPLER_2D u_clearcoatMap;\n #endif\n\n uniform float u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_clearcoatRoughnessMap;\n #endif\n #endif\n\n\n // PBR Based on https://github.com/KhronosGroup/glTF-WebGL-PBR\n\n // Basic Lambertian diffuse\n // Implementation from Lambert\'s Photometria https://archive.org/details/lambertsphotome00lambgoog\n // See also [1], Equation 1\n vec3 diffuse(vec3 diffuseColor) {\n return diffuseColor * HILO_INVERSE_PI;\n }\n\n // The following equation models the Fresnel reflectance term of the spec equation (aka F())\n // Implementation of fresnel from [4], Equation 15\n vec3 specularReflection(vec3 reflectance0, vec3 reflectance90, float VdotH) {\n return reflectance0 + (reflectance90 - reflectance0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n }\n\n // This calculates the specular geometric attenuation (aka G()),\n // where rougher material will reflect less light back to the viewer.\n // This implementation is based on [1] Equation 4, and we adopt their modifications to\n // alphaRoughness as input as originally proposed in [2].\n float geometricOcclusion(float NdotL, float NdotV, float alphaRoughness) {\n float r = alphaRoughness * alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r + (1.0 - r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r + (1.0 - r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n }\n\n // The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())\n // Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz\n // Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.\n float microfacetDistribution(float alphaRoughness, float NdotH) {\n float roughnessSq = alphaRoughness * alphaRoughness;\n float f = (NdotH * roughnessSq - NdotH) * NdotH + 1.0;\n return roughnessSq * HILO_INVERSE_PI / (f * f);\n }\n\n vec3 computeDiffuseSHLight(vec3 normal, in vec3 sh[9]) {\n return sh[0] +\n sh[1] * (normal.y) +\n sh[2] * (normal.z) +\n sh[3] * (normal.x) +\n sh[4] * (normal.y * normal.x) +\n sh[5] * (normal.y * normal.z) +\n sh[6] * ((3.0 * normal.z * normal.z) - 1.0) +\n sh[7] * (normal.z * normal.x) +\n sh[8] * (normal.x * normal.x - (normal.y * normal.y));\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md#rgbd\n vec3 decodeRGBD(in vec4 color){\n return color.rgb / color.a;\n }\n\n vec3 getIBLClearCoatContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif HILO_USE_SHADER_TEXTURE_LOD\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 getIBLContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_NEED_WORLD_NORMAL\n N = u_viewInverseNormalMatrix * N;\n V = u_viewInverseNormalMatrix * V;\n #endif\n #if defined(HILO_DIFFUSE_ENV_MAP) || defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_GAMMA_CORRECTION\n vec3 diffuseLight = sRGBToLinear(textureEnvMap(u_diffuseEnvMap, N)).rgb;\n #else\n vec3 diffuseLight = textureEnvMap(u_diffuseEnvMap, N).rgb;\n #endif\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n vec3 diffuseLight = computeDiffuseSHLight(N, u_diffuseEnvSphereHarmonics3);\n #endif\n color.rgb += diffuseLight * diffuseColor * ao * u_diffuseEnvIntensity;\n #endif\n\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif HILO_USE_SHADER_TEXTURE_LOD\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 calculateLo(vec3 N, vec3 V, vec3 L, vec3 reflectance0, vec3 reflectance90, float alphaRoughness, vec3 diffuseColor, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float LdotH = clamp(dot(L, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n // Calculate the shading terms for the microfacet specular shading model\n vec3 F = specularReflection(reflectance0, reflectance90, VdotH);\n float G = geometricOcclusion(NdotL, NdotV, alphaRoughness);\n float D = microfacetDistribution(alphaRoughness, NdotH);\n\n vec3 diffuseContrib;\n\n #ifdef HILO_LIGHT_MAP\n diffuseContrib = vec3(0.0);\n #else\n diffuseContrib = (1.0 - F) * diffuse(diffuseColor);\n #endif\n vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return NdotL * (diffuseContrib + specContrib);\n }\n\n #ifdef HILO_HAS_CLEARCOAT\n float calculateClearcoatBRDF(vec3 N, vec3 V, vec3 L, float clearcoatAlphaRoughness, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n\n float G = geometricOcclusion(NdotL, NdotV, clearcoatAlphaRoughness);\n float D = microfacetDistribution(clearcoatAlphaRoughness, NdotH);\n\n float clearcoatLayer = G * D / (4.0 * NdotV);\n\n return clearcoatLayer;\n }\n #endif\n#endif'},function(t,e){t.exports="#define GLSLIFY 1\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\n\nvec3 sRGBToLinear( in vec3 value ) {\n return vec3( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ));\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\nvec4 baseColor = u_baseColor;\nvec3 emissionColor = u_emissionFactor.rgb;\n\n#ifdef HILO_BASE_COLOR_MAP\n #ifdef HILO_GAMMA_CORRECTION\n baseColor *= sRGBToLinear(HILO_TEXTURE_2D(u_baseColorMap));\n #else\n baseColor *= HILO_TEXTURE_2D(u_baseColorMap);\n #endif\n#endif\n\n#if defined(HILO_HAS_COLOR)\n baseColor *= v_color;\n#endif\n\ncolor.a = baseColor.a;\n\n"+n(46)+"\n\n#ifdef HILO_HAS_LIGHT\n vec3 viewPos = vec3(0, 0, 0);\n vec3 N = normal;\n vec3 V = normalize(viewPos - v_fragPos);\n\n #ifdef HILO_OCCLUSION_MAP\n float ao = HILO_TEXTURE_2D(u_occlusionMap).r;\n #else\n float ao = 1.0;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n vec3 specular = u_specular.rgb;\n float glossiness = u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n vec4 specularGlossiness = sRGBToLinear(HILO_TEXTURE_2D(u_specularGlossinessMap));\n specular = specularGlossiness.rgb * specular;\n glossiness = specularGlossiness.a * glossiness;\n #endif\n float roughness = 1.0 - glossiness;\n float metallic = 0.0;\n vec3 diffuseColor = baseColor.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n vec3 specularColor = specular;\n #else\n float metallic = u_metallic;\n float roughness = u_roughness;\n #ifdef HILO_METALLIC_MAP\n metallic = HILO_TEXTURE_2D(u_metallicMap).r * u_metallic;\n #endif\n #ifdef HILO_ROUGHNESS_MAP\n roughness = HILO_TEXTURE_2D(u_roughnessMap).r * u_roughness;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughnessMap = HILO_TEXTURE_2D(u_metallicRoughnessMap);\n #ifdef HILO_IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP\n ao = metallicRoughnessMap.r;\n #endif\n roughness = metallicRoughnessMap.g * u_roughness;\n metallic = metallicRoughnessMap.b * u_metallic;\n #endif\n roughness = clamp(roughness, 0.04, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n ao = mix(1.0, ao, u_occlusionStrength);\n #endif\n\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n float NdotV = clamp(abs(dot(N, V)), 0.001, 1.0);\n float alphaRoughness = roughness * roughness;\n\n #ifdef HILO_HAS_CLEARCOAT\n float clearcoatFactor = u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n clearcoatFactor *= HILO_TEXTURE_2D(u_clearcoatMap).r;\n #endif\n float clearcoatRoughnessFactor = u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n clearcoatRoughnessFactor *= HILO_TEXTURE_2D(u_clearcoatRoughnessMap).g;\n #endif\n\n float clearcoatAlphaRoughnessFactor = clearcoatRoughnessFactor * clearcoatRoughnessFactor;\n vec3 NC = clearcoatNormal;\n float NCdotV = clamp(abs(dot(NC, V)), 0.001, 1.0);\n float clearCoatFresnel = 0.04 + (1.0 - 0.04) * pow((1.0 - abs(NCdotV)),5.0);\n vec3 clearCoatLayer = vec3(0.0);\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = normalize(-u_directionalLightsInfo[i]);\n vec3 radiance = u_directionalLightsColor[i];\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = normalize(-u_spotLightsDir[i]);\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n vec3 radiance = intensity * attenuation * u_spotLightsColor[i];\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0; i < HILO_POINT_LIGHTS; i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n vec3 radiance = attenuation * u_pointLightsColor[i];\n\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuseColor, specularColor, roughness, N, V, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_LIGHT_MAP\n vec4 lightMapColor = HILO_TEXTURE_2D(u_lightMap);\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_lights_image_based#rgbd\n color.rgb += baseColor.rgb * decodeRGBD(lightMapColor);\n #endif\n\n // IBL\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += getIBLClearCoatContribution(NC, V, diffuseColor, vec3(.04), ao, NCdotV, clearcoatRoughnessFactor)/clearCoatFresnel;\n #endif\n color.rgb += getIBLContribution(N, V, diffuseColor, specularColor, ao, NdotV, roughness);\n\n #if defined(HILO_AMBIENT_LIGHTS) && (defined(HILO_IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER) || (!defined(HILO_DIFFUSE_ENV_MAP) && !defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)))\n color.rgb += u_ambientLightsColor * baseColor.rgb * ao;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n #ifdef HILO_GAMMA_CORRECTION\n emissionColor *= sRGBToLinear(HILO_TEXTURE_2D(u_emission)).rgb;\n #else\n emissionColor *= HILO_TEXTURE_2D(u_emission).rgb;\n #endif\n #endif\n\n color.rgb += emissionColor;\n\n #ifdef HILO_HAS_CLEARCOAT\n float t = clearcoatFactor * clearCoatFresnel;\n color.rgb = color.rgb * (1.0 - t) + clearCoatLayer * t;\n #endif\n#else\n color.rgb = baseColor.rgb;\n color.rgb += emissionColor;\n#endif"},function(t,e,n){var r=n(89),i=n(26),a=n(30),s=[0,0,0],o=[0,0,0],u=[0,0,0],c=[0,0,0],h=[0,0,0];t.exports=function(t,e,n,f){a(s,f[1],f[0]),a(o,f[2],f[0]),r(c,n,o);var l=i(s,c);if(l<1e-6)return null;a(u,e,f[0]);var d=i(u,c);if(d<0||d>l)return null;r(h,u,s);var m=i(n,h);if(m<0||d+m>l)return null;var _=i(o,h)/l;return t[0]=e[0]+_*n[0],t[1]=e[1]+_*n[1],t[2]=e[2]+_*n[2],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2];return t[0]=i*u-a*o,t[1]=a*s-r*u,t[2]=r*o-i*s,t}},function(t,e,n){var r=n(26),i=n(31),a=n(32),s=n(33);t.exports=function(t,e,n,u,c){var h=r(n,u);if(0!==h){var f=-(r(e,u)+c)/h;return f<0?null:(a(o,n,f),i(t,e,o))}return r(u,e)+c===0?s(t,e):null};var o=[0,0,0]},function(t,e,n){var r=n(92),i=n(26),a=n(30),s=n(93),o=n(32),u=n(31),c=[0,0,0];t.exports=function(t,e,n,h,f){a(c,h,e);var l=i(n,c);if(l<0)return null;s(c,e,n,l);var d=r(h,c),m=f*f;if(d>m)return null;return o(t,n,l-Math.sqrt(m-d)),u(t,t,e)}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}},function(t,e){function n(t,e,n){for(var r=t.length,i=-1/0,a=1/0,s=0;su){var c=o;o=u,u=c}if(ua)return 1/0;o>i&&(i=o),ua?1/0:i}t.exports=function(t,e,r,i){var a=n(e,r,i);if(a===1/0)t=null;else{t=t||[];for(var s=0;s0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=a*s),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.lerp=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=s+r*(n[2]-s),t[3]=o+r*(n[3]-o),t},e.random=function(t,e){var n,i,a,s,o,u;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{u=(a=2*r.RANDOM()-1)*a+(s=2*r.RANDOM()-1)*s}while(u>=1);var c=Math.sqrt((1-o)/u);return t[0]=e*n,t[1]=e*i,t[2]=e*a*c,t[3]=e*s*c,t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*s,t},e.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2],c=n[3],h=c*r+o*a-u*i,f=c*i+u*r-s*a,l=c*a+s*i-o*r,d=-s*r-o*i-u*a;return t[0]=h*c+d*-s+f*-u-l*-o,t[1]=f*c+d*-o+l*-s-h*-u,t[2]=l*c+d*-u+h*-o-f*-s,t[3]=e[3],t},e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function h(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}function f(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.len=h,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=4),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u1?0:i<-1?Math.PI:Math.acos(i)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],u=e[2];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-u)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function a(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function s(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function l(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function d(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}function m(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.sub=o,e.mul=u,e.div=c,e.dist=h,e.sqrDist=f,e.len=a,e.sqrLen=l,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=3),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;ur.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n},e.multiply=h,e.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+s*o,t[1]=i*u+a*o,t[2]=a*u-i*o,t[3]=s*u-r*o,t},e.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u-a*o,t[1]=i*u+s*o,t[2]=a*u+r*o,t[3]=s*u-i*o,t},e.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*o,t[1]=i*u-r*o,t[2]=a*u+s*o,t[3]=s*u-a*o,t},e.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},e.slerp=f,e.random=function(t){var e=r.RANDOM(),n=r.RANDOM(),i=r.RANDOM(),a=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*n),t[1]=a*Math.cos(2*Math.PI*n),t[2]=s*Math.sin(2*Math.PI*i),t[3]=s*Math.cos(2*Math.PI*i),t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a,o=s?1/s:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=a*o,t},e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.fromMat3=l,e.fromEuler=function(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var a=Math.sin(e),s=Math.cos(e),o=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);return t[0]=a*u*h-s*o*c,t[1]=s*o*h+a*u*c,t[2]=s*u*c-a*o*h,t[3]=s*u*h+a*o*c,t},e.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var r=o(n(0)),i=o(n(5)),a=o(n(2)),s=o(n(1));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function u(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function h(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+s*o+i*c-a*u,t[1]=i*h+s*u+a*o-r*c,t[2]=a*h+s*c+r*u-i*o,t[3]=s*h-r*o-i*u-a*c,t}function f(t,e,n,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=n[0],h=n[1],f=n[2],l=n[3],d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return(m=a*c+s*h+o*f+u*l)<0&&(m=-m,c=-c,h=-h,f=-f,l=-l),1-m>r.EPSILON?(d=Math.acos(m),_=Math.sin(d),p=Math.sin((1-i)*d)/_,g=Math.sin(i*d)/_):(p=1-i,g=i),t[0]=p*a+g*c,t[1]=p*s+g*h,t[2]=p*o+g*f,t[3]=p*u+g*l,t}function l(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+s]-e[3*s+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}e.clone=s.clone,e.fromValues=s.fromValues,e.copy=s.copy,e.set=s.set,e.add=s.add,e.mul=h,e.scale=s.scale,e.dot=s.dot,e.lerp=s.lerp;var d=e.length=s.length,m=(e.len=d,e.squaredLength=s.squaredLength),_=(e.sqrLen=m,e.normalize=s.normalize);e.exactEquals=s.exactEquals,e.equals=s.equals,e.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),n=a.fromValues(0,1,0);return function(r,i,s){var o=a.dot(i,s);return o<-.999999?(a.cross(t,e,i),a.len(t)<1e-6&&a.cross(t,n,i),a.normalize(t,t),c(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,_(r,r))}}(),e.sqlerp=function(){var t=u(),e=u();return function(n,r,i,a,s,o){return f(t,r,s,o),f(e,i,a,o),f(n,t,e,2*o*(1-o)),n}}(),e.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],_(e,l(e,t))}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.fromValues=function(t,e,n,i,a,s,o,u,c,h,f,l,d,m,_,p){var g=new r.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=n,g[3]=i,g[4]=a,g[5]=s,g[6]=o,g[7]=u,g[8]=c,g[9]=h,g[10]=f,g[11]=l,g[12]=d,g[13]=m,g[14]=_,g[15]=p,g},e.set=function(t,e,n,r,i,a,s,o,u,c,h,f,l,d,m,_,p){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t[9]=h,t[10]=f,t[11]=l,t[12]=d,t[13]=m,t[14]=_,t[15]=p,t},e.identity=i,e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],a=e[6],s=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=i,t[13]=s,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(i*y-r*N-a*R)*x,t[2]=(_*L-p*A+g*M)*x,t[3]=(l*A-f*L-d*M)*x,t[4]=(u*S-s*N-c*O)*x,t[5]=(n*N-i*S+a*O)*x,t[6]=(p*T-m*L-g*E)*x,t[7]=(h*L-l*T+d*E)*x,t[8]=(s*y-o*S+c*I)*x,t[9]=(r*S-n*y-a*I)*x,t[10]=(m*A-_*T+g*v)*x,t[11]=(f*T-h*A-d*v)*x,t[12]=(o*O-s*R-u*I)*x,t[13]=(n*R-r*O+i*I)*x,t[14]=(_*E-m*M-p*v)*x,t[15]=(h*M-f*E+l*v)*x,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15];return t[0]=o*(l*g-d*p)-f*(u*g-c*p)+_*(u*d-c*l),t[1]=-(r*(l*g-d*p)-f*(i*g-a*p)+_*(i*d-a*l)),t[2]=r*(u*g-c*p)-o*(i*g-a*p)+_*(i*c-a*u),t[3]=-(r*(u*d-c*l)-o*(i*d-a*l)+f*(i*c-a*u)),t[4]=-(s*(l*g-d*p)-h*(u*g-c*p)+m*(u*d-c*l)),t[5]=n*(l*g-d*p)-h*(i*g-a*p)+m*(i*d-a*l),t[6]=-(n*(u*g-c*p)-s*(i*g-a*p)+m*(i*c-a*u)),t[7]=n*(u*d-c*l)-s*(i*d-a*l)+h*(i*c-a*u),t[8]=s*(f*g-d*_)-h*(o*g-c*_)+m*(o*d-c*f),t[9]=-(n*(f*g-d*_)-h*(r*g-a*_)+m*(r*d-a*f)),t[10]=n*(o*g-c*_)-s*(r*g-a*_)+m*(r*c-a*o),t[11]=-(n*(o*d-c*f)-s*(r*d-a*f)+h*(r*c-a*o)),t[12]=-(s*(f*p-l*_)-h*(o*p-u*_)+m*(o*l-u*f)),t[13]=n*(f*p-l*_)-h*(r*p-i*_)+m*(r*l-i*f),t[14]=-(n*(o*p-u*_)-s*(r*p-i*_)+m*(r*u-i*o)),t[15]=n*(o*l-u*f)-s*(r*l-i*f)+h*(r*u-i*o),t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8],h=t[9],f=t[10],l=t[11],d=t[12],m=t[13],_=t[14],p=t[15];return(e*s-n*a)*(f*p-l*_)-(e*o-r*a)*(h*p-l*m)+(e*u-i*a)*(h*_-f*m)+(n*o-r*s)*(c*p-l*d)-(n*u-i*s)*(c*_-f*d)+(r*u-i*o)*(c*m-h*d)},e.multiply=a,e.translate=function(t,e,n){var r=n[0],i=n[1],a=n[2],s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*a+e[12],t[13]=e[1]*r+e[5]*i+e[9]*a+e[13],t[14]=e[2]*r+e[6]*i+e[10]*a+e[14],t[15]=e[3]*r+e[7]*i+e[11]*a+e[15]):(s=e[0],o=e[1],u=e[2],c=e[3],h=e[4],f=e[5],l=e[6],d=e[7],m=e[8],_=e[9],p=e[10],g=e[11],t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=h,t[5]=f,t[6]=l,t[7]=d,t[8]=m,t[9]=_,t[10]=p,t[11]=g,t[12]=s*r+h*i+m*a+e[12],t[13]=o*r+f*i+_*a+e[13],t[14]=u*r+l*i+p*a+e[14],t[15]=c*r+d*i+g*a+e[15]),t},e.scale=function(t,e,n){var r=n[0],i=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.rotate=function(t,e,n,i){var a,s,o,u,c,h,f,l,d,m,_,p,g,v,E,T,M,A,L,I,O,S,R,y,N=i[0],x=i[1],b=i[2],C=Math.sqrt(N*N+x*x+b*b);return C0?(n[0]=2*(c*u+l*i+h*o-f*a)/d,n[1]=2*(h*u+l*a+f*i-c*o)/d,n[2]=2*(f*u+l*o+c*a-h*i)/d):(n[0]=2*(c*u+l*i+h*o-f*a),n[1]=2*(h*u+l*a+f*i-c*o),n[2]=2*(f*u+l*o+c*a-h*i)),s(t,e,n),t},e.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},e.getScaling=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[4],s=e[5],o=e[6],u=e[8],c=e[9],h=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(a*a+s*s+o*o),t[2]=Math.sqrt(u*u+c*c+h*h),t},e.getRotation=function(t,e){var n=e[0]+e[5]+e[10],r=0;return n>0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},e.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3],u=i+i,c=a+a,h=s+s,f=i*u,l=i*c,d=i*h,m=a*c,_=a*h,p=s*h,g=o*u,v=o*c,E=o*h,T=r[0],M=r[1],A=r[2];return t[0]=(1-(m+p))*T,t[1]=(l+E)*T,t[2]=(d-v)*T,t[3]=0,t[4]=(l-E)*M,t[5]=(1-(f+p))*M,t[6]=(_+g)*M,t[7]=0,t[8]=(d+v)*A,t[9]=(_-g)*A,t[10]=(1-(f+m))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=a+a,h=s+s,f=o+o,l=a*c,d=a*h,m=a*f,_=s*h,p=s*f,g=o*f,v=u*c,E=u*h,T=u*f,M=r[0],A=r[1],L=r[2],I=i[0],O=i[1],S=i[2],R=(1-(_+g))*M,y=(d+T)*M,N=(m-E)*M,x=(d-T)*A,b=(1-(l+g))*A,C=(p+v)*A,P=(m+E)*L,w=(p-v)*L,H=(1-(l+_))*L;return t[0]=R,t[1]=y,t[2]=N,t[3]=0,t[4]=x,t[5]=b,t[6]=C,t[7]=0,t[8]=P,t[9]=w,t[10]=H,t[11]=0,t[12]=n[0]+I-(R*I+x*O+P*S),t[13]=n[1]+O-(y*I+b*O+w*S),t[14]=n[2]+S-(N*I+C*O+H*S),t[15]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[1]=h+g,t[2]=l-p,t[3]=0,t[4]=h-g,t[5]=1-c-m,t[6]=d+_,t[7]=0,t[8]=l+p,t[9]=d-_,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,e,n,r,i,a,s){var o=1/(n-e),u=1/(i-r),c=1/(a-s);return t[0]=2*a*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*u,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*u,t[10]=(s+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*a*2*c,t[15]=0,t},e.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),s=void 0;return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(s=1/(r-i),t[10]=(i+r)*s,t[14]=2*i*r*s):(t[10]=-1,t[14]=-2*r),t},e.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+o),c=2/(i+a);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(s-o)*u*.5,t[9]=(i-a)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},e.ortho=function(t,e,n,r,i,a,s){var o=1/(e-n),u=1/(r-i),c=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*u,t[14]=(s+a)*c,t[15]=1,t},e.lookAt=function(t,e,n,a){var s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=e[0],g=e[1],v=e[2],E=a[0],T=a[1],M=a[2],A=n[0],L=n[1],I=n[2];return Math.abs(p-A)0&&(h*=d=1/Math.sqrt(d),f*=d,l*=d);var m=u*l-c*f,_=c*h-o*l,p=o*f-u*h;return(d=m*m+_*_+p*p)>0&&(m*=d=1/Math.sqrt(d),_*=d,p*=d),t[0]=m,t[1]=_,t[2]=p,t[3]=0,t[4]=f*p-l*_,t[5]=l*m-h*p,t[6]=h*_-f*m,t[7]=0,t[8]=h,t[9]=f,t[10]=l,t[11]=0,t[12]=i,t[13]=a,t[14]=s,t[15]=1,t},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},e.subtract=o,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=t[9],d=t[10],m=t[11],_=t[12],p=t[13],g=t[14],v=t[15],E=e[0],T=e[1],M=e[2],A=e[3],L=e[4],I=e[5],O=e[6],S=e[7],R=e[8],y=e[9],N=e[10],x=e[11],b=e[12],C=e[13],P=e[14],w=e[15];return Math.abs(n-E)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-M)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-A)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(o-L)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(u-I)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-O)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(h-S)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-R)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(l-y)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(d-N)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(N))&&Math.abs(m-x)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(x))&&Math.abs(_-b)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(b))&&Math.abs(p-C)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(g-P)<=r.EPSILON*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(v-w)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(w))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function a(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=e[9],d=e[10],m=e[11],_=e[12],p=e[13],g=e[14],v=e[15],E=n[0],T=n[1],M=n[2],A=n[3];return t[0]=E*r+T*o+M*f+A*_,t[1]=E*i+T*u+M*l+A*p,t[2]=E*a+T*c+M*d+A*g,t[3]=E*s+T*h+M*m+A*v,E=n[4],T=n[5],M=n[6],A=n[7],t[4]=E*r+T*o+M*f+A*_,t[5]=E*i+T*u+M*l+A*p,t[6]=E*a+T*c+M*d+A*g,t[7]=E*s+T*h+M*m+A*v,E=n[8],T=n[9],M=n[10],A=n[11],t[8]=E*r+T*o+M*f+A*_,t[9]=E*i+T*u+M*l+A*p,t[10]=E*a+T*c+M*d+A*g,t[11]=E*s+T*h+M*m+A*v,E=n[12],T=n[13],M=n[14],A=n[15],t[12]=E*r+T*o+M*f+A*_,t[13]=E*i+T*u+M*l+A*p,t[14]=E*a+T*c+M*d+A*g,t[15]=E*s+T*h+M*m+A*v,t}function s(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=r+r,u=i+i,c=a+a,h=r*o,f=r*u,l=r*c,d=i*u,m=i*c,_=a*c,p=s*o,g=s*u,v=s*c;return t[0]=1-(d+_),t[1]=f+v,t[2]=l-g,t[3]=0,t[4]=f-v,t[5]=1-(h+_),t[6]=m+p,t[7]=0,t[8]=l+g,t[9]=m-p,t[10]=1-(h+d),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}e.mul=a,e.sub=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},e.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},e.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromValues=function(t,e,n,i,a,s,o,u,c){var h=new r.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=n,h[3]=i,h[4]=a,h[5]=s,h[6]=o,h[7]=u,h[8]=c,h},e.set=function(t,e,n,r,i,a,s,o,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else 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];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=h*s-o*c,l=-h*a+o*u,d=c*a-s*u,m=n*f+r*l+i*d;return m?(m=1/m,t[0]=f*m,t[1]=(-h*r+i*c)*m,t[2]=(o*r-i*s)*m,t[3]=l*m,t[4]=(h*n-i*u)*m,t[5]=(-o*n+i*a)*m,t[6]=d*m,t[7]=(-c*n+r*u)*m,t[8]=(s*n-r*a)*m,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8];return t[0]=s*h-o*c,t[1]=i*c-r*h,t[2]=r*o-i*s,t[3]=o*u-a*h,t[4]=n*h-i*u,t[5]=i*a-n*o,t[6]=a*c-s*u,t[7]=r*u-n*c,t[8]=n*s-r*a,t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8];return e*(c*a-s*u)+n*(-c*i+s*o)+r*(u*i-a*o)},e.multiply=i,e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=u,t[6]=l*r+d*s+c,t[7]=l*i+d*o+h,t[8]=l*a+d*u+f,t},e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=Math.sin(n),d=Math.cos(n);return t[0]=d*r+l*s,t[1]=d*i+l*o,t[2]=d*a+l*u,t[3]=d*s-l*r,t[4]=d*o-l*i,t[5]=d*u-l*a,t[6]=c,t[7]=h,t[8]=f,t},e.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[3]=h-g,t[6]=l+p,t[1]=h+g,t[4]=1-c-m,t[7]=d-_,t[2]=l-p,t[5]=d+_,t[8]=1-c-f,t},e.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(u*S-s*N-c*O)*x,t[2]=(s*y-o*S+c*I)*x,t[3]=(i*y-r*N-a*R)*x,t[4]=(n*N-i*S+a*O)*x,t[5]=(r*S-n*y-a*I)*x,t[6]=(_*L-p*A+g*M)*x,t[7]=(p*T-m*L-g*E)*x,t[8]=(m*A-_*T+g*v)*x,t):null},e.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=e[0],d=e[1],m=e[2],_=e[3],p=e[4],g=e[5],v=e[6],E=e[7],T=e[8];return Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-d)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-m)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(s-_)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(o-p)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(u-g)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-v)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(h-E)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-T)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(T))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1],m=n[2],_=n[3],p=n[4],g=n[5],v=n[6],E=n[7],T=n[8];return t[0]=l*r+d*s+m*c,t[1]=l*i+d*o+m*h,t[2]=l*a+d*u+m*f,t[3]=_*r+p*s+g*c,t[4]=_*i+p*o+g*h,t[5]=_*a+p*u+g*f,t[6]=v*r+E*s+T*c,t[7]=v*i+E*o+T*h,t[8]=v*a+E*u+T*f,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.sqrDist=e.dist=e.div=e.mul=e.sub=e.len=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},e.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},e.set=function(t,e,n){return t[0]=e,t[1]=n,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},e.subtract=a,e.multiply=s,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},e.distance=u,e.squaredDistance=c,e.length=h,e.squaredLength=f,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},e.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},e.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},e.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},e.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},e.rotate=function(t,e,n,r){var i=e[0]-n[0],a=e[1]-n[1],s=Math.sin(r),o=Math.cos(r);return t[0]=i*o-a*s+n[0],t[1]=i*s+a*o+n[1],t},e.angle=function(t,e){var n=t[0],r=t[1],i=e[0],a=e[1],s=n*n+r*r;s>0&&(s=1/Math.sqrt(s));var o=i*i+a*a;o>0&&(o=1/Math.sqrt(o));var u=(n*i+r*a)*s*o;return u>1?0:u<-1?Math.PI:Math.acos(u)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],a=e[0],s=e[1];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function h(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function f(t){var e=t[0],n=t[1];return e*e+n*n}e.len=h,e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=2),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,a=e[2]/n,s=e[3]/n,o=e[4],u=e[5],c=e[6],h=e[7],f=r*o+i*u+a*c+s*h;t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=(o-r*f)/n,t[5]=(u-i*f)/n,t[6]=(c-a*f)/n,t[7]=(h-s*f)/n}return t},e.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=e[0],l=e[1],d=e[2],m=e[3],_=e[4],p=e[5],g=e[6],v=e[7];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-m)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-_)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(u-p)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(c-g)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(h-v)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))};var r=s(n(0)),i=s(n(3)),a=s(n(4));function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e,n){var r=.5*n[0],i=.5*n[1],a=.5*n[2],s=e[0],o=e[1],u=e[2],c=e[3];return t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=r*c+i*u-a*o,t[5]=i*c+a*s-r*u,t[6]=a*c+r*o-i*s,t[7]=-r*s-i*o-a*u,t}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[4],u=n[5],c=n[6],h=n[7],f=e[4],l=e[5],d=e[6],m=e[7],_=n[0],p=n[1],g=n[2],v=n[3];return t[0]=r*v+s*_+i*g-a*p,t[1]=i*v+s*p+a*_-r*g,t[2]=a*v+s*g+r*p-i*_,t[3]=s*v-r*_-i*p-a*g,t[4]=r*h+s*o+i*c-a*u+f*v+m*_+l*g-d*p,t[5]=i*h+s*u+a*o-r*c+l*v+m*p+d*_-f*g,t[6]=a*h+s*c+r*u-i*o+d*v+m*g+f*p-l*_,t[7]=s*h-r*o-i*u-a*c+m*v-f*_-l*p-d*g,t}e.getReal=i.copy,e.setReal=i.copy,e.mul=c;var h=e.dot=i.dot,f=e.length=i.length,l=(e.len=f,e.squaredLength=i.squaredLength);e.sqrLen=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.fromValues=function(t,e,n,i,a,s){var o=new r.ARRAY_TYPE(6);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o[4]=a,o[5]=s,o},e.set=function(t,e,n,r,i,a,s){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=n*a-r*i;return u?(u=1/u,t[0]=a*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t[4]=(i*o-a*s)*u,t[5]=(r*s-n*o)*u,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=Math.sin(n),h=Math.cos(n);return t[0]=r*h+a*c,t[1]=i*h+s*c,t[2]=r*-c+a*h,t[3]=i*-c+s*h,t[4]=o,t[5]=u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r*c,t[1]=i*c,t[2]=a*h,t[3]=s*h,t[4]=o,t[5]=u,t},e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=r*c+a*h+o,t[5]=i*c+s*h+u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=e[0],h=e[1],f=e[2],l=e[3],d=e[4],m=e[5];return Math.abs(n-c)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-f)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-l)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-d)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(u-m)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(m))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1],f=n[2],l=n[3],d=n[4],m=n[5];return t[0]=r*c+a*h,t[1]=i*c+s*h,t[2]=r*f+a*l,t[3]=i*f+s*l,t[4]=r*d+a*m+o,t[5]=i*d+s*m+u,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*a-i*r;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-i*s,t[3]=n*s,t):null},e.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*o,t[1]=i*u+s*o,t[2]=r*-o+a*u,t[3]=i*-o+s*u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1];return t[0]=r*o,t[1]=i*o,t[2]=a*u,t[3]=s*u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=a,e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))},e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*o+a*u,t[1]=i*o+s*u,t[2]=r*c+a*h,t[3]=i*c+s*h,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.vec4=e.vec3=e.vec2=e.quat2=e.quat=e.mat4=e.mat3=e.mat2d=e.mat2=e.glMatrix=void 0;var r=d(n(0)),i=d(n(9)),a=d(n(8)),s=d(n(5)),o=d(n(4)),u=d(n(3)),c=d(n(7)),h=d(n(6)),f=d(n(2)),l=d(n(1));function d(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.glMatrix=r,e.mat2=i,e.mat2d=a,e.mat3=s,e.mat4=o,e.quat=u,e.quat2=c,e.vec2=h,e.vec3=f,e.vec4=l}])},function(t,e,n){"use strict";var r=function(){var t,e;try{t=Object.defineProperty,e=Object.defineProperties,t({},"$",{value:0})}catch(n){"__defineGetter__"in Object&&(t=function(t,e,n){return"value"in n&&(t[e]=n.value),"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),t},e=function(e,n){for(var r in n)n.hasOwnProperty(r)&&t(e,r,n[r]);return e})}var n=function(t){for(var n=1,r=arguments.length;n>1,s=n(t[a],e);if(0===s)return[a,a];s<0?r=a+1:i=a-1}return r>i?[i,r]:[r,i]}function v(t,e,n){var r=g(t,e,n);t.splice(r[1],0,e)}function E(t,e,n){return e<=t.length?t:new Array(e-t.length+1).join(n||"0")+t}function T(t){return t instanceof Float32Array?l:t instanceof Int8Array?o:t instanceof Uint8Array?u:t instanceof Int16Array?c:t instanceof Uint16Array?h:t instanceof Uint32Array?f:l}var M,A,L=(a(M={},o,Int8Array),a(M,u,Uint8Array),a(M,c,Int16Array),a(M,h,Uint16Array),a(M,f,Uint32Array),a(M,l,Float32Array),A=M,function(t){return A[t]||Float32Array});function I(t,e,n,r,i){if(t&&e){e.isGeometryData&&(e=e.data);for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return Array.isArray(t)||(t=Object.values(t)),t.reduce((function(t,n,r){return t.then((function(){return e(n,r)}))}),Promise.resolve())}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector3",isVector3:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec3.round(this.elements,this.elements),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},random:function(t){return r.vec3.random(this.elements,t),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r,i={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r=0,function(t){var e=++r;return t?e=t+"_"+e:e+="",e}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},degToRad:function(t){return t*this.DEG2RAD},radToDeg:function(t){return t*this.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};e.a=i},function(t,e,n){"use strict";var r,i=n(0),a=n(1),s=n(5),o=n(10),u=new s.a,c=new s.a,h=a.a.create({className:"Matrix4",isMatrix4:!0,constructor:function(){this.elements=i.mat4.create()},copy:function(t){return i.mat4.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return i.mat4.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this},identity:function(){return i.mat4.identity(this.elements),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this},fromRotationTranslationScaleOrigin:function(t,e,n,r){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this},lookAt:function(t,e,n){return t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this},targetTo:function(t,e,n){t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],h=n[1],f=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=h*m-f*d,g=f*l-o*m,v=o*d-h*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=h*m-f*d)*p+(g=f*l-(o+=1e-7)*m)*g+(v=o*d-h*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new h),this.determinant()<0&&(n.x*=-1),r.copy(this),u.inverse(n),r.scale(u),t.fromMat4(r),i&&i.set(0,0,0),this}});h.prototype.sub=h.prototype.subtract,h.prototype.mul=h.prototype.multiply,e.a=h},function(t,e,n){"use strict";var r=n(1),i=n(12),a=n(4),s=r.a.create({Extends:i.a,className:"Color",isColor:!0,r:{get:function(){return this.x},set:function(t){this.x=t}},g:{get:function(){return this.y},set:function(t){this.y=t}},b:{get:function(){return this.z},set:function(t){this.z=t}},a:{get:function(){return this.w},set:function(t){this.w=t}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;s.superclass.constructor.call(this,t,e,n,r)},toRGBArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t},fromUintArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e]/255,this.elements[1]=t[e+1]/255,this.elements[2]=t[e+2]/255,this.elements[3]=t[e+3]/255,this},fromHEX:function(t){return"number"==typeof t?t=Object(a.padLeft)(t.toString(16),6):("#"===t[0]&&(t=t.slice(1)),3===t.length&&(t=t.replace(/(\w)/g,"$1$1"))),this.elements[0]=parseInt(t.slice(0,2),16)/255,this.elements[1]=parseInt(t.slice(2,4),16)/255,this.elements[2]=parseInt(t.slice(4,6),16)/255,this},toHEX:function(){for(var t="",e=0;e<3;e++)t+=Object(a.padLeft)(Math.floor(255*this.elements[e]).toString(16),2);return t}});e.a=s},function(t,e,n){"use strict";var r=n(1).a.create({constructor:function(t,e,n){this.type=t,this.target=e,this.detail=n,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),i={_listeners:null,on:function(t,e,n){for(var r=this._listeners=this._listeners||{},i=r[t]=r[t]||[],a=0,s=i.length;a0){if(1===arguments.length)return delete this._listeners[t],this;for(var r=0,i=n.length;r0){var o=s.slice(0);if((n=n||new r(i,this,e))._stopped)return!1;for(var u=0;u-1&&s.splice(h,1)}}return!0}return!1}};e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(11),a=n(1),s=n(9),o=new i.a,u=a.a.create({Mixes:s.a,className:"Quaternion",isQuaternion:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.elements=r.quat.fromValues(t,e,n,i)},copy:function(t,e){return r.quat.copy(this.elements,t.elements),e||this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=this.elements;return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n||this.fire("update"),this},set:function(t,e,n,i,a){return r.quat.set(this.elements,t,e,n,i),a||this.fire("update"),this},identity:function(t){return r.quat.identity(this.elements),t||this.fire("update"),this},rotationTo:function(t,e,n){return r.quat.rotationTo(this.elements,t.elements,e.elements),n||this.fire("update"),this},setAxes:function(t,e,n,i){return r.quat.setAxes(this.elements,t.elements,e.elements,n.elements),i||this.fire("update"),this},setAxisAngle:function(t,e,n){return r.quat.setAxisAngle(this.elements,t.elements,e),n||this.fire("update"),this},getAxisAngle:function(t){return r.quat.getAxisAngle(t.elements,this.elements)},add:function(t,e){return r.quat.add(this.elements,this.elements,t.elements),e||this.fire("update"),this},multiply:function(t,e){return r.quat.multiply(this.elements,this.elements,t.elements),e||this.fire("update"),this},premultiply:function(t,e){return r.quat.multiply(this.elements,t.elements,this.elements),e||this.fire("update"),this},scale:function(t,e){return r.quat.scale(this.elements,this.elements,t),e||this.fire("update"),this},rotateX:function(t,e){return r.quat.rotateX(this.elements,this.elements,t),e||this.fire("update"),this},rotateY:function(t,e){return r.quat.rotateY(this.elements,this.elements,t),e||this.fire("update"),this},rotateZ:function(t,e){return r.quat.rotateZ(this.elements,this.elements,t),e||this.fire("update"),this},calculateW:function(t){return r.quat.calculateW(this.elements,this.elements),t||this.fire("update"),this},dot:function(t){return r.quat.dot(this.elements,t.elements)},lerp:function(t,e,n){return r.quat.lerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},slerp:function(t,e,n){return r.quat.slerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},sqlerp:function(t,e,n,i,a,s){return r.quat.sqlerp(this.elements,t.elements,e.elements,n.elements,i.elements,a),s||this.fire("update"),this},invert:function(t){return r.quat.invert(this.elements,this.elements),t||this.fire("update"),this},conjugate:function(t){return r.quat.conjugate(this.elements,this.elements),t||this.fire("update"),this},length:function(){return r.quat.length(this.elements)},squaredLength:function(){return r.quat.squaredLength(this.elements)},normalize:function(t){return r.quat.normalize(this.elements,this.elements),t||this.fire("update"),this},fromMat3:function(t,e){return r.quat.fromMat3(this.elements,t.elements),e||this.fire("update"),this},fromMat4:function(t,e){return o.fromMat4(t),this.fromMat3(o,e),this},exactEquals:function(t){return r.quat.exactEquals(this.elements,t.elements)},equals:function(t){return r.quat.equals(this.elements,t.elements)},fromEuler:function(t,e){var n=.5*t.x,r=.5*t.y,i=.5*t.z,a=t.order||"ZYX",s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),c=Math.cos(r),h=Math.sin(i),f=Math.cos(i),l=this.elements;return"XYZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"YXZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"ZXY"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"ZYX"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"YZX"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f-s*u*h):"XZY"===a&&(l[0]=s*c*f-o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f+s*u*h),e||this.fire("update"),this},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t,this.fire("update")}}});u.prototype.mul=u.prototype.multiply,u.prototype.len=u.prototype.length,u.prototype.sqrLen=u.prototype.squaredLength,e.a=u},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Matrix3",isMatrix3:!0,constructor:function(){this.elements=r.mat3.create()},copy:function(t){return r.mat3.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return r.mat3.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)n[r]=t[e+r];return this},set:function(t,e,n,i,a,s,o,u,c){return r.mat3.set(this.elements,t,e,n,i,a,s,o,u,c),this},identity:function(){return r.mat3.identity(this.elements),this},transpose:function(){return r.mat3.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.adjoint(this.elements,t.elements),this},determinant:function(){return r.mat3.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),r.mat3.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return r.mat3.translate(this.elements,this.elements,t.elements),this},rotate:function(t){return r.mat3.rotate(this.elements,this.elements,t),this},scale:function(t){return r.mat3.scale(this.elements,this.elements,t.elements),this},fromTranslation:function(t){return r.mat3.fromTranslation(this.elements,t.elements),this},fromRotation:function(t){return r.mat3.fromRotation(this.elements,t),this},fromScaling:function(t){return r.mat3.fromScaling(this.elements,t.elements),this},fromQuat:function(t){return r.mat3.fromQuat(this.elements,t.elements),this},normalFromMat4:function(t){return r.mat3.normalFromMat4(this.elements,t.elements),this},fromMat4:function(t){return r.mat3.fromMat4(this.elements,t.elements),this},frob:function(){return r.mat3.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),r.mat3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.mat3.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.mat3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.mat3.equals(t.elements,e.elements)},fromRotationTranslationScale:function(t,e,n,r,i){var a=Math.cos(t),s=Math.sin(t);return this.set(r*a,-i*s,0,r*s,i*a,0,e,n,1),this}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector4",isVector4:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.elements=r.vec4.fromValues(t,e,n,i)},copy:function(t){return r.vec4.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t[3+e]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],this},set:function(t,e,n,i){return r.vec4.set(this.elements,t,e,n,i),this},add:function(t,e){return e||(e=t,t=this),r.vec4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec4.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec4.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec4.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec4.ceil(this.elements,this.elements),this},floor:function(){return r.vec4.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec4.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec4.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec4.round(this.elements,this.elements),this},scale:function(t){return r.vec4.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec4.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec4.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec4.squaredDistance(t.elements,e.elements)},length:function(){return r.vec4.length(this.elements)},squaredLength:function(){return r.vec4.squaredLength(this.elements)},negate:function(){return r.vec4.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec4.inverse(this.elements,t.elements),this},normalize:function(){return r.vec4.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec4.dot(t.elements,e.elements)},lerp:function(t,e){return r.vec4.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return t=t||1,this.elements[0]=Math.random(),this.elements[1]=Math.random(),this.elements[2]=Math.random(),this.elements[3]=Math.random(),this.normalize(),this.scale(t),this},transformMat4:function(t){return r.vec4.transformMat4(this.elements,this.elements,t.elements),this},transformQuat:function(t){return r.vec4.transformQuat(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec4.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r=n(1),i=n(6),a=n(7),s=n(3),o=new a.a,u=i.a.DEG2RAD,c=i.a.RAD2DEG,h=r.a.create({className:"Euler",isEuler:!0,order:"ZYX",constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=new Float32Array([t,e,n]),this.updateDegrees()},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.elements[0]=t.x,this.elements[1]=t.y,this.elements[2]=t.z,this.order=t.order,this.updateDegrees(),this},set:function(t,e,n){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=n,this.updateDegrees(),this},setDegree:function(t,e,n){return this._degX=t,this._degY=e,this._degZ=n,this.updateRadians(),this},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e],this.elements[1]=t[e+1],this.elements[2]=t[e+2],this.updateDegrees(),this},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.elements[0],t[e+1]=this.elements[1],t[e+2]=this.elements[2],t},fromMat4:function(t,e){var n=t.elements,r=n[0],a=n[1],o=n[2],u=n[4],c=n[5],h=n[6],f=n[8],l=n[9],d=n[10];e=e||this.order,this.order=e;var m=i.a.clamp;return"XYZ"===e?(this.elements[1]=Math.asin(m(f,-1,1)),Math.abs(f)<.99999?(this.elements[0]=Math.atan2(-l,d),this.elements[2]=Math.atan2(-u,r)):(this.elements[0]=Math.atan2(h,c),this.elements[2]=0)):"YXZ"===e?(this.elements[0]=Math.asin(-m(l,-1,1)),Math.abs(l)<.99999?(this.elements[1]=Math.atan2(f,d),this.elements[2]=Math.atan2(a,c)):(this.elements[1]=Math.atan2(-o,r),this.elements[2]=0)):"ZXY"===e?(this.elements[0]=Math.asin(m(h,-1,1)),Math.abs(h)<.99999?(this.elements[1]=Math.atan2(-o,d),this.elements[2]=Math.atan2(-u,c)):(this.elements[1]=0,this.elements[2]=Math.atan2(a,r))):"ZYX"===e?(this.elements[1]=Math.asin(-m(o,-1,1)),Math.abs(o)<.99999?(this.elements[0]=Math.atan2(h,d),this.elements[2]=Math.atan2(a,r)):(this.elements[0]=0,this.elements[2]=Math.atan2(-u,c))):"YZX"===e?(this.elements[2]=Math.asin(m(a,-1,1)),Math.abs(a)<.99999?(this.elements[0]=Math.atan2(-l,c),this.elements[1]=Math.atan2(-o,r)):(this.elements[0]=0,this.elements[1]=Math.atan2(f,d))):"XZY"===e?(this.elements[2]=Math.asin(-m(u,-1,1)),Math.abs(u)<.99999?(this.elements[0]=Math.atan2(h,c),this.elements[1]=Math.atan2(f,r)):(this.elements[0]=Math.atan2(-l,d),this.elements[1]=0)):s.a.warn("Euler fromMat4() unsupported order: "+e),this.updateDegrees(),this},fromQuat:function(t,e){return o.fromQuat(t),this.fromMat4(o,e)},updateDegrees:function(){return this._degX=this.elements[0]*c,this._degY=this.elements[1]*c,this._degZ=this.elements[2]*c,this},updateRadians:function(){return this.elements[0]=this._degX*u,this.elements[1]=this._degY*u,this.elements[2]=this._degZ*u,this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*u}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*u}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*u}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*c}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*c}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*c}}});e.a=h},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector2",isVector2:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.elements=r.vec2.fromValues(t,e)},copy:function(t){return r.vec2.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],this},set:function(t,e){return r.vec2.set(this.elements,t,e),this},add:function(t,e){return e||(e=t,t=this),r.vec2.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec2.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec2.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec2.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec2.ceil(this.elements,this.elements),this},floor:function(){return r.vec2.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec2.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec2.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec2.round(this.elements,this.elements),this},scale:function(t){return r.vec2.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec2.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec2.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec2.squaredDistance(t.elements,e.elements)},length:function(){return r.vec2.length(this.elements)},squaredLength:function(){return r.vec2.squaredLength(this.elements)},negate:function(){return r.vec2.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec2.inverse(this.elements,t.elements),this},normalize:function(){return r.vec2.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec2.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec2.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec2.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return r.vec2.random(this.elements,t),this},transformMat3:function(t){return r.vec2.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec2.transformMat4(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec2.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec2.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){function r(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:4;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.indices=e,this.mode=n,this.attrs=[],this.attrIndexMap={}}return i(t,null,[{key:"cp",value:function(t){return t}},{key:"minus",value:function(t,e){return t-e}},{key:"plus",value:function(t,e){return t+e}},{key:"pp",value:function(t,e,n,r){return r-e-n+t}},{key:"depp",value:function(t,e,n,r){return e+n-t+r}},{key:"ATTR",get:function(){return s}},{key:"ATTR_NAME_ID",get:function(){return u}}]),i(t,[{key:"getAttrLength",value:function(){return this.attrs[0].data.length/this.attrs[0].itemCount}},{key:"attrIdToName",value:function(t){return o[t]||"OTHER"}},{key:"addAttr",value:function(t,e,n){s[t]?(this.attrIndexMap[t]=this.attrs.length,n||(n=f[t])):n||(n=1),this.attrs.push({name:t,itemCount:n,data:e})}},{key:"getAttr",value:function(t){if(this.attrIndexMap[t])return this.attrs[this.attrIndexMap[t]];for(var e=this.attrs.length-1;e>=0;e--){var n=this.attrs[e];if(n.name===t)return n}}},{key:"cal",value:function(t,e,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a=0;c--)o[u+c]=n.apply(null,i.map((function(t){return s[t*r.itemCount+c]})))}))}},{key:"quantize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attrs.forEach((function(e){if("JOINT"!==e.name&&0!=t[e.name]){var n=a.encode(e.data,t[e.name]||12);e.quantizationBit=n.quantizationBit,e.min=n.min,e.max=n.max,e.data=n.data}}))}},{key:"dequantize",value:function(){this.attrs.forEach((function(t){t.quantizationBit&&(t.data=a.decode(t.data,t.quantizationBit,t.min,t.max))}))}},{key:"convertTypedArray",value:function(){!this.indices||this.indices instanceof Array||(this.indices=Array.from(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array||t.data instanceof Float32Array||(t.data=Array.from(t.data))}))}},{key:"clearEBAttrs",value:function(){delete this.clers,delete this.holes,delete this.handles}},{key:"convertToTypedArray",value:function(){this.indices instanceof Array&&(this.getAttrLength()>65535?this.indices=new Uint32Array(this.indices):this.indices=new Uint16Array(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array&&(t.data=new Float32Array(t.data))}))}},{key:"prepareToWorkerSend",value:function(){return this.clearEBAttrs(),this.convertToTypedArray(),this.getAllBuffers()}},{key:"clone",value:function(){var e=new t(Array.from(this.indices),this.mode);return Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=Array.from(e.data),e})),e}},{key:"cloneStruct",value:function(){var e=new t;return e.mode=this.mode,this.indices&&(e.indices=[]),Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=[],e})),e}},{key:"toHilo3dGeometry",value:function(t,e){var n=e||new t.Geometry;return this.indices&&(this.indices.BYTES_PER_ELEMENT?n.indices=new t.GeometryData(this.indices,1):this.getAttrLength()>65535?n.indices=new t.GeometryData(new Uint32Array(this.indices),1):n.indices=new t.GeometryData(new Uint16Array(this.indices),1)),this.attrs.forEach((function(e){var r=c[e.name];r&&(e.data.BYTES_PER_ELEMENT?n[r]=new t.GeometryData(e.data,e.itemCount):n[r]=new t.GeometryData(new Float32Array(e.data),e.itemCount))})),n}},{key:"getAllBuffers",value:function(){var t=[];return this.indices.BYTES_PER_ELEMENT&&t.push(this.indices.buffer),this.attrs.forEach((function(e){e.data&&e.data.BYTES_PER_ELEMENT&&t.push(e.data.buffer)})),t}}],[{key:"fromGLTFPrimitive",value:function(e){var n=new t(e.indices,e.mode),r=e.attributes,i=0;for(var a in r.POSITION&&(i=r.POSITION.length/3),r)if(s[a]){var o=f[s[a]];i&&(o=r[a].length/i),n.addAttr(s[a],r[a],o)}else console.warn("Dont support attribute",a);return n}},{key:"fromHilo3dGeometry",value:function(e){var n=new t(e.indices.data,e.mode);for(var r in h)e[r]&&n.addAttr(h[r],e[r].data,e[r].size);return n}}]),t}();t.exports=l},function(t,e){var n={};function r(t){return n[t]||(n[t]=Math.pow(2,t)-1),n[t]}t.exports={cal:function(t,e,n,i){var a=r(i),s=n-e;return Math.round((t-e)/s*a)},encode:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=t.length,i=r(e),a=1/0,s=-1/0,o=0;o1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8,s=t.length,o=r(a),u=i-n||1,c=0;c1&&void 0!==arguments[1]?arguments[1]:8,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=t.length,s=r(e),o=i-n,u=new Float32Array(a),c=0;c1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=t.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return t instanceof Uint8Array&&(e=t.byteOffset,t=t.buffer),function(t){return new u[t.type](t).decompress()}(function(t,e){var n=new Uint8Array(t,e,4);if(65!==n[0]||77!==n[1]||67!==n[2])throw new Error("The file is not AMC format!");var r=c[n[3]].read(t,e+4);return r.geometry.type=n[3],r.geometry}(t,e))}var f,l=null,d=null;function m(t,e){return!l&&o()?(l=new s({wasmURL:t,memPages:e}),d=l.init()):d||Promise.resolve()}function _(t,e,n){if(l||m(e,n),!l||!l.isReady)return h(t);try{return l.decompress(t)}catch(e){return console.warn("wasm decompress error",e),h(t)}}var p=null;function g(t){return t=t||"https://g.alicdn.com/hilo/amc/0.1.27/worker.js",p||(!1===f||"undefined"==typeof Worker?Promise.reject("dont support web worker"):p=/^(?:http|blob|data:|\/\/)/.test(t)?new Promise((function(e,n){var r=new XMLHttpRequest;r.addEventListener("load",(function(){if("undefined"==typeof URL||"undefined"==typeof Blob)f=new Worker("data:application/javascript, ".concat(this.responseText));else{var t=URL.createObjectURL(new Blob([this.responseText]));f=new Worker(t)}f.onerror=function(t){console.log("web worker error",t),f=!1,n(t)},e(f)})),r.addEventListener("error",(function(t){return n(t)})),r.open("get",t,!0),r.send()})):new Promise((function(e,n){(f=new Worker(t)).onerror=function(t){console.log("web worker init error",t),f=!1,n(t)},e(f)})))}var v=0;function E(t,e,n,i){return e=e&&o(),t=new Uint8Array(t),g(i).then((function(i){return new Promise((function(a,s){var o=v++,u=function(e){if(e.data.id===o)if(i.removeEventListener("message",u),u=null,e.data.data){var n=e.data.data;n.constructor=r,n.__proto__=r.prototype,a(n)}else a(h(t))};i.addEventListener("message",u),i.postMessage({id:o,data:t,useWASM:e,wasmURL:n},[t.buffer])}))})).catch((function(r){return e?_(t,n):h(t)}))}t.exports={initWASM:m,initWorker:g,decompress:function(t,e,n){var r=o();return!r||t.byteLength>1048576?E(t,r,e,n):r?Promise.resolve(_(t,e)):Promise.resolve(h(t))},decompressWithJS:h,decompressWithWASM:_,decompressWithWorker:E,destory:function(){f&&(f.terminate(),f=null,p=null),l&&(l=null,d=null)}}},function(t,e,n){function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e=0;n-=2)e[t[n]]=t[n-1]}},{key:"mapBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex,i=this.currentVertex-n+1,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r,r=i,e[this.prevCorner(t[a])]=i++;this.currentVertex-=n}},{key:"mapHoleBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex-n+1,i=r,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r++,e[this.prevCorner(t[a])]=a?r:i;this.currentVertex-=n}},{key:"fixNegativeIndex",value:function(t){for(var e=t,n=this.indices;n[t]<0;){if(e===-n[-n[t]]||n[t]===n[-n[t]]){console.warn("dead loop bug!!"),n[s]=0;break}n[t]=n[-n[t]]}}},{key:"fixIndicesAndReadVertice",value:function(){for(var t,e=this.indices,n=this.handlesMap,r=this.clers,i=r.length,a=-1,s=[],u=0,c=0;u1&&void 0!==arguments[1]?arguments[1]:-1;if(!this.readedVertexMap[t]&&(this.readedVertexMap[t]=1,!this.noParallelogramPrediction)){var n=this.indices,r=this.geometry;-1===e?void 0!==this.lastReadVertexIndex&&r.cal(r,t,a.plus,this.lastReadVertexIndex,t):r.cal(r,t,a.depp,n[e],n[this.prevCorner(e)],n[this.nextCorner(e)],t),this.lastReadVertexIndex=t}}},{key:"markCorner",value:function(t,e){var n=this.indices;void 0===n[this.nextCorner(t)]&&(n[this.nextCorner(t)]=-this.prevCorner(e[0])),void 0===n[this.prevCorner(t)]&&(n[this.prevCorner(t)]=-this.nextCorner(e[e.length-1]))}},{key:"onFaceC",value:function(t){var e=this.indices,n=3*this.currentFace,r=this.currentVertex--;e[n]=r;var i=t.pop();return e[this.nextCorner(i)]=r,e[this.prevCorner(i)]=-this.nextCorner(t[t.length-1]),i=t.shift(),e[this.prevCorner(i)]=r,e[this.nextCorner(i)]=-this.prevCorner(t[0]),t.push(n),t}},{key:"onFaceL",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.unshift(e+2),t.push(e),t}},{key:"onFaceF",value:function(t,e){return t&&this.mapBoundary(t),this.onFaceE(null,e)}},{key:"onFaceE",value:function(t,e){var n=3*this.currentFace;return t&&e.push(t),[n+2,n+1,n]}},{key:"onFaceR",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.push(e+1,e),t}},{key:"onHandleEnd",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=this.handlesMap[this.currentFace],s=e.splice(0,t);return e.shift(),n.push(s),r[this.nextCorner(a)]=-(i+1),r[this.prevCorner(a)]=-this.nextCorner(s[s.length-1]),r[i]=-this.prevCorner(s[0]),e.push(i),e}},{key:"onHandleStart",value:function(t,e){for(var n,i=this.indices,a=3*this.currentFace,s=this.handlesMap[this.currentFace],o=e.length-1;o>=0;o--){var u=e[o].indexOf(s);if(u>=0){var c,h=(n=e.splice(o,1)[0]).splice(0,u);n.shift(),(c=n).push.apply(c,r(h));break}}return i[this.nextCorner(s)]=-(a+1),i[this.prevCorner(s)]=-this.nextCorner(n[n.length-1]),i[a]=-this.prevCorner(t[0]),(t=n.concat(t)).push(a),t}},{key:"onFaceS",value:function(t,e,n){var r=this.handlesMap,i=this.indices,a=3*this.currentFace;if(r[this.currentFace]){this.markCorner(t.pop(),t);var s=t.indexOf(r[this.currentFace]);t=s>=0?this.onHandleEnd(s,t,n):this.onHandleStart(t,n)}else{var o=t.pop();this.markCorner(o,t),i[a]=-this.nextCorner(o);var u=e.pop();this.markCorner(u.pop(),u),(t=u.concat(t)).push(a)}return t}},{key:"onFaceM",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=t.splice(0,this.holes[this.currentHole--]);this.mapHoleBoundary(a);var s=r[this.prevCorner(a[0])];r[i]=s;var o=t.pop();return r[this.prevCorner(o)]=-this.nextCorner(t[t.length-1]),r[this.nextCorner(o)]=s,o=t.shift(),r[this.prevCorner(o)]=s,r[this.nextCorner(o)]=-this.prevCorner(t[0]),t.push(i),t}},{key:"decompress",value:function(){this.readedVertexMap=new Uint8Array(this.vertexCount);var t=this.faceCount,e=this.indices=new Array(3*t);this.currentFace=t-1,this.currentVertex=this.vertexCount-1,this.currentHole=this.holes.length-1;for(var n,r=this.clers,i=[],a=[];this.currentFace>=0;){var s="onFace"+u[r[this.currentFace]];this[s]?n=this[s](n,i,a):console.warn("has no ".concat(s)),this.currentFace--}return this.mapBoundary(n),this.fixIndicesAndReadVertice(this.indices),this.geometry.indices=e,this.geometry.dequantize(),this.geometry}},{key:"_onDecompressFace",value:function(t,e){this.onDecompressFace&&this.onDecompressFace(t,e)}}])&&i(e.prototype,n),t}();t.exports=c},function(t,e){var n={C:0,R:1,L:2,S:3,E:4,M:5,F:6},r=[];for(var i in n)r[n[i]]=i;n.map=r,t.exports=n},function(t,e,n){var r=n(0);function i(t,e,n,r){return new t(e.slice(n,n+r*t.BYTES_PER_ELEMENT))}t.exports={read:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(t),a=new r,s=function(t,e){var n={};return n.version=t.getUint8(e++),n.faceCount=t.getUint32(e,!0),e+=4,n.vertexCount=t.getUint32(e,!0),e+=4,n.attrCount=t.getUint8(e++),n.noParallelogramPrediction=t.getUint8(e++),n.holesCount=t.getUint16(e,!0),e+=2,n.handlesCount=t.getUint16(e,!0),e+=2,n.headerBytes=15,n}(n,e);return e+=s.headerBytes,a.mode="CLERS",e=function(t,e,n,r){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wasmURL=e.wasmURL||"https://ossgw.alicdn.com/tmall-c3/tmx/70b8d82ccf33e97a124e54c2d6a3e0c7.wasm",this.memPages=e.memPages||256,this.memPages<256&&(this.memPages=256),this.isReady=!1}var e,n;return e=t,(n=[{key:"initASMJS",value:function(){this.isReady=!0,this.dv=new DataView(HEAP8.buffer),this.heap8=HEAP8,this.ins={exports:{__Z7AMCinitj:Module.__Z7AMCinitj,__Z12AMDecompressv:Module.__Z12AMDecompressv}}}},{key:"init",value:function(){var t=this,e=this.memory=new WebAssembly.Memory({initial:this.memPages});this.dv=new DataView(e.buffer);var n=this.heap8=new Uint8Array(e.buffer),r={global:{NaN:5,Infinity:6},env:{memoryBase:0,memory:e,_malloc:function(){return 2097152},_memset:function(t,e,r){return n.fill(e,t,t+r),t},_printf:function(t,e){for(var r=t;n[r];)r++;var i=String.fromCharCode.apply(String,function(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e65536?new Uint32Array(d):new Uint16Array(d);var m=new i(d);return h.forEach((function(t){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(t,3),r=n[0],i=n[1],a=n[2],s=new Float32Array(e.buffer.slice(a,a+u*i*4));m.addAttr(m.attrIdToName(r),s,i)})),m}}])&&r(e.prototype,n),t}();t.exports=a},function(t,e){var n;t.exports=function(){return void 0===n&&(n=function(){if("undefined"==typeof WebAssembly||"undefined"==typeof fetch||function(){if(!/iPad|iPhone|iPod/i.test(navigator.userAgent))return!1;if(/OS (\d+)_(\d+)_?(\d+)?/i.test(navigator.userAgent)){var t=Number(RegExp.$1),e=Number(RegExp.$2);if(11===t&&e>=3||t>11)return!1}return!0}())return!1;try{var t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)}catch(t){return console.log("err while check WebAssembly",t),!1}}()),n}}])},function(t,e,n){"use strict";var r=n(34),i=n.n(r),a=n(1),s=n(5),o=a.a.create({className:"Ray",isRay:!0,origin:{get:function(){return this._origin},set:function(t){this._origin=t,this._ray.origin=t.elements}},direction:{get:function(){return this._direction},set:function(t){this._direction=t,this._ray.direction=t.elements}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._ray=new i.a,this.origin=t.origin||new s.a(0,0,0),this.direction=t.direction||new s.a(0,0,-1)},set:function(t,e){return this.origin=t,this.direction=e,this},copy:function(t){this.origin.copy(t.origin),this.direction.copy(t.direction)},clone:function(){return new this.constructor({origin:this.origin.clone(),direction:this.direction.clone()})},fromCamera:function(t,e,n,r,i){t.isPerspectiveCamera?(t.worldMatrix.getTranslation(this.origin),this.direction.set(e,n,0),this.direction.copy(t.unprojectVector(this.direction,r,i)),this.direction.sub(this.origin).normalize()):t.isOrthographicCamera&&(this.origin.set(e,n,(t.near+t.far)/(t.near-t.far)),this.origin.copy(t.unprojectVector(this.origin,r,i)),this.direction.set(0,0,-1).transformDirection(t.worldMatrix).normalize())},transformMat4:function(t){this.origin.transformMat4(t),this.direction.transformDirection(t).normalize()},sortPoints:function(t,e){var n=this;e?t.sort((function(t,r){return n.squaredDistance(t[e])-n.squaredDistance(r[e])})):t.sort((function(t,e){return n.squaredDistance(t)-n.squaredDistance(e)}))},squaredDistance:function(t){return this.origin.squaredDistance(t)},distance:function(t){return this.origin.distance(t)},intersectsSphere:function(t,e){var n=this._ray.intersectsSphere(t,e);return this._getRes(n)},intersectsPlane:function(t,e){var n=this._ray.intersectsPlane(t,e);return this._getRes(n)},intersectsTriangle:function(t){var e=this._ray.intersectsTriangle(t);return this._getRes(e)},intersectsBox:function(t){var e=this._ray.intersectsBox(t);return this._getRes(e)},intersectsTriangleCell:function(t,e){var n=this._ray.intersectsTriangleCell(t,e);return this._getRes(n)},_getRes:function(t){return t?new s.a(t[0],t[1],t[2]):null}});e.a=o},function(t,e,n){"use strict";var r=n(0),i=n(1),a=n(9),s=n(5),o=i.a.create({Mixes:a.a,Extends:s.a,className:"Vector3Notifier",isVector3Notifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this.fire("update"),this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this.fire("update"),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this.fire("update"),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this.fire("update"),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this.fire("update"),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this.fire("update"),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this.fire("update"),this},round:function(){return r.vec3.round(this.elements,this.elements),this.fire("update"),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this.fire("update"),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this.fire("update"),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this.fire("update"),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this.fire("update"),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this.fire("update"),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this.fire("update"),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this.fire("update"),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},random:function(t){return r.vec3.random(this.elements,t),this.fire("update"),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this.fire("update"),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this.fire("update"),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this.fire("update"),this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this.fire("update"),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}}});e.a=o},function(t,e){t.exports="#define GLSLIFY 1\n#define HILO_FRONT_SIDE 1028\n#define HILO_BACK_SIDE 1029\n#define HILO_FRONT_AND_BACK_SIDE 1032\n#define HILO_PI 3.141592653589793\n#define HILO_INVERSE_PI 0.3183098861837907"},function(t,e,n){"use strict";var r=n(1),i=n(5),a=r.a.create({className:"Plane",isPlane:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=t,this.distance=e},copy:function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},clone:function(){return new this.constructor(this.normal.clone(),this.distance)},set:function(t,e,n,r){return this.normal.set(t,e,n),this.distance=r,this},normalize:function(){var t=1/this.normal.length();return this.normal.scale(t),this.distance*=t,this},distanceToPoint:function(t){return this.normal.dot(t)+this.distance},projectPoint:function(t){return(new i.a).copy(this.normal).scale(-this.distanceToPoint(t)).add(t)}});e.a=a},function(t,e,n){"use strict";var r=n(1),i=n(5),a=new i.a,s=r.a.create({className:"Sphere",isSphere:!0,radius:0,constructor:function(t){Object.assign(this,t),this.center||(this.center=new i.a(0,0,0))},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},fromPoints:function(t){for(var e=this.center,n=0,r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this.fire("update"),this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this.fire("update"),this},identity:function(){return i.mat4.identity(this.elements),this.fire("update"),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this.fire("update"),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this.fire("update"),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this.fire("update"),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},premultiply:function(t){return this.multiply(t,this),this.fire("update"),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this.fire("update"),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this.fire("update"),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this.fire("update"),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this.fire("update"),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this.fire("update"),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this.fire("update"),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this.fire("update"),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this.fire("update"),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this.fire("update"),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this.fire("update"),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this.fire("update"),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this.fire("update"),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this.fire("update"),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},fromRotationTranslationScaleOrigin:function(t,e,n,r,a){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),a||this.fire("update"),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this.fire("update"),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this.fire("update"),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this.fire("update"),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this.fire("update"),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this.fire("update"),this},lookAt:function(t,e,n){return t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},targetTo:function(t,e,n){t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],u=n[1],c=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=u*m-c*d,g=c*l-o*m,v=o*d-u*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=u*m-c*d)*p+(g=c*l-(o+=1e-7)*m)*g+(v=o*d-u*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this.fire("update"),this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new u.a),this.determinant()<0&&(n.x*=-1),r.copy(this),h.inverse(n),r.scale(h),t.fromMat4(r),i&&i.set(0,0,0),this}});e.a=l},function(t,e,n){"use strict";var r=n(1),i=n(9),a=n(6),s=n(13),o=a.a.DEG2RAD,u=a.a.RAD2DEG,c=r.a.create({Mixes:i.a,Extends:s.a,className:"EulerNotifier",isEulerNotifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;s.a.call(this,t,e,n)},updateDegrees:function(){return c.superclass.updateDegrees.call(this),this.fire("update"),this},updateRadians:function(){return c.superclass.updateRadians.call(this),this.fire("update"),this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*o,this.fire("update")}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*o,this.fire("update")}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*o,this.fire("update")}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*u,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*u,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*u,this.fire("update")}}});e.a=c},function(t,e,n){"use strict";var r=n(1),i=n(19),a=r.a.create({className:"Frustum",isFrustum:!0,constructor:function(){this.planes=[];for(var t=6;t--;)this.planes.push(new i.a)},copy:function(t){var e=t.planes;return this.planes.forEach((function(t,n){t.copy(e[n])})),this},clone:function(){var t=new this.constructor;return t.copy(this),t},fromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],s=n[3],o=n[4],u=n[5],c=n[6],h=n[7],f=n[8],l=n[9],d=n[10],m=n[11],_=n[12],p=n[13],g=n[14],v=n[15];return e[0].set(s-r,h-o,m-f,v-_).normalize(),e[1].set(s+r,h+o,m+f,v+_).normalize(),e[2].set(s+i,h+u,m+l,v+p).normalize(),e[3].set(s-i,h-u,m-l,v-p).normalize(),e[4].set(s-a,h-c,m-d,v-g).normalize(),e[5].set(s+a,h+c,m+d,v+g).normalize(),this},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n) 0.0) {\n attenuation *= max(min(1.0 - pow( distance / range, 4.0 ), 1.0), 0.0);\n }\n #else\n attenuation = 1.0/(info.x + info.y * distance + info.z * distance * distance);\n #endif\n\n return attenuation;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nfloat unpackFloat(vec4 rgbaDepth) {\n const vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n float depth = dot(rgbaDepth, bitShift);\n return depth;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nbool isOutOfRange(vec2 pos) {\n if (pos.x < 0.0 || pos.x > 1.0 || pos.y < 0.0 || pos.y > 1.0) {\n return true;\n }\n return false;\n}\n\nfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float bias, vec3 fragPos, mat4 lightSpaceMatrix) {\n vec4 fragPosLightSpace = lightSpaceMatrix * vec4(fragPos, 1.0);\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n projCoords = projCoords * 0.5 + 0.5;\n if (isOutOfRange(projCoords.xy)) {\n return 1.0;\n }\n float currentDepth = projCoords.z;\n float shadow = 0.0;\n vec2 texelSize = 1.0 / shadowMapSize;\n for (int x = -1; x <= 1; ++x) {\n for (int y = -1; y <= 1; ++y) {\n vec2 pos = projCoords.xy + vec2(x, y) * texelSize;\n if (isOutOfRange(pos)) {\n shadow += 1.0;\n } else {\n float pcfDepth = texture2D(shadowMap, pos).r;\n shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n }\n }\n }\n return 1.0 - shadow / 9.0;\n}\n\nfloat getShadow(samplerCube shadowMap, float bias, vec3 lightPos, vec3 position, vec2 camera, mat4 lightSpaceMatrix) {\n vec4 distanceVec = lightSpaceMatrix * vec4(position, 1.0) - lightSpaceMatrix * vec4(lightPos, 1.0);\n float currentDistance = length(distanceVec);\n vec3 direction = normalize(distanceVec).xyz;\n\n float shadow = 0.0;\n const float samples = 2.0;\n const float offset = 0.01;\n const float step = offset / (samples * 0.5);\n for(float x = -offset; x < offset; x +=step)\n {\n for(float y = -offset; y < offset; y +=step)\n {\n for(float z = -offset; z < offset; z +=step)\n {\n float closestDistance = camera[0] + (camera[1] - camera[0]) * unpackFloat(textureCube(shadowMap, direction + vec3(x, y, z)));\n if (closestDistance == camera[0]) {\n continue;\n }\n else if(currentDistance - bias > closestDistance)\n shadow += 1.0;\n }\n }\n }\n shadow /= (samples * samples * samples);\n\n return 1.0 - shadow;\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(64)+"\n\n#ifdef HILO_HAS_LIGHT\n #ifdef HILO_HAS_SPECULAR\n uniform float u_shininess;\n #ifdef HILO_SPECULAR_MAP\n uniform HILO_SAMPLER_2D u_specular;\n #else\n uniform vec4 u_specular;\n #endif\n #endif\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #else\n uniform vec4 u_emission;\n #endif\n #ifdef HILO_AMBIENT_MAP\n uniform HILO_SAMPLER_2D u_ambient;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform mat4 u_specularEnvMatrix;\n uniform float u_reflectivity;\n uniform float u_refractRatio;\n uniform float u_refractivity;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_FIX_MAX_BUG\n float hilo_max(float a, float b){\n if (a > b) {\n return a;\n }\n return b;\n }\n #define HILO_MAX(a, b) hilo_max(a, b);\n#else\n #define HILO_MAX(a, b) max(a, b);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_DIFFUSE_MAP)\n diffuse = HILO_TEXTURE_2D(u_diffuse);\n#elif defined(HILO_DIFFUSE_CUBE_MAP)\n diffuse = textureCube(u_diffuse, v_position);\n#elif defined(HILO_HAS_COLOR)\n diffuse = v_color;\n#else\n diffuse = u_diffuse;\n#endif\ncolor.a = diffuse.a;"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_LIGHT\n vec3 lightDiffuse = vec3(0, 0, 0);\n vec3 lightAmbient = vec3(0, 0, 0);\n vec3 viewPos = vec3(0, 0, 0);\n\n #ifdef HILO_AMBIENT_MAP\n lightAmbient = HILO_TEXTURE_2D(u_ambient).rgb;\n #else\n lightAmbient = diffuse.rgb;\n #endif\n\n #ifdef HILO_HAS_SPECULAR\n vec3 lightSpecular = vec3(0, 0, 0);\n #ifdef HILO_SPECULAR_MAP\n vec4 specular = HILO_TEXTURE_2D(u_specular);\n #else\n vec4 specular = u_specular;\n #endif\n #endif\n \n #ifdef HILO_EMISSION_MAP\n vec4 emission = HILO_TEXTURE_2D(u_emission);\n #else\n vec4 emission = u_emission;\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = -u_directionalLightsInfo[i];\n\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n\n float diff = getDiffuse(normal, lightDir);\n lightDiffuse += diff * u_directionalLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * u_directionalLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = -u_spotLightsDir[i];\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, normalize(distanceVec));\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n\n lightDiffuse += intensity * attenuation * shadow * diff * u_spotLightsColor[i];\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += intensity * attenuation * shadow * spec * u_spotLightsColor[i];\n #endif\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0;i < HILO_POINT_LIGHTS;i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, lightDir);\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n lightDiffuse += diff * attenuation * u_pointLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * attenuation * u_pointLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n #ifndef HILO_HAS_SPECULAR\n vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);\n #endif\n vec3 viewDir = normalize(vec3(0, 0, 0) - v_fragPos);\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuse.rgb, specular.rgb, sqrt(2.0/(u_shininess+2.0)), normal, viewDir, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_AMBIENT_LIGHTS\n color.rgb += u_ambientLightsColor * lightAmbient;\n #endif\n\n #if defined(HILO_SPECULAR_ENV_MAP) && defined(HILO_HAS_SPECULAR)\n vec3 I = normalize(v_fragPos - viewPos);\n if (u_reflectivity > 0.0) {\n vec3 R = reflect(I, normal);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_reflectivity;\n }\n if (u_refractivity > 0.0) {\n vec3 R = refract(I, normal, u_refractRatio);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_refractivity;\n }\n #endif\n\n color.rgb += lightDiffuse * diffuse.rgb;\n #ifdef HILO_HAS_SPECULAR\n color.rgb += lightSpecular * specular.rgb;\n #endif\n\n color.rgb += emission.rgb;\n#else\n color.rgb = diffuse.rgb;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_FOG\n float fogFactor = 1.0;\n\n #ifdef HILO_FOG_LINEAR\n fogFactor = (u_fogInfo.y - v_dist)/(u_fogInfo.y - u_fogInfo.x);\n #elif defined(HILO_FOG_EXP)\n fogFactor = exp(-abs(u_fogInfo * v_dist));\n #elif defined(HILO_FOG_EXP2)\n fogFactor = exp(-(u_fogInfo * v_dist) * (u_fogInfo * v_dist)); \n #endif\n \n fogFactor = clamp(fogFactor, 0.0, 1.0);\n color = mix(u_fogColor, color, fogFactor);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n uniform mat4 u_positionDecodeMat;\n #endif\n #ifdef HILO_NORMAL_QUANTIZED\n uniform mat4 u_normalDecodeMat;\n #endif\n #ifdef HILO_UV_QUANTIZED\n uniform mat3 u_uvDecodeMat;\n #endif\n #ifdef HILO_UV1_QUANTIZED\n uniform mat3 u_uv1DecodeMat;\n #endif\n\n vec2 unQuantize(vec2 data, mat3 decodeMat) {\n vec3 result = vec3(data, 1.0);\n result = decodeMat * result;\n return result.xy;\n }\n\n vec3 unQuantize(vec3 data, mat4 decodeMat) {\n vec4 result = vec4(data, 1.0);\n result = decodeMat * result;\n return result.xyz;\n }\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n attribute vec4 a_skinIndices;\n attribute vec4 a_skinWeights;\n #ifdef HILO_JOINT_MAT_MAP\n uniform sampler2D u_jointMatTexture;\n uniform vec2 u_jointMatTextureSize;\n mat4 getJointMat(float index) {\n index *= 4.0;\n float x = float(mod(index, u_jointMatTextureSize.x));\n float y = float(floor(index / u_jointMatTextureSize.x));\n float dx = 1.0 / float(u_jointMatTextureSize.x);\n float dy = 1.0 / float(u_jointMatTextureSize.y);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(u_jointMatTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(u_jointMatTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(u_jointMatTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(u_jointMatTexture, vec2(dx * (x + 3.5), y));\n mat4 mat = mat4(v1, v2, v3, v4);\n return mat;\n }\n\n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * getJointMat(indices.x);\n mat += weights.y * getJointMat(indices.y);\n mat += weights.z * getJointMat(indices.z);\n mat += weights.w * getJointMat(indices.w);\n return mat;\n }\n #else\n uniform mat4 u_jointMat[HILO_JOINT_COUNT];\n \n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * u_jointMat[int(indices.x)];\n mat += weights.y * u_jointMat[int(indices.y)];\n mat += weights.z * u_jointMat[int(indices.z)];\n mat += weights.w * u_jointMat[int(indices.w)];\n return mat;\n }\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n attribute vec2 a_texcoord0;\n varying vec2 v_texcoord0;\n #ifdef HILO_UV_MATRIX\n uniform mat3 u_uvMatrix;\n #endif\n#endif\n\n#ifdef HILO_HAS_TEXCOORD1\n attribute vec2 a_texcoord1;\n varying vec2 v_texcoord1;\n #ifdef HILO_UV_MATRIX1\n uniform mat3 u_uvMatrix1;\n #endif\n#endif\n\n#ifdef HILO_DIFFUSE_CUBE_MAP\n varying vec3 v_position;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n attribute vec3 a_normal;\n uniform mat3 u_normalMatrix;\n varying vec3 v_normal;\n\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n attribute vec4 a_tangent;\n varying mat3 v_TBN;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n uniform mat4 u_modelViewMatrix;\n #ifdef HILO_HAS_FOG\n varying float v_dist;\n #endif\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS) \n varying vec3 v_fragPos;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n uniform float u_morphWeights[HILO_MORPH_TARGET_COUNT];\n\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition0;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal0;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent0;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition1;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal1;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent1;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition2;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal2;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent2;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition3;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal3;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent3;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition4;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal4;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent4;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition5;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal5;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent5;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition6;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal6;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent6;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition7;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal7;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent7;\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n attribute vec3 a_color;\n #elif HILO_COLOR_SIZE == 4\n attribute vec4 a_color;\n #endif\n varying vec4 v_color;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n varying float v_fragDepth;\n #else\n uniform float u_logDepth;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n v_color = vec4(a_color, 1.0);\n #elif HILO_COLOR_SIZE == 4\n v_color = a_color;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n pos.xyz = unQuantize(pos.xyz, u_positionDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD0) && defined(HILO_UV_QUANTIZED)\n uv = unQuantize(uv, u_uvDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD1) && defined(HILO_UV1_QUANTIZED)\n uv1 = unQuantize(uv1, u_uv1DecodeMat);\n #endif\n #if defined(HILO_HAS_NORMAL) && defined(HILO_NORMAL_QUANTIZED)\n normal = unQuantize(normal, u_normalDecodeMat);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent0 * u_morphWeights[0];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent1 * u_morphWeights[1];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent2 * u_morphWeights[2];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent3 * u_morphWeights[3];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent4 * u_morphWeights[4];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent5 * u_morphWeights[5];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent6 * u_morphWeights[6];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent7 * u_morphWeights[7];\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n mat4 skinMat = getJointMat(a_skinWeights, a_skinIndices);\n pos = skinMat * pos;\n\n #ifdef HILO_HAS_NORMAL\n normal = mat3(skinMat) * normal;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n #ifdef HILO_UV_MATRIX\n v_texcoord0 = (u_uvMatrix * vec3(uv, 1.0)).xy;\n #else\n v_texcoord0 = uv;\n #endif\n#endif\n#ifdef HILO_HAS_TEXCOORD1\n #ifdef HILO_UV_MATRIX1\n v_texcoord1 = (u_uvMatrix1 * vec3(uv1, 1.0)).xy;\n #else\n v_texcoord1 = uv1;\n #endif\n#endif\n#ifdef HILO_DIFFUSE_CUBE_MAP\n v_position = pos.xyz;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n vec3 T = normalize(u_normalMatrix * tangent.xyz);\n vec3 N = normalize(u_normalMatrix * normal);\n T = normalize(T - dot(T, N) * N);\n vec3 B = cross(N, T) * tangent.w;\n v_TBN = mat3(T, B, N);\n #endif\n v_normal = normalize(u_normalMatrix * normal);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n vec3 fragPos = (u_modelViewMatrix * pos).xyz;\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS)\n v_fragPos = fragPos;\n #endif\n\n #ifdef HILO_HAS_FOG\n v_dist = length(fragPos);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n v_fragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2( max( 1e-6, gl_Position.w + 1.0 ) ) * u_logDepth - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n// https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/packDepth.frag\n// Packing a float in GLSL with multiplication and mod\n// http://blog.gradientstudios.com/2012/08/23/shadow-map-improvement\nvec4 packFloat(float depth) {\n const vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n\n // combination of mod and multiplication and division works better\n vec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);\n res -= res.xxyz * bit_mask;\n return res;\n}\n\n\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(86)+"\n"+n(64)+'\n\nuniform vec4 u_baseColor;\nuniform vec4 u_emissionFactor;\n\n#ifdef HILO_BASE_COLOR_MAP\n uniform HILO_SAMPLER_2D u_baseColorMap;\n#endif\n\n#ifdef HILO_NEED_WORLD_NORMAL\n uniform mat3 u_viewInverseNormalMatrix;\n#endif\n\n#ifdef HILO_HAS_LIGHT\n uniform float u_metallic;\n #ifdef HILO_METALLIC_MAP\n uniform HILO_SAMPLER_2D u_metallicMap;\n #endif\n uniform float u_roughness;\n #ifdef HILO_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_roughnessMap;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_metallicRoughnessMap;\n #endif\n #ifdef HILO_OCCLUSION_MAP\n uniform HILO_SAMPLER_2D u_occlusionMap;\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n uniform float u_occlusionStrength;\n #endif\n\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_DIFFUSE_ENV_MAP_CUBE\n uniform samplerCube u_diffuseEnvMap;\n #else\n uniform sampler2D u_diffuseEnvMap;\n #endif\n uniform float u_diffuseEnvIntensity;\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n uniform vec3 u_diffuseEnvSphereHarmonics3[9];\n uniform float u_diffuseEnvIntensity;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n uniform sampler2D u_brdfLUT;\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform float u_specularEnvIntensity;\n\n uniform float u_specularEnvMapMipCount;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n uniform vec4 u_specular;\n uniform float u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n uniform HILO_SAMPLER_2D u_specularGlossinessMap;\n #endif\n #endif\n\n #ifdef HILO_LIGHT_MAP\n uniform HILO_SAMPLER_2D u_lightMap;\n #endif\n\n #ifdef HILO_HAS_CLEARCOAT\n uniform float u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n uniform HILO_SAMPLER_2D u_clearcoatMap;\n #endif\n\n uniform float u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_clearcoatRoughnessMap;\n #endif\n #endif\n\n\n // PBR Based on https://github.com/KhronosGroup/glTF-WebGL-PBR\n\n // Basic Lambertian diffuse\n // Implementation from Lambert\'s Photometria https://archive.org/details/lambertsphotome00lambgoog\n // See also [1], Equation 1\n vec3 diffuse(vec3 diffuseColor) {\n return diffuseColor * HILO_INVERSE_PI;\n }\n\n // The following equation models the Fresnel reflectance term of the spec equation (aka F())\n // Implementation of fresnel from [4], Equation 15\n vec3 specularReflection(vec3 reflectance0, vec3 reflectance90, float VdotH) {\n return reflectance0 + (reflectance90 - reflectance0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n }\n\n // This calculates the specular geometric attenuation (aka G()),\n // where rougher material will reflect less light back to the viewer.\n // This implementation is based on [1] Equation 4, and we adopt their modifications to\n // alphaRoughness as input as originally proposed in [2].\n float geometricOcclusion(float NdotL, float NdotV, float alphaRoughness) {\n float r = alphaRoughness * alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r + (1.0 - r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r + (1.0 - r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n }\n\n // The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())\n // Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz\n // Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.\n float microfacetDistribution(float alphaRoughness, float NdotH) {\n float roughnessSq = alphaRoughness * alphaRoughness;\n float f = (NdotH * roughnessSq - NdotH) * NdotH + 1.0;\n return roughnessSq * HILO_INVERSE_PI / (f * f);\n }\n\n vec3 computeDiffuseSHLight(vec3 normal, in vec3 sh[9]) {\n return sh[0] +\n sh[1] * (normal.y) +\n sh[2] * (normal.z) +\n sh[3] * (normal.x) +\n sh[4] * (normal.y * normal.x) +\n sh[5] * (normal.y * normal.z) +\n sh[6] * ((3.0 * normal.z * normal.z) - 1.0) +\n sh[7] * (normal.z * normal.x) +\n sh[8] * (normal.x * normal.x - (normal.y * normal.y));\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md#rgbd\n vec3 decodeRGBD(in vec4 color){\n return color.rgb / color.a;\n }\n\n vec3 getIBLClearCoatContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif defined(HILO_USE_SHADER_TEXTURE_LOD)\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 getIBLContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_NEED_WORLD_NORMAL\n N = u_viewInverseNormalMatrix * N;\n V = u_viewInverseNormalMatrix * V;\n #endif\n #if defined(HILO_DIFFUSE_ENV_MAP) || defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_GAMMA_CORRECTION\n vec3 diffuseLight = sRGBToLinear(textureEnvMap(u_diffuseEnvMap, N)).rgb;\n #else\n vec3 diffuseLight = textureEnvMap(u_diffuseEnvMap, N).rgb;\n #endif\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n vec3 diffuseLight = computeDiffuseSHLight(N, u_diffuseEnvSphereHarmonics3);\n #endif\n color.rgb += diffuseLight * diffuseColor * ao * u_diffuseEnvIntensity;\n #endif\n\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif defined(HILO_USE_SHADER_TEXTURE_LOD)\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 calculateLo(vec3 N, vec3 V, vec3 L, vec3 reflectance0, vec3 reflectance90, float alphaRoughness, vec3 diffuseColor, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float LdotH = clamp(dot(L, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n // Calculate the shading terms for the microfacet specular shading model\n vec3 F = specularReflection(reflectance0, reflectance90, VdotH);\n float G = geometricOcclusion(NdotL, NdotV, alphaRoughness);\n float D = microfacetDistribution(alphaRoughness, NdotH);\n\n vec3 diffuseContrib;\n\n #ifdef HILO_LIGHT_MAP\n diffuseContrib = vec3(0.0);\n #else\n diffuseContrib = (1.0 - F) * diffuse(diffuseColor);\n #endif\n vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return NdotL * (diffuseContrib + specContrib);\n }\n\n #ifdef HILO_HAS_CLEARCOAT\n float calculateClearcoatBRDF(vec3 N, vec3 V, vec3 L, float clearcoatAlphaRoughness, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n\n float G = geometricOcclusion(NdotL, NdotV, clearcoatAlphaRoughness);\n float D = microfacetDistribution(clearcoatAlphaRoughness, NdotH);\n\n float clearcoatLayer = G * D / (4.0 * NdotV);\n\n return clearcoatLayer;\n }\n #endif\n#endif'},function(t,e){t.exports="#define GLSLIFY 1\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\n\nvec3 sRGBToLinear( in vec3 value ) {\n return vec3( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ));\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\nvec4 baseColor = u_baseColor;\nvec3 emissionColor = u_emissionFactor.rgb;\n\n#ifdef HILO_BASE_COLOR_MAP\n #ifdef HILO_GAMMA_CORRECTION\n baseColor *= sRGBToLinear(HILO_TEXTURE_2D(u_baseColorMap));\n #else\n baseColor *= HILO_TEXTURE_2D(u_baseColorMap);\n #endif\n#endif\n\n#if defined(HILO_HAS_COLOR)\n baseColor *= v_color;\n#endif\n\ncolor.a = baseColor.a;\n\n"+n(46)+"\n\n#ifdef HILO_HAS_LIGHT\n vec3 viewPos = vec3(0, 0, 0);\n vec3 N = normal;\n vec3 V = normalize(viewPos - v_fragPos);\n\n #ifdef HILO_OCCLUSION_MAP\n float ao = HILO_TEXTURE_2D(u_occlusionMap).r;\n #else\n float ao = 1.0;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n vec3 specular = u_specular.rgb;\n float glossiness = u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n vec4 specularGlossiness = sRGBToLinear(HILO_TEXTURE_2D(u_specularGlossinessMap));\n specular = specularGlossiness.rgb * specular;\n glossiness = specularGlossiness.a * glossiness;\n #endif\n float roughness = 1.0 - glossiness;\n float metallic = 0.0;\n vec3 diffuseColor = baseColor.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n vec3 specularColor = specular;\n #else\n float metallic = u_metallic;\n float roughness = u_roughness;\n #ifdef HILO_METALLIC_MAP\n metallic = HILO_TEXTURE_2D(u_metallicMap).r * u_metallic;\n #endif\n #ifdef HILO_ROUGHNESS_MAP\n roughness = HILO_TEXTURE_2D(u_roughnessMap).r * u_roughness;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughnessMap = HILO_TEXTURE_2D(u_metallicRoughnessMap);\n #ifdef HILO_IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP\n ao = metallicRoughnessMap.r;\n #endif\n roughness = metallicRoughnessMap.g * u_roughness;\n metallic = metallicRoughnessMap.b * u_metallic;\n #endif\n roughness = clamp(roughness, 0.04, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n ao = mix(1.0, ao, u_occlusionStrength);\n #endif\n\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n float NdotV = clamp(abs(dot(N, V)), 0.001, 1.0);\n float alphaRoughness = roughness * roughness;\n\n #ifdef HILO_HAS_CLEARCOAT\n float clearcoatFactor = u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n clearcoatFactor *= HILO_TEXTURE_2D(u_clearcoatMap).r;\n #endif\n float clearcoatRoughnessFactor = u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n clearcoatRoughnessFactor *= HILO_TEXTURE_2D(u_clearcoatRoughnessMap).g;\n #endif\n\n float clearcoatAlphaRoughnessFactor = clearcoatRoughnessFactor * clearcoatRoughnessFactor;\n vec3 NC = clearcoatNormal;\n float NCdotV = clamp(abs(dot(NC, V)), 0.001, 1.0);\n float clearCoatFresnel = 0.04 + (1.0 - 0.04) * pow((1.0 - abs(NCdotV)),5.0);\n vec3 clearCoatLayer = vec3(0.0);\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = normalize(-u_directionalLightsInfo[i]);\n vec3 radiance = u_directionalLightsColor[i];\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = normalize(-u_spotLightsDir[i]);\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n vec3 radiance = intensity * attenuation * u_spotLightsColor[i];\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0; i < HILO_POINT_LIGHTS; i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n vec3 radiance = attenuation * u_pointLightsColor[i];\n\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuseColor, specularColor, roughness, N, V, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_LIGHT_MAP\n vec4 lightMapColor = HILO_TEXTURE_2D(u_lightMap);\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_lights_image_based#rgbd\n color.rgb += baseColor.rgb * decodeRGBD(lightMapColor);\n #endif\n\n // IBL\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += getIBLClearCoatContribution(NC, V, diffuseColor, vec3(.04), ao, NCdotV, clearcoatRoughnessFactor)/clearCoatFresnel;\n #endif\n color.rgb += getIBLContribution(N, V, diffuseColor, specularColor, ao, NdotV, roughness);\n\n #if defined(HILO_AMBIENT_LIGHTS) && (defined(HILO_IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER) || (!defined(HILO_DIFFUSE_ENV_MAP) && !defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)))\n color.rgb += u_ambientLightsColor * baseColor.rgb * ao;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n #ifdef HILO_GAMMA_CORRECTION\n emissionColor *= sRGBToLinear(HILO_TEXTURE_2D(u_emission)).rgb;\n #else\n emissionColor *= HILO_TEXTURE_2D(u_emission).rgb;\n #endif\n #endif\n\n color.rgb += emissionColor;\n\n #ifdef HILO_HAS_CLEARCOAT\n float t = clearcoatFactor * clearCoatFresnel;\n color.rgb = color.rgb * (1.0 - t) + clearCoatLayer * t;\n #endif\n#else\n color.rgb = baseColor.rgb;\n color.rgb += emissionColor;\n#endif"},function(t,e,n){var r=n(89),i=n(26),a=n(30),s=[0,0,0],o=[0,0,0],u=[0,0,0],c=[0,0,0],h=[0,0,0];t.exports=function(t,e,n,f){a(s,f[1],f[0]),a(o,f[2],f[0]),r(c,n,o);var l=i(s,c);if(l<1e-6)return null;a(u,e,f[0]);var d=i(u,c);if(d<0||d>l)return null;r(h,u,s);var m=i(n,h);if(m<0||d+m>l)return null;var _=i(o,h)/l;return t[0]=e[0]+_*n[0],t[1]=e[1]+_*n[1],t[2]=e[2]+_*n[2],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2];return t[0]=i*u-a*o,t[1]=a*s-r*u,t[2]=r*o-i*s,t}},function(t,e,n){var r=n(26),i=n(31),a=n(32),s=n(33);t.exports=function(t,e,n,u,c){var h=r(n,u);if(0!==h){var f=-(r(e,u)+c)/h;return f<0?null:(a(o,n,f),i(t,e,o))}return r(u,e)+c===0?s(t,e):null};var o=[0,0,0]},function(t,e,n){var r=n(92),i=n(26),a=n(30),s=n(93),o=n(32),u=n(31),c=[0,0,0];t.exports=function(t,e,n,h,f){a(c,h,e);var l=i(n,c);if(l<0)return null;s(c,e,n,l);var d=r(h,c),m=f*f;if(d>m)return null;return o(t,n,l-Math.sqrt(m-d)),u(t,t,e)}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}},function(t,e){function n(t,e,n){for(var r=t.length,i=-1/0,a=1/0,s=0;su){var c=o;o=u,u=c}if(ua)return 1/0;o>i&&(i=o),ua?1/0:i}t.exports=function(t,e,r,i){var a=n(e,r,i);if(a===1/0)t=null;else{t=t||[];for(var s=0;s0;){if(d(c)128){if(0==(u=(255&f[0])-128)||u>o-s)throw new Error("Bad scanline data");for(;u-- >0;)h[s++]=f[1]}else{if(0==(u=255&f[0])||u>o-s)throw new Error("Bad scanline data");if(h[s++]=f[1],--u>0){if(m(h,s,u)=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(103),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(35))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,a,s,o,u=1,c={},h=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){m(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((a=new MessageChannel).port1.onmessage=function(t){m(t.data)},r=function(t){a.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,r=function(t){var e=f.createElement("script");e.onreadystatechange=function(){m(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(m,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&m(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),r=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n 0.0 ? v : (0.5 * inversesqrt(max(1.0 - (x * x), 1e-7))) - v;\n return cross(v1, v2) * theta_sintheta;\n}\n\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if (dot(lightNormal, P - rectCoords[0]) < 0.0)\n return vec3(0.0);\n vec3 T1, T2;\n T1 = normalize(V - (N * dot(V, N)));\n T2 = -cross(N, T1);\n mat3 mat = mInv * transpose(mat3(T1, T2, N));\n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n\nvec3 getAreaLight(const in vec3 diffuseColor, const in vec3 specularColor, const in float roughness, const in vec3 normal, const in vec3 viewDir, const in vec3 position, const in vec3 lightPos, const in vec3 lightColor, const in vec3 halfWidth, const in vec3 halfHeight, const in sampler2D areaLightsLtcTexture1, const in sampler2D areaLightsLtcTexture2){\n vec3 rectCoords[4];\n rectCoords[0] = (lightPos - halfWidth) - halfHeight;\n rectCoords[1] = (lightPos + halfWidth) - halfHeight;\n rectCoords[2] = (lightPos + halfWidth) + halfHeight;\n rectCoords[3] = (lightPos - halfWidth) + halfHeight;\n \n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(areaLightsLtcTexture1, uv);\n vec4 t2 = texture2D(areaLightsLtcTexture2, uv);\n\n mat3 mInv = mat3(vec3(t1.x, 0, t1.y), vec3(0, 1, 0), vec3(t1.z, 0, t1.w));\n vec3 fresnel = (specularColor * t2.x) + ((vec3(1.0) - specularColor) * t2.y);\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += ((lightColor * fresnel) * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords));\n color += ((lightColor * diffuseColor) * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords));\n return color;\n}\n\n"},function(t,e,n){"use strict";n.r(e),n.d(e,"util",(function(){return i})),n.d(e,"GLTFExtensions",(function(){return r})),n.d(e,"Class",(function(){return a.a})),n.d(e,"EventMixin",(function(){return s.a})),n.d(e,"Fog",(function(){return cr})),n.d(e,"Mesh",(function(){return mr})),n.d(e,"Node",(function(){return g})),n.d(e,"SkinedMesh",(function(){return vr})),n.d(e,"Skeleton",(function(){return Tr})),n.d(e,"Stage",(function(){return zr})),n.d(e,"Tween",(function(){return di})),n.d(e,"version",(function(){return Mr})),n.d(e,"BoxGeometry",(function(){return _i})),n.d(e,"Geometry",(function(){return Z})),n.d(e,"GeometryData",(function(){return C})),n.d(e,"MorphGeometry",(function(){return qn})),n.d(e,"PlaneGeometry",(function(){return Ti})),n.d(e,"SphereGeometry",(function(){return Ai})),n.d(e,"Camera",(function(){return O})),n.d(e,"PerspectiveCamera",(function(){return Q})),n.d(e,"OrthographicCamera",(function(){return hn})),n.d(e,"Buffer",(function(){return Nt})),n.d(e,"capabilities",(function(){return et})),n.d(e,"extensions",(function(){return tt})),n.d(e,"Framebuffer",(function(){return ce})),n.d(e,"glType",(function(){return Tt})),n.d(e,"logGLResource",(function(){return Ii})),n.d(e,"Program",(function(){return Lt})),n.d(e,"RenderInfo",(function(){return Ar})),n.d(e,"RenderList",(function(){return Sr})),n.d(e,"VertexArrayObject",(function(){return Ft})),n.d(e,"WebGLRenderer",(function(){return Xr})),n.d(e,"WebGLResourceManager",(function(){return yr})),n.d(e,"WebGLState",(function(){return Rr})),n.d(e,"BasicLoader",(function(){return Ni})),n.d(e,"CubeTextureLoader",(function(){return Pi})),n.d(e,"GLTFLoader",(function(){return _a})),n.d(e,"GLTFParser",(function(){return da})),n.d(e,"AliAMCExtension",(function(){return Jn})),n.d(e,"HDRLoader",(function(){return La})),n.d(e,"KTXLoader",(function(){return Sa})),n.d(e,"LoadCache",(function(){return Si})),n.d(e,"LoadQueue",(function(){return Ra})),n.d(e,"ShaderMaterialLoader",(function(){return Na})),n.d(e,"TextureLoader",(function(){return ba})),n.d(e,"Loader",(function(){return bi})),n.d(e,"Texture",(function(){return Qt})),n.d(e,"LazyTexture",(function(){return Ui})),n.d(e,"CubeTexture",(function(){return pe})),n.d(e,"DataTexture",(function(){return Le})),n.d(e,"Shader",(function(){return dt})),n.d(e,"BasicMaterial",(function(){return tn})),n.d(e,"GeometryMaterial",(function(){return un})),n.d(e,"Material",(function(){return Je})),n.d(e,"PBRMaterial",(function(){return Hi})),n.d(e,"semantic",(function(){return Ue})),n.d(e,"ShaderMaterial",(function(){return kn})),n.d(e,"AxisHelper",(function(){return Ha})),n.d(e,"AxisNetHelper",(function(){return Ua})),n.d(e,"CameraHelper",(function(){return Xa})),n.d(e,"AmbientLight",(function(){return ka})),n.d(e,"AreaLight",(function(){return Wa})),n.d(e,"DirectionalLight",(function(){return Un})),n.d(e,"CubeLightShadow",(function(){return Cn})),n.d(e,"Light",(function(){return M})),n.d(e,"LightManager",(function(){return Cr})),n.d(e,"LightShadow",(function(){return gn})),n.d(e,"PointLight",(function(){return wn})),n.d(e,"SpotLight",(function(){return Xn})),n.d(e,"Animation",(function(){return ta})),n.d(e,"AnimationStates",(function(){return Ji})),n.d(e,"MeshPicker",(function(){return Ka})),n.d(e,"Ticker",(function(){return Qa})),n.d(e,"log",(function(){return m.a})),n.d(e,"Cache",(function(){return J})),n.d(e,"browser",(function(){return jr})),n.d(e,"WebGLSupport",(function(){return Ja})),n.d(e,"constants",(function(){return P.a})),n.d(e,"Color",(function(){return $a.Color})),n.d(e,"Euler",(function(){return $a.Euler})),n.d(e,"EulerNotifier",(function(){return $a.EulerNotifier})),n.d(e,"Frustum",(function(){return $a.Frustum})),n.d(e,"math",(function(){return $a.math})),n.d(e,"Matrix3",(function(){return $a.Matrix3})),n.d(e,"Matrix4",(function(){return $a.Matrix4})),n.d(e,"Matrix4Notifier",(function(){return $a.Matrix4Notifier})),n.d(e,"Plane",(function(){return $a.Plane})),n.d(e,"Quaternion",(function(){return $a.Quaternion})),n.d(e,"Ray",(function(){return $a.Ray})),n.d(e,"Sphere",(function(){return $a.Sphere})),n.d(e,"SphericalHarmonics3",(function(){return $a.SphericalHarmonics3})),n.d(e,"Vector2",(function(){return $a.Vector2})),n.d(e,"Vector3",(function(){return $a.Vector3})),n.d(e,"Vector3Notifier",(function(){return $a.Vector3Notifier})),n.d(e,"Vector4",(function(){return $a.Vector4}));var r={};n.r(r),n.d(r,"ALI_amc_mesh_compression",(function(){return Jn})),n.d(r,"WEB3D_quantized_attributes",(function(){return tr})),n.d(r,"HILO_animation_clips",(function(){return er})),n.d(r,"ALI_animation_clips",(function(){return nr})),n.d(r,"ALI_bounding_box",(function(){return rr})),n.d(r,"KHR_materials_pbrSpecularGlossiness",(function(){return ir})),n.d(r,"KHR_materials_clearcoat",(function(){return ar})),n.d(r,"KHR_lights_punctual",(function(){return sr})),n.d(r,"KHR_techniques_webgl",(function(){return or}));var i=n(4),a=n(1),s=n(9),o=n(7),u=n(21),c=n(5),h=n(17),f=n(22),l=n(10),d=n(6),m=n(3),_=new c.a(0,1,0),p=new o.a,g=a.a.create({Statics:{TRAVERSE_STOP_NONE:!1,TRAVERSE_STOP_CHILDREN:1,TRAVERSE_STOP_ALL:!0},Mixes:s.a,isNode:!0,className:"Node",name:"",anim:null,animationId:"",jointName:"",autoUpdateWorldMatrix:!0,autoUpdateChildWorldMatrix:!0,parent:null,_quatDirty:!1,_matrixDirty:!1,needCallChildUpdate:!0,visible:!0,pointerEnabled:!0,pointerChildren:!0,useHandCursor:!1,userData:null,onUpdate:null,__forceUseParentWorldMatrix:!1,constructor:function(t){var e=this;this.id=d.a.generateUUID(this.className),this.up=_.clone(),this.children=[],this.worldMatrix=new o.a,this._matrix=new u.a,this._position=new h.a(0,0,0),this._scale=new h.a(1,1,1),this._pivot=new h.a(0,0,0),this._rotation=new f.a,this._quaternion=new l.a,this._matrix.on("update",(function(){e._onMatrixUpdate()})),this._position.on("update",(function(){e._onPositionUpdate()})),this._scale.on("update",(function(){e._onScaleUpdate()})),this._pivot.on("update",(function(){e._onPivotUpdate()})),this._rotation.on("update",(function(){e._onRotationUpdate()})),this._quaternion.on("update",(function(){e._onQuaternionUpdate()})),Object.assign(this,t)},clone:function(t){var e=new this.constructor;return e.name=this.name,e.jointName=this.jointName,e.animationId=this.animationId,e.setPosition(this.x,this.y,this.z),e.setScale(this.scaleX,this.scaleY,this.scaleZ),e.setRotation(this.rotationX,this.rotationY,this.rotationZ),this.children.forEach((function(t){e.addChild(t.clone(!0))})),t||(this.anim&&(e.anim=this.anim.clone(e)),e.resetSkinedMeshRootNode()),e},setAnim:function(t){return this.anim=t,t.rootNode=this,this},resetSkinedMeshRootNode:function(){var t=this;this.traverse((function(e){e.isSkinedMesh&&e.skeleton&&(e.skeleton.rootNode=t)}),!0)},getChildrenNameMap:function(){var t={};return this.traverse((function(e){t[e.name]=e;var n=e._originName;void 0===n||t[n]||(t[n]=e)}),!0),t},addChild:function(t){return t.parent&&t.removeFromParent(),t.parent=this,this.children.push(t),this},removeChild:function(t){var e=this.children.indexOf(t);return e>-1&&(this.children.splice(e,1),t.parent=null),this},addTo:function(t){return t.addChild(this),this},removeFromParent:function(){return this.parent&&this.parent.removeChild(this),this},updateMatrix:function(){return this._matrixDirty&&(this._matrixDirty=!1,this.matrixVersion++,this._matrix.fromRotationTranslationScaleOrigin(this.quaternion,this._position,this._scale,this._pivot,!0)),this},updateQuaternion:function(){return this._quatDirty&&(this._quatDirty=!1,this._quaternion.fromEuler(this._rotation,!0)),this},updateTransform:function(){return this._matrix.decompose(this._quaternion,this._position,this._scale,this._pivot),this._onQuaternionUpdate(),this._matrixDirty=!1,this},updateMatrixWorld:function(t){return this.traverse((function(e){return(e.autoUpdateWorldMatrix||t)&&(e.parent?e.__forceUseParentWorldMatrix?e.worldMatrix.copy(e.parent.worldMatrix):e.worldMatrix.multiply(e.parent.worldMatrix,e.matrix):e.worldMatrix.copy(e.matrix)),!e.autoUpdateChildWorldMatrix&&!t&&1})),this},getConcatenatedMatrix:function(t){for(var e=new o.a,n=this;n&&n!==t;n=n.parent)e.multiply(n.matrix,e);return e},_traverse:function(t,e){if(!e){var n=t(this);if(n)return n}for(var r=this.children,i=0,a=r.length;i1&&void 0!==arguments[1]&&arguments[1];return this._traverse(t,e),this},traverseBFS:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(n=r?this.children:[this];n.length;){e=n,n=[];for(var i=0,a=e.length;i1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return this._scale.set(t,e,n),this},setPosition:function(t,e,n){return this._position.set(t,e,n),this},setRotation:function(t,e,n){return this._rotation.setDegree(t,e,n),this},setPivot:function(t,e,n){return this._pivot.set(t,e,n),this},lookAt:function(t){return this.isCamera?p.targetTo(this,t,this.up):p.targetTo(t,this,this.up),this._quaternion.fromMat4(p),this},raycast:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.visible)return null;var i=[];return this.traverse((function(n){if(r&&!n.pointerEnabled)return 1;if(n.isMesh){var a=n.raycast(t,!1);a&&(i=i.concat(a.map((function(t){return{mesh:n,point:t}}))))}return!(!r||e.pointerChildren)&&1})),i.length?(n&&t.sortPoints(i,"point"),i):null},matrix:{get:function(){return this.updateMatrix(),this._matrix},set:function(t){m.a.warnOnce("Node.matrix.set","node.matrix is readOnly.Use node.matrix.copy instead."),this._matrix.copy(t)}},position:{get:function(){return this._position},set:function(t){m.a.warnOnce("Node.position.set","node.position is readOnly.Use node.position.copy instead."),this._position.copy(t)}},x:{get:function(){return this._position.elements[0]},set:function(t){this._position.elements[0]=t,this._matrixDirty=!0}},y:{get:function(){return this._position.elements[1]},set:function(t){this._position.elements[1]=t,this._matrixDirty=!0}},z:{get:function(){return this._position.elements[2]},set:function(t){this._position.elements[2]=t,this._matrixDirty=!0}},scale:{get:function(){return this._scale},set:function(t){m.a.warnOnce("Node.scale.set","node.scale is readOnly.Use node.scale.copy instead."),this._scale.copy(t)}},scaleX:{get:function(){return this._scale.elements[0]},set:function(t){this._scale.elements[0]=t,this._matrixDirty=!0}},scaleY:{get:function(){return this._scale.elements[1]},set:function(t){this._scale.elements[1]=t,this._matrixDirty=!0}},scaleZ:{get:function(){return this._scale.elements[2]},set:function(t){this._scale.elements[2]=t,this._matrixDirty=!0}},pivot:{get:function(){return this._pivot},set:function(t){m.a.warnOnce("Node.pivot.set","node.pivot is readOnly.Use node.pivot.copy instead."),this._pivot.copy(t)}},pivotX:{get:function(){return this._pivot.elements[0]},set:function(t){this._pivot.elements[0]=t,this._matrixDirty=!0}},pivotY:{get:function(){return this._pivot.elements[1]},set:function(t){this._pivot.elements[1]=t,this._matrixDirty=!0}},pivotZ:{get:function(){return this._pivot.elements[2]},set:function(t){this._pivot.elements[2]=t,this._matrixDirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){m.a.warnOnce("Node.rotation.set","node.rotation is readOnly.Use node.rotation.copy instead."),this._rotation.copy(t)}},rotationX:{get:function(){return this._rotation.degX},set:function(t){this._rotation.degX=t}},rotationY:{get:function(){return this._rotation.degY},set:function(t){this._rotation.degY=t}},rotationZ:{get:function(){return this._rotation.degZ},set:function(t){this._rotation.degZ=t}},quaternion:{get:function(){return this.updateQuaternion(),this._quaternion},set:function(t){m.a.warnOnce("Node.quaternion.set","node.quaternion is readOnly.Use node.quaternion.copy instead."),this._quaternion.copy(t)}},matrixVersion:0,getBounds:function(t,e,n){return e?e.multiply(this.matrix):e=this.getConcatenatedMatrix(t),this.children.forEach((function(t){n=t.getBounds(null,e.clone(),n)})),this.isMesh&&(n=this.geometry.getBounds(e,n)),n},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"===t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=Object.assign({},t);e.type="mouseover",this.fire(e)}}else"mouseout"===t.type&&(this.__mouseOver=!1);var n=this.parent;t._stopped||t._stopPropagationed||!n||n._fireMouseEvent(t)},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getChildrenByBaseClassName("Node");return this.off(),n.forEach((function(n){n.isMesh?n.destroy(t,e):(n.off(),n.removeFromParent())})),this.removeFromParent(),this},_onMatrixUpdate:function(){this.matrixVersion++,this.updateTransform()},_onPositionUpdate:function(){this._matrixDirty=!0},_onScaleUpdate:function(){this._matrixDirty=!0},_onPivotUpdate:function(){this._matrixDirty=!0},_onRotationUpdate:function(){this._quatDirty=!0,this._matrixDirty=!0},_onQuaternionUpdate:function(){this._rotation.fromQuat(this._quaternion),this._quatDirty=!1}}),v=n(8),E=new v.a,T=a.a.create({Extends:g,isLight:!0,className:"Light",amount:1,enabled:!0,constantAttenuation:1,linearAttenuation:0,quadraticAttenuation:0,_range:0,range:{get:function(){return this._range},set:function(t){this.constantAttenuation=1,t<=0?(this.linearAttenuation=0,this.quadraticAttenuation=0):(this.linearAttenuation=4.5/t,this.quadraticAttenuation=75/(t*t)),this._range=t}},shadow:null,isDirty:!1,constructor:function(t){this.color=new v.a(1,1,1),T.superclass.constructor.call(this,t)},toInfoArray:function(t,e){return t[e+0]=this.constantAttenuation,t[e+1]=this.linearAttenuation,t[e+2]=this.quadraticAttenuation,this},getRealColor:function(){return E.copy(this.color).scale(this.amount)},createShadowMap:function(t,e){}}),M=T,A=n(23),L=new o.a,I=a.a.create({Extends:g,isCamera:!0,className:"Camera",_needUpdateProjectionMatrix:!0,_isGeometryDirty:!1,constructor:function(t){this.viewMatrix=new o.a,this.projectionMatrix=new o.a,this.viewProjectionMatrix=new o.a,this._frustum=new A.a,I.superclass.constructor.call(this,t)},updateViewMatrix:function(){return this.updateMatrixWorld(!0),this.viewMatrix.invert(this.worldMatrix),this},updateProjectionMatrix:function(){},getGeometry:function(t){},updateViewProjectionMatrix:function(){return this._needUpdateProjectionMatrix&&(this.updateProjectionMatrix(),this._needUpdateProjectionMatrix=!1),this.updateViewMatrix(),this.viewProjectionMatrix.multiply(this.projectionMatrix,this.viewMatrix),this.updateFrustum(this.viewProjectionMatrix),this},getModelViewMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewMatrix,t.worldMatrix),e},getModelProjectionMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewProjectionMatrix,t.worldMatrix),e},projectVector:function(t,e,n){var r=t.clone();return r.transformMat4(this.viewProjectionMatrix),e&&n&&(r.x=(r.x+1)/2*e,r.y=n-(r.y+1)/2*n),r},unprojectVector:function(t,e,n){var r=t.clone();return e&&n&&(r.x=r.x/e*2-1,r.y=1-r.y/n*2),L.invert(this.viewProjectionMatrix),r.transformMat4(L),r},isPointVisible:function(t){return!!this._frustum.intersectsSphere({center:t,radius:0})},isMeshVisible:function(t){var e=t.geometry;if(e){var n=e.getSphereBounds(t.worldMatrix);if(this._frustum.intersectsSphere(n))return!0}return!1},updateFrustum:function(t){return this._frustum.fromMatrix(t),this}}),O=I,S=n(14),R=n(12),y=n(11),N=n(20),x={2:new S.a,3:new c.a,4:new R.a,16:new o.a},b=a.a.create({className:"GeometryData",isGeometryData:!0,size:void 0,normalized:!1,type:void 0,_isSubDirty:!1,_isAllDirty:!1,isDirty:{get:function(){return this._isSubDirty||this._isAllDirty},set:function(t){this._isAllDirty=t,!1===t&&this.clearSubData()}},bufferViewId:void 0,glBuffer:null,constructor:function(t,e,n){this.id=d.a.generateUUID(this.className),this.data=t,this.size=e,Object.assign(this,n),this.bufferViewId||(this.bufferViewId=this.id),this.size||m.a.warn("GeometryData.constructor: geometryData must set size!",this)},_stride:0,stride:{get:function(){return this._stride},set:function(t){this._stride=t,this.strideSize=0===t?0:t/this.data.BYTES_PER_ELEMENT}},strideSize:0,_offset:0,offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetSize=t/this.data.BYTES_PER_ELEMENT}},offsetSize:0,data:{set:function(t){t&&(this._data=t,this.type=Object(i.getTypedArrayGLType)(t),this.stride=this._stride,this.offset=this._offset,this._isAllDirty=!0)},get:function(){return this._data}},length:{get:function(){return this._data.length}},realLength:{get:function(){return 0===this.strideSize?this._data.length:this._data.length/this.strideSize*this.size}},getByteLength:function(){return this._data.BYTES_PER_ELEMENT*this.realLength},count:{get:function(){return 0===this.strideSize?this._data.length/this.size:this._data.length/this.strideSize}},setSubData:function(t,e){this._isSubDirty=!0,this.data.set(e,t),this.subDataList||(this.subDataList=[]);var n=e.BYTES_PER_ELEMENT*t;this.subDataList.push({byteOffset:n,data:e})},clearSubData:function(){this.subDataList&&(this.subDataList.length=0),this._isSubDirty=!1},clone:function(){var t=new b(null,1);return t.copy(this),t},copy:function(t){var e=t.data;this.data=new e.constructor(e),this.size=t.size,this.stride=t.stride,this.normalized=t.normalized,this.type=t.type,this.offset=t.offset},getOffset:function(t){var e=this.strideSize;return 0===e?t*this.size:t*e+this.offsetSize},get:function(t){var e=this.getOffset(t);return this.getByOffset(e)},getCopy:function(t){return this.get(t).clone()},set:function(t,e){var n=this.getOffset(t);return this.setByOffset(n,e),n},getByOffset:function(t){var e=this.size;return e>1?x[e].fromArray(this._data,t):this._data[t]},setByOffset:function(t,e){var n=this.size,r=this._data;n>1?e.toArray(r,t):r[t]=e,this._isAllDirty=!0},traverse:function(t){for(var e=this.count,n=0;n0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromTranslation(G.set(t,e,n))),this},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.transformMat4(Y.fromScaling(G.set(t,e,n))),this},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromQuat(q.fromEuler({x:t*d.a.DEG2RAD,y:e*d.a.DEG2RAD,z:n*d.a.DEG2RAD}))),this},transformMat4:function(t){var e=this.vertices;if(e&&e.traverse((function(n,r,i){e.setByOffset(i,n.transformMat4(t))})),W.normalFromMat4(t),this._normals){var n=this.normals;n.traverse((function(t,e,r){n.setByOffset(r,t.transformMat3(W).normalize())}))}if(this._tangents){var r=this.tangents;r.traverse((function(t,e,n){r.setByOffset(n,t.transformMat3(W).normalize())}))}return this.isDirty=!0,this},merge:function(t,e){var n=t.vertices;if(n&&this.vertices){var r=this.vertices.count;e&&(n=t.vertices.clone()).traverse((function(t,r,i){n.setByOffset(i,t.transformMat4(e))})),this.vertices.merge(n),this.indices&&t.indices?this.indices.merge(t.indices,(function(t){return t+r})):this.indices=null}return this.uvs&&t.uvs?this.uvs.merge(t.uvs):this.uvs=null,this.uvs1&&t.uvs1?this.uvs1.merge(t.uvs1):this.uvs1=null,this.colors&&t.colors?this.colors.merge(t.colors):this.colors=null,this._normals&&(this._normals=null),this._tangents&&(this._tangents=null),this._tangents1&&(this._tangents1=null),this.isDirty=!0,this},ensureData:function(t,e,n,r){var i=this[t];if(!i||n>i.length){var a=new r(n);i?(a.set(i.data),i.data=a):this[t]=new C(a,e)}},addPoints:function(){var t=this,e=[].slice.call(arguments),n=3*(this.currentVerticesCount+e.length);this.ensureData("vertices",3,n,Float32Array);var r=this.vertices.data;return e.forEach((function(e){var n=3*t.currentVerticesCount++;r[n]=e[0],r[n+1]=e[1],r[n+2]=e[2]})),this.currentVerticesCount-e.length},addIndices:function(){var t=this,e=[].slice.call(arguments),n=this.currentIndicesCount+e.length;this.ensureData("indices",1,n,Uint16Array);var r=this.indices.data;e.forEach((function(e){r[t.currentIndicesCount++]=e})),this._needUpdateNormals=!0},addLine:function(t,e){var n=this.addPoints(t,e);this.addIndices(n,n+1)},addFace:function(t,e,n){var r=this.addPoints(t,e,n);this.addIndices(r,r+1,r+2)},addRect:function(t,e,n,r){var i=this.addPoints(t,e,n,r);this.addIndices(i,i+1,i+2,i,i+2,i+3)},setVertexUV:function(t,e){this.ensureData("uvs",2,this.vertices.length/3*2,Float32Array);for(var n=this.uvs.data,r=0;r0&&void 0!==arguments[0]&&arguments[0];return this._localBounds&&!t||(this._localBounds=this.getBounds()),this._localBounds},getSphereBounds:function(t){this._sphereBounds||(this._sphereBounds=new N.a);var e=this._sphereBounds;return e.copy(this.getLocalSphereBounds()),t&&e.transformMat4(t),e},getLocalSphereBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._localSphereBounds||t){var e=this.getLocalBounds(t),n=new N.a({center:new c.a(e.x,e.y,e.z)}),r=this.vertices;r?n.fromGeometryData(r):(m.a.warnOnce("geometry.getLocalSphereBounds","geometry has no vertices data, geometry.getLocalSphereBounds will return Infinity bounds."),n.radius=1/0),this._localSphereBounds=n}return this._localSphereBounds},convertToNoIndices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.mode===w)if(this.indices){for(var e=this.indices.data,n=e.length,r=new Float32Array(n*t),a=this.uvs?new Float32Array(2*n):null,s=new Float32Array(3*n),o=this.colors?new Float32Array(this.colors.size*n):null,u=this.skinIndices?new Float32Array(4*n):null,c=this.skinWeights?new Float32Array(4*n):null,h=0;h2&&void 0!==arguments[2])||arguments[2];return(n=this.useAABBRaycast?this._aabbRaycast(t):this._raycast(t,e))&&r&&t.sortPoints(n),n},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.positionDecodeMat&&(t.QUANTIZED=1,t.POSITION_QUANTIZED=1),this.normalDecodeMat&&(t.QUANTIZED=1,t.NORMAL_QUANTIZED=1),this.uvDecodeMat&&(t.QUANTIZED=1,t.UV_QUANTIZED=1),this.uv1DecodeMat&&(t.QUANTIZED=1,t.UV1_QUANTIZED=1),this.colors&&(t.HAS_COLOR=1,t.COLOR_SIZE=this.colors.size),t},getShaderKey:function(){return void 0===this._shaderKey&&(this._shaderKey="geometry",this.isMorphGeometry?this._shaderKey+="_id_".concat(this.id):(this.colors&&(this._shaderKey+="_colors"),this.positionDecodeMat&&(this._shaderKey+="positionDecodeMat"))),this._shaderKey},getSize:function(){var t=0;for(var e in this)Object(i.hasOwnProperty)(this,e)&&this[e]&&this[e].isGeometryData&&(t+=this[e].getByteLength());return t},destroy:function(){m.a.warn("Geometry.destroy has been deprecated, use mesh.destroy(renderer) instead.")}}),K=a.a.create({Extends:O,isPerspectiveCamera:!0,className:"PerspectiveCamera",_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:null,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},_fov:50,fov:{get:function(){return this._fov},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._fov=t}},_aspect:1,aspect:{get:function(){return this._aspect},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._aspect=t}},constructor:function(t){K.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.projectionMatrix.elements,e=this.near,n=this.far,r=this.aspect,i=this.fov,a=1/Math.tan(.5*d.a.degToRad(i));if(t[0]=a/r,t[5]=a,t[11]=-1,t[15]=0,n){var s=1/(e-n);t[10]=(e+n)*s,t[14]=2*n*e*s}else t[10]=-1,t[14]=-2*e},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=Math.tan(this.fov/2*Math.PI/180),r=this.near,i=this.far,a=r*n,s=i*n,o=this.aspect*a,u=this.aspect*s,c=[-o,-a,-r],h=[o,-a,-r],f=[o,a,-r],l=[-o,a,-r],d=[-u,-s,-i],m=[u,-s,-i],_=[u,s,-i],p=[-u,s,-i];e.addRect(d,m,_,p),e.addRect(m,h,f,_),e.addRect(h,c,l,f),e.addRect(c,d,p,l),e.addRect(p,_,f,l),e.addRect(c,h,m,d),this._geometry=e}return this._geometry}}),Q=K,J=a.a.create({constructor:function(){this._cache={}},get:function(t){return this._cache[t]},getObject:function(t){return this._cache[t.__cacheId]},add:function(t,e){"object"==typeof e&&(e.__cacheId=t),this._cache[t]=e},remove:function(t){delete this._cache[t]},removeObject:function(t){delete this._cache[t.__cacheId]},removeAll:function(){this._cache={}},each:function(t){var e=this._cache;for(var n in e)t(e[n],n)}}),$={instanced:void 0,vao:void 0,texFloat:void 0,loseContext:void 0,textureFilterAnisotropic:void 0,_usedExtensions:{},_disabledExtensions:{},init:function(t){this.reset(t)},reset:function(t){this.gl=t;var e=this._usedExtensions;for(var n in e){var r=e[n];this[r]=void 0,this.get(n,r)}},use:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.gl?this.get(t,e):this._usedExtensions[t]=e},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this._disabledExtensions[t])return null;var n=this[e];return void 0===n&&(n=this._getExtension(t),this[e]=n),n},disable:function(t){this._disabledExtensions[t]=!0},enable:function(t){this._disabledExtensions[t]=!1},_getExtension:function(t){var e=this.gl;return e&&e.getExtension&&(e.getExtension(t)||e.getExtension("WEBKIT_"+t)||e.getExtension("MOZ_"+t))||null}};$.use("ANGLE_instanced_arrays","instanced"),$.use("OES_vertex_array_object","vao"),$.use("OES_texture_float","texFloat"),$.use("WEBGL_lose_context","loseContext"),$.use("OES_element_index_uint","uintIndices"),$.use("EXT_shader_texture_lod","shaderTextureLod"),$.use("EXT_texture_filter_anisotropic","textureFilterAnisotropic");var tt=$,et={MAX_TEXTURE_INDEX:null,MAX_PRECISION:null,MAX_VERTEX_PRECISION:null,MAX_FRAGMENT_PRECISION:null,VERTEX_TEXTURE_FLOAT:null,FRAGMENT_TEXTURE_FLOAT:null,MAX_TEXTURE_MAX_ANISOTROPY:1,MAX_RENDERBUFFER_SIZE:void 0,MAX_COMBINED_TEXTURE_IMAGE_UNITS:void 0,MAX_CUBE_MAP_TEXTURE_SIZE:void 0,MAX_FRAGMENT_UNIFORM_VECTORS:void 0,MAX_TEXTURE_IMAGE_UNITS:void 0,MAX_TEXTURE_SIZE:void 0,MAX_VARYING_VECTORS:void 0,MAX_VERTEX_ATTRIBS:void 0,MAX_VERTEX_TEXTURE_IMAGE_UNITS:void 0,MAX_VERTEX_UNIFORM_VECTORS:void 0,init:function(t){var e=this;this.gl=t;["MAX_RENDERBUFFER_SIZE","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"].forEach((function(t){e.get(t)})),this.MAX_TEXTURE_INDEX=this.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,this.MAX_VERTEX_PRECISION=this._getMaxSupportPrecision(t.VERTEX_SHADER),this.MAX_FRAGMENT_PRECISION=this._getMaxSupportPrecision(t.FRAGMENT_SHADER),this.MAX_PRECISION=this.getMaxPrecision(this.MAX_FRAGMENT_PRECISION,this.MAX_VERTEX_PRECISION),this.VERTEX_TEXTURE_FLOAT=!!tt.texFloat&&this.MAX_VERTEX_TEXTURE_IMAGE_UNITS>0,this.FRAGMENT_TEXTURE_FLOAT=!!tt.texFloat,this.EXT_FRAG_DEPTH=tt.get("EXT_frag_depth"),this.SHADER_TEXTURE_LOD=!!tt.shaderTextureLod,tt.textureFilterAnisotropic&&(this.MAX_TEXTURE_MAX_ANISOTROPY=t.getParameter(tt.textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},get:function(t){var e=this.gl,n=this[t];return void 0===n&&(n=this[t]=e.getParameter(e[t])),n},_getMaxSupportPrecision:function(t){var e=this.gl,n="lowp";if(e.getShaderPrecisionFormat)for(var r=[{name:"highp",type:e.HIGH_FLOAT},{name:"mediump",type:e.MEDIUM_FLOAT}],i=0;i0){n=a.name;break}}else n="mediump";return n},getMaxPrecision:function(t,e){return"highp"===t||"mediump"===t&&"lowp"===e?e:t}},nt=n(50),rt=n.n(nt),it=n(51),at=n.n(it),st=n(52),ot=n.n(st),ut=n(53),ct=n.n(ut),ht=new J,ft=new J,lt=a.a.create({isShader:!0,className:"Shader",vs:"",fs:"",Statics:{commonOptions:{},shaders:{"chunk/baseDefine.glsl":n(18),"chunk/color.frag":n(36),"chunk/color.vert":n(74),"chunk/color_main.vert":n(76),"chunk/diffuse.frag":n(56),"chunk/diffuse_main.frag":n(65),"chunk/extensions.frag":n(24),"chunk/extensions.vert":n(48),"chunk/fog.frag":n(43),"chunk/fog_main.frag":n(67),"chunk/frag_color.frag":n(47),"chunk/joint.vert":n(69),"chunk/joint_main.vert":n(79),"chunk/light.frag":n(40),"chunk/lightFog.frag":n(39),"chunk/lightFog.vert":n(72),"chunk/lightFog_main.frag":n(45),"chunk/lightFog_main.vert":n(82),"chunk/logDepth.frag":n(28),"chunk/logDepth_main.frag":n(29),"chunk/logDepth.vert":n(75),"chunk/logDepth_main.vert":n(83),"chunk/morph.vert":n(73),"chunk/morph_main.vert":n(78),"chunk/normal.frag":n(38),"chunk/normal.vert":n(71),"chunk/normal_main.frag":n(44),"chunk/normal_main.vert":n(81),"chunk/pbr.frag":n(85),"chunk/pbr_main.frag":n(87),"chunk/phong.frag":n(63),"chunk/phong_main.frag":n(66),"chunk/precision.frag":n(25),"chunk/precision.vert":n(49),"chunk/transparency.frag":n(42),"chunk/transparency_main.frag":n(46),"chunk/unQuantize.vert":n(68),"chunk/unQuantize_main.vert":n(77),"chunk/uv.frag":n(37),"chunk/uv.vert":n(70),"chunk/uv_main.vert":n(80),"method/encoding.glsl":n(86),"method/getDiffuse.glsl":n(58),"method/getLightAttenuation.glsl":n(60),"method/getShadow.glsl":n(62),"method/getSpecular.glsl":n(59),"method/packFloat.glsl":n(84),"method/textureEnvMap.glsl":n(41),"method/transpose.glsl":n(57),"method/unpackFloat.glsl":n(61),"basic.frag":n(50),"basic.vert":n(51),"geometry.frag":n(52),"pbr.frag":n(53),"screen.frag":n(54),"screen.vert":n(55)},init:function(t){this.renderer=t,this.commonHeader=this._getCommonHeader(this.renderer)},cache:{get:function(){return ht}},headerCache:{get:function(){return ft}},reset:function(t){ht.removeAll()},getHeaderKey:function(t,e,n,r,i){var a="header_"+e.id+"_"+n.lightInfo.uid;return t.isSkinedMesh&&(a+="_joint"+t.skeleton.jointCount),r&&(a+="_fog_"+r.mode),a+="_"+t.geometry.getShaderKey(),i&&(a+="_fogDepth"),a},getHeader:function(t,e,n,r,i){var a=this.getHeaderKey(t,e,n,r),s=ft.get(a);if(!s||e.isDirty){var o={};Object.assign(o,this.commonOptions);var u=e.lightType;u&&"NONE"!==u&&n.getRenderOption(o),e.getRenderOption(o),t.getRenderOption(o),r&&(o.HAS_FOG=1,r.getRenderOption(o)),i&&(o.USE_LOG_DEPTH=1,et.EXT_FRAG_DEPTH&&(o.USE_EXT_FRAG_DEPTH=1)),o.HAS_NORMAL&&o.NORMAL_MAP&&(o.HAS_TANGENT=1),o.RECEIVE_SHADOWS||(delete o.DIRECTIONAL_LIGHTS_SMC,delete o.SPOT_LIGHTS_SMC,delete o.POINT_LIGHTS_SMC),s="#define SHADER_NAME ".concat(e.className,"\n"),s+=Object.keys(o).map((function(t){return t.indexOf("HILO_CUSTUM_OPTION_")>-1?"#define ".concat(t.replace("HILO_CUSTUM_OPTION_","")," ").concat(o[t]):"#define HILO_".concat(t," ").concat(o[t])})).join("\n")+"\n",ft.add(a,s)}return s},_getCommonHeader:function(t){var e=et.getMaxPrecision(et.MAX_VERTEX_PRECISION,t.vertexPrecision),n=et.getMaxPrecision(et.MAX_FRAGMENT_PRECISION,t.fragmentPrecision),r=et.getMaxPrecision(e,n);return"\n#define HILO_MAX_PRECISION ".concat(r,"\n#define HILO_MAX_VERTEX_PRECISION ").concat(e,"\n#define HILO_MAX_FRAGMENT_PRECISION ").concat(n,"\n")},getShader:function(t,e,n,r,i,a){var s=this.getHeader(t,e,r,i,a);return e.isBasicMaterial||e.isPBRMaterial?this.getBasicShader(e,n,s):e.isShaderMaterial?this.getCustomShader(e.vs,e.fs,s,e.shaderCacheId||e.id,e.useHeaderCache):null},getBasicShader:function(t,e,n){var r="";e&&(r=(r=t.getInstancedUniforms().map((function(t){return t.name}))).join("|"));var i=t.className+":"+r;t.onBeforeCompile&&(i+=":"+(t.shaderCacheId||t.id));var a=ht.get(i);if(!a){var s="",o=at.a;if(t.isBasicMaterial?t.isGeometryMaterial?s+=ot.a:s+=rt.a:t.isPBRMaterial&&(s+=ct.a),t.onBeforeCompile){var u=t.onBeforeCompile(o,s);s=u.fs,o=u.vs}if(r){var c=new RegExp("^\\s*uniform\\s+(\\w+)\\s+(".concat(r,");"),"gm");o=o.replace(c,"attribute $1 $2;")}a=this.getCustomShader(o,s,n,i,!0)}if(a){var h=this._getNumId(a);null!==h&&(t._shaderNumId=h)}return a},_getNumId:function(t){var e=t.id.match(/_(\d+)/);return e&&e[1]?parseInt(e[1],10):null},getCustomShader:function(t,e,n,r,i){var a,s=this.commonHeader;return r&&(i&&(r+=":"+n),a=ht.get(r)),a||(a=new lt({vs:s+n+t,fs:s+n+e}),r&&ht.add(r,a)),a}},alwaysUse:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(ht.removeObject(this),this._isDestroyed=!0),this}}),dt=lt,mt=n(55),_t=n.n(mt),pt=n(54),gt=n.n(pt),vt=[{name:"FLOAT",byteSize:4,uniformFuncName:"uniform1f",type:"Scalar",size:1},{name:"FLOAT_VEC2",byteSize:8,uniformFuncName:"uniform2f",type:"Vector",size:2},{name:"FLOAT_VEC3",byteSize:12,uniformFuncName:"uniform3f",type:"Vector",size:3},{name:"FLOAT_VEC4",byteSize:16,uniformFuncName:"uniform4f",type:"Vector",size:4},{name:"FLOAT_MAT2",byteSize:16,uniformFuncName:"uniformMatrix2fv",type:"Matrix",size:4},{name:"FLOAT_MAT3",byteSize:36,uniformFuncName:"uniformMatrix3fv",type:"Matrix",size:9},{name:"FLOAT_MAT4",byteSize:64,uniformFuncName:"uniformMatrix4fv",type:"Matrix",size:16},{name:"INT",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"INT_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"INT_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"INT_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"BOOL",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"BOOL_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"BOOL_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"BOOL_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"SAMPLER_2D",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"SAMPLER_CUBE",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1}],Et={},Tt={dict:Et,init:function(t){vt.forEach((function(e){var n,r,i=e.name,a=e.uniformFuncName,s=a+"v";"Matrix"===e.type?n=r=function(e,n){void 0!==n&&t[a](e,!1,n)}:(n=function(e,n){void 0!==n&&t[a](e,n)},r=function(e,n){t[s](e,n)}),Et[t[i]]=Object.assign(e,{glValue:t[i],uniform:n,uniformArray:r})}))},get:function(t){return Et[t]}},Mt=new J,At=a.a.create({Statics:{cache:{get:function(){return Mt}},reset:function(t){Mt.each((function(t){t.destroy()}))},getProgram:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.id,i=Mt.get(r);return i||(i=new At({state:e,vertexShader:t.vs,fragShader:t.fs,ignoreError:n}),Mt.add(r,i)),i},getBlankProgram:function(t){var e=dt.getCustomShader("void main(){}","precision HILO_MAX_FRAGMENT_PRECISION float;void main(){gl_FragColor = vec4(0.0);}","","__hiloBlankShader");return this.getProgram(e,t,!0)}},className:"Program",isProgram:!0,fragShader:"",vertexShader:"",attributes:null,uniforms:null,program:null,gl:null,state:null,alwaysUse:!1,constructor:function(t){return this.id=d.a.generateUUID(this.className),Object.assign(this,t),this._dict={},this.attributes={},this.uniforms={},this.gl=this.state.gl,this.program=this.createProgram(),this.program?(this.initAttributes(),this.initUniforms(),this):this.ignoreError?this:At.getBlankProgram(t.state)},createProgram:function(){var t=this.gl,e=t.createProgram(),n=this.createShader(t.VERTEX_SHADER,this.vertexShader),r=this.createShader(t.FRAGMENT_SHADER,this.fragShader);if(n&&r){if(t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(e,t.LINK_STATUS)){var i=t.getProgramInfoLog(e);return m.a.error("compileProgramError: "+i,this),t.deleteProgram(e),null}return e}return null},useProgram:function(){this.state.useProgram(this.program)},createShader:function(t,e){var n=this.gl,r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(r);return m.a.error("compileShaderError: "+i,e.split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),null}return r},initAttributes:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),i=tt.instanced,a=function(r){var a=e.getActiveAttrib(n,r),s=a.name,o=a.type,u=a.size,c=e.getAttribLocation(n,s),h=Tt.get(o),f=function(t){var n=t.type,r=void 0===n?e.FLOAT:n,i=t.normalized,a=void 0!==i&&i,s=t.stride,o=void 0===s?0:s,u=t.offset,f=void 0===u?0:u,l=t.size,d=void 0===l?h.size:l;e.vertexAttribPointer(c,d,r,a,o,f)},l=function(){e.enableVertexAttribArray(c)},d=function(){},m=function(t,e){t[c]=e};if(i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i.vertexAttribDivisorANGLE(c,t)}),"Matrix"===h.type){var _=h.byteSize,p=h.size,g=Math.sqrt(p),v=4*g,E=function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;E((function(e){i.vertexAttribDivisorANGLE(e,t)}))})}t.attributes[s]={name:s,location:c,type:o,size:u,glTypeInfo:h,pointer:f,enable:l,divisor:d,addTo:m}},s=0;s1||o>1?function(t){f(c,t)}:function(e){t._dict[s]!==e&&(t._dict[s]=e,l(c,e))}})},s=0;s2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,It,e,n)},createBuffer:function(t,e,n,r){var i=n.bufferViewId,a=Rt.get(i);return a||(n.isDirty=!1,a=new yt(t,e,n.data,r),Rt.add(i,a),a)},createIndexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,Ot,e,n)}},className:"Buffer",isBuffer:!0,constructor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St;this.id=d.a.generateUUID(this.className),this.gl=t,this.target=e,this.usage=r,this.buffer=t.createBuffer(),n&&this.bufferData(n)},bind:function(){return this.gl.bindBuffer(this.target,this.buffer),this},bufferData:function(t){var e=this.gl,n=this.target,r=this.usage;return this.bind(),e.bufferData(n,t,r),this.data=t,this},bufferSubData:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.gl,i=this.target;return n||this.bind(),r.bufferSubData(i,t,e),this},uploadGeometryData:function(t){var e=this,n=t.subDataList;return!this.data||this.data.byteLength2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;r0&&void 0!==arguments[0]?arguments[0]:1;this.bind();var e=this.gl,n=this.mode;this.useInstanced&&(this.indexBuffer?this.instancedExtension.drawElementsInstancedANGLE(n,this.vertexCount,e.UNSIGNED_SHORT,0,t):this.instancedExtension.drawArraysInstancedANGLE(n,0,this.getVertexCount(),t))},addIndexBuffer:function(t,e){this.bind();var n=this.gl,r=this.indexBuffer;return this.indexType=t.type,r?t.isDirty&&(r.uploadGeometryData(t),this.vertexCount=t.length):((r=Nt.createIndexBuffer(n,t,e)).bind(),this.indexBuffer=r,this.vertexCount=t.length),r},addAttribute:function(t,e,n,r){this.bind();var i=this.gl,a=e.name,s=this[a];if(!s){var o=Nt.createVertexBuffer(i,t,n);o.bind(),e.enable(),e.pointer(t),s={attribute:e,buffer:o,geometryData:t},this.attributes.push(s),this[a]=s,e.addTo(this.activeStates,s),r&&r(s)}if(t.isDirty){var u=s.buffer;u.bind(),e.enable(),e.pointer(t),u.uploadGeometryData(t)}return s},addInstancedAttribute:function(t,e,n){this.bind();var r=this.gl,i=t.name,a=t.glTypeInfo,s=bt.getTypedArray(Float32Array,e.length*a.size);e.forEach((function(t,e){void 0!==n(t)?bt.fillArrayData(s,n(t),e*a.size):m.a.warn("no attributeData:"+i+"-"+t.name)}));var o,u=this[i];return u?(o=u.geometryData).data=s:o=new C(s,1),this.addAttribute(o,t,r.DYNAMIC_DRAW,(function(e){t.divisor(1),e.useInstanced=!0}))},getResources:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.attributes&&this.attributes.forEach((function(e){t.push(e.buffer)})),this.indexBuffer&&t.push(this.indexBuffer),t},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){var t=this;return this._isDestroyed||(this.instancedExtension=null,this.useVao&&(this.vaoExtension.deleteVertexArrayOES(this.vao),this.vao=null,this.vaoExtension=null),this.gl=null,this.indexBuffer=null,this.attributes.forEach((function(e){var n=e.attribute||{};t[n.name]=null})),this.attributes=null,this.activeStates=null,Ht.removeObject(this),this._isDestroyed=!0),this}}),Ft=Dt,Ut=P.a.TEXTURE_2D,Gt=P.a.RGBA,Bt=P.a.LINEAR,Vt=P.a.NEAREST,Xt=P.a.REPEAT,jt=P.a.CLAMP_TO_EDGE,kt=P.a.UNSIGNED_BYTE,zt=P.a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wt=P.a.UNPACK_FLIP_Y_WEBGL,Yt=P.a.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt=P.a.BROWSER_DEFAULT_WEBGL,Zt=P.a.NONE,Kt=new J,Qt=a.a.create({Statics:{cache:{get:function(){return Kt}},reset:function(t){Kt.each((function(e,n){t.deleteTexture(e),Kt.remove(n)}))}},isTexture:!0,className:"Texture",isImageCanRelease:!1,_isImageReleased:!1,_image:null,image:{get:function(){return this._isImageReleased&&m.a.errorOnce("Read Texture.image(".concat(this.id,")"),"Read Texture.image after image released!"),this._image},set:function(t){this._image=t,this._isImageReleased=!1}},_releaseImage:function(){this._canvasImage=null,this._canvasCtx=null,this._originImage=null,this._image=null,this.mipmaps=null,this._isImageReleased=!0},mipmaps:null,target:Ut,internalFormat:Gt,format:Gt,type:kt,width:0,height:0,border:0,magFilter:Bt,minFilter:Bt,wrapS:Xt,wrapT:Xt,name:"",premultiplyAlpha:!1,flipY:!1,colorSpaceConversion:!0,compressed:!1,needUpdate:!0,needDestroy:!1,autoUpdate:!1,uv:0,anisotropic:1,origWidth:{get:function(){return this._originImage?this._originImage.width||this.width:this.image&&this.image.width||this.width}},origHeight:{get:function(){return this.originImage?this._originImage.height||this.height:this.image&&this.image.height||this.height}},useMipmap:{get:function(){return this.minFilter!==Bt&&this.minFilter!==Vt},set:function(){m.a.warn("texture.useMipmap is readOnly!")}},useRepeat:{get:function(){return this.wrapS!==jt||this.wrapT!==jt},set:function(){m.a.warn("texture.useRepeat is readOnly!")}},mipmapCount:{get:function(){return Math.floor(Math.log2(Math.max(this.width,this.height))+1)},set:function(){m.a.warn("texture.mipmapCount is readOnly!")}},constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},isImgPowerOfTwo:function(t){return d.a.isPowerOfTwo(t.width)&&d.a.isPowerOfTwo(t.height)},getSupportSize:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.width,r=t.height;e&&!this.isImgPowerOfTwo(t)&&(n=d.a.nextPowerOfTwo(n),r=d.a.nextPowerOfTwo(r));var i=et.MAX_TEXTURE_SIZE;return i&&(n>i&&(n=i),r>i&&(r=i)),{width:n,height:r}},resizeImgToPowerOfTwo:function(t){var e=this.getSupportSize(t,!0);return this.resizeImg(t,e.width,e.height)},resizeImg:function(t,e,n){if(t.width===e&&t.height===n)return t;var r=this._canvasImage;return r?(r.width=e,r.height=n,this._canvasCtx=r.getContext("2d")):((r=document.createElement("canvas")).width=e,r.height=n,this._canvasImage=r,this._canvasCtx=r.getContext("2d")),this._canvasCtx.drawImage(t,0,0,t.width,t.height,0,0,e,n),m.a.warnOnce("Texture.resizeImg(".concat(this.id,")"),"image size(".concat(t.width,"x").concat(t.height,") is not support. Resized to ").concat(r.width,"x").concat(r.height),t.src),this._originImage=t,r},_glUploadTexture:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.width,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.height,s=t.gl;return this.compressed?s.compressedTexImage2D(e,r,this.internalFormat,i,a,this.border,n):n&&void 0!==n.width?s.texImage2D(e,r,this.internalFormat,this.format,this.type,n):s.texImage2D(e,r,this.internalFormat,i,a,this.border,this.format,this.type,n),this},_uploadTexture:function(t){var e=this;return this.useMipmap&&this.mipmaps?this.mipmaps.forEach((function(n,r){e._glUploadTexture(t,e.target,n.data,r,n.width,n.height)})):this._glUploadTexture(t,this.target,this.image,0),this},_updatePixelStorei:function(){var t=this.state;t.pixelStorei(zt,this.premultiplyAlpha),t.pixelStorei(Wt,!!this.flipY),t.pixelStorei(Yt,this.colorSpaceConversion?qt:Zt)},updateTexture:function(t,e){var n=t.gl;if(this.needUpdate||this.autoUpdate){this._originImage&&this.image===this._canvasImage&&(this.image=this._originImage);var r=this.useMipmap,i=this.useRepeat;if(this.image&&!this.image.length){var a=i||r,s=this.getSupportSize(this.image,a);this.image=this.resizeImg(this.image,s.width,s.height),this.width=this.image.width,this.height=this.image.height}t.activeTexture(n.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._uploadTexture(t),r&&(this.compressed?this.mipmaps||(m.a.warn("Compressed texture has no mipmips, changed the minFilter from ".concat(this.minFilter," to Linear!"),this),this.minFilter=Bt):n.generateMipmap(this.target)),n.texParameterf(this.target,n.TEXTURE_MAG_FILTER,this.magFilter),n.texParameterf(this.target,n.TEXTURE_MIN_FILTER,this.minFilter),n.texParameterf(this.target,n.TEXTURE_WRAP_S,this.wrapS),n.texParameterf(this.target,n.TEXTURE_WRAP_T,this.wrapT);var o=tt.textureFilterAnisotropic;o&&this.anisotropic>1&&n.texParameterf(this.target,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropic,et.MAX_TEXTURE_MAX_ANISOTROPY)),this.needUpdate=!1}return this._needUpdateSubTexture&&(this._uploadSubTextures(t,e),this._needUpdateSubTexture=!1),this},_uploadSubTextures:function(t,e){var n=this;if(this._subTextureList&&this._subTextureList.length>0){var r=t.gl;t.activeTexture(r.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._subTextureList.forEach((function(t){var e=t[0],i=t[1],a=t[2];r.texSubImage2D(n.target,0,e,i,n.format,n.type,a)})),this._subTextureList.length=0}},_needUpdateSubTexture:!1,_subTextureList:null,updateSubTexture:function(t,e,n){this._subTextureList||(this._subTextureList=[]),this._subTextureList.push([t,e,n]),this._needUpdateSubTexture=!0},getGLTexture:function(t){this.state=t;var e=this.gl=t.gl,n=this.id;this.needDestroy&&(this.destroy(),this.needDestroy=!1);var r=Kt.get(n);return r||(r=e.createTexture(),Kt.add(n,r),this.needUpdate=!0),this.updateTexture(t,r),this.isImageCanRelease&&this._releaseImage(),r},setGLTexture:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&this.destroy(),Kt.add(this.id,t),this},destroy:function(){var t=this.id,e=Kt.get(t);return e&&this.gl&&(this.gl.deleteTexture(e),Kt.remove(t)),this},clone:function(){var t=Object.assign({},this);return delete t.id,new this.constructor(t)}}),Jt=P.a.TEXTURE_2D,$t=P.a.RGBA,te=P.a.UNSIGNED_BYTE,ee=P.a.COLOR_ATTACHMENT0,ne=P.a.DEPTH_STENCIL,re=P.a.DEPTH_TEST,ie=P.a.CULL_FACE,ae=P.a.TRIANGLE_STRIP,se=P.a.NEAREST,oe=P.a.CLAMP_TO_EDGE,ue=new J,ce=a.a.create({Statics:{cache:{get:function(){return ue}},reset:function(t){ue.each((function(t){t.reset()}))},destroy:function(t){ue.each((function(t){t.destroy()}))}},className:"Framebuffer",isFramebuffer:!0,bufferInternalFormat:ne,target:Jt,format:$t,internalFormat:$t,type:te,minFilter:se,magFilter:se,wrapS:oe,wrapT:oe,data:null,attachment:ee,needRenderbuffer:!0,useVao:!0,renderer:null,texture:null,renderbuffer:null,framebuffer:null,_isInit:!1,constructor:function(t,e){this.id=d.a.generateUUID(this.className),this.renderer=t,Object.assign(this,e),this.width||(this.width=t.width),this.height||(this.height=t.height),ue.add(this.id,this)},init:function(){if(!this._isInit&&this.renderer.isInit){this._isInit=!0;var t=this.renderer;this.gl=t.gl,this.state=t.state,this.reset()}},reset:function(){this.destroyResource();var t=this.gl;this.framebuffer=t.createFramebuffer(),this.bind(),this.needRenderbuffer&&(this.renderbuffer=this.createRenderbuffer()),this.texture=this.createTexture(),this.isComplete()||m.a.warn("Framebuffer is not complete => "+t.checkFramebufferStatus(t.FRAMEBUFFER)),this.unbind()},isComplete:function(){var t=this.gl;return!(!t||t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)},bind:function(){this.init(),this._isInit&&this.state.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer)},unbind:function(){if(this.init(),this._isInit){var t=this.state;t.bindFramebuffer(this.gl.FRAMEBUFFER,t.preFramebuffer)}},clear:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new v.a(0,0,0,0);if(this._isInit){var e=this.gl;e.clearColor(t.r,t.g,t.b,t.a),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4?arguments[4]:void 0;if(this._isInit){var a=this.gl,s=this.state;s.disable(re),s.disable(ie),i&&this.clear(i);var o=dt.getCustomShader(_t.a,gt.a,"","FramebufferTextureShader"),u=Lt.getProgram(o,s);u.useProgram();var c="".concat(t,"_").concat(e,"_").concat(n,"_").concat(r,"_").concat(u.id),h=Ft.getVao(a,c,{useVao:this.useVao,useInstanced:!1,mode:ae});if(h.isDirty){h.isDirty=!1;var f=[t=2*t-1,e=1-2*e,t+(n*=2),e,t,e-(r*=2),t+n,e-r];h.addAttribute(new C(new Float32Array(f),2),u.attributes.a_position),h.addAttribute(new C(new Float32Array([0,1,1,1,0,0,1,0]),2),u.attributes.a_texcoord0)}s.activeTexture(a.TEXTURE0),s.bindTexture(a.TEXTURE_2D,this.texture.getGLTexture(s)),h.draw()}},createRenderbuffer:function(){var t=this.gl,e=this.width,n=this.height,r=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),r},createTexture:function(){var t=this.state,e=t.gl,n=new Qt({minFilter:this.minFilter,magFilter:this.magFilter,internalFormat:this.internalFormat,format:this.format,type:this.type,width:this.width,height:this.height,image:this.data,wrapS:this.wrapS,wrapT:this.wrapT}),r=n.getGLTexture(t);return e.framebufferTexture2D(e.FRAMEBUFFER,this.attachment,this.target,r,0),n},resize:function(t,e,n){(n||this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this._isInit&&this.reset())},readPixels:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Object(i.getTypedArrayClass)(this.type),s=new a(n*r*4);if(this._isInit){var o=this.gl;e=this.height-e-r,this.bind(),o.readPixels(t,e,n,r,this.format,this.type,s),this.unbind()}return s},destroy:function(){return this._isDestroyed||(this.destroyResource(),this.gl=null,ue.removeObject(this),this._isDestroyed=!0),this},destroyResource:function(){var t=this.gl;t&&(this.framebuffer&&(t.deleteFramebuffer(this.framebuffer),this.framebuffer=null),this.renderbuffer&&(t.deleteRenderbuffer(this.renderbuffer),this.renderbuffer=null),this.texture&&(this.texture.destroy(),this.texture=null))}}),he=P.a.TEXTURE_CUBE_MAP,fe=P.a.RGB,le=P.a.LINEAR,de=P.a.CLAMP_TO_EDGE,me=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,_e=a.a.create({Extends:Qt,isCubeTexture:!0,className:"CubeTexture",target:he,internalFormat:fe,format:fe,magFilter:le,minFilter:le,wrapS:de,wrapT:de,constructor:function(t){_e.superclass.constructor.call(this,t),this.image=this.image||[]},_uploadTexture:function(t){var e=this,n=this.image;Array.isArray(n)&&6===n.length?(n[0]&&n[0].width&&(this.width=n[0].width,this.height=n[0].height),n.forEach((function(n,r){e._glUploadTexture(t,me+r,n,0)}))):m.a.error("CubeTexture image must be an Array of length 6",n)},right:{get:function(){return this.image[0]},set:function(t){this.image[0]=t}},left:{get:function(){return this.image[1]},set:function(t){this.image[1]=t}},top:{get:function(){return this.image[2]},set:function(t){this.image[2]=t}},bottom:{get:function(){return this.image[3]},set:function(t){this.image[3]=t}},front:{get:function(){return this.image[4]},set:function(t){this.image[4]=t}},back:{get:function(){return this.image[5]},set:function(t){this.image[5]=t}}}),pe=_e,ge=P.a.TEXTURE_2D,ve=P.a.RGBA,Ee=P.a.NEAREST,Te=P.a.CLAMP_TO_EDGE,Me=P.a.FLOAT,Ae=a.a.create({Extends:Qt,isDataTexture:!0,className:"DataTexture",target:ge,internalFormat:ve,format:ve,type:Me,magFilter:Ee,minFilter:Ee,wrapS:Te,wrapT:Te,dataLength:0,resetSize:function(t){if(t!==this.dataLength){this.dataLength=t;var e=d.a.nextPowerOfTwo(t/4),n=Math.max(Math.log2(e),4),r=Math.floor(n/2),a=n-r;this.width=Math.pow(2,r),this.height=Math.pow(2,a),this.DataClass=Object(i.getTypedArrayClass)(this.type)}},data:{get:function(){return this.image},set:function(t){if(this.image!==t){this.resetSize(t.length);var e=this.width*this.height*4;e===t.length&&t instanceof this.DataClass?this.image=t:(this.image&&this.image.length===e||(this.image=new this.DataClass(e)),this.image.set(t,0)),this.needUpdate=!0}}},constructor:function(t){Ae.superclass.constructor.call(this,t)}}),Le=Ae;function Ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Oe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},n=this.lightType;e["LIGHT_TYPE_".concat(n)]=1,e.SIDE=this.side,"NONE"!==n&&(e.HAS_LIGHT=1),this.premultiplyAlpha&&(e.PREMULTIPLY_ALPHA=1);var r=this._textureOption.reset(e);return e.HAS_LIGHT&&(e.HAS_NORMAL=1,r.add(this.normalMap,"NORMAL_MAP",(function(){1!==t.normalMapScale&&(e.NORMAL_MAP_SCALE=1)}))),r.add(this.parallaxMap,"PARALLAX_MAP"),r.add(this.emission,"EMISSION_MAP"),r.add(this.transparency,"TRANSPARENCY_MAP"),this.ignoreTranparent&&(e.IGNORE_TRANSPARENT=1),this.alphaCutoff>0&&(e.ALPHA_CUTOFF=1),this.useHDR&&(e.USE_HDR=1),this.gammaCorrection&&(e.GAMMA_CORRECTION=1),this.receiveShadows&&(e.RECEIVE_SHADOWS=1),this.castShadows&&(e.CAST_SHADOWS=1),this.uvMatrix&&(e.UV_MATRIX=1),this.uvMatrix1&&(e.UV_MATRIX1=1),this.usePhysicsLight&&(e.USE_PHYSICS_LIGHT=1),this.isDiffuesEnvAndAmbientLightWorkTogether&&(e.IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER=1),r.update(),e},_textureOption:{uvTypes:null,option:null,reset:function(t){return this.option=t,this.uvTypes={},this},add:function(t,e,n){if(t&&t.isTexture){var r=this.uvTypes,i=this.option,a=t.uv||0;r[a]=1,i[e]=a,t.isCubeTexture&&(i["".concat(e,"_CUBE")]=1),n&&n(t)}return this},update:function(){var t=[0,1],e=this.uvTypes,n=this.option;for(var r in e)-1!==t.indexOf(Number(r))?n["HAS_TEXCOORD".concat(r)]=1:(m.a.warnOnce("Material._textureOption.update(".concat(r,")"),"uv_".concat(r," not support!")),n.HAS_TEXCOORD0=1);return this}},getInstancedUniforms:function(){var t=this._instancedUniforms;if(!this._instancedUniforms){var e=this.uniforms;for(var n in t=this._instancedUniforms=[],e){var r=this.getUniformInfo(n);r.isDependMesh&&!r.notSupportInstanced&&t.push({name:n,info:r})}}return t},getUniformData:function(t,e,n){return this.getUniformInfo(t).get(e,this,n)},getAttributeData:function(t,e,n){return this.getAttributeInfo(t).get(e,this,n)},getUniformInfo:function(t){return this.getInfo("uniforms",t)},getAttributeInfo:function(t){return this.getInfo("attributes",t)},getInfo:function(t,e){var n=this[t][e];return"string"==typeof n&&(n=Ue[n]),n&&n.get||(m.a.warnOnce("material.getInfo-"+e,"Material.getInfo: no this semantic:"+e),n=Qe),n},clone:function(){var t=new this.constructor;for(var e in this)"id"!==e&&(t[e]=this[e]);return t},destroyTextures:function(){this.getTextures().forEach((function(t){t.destroy()}))},getTextures:function(){var t=[];for(var e in this){var n=this[e];n&&n.isTexture&&t.push(n)}return t},_copyProps:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}}),$e=a.a.create({Extends:Je,isBasicMaterial:!0,className:"BasicMaterial",lightType:"BLINN-PHONG",diffuse:null,ambient:null,specular:null,emission:null,specularEnvMap:null,specularEnvMatrix:null,reflectivity:0,refractRatio:0,refractivity:0,shininess:32,usedUniformVectors:11,constructor:function(t){this.diffuse=new v.a(.5,.5,.5),this.specular=new v.a(1,1,1),this.emission=new v.a(0,0,0),$e.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT",u_shininess:"SHININESS",u_reflectivity:"REFLECTIVITY",u_refractRatio:"REFRACTRATIO",u_refractivity:"REFRACTIVITY",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvMatrix:"SPECULARENVMATRIX"}),this.addTextureUniforms({u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$e.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t),n=this.lightType;"PHONG"!==n&&"BLINN-PHONG"!==n||(t.HAS_SPECULAR=1);var r=this.diffuse;return r&&r.isTexture&&(r.isCubeTexture?t.DIFFUSE_CUBE_MAP=1:e.add(this.diffuse,"DIFFUSE_MAP")),t.HAS_LIGHT&&(e.add(this.specular,"SPECULAR_MAP"),e.add(this.ambient,"AMBIENT_MAP"),e.add(this.specularEnvMap,"SPECULAR_ENV_MAP")),e.update(),t}}),tn=$e,en=P.a.POSITION,nn=P.a.NORMAL,rn=P.a.DEPTH,an=P.a.DISTANCE,sn=P.a.NONE,on=a.a.create({Extends:tn,isGeometryMaterial:!0,className:"GeometryMaterial",vertexType:en,lightType:sn,writeOriginData:!1,constructor:function(t){on.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_cameraFar:"CAMERAFAR",u_cameraNear:"CAMERANEAR",u_cameraType:"CAMERATYPE"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(on.superclass.getRenderOption.call(this,t),t["VERTEX_TYPE_".concat(this.vertexType)]=1,this.vertexType){case en:t.HAS_FRAG_POS=1;break;case nn:t.HAS_NORMAL=1;break;case rn:break;case an:t.HAS_FRAG_POS=1}return this.writeOriginData&&(t.WRITE_ORIGIN_DATA=1),t}}),un=on,cn=a.a.create({Extends:O,isOrthographicCamera:!0,className:"OrthographicCamera",_left:-1,left:{get:function(){return this._left},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._left=t}},_right:1,right:{get:function(){return this._right},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._right=t}},_bottom:-1,bottom:{get:function(){return this._bottom},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._bottom=t}},_top:1,top:{get:function(){return this._top},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._top=t}},_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:1,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},constructor:function(t){cn.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=[this.left,this.bottom,-this.near],r=[this.right,this.bottom,-this.near],i=[this.right,this.top,-this.near],a=[this.left,this.top,-this.near],s=[this.left,this.bottom,-this.far],o=[this.right,this.bottom,-this.far],u=[this.right,this.top,-this.far],c=[this.left,this.top,-this.far];e.addRect(s,o,u,c),e.addRect(o,r,i,u),e.addRect(r,n,a,i),e.addRect(n,s,c,a),e.addRect(c,u,i,a),e.addRect(n,r,o,s),this._geometry=e}return this._geometry}}),hn=cn,fn=P.a.DEPTH,ln=P.a.BACK,dn=null,mn=new v.a(1,1,1),_n=new o.a,pn=function(t){return t.material.castShadows},gn=a.a.create({isLightShadow:!0,className:"LightShadow",light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,cameraInfo:null,debug:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},createFramebuffer:function(){this.framebuffer||(this.framebuffer=new ce(this.renderer,{width:this.width,height:this.height}),this.debug&&this.showShadowMap())},updateLightCamera:function(t){this.light.isDirectionalLight?this.updateDirectionalLightCamera(t):this.light.isSpotLight&&this.updateSpotLightCamera(t)},updateDirectionalLightCamera:function(t){var e=this.light;if(this.camera.lookAt(e.direction),this.cameraInfo)this.updateCustumCamera(this.cameraInfo);else{var n=t.getGeometry();if(n){this.camera.updateViewMatrix(),_n.multiply(this.camera.viewMatrix,t.worldMatrix);var r=n.getBounds(_n);this.camera.near=-r.zMax,this.camera.far=-r.zMin,this.camera.left=r.xMin,this.camera.right=r.xMax,this.camera.bottom=r.yMin,this.camera.top=r.yMax}}this.camera.updateViewMatrix()},updateCustumCamera:function(t){for(var e in t)this.camera[e]=t[e]},updateSpotLightCamera:function(t){var e=this.light;this.camera.lookAt(e.direction),this.cameraInfo?this.updateCustumCamera(this.cameraInfo):(this.camera.fov=2*e.outerCutoff,this.camera.near=.01,this.camera.far=t.far,this.camera.aspect=1),this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.light.isDirectionalLight?this.camera=new hn:this.light.isSpotLight&&(this.camera=new Q),this.camera.addTo(this.light)),(this.light.isDirty||this._cameraMatrixVersion!==t.matrixVersion)&&(this.updateLightCamera(t),this._cameraMatrixVersion=t.matrixVersion,this.light.isDirty=!1)},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;dn||(dn=new un({vertexType:fn,side:ln,writeOriginData:!0})),n.bind(),e.state.viewport(0,0,this.width,this.height),e.clear(mn),r.updateViewProjectionMatrix(),Ue.setCamera(r),e.forceMaterial=dn,this.renderShadowScene(e),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){t.renderList.traverse((function(e){pn(e)&&t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e.filter((function(t){return pn(t)})))}))},showShadowMap:function(){var t=this;this.renderer.on("afterRender",(function(){t.framebuffer.render(0,.7,.3,.3)}))}}),vn=P.a.DISTANCE,En=P.a.BACK,Tn=P.a.TEXTURE_CUBE_MAP,Mn=P.a.TEXTURE0,An=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,Ln=P.a.NEAREST,In=P.a.FRAMEBUFFER,On=P.a.FRAMEBUFFER_COMPLETE,Sn=null,Rn=new v.a(0,0,0,0),yn=new c.a,Nn=[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,-1,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,0,-1,0]],xn=function(t,e){if(t.material.castShadows){if(!t.frustumTest)return!0;if(e.isMeshVisible(t))return!0}return!1},bn=a.a.create({isLightShadow:!0,className:"CubeLightShadow",Extends:gn,light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,debug:!1,constructor:function(t){bn.superclass.constructor.call(this,t)},createFramebuffer:function(){if(!this.framebuffer){this.framebuffer=new ce(this.renderer,{target:Tn,width:1024,height:1024,createTexture:function(){var t=this.state.gl,e=new pe({image:[null,null,null,null,null,null],type:this.type,format:this.format,internalFormat:this.internalFormat,magFilter:Ln,minFilter:Ln,width:1024,height:1024});return t.checkFramebufferStatus(In)!==On&&m.a.warn("Framebuffer is not complete",t.checkFramebufferStatus(In)),e},bindTexture:function(t){t=t||0;var e=this.state,n=e.gl,r=this.texture.getGLTexture(e);e.activeTexture(Mn+et.MAX_TEXTURE_INDEX),e.bindTexture(this.target,r),n.framebufferTexture2D(In,this.attachment,An+t,r,0)}})}},updateLightCamera:function(t){this.camera.fov=90,this.camera.near=t.near,this.camera.far=t.far,this.camera.aspect=1,this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.camera=new Q,this.updateLightCamera(t))},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;Sn||(Sn=new un({vertexType:vn,side:En,writeOriginData:!1})),n.bind(),e.state.viewport(0,0,n.width,n.height),this.light.worldMatrix.getTranslation(r.position);for(var i=0;i<6;i++)n.bindTexture(i),yn.fromArray(Nn[0],3*i).add(r.position),r.up.fromArray(Nn[1],3*i),r.lookAt(yn),r.updateViewProjectionMatrix(),e.clear(Rn),Ue.setCamera(r),e.forceMaterial=Sn,this.renderShadowScene(e);r.matrix.identity(),r.updateViewProjectionMatrix(),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){var e=t.renderList,n=this.camera;e.traverse((function(e){xn(e,n)&&t.renderMesh(e)}),(function(e){var r=e.filter((function(t){return xn(t,n)}));t.renderInstancedMeshes(r)}))}}),Cn=bn,Pn=a.a.create({Extends:M,isPointLight:!0,className:"PointLight",constructor:function(t){Pn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new Cn({light:this,renderer:t}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))}}),wn=Pn,Hn=new o.a,Dn=new c.a,Fn=a.a.create({Extends:M,isDirectionalLight:!0,className:"DirectionalLight",constructor:function(t){this.direction=new c.a(0,0,1),Fn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Dn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Dn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Hn);return Dn.copy(this.direction).transformDirection(e).normalize(),Dn}}),Un=Fn,Gn=new o.a,Bn=new c.a,Vn=a.a.create({Extends:M,isSpotLight:!0,className:"SpotLight",_cutoffCos:.9763,_cutoff:12.5,cutoff:{get:function(){return this._cutoff},set:function(t){this._cutoff=t,this._cutoffCos=Math.cos(d.a.degToRad(t))}},_outerCutoffCos:.9537,_outerCutoff:17.5,outerCutoff:{get:function(){return this._outerCutoff},set:function(t){this._outerCutoff=t,this._outerCutoffCos=Math.cos(d.a.degToRad(t))}},constructor:function(t){this.direction=new c.a(0,0,1),Vn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Bn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Bn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Gn);return Bn.copy(this.direction).transformDirection(e).normalize(),Bn}}),Xn=Vn,jn=a.a.create({Extends:Je,isShaderMaterial:!0,className:"ShaderMaterial",vs:"",fs:"",useHeaderCache:!1,constructor:function(t){jn.superclass.constructor.call(this,t)},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(jn.superclass.getRenderOption.call(this,t),this.getCustomRenderOption){var e=this.getCustomRenderOption({});for(var n in e)t["HILO_CUSTUM_OPTION_".concat(n)]=e[n]}return t},getCustomRenderOption:null}),kn=jn,zn=n(15),Wn=n.n(zn),Yn=a.a.create({Extends:Z,isMorphGeometry:!0,className:"MorphGeometry",isStatic:!1,weights:[],targets:null,constructor:function(t){Yn.superclass.constructor.call(this,t),this.weights=this.weights||[]},update:function(t,e){this.weights=t,this._originalMorphIndices=e},clone:function(){return Z.prototype.clone.call(this,{targets:this.targets,weights:this.weights})},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn.superclass.getRenderOption.call(this,e),this.targets&&(this._maxMorphTargetCount||(this._maxMorphTargetCount=Math.floor(8/Object.keys(this.targets).length)),Object(i.each)(this.targets,(function(n,r){e.MORPH_TARGET_COUNT=Math.min(n.length,t._maxMorphTargetCount),"vertices"===r?e.MORPH_HAS_POSITION=1:"normals"===r?e.MORPH_HAS_NORMAL=1:"tangents"===r&&(e.MORPH_HAS_TANGENT=1)}))),e}}),qn=Yn,Zn={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},Kn={Geometry:Z,GeometryData:C};var Qn={_decodeTotalTime:0,wasmURL:"",workerURL:"",useWASM:!0,useWebWorker:!0,useAuto:!0,init:function(){return Qn.useAuto?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Qn.useWebWorker?Wn.a.initWorker(Qn.workerURL):Qn.useWASM?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Promise.resolve()},parse:function(t,e,n,r){var i=Date.now(),a=e.bufferViews[t.bufferView],s=Qn.wasmURL,o=Qn.workerURL,u=Qn.useAuto,c=Qn.useWASM,h=Qn.useWebWorker,f=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);function l(e){Qn._decodeTotalTime+=Date.now()-i;var n=e.toHilo3dGeometry(Kn,r.primitive._geometry);return t.targets&&(n=function(t,e,n){if(!n.isMorphGeometry){var r=new qn;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&"id"!==i&&(r[i]=n[i]);r.targets={},n=r}for(var a=n.targets,s=0;s0&&void 0!==arguments[0]?arguments[0]:{};return t["FOG_".concat(this.mode)]=1,t}}),hr=n(16),fr=new hr.a,lr=new o.a,dr=a.a.create({Extends:g,isMesh:!0,className:"Mesh",geometry:null,material:null,useInstanced:!1,frustumTest:!0,constructor:function(t){dr.superclass.constructor.call(this,t)},clone:function(t){var e=g.prototype.clone.call(this,t);return Object.assign(e,{geometry:this.geometry,material:this.material}),e},raycast:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.visible)return null;var n=this.geometry,r=this.material,i=this.worldMatrix;if(n&&r){lr.invert(i),fr.copy(t),fr.transformMat4(lr);var a=n.raycast(fr,r.side,e);if(a)return a.forEach((function(t){t.transformMat4(i)})),a}return null},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.geometry.getRenderOption(t),t},isDestroyed:{get:function(){return this._isDestroyed}},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._isDestroyed)return this;this.removeFromParent();var n=t.resourceManager;return n.destroyMesh(this),this.material&&e&&this.material.destroyTextures(),this.off(),this.geometry=null,this.material=null,this._isDestroyed=!0,this}}),mr=dr,_r=new o.a,pr=new o.a,gr=a.a.create({Extends:mr,isSkinedMesh:!0,className:"SkinedMesh",useInstanced:!1,jointMatTexture:null,frustumTest:!1,skeleton:null,constructor:function(t){gr.superclass.constructor.call(this,t)},getJointMat:function(){var t=this;if(this.skeleton&&!(this.skeleton.jointCount<=0)){var e=this.skeleton.jointNodeList,n=this.skeleton.inverseBindMatrices,r=16*this.skeleton.jointCount;return this.jointMat&&this.jointMat.length===r||(this.jointMat=new Float32Array(r)),this.clonedFrom?pr.invert(this.clonedFrom.worldMatrix):pr.invert(this.worldMatrix),e.forEach((function(e,r){_r.copy(pr),_r.multiply(e.worldMatrix),_r.multiply(n[r]),_r.toArray(t.jointMat,16*r)})),this.jointMat}},resetJointNamesByNodeName:function(t){this.skeleton.resetJointNamesByNodeName(t)},resetSkinIndices:function(t){var e=this.skeleton;if(e){var n=this.geometry,r=n.skinIndices;if(r){this.material.isDirty=!0,n.isDirty=!0,r.isDirty=!0;var i=new R.a;r.traverse((function(n,a,s){n.elements.forEach((function(n,r){var a=e.jointNames[n],s=t.jointNames.indexOf(a);s>=0?i.elements[r]=s:m.a.warnOnce("SkinedMesh.resetSkinIndices","SkinedMesh.resetSkinIndices: no jointName found!",a)})),r.setByOffset(s,i)}))}}},initJointMatTexture:function(){if(!this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture=new Le({data:t})}return this.jointMatTexture},updateJointMatTexture:function(){if(this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture.data.set(t,0),this.jointMatTexture.needUpdate=!0}else this.initJointMatTexture()},clone:function(t){var e=mr.prototype.clone.call(this,t);return Object.assign(e,{useInstanced:this.useInstanced,skeleton:this.skeleton.clone()}),e.clonedFrom=this,e},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};gr.superclass.getRenderOption.call(this,t);var e=this.skeleton.jointCount;if(e&&(t.JOINT_COUNT=e,et.VERTEX_TEXTURE_FLOAT)){var n=(et.MAX_VERTEX_UNIFORM_VECTORS-22)/4;e>n&&(t.JOINT_MAT_MAP=1)}return t}}),vr=gr,Er=a.a.create({isSkeleton:!0,className:"Skeleton",userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.jointNodeList=[],this.jointNames=[],this.inverseBindMatrices=[],Object.assign(this,t)},jointCount:{get:function(){return this.jointNodeList.length}},_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,t&&this._initJointNodeList()}},_initJointNodeList:function(){var t={};this.rootNode.traverse((function(e){t[e.jointName]=e})),this.jointNodeList=this.jointNames.map((function(e){return t[e]}))},resetJointNamesByNodeName:function(t){var e=this.jointNames;this.jointNodeList.forEach((function(n,r){var i=t.rootNode.getChildByName(n.name);i&&(e[r]=i.jointName)}))},clone:function(t){var e=new Er;return e.copy(this,t),e},copy:function(t,e){return this.inverseBindMatrices=t.inverseBindMatrices,this.jointNames=t.jointNames.slice(),void 0===e&&(e=t.rootNode),this.rootNode=e,this}}),Tr=Er,Mr="1.15.20",Ar=a.a.create({className:"RenderInfo",isRenderInfo:!0,constructor:function(){this.reset()},addFaceCount:function(t){this._currentFaceCount+=t},addDrawCount:function(t){this._currentDrawCount+=t},reset:function(){this.faceCount=Math.floor(this._currentFaceCount),this.drawCount=Math.floor(this._currentDrawCount),this._currentFaceCount=0,this._currentDrawCount=0}}),Lr=new c.a,Ir=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;if(n!==r)return n-r;var i=t.material._shaderNumId||0,a=e.material._shaderNumId||0;return i!==a?i-a:t._sortRenderZ-e._sortRenderZ},Or=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;return n!==r?n-r:e._sortRenderZ-t._sortRenderZ},Sr=a.a.create({className:"RenderList",isRenderList:!0,useInstanced:!1,constructor:function(){this.opaqueList=[],this.transparentList=[],this.instancedDict={}},reset:function(){this.opaqueList.length=0,this.transparentList.length=0,this.instancedDict={}},traverse:function(t,e){this.opaqueList.forEach((function(e){t(e)}));var n=this.instancedDict;for(var r in n){var i=n[r];i.length>2&&e?e(i):i.forEach((function(e){t(e)}))}this.transparentList.forEach((function(e){t(e)}))},sort:function(){this.transparentList.sort(Or),this.opaqueList.sort(Ir)},addMesh:function(t,e){var n=t.material,r=t.geometry;if(n&&r){if(t.frustumTest&&!e.isMeshVisible(t))return;if(this.useInstanced&&t.useInstanced){var i=this.instancedDict,a=n.id+"_"+r.id,s=i[a];i[a]||(s=i[a]=[]),s.push(t)}else t.worldMatrix.getTranslation(Lr),Lr.transformMat4(e.viewProjectionMatrix),t._sortRenderZ=Lr.z,n.transparent?this.transparentList.push(t):this.opaqueList.push(t)}else m.a.warnOnce("RenderList.addMesh(".concat(t.id,")"),"Mesh must have material and geometry",t)}}),Rr=a.a.create({className:"WebGLState",isWebGLState:!0,systemFramebuffer:null,constructor:function(t){this.gl=t,this.reset()},reset:function(){this._dict={},this.activeTextureIndex=null,this.textureUnitDict={},this.currentFramebuffer=null,this.preFramebuffer=null,this._pixelStorei={}},enable:function(t){!0!==this._dict[t]&&(this._dict[t]=!0,this.gl.enable(t))},disable:function(t){!1!==this._dict[t]&&(this._dict[t]=!1,this.gl.disable(t))},bindFramebuffer:function(t,e){this.currentFramebuffer!==e&&(this.preFramebuffer=this.currentFramebuffer,this.currentFramebuffer=e,this.gl.bindFramebuffer(t,e))},bindSystemFramebuffer:function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,this.systemFramebuffer)},useProgram:function(t){this.set1("useProgram",t)},depthFunc:function(t){this.set1("depthFunc",t)},depthMask:function(t){this.set1("depthMask",t)},clear:function(t){this.gl.clear(t)},depthRange:function(t,e){this.set2("depthRange",t,e)},stencilFunc:function(t,e,n){this.set3("stencilFunc",t,e,n)},stencilMask:function(t){this.set1("stencilMask",t)},stencilOp:function(t,e,n){this.set3("stencilOp",t,e,n)},colorMask:function(t,e,n,r){this.set4("colorMask",t,e,n,r)},cullFace:function(t){this.set1("cullFace",t)},frontFace:function(t){this.set1("frontFace",t)},blendFuncSeparate:function(t,e,n,r){this.set4("blendFuncSeparate",t,e,n,r)},blendEquationSeparate:function(t,e){this.set2("blendEquationSeparate",t,e)},pixelStorei:function(t,e){this._pixelStorei[t]!==e&&(this._pixelStorei[t]=e,this.gl.pixelStorei(t,e))},viewport:function(t,e,n,r){this.set4("viewport",t,e,n,r)},activeTexture:function(t){this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},bindTexture:function(t,e){var n=this.getActiveTextureUnit();n[t]!==e&&(n[t]=e,this.gl.bindTexture(t,e))},getActiveTextureUnit:function(){var t=this.textureUnitDict[this.activeTextureIndex];return t||(t=this.textureUnitDict[this.activeTextureIndex]={}),t},set1:function(t,e){this._dict[t]!==e&&(this._dict[t]=e,this.gl[t](e))},set2:function(t,e,n){var r=this._dict[t];r||(r=this._dict[t]=[]),r[0]===e&&r[1]===n||(r[0]=e,r[1]=n,this.gl[t](e,n))},set3:function(t,e,n,r){var i=this._dict[t];i||(i=this._dict[t]=[]),i[0]===e&&i[1]===n&&i[2]===r||(i[0]=e,i[1]=n,i[2]=r,this.gl[t](e,n,r))},set4:function(t,e,n,r,i){var a=this._dict[t];a||(a=this._dict[t]=[]),a[0]===e&&a[1]===n&&a[2]===r&&a[3]===i||(a[0]=e,a[1]=n,a[2]=r,a[3]=i,this.gl[t](e,n,r,i))},get:function(t){return this._dict[t]}}),yr=a.a.create({Mixes:s.a,className:"WebGLResourceManager",isWebGLResourceManager:!0,hasNeedDestroyResource:!1,constructor:function(t){this._needDestroyResources=[],Object.assign(this,t)},destroyMesh:function(t){var e=this;this.getMeshResources(t).forEach((function(t){e.destroyIfNoRef(t)})),t._vao=t._program=t._shader=null},getMeshResources:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t._shader&&e.push(t._shader),t._vao&&(e.push(t._vao),t._vao.getResources(e)),t._program&&e.push(t._program),e},destroyIfNoRef:function(t){var e=this._needDestroyResources;return t&&e.indexOf(t)<0&&e.push(t),this},getUsedResources:function(t){var e=this,n=[];return t&&t.traverse((function(t){t.isMesh&&!t.isDestroyed&&e.getMeshResources(t,n)})),n},destroyUnsuedResource:function(t){var e=this,n=this._needDestroyResources;if(0===n.length)return this;var r=this.getUsedResources(t);return n.forEach((function(t){r.indexOf(t)<0&&t&&t.destroy&&!t.alwaysUse&&(e.fire("destroyResource",t.id),t.destroy())})),this.reset(),this},reset:function(){return this._needDestroyResources.length=0,this}}),Nr=new o.a,xr=new c.a,br=new Float32Array([0,0,0]),Cr=a.a.create({isLightManager:!0,className:"LightManager",constructor:function(t){this.ambientLights=[],this.directionalLights=[],this.pointLights=[],this.spotLights=[],this.areaLights=[],this.lightInfo={AMBIENT_LIGHTS:0,POINT_LIGHTS:0,DIRECTIONAL_LIGHTS:0,SPOT_LIGHTS:0,AREA_LIGHTS:0,uid:0},Object.assign(this,t)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.each)(this.lightInfo,(function(n,r){if("uid"!==r&&n){e[r]=n;var i=t.getShadowMapCount(r);i&&(e[r+"_SMC"]=i)}})),e},addLight:function(t){var e=null;return t.enabled?(t.isAmbientLight?e=this.ambientLights:t.isDirectionalLight?e=this.directionalLights:t.isPointLight?e=this.pointLights:t.isSpotLight?e=this.spotLights:t.isAreaLight?e=this.areaLights:m.a.warnOnce("LightManager.addLight(".concat(t.id,")"),"Not support this light:",t),e&&(t.shadow?e.unshift(t):e.push(t)),this):this},getDirectionalInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[];this.directionalLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(e,c),o.getViewDirection(t).toArray(n,c),o.shadow&&o.lightShadow&&(r.push(o.lightShadow.framebuffer.texture),i.push(o.lightShadow.width),i.push(o.lightShadow.height),s.push(o.lightShadow.minBias,o.lightShadow.maxBias),Nr.copy(t.worldMatrix),Nr.premultiply(o.lightShadow.camera.viewProjectionMatrix),Nr.toArray(a,16*u))}));var o={colors:new Float32Array(e),infos:new Float32Array(n)};return r.length&&(o.shadowMap=r,o.shadowMapSize=new Float32Array(i),o.shadowBias=new Float32Array(s),o.lightSpaceMatrix=new Float32Array(a)),o},getSpotInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[],c=[],h=[];this.spotLights.forEach((function(f,l){var d=3*l;f.getRealColor().toRGBArray(e,d),f.toInfoArray(n,d),f.getViewDirection(t).toArray(i,d),h.push(f.range),a.push(f._cutoffCos,f._outerCutoffCos),t.getModelViewMatrix(f,Nr),Nr.getTranslation(xr),xr.toArray(r,d),f.shadow&&f.lightShadow&&(s.push(f.lightShadow.framebuffer.texture),o.push(f.lightShadow.width),o.push(f.lightShadow.height),c.push(f.lightShadow.minBias,f.lightShadow.maxBias),Nr.multiply(f.lightShadow.camera.viewProjectionMatrix,t.worldMatrix),Nr.toArray(u,16*l))}));var f={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),dirs:new Float32Array(i),cutoffs:new Float32Array(a),ranges:new Float32Array(h)};return s.length&&(f.shadowMap=s,f.shadowMapSize=new Float32Array(o),f.shadowBias=new Float32Array(c),f.lightSpaceMatrix=new Float32Array(u)),f},getPointInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[];this.pointLights.forEach((function(c,h){var f=3*h;c.getRealColor().toRGBArray(e,f),c.toInfoArray(n,f),u.push(c.range),t.getModelViewMatrix(c,Nr),Nr.getTranslation(xr),xr.toArray(r,f),c.shadow&&c.lightShadow&&(i.push(c.lightShadow.framebuffer.texture),s.push(c.lightShadow.minBias,c.lightShadow.maxBias),t.worldMatrix.toArray(a,16*h),o[2*h]=c.lightShadow.camera.near,o[2*h+1]=c.lightShadow.camera.far)}));var c={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),ranges:new Float32Array(u)};return i.length&&(c.shadowMap=i,c.shadowBias=new Float32Array(s),c.lightSpaceMatrix=new Float32Array(a),c.cameras=new Float32Array(o)),c},getAreaInfo:function(t){var e,n,r=[],i=[],a=[],s=[];return this.areaLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(r,c),t.getModelViewMatrix(o,Nr),Nr.getTranslation(xr),xr.toArray(i,c);var h=Nr.getRotation();Nr.fromQuat(h),xr.set(.5*o.width,0,0),xr.transformMat4(Nr),xr.toArray(a,c),xr.set(0,.5*o.height,0),xr.transformMat4(Nr),xr.toArray(s,c),e=o.ltcTexture1,n=o.ltcTexture2})),{colors:new Float32Array(r),poses:new Float32Array(i),width:new Float32Array(a),height:new Float32Array(s),ltcTexture1:e,ltcTexture2:n}},getAmbientInfo:function(){return br[0]=br[1]=br[2]=0,this.ambientLights.forEach((function(t){var e=t.getRealColor();br[0]+=e.r,br[1]+=e.g,br[2]+=e.b})),br[0]=Math.min(1,br[0]),br[1]=Math.min(1,br[1]),br[2]=Math.min(1,br[2]),br},updateInfo:function(t){var e=this.lightInfo,n=this.ambientLights,r=this.directionalLights,i=this.pointLights,a=this.spotLights,s=this.areaLights;e.AMBIENT_LIGHTS=n.length,e.POINT_LIGHTS=i.length,e.DIRECTIONAL_LIGHTS=r.length,e.SPOT_LIGHTS=a.length,e.AREA_LIGHTS=s.length;var o=function(t){return!!t.shadow};e.SHADOW_POINT_LIGHTS=i.filter(o).length,e.SHADOW_SPOT_LIGHTS=a.filter(o).length,e.SHADOW_DIRECTIONAL_LIGHTS=r.filter(o).length,e.uid=[e.AMBIENT_LIGHTS,e.POINT_LIGHTS,e.SHADOW_POINT_LIGHTS,e.DIRECTIONAL_LIGHTS,e.SHADOW_DIRECTIONAL_LIGHTS,e.SPOT_LIGHTS,e.SHADOW_SPOT_LIGHTS,e.AREA_LIGHTS].join("_"),this.directionalInfo=this.getDirectionalInfo(t),this.pointInfo=this.getPointInfo(t),this.spotInfo=this.getSpotInfo(t),this.areaInfo=this.getAreaInfo(t),this.ambientInfo=this.getAmbientInfo()},getInfo:function(){return this.lightInfo},reset:function(){this.ambientLights.length=0,this.directionalLights.length=0,this.pointLights.length=0,this.spotLights.length=0,this.areaLights.length=0},getShadowMapCount:function(t){var e=[];"POINT_LIGHTS"===t?e=this.pointLights:"DIRECTIONAL_LIGHTS"===t?e=this.directionalLights:("SPOT_LIGHTS"===t||"AREA_LIGHTS"===t)&&(e=this.spotLights);var n=0;return e.forEach((function(t){n+=t.shadow?1:0})),n},createShadowMap:function(t,e){this.directionalLights.forEach((function(n){n.createShadowMap(t,e)})),this.spotLights.forEach((function(n){n.createShadowMap(t,e)})),this.pointLights.forEach((function(n){n.createShadowMap(t,e)})),this.areaLights.forEach((function(n){n.createShadowMap(t,e)}))}}),Pr=P.a.DEPTH_TEST,wr=P.a.STENCIL_TEST,Hr=P.a.SAMPLE_ALPHA_TO_COVERAGE,Dr=P.a.CULL_FACE,Fr=P.a.FRONT_AND_BACK,Ur=P.a.BLEND,Gr=P.a.LINES,Br=P.a.STATIC_DRAW,Vr=P.a.DYNAMIC_DRAW,Xr=a.a.create({Mixes:s.a,className:"WebGLRenderer",isWebGLRenderer:!0,gl:null,width:0,height:0,pixelRatio:1,domElement:null,useInstanced:!1,useVao:!0,alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,gameMode:!1,useFramebuffer:!1,framebufferOption:{},useLogDepth:!1,vertexPrecision:"highp",fragmentPrecision:"highp",fog:null,offsetX:0,offsetY:0,isInitFailed:!1,_isInit:!1,_isContextLost:!1,constructor:function(t){this.clearColor=new v.a(1,1,1),Object.assign(this,t),this.renderInfo=new Ar,this.renderList=new Sr,this.lightManager=new Cr,this.resourceManager=new yr},resize:function(t,e,n){if(n||this.width!==t||this.height!==e){var r=this.domElement;this.width=t,this.height=e,r.width=t,r.height=e,this.framebuffer&&this.framebuffer.resize(this.width,this.height,n),this.viewport()}},setOffset:function(t,e){this.offsetX===t&&this.offsetY===e||(this.offsetX=t,this.offsetY=e,this.viewport())},viewport:function(t,e,n,r){var i=this.state,a=this.gl;i&&(void 0===t?t=this.offsetX:this.offsetX=t,void 0===e?e=this.offsetY:this.offsetY=e,void 0===n&&(n=a.drawingBufferWidth),void 0===r&&(r=a.drawingBufferHeight),i.viewport(t,e,n,r))},isInit:{get:function(){return this._isInit&&!this.isInitFailed}},onInit:function(t){var e=this;this._isInit?t(this):this.on("init",(function(){t(e)}),!0)},initContext:function(){if(!this._isInit){this._isInit=!0;try{this._initContext(),this.fire("init")}catch(t){this.isInitFailed=!0,this.fire("initFailed",t)}}},_initContext:function(){var t=this,e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat};!0===this.preserveDrawingBuffer&&(e.preserveDrawingBuffer=!0),!0===this.gameMode&&(e.gameMode=!0);var n=this.gl=this.domElement.getContext("webgl",e);n.viewport(0,0,this.width,this.height),Tt.init(n),tt.init(n),et.init(n),dt.init(this),this.state=new Rr(n),tt.instanced||(this.useInstanced=!1),this.renderList.useInstanced=this.useInstanced,tt.vao||(this.useVao=!1),this.useFramebuffer&&(this.framebuffer=new ce(this,Object.assign({useVao:this.useVao,width:this.width,height:this.height},this.framebufferOption))),this.domElement.addEventListener("webglcontextlost",(function(e){t._onContextLost(e)}),!1),this.domElement.addEventListener("webglcontextrestored",(function(e){t._onContextRestore(e)}),!1)},_onContextLost:function(t){var e=this.gl;this._isContextLost=!0,t.preventDefault(),Lt.reset(e),dt.reset(e),Qt.reset(e),Nt.reset(e),Ft.reset(e),this.state.reset(e),this._lastMaterial=null,this._lastProgram=null,this.fire("webglContextLost")},_onContextRestore:function(t){var e=this.gl;this._isContextLost=!1,tt.reset(e),ce.reset(e),this.fire("webglContextRestored")},setupDepthTest:function(t){var e=this.state;t.depthTest?(e.enable(Pr),e.depthFunc(t.depthFunc),e.depthMask(t.depthMask),e.depthRange(t.depthRange[0],t.depthRange[1])):e.disable(Pr)},setupSampleAlphaToCoverage:function(t){var e=this.state;t.sampleAlphaToCoverage?e.enable(Hr):e.disable(Hr)},setupCullFace:function(t){var e=this.state;t.cullFace&&t.cullFaceType!==Fr?(e.enable(Dr),e.cullFace(t.cullFaceType),e.frontFace(t.frontFace)):e.disable(Dr)},setupBlend:function(t){var e=this.state;t.blend?(e.enable(Ur),e.blendFuncSeparate(t.blendSrc,t.blendDst,t.blendSrcAlpha,t.blendDstAlpha),e.blendEquationSeparate(t.blendEquation,t.blendEquationAlpha)):e.disable(Ur)},setupStencil:function(t){if(this.stencil){var e=this.state;t.stencilTest?(e.enable(wr),e.stencilMask(t.stencilMask),e.stencilFunc(t.stencilFunc,t.stencilFuncRef,t.stencilFuncMask),e.stencilOp(t.stencilOpFail,t.stencilOpZFail,t.stencilOpZPass)):e.disable(wr)}},setupUniforms:function(t,e,n,r){var i=this.forceMaterial||e.material;for(var a in t.uniforms){var s=i.getUniformInfo(a),o=t.uniforms[a];if(!s.isBlankInfo&&(r||s.isDependMesh&&!n)){var u=s.get(e,i,o);null!=u&&(t[a]=u)}}},setupVao:function(t,e,n){var r=n.geometry,i=r.isStatic;if(t.isDirty||!i||r.isDirty){t.isDirty=!1;var a=this.forceMaterial||n.material,s=a.attributes,o=i?Br:Vr;for(var u in s){var c=e.attributes[u];if(c){var h=a.getAttributeData(u,n,c);null!=h&&t.addAttribute(h,c,o)}}r.indices&&t.addIndexBuffer(r.indices,o),r.isDirty=!1}r.vertexCount&&(t.vertexCount=r.vertexCount)},setupMaterial:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=this.forceMaterial||e.material;(i.isDirty||this._lastMaterial!==i)&&(this.setupDepthTest(i),this.setupSampleAlphaToCoverage(i),this.setupCullFace(i),this.setupBlend(i),this.setupStencil(i),r=!0),this.setupUniforms(t,e,n,r),i.isDirty=!1,this._lastMaterial=i},setupMesh:function(t,e){var n=this.gl,r=this.state,i=this.lightManager,a=t.geometry,s=this.forceMaterial||t.material,o=dt.getShader(t,s,e,i,this.fog,this.useLogDepth),u=Lt.getProgram(o,r);u.useProgram(),this.setupMaterial(u,t,e,this._lastProgram!==u),this._lastProgram=u,t.material.wireframe&&a.mode!==Gr&&a.convertToLinesMode();var c=a.id+u.id,h=Ft.getVao(n,c,{useInstanced:e,useVao:this.useVao,mode:a.mode});return this.setupVao(h,u,t),t._vao=h,t._shader=o,t._program=u,{vao:h,program:u,geometry:a}},addRenderInfo:function(t,e){var n=this.renderInfo;n.addFaceCount(t),n.addDrawCount(e)},render:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.initContext(),!this.isInitFailed&&!this._isContextLost){var r=this.renderList,i=this.renderInfo,a=this.lightManager,s=this.resourceManager,o=this.state;this.fog=t.fog,a.reset(),i.reset(),r.reset(),Ue.init(this,o,e,a,this.fog),t.updateMatrixWorld(),e.updateViewProjectionMatrix(),t.traverse((function(t){return t.visible?(t.isMesh?r.addMesh(t,e):t.isLight&&a.addLight(t),g.TRAVERSE_STOP_NONE):g.TRAVERSE_STOP_CHILDREN})),r.sort(),a.createShadowMap(this,e),a.updateInfo(e),n&&this.fire("beforeRender"),this.useFramebuffer&&this.framebuffer.bind(),this.clear(),n&&this.fire("beforeRenderScene"),this.renderScene(),this.useFramebuffer&&this.renderToScreen(this.framebuffer),n&&this.fire("afterRender"),s.destroyUnsuedResource(t)}},renderScene:function(){var t=this;this.renderList.traverse((function(e){t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e)})),this._gameModeSumbit()},_gameModeSumbit:function(){var t=this.gl;this.gameMode&&t&&t.submit&&t.submit()},clear:function(t){var e=this.gl,n=this.state;t=t||this.clearColor,this._lastMaterial=null,this._lastProgram=null,e.clearColor(t.r,t.g,t.b,t.a),n.depthMask(!0);var r=e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT;this.stencil&&(n.stencilMask(!0),r|=e.STENCIL_BUFFER_BIT),e.clear(r)},clearDepth:function(){var t=this.gl;this.state.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},clearStencil:function(){var t=this.gl;this.state.stencilMask(!0),t.clear(t.STENCIL_BUFFER_BIT)},renderToScreen:function(t){this.state.bindSystemFramebuffer(),t.render(0,0,1,1,this.clearColor)},renderMesh:function(t){var e=this.setupMesh(t,!1).vao;e.draw(),this.addRenderInfo(e.vertexCount/3,1)},renderInstancedMeshes:function(t){var e=t[0];if(e){var n=this.forceMaterial||e.material,r=this.setupMesh(e,!0),i=r.vao,a=r.program;n.getInstancedUniforms().forEach((function(e){var n=e.name,r=e.info,s=a.attributes[n];s&&i.addInstancedAttribute(s,t,(function(t){return r.get(t)}))})),i.drawInstance(t.length),this.addRenderInfo(i.vertexCount/3*t.length,1)}},renderMultipleMeshes:function(t){var e=this;t.forEach((function(t){e.renderMesh(t)}))},releaseGLResource:function(){var t=this.gl;t&&(Lt.reset(t),dt.reset(t),Nt.reset(t),Ft.reset(t),this.state.reset(t),Qt.reset(t),ce.destroy(t))}}),jr=function(){var t,e=navigator.userAgent,n=document,r=window,i=n.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in r,supportCanvas:!!n.createElement("canvas").getContext,supportStorage:void 0,supportOrientation:"orientation"in r||"orientation"in r.screen,supportDeviceMotion:"ondevicemotion"in r};try{localStorage.setItem("hilo","hilo"),localStorage.removeItem("hilo"),a.supportStorage=!0}catch(t){a.supportStorage=!1,m.a.warn("LocalStorage disabled")}t=a.webkit||a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",a.jsVendor=t;var s=a.cssVendor="-"+t+"-",o=n.createElement("div"),u=o.style,c=void 0!==u[t+"Transform"],h=void 0!==u[t+"Perspective"];h&&(o.id="test3d",(u=n.createElement("style")).textContent="@media ("+s+"transform-3d){#test3d{height:3px}}",n.head.appendChild(u),i.appendChild(o),h=3===o.offsetHeight,n.head.removeChild(u),i.removeChild(o)),a.supportTransform=c,a.supportTransform3D=h;var f=a.supportTouch,l=f?"touchstart":"mousedown",d=f?"touchmove":"mousemove",_=f?"touchend":"mouseup";return a.POINTER_START=l,a.POINTER_MOVE=d,a.POINTER_END=_,a}(),kr=a.a.create({Extends:g,isStage:!0,className:"Stage",renderer:null,camera:null,pixelRatio:null,offsetX:0,offsetY:0,width:0,height:0,canvas:null,constructor:function(t){if(t.width||(t.width=window.innerWidth),t.height||(t.height=window.innerHeight),!t.pixelRatio){var e=window.devicePixelRatio||1;e=Math.min(e,1024/Math.max(t.width,t.height),2),e=Math.max(e,1),t.pixelRatio=e}kr.superclass.constructor.call(this,t),this.initRenderer(t),m.a.log("Hilo3d version: ".concat(Mr))},initRenderer:function(t){var e=this.canvas=this.createCanvas(t);this.renderer=new Xr(Object.assign(t,{domElement:e})),this.resize(this.width,this.height,this.pixelRatio,!0)},createCanvas:function(t){var e;return e=t.canvas?t.canvas:document.createElement("canvas"),t.container&&t.container.appendChild(e),e},resize:function(t,e,n,r){if(void 0===n&&(n=this.pixelRatio),r||this.width!==t||this.height!==e||this.pixelRatio!==n){this.width=t,this.height=e,this.pixelRatio=n,this.rendererWidth=t*n,this.rendererHeight=e*n;var i=this.canvas;this.renderer.resize(this.rendererWidth,this.rendererHeight,r),i.style.width=this.width+"px",i.style.height=this.height+"px",this.updateDomViewport()}return this},setOffset:function(t,e){if(this.offsetX!==t||this.offsetY!==e){this.offsetX=t,this.offsetY=e;var n=this.pixelRatio;this.renderer.setOffset(t*n,e*n)}return this},viewport:function(t,e,n,r){return this.resize(n,r,this.pixelRatio,!0),this.setOffset(t,e),this},tick:function(t){return this.traverseUpdate(t),this.camera&&this.renderer.render(this,this.camera,!0),this},enableDOMEvent:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.canvas,i=this._domListener||(this._domListener=function(t){e._onDOMEvent(t)});return(t="string"==typeof t?[t]:t).forEach((function(t){n?r.addEventListener(t,i,!1):r.removeEventListener(t,i)})),this},_onDOMEvent:function(t){var e=this.canvas,n=this._eventTarget,r=t.type,i=0===r.indexOf("touch"),a=t;if(i){var s=t.touches,o=t.changedTouches;s&&s.length?a=s[0]:o&&o.length&&(a=o[0])}var u=this.domViewport||this.updateDomViewport(),c=(a.pageX||a.clientX)-u.left,h=(a.pageY||a.clientY)-u.top;t.stageX=c,t.stageY=h,t.stopPropagation=function(){this._stopPropagationed=!0};var f=this.getMeshResultAtPoint(c,h,!0),l=f.mesh;t.hitPoint=f.point;var d="mouseout"===r;if(n&&(n!==l&&(!n.contains||!n.contains(l))||d)){var m=!1;if("touchmove"===r?m="touchout":"mousemove"!==r&&!d&&l||(m="mouseout"),m){var _=Object.assign({},t);_.type=m,_.eventTarget=n,n._fireMouseEvent(_)}t.lastEventTarget=n,this._eventTarget=null}if(l&&l.pointerEnabled&&"mouseout"!==r&&(t.eventTarget=this._eventTarget=l,l._fireMouseEvent(t)),!i){var p=l&&l.pointerEnabled&&l.useHandCursor?"pointer":"";e.style.cursor=p}jr.android&&"touchmove"===r&&t.preventDefault()},updateDomViewport:function(){var t=this.canvas,e=null;return t.parentNode&&(e=this.domViewport=Object(i.getElementRect)(t)),e},getMeshResultAtPoint:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.camera,i=this._ray;i||(i=this._ray=new hr.a),i.fromCamera(r,t,e,this.width,this.height);var a=this.raycast(i,!0,n);if(a)return a[0];this._stageResultAtPoint||(this._stageResultAtPoint={mesh:this,point:new c.a});var s=this._stageResultAtPoint.point;return s.copy(r.unprojectVector(s.set(t,e,0),this.width,this.height)),this._stageResultAtPoint},releaseGLResource:function(){return this.renderer.releaseGLResource(),this},destroy:function(){return kr.superclass.destroy.call(this,this.renderer),this.releaseGLResource(),this.traverse((function(t){t.off(),t.parent=null})),this.children.length=0,this.renderer.off(),this}}),zr=kr;function Wr(){return+new Date}var Yr=a.a.create({constructor:function(t,e,n,r){var i=this;for(var a in i.target=t,i._startTime=0,i._seekTime=0,i._pausedTime=0,i._pausedStartTime=0,i._reverseFlag=1,i._repeatCount=0,3===arguments.length&&(r=n,n=e,e=null),r)i[a]=r[a];i._fromProps=e,i._toProps=n,!r.duration&&r.time&&(i.duration=r.time||0,i.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(t,e){var n=this.target,r=t||e,i=this._fromProps={},a=this._toProps={};for(var s in t=t||n,e=e||n,r)a[s]=e[s]||0,n[s]=i[s]=t[s]||0;return this},start:function(){var t=this;return t._startTime=Wr()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,Yr.add(t),t},stop:function(){return Yr.remove(this),this},pause:function(){return this.paused=!0,this._pausedStartTime=Wr(),this},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=Wr()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,e){var n=this,r=Wr();return n._startTime=r,n._seekTime=t,n._pausedTime=0,void 0!==e&&(n.paused=e),n._update(r,!0),Yr.add(n),n},link:function(t){var e,n,r=t.delay,i=this._startTime;return"string"==typeof r&&(e=0===r.indexOf("+"),n=0===r.indexOf("-"),r=e||n?Number(r.substr(1))*(e?1:-1):Number(r)),t.delay=r,t._startTime=e||n?i+this.duration+r:i+r,this._next=t,Yr.remove(t),t},_render:function(t){var e=this.target,n=this._fromProps;for(var r in n)e[r]=n[r]+(this._toProps[r]-n[r])*t},_update:function(t,e){var n=this;if(n.paused&&!e)return!1;if(n.isComplete)return!0;var r=t-n._startTime-n._pausedTime+n._seekTime;if(r<0)return!1;var i,a=r/n.duration;a<=0?a=0:a>=1&&(a=1);var s=n.ease?n.ease(a):a;n.reverse&&n.isStart&&(n._reverseFlag<0&&(a=1-a,s=1-s),a<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0===n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=r,n._render(s),(i=n.onUpdate)&&i.call(n,s,n),a>=1&&(n.reverse?(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&u<=t?(o._render(a),o.time=r,Yr.add(o)):n.isComplete&&(u<0||u>t)&&o.start()}return!!n.isComplete&&((i=n.onComplete)&&i.call(n,n),!0)},Statics:{_tweens:[],tick:function(){var t,e,n=Yr._tweens,r=n.length;for(e=0;e-1&&r.splice(e,1);else for(e=0;e1||this.heightSegments>1||this.depthSegments>1},setFrontUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setFrontUV!"):this.setVertexUV(32,t)},setRightUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setRightUV!"):this.setVertexUV(0,t)},setBackUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBackUV!"):this.setVertexUV(40,t)},setLeftUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setLeftUV!"):this.setVertexUV(8,t)},setTopUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setTopUV!"):this.setVertexUV(16,t)},setBottomUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBottomUV!"):this.setVertexUV(24,t)},setAllRectUV:function(t){if(this.isSegments())return m.a.warn("segmented BoxGeometry dont support setAllRectUV!"),null;for(var e=0;e<6;e++)this.setVertexUV(8*e,t);return this},_raycast:function(t,e){return mi.superclass._raycast.call(this,t,e)}}),_i=mi,pi=P.a.FRONT,gi=P.a.BACK,vi=[0,0,1],Ei=a.a.create({Extends:Z,isPlaneGeometry:!0,className:"PlaneGeometry",width:1,height:1,widthSegments:1,heightSegments:1,constructor:function(t){Ei.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.widthSegments,e=this.heightSegments,n=(t+1)*(e+1),r=this.width/t,i=this.height/e,a=new Float32Array(3*n),s=new Float32Array(3*n),o=new Float32Array(2*n),u=new Uint16Array(t*e*6),c=0,h=0;h<=e;h++)for(var f=0;f<=t;f++){var l=h*(t+1)+f;if(a[3*l]=f*r-this.width/2,a[3*l+1]=this.height/2-h*i,s[3*l]=0,s[3*l+1]=0,s[3*l+2]=1,o[2*l]=f/t,o[2*l+1]=1-h/e,h0||n<0))return null;if(e===gi&&(r<0||n>0))return null;var i=t.intersectsPlane(vi,0);if(i){var a=i.x,s=i.y,o=.5*this.width,u=.5*this.height;if(a>=-o&&a<=o&&s>=-u&&s<=u)return[i]}return null}}),Ti=Ei,Mi=a.a.create({Extends:Z,isSphereGeometry:!0,className:"SphereGeometry",radius:1,heightSegments:16,widthSegments:32,constructor:function(t){Mi.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.radius,e=this.heightSegments,n=this.widthSegments,r=(n+1)*(e+1),i=n*e,a=new Float32Array(3*r),s=new Float32Array(4*r),o=new Float32Array(2*r),u=new Uint16Array(6*i),c=0,h=0,f=0,l=0,d=0,m=2*Math.PI,_=Math.PI,p=0;p<=e;p++)for(var g=p/e,v=_*g,E=Math.cos(v)*t,T=Math.sin(v)*t,M=0;M<=n;M++){var A=M/n,L=m*A,I=Math.cos(L),O=Math.sin(L),S=I*T,R=O*T,y=O,N=-I;if(s[f++]=y,s[f++]=0,s[f++]=N,s[f++]=1,a[h++]=S,a[h++]=E,a[h++]=R,o[l++]=A,o[l++]=g,p>0&&M>0){var x=d,b=x-1,P=b-n-1,w=x-n-1;u[c++]=P,u[c++]=w,u[c++]=x,u[c++]=P,u[c++]=x,u[c++]=b}d++}this.vertices=new C(a,3),this.indices=new C(u,1),this.uvs=new C(o,2),this.tangents=new C(s,4),this.normals=new C(new Float32Array(a),3)},_raycast:function(t,e){return Mi.superclass._raycast.call(this,t,e)}}),Ai=Mi,Li=[dt,Lt,Nt,Ft,Qt,ce],Ii=function(){var t="";return Li.forEach((function(e){t+="".concat(e.prototype.className,":").concat(Object.keys(e.cache._cache).length," ")})),m.a.log(t),t},Oi=a.a.create({Mixes:s.a,isLoadCache:!0,className:"LoadCache",Statics:{PENDING:1,LOADED:2,FAILED:3},enabled:!0,constructor:function(){this._files={}},update:function(t,e,n){if(this.enabled){var r={key:t,state:e,data:n};this._files[t]=r,this.fire("update",r),this.fire("update:".concat(r.key),r)}},get:function(t){return this.enabled?this._files[t]:null},getLoaded:function(t){var e=this.get(t);return e&&e.state===Oi.LOADED?e.data:null},remove:function(t){delete this._files[t]},clear:function(){this._files={}},wait:function(t){var e=this;return t?t.state===Oi.LOADED?Promise.resolve(t.data):t.state===Oi.FAILED?Promise.reject():new Promise((function(n,r){e.on("update:".concat(t.key),(function(t){var e=t.detail;e.state===Oi.LOADED?n(e.data):e.state===Oi.FAILED&&r(e.data)}),!0)})):Promise.reject()}}),Si=Oi,Ri=new Si,yi=a.a.create({Mixes:s.a,isBasicLoader:!0,className:"BasicLoader",Statics:{_cache:Ri,enalbeCache:function(){Ri.enabled=!0},disableCache:function(){Ri.enabled=!1},deleteCache:function(t){Ri.remove(t)},clearCache:function(){Ri.clear()},cache:{get:function(){return Ri},set:function(){m.a.warn("BasicLoader.cache is readonly!")}},TYPE_IMAGE:"img",TYPE_JSON:"json",TYPE_BUFFER:"buffer",TYPE_TEXT:"text"},load:function(t){var e=t.src,n=t.type;if(!n){var r=Object(i.getExtension)(e);/^(?:png|jpe?g|gif|webp|bmp)$/i.test(r)&&(n="img"),n||(n=t.defaultType)}return n===yi.TYPE_IMAGE?this.loadImg(e,t.crossOrigin):this.loadRes(e,n)},isCrossOrigin:function(t){var e=window.location,n=document.createElement("a");return n.href=t,n.hostname!==e.hostname||n.port!==e.port||n.protocol!==e.protocol},isBase64:function(t){return/^data:(.+?);base64,/.test(t)},Uint8ArrayFrom:function(t,e){if(Uint8Array.from)return Uint8Array.from(t,e);for(var n=t.length,r=new Uint8Array(n),i=0;i=300)r(new TypeError("Network request failed for ".concat(a.status)));else{var e="response"in a?a.response:a.responseText;if(t.type===yi.TYPE_JSON)try{e=JSON.parse(e)}catch(t){return void r(new TypeError("JSON.parse error"+t))}n(e)}},a.onprogress=function(n){e.fire("progress",{url:t.url,loaded:n.loaded,total:n.total})},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request timed out"))},a.open(t.method||"GET",t.url,!0),"include"===t.credentials&&(a.withCredentials=!0),t.type===yi.TYPE_BUFFER&&(a.responseType="arraybuffer"),Object(i.each)(t.headers,(function(t,e){a.setRequestHeader(e,t)})),a.send(t.body||null)}))}}),Ni=yi,xi=a.a.create({isLoader:!0,className:"Loader",maxConnections:2,Statics:{_loaderClassMap:{},_loaders:{},addLoader:function(t,e){xi._loaderClassMap[t]=e},getLoader:function(t){if(!xi._loaders[t]){var e=xi._loaderClassMap[t]?xi._loaderClassMap[t]:Ni;xi._loaders[t]=new e}return xi._loaders[t]}},preHandlerUrl:null,load:function(t){var e=this;if(t instanceof Array)return Promise.all(t.map((function(t){return e.load(t)})));var n=t.type||Object(i.getExtension)(t.src),r=xi.getLoader(n),a=t;return this.preHandlerUrl&&((a=Object.assign({},t)).src=this.preHandlerUrl(t.src)),r.load(a)}}),bi=xi,Ci=a.a.create({Extends:Ni,isCubeTextureLoader:!0,className:"CubeTextureLoader",constructor:function(){Ci.superclass.constructor.call(this)},load:function(t){var e,n=this;return e=t.images&&Array.isArray(t.images)?t.images:[t.right,t.left,t.top,t.bottom,t.front,t.back],Promise.all(e.map((function(e){return n.loadImg(e,t.crossOrigin)}))).then((function(e){var n=Object.assign({},t);return delete n.images,delete n.type,delete n.right,delete n.left,delete n.top,delete n.bottom,delete n.front,delete n.back,n.image=e,new pe(n)})).catch((function(t){throw m.a.error("load CubeTexture failed",t.message,t.stack),t}))}});bi.addLoader("CubeTexture",Ci);var Pi=Ci,wi=a.a.create({Extends:Je,isPBRMaterial:!0,className:"PBRMaterial",lightType:"PBR",gammaCorrection:!0,usePhysicsLight:!0,baseColor:null,baseColorMap:null,metallic:1,metallicMap:null,roughness:1,roughnessMap:null,metallicRoughnessMap:null,occlusionMap:null,occlusionStrength:1,isOcclusionInMetallicRoughnessMap:!1,diffuseEnvMap:null,diffuseEnvSphereHarmonics3:null,diffuseEnvIntensity:1,brdfLUT:null,specularEnvIntensity:1,specularEnvMap:null,isSpecularEnvMapIncludeMipmaps:!1,emission:null,emissionFactor:null,isSpecularGlossiness:!1,specular:null,glossiness:1,specularGlossinessMap:null,clearcoatFactor:0,clearcoatMap:null,clearcoatRoughnessFactor:0,clearcoatRoughnessMap:null,clearcoatNormalMap:null,usedUniformVectors:11,constructor:function(t){this.baseColor=new v.a(1,1,1),this.specular=new v.a(1,1,1),this.emissionFactor=new v.a(0,0,0),wi.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_baseColor:"BASECOLOR",u_metallic:"METALLIC",u_roughness:"ROUGHNESS",u_specular:"SPECULAR",u_emissionFactor:"EMISSIONFACTOR",u_glossiness:"GLOSSINESS",u_brdfLUT:"BRDFLUT",u_diffuseEnvMap:"DIFFUSEENVMAP",u_diffuseEnvIntensity:"DIFFUSEENVINTENSITY",u_occlusionStrength:"OCCLUSIONSTRENGTH",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvIntensity:"SPECULARENVINTENSITY",u_specularEnvMapMipCount:"SPECULARENVMAPMIPCOUNT",u_diffuseEnvSphereHarmonics3:"DIFFUSEENVSPHEREHARMONICS3",u_clearcoatFactor:"CLEARCOATFACTOR",u_clearcoatRoughnessFactor:"CLEARCOATROUGHNESSFACTOR"}),this.addTextureUniforms({u_baseColorMap:"BASECOLORMAP",u_metallicMap:"METALLICMAP",u_roughnessMap:"ROUGHNESSMAP",u_metallicRoughnessMap:"METALLICROUGHNESSMAP",u_occlusionMap:"OCCLUSIONMAP",u_specularGlossinessMap:"SPECULARGLOSSINESSMAP",u_lightMap:"LIGHTMAP",u_clearcoatMap:"CLEARCOATMAP",u_clearcoatRoughnessMap:"CLEARCOATROUGHNESSMAP",u_clearcoatNormalMap:"CLEARCOATNORMALMAP"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};wi.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t);return e.add(this.baseColorMap,"BASE_COLOR_MAP"),e.add(this.metallicMap,"METALLIC_MAP"),e.add(this.roughnessMap,"ROUGHNESS_MAP"),e.add(this.metallicRoughnessMap,"METALLIC_ROUGHNESS_MAP"),e.add(this.diffuseEnvMap,"DIFFUSE_ENV_MAP"),e.add(this.occlusionMap,"OCCLUSION_MAP"),e.add(this.lightMap,"LIGHT_MAP"),this.brdfLUT&&(e.add(this.specularEnvMap,"SPECULAR_ENV_MAP"),et.SHADER_TEXTURE_LOD&&this.specularEnvMap&&(t.USE_SHADER_TEXTURE_LOD=1)),this.isSpecularGlossiness&&(t.PBR_SPECULAR_GLOSSINESS=1,e.add(this.specularGlossinessMap,"SPECULAR_GLOSSINESS_MAP")),this.isOcclusionInMetallicRoughnessMap&&(t.IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP=1),1!==this.occlusionStrength&&(t.OCCLUSION_STRENGTH=1),this.diffuseEnvSphereHarmonics3&&(t.HAS_NORMAL=1,t.DIFFUSE_ENV_SPHERE_HARMONICS3=1),(this.specularEnvMap||this.diffuseEnvSphereHarmonics3||this.specularEnvMap)&&(t.NEED_WORLD_NORMAL=1),this.specularEnvMap&&this.isSpecularEnvMapIncludeMipmaps&&(t.IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS=1),this.clearcoatFactor>0&&(t.HAS_CLEARCOAT=1,t.HAS_NORMAL=1,this.clearcoatMap&&e.add(this.clearcoatMap,"CLEARCOAT_MAP"),this.clearcoatNormalMap&&e.add(this.clearcoatNormalMap,"CLEARCOAT_NORMAL_MAP"),this.clearcoatRoughnessMap&&e.add(this.clearcoatRoughnessMap,"CLEARCOAT_ROUGHNESS_MAP")),e.update(),t}}),Hi=wi,Di=new Image;Di.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var Fi=a.a.create({Extends:Qt,Mixes:s.a,isLazyTexture:!0,className:"LazyTexture",_src:"",crossOrigin:!1,autoLoad:!0,resType:"",src:{get:function(){return this._src},set:function(t){this._src!==t&&(this._src=t,this.autoLoad&&this.load())}},constructor:function(t){t&&("crossOrigin"in t&&(this.crossOrigin=t.crossOrigin),"autoLoad"in t&&(this.autoLoad=t.autoLoad)),Fi.superclass.constructor.call(this,t),this.image=this.placeHolder||Di},load:function(t){var e=this;return Fi.loader=Fi.loader||new bi,Fi.loader.load({src:this.src,crossOrigin:this.crossOrigin,type:this.resType,defaultType:"img"}).then((function(t){t.isTexture?(Object.assign(e,t),e.needUpdate=!0,e.needDestroy=!0,e.fire("load")):(e.image=t,e.needUpdate=!0,e.fire("load"))}),(function(n){if(e.fire("error"),t)throw new Error("LazyTexture Failed ".concat(n));m.a.warn("LazyTexture Failed ".concat(n))}))},_releaseImage:function(){this._src&&"string"!=typeof this._src&&(this._src=""),Fi.superclass._releaseImage.call(this)}}),Ui=Fi,Gi=n(13);function Bi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Vi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vi(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;r--)Zi[r]=t[r]+n*(e[r]-t[r]);return Zi}return t+n*(e-t)},STEP:function(t,e,n){return t},CUBICSPLINE:function(t,e,n,r){var a=t.length/3;if(void 0===e)return 1===a?t[1]:t.slice(a,-a);var s=t[1],o=t[2],u=e[1],c=e[0];return a>1&&(s=t.slice(a,-a),o=t.slice(-a),u=e.slice(a,-a),c=e.slice(0,a)),s.hermite?s.hermite(s,o.scale(r),u,c.scale(r),n):s.isQuaternion?(s.fromArray(this._cubicSpline(s.elements,o.elements,u.elements,c.elements,r,n),0,!0),s.normalize(!0)):(Object(i.isArrayLike)(s)||(s=[s],o=[o],u=[u],c=[c]),s=this._cubicSpline(s,o,u,c,r,n)),s},_cubicSpline:function(t,e,n,r,i,a){var s=a*a,o=s*a,u=2*o-3*s+1,c=o-2*s+a,h=-2*o+3*s,f=o-s;Zi.length=0;for(var l=t.length-1;l>=0;l--)Zi[l]=t[l]*u+c*e[l]*i+n[l]*h+f*r[l]*i;return Zi}},StateType:{TRANSLATE:"Translation",POSITION:"Translation",TRANSLATION:"Translation",SCALE:"Scale",ROTATE:"Rotation",ROTATION:"Rotation",QUATERNION:"Quaternion",WEIGHTS:"Weights"},getType:function(t){return t=String(t).toUpperCase(),Qi.StateType[t]||Qi._extraStateHandlers.type[t]},_extraStateHandlers:{type:{},handler:{}},registerStateHandler:function(t,e){Qi._extraStateHandlers.type[String(t).toUpperCase()]=t,Qi._extraStateHandlers.handler[t]=e}},isAnimationStates:!0,className:"AnimationStates",nodeName:"",type:"",interpolationType:"LINEAR",constructor:function(t){this.id=d.a.generateUUID(this.className),this.keyTime=[],this.states=[],Object.assign(this,t)},findIndexByTime:function(t){return Object(i.getIndexFromSortedArray)(this.keyTime,t,Ki)},getStateByIndex:function(t){var e=this.states.length/this.keyTime.length;return 1===e?this.states[t]:this.states.slice(t*e,t*e+e)},getState:function(t){var e=Bi(this.findIndexByTime(t),2),n=e[0],r=e[1];if(n<0||r>=this.keyTime.length)return null;var a=this.keyTime[n],s=this.keyTime[r],o=this.getStateByIndex(n);if("STEP"===this.interpolationType)return o;if(n===r){var u=this.interpolation(o);return this.type===Qi.StateType.ROTATION&&(u=Xi.fromEuler(qi.fromArray(u))),u.elements||u}var c=this.getStateByIndex(r),h=s-a,f=(t-a)/h;this.type===Qi.StateType.ROTATION?Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromEuler(qi.fromArray(o[0])),o[1]=ji.fromEuler(qi.fromArray(o[1])),o[2]=ki.fromEuler(qi.fromArray(o[2])),c[0]=zi.fromEuler(qi.fromArray(c[0])),c[1]=Wi.fromEuler(qi.fromArray(c[1])),c[2]=Yi.fromEuler(qi.fromArray(c[2]))):(o=Xi.fromEuler(qi.fromArray(o)),c=ji.fromEuler(qi.fromArray(c))):this.type===Qi.StateType.QUATERNION&&(Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromArray(o[0]),o[1]=ji.fromArray(o[1]),o[2]=ki.fromArray(o[2]),c[0]=zi.fromArray(c[0]),c[1]=Wi.fromArray(c[1]),c[2]=Yi.fromArray(c[2])):(o=Xi.fromArray(o),c=ji.fromArray(c)));var l=this.interpolation(o,c,f,h);return l.elements||l},interpolation:function(t,e,n,r){return Qi.interpolation[this.interpolationType](t,e,n,r)},updateNodeTranslation:function(t,e){t.x=e[0],t.y=e[1],t.z=e[2]},updateNodeScale:function(t,e){t.scaleX=e[0],t.scaleY=e[1],t.scaleZ=e[2]},updateNodeQuaternion:function(t,e){t.quaternion.fromArray(e)},updateNodeWeights:function(t,e){var n=this._originalWeightIndices=this._originalWeightIndices||[],r=e.length;e=e.slice();for(var i=0;ie[a]){var o=e[a];e[a]=e[s],e[s]=o,o=n[a],n[a]=n[s],n[s]=o}t.traverse((function(t){t.isMesh&&t.geometry&&t.geometry.isMorphGeometry&&t.geometry.update(e,n)}))},updateNodeState:function(t,e){if(e){var n=this.type;n===Qi.StateType.ROTATION&&(n=Qi.StateType.QUATERNION);var r=this.getState(t);if(r){var i="updateNode"+n;this[i]?this[i](e,r):Qi._extraStateHandlers.handler[n]?Qi._extraStateHandlers.handler[n].call(this,e,r):m.a.warnOnce(i,"updateNodeState failed unknow type(%s)",n)}}},clone:function(){return new this.constructor({keyTime:this.keyTime,states:this.states,type:this.type,nodeName:this.nodeName})}}),Ji=Qi,$i=a.a.create({Statics:{_anims:[],tick:function(t){this._anims.forEach((function(e){return e.tick(t)}))}},Mixes:s.a,isAnimation:!0,className:"Animation",paused:!1,currentLoopCount:0,loop:1/0,currentTime:0,timeScale:1,startTime:0,endTime:0,clipStartTime:0,clipEndTime:0,nodeNameMap:null,_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,this._initNodeNameMap()}},_animStatesList:null,animStatesList:{get:function(){return this._animStatesList},set:function(t){this._animStatesList=t,this._initClipTime()}},validAnimationIds:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.clips={},this._animStatesList=[],Object.assign(this,t)},addClip:function(t,e,n,r){this.clips[t]={start:e,end:n,animStatesList:r}},removeClip:function(t){this.clips[t]=null},getAnimStatesListTimeInfo:function(t){var e=0,n=1/0;return t.forEach((function(t){e=Math.max(t.keyTime[t.keyTime.length-1],e),n=Math.min(t.keyTime[0],n)})),{startTime:n,endTime:e}},_initClipTime:function(){var t=this.getAnimStatesListTimeInfo(this.animStatesList);this.clipStartTime=t.startTime,this.clipEndTime=t.endTime},_initNodeNameMap:function(){if(this._rootNode){var t=this.nodeNameMap={};this._rootNode.traverse((function(e){t[e.animationId]=e;var n=e.name;void 0===n||t[n]||(t[n]=e)}),!1)}},tick:function(t){this.paused||(this.currentTime+=t/1e3*this.timeScale,this.currentTime>=this.endTime?(this.currentLoopCount++,this.currentTime=this.endTime,this.updateAnimStates(),this.fire("loopEnd"),!this.loop||this.currentLoopCount>=this.loop?(this.stop(),this.fire("end")):this.currentTime=this.startTime):this.updateAnimStates())},updateAnimStates:function(){var t=this;return this.animStatesList.forEach((function(e){e.updateNodeState(t.currentTime,t.nodeNameMap[e.nodeName])})),this},play:function(t,e){var n;if("string"==typeof t){var r=this.clips[t];r?(n=r.start,e=r.end,r.animStatesList&&(this.animStatesList=r.animStatesList,this._initClipTime())):m.a.warn("no this animation clip name:"+t)}else n=t;void 0===n&&(n=this.clipStartTime),void 0===e&&(e=this.clipEndTime),this.endTime=Math.min(e,this.clipEndTime),this.startTime=Math.min(n,this.endTime),this.currentTime=this.startTime,this.currentLoopCount=0,this.stop(),this.paused=!1,$i._anims.push(this)},stop:function(){this.paused=!0;var t=$i._anims,e=t.indexOf(this);-1!==e&&t.splice(e,1)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},clone:function(t){var e=new this.constructor({rootNode:t,animStatesList:this.animStatesList,timeScale:this.timeScale,loop:this.loop,paused:this.paused,currentTime:this.currentTime,startTime:this.startTime,endTime:this.endTime,clips:this.clips});return this.paused||e.play(),e}}),ta=$i;function ea(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return na(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function na(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=2&&(this.isGLTF2=!0),this.parseExtensionUsed(),this.loadResources(t).then((function(){return e.parseExtensions(e.json.extensions,null,{isGlobal:!0,methodName:"parseOnLoad"}),Promise.resolve()})).then((function(){return e.parseGeometries()})).then((function(){return e.parseScene()}))},parseExtensionUsed:function(){var t=this;this.extensionsUsed={},i.each(this.json.extensionsUsed,(function(e){t.extensionsUsed[e]=!0})),this.extensionsUsed.WEB3D_quantized_attributes||(this.isUnQuantizeInShader=!1)},getExtensionHandler:function(t){return this.extensionHandlers&&this.extensionHandlers[t]||la.extensionHandlers[t]},parseExtension:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t[e],a=this.getExtensionHandler(e);return a&&a.parse?a.parse(i,this,n,r):n},parseExtensions:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.each(t,(function(t,i){if(!r.ignoreExtensions||!r.ignoreExtensions[i]){var a=n.getExtensionHandler(i),s=r.methodName||"parse";a&&a[s]&&(e=a[s](t,n,e,r))}})),e},isUseExtension:function(t,e){return!!(t&&t.extensions&&t.extensions[e])},parseBinary:function(t){this.isBinary=!0;var e,n=new DataView(t),r=n.getUint32(4,!0),a=n.getUint32(8,!0),s=12;if(r<2){var o=n.getUint32(s,!0);e=new Uint8Array(t,20,o),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e),this.binaryBody=t.slice(20+o)}else{if(2!==r)throw new Error("Dont support glTF version ".concat(r));for(;sa*i.BYTES_PER_ELEMENT)s.array=new i(s.buffer,s.byteOffset,s.byteLength/i.BYTES_PER_ELEMENT),r=new C(s.array,a,{offset:n.byteOffset||0,stride:s.byteStride,bufferViewId:s.id});else{var u,c=(n.byteOffset||0)+s.byteOffset;if(c%i.BYTES_PER_ELEMENT||this.forceCreateNewBuffer)u=new i(s.buffer.slice(c,c+o*i.BYTES_PER_ELEMENT));else u=new i(s.buffer,c,o);r=new C(u,a)}return n.sparse&&(r||(r=new C(new i(o),a)),r=this.sparseAccessorHandler(r,n.sparse)),r=this.parseExtensions(n.extensions,r,{isDecode:e,isAccessor:!0}),n.data=r,n.normalized&&(r.normalized=!0),r},getArrayByAccessor:function(t,e){var n=this.json.accessors[t];if(n.array)return n.array;var r=this.getAccessorData(t,e);if(!r.stride&&!r.offset&&1===r.size)return r.data;var i=[];return r.traverse((function(t){i.push(t.toArray?t.toArray():t)})),n.array=i,i},parseTechnique:function(t,e){var n=null;this.json.techniques&&(n=this.json.techniques[t.technique]),n&&n.states&&(n.states.enable.forEach((function(t){switch(t){case ra:e.blend=!0;break;case ia:e.depthTest=!0;break;case aa:e.cullFace=!0}})),i.each(n.states.functions,(function(t,n){switch(n){case"blendEquationSeparate":e.blendEquation=t[0],e.blendEquationAlpha=t[1];break;case"blendFuncSeparate":e.blendSrc=t[0],e.blendDst=t[1],e.blendSrcAlpha=t[2],e.blendDstAlpha=t[3];break;case"depthMask":e.depthMask=t[0];break;case"cullFace":e.cullFaceType=t[0];break;default:e[n]=t}})),e.cullFace?e.side=e.cullFaceType===sa?oa:sa:e.side=ua)},createMorphGeometry:function(t,e){var n=this,r=new qn,a=r.targets={};return i.each(t.targets,(function(t){i.each(t,(function(t,e){var r=fa[e].name;a[r]||(a[r]=[]);var i=n.getAccessorData(t,!0);a[r].push(i)}))})),r.weights=e||new Float32Array(t.targets.length),r},handlerGeometry:function(t,e){var n=void 0===e.mode?4:e.mode;if(e.extensions){var r=this.parseExtensions(e.extensions,null,{primitive:e,isPrimitive:!0});if(r)return r.mode=n,r}t||(t=new Z({mode:n})),"indices"in e&&(t.indices=this.getAccessorData(e.indices));var i=e.attributes;for(var a in i){var s=fa[a];if(s){var o=!(this.isUnQuantizeInShader&&s.decodeMatName);t[s.name]=this.getAccessorData(i[a],o),o||(t[s.decodeMatName]=t[s.name].decodeMat,delete t[s.name].decodeMat)}else m.a.warn("Unknow attribute named ".concat(a,"!"))}return t},handlerSkinedMesh:function(t,e){e&&(t.skeleton=e,this.useInstanced&&(t.useInstanced=!0))},fixProgressiveGeometry:function(t,e){t._geometry=e,this.isProgressive&&t._meshes&&t._meshes.forEach((function(t){t.visible=!0,t.geometry=e}))},parseGeometries:function(){var t=this,e=i.serialRun(this.json.meshes,(function(e){return i.serialRun(e.primitives,(function(n){var r;n.targets&&n.targets.length&&(r=t.createMorphGeometry(n,e.weights)),n._geometry=r;var i=t.handlerGeometry(r,n);return i&&i.then?i.then((function(e){t.fixProgressiveGeometry(n,e)}),(function(t){m.a.error("geometry parse error",t)})):(t.fixProgressiveGeometry(n,i),i)}))}));return this.isProgressive?null:e},parseMesh:function(t,e,n){var r=this,i=this.json.meshes[t];i.primitives.forEach((function(a){var s,o=r.skins&&r.skins[n.skin];if(a.meshNode)s=a.meshNode.clone();else{var u=r.materials[a.material]||new tn;s=new(o?vr:mr)({geometry:a._geometry,material:u,name:"mesh-"+(i.name||t)}),a.meshNode=s}r.handlerSkinedMesh(s,o),r.isProgressive&&!s.geometry&&(s.visible=!1,a._meshes=a._meshes||[],a._meshes.push(s)),e.addChild(s),r.meshes.push(s)}))},parseCameras:function(){var t=this;this.cameras={};var e=window.innerWidth/window.innerHeight;i.each(this.json.cameras,(function(n,r){var i;"perspective"===n.type&&n.perspective?((i=new Q).fov=d.a.radToDeg(n.perspective.yfov),i.near=n.perspective.znear,i.far=n.perspective.zfar,n.aspectRatio?i.aspect=n.aspectRatio:i.aspect=e):"orthographic"===n.type&&n.orthographic&&((i=new hn).near=n.orthographic.znear,i.far=n.orthographic.zfar,i.right=n.orthographic.xmag,i.left=-1*i.right,i.top=n.orthographic.ymag,i.bottom=-1*i.top),(i=t.parseExtensions(n.extensions,i,{isCamera:!0}))&&(i.name=n.name||r,t.cameras[r]=i)}))},handlerNodeTransform:function(t,e){e.matrix?t.matrix.fromArray(e.matrix):(e.rotation&&t.quaternion.fromArray(e.rotation),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.translation&&(t.x=e.translation[0],t.y=e.translation[1],t.z=e.translation[2]))},parseNode:function(t,e){var n,r=this,i=this.json.nodes[t];i||m.a.warn("GLTFParser.parseNode: nodes[".concat(t,"] has nothing.")),n=new g({name:i.name,animationId:t}),n=this.parseExtensions(i.extensions,n,{isNode:!0}),"camera"in i&&this.cameras[i.camera]&&n.addChild(this.cameras[i.camera]),this.handlerNodeTransform(n,i),i.jointName?(n.jointName=i.jointName,this.jointMap[n.jointName]=n):this.isGLTF2&&(n.jointName=t,this.jointMap[t]=n),i.meshes?i.meshes.forEach((function(t){return r.parseMesh(t,n,i)})):"mesh"in i&&this.parseMesh(i.mesh,n,i),i.children&&i.children.forEach((function(t){return r.parseNode(t,n)})),e.addChild(n)},parseAnimations:function(){var t=this;if(!this.json.animations)return null;var e=this.isMultiAnim,n={},r=[],a={};return i.each(this.json.animations,(function(i){i.channels.forEach((function(e){var n=e.target.path,s=e.target.id;t.isGLTF2&&(s=e.target.node);var o=i.samplers[e.sampler],u=t.isGLTF2?o.input:i.parameters[o.input],c=t.isGLTF2?o.output:i.parameters[n],h=t.getArrayByAccessor(u,!0),f=t.getArrayByAccessor(c,!0);"rotation"===n&&(n="quaternion");var l=new Ji({interpolationType:o.interpolation||"LINEAR",nodeName:s,keyTime:h,states:f,type:Ji.getType(n)});r.push(l),a[s]=!0})),e&&r.length&&(n[i.name]={animStatesList:r},r=[])})),e&&Object.keys(n).length>0&&(r=Object.values(n)[0].animStatesList),r.length?new ta({rootNode:this.node,animStatesList:r,validAnimationIds:a,clips:n}):null},parseScene:function(){var t=this;this.parseMaterials(),this.jointMap={},this.meshes=[],this.lights=[],this.node=new g({needCallChildUpdate:!1}),this.parseCameras();var e=this.json.scenes[this.getDefaultSceneName()];if(!e)return m.a.warn("GLTFParser:no scene!"),{node:this.node,meshes:[],cameras:[],lights:[],textures:[],materials:[]};var n=e.nodes;this.parseSkins(),n.forEach((function(e){return t.parseNode(e,t.node)})),this.resetSkinInfo(this.node);var r={node:this.node,scene:this.node,meshes:this.meshes,json:this.json,cameras:Object.values(this.cameras),lights:this.lights,textures:Object.values(this.textures),materials:Object.values(this.materials)},i=this.parseAnimations();return i&&(this.node.setAnim(i),i.play(),r.anim=i),this.parseExtensions(e.extensions,null,{isScene:!0}),this.parseExtensions(this.json.extensions,r,{isGlobal:!0,methodName:"parseOnEnd"}),r},getDefaultSceneName:function(){return void 0!==this.defaultScene?this.defaultScene:this.json.scenes?Object.keys(this.json.scenes)[0]:null},parseSkins:function(){var t=this;this.skins=[];var e=this.json.skins;e&&e.length&&(this.skins=e.map((function(e){for(var n=new Tr,r=e.joints.length,i=t.getArrayByAccessor(e.inverseBindMatrices,!0),a=0;a ",t)}return null}))}});bi.addLoader("hdr",Aa);var La=Aa,Ia=a.a.create({Statics:{HEADER_LEN:64,COMPRESSED_2D:0,COMPRESSED_3D:1,TEX_2D:2,TEX_3D:3},isKhronosTextureContainer:!0,className:"KhronosTextureContainer",constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.arrayBuffer=t,this.baseOffset=n;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,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]){var i=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*i),s=a.getUint32(0,!0),o=67305985===s;this.glType=a.getUint32(1*i,o),this.glTypeSize=a.getUint32(2*i,o),this.glFormat=a.getUint32(3*i,o),this.glInternalFormat=a.getUint32(4*i,o),this.glBaseInternalFormat=a.getUint32(5*i,o),this.pixelWidth=a.getUint32(6*i,o),this.pixelHeight=a.getUint32(7*i,o),this.pixelDepth=a.getUint32(8*i,o),this.numberOfArrayElements=a.getUint32(9*i,o),this.numberOfFaces=a.getUint32(10*i,o),this.numberOfMipmapLevels=a.getUint32(11*i,o),this.bytesOfKeyValueData=a.getUint32(12*i,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=Ia.COMPRESSED_2D:this.loadType=Ia.TEX_2D:m.a.warn("number of faces expected"+e+", but found "+this.numberOfFaces):m.a.warn("texture arrays not currently supported"):m.a.warn("only 2D textures currently supported")}else m.a.error("texture missing KTX identifier")},mipmaps:function(t){for(var e=[],n=Ia.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,i=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s2&&void 0!==arguments[2]?arguments[2]:0,r=new Ia(e,1,n),i={compressed:0===r.glType,type:r.glType,width:r.pixelWidth,height:r.pixelHeight,internalFormat:r.glInternalFormat,format:r.glFormat,isCubemap:6===r.numberOfFaces};return r.numberOfMipmapLevels>=Math.floor(Math.log2(Math.max(i.width,i.height))+1)?(i.mipmaps=r.mipmaps(!0),i.image=i.mipmaps[0].data):(i.mipmaps=null,i.image=r.mipmaps(!1)[0].data),new Qt(i)}});bi.addLoader("ktx",Oa);var Sa=Oa,Ra=a.a.create({Mixes:s.a,isLoadQueue:!0,className:"LoadQueue",Statics:{addLoader:function(t,e){m.a.warn("LoadQueue.addLoader is duplicated, please use Loader.addLoader"),bi.addLoader(t,e)}},constructor:function(t){this._source=[],this.add(t)},maxConnections:2,_source:null,_loaded:0,_connections:0,_currentIndex:-1,add:function(t){return t&&(t=Array.isArray(t)?t:[t],this._source=this._source.concat(t)),this},get:function(t){if(!t)return null;for(var e=this._source,n=0;n=n)this.fire("complete");else if(this._currentIndex2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.renderer.pixelRatio,a=[],s=this.framebuffer.readPixels(t*i,e*i,n*i,r*i),o=0;o=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=n.slice(0),i=0,a=r.length;i=0&&e.splice(n,1)},nextTick:function(t){var e=this,n={tick:function(){e.removeTick(n),t()}};return e.addTick(n),n},timeout:function(t,e){var n=this,r=(new Date).getTime()+e,i={tick:function(){(new Date).getTime()-r>=0&&(n.removeTick(i),t())}};return n.addTick(i),i},interval:function(t,e){var n=(new Date).getTime()+e,r={tick:function(){var r=(new Date).getTime(),i=r-n;i>=0&&(i0;){if(d(c)128){if(0==(u=(255&f[0])-128)||u>o-s)throw new Error("Bad scanline data");for(;u-- >0;)h[s++]=f[1]}else{if(0==(u=255&f[0])||u>o-s)throw new Error("Bad scanline data");if(h[s++]=f[1],--u>0){if(m(h,s,u)=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(103),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(35))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,a,s,o,u=1,c={},h=!1,f=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){m(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((a=new MessageChannel).port1.onmessage=function(t){m(t.data)},r=function(t){a.port2.postMessage(t)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,r=function(t){var e=f.createElement("script");e.onreadystatechange=function(){m(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(m,0,t)}:(s="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&m(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),r=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n 0.0 ? v : (0.5 * inversesqrt(max(1.0 - (x * x), 1e-7))) - v;\n return cross(v1, v2) * theta_sintheta;\n}\n\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if (dot(lightNormal, P - rectCoords[0]) < 0.0)\n return vec3(0.0);\n vec3 T1, T2;\n T1 = normalize(V - (N * dot(V, N)));\n T2 = -cross(N, T1);\n mat3 mat = mInv * transpose(mat3(T1, T2, N));\n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n\nvec3 getAreaLight(const in vec3 diffuseColor, const in vec3 specularColor, const in float roughness, const in vec3 normal, const in vec3 viewDir, const in vec3 position, const in vec3 lightPos, const in vec3 lightColor, const in vec3 halfWidth, const in vec3 halfHeight, const in sampler2D areaLightsLtcTexture1, const in sampler2D areaLightsLtcTexture2){\n vec3 rectCoords[4];\n rectCoords[0] = (lightPos - halfWidth) - halfHeight;\n rectCoords[1] = (lightPos + halfWidth) - halfHeight;\n rectCoords[2] = (lightPos + halfWidth) + halfHeight;\n rectCoords[3] = (lightPos - halfWidth) + halfHeight;\n \n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(areaLightsLtcTexture1, uv);\n vec4 t2 = texture2D(areaLightsLtcTexture2, uv);\n\n mat3 mInv = mat3(vec3(t1.x, 0, t1.y), vec3(0, 1, 0), vec3(t1.z, 0, t1.w));\n vec3 fresnel = (specularColor * t2.x) + ((vec3(1.0) - specularColor) * t2.y);\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += ((lightColor * fresnel) * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords));\n color += ((lightColor * diffuseColor) * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords));\n return color;\n}\n\n"},function(t,e,n){"use strict";n.r(e),n.d(e,"util",(function(){return i})),n.d(e,"GLTFExtensions",(function(){return r})),n.d(e,"Class",(function(){return a.a})),n.d(e,"EventMixin",(function(){return s.a})),n.d(e,"Fog",(function(){return cr})),n.d(e,"Mesh",(function(){return mr})),n.d(e,"Node",(function(){return g})),n.d(e,"SkinedMesh",(function(){return vr})),n.d(e,"Skeleton",(function(){return Tr})),n.d(e,"Stage",(function(){return zr})),n.d(e,"Tween",(function(){return di})),n.d(e,"version",(function(){return Mr})),n.d(e,"BoxGeometry",(function(){return _i})),n.d(e,"Geometry",(function(){return Z})),n.d(e,"GeometryData",(function(){return C})),n.d(e,"MorphGeometry",(function(){return qn})),n.d(e,"PlaneGeometry",(function(){return Ti})),n.d(e,"SphereGeometry",(function(){return Ai})),n.d(e,"Camera",(function(){return O})),n.d(e,"PerspectiveCamera",(function(){return Q})),n.d(e,"OrthographicCamera",(function(){return hn})),n.d(e,"Buffer",(function(){return Nt})),n.d(e,"capabilities",(function(){return et})),n.d(e,"extensions",(function(){return tt})),n.d(e,"Framebuffer",(function(){return ce})),n.d(e,"glType",(function(){return Tt})),n.d(e,"logGLResource",(function(){return Ii})),n.d(e,"Program",(function(){return Lt})),n.d(e,"RenderInfo",(function(){return Ar})),n.d(e,"RenderList",(function(){return Sr})),n.d(e,"VertexArrayObject",(function(){return Ft})),n.d(e,"WebGLRenderer",(function(){return Xr})),n.d(e,"WebGLResourceManager",(function(){return yr})),n.d(e,"WebGLState",(function(){return Rr})),n.d(e,"BasicLoader",(function(){return Ni})),n.d(e,"CubeTextureLoader",(function(){return Pi})),n.d(e,"GLTFLoader",(function(){return _a})),n.d(e,"GLTFParser",(function(){return da})),n.d(e,"AliAMCExtension",(function(){return Jn})),n.d(e,"HDRLoader",(function(){return La})),n.d(e,"KTXLoader",(function(){return Sa})),n.d(e,"LoadCache",(function(){return Si})),n.d(e,"LoadQueue",(function(){return Ra})),n.d(e,"ShaderMaterialLoader",(function(){return Na})),n.d(e,"TextureLoader",(function(){return ba})),n.d(e,"Loader",(function(){return bi})),n.d(e,"Texture",(function(){return Qt})),n.d(e,"LazyTexture",(function(){return Ui})),n.d(e,"CubeTexture",(function(){return pe})),n.d(e,"DataTexture",(function(){return Le})),n.d(e,"Shader",(function(){return dt})),n.d(e,"BasicMaterial",(function(){return tn})),n.d(e,"GeometryMaterial",(function(){return un})),n.d(e,"Material",(function(){return Je})),n.d(e,"PBRMaterial",(function(){return Hi})),n.d(e,"semantic",(function(){return Ue})),n.d(e,"ShaderMaterial",(function(){return kn})),n.d(e,"AxisHelper",(function(){return Ha})),n.d(e,"AxisNetHelper",(function(){return Ua})),n.d(e,"CameraHelper",(function(){return Xa})),n.d(e,"AmbientLight",(function(){return ka})),n.d(e,"AreaLight",(function(){return Wa})),n.d(e,"DirectionalLight",(function(){return Un})),n.d(e,"CubeLightShadow",(function(){return Cn})),n.d(e,"Light",(function(){return M})),n.d(e,"LightManager",(function(){return Cr})),n.d(e,"LightShadow",(function(){return gn})),n.d(e,"PointLight",(function(){return wn})),n.d(e,"SpotLight",(function(){return Xn})),n.d(e,"Animation",(function(){return ta})),n.d(e,"AnimationStates",(function(){return Ji})),n.d(e,"MeshPicker",(function(){return Ka})),n.d(e,"Ticker",(function(){return Qa})),n.d(e,"log",(function(){return m.a})),n.d(e,"Cache",(function(){return J})),n.d(e,"browser",(function(){return jr})),n.d(e,"WebGLSupport",(function(){return Ja})),n.d(e,"constants",(function(){return P.a})),n.d(e,"Color",(function(){return $a.Color})),n.d(e,"Euler",(function(){return $a.Euler})),n.d(e,"EulerNotifier",(function(){return $a.EulerNotifier})),n.d(e,"Frustum",(function(){return $a.Frustum})),n.d(e,"math",(function(){return $a.math})),n.d(e,"Matrix3",(function(){return $a.Matrix3})),n.d(e,"Matrix4",(function(){return $a.Matrix4})),n.d(e,"Matrix4Notifier",(function(){return $a.Matrix4Notifier})),n.d(e,"Plane",(function(){return $a.Plane})),n.d(e,"Quaternion",(function(){return $a.Quaternion})),n.d(e,"Ray",(function(){return $a.Ray})),n.d(e,"Sphere",(function(){return $a.Sphere})),n.d(e,"SphericalHarmonics3",(function(){return $a.SphericalHarmonics3})),n.d(e,"Vector2",(function(){return $a.Vector2})),n.d(e,"Vector3",(function(){return $a.Vector3})),n.d(e,"Vector3Notifier",(function(){return $a.Vector3Notifier})),n.d(e,"Vector4",(function(){return $a.Vector4}));var r={};n.r(r),n.d(r,"ALI_amc_mesh_compression",(function(){return Jn})),n.d(r,"WEB3D_quantized_attributes",(function(){return tr})),n.d(r,"HILO_animation_clips",(function(){return er})),n.d(r,"ALI_animation_clips",(function(){return nr})),n.d(r,"ALI_bounding_box",(function(){return rr})),n.d(r,"KHR_materials_pbrSpecularGlossiness",(function(){return ir})),n.d(r,"KHR_materials_clearcoat",(function(){return ar})),n.d(r,"KHR_lights_punctual",(function(){return sr})),n.d(r,"KHR_techniques_webgl",(function(){return or}));var i=n(4),a=n(1),s=n(9),o=n(7),u=n(21),c=n(5),h=n(17),f=n(22),l=n(10),d=n(6),m=n(3),_=new c.a(0,1,0),p=new o.a,g=a.a.create({Statics:{TRAVERSE_STOP_NONE:!1,TRAVERSE_STOP_CHILDREN:1,TRAVERSE_STOP_ALL:!0},Mixes:s.a,isNode:!0,className:"Node",name:"",anim:null,animationId:"",jointName:"",autoUpdateWorldMatrix:!0,autoUpdateChildWorldMatrix:!0,parent:null,_quatDirty:!1,_matrixDirty:!1,needCallChildUpdate:!0,visible:!0,pointerEnabled:!0,pointerChildren:!0,useHandCursor:!1,userData:null,onUpdate:null,__forceUseParentWorldMatrix:!1,constructor:function(t){var e=this;this.id=d.a.generateUUID(this.className),this.up=_.clone(),this.children=[],this.worldMatrix=new o.a,this._matrix=new u.a,this._position=new h.a(0,0,0),this._scale=new h.a(1,1,1),this._pivot=new h.a(0,0,0),this._rotation=new f.a,this._quaternion=new l.a,this._matrix.on("update",(function(){e._onMatrixUpdate()})),this._position.on("update",(function(){e._onPositionUpdate()})),this._scale.on("update",(function(){e._onScaleUpdate()})),this._pivot.on("update",(function(){e._onPivotUpdate()})),this._rotation.on("update",(function(){e._onRotationUpdate()})),this._quaternion.on("update",(function(){e._onQuaternionUpdate()})),Object.assign(this,t)},clone:function(t){var e=new this.constructor;return e.name=this.name,e.jointName=this.jointName,e.animationId=this.animationId,e.setPosition(this.x,this.y,this.z),e.setScale(this.scaleX,this.scaleY,this.scaleZ),e.setRotation(this.rotationX,this.rotationY,this.rotationZ),this.children.forEach((function(t){e.addChild(t.clone(!0))})),t||(this.anim&&(e.anim=this.anim.clone(e)),e.resetSkinedMeshRootNode()),e},setAnim:function(t){return this.anim=t,t.rootNode=this,this},resetSkinedMeshRootNode:function(){var t=this;this.traverse((function(e){e.isSkinedMesh&&e.skeleton&&(e.skeleton.rootNode=t)}),!0)},getChildrenNameMap:function(){var t={};return this.traverse((function(e){t[e.name]=e;var n=e._originName;void 0===n||t[n]||(t[n]=e)}),!0),t},addChild:function(t){return t.parent&&t.removeFromParent(),t.parent=this,this.children.push(t),this},removeChild:function(t){var e=this.children.indexOf(t);return e>-1&&(this.children.splice(e,1),t.parent=null),this},addTo:function(t){return t.addChild(this),this},removeFromParent:function(){return this.parent&&this.parent.removeChild(this),this},updateMatrix:function(){return this._matrixDirty&&(this._matrixDirty=!1,this.matrixVersion++,this._matrix.fromRotationTranslationScaleOrigin(this.quaternion,this._position,this._scale,this._pivot,!0)),this},updateQuaternion:function(){return this._quatDirty&&(this._quatDirty=!1,this._quaternion.fromEuler(this._rotation,!0)),this},updateTransform:function(){return this._matrix.decompose(this._quaternion,this._position,this._scale,this._pivot),this._onQuaternionUpdate(),this._matrixDirty=!1,this},updateMatrixWorld:function(t){return this.traverse((function(e){return(e.autoUpdateWorldMatrix||t)&&(e.parent?e.__forceUseParentWorldMatrix?e.worldMatrix.copy(e.parent.worldMatrix):e.worldMatrix.multiply(e.parent.worldMatrix,e.matrix):e.worldMatrix.copy(e.matrix)),!e.autoUpdateChildWorldMatrix&&!t&&1})),this},getConcatenatedMatrix:function(t){for(var e=new o.a,n=this;n&&n!==t;n=n.parent)e.multiply(n.matrix,e);return e},_traverse:function(t,e){if(!e){var n=t(this);if(n)return n}for(var r=this.children,i=0,a=r.length;i1&&void 0!==arguments[1]&&arguments[1];return this._traverse(t,e),this},traverseBFS:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(n=r?this.children:[this];n.length;){e=n,n=[];for(var i=0,a=e.length;i1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return this._scale.set(t,e,n),this},setPosition:function(t,e,n){return this._position.set(t,e,n),this},setRotation:function(t,e,n){return this._rotation.setDegree(t,e,n),this},setPivot:function(t,e,n){return this._pivot.set(t,e,n),this},lookAt:function(t){return this.isCamera?p.targetTo(this,t,this.up):p.targetTo(t,this,this.up),this._quaternion.fromMat4(p),this},raycast:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.visible)return null;var i=[];return this.traverse((function(n){if(r&&!n.pointerEnabled)return 1;if(n.isMesh){var a=n.raycast(t,!1);a&&(i=i.concat(a.map((function(t){return{mesh:n,point:t}}))))}return!(!r||e.pointerChildren)&&1})),i.length?(n&&t.sortPoints(i,"point"),i):null},matrix:{get:function(){return this.updateMatrix(),this._matrix},set:function(t){m.a.warnOnce("Node.matrix.set","node.matrix is readOnly.Use node.matrix.copy instead."),this._matrix.copy(t)}},position:{get:function(){return this._position},set:function(t){m.a.warnOnce("Node.position.set","node.position is readOnly.Use node.position.copy instead."),this._position.copy(t)}},x:{get:function(){return this._position.elements[0]},set:function(t){this._position.elements[0]=t,this._matrixDirty=!0}},y:{get:function(){return this._position.elements[1]},set:function(t){this._position.elements[1]=t,this._matrixDirty=!0}},z:{get:function(){return this._position.elements[2]},set:function(t){this._position.elements[2]=t,this._matrixDirty=!0}},scale:{get:function(){return this._scale},set:function(t){m.a.warnOnce("Node.scale.set","node.scale is readOnly.Use node.scale.copy instead."),this._scale.copy(t)}},scaleX:{get:function(){return this._scale.elements[0]},set:function(t){this._scale.elements[0]=t,this._matrixDirty=!0}},scaleY:{get:function(){return this._scale.elements[1]},set:function(t){this._scale.elements[1]=t,this._matrixDirty=!0}},scaleZ:{get:function(){return this._scale.elements[2]},set:function(t){this._scale.elements[2]=t,this._matrixDirty=!0}},pivot:{get:function(){return this._pivot},set:function(t){m.a.warnOnce("Node.pivot.set","node.pivot is readOnly.Use node.pivot.copy instead."),this._pivot.copy(t)}},pivotX:{get:function(){return this._pivot.elements[0]},set:function(t){this._pivot.elements[0]=t,this._matrixDirty=!0}},pivotY:{get:function(){return this._pivot.elements[1]},set:function(t){this._pivot.elements[1]=t,this._matrixDirty=!0}},pivotZ:{get:function(){return this._pivot.elements[2]},set:function(t){this._pivot.elements[2]=t,this._matrixDirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){m.a.warnOnce("Node.rotation.set","node.rotation is readOnly.Use node.rotation.copy instead."),this._rotation.copy(t)}},rotationX:{get:function(){return this._rotation.degX},set:function(t){this._rotation.degX=t}},rotationY:{get:function(){return this._rotation.degY},set:function(t){this._rotation.degY=t}},rotationZ:{get:function(){return this._rotation.degZ},set:function(t){this._rotation.degZ=t}},quaternion:{get:function(){return this.updateQuaternion(),this._quaternion},set:function(t){m.a.warnOnce("Node.quaternion.set","node.quaternion is readOnly.Use node.quaternion.copy instead."),this._quaternion.copy(t)}},matrixVersion:0,getBounds:function(t,e,n){return e?e.multiply(this.matrix):e=this.getConcatenatedMatrix(t),this.children.forEach((function(t){n=t.getBounds(null,e.clone(),n)})),this.isMesh&&(n=this.geometry.getBounds(e,n)),n},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"===t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=Object.assign({},t);e.type="mouseover",this.fire(e)}}else"mouseout"===t.type&&(this.__mouseOver=!1);var n=this.parent;t._stopped||t._stopPropagationed||!n||n._fireMouseEvent(t)},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getChildrenByBaseClassName("Node");return this.off(),n.forEach((function(n){n.isMesh?n.destroy(t,e):(n.off(),n.removeFromParent())})),this.removeFromParent(),this},_onMatrixUpdate:function(){this.matrixVersion++,this.updateTransform()},_onPositionUpdate:function(){this._matrixDirty=!0},_onScaleUpdate:function(){this._matrixDirty=!0},_onPivotUpdate:function(){this._matrixDirty=!0},_onRotationUpdate:function(){this._quatDirty=!0,this._matrixDirty=!0},_onQuaternionUpdate:function(){this._rotation.fromQuat(this._quaternion),this._quatDirty=!1}}),v=n(8),E=new v.a,T=a.a.create({Extends:g,isLight:!0,className:"Light",amount:1,enabled:!0,constantAttenuation:1,linearAttenuation:0,quadraticAttenuation:0,_range:0,range:{get:function(){return this._range},set:function(t){this.constantAttenuation=1,t<=0?(this.linearAttenuation=0,this.quadraticAttenuation=0):(this.linearAttenuation=4.5/t,this.quadraticAttenuation=75/(t*t)),this._range=t}},shadow:null,isDirty:!1,constructor:function(t){this.color=new v.a(1,1,1),T.superclass.constructor.call(this,t)},toInfoArray:function(t,e){return t[e+0]=this.constantAttenuation,t[e+1]=this.linearAttenuation,t[e+2]=this.quadraticAttenuation,this},getRealColor:function(){return E.copy(this.color).scale(this.amount)},createShadowMap:function(t,e){}}),M=T,A=n(23),L=new o.a,I=a.a.create({Extends:g,isCamera:!0,className:"Camera",_needUpdateProjectionMatrix:!0,_isGeometryDirty:!1,constructor:function(t){this.viewMatrix=new o.a,this.projectionMatrix=new o.a,this.viewProjectionMatrix=new o.a,this._frustum=new A.a,I.superclass.constructor.call(this,t)},updateViewMatrix:function(){return this.updateMatrixWorld(!0),this.viewMatrix.invert(this.worldMatrix),this},updateProjectionMatrix:function(){},getGeometry:function(t){},updateViewProjectionMatrix:function(){return this._needUpdateProjectionMatrix&&(this.updateProjectionMatrix(),this._needUpdateProjectionMatrix=!1),this.updateViewMatrix(),this.viewProjectionMatrix.multiply(this.projectionMatrix,this.viewMatrix),this.updateFrustum(this.viewProjectionMatrix),this},getModelViewMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewMatrix,t.worldMatrix),e},getModelProjectionMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewProjectionMatrix,t.worldMatrix),e},projectVector:function(t,e,n){var r=t.clone();return r.transformMat4(this.viewProjectionMatrix),e&&n&&(r.x=(r.x+1)/2*e,r.y=n-(r.y+1)/2*n),r},unprojectVector:function(t,e,n){var r=t.clone();return e&&n&&(r.x=r.x/e*2-1,r.y=1-r.y/n*2),L.invert(this.viewProjectionMatrix),r.transformMat4(L),r},isPointVisible:function(t){return!!this._frustum.intersectsSphere({center:t,radius:0})},isMeshVisible:function(t){var e=t.geometry;if(e){var n=e.getSphereBounds(t.worldMatrix);if(this._frustum.intersectsSphere(n))return!0}return!1},updateFrustum:function(t){return this._frustum.fromMatrix(t),this}}),O=I,S=n(14),R=n(12),y=n(11),N=n(20),x={2:new S.a,3:new c.a,4:new R.a,16:new o.a},b=a.a.create({className:"GeometryData",isGeometryData:!0,size:void 0,normalized:!1,type:void 0,_isSubDirty:!1,_isAllDirty:!1,isDirty:{get:function(){return this._isSubDirty||this._isAllDirty},set:function(t){this._isAllDirty=t,!1===t&&this.clearSubData()}},bufferViewId:void 0,glBuffer:null,constructor:function(t,e,n){this.id=d.a.generateUUID(this.className),this.data=t,this.size=e,Object.assign(this,n),this.bufferViewId||(this.bufferViewId=this.id),this.size||m.a.warn("GeometryData.constructor: geometryData must set size!",this)},_stride:0,stride:{get:function(){return this._stride},set:function(t){this._stride=t,this.strideSize=0===t?0:t/this.data.BYTES_PER_ELEMENT}},strideSize:0,_offset:0,offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetSize=t/this.data.BYTES_PER_ELEMENT}},offsetSize:0,data:{set:function(t){t&&(this._data=t,this.type=Object(i.getTypedArrayGLType)(t),this.stride=this._stride,this.offset=this._offset,this._isAllDirty=!0)},get:function(){return this._data}},length:{get:function(){return this._data.length}},realLength:{get:function(){return 0===this.strideSize?this._data.length:this._data.length/this.strideSize*this.size}},getByteLength:function(){return this._data.BYTES_PER_ELEMENT*this.realLength},count:{get:function(){return 0===this.strideSize?this._data.length/this.size:this._data.length/this.strideSize}},setSubData:function(t,e){this._isSubDirty=!0,this.data.set(e,t),this.subDataList||(this.subDataList=[]);var n=e.BYTES_PER_ELEMENT*t;this.subDataList.push({byteOffset:n,data:e})},clearSubData:function(){this.subDataList&&(this.subDataList.length=0),this._isSubDirty=!1},clone:function(){var t=new b(null,1);return t.copy(this),t},copy:function(t){var e=t.data;this.data=new e.constructor(e),this.size=t.size,this.stride=t.stride,this.normalized=t.normalized,this.type=t.type,this.offset=t.offset},getOffset:function(t){var e=this.strideSize;return 0===e?t*this.size:t*e+this.offsetSize},get:function(t){var e=this.getOffset(t);return this.getByOffset(e)},getCopy:function(t){return this.get(t).clone()},set:function(t,e){var n=this.getOffset(t);return this.setByOffset(n,e),n},getByOffset:function(t){var e=this.size;return e>1?x[e].fromArray(this._data,t):this._data[t]},setByOffset:function(t,e){var n=this.size,r=this._data;n>1?e.toArray(r,t):r[t]=e,this._isAllDirty=!0},traverse:function(t){for(var e=this.count,n=0;n0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromTranslation(G.set(t,e,n))),this},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.transformMat4(Y.fromScaling(G.set(t,e,n))),this},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromQuat(q.fromEuler({x:t*d.a.DEG2RAD,y:e*d.a.DEG2RAD,z:n*d.a.DEG2RAD}))),this},transformMat4:function(t){var e=this.vertices;if(e&&e.traverse((function(n,r,i){e.setByOffset(i,n.transformMat4(t))})),W.normalFromMat4(t),this._normals){var n=this.normals;n.traverse((function(t,e,r){n.setByOffset(r,t.transformMat3(W).normalize())}))}if(this._tangents){var r=this.tangents;r.traverse((function(t,e,n){r.setByOffset(n,t.transformMat3(W).normalize())}))}return this.isDirty=!0,this},merge:function(t,e){var n=t.vertices;if(n&&this.vertices){var r=this.vertices.count;e&&(n=t.vertices.clone()).traverse((function(t,r,i){n.setByOffset(i,t.transformMat4(e))})),this.vertices.merge(n),this.indices&&t.indices?this.indices.merge(t.indices,(function(t){return t+r})):this.indices=null}return this.uvs&&t.uvs?this.uvs.merge(t.uvs):this.uvs=null,this.uvs1&&t.uvs1?this.uvs1.merge(t.uvs1):this.uvs1=null,this.colors&&t.colors?this.colors.merge(t.colors):this.colors=null,this._normals&&(this._normals=null),this._tangents&&(this._tangents=null),this._tangents1&&(this._tangents1=null),this.isDirty=!0,this},ensureData:function(t,e,n,r){var i=this[t];if(!i||n>i.length){var a=new r(n);i?(a.set(i.data),i.data=a):this[t]=new C(a,e)}},addPoints:function(){var t=this,e=[].slice.call(arguments),n=3*(this.currentVerticesCount+e.length);this.ensureData("vertices",3,n,Float32Array);var r=this.vertices.data;return e.forEach((function(e){var n=3*t.currentVerticesCount++;r[n]=e[0],r[n+1]=e[1],r[n+2]=e[2]})),this.currentVerticesCount-e.length},addIndices:function(){var t=this,e=[].slice.call(arguments),n=this.currentIndicesCount+e.length;this.ensureData("indices",1,n,Uint16Array);var r=this.indices.data;e.forEach((function(e){r[t.currentIndicesCount++]=e})),this._needUpdateNormals=!0},addLine:function(t,e){var n=this.addPoints(t,e);this.addIndices(n,n+1)},addFace:function(t,e,n){var r=this.addPoints(t,e,n);this.addIndices(r,r+1,r+2)},addRect:function(t,e,n,r){var i=this.addPoints(t,e,n,r);this.addIndices(i,i+1,i+2,i,i+2,i+3)},setVertexUV:function(t,e){this.ensureData("uvs",2,this.vertices.length/3*2,Float32Array);for(var n=this.uvs.data,r=0;r0&&void 0!==arguments[0]&&arguments[0];return this._localBounds&&!t||(this._localBounds=this.getBounds()),this._localBounds},getSphereBounds:function(t){this._sphereBounds||(this._sphereBounds=new N.a);var e=this._sphereBounds;return e.copy(this.getLocalSphereBounds()),t&&e.transformMat4(t),e},getLocalSphereBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._localSphereBounds||t){var e=this.getLocalBounds(t),n=new N.a({center:new c.a(e.x,e.y,e.z)}),r=this.vertices;r?n.fromGeometryData(r):(m.a.warnOnce("geometry.getLocalSphereBounds","geometry has no vertices data, geometry.getLocalSphereBounds will return Infinity bounds."),n.radius=1/0),this._localSphereBounds=n}return this._localSphereBounds},convertToNoIndices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.mode===w)if(this.indices){for(var e=this.indices.data,n=e.length,r=new Float32Array(n*t),a=this.uvs?new Float32Array(2*n):null,s=new Float32Array(3*n),o=this.colors?new Float32Array(this.colors.size*n):null,u=this.skinIndices?new Float32Array(4*n):null,c=this.skinWeights?new Float32Array(4*n):null,h=0;h2&&void 0!==arguments[2])||arguments[2];return(n=this.useAABBRaycast?this._aabbRaycast(t):this._raycast(t,e))&&r&&t.sortPoints(n),n},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.positionDecodeMat&&(t.QUANTIZED=1,t.POSITION_QUANTIZED=1),this.normalDecodeMat&&(t.QUANTIZED=1,t.NORMAL_QUANTIZED=1),this.uvDecodeMat&&(t.QUANTIZED=1,t.UV_QUANTIZED=1),this.uv1DecodeMat&&(t.QUANTIZED=1,t.UV1_QUANTIZED=1),this.colors&&(t.HAS_COLOR=1,t.COLOR_SIZE=this.colors.size),t},getShaderKey:function(){return void 0===this._shaderKey&&(this._shaderKey="geometry",this.isMorphGeometry?this._shaderKey+="_id_".concat(this.id):(this.colors&&(this._shaderKey+="_colors"),this.positionDecodeMat&&(this._shaderKey+="positionDecodeMat"))),this._shaderKey},getSize:function(){var t=0;for(var e in this)Object(i.hasOwnProperty)(this,e)&&this[e]&&this[e].isGeometryData&&(t+=this[e].getByteLength());return t},destroy:function(){m.a.warn("Geometry.destroy has been deprecated, use mesh.destroy(renderer) instead.")}}),K=a.a.create({Extends:O,isPerspectiveCamera:!0,className:"PerspectiveCamera",_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:null,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},_fov:50,fov:{get:function(){return this._fov},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._fov=t}},_aspect:1,aspect:{get:function(){return this._aspect},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._aspect=t}},constructor:function(t){K.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.projectionMatrix.elements,e=this.near,n=this.far,r=this.aspect,i=this.fov,a=1/Math.tan(.5*d.a.degToRad(i));if(t[0]=a/r,t[5]=a,t[11]=-1,t[15]=0,n){var s=1/(e-n);t[10]=(e+n)*s,t[14]=2*n*e*s}else t[10]=-1,t[14]=-2*e},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=Math.tan(this.fov/2*Math.PI/180),r=this.near,i=this.far,a=r*n,s=i*n,o=this.aspect*a,u=this.aspect*s,c=[-o,-a,-r],h=[o,-a,-r],f=[o,a,-r],l=[-o,a,-r],d=[-u,-s,-i],m=[u,-s,-i],_=[u,s,-i],p=[-u,s,-i];e.addRect(d,m,_,p),e.addRect(m,h,f,_),e.addRect(h,c,l,f),e.addRect(c,d,p,l),e.addRect(p,_,f,l),e.addRect(c,h,m,d),this._geometry=e}return this._geometry}}),Q=K,J=a.a.create({constructor:function(){this._cache={}},get:function(t){return this._cache[t]},getObject:function(t){return this._cache[t.__cacheId]},add:function(t,e){"object"==typeof e&&(e.__cacheId=t),this._cache[t]=e},remove:function(t){delete this._cache[t]},removeObject:function(t){delete this._cache[t.__cacheId]},removeAll:function(){this._cache={}},each:function(t){var e=this._cache;for(var n in e)t(e[n],n)}}),$={instanced:void 0,vao:void 0,texFloat:void 0,loseContext:void 0,textureFilterAnisotropic:void 0,_usedExtensions:{},_disabledExtensions:{},init:function(t){this.reset(t)},reset:function(t){this.gl=t;var e=this._usedExtensions;for(var n in e){var r=e[n];this[r]=void 0,this.get(n,r)}},use:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.gl?this.get(t,e):this._usedExtensions[t]=e},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this._disabledExtensions[t])return null;var n=this[e];return void 0===n&&(n=this._getExtension(t),this[e]=n),n},disable:function(t){this._disabledExtensions[t]=!0},enable:function(t){this._disabledExtensions[t]=!1},_getExtension:function(t){var e=this.gl;return e&&e.getExtension&&(e.getExtension(t)||e.getExtension("WEBKIT_"+t)||e.getExtension("MOZ_"+t))||null}};$.use("ANGLE_instanced_arrays","instanced"),$.use("OES_vertex_array_object","vao"),$.use("OES_texture_float","texFloat"),$.use("WEBGL_lose_context","loseContext"),$.use("OES_element_index_uint","uintIndices"),$.use("EXT_shader_texture_lod","shaderTextureLod"),$.use("EXT_texture_filter_anisotropic","textureFilterAnisotropic");var tt=$,et={MAX_TEXTURE_INDEX:null,MAX_PRECISION:null,MAX_VERTEX_PRECISION:null,MAX_FRAGMENT_PRECISION:null,VERTEX_TEXTURE_FLOAT:null,FRAGMENT_TEXTURE_FLOAT:null,MAX_TEXTURE_MAX_ANISOTROPY:1,MAX_RENDERBUFFER_SIZE:void 0,MAX_COMBINED_TEXTURE_IMAGE_UNITS:void 0,MAX_CUBE_MAP_TEXTURE_SIZE:void 0,MAX_FRAGMENT_UNIFORM_VECTORS:void 0,MAX_TEXTURE_IMAGE_UNITS:void 0,MAX_TEXTURE_SIZE:void 0,MAX_VARYING_VECTORS:void 0,MAX_VERTEX_ATTRIBS:void 0,MAX_VERTEX_TEXTURE_IMAGE_UNITS:void 0,MAX_VERTEX_UNIFORM_VECTORS:void 0,init:function(t){var e=this;this.gl=t;["MAX_RENDERBUFFER_SIZE","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"].forEach((function(t){e.get(t)})),this.MAX_TEXTURE_INDEX=this.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,this.MAX_VERTEX_PRECISION=this._getMaxSupportPrecision(t.VERTEX_SHADER),this.MAX_FRAGMENT_PRECISION=this._getMaxSupportPrecision(t.FRAGMENT_SHADER),this.MAX_PRECISION=this.getMaxPrecision(this.MAX_FRAGMENT_PRECISION,this.MAX_VERTEX_PRECISION),this.VERTEX_TEXTURE_FLOAT=!!tt.texFloat&&this.MAX_VERTEX_TEXTURE_IMAGE_UNITS>0,this.FRAGMENT_TEXTURE_FLOAT=!!tt.texFloat,this.EXT_FRAG_DEPTH=tt.get("EXT_frag_depth"),this.SHADER_TEXTURE_LOD=!!tt.shaderTextureLod,tt.textureFilterAnisotropic&&(this.MAX_TEXTURE_MAX_ANISOTROPY=t.getParameter(tt.textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},get:function(t){var e=this.gl,n=this[t];return void 0===n&&(n=this[t]=e.getParameter(e[t])),n},_getMaxSupportPrecision:function(t){var e=this.gl,n="lowp";if(e.getShaderPrecisionFormat)for(var r=[{name:"highp",type:e.HIGH_FLOAT},{name:"mediump",type:e.MEDIUM_FLOAT}],i=0;i0){n=a.name;break}}else n="mediump";return n},getMaxPrecision:function(t,e){return"highp"===t||"mediump"===t&&"lowp"===e?e:t}},nt=n(50),rt=n.n(nt),it=n(51),at=n.n(it),st=n(52),ot=n.n(st),ut=n(53),ct=n.n(ut),ht=new J,ft=new J,lt=a.a.create({isShader:!0,className:"Shader",vs:"",fs:"",Statics:{commonOptions:{},shaders:{"chunk/baseDefine.glsl":n(18),"chunk/color.frag":n(36),"chunk/color.vert":n(74),"chunk/color_main.vert":n(76),"chunk/diffuse.frag":n(56),"chunk/diffuse_main.frag":n(65),"chunk/extensions.frag":n(24),"chunk/extensions.vert":n(48),"chunk/fog.frag":n(43),"chunk/fog_main.frag":n(67),"chunk/frag_color.frag":n(47),"chunk/joint.vert":n(69),"chunk/joint_main.vert":n(79),"chunk/light.frag":n(40),"chunk/lightFog.frag":n(39),"chunk/lightFog.vert":n(72),"chunk/lightFog_main.frag":n(45),"chunk/lightFog_main.vert":n(82),"chunk/logDepth.frag":n(28),"chunk/logDepth_main.frag":n(29),"chunk/logDepth.vert":n(75),"chunk/logDepth_main.vert":n(83),"chunk/morph.vert":n(73),"chunk/morph_main.vert":n(78),"chunk/normal.frag":n(38),"chunk/normal.vert":n(71),"chunk/normal_main.frag":n(44),"chunk/normal_main.vert":n(81),"chunk/pbr.frag":n(85),"chunk/pbr_main.frag":n(87),"chunk/phong.frag":n(63),"chunk/phong_main.frag":n(66),"chunk/precision.frag":n(25),"chunk/precision.vert":n(49),"chunk/transparency.frag":n(42),"chunk/transparency_main.frag":n(46),"chunk/unQuantize.vert":n(68),"chunk/unQuantize_main.vert":n(77),"chunk/uv.frag":n(37),"chunk/uv.vert":n(70),"chunk/uv_main.vert":n(80),"method/encoding.glsl":n(86),"method/getDiffuse.glsl":n(58),"method/getLightAttenuation.glsl":n(60),"method/getShadow.glsl":n(62),"method/getSpecular.glsl":n(59),"method/packFloat.glsl":n(84),"method/textureEnvMap.glsl":n(41),"method/transpose.glsl":n(57),"method/unpackFloat.glsl":n(61),"basic.frag":n(50),"basic.vert":n(51),"geometry.frag":n(52),"pbr.frag":n(53),"screen.frag":n(54),"screen.vert":n(55)},init:function(t){this.renderer=t,this.commonHeader=this._getCommonHeader(this.renderer)},cache:{get:function(){return ht}},headerCache:{get:function(){return ft}},reset:function(t){ht.removeAll()},getHeaderKey:function(t,e,n,r,i){var a="header_"+e.id+"_"+n.lightInfo.uid;return t.isSkinedMesh&&(a+="_joint"+t.skeleton.jointCount),r&&(a+="_fog_"+r.mode),a+="_"+t.geometry.getShaderKey(),i&&(a+="_fogDepth"),a},getHeader:function(t,e,n,r,i){var a=this.getHeaderKey(t,e,n,r),s=ft.get(a);if(!s||e.isDirty){var o={};Object.assign(o,this.commonOptions);var u=e.lightType;u&&"NONE"!==u&&n.getRenderOption(o),e.getRenderOption(o),t.getRenderOption(o),r&&(o.HAS_FOG=1,r.getRenderOption(o)),i&&(o.USE_LOG_DEPTH=1,et.EXT_FRAG_DEPTH&&(o.USE_EXT_FRAG_DEPTH=1)),o.HAS_NORMAL&&o.NORMAL_MAP&&(o.HAS_TANGENT=1),o.RECEIVE_SHADOWS||(delete o.DIRECTIONAL_LIGHTS_SMC,delete o.SPOT_LIGHTS_SMC,delete o.POINT_LIGHTS_SMC),s="#define SHADER_NAME ".concat(e.className,"\n"),s+=Object.keys(o).map((function(t){return t.indexOf("HILO_CUSTUM_OPTION_")>-1?"#define ".concat(t.replace("HILO_CUSTUM_OPTION_","")," ").concat(o[t]):"#define HILO_".concat(t," ").concat(o[t])})).join("\n")+"\n",ft.add(a,s)}return s},_getCommonHeader:function(t){var e=et.getMaxPrecision(et.MAX_VERTEX_PRECISION,t.vertexPrecision),n=et.getMaxPrecision(et.MAX_FRAGMENT_PRECISION,t.fragmentPrecision),r=et.getMaxPrecision(e,n);return"\n#define HILO_MAX_PRECISION ".concat(r,"\n#define HILO_MAX_VERTEX_PRECISION ").concat(e,"\n#define HILO_MAX_FRAGMENT_PRECISION ").concat(n,"\n")},getShader:function(t,e,n,r,i,a){var s=this.getHeader(t,e,r,i,a);return e.isBasicMaterial||e.isPBRMaterial?this.getBasicShader(e,n,s):e.isShaderMaterial?this.getCustomShader(e.vs,e.fs,s,e.shaderCacheId||e.id,e.useHeaderCache):null},getBasicShader:function(t,e,n){var r="";e&&(r=(r=t.getInstancedUniforms().map((function(t){return t.name}))).join("|"));var i=t.className+":"+r;t.onBeforeCompile&&(i+=":"+(t.shaderCacheId||t.id));var a=ht.get(i);if(!a){var s="",o=at.a;if(t.isBasicMaterial?t.isGeometryMaterial?s+=ot.a:s+=rt.a:t.isPBRMaterial&&(s+=ct.a),t.onBeforeCompile){var u=t.onBeforeCompile(o,s);s=u.fs,o=u.vs}if(r){var c=new RegExp("^\\s*uniform\\s+(\\w+)\\s+(".concat(r,");"),"gm");o=o.replace(c,"attribute $1 $2;")}a=this.getCustomShader(o,s,n,i,!0)}if(a){var h=this._getNumId(a);null!==h&&(t._shaderNumId=h)}return a},_getNumId:function(t){var e=t.id.match(/_(\d+)/);return e&&e[1]?parseInt(e[1],10):null},getCustomShader:function(t,e,n,r,i){var a,s=this.commonHeader;return r&&(i&&(r+=":"+n),a=ht.get(r)),a||(a=new lt({vs:s+n+t,fs:s+n+e}),r&&ht.add(r,a)),a}},alwaysUse:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(ht.removeObject(this),this._isDestroyed=!0),this}}),dt=lt,mt=n(55),_t=n.n(mt),pt=n(54),gt=n.n(pt),vt=[{name:"FLOAT",byteSize:4,uniformFuncName:"uniform1f",type:"Scalar",size:1},{name:"FLOAT_VEC2",byteSize:8,uniformFuncName:"uniform2f",type:"Vector",size:2},{name:"FLOAT_VEC3",byteSize:12,uniformFuncName:"uniform3f",type:"Vector",size:3},{name:"FLOAT_VEC4",byteSize:16,uniformFuncName:"uniform4f",type:"Vector",size:4},{name:"FLOAT_MAT2",byteSize:16,uniformFuncName:"uniformMatrix2fv",type:"Matrix",size:4},{name:"FLOAT_MAT3",byteSize:36,uniformFuncName:"uniformMatrix3fv",type:"Matrix",size:9},{name:"FLOAT_MAT4",byteSize:64,uniformFuncName:"uniformMatrix4fv",type:"Matrix",size:16},{name:"INT",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"INT_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"INT_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"INT_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"BOOL",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"BOOL_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"BOOL_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"BOOL_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"SAMPLER_2D",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"SAMPLER_CUBE",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1}],Et={},Tt={dict:Et,init:function(t){vt.forEach((function(e){var n,r,i=e.name,a=e.uniformFuncName,s=a+"v";"Matrix"===e.type?n=r=function(e,n){void 0!==n&&t[a](e,!1,n)}:(n=function(e,n){void 0!==n&&t[a](e,n)},r=function(e,n){t[s](e,n)}),Et[t[i]]=Object.assign(e,{glValue:t[i],uniform:n,uniformArray:r})}))},get:function(t){return Et[t]}},Mt=new J,At=a.a.create({Statics:{cache:{get:function(){return Mt}},reset:function(t){Mt.each((function(t){t.destroy()}))},getProgram:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.id,i=Mt.get(r);return i||(i=new At({state:e,vertexShader:t.vs,fragShader:t.fs,ignoreError:n}),Mt.add(r,i)),i},getBlankProgram:function(t){var e=dt.getCustomShader("void main(){}","precision HILO_MAX_FRAGMENT_PRECISION float;void main(){gl_FragColor = vec4(0.0);}","","__hiloBlankShader");return this.getProgram(e,t,!0)}},className:"Program",isProgram:!0,fragShader:"",vertexShader:"",attributes:null,uniforms:null,program:null,gl:null,state:null,alwaysUse:!1,constructor:function(t){return this.id=d.a.generateUUID(this.className),Object.assign(this,t),this._dict={},this.attributes={},this.uniforms={},this.gl=this.state.gl,this.program=this.createProgram(),this.program?(this.initAttributes(),this.initUniforms(),this):this.ignoreError?this:At.getBlankProgram(t.state)},createProgram:function(){var t=this.gl,e=t.createProgram(),n=this.createShader(t.VERTEX_SHADER,this.vertexShader),r=this.createShader(t.FRAGMENT_SHADER,this.fragShader);if(n&&r){if(t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(e,t.LINK_STATUS)){var i=t.getProgramInfoLog(e);return m.a.error("compileProgramError: "+i,this),t.deleteProgram(e),null}return e}return null},useProgram:function(){this.state.useProgram(this.program)},createShader:function(t,e){var n=this.gl,r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(r);return m.a.error("compileShaderError: "+i,e.split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),null}return r},initAttributes:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),i=tt.instanced,a=function(r){var a=e.getActiveAttrib(n,r),s=a.name,o=a.type,u=a.size,c=e.getAttribLocation(n,s),h=Tt.get(o),f=function(t){var n=t.type,r=void 0===n?e.FLOAT:n,i=t.normalized,a=void 0!==i&&i,s=t.stride,o=void 0===s?0:s,u=t.offset,f=void 0===u?0:u,l=t.size,d=void 0===l?h.size:l;e.vertexAttribPointer(c,d,r,a,o,f)},l=function(){e.enableVertexAttribArray(c)},d=function(){},m=function(t,e){t[c]=e};if(i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i.vertexAttribDivisorANGLE(c,t)}),"Matrix"===h.type){var _=h.byteSize,p=h.size,g=Math.sqrt(p),v=4*g,E=function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;E((function(e){i.vertexAttribDivisorANGLE(e,t)}))})}t.attributes[s]={name:s,location:c,type:o,size:u,glTypeInfo:h,pointer:f,enable:l,divisor:d,addTo:m}},s=0;s1||o>1?function(t){f(c,t)}:function(e){t._dict[s]!==e&&(t._dict[s]=e,l(c,e))}})},s=0;s2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,It,e,n)},createBuffer:function(t,e,n,r){var i=n.bufferViewId,a=Rt.get(i);return a||(n.isDirty=!1,a=new yt(t,e,n.data,r),Rt.add(i,a),a)},createIndexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,Ot,e,n)}},className:"Buffer",isBuffer:!0,constructor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St;this.id=d.a.generateUUID(this.className),this.gl=t,this.target=e,this.usage=r,this.buffer=t.createBuffer(),n&&this.bufferData(n)},bind:function(){return this.gl.bindBuffer(this.target,this.buffer),this},bufferData:function(t){var e=this.gl,n=this.target,r=this.usage;return this.bind(),e.bufferData(n,t,r),this.data=t,this},bufferSubData:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.gl,i=this.target;return n||this.bind(),r.bufferSubData(i,t,e),this},uploadGeometryData:function(t){var e=this,n=t.subDataList;return!this.data||this.data.byteLength2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;r0&&void 0!==arguments[0]?arguments[0]:1;this.bind();var e=this.gl,n=this.mode;this.useInstanced&&(this.indexBuffer?this.instancedExtension.drawElementsInstancedANGLE(n,this.vertexCount,e.UNSIGNED_SHORT,0,t):this.instancedExtension.drawArraysInstancedANGLE(n,0,this.getVertexCount(),t))},addIndexBuffer:function(t,e){this.bind();var n=this.gl,r=this.indexBuffer;return this.indexType=t.type,r?t.isDirty&&(r.uploadGeometryData(t),this.vertexCount=t.length):((r=Nt.createIndexBuffer(n,t,e)).bind(),this.indexBuffer=r,this.vertexCount=t.length),r},addAttribute:function(t,e,n,r){this.bind();var i=this.gl,a=e.name,s=this[a];if(!s){var o=Nt.createVertexBuffer(i,t,n);o.bind(),e.enable(),e.pointer(t),s={attribute:e,buffer:o,geometryData:t},this.attributes.push(s),this[a]=s,e.addTo(this.activeStates,s),r&&r(s)}if(t.isDirty){var u=s.buffer;u.bind(),e.enable(),e.pointer(t),u.uploadGeometryData(t)}return s},addInstancedAttribute:function(t,e,n){this.bind();var r=this.gl,i=t.name,a=t.glTypeInfo,s=bt.getTypedArray(Float32Array,e.length*a.size);e.forEach((function(t,e){void 0!==n(t)?bt.fillArrayData(s,n(t),e*a.size):m.a.warn("no attributeData:"+i+"-"+t.name)}));var o,u=this[i];return u?(o=u.geometryData).data=s:o=new C(s,1),this.addAttribute(o,t,r.DYNAMIC_DRAW,(function(e){t.divisor(1),e.useInstanced=!0}))},getResources:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.attributes&&this.attributes.forEach((function(e){t.push(e.buffer)})),this.indexBuffer&&t.push(this.indexBuffer),t},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){var t=this;return this._isDestroyed||(this.instancedExtension=null,this.useVao&&(this.vaoExtension.deleteVertexArrayOES(this.vao),this.vao=null,this.vaoExtension=null),this.gl=null,this.indexBuffer=null,this.attributes.forEach((function(e){var n=e.attribute||{};t[n.name]=null})),this.attributes=null,this.activeStates=null,Ht.removeObject(this),this._isDestroyed=!0),this}}),Ft=Dt,Ut=P.a.TEXTURE_2D,Gt=P.a.RGBA,Bt=P.a.LINEAR,Vt=P.a.NEAREST,Xt=P.a.REPEAT,jt=P.a.CLAMP_TO_EDGE,kt=P.a.UNSIGNED_BYTE,zt=P.a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wt=P.a.UNPACK_FLIP_Y_WEBGL,Yt=P.a.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt=P.a.BROWSER_DEFAULT_WEBGL,Zt=P.a.NONE,Kt=new J,Qt=a.a.create({Statics:{cache:{get:function(){return Kt}},reset:function(t){Kt.each((function(e,n){t.deleteTexture(e),Kt.remove(n)}))}},isTexture:!0,className:"Texture",isImageCanRelease:!1,_isImageReleased:!1,_image:null,image:{get:function(){return this._isImageReleased&&m.a.errorOnce("Read Texture.image(".concat(this.id,")"),"Read Texture.image after image released!"),this._image},set:function(t){this._image=t,this._isImageReleased=!1}},_releaseImage:function(){this._canvasImage=null,this._canvasCtx=null,this._originImage=null,this._image=null,this.mipmaps=null,this._isImageReleased=!0},mipmaps:null,target:Ut,internalFormat:Gt,format:Gt,type:kt,width:0,height:0,border:0,magFilter:Bt,minFilter:Bt,wrapS:Xt,wrapT:Xt,name:"",premultiplyAlpha:!1,flipY:!1,colorSpaceConversion:!0,compressed:!1,needUpdate:!0,needDestroy:!1,autoUpdate:!1,uv:0,anisotropic:1,origWidth:{get:function(){return this._originImage?this._originImage.width||this.width:this.image&&this.image.width||this.width}},origHeight:{get:function(){return this.originImage?this._originImage.height||this.height:this.image&&this.image.height||this.height}},useMipmap:{get:function(){return this.minFilter!==Bt&&this.minFilter!==Vt},set:function(){m.a.warn("texture.useMipmap is readOnly!")}},useRepeat:{get:function(){return this.wrapS!==jt||this.wrapT!==jt},set:function(){m.a.warn("texture.useRepeat is readOnly!")}},mipmapCount:{get:function(){return Math.floor(Math.log2(Math.max(this.width,this.height))+1)},set:function(){m.a.warn("texture.mipmapCount is readOnly!")}},constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},isImgPowerOfTwo:function(t){return d.a.isPowerOfTwo(t.width)&&d.a.isPowerOfTwo(t.height)},getSupportSize:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.width,r=t.height;e&&!this.isImgPowerOfTwo(t)&&(n=d.a.nextPowerOfTwo(n),r=d.a.nextPowerOfTwo(r));var i=et.MAX_TEXTURE_SIZE;return i&&(n>i&&(n=i),r>i&&(r=i)),{width:n,height:r}},resizeImgToPowerOfTwo:function(t){var e=this.getSupportSize(t,!0);return this.resizeImg(t,e.width,e.height)},resizeImg:function(t,e,n){if(t.width===e&&t.height===n)return t;var r=this._canvasImage;return r?(r.width=e,r.height=n,this._canvasCtx=r.getContext("2d")):((r=document.createElement("canvas")).width=e,r.height=n,this._canvasImage=r,this._canvasCtx=r.getContext("2d")),this._canvasCtx.drawImage(t,0,0,t.width,t.height,0,0,e,n),m.a.warnOnce("Texture.resizeImg(".concat(this.id,")"),"image size(".concat(t.width,"x").concat(t.height,") is not support. Resized to ").concat(r.width,"x").concat(r.height),t.src),this._originImage=t,r},_glUploadTexture:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.width,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.height,s=t.gl;return this.compressed?s.compressedTexImage2D(e,r,this.internalFormat,i,a,this.border,n):n&&void 0!==n.width?s.texImage2D(e,r,this.internalFormat,this.format,this.type,n):s.texImage2D(e,r,this.internalFormat,i,a,this.border,this.format,this.type,n),this},_uploadTexture:function(t){var e=this;return this.useMipmap&&this.mipmaps?this.mipmaps.forEach((function(n,r){e._glUploadTexture(t,e.target,n.data,r,n.width,n.height)})):this._glUploadTexture(t,this.target,this.image,0),this},_updatePixelStorei:function(){var t=this.state;t.pixelStorei(zt,this.premultiplyAlpha),t.pixelStorei(Wt,!!this.flipY),t.pixelStorei(Yt,this.colorSpaceConversion?qt:Zt)},updateTexture:function(t,e){var n=t.gl;if(this.needUpdate||this.autoUpdate){this._originImage&&this.image===this._canvasImage&&(this.image=this._originImage);var r=this.useMipmap,i=this.useRepeat;if(this.image&&!this.image.length){var a=i||r,s=this.getSupportSize(this.image,a);this.image=this.resizeImg(this.image,s.width,s.height),this.width=this.image.width,this.height=this.image.height}t.activeTexture(n.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._uploadTexture(t),r&&(this.compressed?this.mipmaps||(m.a.warn("Compressed texture has no mipmips, changed the minFilter from ".concat(this.minFilter," to Linear!"),this),this.minFilter=Bt):n.generateMipmap(this.target)),n.texParameterf(this.target,n.TEXTURE_MAG_FILTER,this.magFilter),n.texParameterf(this.target,n.TEXTURE_MIN_FILTER,this.minFilter),n.texParameterf(this.target,n.TEXTURE_WRAP_S,this.wrapS),n.texParameterf(this.target,n.TEXTURE_WRAP_T,this.wrapT);var o=tt.textureFilterAnisotropic;o&&this.anisotropic>1&&n.texParameterf(this.target,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropic,et.MAX_TEXTURE_MAX_ANISOTROPY)),this.needUpdate=!1}return this._needUpdateSubTexture&&(this._uploadSubTextures(t,e),this._needUpdateSubTexture=!1),this},_uploadSubTextures:function(t,e){var n=this;if(this._subTextureList&&this._subTextureList.length>0){var r=t.gl;t.activeTexture(r.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._subTextureList.forEach((function(t){var e=t[0],i=t[1],a=t[2];r.texSubImage2D(n.target,0,e,i,n.format,n.type,a)})),this._subTextureList.length=0}},_needUpdateSubTexture:!1,_subTextureList:null,updateSubTexture:function(t,e,n){this._subTextureList||(this._subTextureList=[]),this._subTextureList.push([t,e,n]),this._needUpdateSubTexture=!0},getGLTexture:function(t){this.state=t;var e=this.gl=t.gl,n=this.id;this.needDestroy&&(this.destroy(),this.needDestroy=!1);var r=Kt.get(n);return r||(r=e.createTexture(),Kt.add(n,r),this.needUpdate=!0),this.updateTexture(t,r),this.isImageCanRelease&&this._releaseImage(),r},setGLTexture:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&this.destroy(),Kt.add(this.id,t),this},destroy:function(){var t=this.id,e=Kt.get(t);return e&&this.gl&&(this.gl.deleteTexture(e),Kt.remove(t)),this},clone:function(){var t=Object.assign({},this);return delete t.id,new this.constructor(t)}}),Jt=P.a.TEXTURE_2D,$t=P.a.RGBA,te=P.a.UNSIGNED_BYTE,ee=P.a.COLOR_ATTACHMENT0,ne=P.a.DEPTH_STENCIL,re=P.a.DEPTH_TEST,ie=P.a.CULL_FACE,ae=P.a.TRIANGLE_STRIP,se=P.a.NEAREST,oe=P.a.CLAMP_TO_EDGE,ue=new J,ce=a.a.create({Statics:{cache:{get:function(){return ue}},reset:function(t){ue.each((function(t){t.reset()}))},destroy:function(t){ue.each((function(t){t.destroy()}))}},className:"Framebuffer",isFramebuffer:!0,bufferInternalFormat:ne,target:Jt,format:$t,internalFormat:$t,type:te,minFilter:se,magFilter:se,wrapS:oe,wrapT:oe,data:null,attachment:ee,needRenderbuffer:!0,useVao:!0,renderer:null,texture:null,renderbuffer:null,framebuffer:null,_isInit:!1,constructor:function(t,e){this.id=d.a.generateUUID(this.className),this.renderer=t,Object.assign(this,e),this.width||(this.width=t.width),this.height||(this.height=t.height),ue.add(this.id,this)},init:function(){if(!this._isInit&&this.renderer.isInit){this._isInit=!0;var t=this.renderer;this.gl=t.gl,this.state=t.state,this.reset()}},reset:function(){this.destroyResource();var t=this.gl;this.framebuffer=t.createFramebuffer(),this.bind(),this.needRenderbuffer&&(this.renderbuffer=this.createRenderbuffer()),this.texture=this.createTexture(),this.isComplete()||m.a.warn("Framebuffer is not complete => "+t.checkFramebufferStatus(t.FRAMEBUFFER)),this.unbind()},isComplete:function(){var t=this.gl;return!(!t||t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)},bind:function(){this.init(),this._isInit&&this.state.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer)},unbind:function(){if(this.init(),this._isInit){var t=this.state;t.bindFramebuffer(this.gl.FRAMEBUFFER,t.preFramebuffer)}},clear:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new v.a(0,0,0,0);if(this._isInit){var e=this.gl;e.clearColor(t.r,t.g,t.b,t.a),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4?arguments[4]:void 0;if(this._isInit){var a=this.gl,s=this.state;s.disable(re),s.disable(ie),i&&this.clear(i);var o=dt.getCustomShader(_t.a,gt.a,"","FramebufferTextureShader"),u=Lt.getProgram(o,s);u.useProgram();var c="".concat(t,"_").concat(e,"_").concat(n,"_").concat(r,"_").concat(u.id),h=Ft.getVao(a,c,{useVao:this.useVao,useInstanced:!1,mode:ae});if(h.isDirty){h.isDirty=!1;var f=[t=2*t-1,e=1-2*e,t+(n*=2),e,t,e-(r*=2),t+n,e-r];h.addAttribute(new C(new Float32Array(f),2),u.attributes.a_position),h.addAttribute(new C(new Float32Array([0,1,1,1,0,0,1,0]),2),u.attributes.a_texcoord0)}s.activeTexture(a.TEXTURE0),s.bindTexture(a.TEXTURE_2D,this.texture.getGLTexture(s)),h.draw()}},createRenderbuffer:function(){var t=this.gl,e=this.width,n=this.height,r=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),r},createTexture:function(){var t=this.state,e=t.gl,n=new Qt({minFilter:this.minFilter,magFilter:this.magFilter,internalFormat:this.internalFormat,format:this.format,type:this.type,width:this.width,height:this.height,image:this.data,wrapS:this.wrapS,wrapT:this.wrapT}),r=n.getGLTexture(t);return e.framebufferTexture2D(e.FRAMEBUFFER,this.attachment,this.target,r,0),n},resize:function(t,e,n){(n||this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this._isInit&&this.reset())},readPixels:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Object(i.getTypedArrayClass)(this.type),s=new a(n*r*4);if(this._isInit){var o=this.gl;e=this.height-e-r,this.bind(),o.readPixels(t,e,n,r,this.format,this.type,s),this.unbind()}return s},destroy:function(){return this._isDestroyed||(this.destroyResource(),this.gl=null,ue.removeObject(this),this._isDestroyed=!0),this},destroyResource:function(){var t=this.gl;t&&(this.framebuffer&&(t.deleteFramebuffer(this.framebuffer),this.framebuffer=null),this.renderbuffer&&(t.deleteRenderbuffer(this.renderbuffer),this.renderbuffer=null),this.texture&&(this.texture.destroy(),this.texture=null))}}),he=P.a.TEXTURE_CUBE_MAP,fe=P.a.RGB,le=P.a.LINEAR,de=P.a.CLAMP_TO_EDGE,me=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,_e=a.a.create({Extends:Qt,isCubeTexture:!0,className:"CubeTexture",target:he,internalFormat:fe,format:fe,magFilter:le,minFilter:le,wrapS:de,wrapT:de,constructor:function(t){_e.superclass.constructor.call(this,t),this.image=this.image||[]},_uploadTexture:function(t){var e=this,n=this.image;Array.isArray(n)&&6===n.length?(n[0]&&n[0].width&&(this.width=n[0].width,this.height=n[0].height),n.forEach((function(n,r){e._glUploadTexture(t,me+r,n,0)}))):m.a.error("CubeTexture image must be an Array of length 6",n)},right:{get:function(){return this.image[0]},set:function(t){this.image[0]=t}},left:{get:function(){return this.image[1]},set:function(t){this.image[1]=t}},top:{get:function(){return this.image[2]},set:function(t){this.image[2]=t}},bottom:{get:function(){return this.image[3]},set:function(t){this.image[3]=t}},front:{get:function(){return this.image[4]},set:function(t){this.image[4]=t}},back:{get:function(){return this.image[5]},set:function(t){this.image[5]=t}}}),pe=_e,ge=P.a.TEXTURE_2D,ve=P.a.RGBA,Ee=P.a.NEAREST,Te=P.a.CLAMP_TO_EDGE,Me=P.a.FLOAT,Ae=a.a.create({Extends:Qt,isDataTexture:!0,className:"DataTexture",target:ge,internalFormat:ve,format:ve,type:Me,magFilter:Ee,minFilter:Ee,wrapS:Te,wrapT:Te,dataLength:0,resetSize:function(t){if(t!==this.dataLength){this.dataLength=t;var e=d.a.nextPowerOfTwo(t/4),n=Math.max(Math.log2(e),4),r=Math.floor(n/2),a=n-r;this.width=Math.pow(2,r),this.height=Math.pow(2,a),this.DataClass=Object(i.getTypedArrayClass)(this.type)}},data:{get:function(){return this.image},set:function(t){if(this.image!==t){this.resetSize(t.length);var e=this.width*this.height*4;e===t.length&&t instanceof this.DataClass?this.image=t:(this.image&&this.image.length===e||(this.image=new this.DataClass(e)),this.image.set(t,0)),this.needUpdate=!0}}},constructor:function(t){Ae.superclass.constructor.call(this,t)}}),Le=Ae;function Ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Oe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},n=this.lightType;e["LIGHT_TYPE_".concat(n)]=1,e.SIDE=this.side,"NONE"!==n&&(e.HAS_LIGHT=1),this.premultiplyAlpha&&(e.PREMULTIPLY_ALPHA=1);var r=this._textureOption.reset(e);return e.HAS_LIGHT&&(e.HAS_NORMAL=1,r.add(this.normalMap,"NORMAL_MAP",(function(){1!==t.normalMapScale&&(e.NORMAL_MAP_SCALE=1)}))),r.add(this.parallaxMap,"PARALLAX_MAP"),r.add(this.emission,"EMISSION_MAP"),r.add(this.transparency,"TRANSPARENCY_MAP"),this.ignoreTranparent&&(e.IGNORE_TRANSPARENT=1),this.alphaCutoff>0&&(e.ALPHA_CUTOFF=1),this.useHDR&&(e.USE_HDR=1),this.gammaCorrection&&(e.GAMMA_CORRECTION=1),this.receiveShadows&&(e.RECEIVE_SHADOWS=1),this.castShadows&&(e.CAST_SHADOWS=1),this.uvMatrix&&(e.UV_MATRIX=1),this.uvMatrix1&&(e.UV_MATRIX1=1),this.usePhysicsLight&&(e.USE_PHYSICS_LIGHT=1),this.isDiffuesEnvAndAmbientLightWorkTogether&&(e.IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER=1),r.update(),e},_textureOption:{uvTypes:null,option:null,reset:function(t){return this.option=t,this.uvTypes={},this},add:function(t,e,n){if(t&&t.isTexture){var r=this.uvTypes,i=this.option,a=t.uv||0;r[a]=1,i[e]=a,t.isCubeTexture&&(i["".concat(e,"_CUBE")]=1),n&&n(t)}return this},update:function(){var t=[0,1],e=this.uvTypes,n=this.option;for(var r in e)-1!==t.indexOf(Number(r))?n["HAS_TEXCOORD".concat(r)]=1:(m.a.warnOnce("Material._textureOption.update(".concat(r,")"),"uv_".concat(r," not support!")),n.HAS_TEXCOORD0=1);return this}},getInstancedUniforms:function(){var t=this._instancedUniforms;if(!this._instancedUniforms){var e=this.uniforms;for(var n in t=this._instancedUniforms=[],e){var r=this.getUniformInfo(n);r.isDependMesh&&!r.notSupportInstanced&&t.push({name:n,info:r})}}return t},getUniformData:function(t,e,n){return this.getUniformInfo(t).get(e,this,n)},getAttributeData:function(t,e,n){return this.getAttributeInfo(t).get(e,this,n)},getUniformInfo:function(t){return this.getInfo("uniforms",t)},getAttributeInfo:function(t){return this.getInfo("attributes",t)},getInfo:function(t,e){var n=this[t][e];return"string"==typeof n&&(n=Ue[n]),n&&n.get||(m.a.warnOnce("material.getInfo-"+e,"Material.getInfo: no this semantic:"+e),n=Qe),n},clone:function(){var t=new this.constructor;for(var e in this)"id"!==e&&(t[e]=this[e]);return t},destroyTextures:function(){this.getTextures().forEach((function(t){t.destroy()}))},getTextures:function(){var t=[];for(var e in this){var n=this[e];n&&n.isTexture&&t.push(n)}return t},_copyProps:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}}),$e=a.a.create({Extends:Je,isBasicMaterial:!0,className:"BasicMaterial",lightType:"BLINN-PHONG",diffuse:null,ambient:null,specular:null,emission:null,specularEnvMap:null,specularEnvMatrix:null,reflectivity:0,refractRatio:0,refractivity:0,shininess:32,usedUniformVectors:11,constructor:function(t){this.diffuse=new v.a(.5,.5,.5),this.specular=new v.a(1,1,1),this.emission=new v.a(0,0,0),$e.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT",u_shininess:"SHININESS",u_reflectivity:"REFLECTIVITY",u_refractRatio:"REFRACTRATIO",u_refractivity:"REFRACTIVITY",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvMatrix:"SPECULARENVMATRIX"}),this.addTextureUniforms({u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$e.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t),n=this.lightType;"PHONG"!==n&&"BLINN-PHONG"!==n||(t.HAS_SPECULAR=1);var r=this.diffuse;return r&&r.isTexture&&(r.isCubeTexture?t.DIFFUSE_CUBE_MAP=1:e.add(this.diffuse,"DIFFUSE_MAP")),t.HAS_LIGHT&&(e.add(this.specular,"SPECULAR_MAP"),e.add(this.ambient,"AMBIENT_MAP"),e.add(this.specularEnvMap,"SPECULAR_ENV_MAP")),e.update(),t}}),tn=$e,en=P.a.POSITION,nn=P.a.NORMAL,rn=P.a.DEPTH,an=P.a.DISTANCE,sn=P.a.NONE,on=a.a.create({Extends:tn,isGeometryMaterial:!0,className:"GeometryMaterial",vertexType:en,lightType:sn,writeOriginData:!1,constructor:function(t){on.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_cameraFar:"CAMERAFAR",u_cameraNear:"CAMERANEAR",u_cameraType:"CAMERATYPE"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(on.superclass.getRenderOption.call(this,t),t["VERTEX_TYPE_".concat(this.vertexType)]=1,this.vertexType){case en:t.HAS_FRAG_POS=1;break;case nn:t.HAS_NORMAL=1;break;case rn:break;case an:t.HAS_FRAG_POS=1}return this.writeOriginData&&(t.WRITE_ORIGIN_DATA=1),t}}),un=on,cn=a.a.create({Extends:O,isOrthographicCamera:!0,className:"OrthographicCamera",_left:-1,left:{get:function(){return this._left},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._left=t}},_right:1,right:{get:function(){return this._right},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._right=t}},_bottom:-1,bottom:{get:function(){return this._bottom},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._bottom=t}},_top:1,top:{get:function(){return this._top},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._top=t}},_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:1,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},constructor:function(t){cn.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=[this.left,this.bottom,-this.near],r=[this.right,this.bottom,-this.near],i=[this.right,this.top,-this.near],a=[this.left,this.top,-this.near],s=[this.left,this.bottom,-this.far],o=[this.right,this.bottom,-this.far],u=[this.right,this.top,-this.far],c=[this.left,this.top,-this.far];e.addRect(s,o,u,c),e.addRect(o,r,i,u),e.addRect(r,n,a,i),e.addRect(n,s,c,a),e.addRect(c,u,i,a),e.addRect(n,r,o,s),this._geometry=e}return this._geometry}}),hn=cn,fn=P.a.DEPTH,ln=P.a.BACK,dn=null,mn=new v.a(1,1,1),_n=new o.a,pn=function(t){return t.material.castShadows},gn=a.a.create({isLightShadow:!0,className:"LightShadow",light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,cameraInfo:null,debug:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},createFramebuffer:function(){this.framebuffer||(this.framebuffer=new ce(this.renderer,{width:this.width,height:this.height}),this.debug&&this.showShadowMap())},updateLightCamera:function(t){this.light.isDirectionalLight?this.updateDirectionalLightCamera(t):this.light.isSpotLight&&this.updateSpotLightCamera(t)},updateDirectionalLightCamera:function(t){var e=this.light;if(this.camera.lookAt(e.direction),this.cameraInfo)this.updateCustumCamera(this.cameraInfo);else{var n=t.getGeometry();if(n){this.camera.updateViewMatrix(),_n.multiply(this.camera.viewMatrix,t.worldMatrix);var r=n.getBounds(_n);this.camera.near=-r.zMax,this.camera.far=-r.zMin,this.camera.left=r.xMin,this.camera.right=r.xMax,this.camera.bottom=r.yMin,this.camera.top=r.yMax}}this.camera.updateViewMatrix()},updateCustumCamera:function(t){for(var e in t)this.camera[e]=t[e]},updateSpotLightCamera:function(t){var e=this.light;this.camera.lookAt(e.direction),this.cameraInfo?this.updateCustumCamera(this.cameraInfo):(this.camera.fov=2*e.outerCutoff,this.camera.near=.01,this.camera.far=t.far,this.camera.aspect=1),this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.light.isDirectionalLight?this.camera=new hn:this.light.isSpotLight&&(this.camera=new Q),this.camera.addTo(this.light)),(this.light.isDirty||this._cameraMatrixVersion!==t.matrixVersion)&&(this.updateLightCamera(t),this._cameraMatrixVersion=t.matrixVersion,this.light.isDirty=!1)},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;dn||(dn=new un({vertexType:fn,side:ln,writeOriginData:!0})),n.bind(),e.state.viewport(0,0,this.width,this.height),e.clear(mn),r.updateViewProjectionMatrix(),Ue.setCamera(r),e.forceMaterial=dn,this.renderShadowScene(e),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){t.renderList.traverse((function(e){pn(e)&&t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e.filter((function(t){return pn(t)})))}))},showShadowMap:function(){var t=this;this.renderer.on("afterRender",(function(){t.framebuffer.render(0,.7,.3,.3)}))}}),vn=P.a.DISTANCE,En=P.a.BACK,Tn=P.a.TEXTURE_CUBE_MAP,Mn=P.a.TEXTURE0,An=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,Ln=P.a.NEAREST,In=P.a.FRAMEBUFFER,On=P.a.FRAMEBUFFER_COMPLETE,Sn=null,Rn=new v.a(0,0,0,0),yn=new c.a,Nn=[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,-1,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,0,-1,0]],xn=function(t,e){if(t.material.castShadows){if(!t.frustumTest)return!0;if(e.isMeshVisible(t))return!0}return!1},bn=a.a.create({isLightShadow:!0,className:"CubeLightShadow",Extends:gn,light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,debug:!1,constructor:function(t){bn.superclass.constructor.call(this,t)},createFramebuffer:function(){if(!this.framebuffer){this.framebuffer=new ce(this.renderer,{target:Tn,width:1024,height:1024,createTexture:function(){var t=this.state.gl,e=new pe({image:[null,null,null,null,null,null],type:this.type,format:this.format,internalFormat:this.internalFormat,magFilter:Ln,minFilter:Ln,width:1024,height:1024});return t.checkFramebufferStatus(In)!==On&&m.a.warn("Framebuffer is not complete",t.checkFramebufferStatus(In)),e},bindTexture:function(t){t=t||0;var e=this.state,n=e.gl,r=this.texture.getGLTexture(e);e.activeTexture(Mn+et.MAX_TEXTURE_INDEX),e.bindTexture(this.target,r),n.framebufferTexture2D(In,this.attachment,An+t,r,0)}})}},updateLightCamera:function(t){this.camera.fov=90,this.camera.near=t.near,this.camera.far=t.far,this.camera.aspect=1,this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.camera=new Q,this.updateLightCamera(t))},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;Sn||(Sn=new un({vertexType:vn,side:En,writeOriginData:!1})),n.bind(),e.state.viewport(0,0,n.width,n.height),this.light.worldMatrix.getTranslation(r.position);for(var i=0;i<6;i++)n.bindTexture(i),yn.fromArray(Nn[0],3*i).add(r.position),r.up.fromArray(Nn[1],3*i),r.lookAt(yn),r.updateViewProjectionMatrix(),e.clear(Rn),Ue.setCamera(r),e.forceMaterial=Sn,this.renderShadowScene(e);r.matrix.identity(),r.updateViewProjectionMatrix(),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){var e=t.renderList,n=this.camera;e.traverse((function(e){xn(e,n)&&t.renderMesh(e)}),(function(e){var r=e.filter((function(t){return xn(t,n)}));t.renderInstancedMeshes(r)}))}}),Cn=bn,Pn=a.a.create({Extends:M,isPointLight:!0,className:"PointLight",constructor:function(t){Pn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new Cn({light:this,renderer:t}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))}}),wn=Pn,Hn=new o.a,Dn=new c.a,Fn=a.a.create({Extends:M,isDirectionalLight:!0,className:"DirectionalLight",constructor:function(t){this.direction=new c.a(0,0,1),Fn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Dn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Dn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Hn);return Dn.copy(this.direction).transformDirection(e).normalize(),Dn}}),Un=Fn,Gn=new o.a,Bn=new c.a,Vn=a.a.create({Extends:M,isSpotLight:!0,className:"SpotLight",_cutoffCos:.9763,_cutoff:12.5,cutoff:{get:function(){return this._cutoff},set:function(t){this._cutoff=t,this._cutoffCos=Math.cos(d.a.degToRad(t))}},_outerCutoffCos:.9537,_outerCutoff:17.5,outerCutoff:{get:function(){return this._outerCutoff},set:function(t){this._outerCutoff=t,this._outerCutoffCos=Math.cos(d.a.degToRad(t))}},constructor:function(t){this.direction=new c.a(0,0,1),Vn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Bn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Bn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Gn);return Bn.copy(this.direction).transformDirection(e).normalize(),Bn}}),Xn=Vn,jn=a.a.create({Extends:Je,isShaderMaterial:!0,className:"ShaderMaterial",vs:"",fs:"",useHeaderCache:!1,constructor:function(t){jn.superclass.constructor.call(this,t)},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(jn.superclass.getRenderOption.call(this,t),this.getCustomRenderOption){var e=this.getCustomRenderOption({});for(var n in e)t["HILO_CUSTUM_OPTION_".concat(n)]=e[n]}return t},getCustomRenderOption:null}),kn=jn,zn=n(15),Wn=n.n(zn),Yn=a.a.create({Extends:Z,isMorphGeometry:!0,className:"MorphGeometry",isStatic:!1,weights:[],targets:null,constructor:function(t){Yn.superclass.constructor.call(this,t),this.weights=this.weights||[]},update:function(t,e){this.weights=t,this._originalMorphIndices=e},clone:function(){return Z.prototype.clone.call(this,{targets:this.targets,weights:this.weights})},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn.superclass.getRenderOption.call(this,e),this.targets&&(this._maxMorphTargetCount||(this._maxMorphTargetCount=Math.floor(8/Object.keys(this.targets).length)),Object(i.each)(this.targets,(function(n,r){e.MORPH_TARGET_COUNT=Math.min(n.length,t._maxMorphTargetCount),"vertices"===r?e.MORPH_HAS_POSITION=1:"normals"===r?e.MORPH_HAS_NORMAL=1:"tangents"===r&&(e.MORPH_HAS_TANGENT=1)}))),e}}),qn=Yn,Zn={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},Kn={Geometry:Z,GeometryData:C};var Qn={_decodeTotalTime:0,wasmURL:"",workerURL:"",useWASM:!0,useWebWorker:!0,useAuto:!0,init:function(){return Qn.useAuto?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Qn.useWebWorker?Wn.a.initWorker(Qn.workerURL):Qn.useWASM?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Promise.resolve()},parse:function(t,e,n,r){var i=Date.now(),a=e.bufferViews[t.bufferView],s=Qn.wasmURL,o=Qn.workerURL,u=Qn.useAuto,c=Qn.useWASM,h=Qn.useWebWorker,f=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);function l(e){Qn._decodeTotalTime+=Date.now()-i;var n=e.toHilo3dGeometry(Kn,r.primitive._geometry);return t.targets&&(n=function(t,e,n){if(!n.isMorphGeometry){var r=new qn;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&"id"!==i&&(r[i]=n[i]);r.targets={},n=r}for(var a=n.targets,s=0;s0&&void 0!==arguments[0]?arguments[0]:{};return t["FOG_".concat(this.mode)]=1,t}}),hr=n(16),fr=new hr.a,lr=new o.a,dr=a.a.create({Extends:g,isMesh:!0,className:"Mesh",geometry:null,material:null,useInstanced:!1,frustumTest:!0,constructor:function(t){dr.superclass.constructor.call(this,t)},clone:function(t){var e=g.prototype.clone.call(this,t);return Object.assign(e,{geometry:this.geometry,material:this.material}),e},raycast:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.visible)return null;var n=this.geometry,r=this.material,i=this.worldMatrix;if(n&&r){lr.invert(i),fr.copy(t),fr.transformMat4(lr);var a=n.raycast(fr,r.side,e);if(a)return a.forEach((function(t){t.transformMat4(i)})),a}return null},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.geometry.getRenderOption(t),t},isDestroyed:{get:function(){return this._isDestroyed}},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._isDestroyed)return this;this.removeFromParent();var n=t.resourceManager;return n.destroyMesh(this),this.material&&e&&this.material.destroyTextures(),this.off(),this.geometry=null,this.material=null,this._isDestroyed=!0,this}}),mr=dr,_r=new o.a,pr=new o.a,gr=a.a.create({Extends:mr,isSkinedMesh:!0,className:"SkinedMesh",useInstanced:!1,jointMatTexture:null,frustumTest:!1,skeleton:null,constructor:function(t){gr.superclass.constructor.call(this,t)},getJointMat:function(){var t=this;if(this.skeleton&&!(this.skeleton.jointCount<=0)){var e=this.skeleton.jointNodeList,n=this.skeleton.inverseBindMatrices,r=16*this.skeleton.jointCount;return this.jointMat&&this.jointMat.length===r||(this.jointMat=new Float32Array(r)),this.clonedFrom?pr.invert(this.clonedFrom.worldMatrix):pr.invert(this.worldMatrix),e.forEach((function(e,r){_r.copy(pr),_r.multiply(e.worldMatrix),_r.multiply(n[r]),_r.toArray(t.jointMat,16*r)})),this.jointMat}},resetJointNamesByNodeName:function(t){this.skeleton.resetJointNamesByNodeName(t)},resetSkinIndices:function(t){var e=this.skeleton;if(e){var n=this.geometry,r=n.skinIndices;if(r){this.material.isDirty=!0,n.isDirty=!0,r.isDirty=!0;var i=new R.a;r.traverse((function(n,a,s){n.elements.forEach((function(n,r){var a=e.jointNames[n],s=t.jointNames.indexOf(a);s>=0?i.elements[r]=s:m.a.warnOnce("SkinedMesh.resetSkinIndices","SkinedMesh.resetSkinIndices: no jointName found!",a)})),r.setByOffset(s,i)}))}}},initJointMatTexture:function(){if(!this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture=new Le({data:t})}return this.jointMatTexture},updateJointMatTexture:function(){if(this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture.data.set(t,0),this.jointMatTexture.needUpdate=!0}else this.initJointMatTexture()},clone:function(t){var e=mr.prototype.clone.call(this,t);return Object.assign(e,{useInstanced:this.useInstanced,skeleton:this.skeleton.clone()}),e.clonedFrom=this,e},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};gr.superclass.getRenderOption.call(this,t);var e=this.skeleton.jointCount;if(e&&(t.JOINT_COUNT=e,et.VERTEX_TEXTURE_FLOAT)){var n=(et.MAX_VERTEX_UNIFORM_VECTORS-22)/4;e>n&&(t.JOINT_MAT_MAP=1)}return t}}),vr=gr,Er=a.a.create({isSkeleton:!0,className:"Skeleton",userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.jointNodeList=[],this.jointNames=[],this.inverseBindMatrices=[],Object.assign(this,t)},jointCount:{get:function(){return this.jointNodeList.length}},_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,t&&this._initJointNodeList()}},_initJointNodeList:function(){var t={};this.rootNode.traverse((function(e){t[e.jointName]=e})),this.jointNodeList=this.jointNames.map((function(e){return t[e]}))},resetJointNamesByNodeName:function(t){var e=this.jointNames;this.jointNodeList.forEach((function(n,r){var i=t.rootNode.getChildByName(n.name);i&&(e[r]=i.jointName)}))},clone:function(t){var e=new Er;return e.copy(this,t),e},copy:function(t,e){return this.inverseBindMatrices=t.inverseBindMatrices,this.jointNames=t.jointNames.slice(),void 0===e&&(e=t.rootNode),this.rootNode=e,this}}),Tr=Er,Mr="1.16.0",Ar=a.a.create({className:"RenderInfo",isRenderInfo:!0,constructor:function(){this.reset()},addFaceCount:function(t){this._currentFaceCount+=t},addDrawCount:function(t){this._currentDrawCount+=t},reset:function(){this.faceCount=Math.floor(this._currentFaceCount),this.drawCount=Math.floor(this._currentDrawCount),this._currentFaceCount=0,this._currentDrawCount=0}}),Lr=new c.a,Ir=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;if(n!==r)return n-r;var i=t.material._shaderNumId||0,a=e.material._shaderNumId||0;return i!==a?i-a:t._sortRenderZ-e._sortRenderZ},Or=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;return n!==r?n-r:e._sortRenderZ-t._sortRenderZ},Sr=a.a.create({className:"RenderList",isRenderList:!0,useInstanced:!1,constructor:function(){this.opaqueList=[],this.transparentList=[],this.instancedDict={}},reset:function(){this.opaqueList.length=0,this.transparentList.length=0,this.instancedDict={}},traverse:function(t,e){this.opaqueList.forEach((function(e){t(e)}));var n=this.instancedDict;for(var r in n){var i=n[r];i.length>2&&e?e(i):i.forEach((function(e){t(e)}))}this.transparentList.forEach((function(e){t(e)}))},sort:function(){this.transparentList.sort(Or),this.opaqueList.sort(Ir)},addMesh:function(t,e){var n=t.material,r=t.geometry;if(n&&r){if(t.frustumTest&&!e.isMeshVisible(t))return;if(this.useInstanced&&t.useInstanced){var i=this.instancedDict,a=n.id+"_"+r.id,s=i[a];i[a]||(s=i[a]=[]),s.push(t)}else t.worldMatrix.getTranslation(Lr),Lr.transformMat4(e.viewProjectionMatrix),t._sortRenderZ=Lr.z,n.transparent?this.transparentList.push(t):this.opaqueList.push(t)}else m.a.warnOnce("RenderList.addMesh(".concat(t.id,")"),"Mesh must have material and geometry",t)}}),Rr=a.a.create({className:"WebGLState",isWebGLState:!0,systemFramebuffer:null,constructor:function(t){this.gl=t,this.reset()},reset:function(){this._dict={},this.activeTextureIndex=null,this.textureUnitDict={},this.currentFramebuffer=null,this.preFramebuffer=null,this._pixelStorei={}},enable:function(t){!0!==this._dict[t]&&(this._dict[t]=!0,this.gl.enable(t))},disable:function(t){!1!==this._dict[t]&&(this._dict[t]=!1,this.gl.disable(t))},bindFramebuffer:function(t,e){this.currentFramebuffer!==e&&(this.preFramebuffer=this.currentFramebuffer,this.currentFramebuffer=e,this.gl.bindFramebuffer(t,e))},bindSystemFramebuffer:function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,this.systemFramebuffer)},useProgram:function(t){this.set1("useProgram",t)},depthFunc:function(t){this.set1("depthFunc",t)},depthMask:function(t){this.set1("depthMask",t)},clear:function(t){this.gl.clear(t)},depthRange:function(t,e){this.set2("depthRange",t,e)},stencilFunc:function(t,e,n){this.set3("stencilFunc",t,e,n)},stencilMask:function(t){this.set1("stencilMask",t)},stencilOp:function(t,e,n){this.set3("stencilOp",t,e,n)},colorMask:function(t,e,n,r){this.set4("colorMask",t,e,n,r)},cullFace:function(t){this.set1("cullFace",t)},frontFace:function(t){this.set1("frontFace",t)},blendFuncSeparate:function(t,e,n,r){this.set4("blendFuncSeparate",t,e,n,r)},blendEquationSeparate:function(t,e){this.set2("blendEquationSeparate",t,e)},pixelStorei:function(t,e){this._pixelStorei[t]!==e&&(this._pixelStorei[t]=e,this.gl.pixelStorei(t,e))},viewport:function(t,e,n,r){this.set4("viewport",t,e,n,r)},activeTexture:function(t){this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},bindTexture:function(t,e){var n=this.getActiveTextureUnit();n[t]!==e&&(n[t]=e,this.gl.bindTexture(t,e))},getActiveTextureUnit:function(){var t=this.textureUnitDict[this.activeTextureIndex];return t||(t=this.textureUnitDict[this.activeTextureIndex]={}),t},set1:function(t,e){this._dict[t]!==e&&(this._dict[t]=e,this.gl[t](e))},set2:function(t,e,n){var r=this._dict[t];r||(r=this._dict[t]=[]),r[0]===e&&r[1]===n||(r[0]=e,r[1]=n,this.gl[t](e,n))},set3:function(t,e,n,r){var i=this._dict[t];i||(i=this._dict[t]=[]),i[0]===e&&i[1]===n&&i[2]===r||(i[0]=e,i[1]=n,i[2]=r,this.gl[t](e,n,r))},set4:function(t,e,n,r,i){var a=this._dict[t];a||(a=this._dict[t]=[]),a[0]===e&&a[1]===n&&a[2]===r&&a[3]===i||(a[0]=e,a[1]=n,a[2]=r,a[3]=i,this.gl[t](e,n,r,i))},get:function(t){return this._dict[t]}}),yr=a.a.create({Mixes:s.a,className:"WebGLResourceManager",isWebGLResourceManager:!0,hasNeedDestroyResource:!1,constructor:function(t){this._needDestroyResources=[],Object.assign(this,t)},destroyMesh:function(t){var e=this;this.getMeshResources(t).forEach((function(t){e.destroyIfNoRef(t)})),t._vao=t._program=t._shader=null},getMeshResources:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t._shader&&e.push(t._shader),t._vao&&(e.push(t._vao),t._vao.getResources(e)),t._program&&e.push(t._program),e},destroyIfNoRef:function(t){var e=this._needDestroyResources;return t&&e.indexOf(t)<0&&e.push(t),this},getUsedResources:function(t){var e=this,n=[];return t&&t.traverse((function(t){t.isMesh&&!t.isDestroyed&&e.getMeshResources(t,n)})),n},destroyUnsuedResource:function(t){var e=this,n=this._needDestroyResources;if(0===n.length)return this;var r=this.getUsedResources(t);return n.forEach((function(t){r.indexOf(t)<0&&t&&t.destroy&&!t.alwaysUse&&(e.fire("destroyResource",t.id),t.destroy())})),this.reset(),this},reset:function(){return this._needDestroyResources.length=0,this}}),Nr=new o.a,xr=new c.a,br=new Float32Array([0,0,0]),Cr=a.a.create({isLightManager:!0,className:"LightManager",constructor:function(t){this.ambientLights=[],this.directionalLights=[],this.pointLights=[],this.spotLights=[],this.areaLights=[],this.lightInfo={AMBIENT_LIGHTS:0,POINT_LIGHTS:0,DIRECTIONAL_LIGHTS:0,SPOT_LIGHTS:0,AREA_LIGHTS:0,uid:0},Object.assign(this,t)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.each)(this.lightInfo,(function(n,r){if("uid"!==r&&n){e[r]=n;var i=t.getShadowMapCount(r);i&&(e[r+"_SMC"]=i)}})),e},addLight:function(t){var e=null;return t.enabled?(t.isAmbientLight?e=this.ambientLights:t.isDirectionalLight?e=this.directionalLights:t.isPointLight?e=this.pointLights:t.isSpotLight?e=this.spotLights:t.isAreaLight?e=this.areaLights:m.a.warnOnce("LightManager.addLight(".concat(t.id,")"),"Not support this light:",t),e&&(t.shadow?e.unshift(t):e.push(t)),this):this},getDirectionalInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[];this.directionalLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(e,c),o.getViewDirection(t).toArray(n,c),o.shadow&&o.lightShadow&&(r.push(o.lightShadow.framebuffer.texture),i.push(o.lightShadow.width),i.push(o.lightShadow.height),s.push(o.lightShadow.minBias,o.lightShadow.maxBias),Nr.copy(t.worldMatrix),Nr.premultiply(o.lightShadow.camera.viewProjectionMatrix),Nr.toArray(a,16*u))}));var o={colors:new Float32Array(e),infos:new Float32Array(n)};return r.length&&(o.shadowMap=r,o.shadowMapSize=new Float32Array(i),o.shadowBias=new Float32Array(s),o.lightSpaceMatrix=new Float32Array(a)),o},getSpotInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[],c=[],h=[];this.spotLights.forEach((function(f,l){var d=3*l;f.getRealColor().toRGBArray(e,d),f.toInfoArray(n,d),f.getViewDirection(t).toArray(i,d),h.push(f.range),a.push(f._cutoffCos,f._outerCutoffCos),t.getModelViewMatrix(f,Nr),Nr.getTranslation(xr),xr.toArray(r,d),f.shadow&&f.lightShadow&&(s.push(f.lightShadow.framebuffer.texture),o.push(f.lightShadow.width),o.push(f.lightShadow.height),c.push(f.lightShadow.minBias,f.lightShadow.maxBias),Nr.multiply(f.lightShadow.camera.viewProjectionMatrix,t.worldMatrix),Nr.toArray(u,16*l))}));var f={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),dirs:new Float32Array(i),cutoffs:new Float32Array(a),ranges:new Float32Array(h)};return s.length&&(f.shadowMap=s,f.shadowMapSize=new Float32Array(o),f.shadowBias=new Float32Array(c),f.lightSpaceMatrix=new Float32Array(u)),f},getPointInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[];this.pointLights.forEach((function(c,h){var f=3*h;c.getRealColor().toRGBArray(e,f),c.toInfoArray(n,f),u.push(c.range),t.getModelViewMatrix(c,Nr),Nr.getTranslation(xr),xr.toArray(r,f),c.shadow&&c.lightShadow&&(i.push(c.lightShadow.framebuffer.texture),s.push(c.lightShadow.minBias,c.lightShadow.maxBias),t.worldMatrix.toArray(a,16*h),o[2*h]=c.lightShadow.camera.near,o[2*h+1]=c.lightShadow.camera.far)}));var c={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),ranges:new Float32Array(u)};return i.length&&(c.shadowMap=i,c.shadowBias=new Float32Array(s),c.lightSpaceMatrix=new Float32Array(a),c.cameras=new Float32Array(o)),c},getAreaInfo:function(t){var e,n,r=[],i=[],a=[],s=[];return this.areaLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(r,c),t.getModelViewMatrix(o,Nr),Nr.getTranslation(xr),xr.toArray(i,c);var h=Nr.getRotation();Nr.fromQuat(h),xr.set(.5*o.width,0,0),xr.transformMat4(Nr),xr.toArray(a,c),xr.set(0,.5*o.height,0),xr.transformMat4(Nr),xr.toArray(s,c),e=o.ltcTexture1,n=o.ltcTexture2})),{colors:new Float32Array(r),poses:new Float32Array(i),width:new Float32Array(a),height:new Float32Array(s),ltcTexture1:e,ltcTexture2:n}},getAmbientInfo:function(){return br[0]=br[1]=br[2]=0,this.ambientLights.forEach((function(t){var e=t.getRealColor();br[0]+=e.r,br[1]+=e.g,br[2]+=e.b})),br[0]=Math.min(1,br[0]),br[1]=Math.min(1,br[1]),br[2]=Math.min(1,br[2]),br},updateInfo:function(t){var e=this.lightInfo,n=this.ambientLights,r=this.directionalLights,i=this.pointLights,a=this.spotLights,s=this.areaLights;e.AMBIENT_LIGHTS=n.length,e.POINT_LIGHTS=i.length,e.DIRECTIONAL_LIGHTS=r.length,e.SPOT_LIGHTS=a.length,e.AREA_LIGHTS=s.length;var o=function(t){return!!t.shadow};e.SHADOW_POINT_LIGHTS=i.filter(o).length,e.SHADOW_SPOT_LIGHTS=a.filter(o).length,e.SHADOW_DIRECTIONAL_LIGHTS=r.filter(o).length,e.uid=[e.AMBIENT_LIGHTS,e.POINT_LIGHTS,e.SHADOW_POINT_LIGHTS,e.DIRECTIONAL_LIGHTS,e.SHADOW_DIRECTIONAL_LIGHTS,e.SPOT_LIGHTS,e.SHADOW_SPOT_LIGHTS,e.AREA_LIGHTS].join("_"),this.directionalInfo=this.getDirectionalInfo(t),this.pointInfo=this.getPointInfo(t),this.spotInfo=this.getSpotInfo(t),this.areaInfo=this.getAreaInfo(t),this.ambientInfo=this.getAmbientInfo()},getInfo:function(){return this.lightInfo},reset:function(){this.ambientLights.length=0,this.directionalLights.length=0,this.pointLights.length=0,this.spotLights.length=0,this.areaLights.length=0},getShadowMapCount:function(t){var e=[];"POINT_LIGHTS"===t?e=this.pointLights:"DIRECTIONAL_LIGHTS"===t?e=this.directionalLights:("SPOT_LIGHTS"===t||"AREA_LIGHTS"===t)&&(e=this.spotLights);var n=0;return e.forEach((function(t){n+=t.shadow?1:0})),n},createShadowMap:function(t,e){this.directionalLights.forEach((function(n){n.createShadowMap(t,e)})),this.spotLights.forEach((function(n){n.createShadowMap(t,e)})),this.pointLights.forEach((function(n){n.createShadowMap(t,e)})),this.areaLights.forEach((function(n){n.createShadowMap(t,e)}))}}),Pr=P.a.DEPTH_TEST,wr=P.a.STENCIL_TEST,Hr=P.a.SAMPLE_ALPHA_TO_COVERAGE,Dr=P.a.CULL_FACE,Fr=P.a.FRONT_AND_BACK,Ur=P.a.BLEND,Gr=P.a.LINES,Br=P.a.STATIC_DRAW,Vr=P.a.DYNAMIC_DRAW,Xr=a.a.create({Mixes:s.a,className:"WebGLRenderer",isWebGLRenderer:!0,gl:null,width:0,height:0,pixelRatio:1,domElement:null,useInstanced:!1,useVao:!0,alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,gameMode:!1,useFramebuffer:!1,framebufferOption:{},useLogDepth:!1,vertexPrecision:"highp",fragmentPrecision:"highp",fog:null,offsetX:0,offsetY:0,isInitFailed:!1,_isInit:!1,_isContextLost:!1,constructor:function(t){this.clearColor=new v.a(1,1,1),Object.assign(this,t),this.renderInfo=new Ar,this.renderList=new Sr,this.lightManager=new Cr,this.resourceManager=new yr},resize:function(t,e,n){if(n||this.width!==t||this.height!==e){var r=this.domElement;this.width=t,this.height=e,r.width=t,r.height=e,this.framebuffer&&this.framebuffer.resize(this.width,this.height,n),this.viewport()}},setOffset:function(t,e){this.offsetX===t&&this.offsetY===e||(this.offsetX=t,this.offsetY=e,this.viewport())},viewport:function(t,e,n,r){var i=this.state,a=this.gl;i&&(void 0===t?t=this.offsetX:this.offsetX=t,void 0===e?e=this.offsetY:this.offsetY=e,void 0===n&&(n=a.drawingBufferWidth),void 0===r&&(r=a.drawingBufferHeight),i.viewport(t,e,n,r))},isInit:{get:function(){return this._isInit&&!this.isInitFailed}},onInit:function(t){var e=this;this._isInit?t(this):this.on("init",(function(){t(e)}),!0)},initContext:function(){if(!this._isInit){this._isInit=!0;try{this._initContext(),this.fire("init")}catch(t){this.isInitFailed=!0,this.fire("initFailed",t)}}},_initContext:function(){var t=this,e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat};!0===this.preserveDrawingBuffer&&(e.preserveDrawingBuffer=!0),!0===this.gameMode&&(e.gameMode=!0);var n=this.gl=this.domElement.getContext("webgl",e);n.viewport(0,0,this.width,this.height),Tt.init(n),tt.init(n),et.init(n),dt.init(this),this.state=new Rr(n),tt.instanced||(this.useInstanced=!1),this.renderList.useInstanced=this.useInstanced,tt.vao||(this.useVao=!1),this.useFramebuffer&&(this.framebuffer=new ce(this,Object.assign({useVao:this.useVao,width:this.width,height:this.height},this.framebufferOption))),this.domElement.addEventListener("webglcontextlost",(function(e){t._onContextLost(e)}),!1),this.domElement.addEventListener("webglcontextrestored",(function(e){t._onContextRestore(e)}),!1)},_onContextLost:function(t){var e=this.gl;this._isContextLost=!0,t.preventDefault(),Lt.reset(e),dt.reset(e),Qt.reset(e),Nt.reset(e),Ft.reset(e),this.state.reset(e),this._lastMaterial=null,this._lastProgram=null,this.fire("webglContextLost")},_onContextRestore:function(t){var e=this.gl;this._isContextLost=!1,tt.reset(e),ce.reset(e),this.fire("webglContextRestored")},setupDepthTest:function(t){var e=this.state;t.depthTest?(e.enable(Pr),e.depthFunc(t.depthFunc),e.depthMask(t.depthMask),e.depthRange(t.depthRange[0],t.depthRange[1])):e.disable(Pr)},setupSampleAlphaToCoverage:function(t){var e=this.state;t.sampleAlphaToCoverage?e.enable(Hr):e.disable(Hr)},setupCullFace:function(t){var e=this.state;t.cullFace&&t.cullFaceType!==Fr?(e.enable(Dr),e.cullFace(t.cullFaceType),e.frontFace(t.frontFace)):e.disable(Dr)},setupBlend:function(t){var e=this.state;t.blend?(e.enable(Ur),e.blendFuncSeparate(t.blendSrc,t.blendDst,t.blendSrcAlpha,t.blendDstAlpha),e.blendEquationSeparate(t.blendEquation,t.blendEquationAlpha)):e.disable(Ur)},setupStencil:function(t){if(this.stencil){var e=this.state;t.stencilTest?(e.enable(wr),e.stencilMask(t.stencilMask),e.stencilFunc(t.stencilFunc,t.stencilFuncRef,t.stencilFuncMask),e.stencilOp(t.stencilOpFail,t.stencilOpZFail,t.stencilOpZPass)):e.disable(wr)}},setupUniforms:function(t,e,n,r){var i=this.forceMaterial||e.material;for(var a in t.uniforms){var s=i.getUniformInfo(a),o=t.uniforms[a];if(!s.isBlankInfo&&(r||s.isDependMesh&&!n)){var u=s.get(e,i,o);null!=u&&(t[a]=u)}}},setupVao:function(t,e,n){var r=n.geometry,i=r.isStatic;if(t.isDirty||!i||r.isDirty){t.isDirty=!1;var a=this.forceMaterial||n.material,s=a.attributes,o=i?Br:Vr;for(var u in s){var c=e.attributes[u];if(c){var h=a.getAttributeData(u,n,c);null!=h&&t.addAttribute(h,c,o)}}r.indices&&t.addIndexBuffer(r.indices,o),r.isDirty=!1}r.vertexCount&&(t.vertexCount=r.vertexCount)},setupMaterial:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=this.forceMaterial||e.material;(i.isDirty||this._lastMaterial!==i)&&(this.setupDepthTest(i),this.setupSampleAlphaToCoverage(i),this.setupCullFace(i),this.setupBlend(i),this.setupStencil(i),r=!0),this.setupUniforms(t,e,n,r),i.isDirty=!1,this._lastMaterial=i},setupMesh:function(t,e){var n=this.gl,r=this.state,i=this.lightManager,a=t.geometry,s=this.forceMaterial||t.material,o=dt.getShader(t,s,e,i,this.fog,this.useLogDepth),u=Lt.getProgram(o,r);u.useProgram(),this.setupMaterial(u,t,e,this._lastProgram!==u),this._lastProgram=u,t.material.wireframe&&a.mode!==Gr&&a.convertToLinesMode();var c=a.id+u.id,h=Ft.getVao(n,c,{useInstanced:e,useVao:this.useVao,mode:a.mode});return this.setupVao(h,u,t),t._vao=h,t._shader=o,t._program=u,{vao:h,program:u,geometry:a}},addRenderInfo:function(t,e){var n=this.renderInfo;n.addFaceCount(t),n.addDrawCount(e)},render:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.initContext(),!this.isInitFailed&&!this._isContextLost){var r=this.renderList,i=this.renderInfo,a=this.lightManager,s=this.resourceManager,o=this.state;this.fog=t.fog,a.reset(),i.reset(),r.reset(),Ue.init(this,o,e,a,this.fog),t.updateMatrixWorld(),e.updateViewProjectionMatrix(),t.traverse((function(t){return t.visible?(t.isMesh?r.addMesh(t,e):t.isLight&&a.addLight(t),g.TRAVERSE_STOP_NONE):g.TRAVERSE_STOP_CHILDREN})),r.sort(),a.createShadowMap(this,e),a.updateInfo(e),n&&this.fire("beforeRender"),this.useFramebuffer&&this.framebuffer.bind(),this.clear(),n&&this.fire("beforeRenderScene"),this.renderScene(),this.useFramebuffer&&this.renderToScreen(this.framebuffer),n&&this.fire("afterRender"),s.destroyUnsuedResource(t)}},renderScene:function(){var t=this;this.renderList.traverse((function(e){t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e)})),this._gameModeSumbit()},_gameModeSumbit:function(){var t=this.gl;this.gameMode&&t&&t.submit&&t.submit()},clear:function(t){var e=this.gl,n=this.state;t=t||this.clearColor,this._lastMaterial=null,this._lastProgram=null,e.clearColor(t.r,t.g,t.b,t.a),n.depthMask(!0);var r=e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT;this.stencil&&(n.stencilMask(!0),r|=e.STENCIL_BUFFER_BIT),e.clear(r)},clearDepth:function(){var t=this.gl;this.state.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},clearStencil:function(){var t=this.gl;this.state.stencilMask(!0),t.clear(t.STENCIL_BUFFER_BIT)},renderToScreen:function(t){this.state.bindSystemFramebuffer(),t.render(0,0,1,1,this.clearColor)},renderMesh:function(t){var e=this.setupMesh(t,!1).vao;e.draw(),this.addRenderInfo(e.vertexCount/3,1)},renderInstancedMeshes:function(t){var e=t[0];if(e){var n=this.forceMaterial||e.material,r=this.setupMesh(e,!0),i=r.vao,a=r.program;n.getInstancedUniforms().forEach((function(e){var n=e.name,r=e.info,s=a.attributes[n];s&&i.addInstancedAttribute(s,t,(function(t){return r.get(t)}))})),i.drawInstance(t.length),this.addRenderInfo(i.vertexCount/3*t.length,1)}},renderMultipleMeshes:function(t){var e=this;t.forEach((function(t){e.renderMesh(t)}))},releaseGLResource:function(){var t=this.gl;t&&(Lt.reset(t),dt.reset(t),Nt.reset(t),Ft.reset(t),this.state.reset(t),Qt.reset(t),ce.destroy(t))}}),jr=function(){var t,e=navigator.userAgent,n=document,r=window,i=n.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in r,supportCanvas:!!n.createElement("canvas").getContext,supportStorage:void 0,supportOrientation:"orientation"in r||"orientation"in r.screen,supportDeviceMotion:"ondevicemotion"in r};try{localStorage.setItem("hilo","hilo"),localStorage.removeItem("hilo"),a.supportStorage=!0}catch(t){a.supportStorage=!1,m.a.warn("LocalStorage disabled")}t=a.webkit||a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",a.jsVendor=t;var s=a.cssVendor="-"+t+"-",o=n.createElement("div"),u=o.style,c=void 0!==u[t+"Transform"],h=void 0!==u[t+"Perspective"];h&&(o.id="test3d",(u=n.createElement("style")).textContent="@media ("+s+"transform-3d){#test3d{height:3px}}",n.head.appendChild(u),i.appendChild(o),h=3===o.offsetHeight,n.head.removeChild(u),i.removeChild(o)),a.supportTransform=c,a.supportTransform3D=h;var f=a.supportTouch,l=f?"touchstart":"mousedown",d=f?"touchmove":"mousemove",_=f?"touchend":"mouseup";return a.POINTER_START=l,a.POINTER_MOVE=d,a.POINTER_END=_,a}(),kr=a.a.create({Extends:g,isStage:!0,className:"Stage",renderer:null,camera:null,pixelRatio:null,offsetX:0,offsetY:0,width:0,height:0,canvas:null,constructor:function(t){if(t.width||(t.width=window.innerWidth),t.height||(t.height=window.innerHeight),!t.pixelRatio){var e=window.devicePixelRatio||1;e=Math.min(e,1024/Math.max(t.width,t.height),2),e=Math.max(e,1),t.pixelRatio=e}kr.superclass.constructor.call(this,t),this.initRenderer(t),m.a.log("Hilo3d version: ".concat(Mr))},initRenderer:function(t){var e=this.canvas=this.createCanvas(t);this.renderer=new Xr(Object.assign(t,{domElement:e})),this.resize(this.width,this.height,this.pixelRatio,!0)},createCanvas:function(t){var e;return e=t.canvas?t.canvas:document.createElement("canvas"),t.container&&t.container.appendChild(e),e},resize:function(t,e,n,r){if(void 0===n&&(n=this.pixelRatio),r||this.width!==t||this.height!==e||this.pixelRatio!==n){this.width=t,this.height=e,this.pixelRatio=n,this.rendererWidth=t*n,this.rendererHeight=e*n;var i=this.canvas;this.renderer.resize(this.rendererWidth,this.rendererHeight,r),i.style.width=this.width+"px",i.style.height=this.height+"px",this.updateDomViewport()}return this},setOffset:function(t,e){if(this.offsetX!==t||this.offsetY!==e){this.offsetX=t,this.offsetY=e;var n=this.pixelRatio;this.renderer.setOffset(t*n,e*n)}return this},viewport:function(t,e,n,r){return this.resize(n,r,this.pixelRatio,!0),this.setOffset(t,e),this},tick:function(t){return this.traverseUpdate(t),this.camera&&this.renderer.render(this,this.camera,!0),this},enableDOMEvent:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.canvas,i=this._domListener||(this._domListener=function(t){e._onDOMEvent(t)});return(t="string"==typeof t?[t]:t).forEach((function(t){n?r.addEventListener(t,i,!1):r.removeEventListener(t,i)})),this},_onDOMEvent:function(t){var e=this.canvas,n=this._eventTarget,r=t.type,i=0===r.indexOf("touch"),a=t;if(i){var s=t.touches,o=t.changedTouches;s&&s.length?a=s[0]:o&&o.length&&(a=o[0])}var u=this.domViewport||this.updateDomViewport(),c=(a.pageX||a.clientX)-u.left,h=(a.pageY||a.clientY)-u.top;t.stageX=c,t.stageY=h,t.stopPropagation=function(){this._stopPropagationed=!0};var f=this.getMeshResultAtPoint(c,h,!0),l=f.mesh;t.hitPoint=f.point;var d="mouseout"===r;if(n&&(n!==l&&(!n.contains||!n.contains(l))||d)){var m=!1;if("touchmove"===r?m="touchout":"mousemove"!==r&&!d&&l||(m="mouseout"),m){var _=Object.assign({},t);_.type=m,_.eventTarget=n,n._fireMouseEvent(_)}t.lastEventTarget=n,this._eventTarget=null}if(l&&l.pointerEnabled&&"mouseout"!==r&&(t.eventTarget=this._eventTarget=l,l._fireMouseEvent(t)),!i){var p=l&&l.pointerEnabled&&l.useHandCursor?"pointer":"";e.style.cursor=p}jr.android&&"touchmove"===r&&t.preventDefault()},updateDomViewport:function(){var t=this.canvas,e=null;return t.parentNode&&(e=this.domViewport=Object(i.getElementRect)(t)),e},getMeshResultAtPoint:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.camera,i=this._ray;i||(i=this._ray=new hr.a),i.fromCamera(r,t,e,this.width,this.height);var a=this.raycast(i,!0,n);if(a)return a[0];this._stageResultAtPoint||(this._stageResultAtPoint={mesh:this,point:new c.a});var s=this._stageResultAtPoint.point;return s.copy(r.unprojectVector(s.set(t,e,0),this.width,this.height)),this._stageResultAtPoint},releaseGLResource:function(){return this.renderer.releaseGLResource(),this},destroy:function(){return kr.superclass.destroy.call(this,this.renderer),this.releaseGLResource(),this.traverse((function(t){t.off(),t.parent=null})),this.children.length=0,this.renderer.off(),this}}),zr=kr;function Wr(){return+new Date}var Yr=a.a.create({constructor:function(t,e,n,r){var i=this;for(var a in i.target=t,i._startTime=0,i._seekTime=0,i._pausedTime=0,i._pausedStartTime=0,i._reverseFlag=1,i._repeatCount=0,3===arguments.length&&(r=n,n=e,e=null),r)i[a]=r[a];i._fromProps=e,i._toProps=n,!r.duration&&r.time&&(i.duration=r.time||0,i.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(t,e){var n=this.target,r=t||e,i=this._fromProps={},a=this._toProps={};for(var s in t=t||n,e=e||n,r)a[s]=e[s]||0,n[s]=i[s]=t[s]||0;return this},start:function(){var t=this;return t._startTime=Wr()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,Yr.add(t),t},stop:function(){return Yr.remove(this),this},pause:function(){return this.paused=!0,this._pausedStartTime=Wr(),this},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=Wr()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,e){var n=this,r=Wr();return n._startTime=r,n._seekTime=t,n._pausedTime=0,void 0!==e&&(n.paused=e),n._update(r,!0),Yr.add(n),n},link:function(t){var e,n,r=t.delay,i=this._startTime;return"string"==typeof r&&(e=0===r.indexOf("+"),n=0===r.indexOf("-"),r=e||n?Number(r.substr(1))*(e?1:-1):Number(r)),t.delay=r,t._startTime=e||n?i+this.duration+r:i+r,this._next=t,Yr.remove(t),t},_render:function(t){var e=this.target,n=this._fromProps;for(var r in n)e[r]=n[r]+(this._toProps[r]-n[r])*t},_update:function(t,e){var n=this;if(n.paused&&!e)return!1;if(n.isComplete)return!0;var r=t-n._startTime-n._pausedTime+n._seekTime;if(r<0)return!1;var i,a=r/n.duration;a<=0?a=0:a>=1&&(a=1);var s=n.ease?n.ease(a):a;n.reverse&&n.isStart&&(n._reverseFlag<0&&(a=1-a,s=1-s),a<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0===n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=r,n._render(s),(i=n.onUpdate)&&i.call(n,s,n),a>=1&&(n.reverse?(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&u<=t?(o._render(a),o.time=r,Yr.add(o)):n.isComplete&&(u<0||u>t)&&o.start()}return!!n.isComplete&&((i=n.onComplete)&&i.call(n,n),!0)},Statics:{_tweens:[],tick:function(){var t,e,n=Yr._tweens,r=n.length;for(e=0;e-1&&r.splice(e,1);else for(e=0;e1||this.heightSegments>1||this.depthSegments>1},setFrontUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setFrontUV!"):this.setVertexUV(32,t)},setRightUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setRightUV!"):this.setVertexUV(0,t)},setBackUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBackUV!"):this.setVertexUV(40,t)},setLeftUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setLeftUV!"):this.setVertexUV(8,t)},setTopUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setTopUV!"):this.setVertexUV(16,t)},setBottomUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBottomUV!"):this.setVertexUV(24,t)},setAllRectUV:function(t){if(this.isSegments())return m.a.warn("segmented BoxGeometry dont support setAllRectUV!"),null;for(var e=0;e<6;e++)this.setVertexUV(8*e,t);return this},_raycast:function(t,e){return mi.superclass._raycast.call(this,t,e)}}),_i=mi,pi=P.a.FRONT,gi=P.a.BACK,vi=[0,0,1],Ei=a.a.create({Extends:Z,isPlaneGeometry:!0,className:"PlaneGeometry",width:1,height:1,widthSegments:1,heightSegments:1,constructor:function(t){Ei.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.widthSegments,e=this.heightSegments,n=(t+1)*(e+1),r=this.width/t,i=this.height/e,a=new Float32Array(3*n),s=new Float32Array(3*n),o=new Float32Array(2*n),u=new Uint16Array(t*e*6),c=0,h=0;h<=e;h++)for(var f=0;f<=t;f++){var l=h*(t+1)+f;if(a[3*l]=f*r-this.width/2,a[3*l+1]=this.height/2-h*i,s[3*l]=0,s[3*l+1]=0,s[3*l+2]=1,o[2*l]=f/t,o[2*l+1]=1-h/e,h0||n<0))return null;if(e===gi&&(r<0||n>0))return null;var i=t.intersectsPlane(vi,0);if(i){var a=i.x,s=i.y,o=.5*this.width,u=.5*this.height;if(a>=-o&&a<=o&&s>=-u&&s<=u)return[i]}return null}}),Ti=Ei,Mi=a.a.create({Extends:Z,isSphereGeometry:!0,className:"SphereGeometry",radius:1,heightSegments:16,widthSegments:32,constructor:function(t){Mi.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.radius,e=this.heightSegments,n=this.widthSegments,r=(n+1)*(e+1),i=n*e,a=new Float32Array(3*r),s=new Float32Array(4*r),o=new Float32Array(2*r),u=new Uint16Array(6*i),c=0,h=0,f=0,l=0,d=0,m=2*Math.PI,_=Math.PI,p=0;p<=e;p++)for(var g=p/e,v=_*g,E=Math.cos(v)*t,T=Math.sin(v)*t,M=0;M<=n;M++){var A=M/n,L=m*A,I=Math.cos(L),O=Math.sin(L),S=I*T,R=O*T,y=O,N=-I;if(s[f++]=y,s[f++]=0,s[f++]=N,s[f++]=1,a[h++]=S,a[h++]=E,a[h++]=R,o[l++]=A,o[l++]=g,p>0&&M>0){var x=d,b=x-1,P=b-n-1,w=x-n-1;u[c++]=P,u[c++]=w,u[c++]=x,u[c++]=P,u[c++]=x,u[c++]=b}d++}this.vertices=new C(a,3),this.indices=new C(u,1),this.uvs=new C(o,2),this.tangents=new C(s,4),this.normals=new C(new Float32Array(a),3)},_raycast:function(t,e){return Mi.superclass._raycast.call(this,t,e)}}),Ai=Mi,Li=[dt,Lt,Nt,Ft,Qt,ce],Ii=function(){var t="";return Li.forEach((function(e){t+="".concat(e.prototype.className,":").concat(Object.keys(e.cache._cache).length," ")})),m.a.log(t),t},Oi=a.a.create({Mixes:s.a,isLoadCache:!0,className:"LoadCache",Statics:{PENDING:1,LOADED:2,FAILED:3},enabled:!0,constructor:function(){this._files={}},update:function(t,e,n){if(this.enabled){var r={key:t,state:e,data:n};this._files[t]=r,this.fire("update",r),this.fire("update:".concat(r.key),r)}},get:function(t){return this.enabled?this._files[t]:null},getLoaded:function(t){var e=this.get(t);return e&&e.state===Oi.LOADED?e.data:null},remove:function(t){delete this._files[t]},clear:function(){this._files={}},wait:function(t){var e=this;return t?t.state===Oi.LOADED?Promise.resolve(t.data):t.state===Oi.FAILED?Promise.reject():new Promise((function(n,r){e.on("update:".concat(t.key),(function(t){var e=t.detail;e.state===Oi.LOADED?n(e.data):e.state===Oi.FAILED&&r(e.data)}),!0)})):Promise.reject()}}),Si=Oi,Ri=new Si,yi=a.a.create({Mixes:s.a,isBasicLoader:!0,className:"BasicLoader",Statics:{_cache:Ri,enalbeCache:function(){Ri.enabled=!0},disableCache:function(){Ri.enabled=!1},deleteCache:function(t){Ri.remove(t)},clearCache:function(){Ri.clear()},cache:{get:function(){return Ri},set:function(){m.a.warn("BasicLoader.cache is readonly!")}},TYPE_IMAGE:"img",TYPE_JSON:"json",TYPE_BUFFER:"buffer",TYPE_TEXT:"text"},load:function(t){var e=t.src,n=t.type;if(!n){var r=Object(i.getExtension)(e);/^(?:png|jpe?g|gif|webp|bmp)$/i.test(r)&&(n="img"),n||(n=t.defaultType)}return n===yi.TYPE_IMAGE?this.loadImg(e,t.crossOrigin):this.loadRes(e,n)},isCrossOrigin:function(t){var e=window.location,n=document.createElement("a");return n.href=t,n.hostname!==e.hostname||n.port!==e.port||n.protocol!==e.protocol},isBase64:function(t){return/^data:(.+?);base64,/.test(t)},Uint8ArrayFrom:function(t,e){if(Uint8Array.from)return Uint8Array.from(t,e);for(var n=t.length,r=new Uint8Array(n),i=0;i=300)r(new TypeError("Network request failed for ".concat(a.status)));else{var e="response"in a?a.response:a.responseText;if(t.type===yi.TYPE_JSON)try{e=JSON.parse(e)}catch(t){return void r(new TypeError("JSON.parse error"+t))}n(e)}},a.onprogress=function(n){e.fire("progress",{url:t.url,loaded:n.loaded,total:n.total})},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request timed out"))},a.open(t.method||"GET",t.url,!0),"include"===t.credentials&&(a.withCredentials=!0),t.type===yi.TYPE_BUFFER&&(a.responseType="arraybuffer"),Object(i.each)(t.headers,(function(t,e){a.setRequestHeader(e,t)})),a.send(t.body||null)}))}}),Ni=yi,xi=a.a.create({isLoader:!0,className:"Loader",maxConnections:2,Statics:{_loaderClassMap:{},_loaders:{},addLoader:function(t,e){xi._loaderClassMap[t]=e},getLoader:function(t){if(!xi._loaders[t]){var e=xi._loaderClassMap[t]?xi._loaderClassMap[t]:Ni;xi._loaders[t]=new e}return xi._loaders[t]}},preHandlerUrl:null,load:function(t){var e=this;if(t instanceof Array)return Promise.all(t.map((function(t){return e.load(t)})));var n=t.type||Object(i.getExtension)(t.src),r=xi.getLoader(n),a=t;return this.preHandlerUrl&&((a=Object.assign({},t)).src=this.preHandlerUrl(t.src)),r.load(a)}}),bi=xi,Ci=a.a.create({Extends:Ni,isCubeTextureLoader:!0,className:"CubeTextureLoader",constructor:function(){Ci.superclass.constructor.call(this)},load:function(t){var e,n=this;return e=t.images&&Array.isArray(t.images)?t.images:[t.right,t.left,t.top,t.bottom,t.front,t.back],Promise.all(e.map((function(e){return n.loadImg(e,t.crossOrigin)}))).then((function(e){var n=Object.assign({},t);return delete n.images,delete n.type,delete n.right,delete n.left,delete n.top,delete n.bottom,delete n.front,delete n.back,n.image=e,new pe(n)})).catch((function(t){throw m.a.error("load CubeTexture failed",t.message,t.stack),t}))}});bi.addLoader("CubeTexture",Ci);var Pi=Ci,wi=a.a.create({Extends:Je,isPBRMaterial:!0,className:"PBRMaterial",lightType:"PBR",gammaCorrection:!0,usePhysicsLight:!0,baseColor:null,baseColorMap:null,metallic:1,metallicMap:null,roughness:1,roughnessMap:null,metallicRoughnessMap:null,occlusionMap:null,occlusionStrength:1,isOcclusionInMetallicRoughnessMap:!1,diffuseEnvMap:null,diffuseEnvSphereHarmonics3:null,diffuseEnvIntensity:1,brdfLUT:null,specularEnvIntensity:1,specularEnvMap:null,isSpecularEnvMapIncludeMipmaps:!1,emission:null,emissionFactor:null,isSpecularGlossiness:!1,specular:null,glossiness:1,specularGlossinessMap:null,clearcoatFactor:0,clearcoatMap:null,clearcoatRoughnessFactor:0,clearcoatRoughnessMap:null,clearcoatNormalMap:null,usedUniformVectors:11,constructor:function(t){this.baseColor=new v.a(1,1,1),this.specular=new v.a(1,1,1),this.emissionFactor=new v.a(0,0,0),wi.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_baseColor:"BASECOLOR",u_metallic:"METALLIC",u_roughness:"ROUGHNESS",u_specular:"SPECULAR",u_emissionFactor:"EMISSIONFACTOR",u_glossiness:"GLOSSINESS",u_brdfLUT:"BRDFLUT",u_diffuseEnvMap:"DIFFUSEENVMAP",u_diffuseEnvIntensity:"DIFFUSEENVINTENSITY",u_occlusionStrength:"OCCLUSIONSTRENGTH",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvIntensity:"SPECULARENVINTENSITY",u_specularEnvMapMipCount:"SPECULARENVMAPMIPCOUNT",u_diffuseEnvSphereHarmonics3:"DIFFUSEENVSPHEREHARMONICS3",u_clearcoatFactor:"CLEARCOATFACTOR",u_clearcoatRoughnessFactor:"CLEARCOATROUGHNESSFACTOR"}),this.addTextureUniforms({u_baseColorMap:"BASECOLORMAP",u_metallicMap:"METALLICMAP",u_roughnessMap:"ROUGHNESSMAP",u_metallicRoughnessMap:"METALLICROUGHNESSMAP",u_occlusionMap:"OCCLUSIONMAP",u_specularGlossinessMap:"SPECULARGLOSSINESSMAP",u_lightMap:"LIGHTMAP",u_clearcoatMap:"CLEARCOATMAP",u_clearcoatRoughnessMap:"CLEARCOATROUGHNESSMAP",u_clearcoatNormalMap:"CLEARCOATNORMALMAP"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};wi.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t);return e.add(this.baseColorMap,"BASE_COLOR_MAP"),e.add(this.metallicMap,"METALLIC_MAP"),e.add(this.roughnessMap,"ROUGHNESS_MAP"),e.add(this.metallicRoughnessMap,"METALLIC_ROUGHNESS_MAP"),e.add(this.diffuseEnvMap,"DIFFUSE_ENV_MAP"),e.add(this.occlusionMap,"OCCLUSION_MAP"),e.add(this.lightMap,"LIGHT_MAP"),this.brdfLUT&&(e.add(this.specularEnvMap,"SPECULAR_ENV_MAP"),et.SHADER_TEXTURE_LOD&&this.specularEnvMap&&(t.USE_SHADER_TEXTURE_LOD=1)),this.isSpecularGlossiness&&(t.PBR_SPECULAR_GLOSSINESS=1,e.add(this.specularGlossinessMap,"SPECULAR_GLOSSINESS_MAP")),this.isOcclusionInMetallicRoughnessMap&&(t.IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP=1),1!==this.occlusionStrength&&(t.OCCLUSION_STRENGTH=1),this.diffuseEnvSphereHarmonics3&&(t.HAS_NORMAL=1,t.DIFFUSE_ENV_SPHERE_HARMONICS3=1),(this.specularEnvMap||this.diffuseEnvSphereHarmonics3||this.specularEnvMap)&&(t.NEED_WORLD_NORMAL=1),this.specularEnvMap&&this.isSpecularEnvMapIncludeMipmaps&&(t.IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS=1),this.clearcoatFactor>0&&(t.HAS_CLEARCOAT=1,t.HAS_NORMAL=1,this.clearcoatMap&&e.add(this.clearcoatMap,"CLEARCOAT_MAP"),this.clearcoatNormalMap&&e.add(this.clearcoatNormalMap,"CLEARCOAT_NORMAL_MAP"),this.clearcoatRoughnessMap&&e.add(this.clearcoatRoughnessMap,"CLEARCOAT_ROUGHNESS_MAP")),e.update(),t}}),Hi=wi,Di=new Image;Di.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var Fi=a.a.create({Extends:Qt,Mixes:s.a,isLazyTexture:!0,className:"LazyTexture",_src:"",crossOrigin:!1,autoLoad:!0,resType:"",src:{get:function(){return this._src},set:function(t){this._src!==t&&(this._src=t,this.autoLoad&&this.load())}},constructor:function(t){t&&("crossOrigin"in t&&(this.crossOrigin=t.crossOrigin),"autoLoad"in t&&(this.autoLoad=t.autoLoad)),Fi.superclass.constructor.call(this,t),this.image=this.placeHolder||Di},load:function(t){var e=this;return Fi.loader=Fi.loader||new bi,Fi.loader.load({src:this.src,crossOrigin:this.crossOrigin,type:this.resType,defaultType:"img"}).then((function(t){t.isTexture?(Object.assign(e,t),e.needUpdate=!0,e.needDestroy=!0,e.fire("load")):(e.image=t,e.needUpdate=!0,e.fire("load"))}),(function(n){if(e.fire("error"),t)throw new Error("LazyTexture Failed ".concat(n));m.a.warn("LazyTexture Failed ".concat(n))}))},_releaseImage:function(){this._src&&"string"!=typeof this._src&&(this._src=""),Fi.superclass._releaseImage.call(this)}}),Ui=Fi,Gi=n(13);function Bi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Vi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vi(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;r--)Zi[r]=t[r]+n*(e[r]-t[r]);return Zi}return t+n*(e-t)},STEP:function(t,e,n){return t},CUBICSPLINE:function(t,e,n,r){var a=t.length/3;if(void 0===e)return 1===a?t[1]:t.slice(a,-a);var s=t[1],o=t[2],u=e[1],c=e[0];return a>1&&(s=t.slice(a,-a),o=t.slice(-a),u=e.slice(a,-a),c=e.slice(0,a)),s.hermite?s.hermite(s,o.scale(r),u,c.scale(r),n):s.isQuaternion?(s.fromArray(this._cubicSpline(s.elements,o.elements,u.elements,c.elements,r,n),0,!0),s.normalize(!0)):(Object(i.isArrayLike)(s)||(s=[s],o=[o],u=[u],c=[c]),s=this._cubicSpline(s,o,u,c,r,n)),s},_cubicSpline:function(t,e,n,r,i,a){var s=a*a,o=s*a,u=2*o-3*s+1,c=o-2*s+a,h=-2*o+3*s,f=o-s;Zi.length=0;for(var l=t.length-1;l>=0;l--)Zi[l]=t[l]*u+c*e[l]*i+n[l]*h+f*r[l]*i;return Zi}},StateType:{TRANSLATE:"Translation",POSITION:"Translation",TRANSLATION:"Translation",SCALE:"Scale",ROTATE:"Rotation",ROTATION:"Rotation",QUATERNION:"Quaternion",WEIGHTS:"Weights"},getType:function(t){return t=String(t).toUpperCase(),Qi.StateType[t]||Qi._extraStateHandlers.type[t]},_extraStateHandlers:{type:{},handler:{}},registerStateHandler:function(t,e){Qi._extraStateHandlers.type[String(t).toUpperCase()]=t,Qi._extraStateHandlers.handler[t]=e}},isAnimationStates:!0,className:"AnimationStates",nodeName:"",type:"",interpolationType:"LINEAR",constructor:function(t){this.id=d.a.generateUUID(this.className),this.keyTime=[],this.states=[],Object.assign(this,t)},findIndexByTime:function(t){return Object(i.getIndexFromSortedArray)(this.keyTime,t,Ki)},getStateByIndex:function(t){var e=this.states.length/this.keyTime.length;return 1===e?this.states[t]:this.states.slice(t*e,t*e+e)},getState:function(t){var e=Bi(this.findIndexByTime(t),2),n=e[0],r=e[1];if(n<0||r>=this.keyTime.length)return null;var a=this.keyTime[n],s=this.keyTime[r],o=this.getStateByIndex(n);if("STEP"===this.interpolationType)return o;if(n===r){var u=this.interpolation(o);return this.type===Qi.StateType.ROTATION&&(u=Xi.fromEuler(qi.fromArray(u))),u.elements||u}var c=this.getStateByIndex(r),h=s-a,f=(t-a)/h;this.type===Qi.StateType.ROTATION?Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromEuler(qi.fromArray(o[0])),o[1]=ji.fromEuler(qi.fromArray(o[1])),o[2]=ki.fromEuler(qi.fromArray(o[2])),c[0]=zi.fromEuler(qi.fromArray(c[0])),c[1]=Wi.fromEuler(qi.fromArray(c[1])),c[2]=Yi.fromEuler(qi.fromArray(c[2]))):(o=Xi.fromEuler(qi.fromArray(o)),c=ji.fromEuler(qi.fromArray(c))):this.type===Qi.StateType.QUATERNION&&(Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromArray(o[0]),o[1]=ji.fromArray(o[1]),o[2]=ki.fromArray(o[2]),c[0]=zi.fromArray(c[0]),c[1]=Wi.fromArray(c[1]),c[2]=Yi.fromArray(c[2])):(o=Xi.fromArray(o),c=ji.fromArray(c)));var l=this.interpolation(o,c,f,h);return l.elements||l},interpolation:function(t,e,n,r){return Qi.interpolation[this.interpolationType](t,e,n,r)},updateNodeTranslation:function(t,e){t.x=e[0],t.y=e[1],t.z=e[2]},updateNodeScale:function(t,e){t.scaleX=e[0],t.scaleY=e[1],t.scaleZ=e[2]},updateNodeQuaternion:function(t,e){t.quaternion.fromArray(e)},updateNodeWeights:function(t,e){var n=this._originalWeightIndices=this._originalWeightIndices||[],r=e.length;e=e.slice();for(var i=0;ie[a]){var o=e[a];e[a]=e[s],e[s]=o,o=n[a],n[a]=n[s],n[s]=o}t.traverse((function(t){t.isMesh&&t.geometry&&t.geometry.isMorphGeometry&&t.geometry.update(e,n)}))},updateNodeState:function(t,e){if(e){var n=this.type;n===Qi.StateType.ROTATION&&(n=Qi.StateType.QUATERNION);var r=this.getState(t);if(r){var i="updateNode"+n;this[i]?this[i](e,r):Qi._extraStateHandlers.handler[n]?Qi._extraStateHandlers.handler[n].call(this,e,r):m.a.warnOnce(i,"updateNodeState failed unknow type(%s)",n)}}},clone:function(){return new this.constructor({keyTime:this.keyTime,states:this.states,type:this.type,nodeName:this.nodeName})}}),Ji=Qi,$i=a.a.create({Statics:{_anims:[],tick:function(t){this._anims.forEach((function(e){return e.tick(t)}))}},Mixes:s.a,isAnimation:!0,className:"Animation",paused:!1,currentLoopCount:0,loop:1/0,currentTime:0,timeScale:1,startTime:0,endTime:0,clipStartTime:0,clipEndTime:0,nodeNameMap:null,_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,this._initNodeNameMap()}},_animStatesList:null,animStatesList:{get:function(){return this._animStatesList},set:function(t){this._animStatesList=t,this._initClipTime()}},validAnimationIds:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.clips={},this._animStatesList=[],Object.assign(this,t)},addClip:function(t,e,n,r){this.clips[t]={start:e,end:n,animStatesList:r}},removeClip:function(t){this.clips[t]=null},getAnimStatesListTimeInfo:function(t){var e=0,n=1/0;return t.forEach((function(t){e=Math.max(t.keyTime[t.keyTime.length-1],e),n=Math.min(t.keyTime[0],n)})),{startTime:n,endTime:e}},_initClipTime:function(){var t=this.getAnimStatesListTimeInfo(this.animStatesList);this.clipStartTime=t.startTime,this.clipEndTime=t.endTime},_initNodeNameMap:function(){if(this._rootNode){var t=this.nodeNameMap={};this._rootNode.traverse((function(e){t[e.animationId]=e;var n=e.name;void 0===n||t[n]||(t[n]=e)}),!1)}},tick:function(t){this.paused||(this.currentTime+=t/1e3*this.timeScale,this.currentTime>=this.endTime?(this.currentLoopCount++,this.currentTime=this.endTime,this.updateAnimStates(),this.fire("loopEnd"),!this.loop||this.currentLoopCount>=this.loop?(this.stop(),this.fire("end")):this.currentTime=this.startTime):this.updateAnimStates())},updateAnimStates:function(){var t=this;return this.animStatesList.forEach((function(e){e.updateNodeState(t.currentTime,t.nodeNameMap[e.nodeName])})),this},play:function(t,e){var n;if("string"==typeof t){var r=this.clips[t];r?(n=r.start,e=r.end,r.animStatesList&&(this.animStatesList=r.animStatesList,this._initClipTime())):m.a.warn("no this animation clip name:"+t)}else n=t;void 0===n&&(n=this.clipStartTime),void 0===e&&(e=this.clipEndTime),this.endTime=Math.min(e,this.clipEndTime),this.startTime=Math.min(n,this.endTime),this.currentTime=this.startTime,this.currentLoopCount=0,this.stop(),this.paused=!1,$i._anims.push(this)},stop:function(){this.paused=!0;var t=$i._anims,e=t.indexOf(this);-1!==e&&t.splice(e,1)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},clone:function(t){var e=new this.constructor({rootNode:t,animStatesList:this.animStatesList,timeScale:this.timeScale,loop:this.loop,paused:this.paused,currentTime:this.currentTime,startTime:this.startTime,endTime:this.endTime,clips:this.clips});return this.paused||e.play(),e}}),ta=$i;function ea(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return na(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function na(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=2&&(this.isGLTF2=!0),this.parseExtensionUsed(),this.loadResources(t).then((function(){return e.parseExtensions(e.json.extensions,null,{isGlobal:!0,methodName:"parseOnLoad"}),Promise.resolve()})).then((function(){return e.parseGeometries()})).then((function(){return e.parseScene()}))},parseExtensionUsed:function(){var t=this;this.extensionsUsed={},i.each(this.json.extensionsUsed,(function(e){t.extensionsUsed[e]=!0})),this.extensionsUsed.WEB3D_quantized_attributes||(this.isUnQuantizeInShader=!1)},getExtensionHandler:function(t){return this.extensionHandlers&&this.extensionHandlers[t]||la.extensionHandlers[t]},parseExtension:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t[e],a=this.getExtensionHandler(e);return a&&a.parse?a.parse(i,this,n,r):n},parseExtensions:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.each(t,(function(t,i){if(!r.ignoreExtensions||!r.ignoreExtensions[i]){var a=n.getExtensionHandler(i),s=r.methodName||"parse";a&&a[s]&&(e=a[s](t,n,e,r))}})),e},isUseExtension:function(t,e){return!!(t&&t.extensions&&t.extensions[e])},parseBinary:function(t){this.isBinary=!0;var e,n=new DataView(t),r=n.getUint32(4,!0),a=n.getUint32(8,!0),s=12;if(r<2){var o=n.getUint32(s,!0);e=new Uint8Array(t,20,o),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e),this.binaryBody=t.slice(20+o)}else{if(2!==r)throw new Error("Dont support glTF version ".concat(r));for(;sa*i.BYTES_PER_ELEMENT)s.array=new i(s.buffer,s.byteOffset,s.byteLength/i.BYTES_PER_ELEMENT),r=new C(s.array,a,{offset:n.byteOffset||0,stride:s.byteStride,bufferViewId:s.id});else{var u,c=(n.byteOffset||0)+s.byteOffset;if(c%i.BYTES_PER_ELEMENT||this.forceCreateNewBuffer)u=new i(s.buffer.slice(c,c+o*i.BYTES_PER_ELEMENT));else u=new i(s.buffer,c,o);r=new C(u,a)}return n.sparse&&(r||(r=new C(new i(o),a)),r=this.sparseAccessorHandler(r,n.sparse)),r=this.parseExtensions(n.extensions,r,{isDecode:e,isAccessor:!0}),n.data=r,n.normalized&&(r.normalized=!0),r},getArrayByAccessor:function(t,e){var n=this.json.accessors[t];if(n.array)return n.array;var r=this.getAccessorData(t,e);if(!r.stride&&!r.offset&&1===r.size)return r.data;var i=[];return r.traverse((function(t){i.push(t.toArray?t.toArray():t)})),n.array=i,i},parseTechnique:function(t,e){var n=null;this.json.techniques&&(n=this.json.techniques[t.technique]),n&&n.states&&(n.states.enable.forEach((function(t){switch(t){case ra:e.blend=!0;break;case ia:e.depthTest=!0;break;case aa:e.cullFace=!0}})),i.each(n.states.functions,(function(t,n){switch(n){case"blendEquationSeparate":e.blendEquation=t[0],e.blendEquationAlpha=t[1];break;case"blendFuncSeparate":e.blendSrc=t[0],e.blendDst=t[1],e.blendSrcAlpha=t[2],e.blendDstAlpha=t[3];break;case"depthMask":e.depthMask=t[0];break;case"cullFace":e.cullFaceType=t[0];break;default:e[n]=t}})),e.cullFace?e.side=e.cullFaceType===sa?oa:sa:e.side=ua)},createMorphGeometry:function(t,e){var n=this,r=new qn,a=r.targets={};return i.each(t.targets,(function(t){i.each(t,(function(t,e){var r=fa[e].name;a[r]||(a[r]=[]);var i=n.getAccessorData(t,!0);a[r].push(i)}))})),r.weights=e||new Float32Array(t.targets.length),r},handlerGeometry:function(t,e){var n=void 0===e.mode?4:e.mode;if(e.extensions){var r=this.parseExtensions(e.extensions,null,{primitive:e,isPrimitive:!0});if(r)return r.mode=n,r}t||(t=new Z({mode:n})),"indices"in e&&(t.indices=this.getAccessorData(e.indices));var i=e.attributes;for(var a in i){var s=fa[a];if(s){var o=!(this.isUnQuantizeInShader&&s.decodeMatName);t[s.name]=this.getAccessorData(i[a],o),o||(t[s.decodeMatName]=t[s.name].decodeMat,delete t[s.name].decodeMat)}else m.a.warn("Unknow attribute named ".concat(a,"!"))}return t},handlerSkinedMesh:function(t,e){e&&(t.skeleton=e,this.useInstanced&&(t.useInstanced=!0))},fixProgressiveGeometry:function(t,e){t._geometry=e,this.isProgressive&&t._meshes&&t._meshes.forEach((function(t){t.visible=!0,t.geometry=e}))},parseGeometries:function(){var t=this,e=i.serialRun(this.json.meshes,(function(e){return i.serialRun(e.primitives,(function(n){var r;n.targets&&n.targets.length&&(r=t.createMorphGeometry(n,e.weights)),n._geometry=r;var i=t.handlerGeometry(r,n);return i&&i.then?i.then((function(e){t.fixProgressiveGeometry(n,e)}),(function(t){m.a.error("geometry parse error",t)})):(t.fixProgressiveGeometry(n,i),i)}))}));return this.isProgressive?null:e},parseMesh:function(t,e,n){var r=this,i=this.json.meshes[t];i.primitives.forEach((function(a){var s,o=r.skins&&r.skins[n.skin];if(a.meshNode)s=a.meshNode.clone();else{var u=r.materials[a.material]||new tn;s=new(o?vr:mr)({geometry:a._geometry,material:u,name:"mesh-"+(i.name||t)}),a.meshNode=s}r.handlerSkinedMesh(s,o),r.isProgressive&&!s.geometry&&(s.visible=!1,a._meshes=a._meshes||[],a._meshes.push(s)),e.addChild(s),r.meshes.push(s)}))},parseCameras:function(){var t=this;this.cameras={};var e=window.innerWidth/window.innerHeight;i.each(this.json.cameras,(function(n,r){var i;"perspective"===n.type&&n.perspective?((i=new Q).fov=d.a.radToDeg(n.perspective.yfov),i.near=n.perspective.znear,i.far=n.perspective.zfar,n.aspectRatio?i.aspect=n.aspectRatio:i.aspect=e):"orthographic"===n.type&&n.orthographic&&((i=new hn).near=n.orthographic.znear,i.far=n.orthographic.zfar,i.right=n.orthographic.xmag,i.left=-1*i.right,i.top=n.orthographic.ymag,i.bottom=-1*i.top),(i=t.parseExtensions(n.extensions,i,{isCamera:!0}))&&(i.name=n.name||r,t.cameras[r]=i)}))},handlerNodeTransform:function(t,e){e.matrix?t.matrix.fromArray(e.matrix):(e.rotation&&t.quaternion.fromArray(e.rotation),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.translation&&(t.x=e.translation[0],t.y=e.translation[1],t.z=e.translation[2]))},parseNode:function(t,e){var n,r=this,i=this.json.nodes[t];i||m.a.warn("GLTFParser.parseNode: nodes[".concat(t,"] has nothing.")),n=new g({name:i.name,animationId:t}),n=this.parseExtensions(i.extensions,n,{isNode:!0}),"camera"in i&&this.cameras[i.camera]&&n.addChild(this.cameras[i.camera]),this.handlerNodeTransform(n,i),i.jointName?(n.jointName=i.jointName,this.jointMap[n.jointName]=n):this.isGLTF2&&(n.jointName=t,this.jointMap[t]=n),i.meshes?i.meshes.forEach((function(t){return r.parseMesh(t,n,i)})):"mesh"in i&&this.parseMesh(i.mesh,n,i),i.children&&i.children.forEach((function(t){return r.parseNode(t,n)})),e.addChild(n)},parseAnimations:function(){var t=this;if(!this.json.animations)return null;var e=this.isMultiAnim,n={},r=[],a={};return i.each(this.json.animations,(function(i){i.channels.forEach((function(e){var n=e.target.path,s=e.target.id;t.isGLTF2&&(s=e.target.node);var o=i.samplers[e.sampler],u=t.isGLTF2?o.input:i.parameters[o.input],c=t.isGLTF2?o.output:i.parameters[n],h=t.getArrayByAccessor(u,!0),f=t.getArrayByAccessor(c,!0);"rotation"===n&&(n="quaternion");var l=new Ji({interpolationType:o.interpolation||"LINEAR",nodeName:s,keyTime:h,states:f,type:Ji.getType(n)});r.push(l),a[s]=!0})),e&&r.length&&(n[i.name]={animStatesList:r},r=[])})),e&&Object.keys(n).length>0&&(r=Object.values(n)[0].animStatesList),r.length?new ta({rootNode:this.node,animStatesList:r,validAnimationIds:a,clips:n}):null},parseScene:function(){var t=this;this.parseMaterials(),this.jointMap={},this.meshes=[],this.lights=[],this.node=new g({needCallChildUpdate:!1}),this.parseCameras();var e=this.json.scenes[this.getDefaultSceneName()];if(!e)return m.a.warn("GLTFParser:no scene!"),{node:this.node,meshes:[],cameras:[],lights:[],textures:[],materials:[]};var n=e.nodes;this.parseSkins(),n.forEach((function(e){return t.parseNode(e,t.node)})),this.resetSkinInfo(this.node);var r={node:this.node,scene:this.node,meshes:this.meshes,json:this.json,cameras:Object.values(this.cameras),lights:this.lights,textures:Object.values(this.textures),materials:Object.values(this.materials)},i=this.parseAnimations();return i&&(this.node.setAnim(i),i.play(),r.anim=i),this.parseExtensions(e.extensions,null,{isScene:!0}),this.parseExtensions(this.json.extensions,r,{isGlobal:!0,methodName:"parseOnEnd"}),r},getDefaultSceneName:function(){return void 0!==this.defaultScene?this.defaultScene:this.json.scenes?Object.keys(this.json.scenes)[0]:null},parseSkins:function(){var t=this;this.skins=[];var e=this.json.skins;e&&e.length&&(this.skins=e.map((function(e){for(var n=new Tr,r=e.joints.length,i=t.getArrayByAccessor(e.inverseBindMatrices,!0),a=0;a ",t)}return null}))}});bi.addLoader("hdr",Aa);var La=Aa,Ia=a.a.create({Statics:{HEADER_LEN:64,COMPRESSED_2D:0,COMPRESSED_3D:1,TEX_2D:2,TEX_3D:3},isKhronosTextureContainer:!0,className:"KhronosTextureContainer",constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.arrayBuffer=t,this.baseOffset=n;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,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]){var i=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*i),s=a.getUint32(0,!0),o=67305985===s;this.glType=a.getUint32(1*i,o),this.glTypeSize=a.getUint32(2*i,o),this.glFormat=a.getUint32(3*i,o),this.glInternalFormat=a.getUint32(4*i,o),this.glBaseInternalFormat=a.getUint32(5*i,o),this.pixelWidth=a.getUint32(6*i,o),this.pixelHeight=a.getUint32(7*i,o),this.pixelDepth=a.getUint32(8*i,o),this.numberOfArrayElements=a.getUint32(9*i,o),this.numberOfFaces=a.getUint32(10*i,o),this.numberOfMipmapLevels=a.getUint32(11*i,o),this.bytesOfKeyValueData=a.getUint32(12*i,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=Ia.COMPRESSED_2D:this.loadType=Ia.TEX_2D:m.a.warn("number of faces expected"+e+", but found "+this.numberOfFaces):m.a.warn("texture arrays not currently supported"):m.a.warn("only 2D textures currently supported")}else m.a.error("texture missing KTX identifier")},mipmaps:function(t){for(var e=[],n=Ia.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,i=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s2&&void 0!==arguments[2]?arguments[2]:0,r=new Ia(e,1,n),i={compressed:0===r.glType,type:r.glType,width:r.pixelWidth,height:r.pixelHeight,internalFormat:r.glInternalFormat,format:r.glFormat,isCubemap:6===r.numberOfFaces};return r.numberOfMipmapLevels>=Math.floor(Math.log2(Math.max(i.width,i.height))+1)?(i.mipmaps=r.mipmaps(!0),i.image=i.mipmaps[0].data):(i.mipmaps=null,i.image=r.mipmaps(!1)[0].data),new Qt(i)}});bi.addLoader("ktx",Oa);var Sa=Oa,Ra=a.a.create({Mixes:s.a,isLoadQueue:!0,className:"LoadQueue",Statics:{addLoader:function(t,e){m.a.warn("LoadQueue.addLoader is duplicated, please use Loader.addLoader"),bi.addLoader(t,e)}},constructor:function(t){this._source=[],this.add(t)},maxConnections:2,_source:null,_loaded:0,_connections:0,_currentIndex:-1,add:function(t){return t&&(t=Array.isArray(t)?t:[t],this._source=this._source.concat(t)),this},get:function(t){if(!t)return null;for(var e=this._source,n=0;n=n)this.fire("complete");else if(this._currentIndex2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.renderer.pixelRatio,a=[],s=this.framebuffer.readPixels(t*i,e*i,n*i,r*i),o=0;o=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=n.slice(0),i=0,a=r.length;i=0&&e.splice(n,1)},nextTick:function(t){var e=this,n={tick:function(r){e.removeTick(n),t(r)}};return e.addTick(n),n},timeout:function(t,e){var n=this,r=(new Date).getTime()+e,i={tick:function(){(new Date).getTime()-r>=0&&(n.removeTick(i),t())}};return n.addTick(i),i},interval:function(t,e){var n=(new Date).getTime()+e,r={tick:function(){var r=(new Date).getTime(),i=r-n;i>=0&&(i0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=a*s),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.lerp=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=s+r*(n[2]-s),t[3]=o+r*(n[3]-o),t},e.random=function(t,e){var n,i,a,s,o,u;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{u=(a=2*r.RANDOM()-1)*a+(s=2*r.RANDOM()-1)*s}while(u>=1);var c=Math.sqrt((1-o)/u);return t[0]=e*n,t[1]=e*i,t[2]=e*a*c,t[3]=e*s*c,t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*s,t},e.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2],c=n[3],h=c*r+o*a-u*i,f=c*i+u*r-s*a,l=c*a+s*i-o*r,d=-s*r-o*i-u*a;return t[0]=h*c+d*-s+f*-u-l*-o,t[1]=f*c+d*-o+l*-s-h*-u,t[2]=l*c+d*-u+h*-o-f*-s,t[3]=e[3],t},e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function h(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}function f(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.len=h,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=4),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u1?0:i<-1?Math.PI:Math.acos(i)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],u=e[2];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-u)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function a(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function s(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function l(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function d(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}function m(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.sub=o,e.mul=u,e.div=c,e.dist=h,e.sqrDist=f,e.len=a,e.sqrLen=l,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=3),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;ur.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n},e.multiply=h,e.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+s*o,t[1]=i*u+a*o,t[2]=a*u-i*o,t[3]=s*u-r*o,t},e.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u-a*o,t[1]=i*u+s*o,t[2]=a*u+r*o,t[3]=s*u-i*o,t},e.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*o,t[1]=i*u-r*o,t[2]=a*u+s*o,t[3]=s*u-a*o,t},e.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},e.slerp=f,e.random=function(t){var e=r.RANDOM(),n=r.RANDOM(),i=r.RANDOM(),a=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*n),t[1]=a*Math.cos(2*Math.PI*n),t[2]=s*Math.sin(2*Math.PI*i),t[3]=s*Math.cos(2*Math.PI*i),t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a,o=s?1/s:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=a*o,t},e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.fromMat3=l,e.fromEuler=function(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var a=Math.sin(e),s=Math.cos(e),o=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);return t[0]=a*u*h-s*o*c,t[1]=s*o*h+a*u*c,t[2]=s*u*c-a*o*h,t[3]=s*u*h+a*o*c,t},e.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var r=o(n(0)),i=o(n(5)),a=o(n(2)),s=o(n(1));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function u(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function h(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+s*o+i*c-a*u,t[1]=i*h+s*u+a*o-r*c,t[2]=a*h+s*c+r*u-i*o,t[3]=s*h-r*o-i*u-a*c,t}function f(t,e,n,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=n[0],h=n[1],f=n[2],l=n[3],d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return(m=a*c+s*h+o*f+u*l)<0&&(m=-m,c=-c,h=-h,f=-f,l=-l),1-m>r.EPSILON?(d=Math.acos(m),_=Math.sin(d),p=Math.sin((1-i)*d)/_,g=Math.sin(i*d)/_):(p=1-i,g=i),t[0]=p*a+g*c,t[1]=p*s+g*h,t[2]=p*o+g*f,t[3]=p*u+g*l,t}function l(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+s]-e[3*s+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}e.clone=s.clone,e.fromValues=s.fromValues,e.copy=s.copy,e.set=s.set,e.add=s.add,e.mul=h,e.scale=s.scale,e.dot=s.dot,e.lerp=s.lerp;var d=e.length=s.length,m=(e.len=d,e.squaredLength=s.squaredLength),_=(e.sqrLen=m,e.normalize=s.normalize);e.exactEquals=s.exactEquals,e.equals=s.equals,e.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),n=a.fromValues(0,1,0);return function(r,i,s){var o=a.dot(i,s);return o<-.999999?(a.cross(t,e,i),a.len(t)<1e-6&&a.cross(t,n,i),a.normalize(t,t),c(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,_(r,r))}}(),e.sqlerp=function(){var t=u(),e=u();return function(n,r,i,a,s,o){return f(t,r,s,o),f(e,i,a,o),f(n,t,e,2*o*(1-o)),n}}(),e.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],_(e,l(e,t))}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.fromValues=function(t,e,n,i,a,s,o,u,c,h,f,l,d,m,_,p){var g=new r.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=n,g[3]=i,g[4]=a,g[5]=s,g[6]=o,g[7]=u,g[8]=c,g[9]=h,g[10]=f,g[11]=l,g[12]=d,g[13]=m,g[14]=_,g[15]=p,g},e.set=function(t,e,n,r,i,a,s,o,u,c,h,f,l,d,m,_,p){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t[9]=h,t[10]=f,t[11]=l,t[12]=d,t[13]=m,t[14]=_,t[15]=p,t},e.identity=i,e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],a=e[6],s=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=i,t[13]=s,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(i*y-r*N-a*R)*x,t[2]=(_*L-p*A+g*M)*x,t[3]=(l*A-f*L-d*M)*x,t[4]=(u*S-s*N-c*O)*x,t[5]=(n*N-i*S+a*O)*x,t[6]=(p*T-m*L-g*E)*x,t[7]=(h*L-l*T+d*E)*x,t[8]=(s*y-o*S+c*I)*x,t[9]=(r*S-n*y-a*I)*x,t[10]=(m*A-_*T+g*v)*x,t[11]=(f*T-h*A-d*v)*x,t[12]=(o*O-s*R-u*I)*x,t[13]=(n*R-r*O+i*I)*x,t[14]=(_*E-m*M-p*v)*x,t[15]=(h*M-f*E+l*v)*x,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15];return t[0]=o*(l*g-d*p)-f*(u*g-c*p)+_*(u*d-c*l),t[1]=-(r*(l*g-d*p)-f*(i*g-a*p)+_*(i*d-a*l)),t[2]=r*(u*g-c*p)-o*(i*g-a*p)+_*(i*c-a*u),t[3]=-(r*(u*d-c*l)-o*(i*d-a*l)+f*(i*c-a*u)),t[4]=-(s*(l*g-d*p)-h*(u*g-c*p)+m*(u*d-c*l)),t[5]=n*(l*g-d*p)-h*(i*g-a*p)+m*(i*d-a*l),t[6]=-(n*(u*g-c*p)-s*(i*g-a*p)+m*(i*c-a*u)),t[7]=n*(u*d-c*l)-s*(i*d-a*l)+h*(i*c-a*u),t[8]=s*(f*g-d*_)-h*(o*g-c*_)+m*(o*d-c*f),t[9]=-(n*(f*g-d*_)-h*(r*g-a*_)+m*(r*d-a*f)),t[10]=n*(o*g-c*_)-s*(r*g-a*_)+m*(r*c-a*o),t[11]=-(n*(o*d-c*f)-s*(r*d-a*f)+h*(r*c-a*o)),t[12]=-(s*(f*p-l*_)-h*(o*p-u*_)+m*(o*l-u*f)),t[13]=n*(f*p-l*_)-h*(r*p-i*_)+m*(r*l-i*f),t[14]=-(n*(o*p-u*_)-s*(r*p-i*_)+m*(r*u-i*o)),t[15]=n*(o*l-u*f)-s*(r*l-i*f)+h*(r*u-i*o),t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8],h=t[9],f=t[10],l=t[11],d=t[12],m=t[13],_=t[14],p=t[15];return(e*s-n*a)*(f*p-l*_)-(e*o-r*a)*(h*p-l*m)+(e*u-i*a)*(h*_-f*m)+(n*o-r*s)*(c*p-l*d)-(n*u-i*s)*(c*_-f*d)+(r*u-i*o)*(c*m-h*d)},e.multiply=a,e.translate=function(t,e,n){var r=n[0],i=n[1],a=n[2],s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*a+e[12],t[13]=e[1]*r+e[5]*i+e[9]*a+e[13],t[14]=e[2]*r+e[6]*i+e[10]*a+e[14],t[15]=e[3]*r+e[7]*i+e[11]*a+e[15]):(s=e[0],o=e[1],u=e[2],c=e[3],h=e[4],f=e[5],l=e[6],d=e[7],m=e[8],_=e[9],p=e[10],g=e[11],t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=h,t[5]=f,t[6]=l,t[7]=d,t[8]=m,t[9]=_,t[10]=p,t[11]=g,t[12]=s*r+h*i+m*a+e[12],t[13]=o*r+f*i+_*a+e[13],t[14]=u*r+l*i+p*a+e[14],t[15]=c*r+d*i+g*a+e[15]),t},e.scale=function(t,e,n){var r=n[0],i=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.rotate=function(t,e,n,i){var a,s,o,u,c,h,f,l,d,m,_,p,g,v,E,T,M,A,L,I,O,S,R,y,N=i[0],x=i[1],C=i[2],b=Math.sqrt(N*N+x*x+C*C);return b0?(n[0]=2*(c*u+l*i+h*o-f*a)/d,n[1]=2*(h*u+l*a+f*i-c*o)/d,n[2]=2*(f*u+l*o+c*a-h*i)/d):(n[0]=2*(c*u+l*i+h*o-f*a),n[1]=2*(h*u+l*a+f*i-c*o),n[2]=2*(f*u+l*o+c*a-h*i)),s(t,e,n),t},e.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},e.getScaling=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[4],s=e[5],o=e[6],u=e[8],c=e[9],h=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(a*a+s*s+o*o),t[2]=Math.sqrt(u*u+c*c+h*h),t},e.getRotation=function(t,e){var n=e[0]+e[5]+e[10],r=0;return n>0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},e.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3],u=i+i,c=a+a,h=s+s,f=i*u,l=i*c,d=i*h,m=a*c,_=a*h,p=s*h,g=o*u,v=o*c,E=o*h,T=r[0],M=r[1],A=r[2];return t[0]=(1-(m+p))*T,t[1]=(l+E)*T,t[2]=(d-v)*T,t[3]=0,t[4]=(l-E)*M,t[5]=(1-(f+p))*M,t[6]=(_+g)*M,t[7]=0,t[8]=(d+v)*A,t[9]=(_-g)*A,t[10]=(1-(f+m))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=a+a,h=s+s,f=o+o,l=a*c,d=a*h,m=a*f,_=s*h,p=s*f,g=o*f,v=u*c,E=u*h,T=u*f,M=r[0],A=r[1],L=r[2],I=i[0],O=i[1],S=i[2],R=(1-(_+g))*M,y=(d+T)*M,N=(m-E)*M,x=(d-T)*A,C=(1-(l+g))*A,b=(p+v)*A,P=(m+E)*L,w=(p-v)*L,H=(1-(l+_))*L;return t[0]=R,t[1]=y,t[2]=N,t[3]=0,t[4]=x,t[5]=C,t[6]=b,t[7]=0,t[8]=P,t[9]=w,t[10]=H,t[11]=0,t[12]=n[0]+I-(R*I+x*O+P*S),t[13]=n[1]+O-(y*I+C*O+w*S),t[14]=n[2]+S-(N*I+b*O+H*S),t[15]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[1]=h+g,t[2]=l-p,t[3]=0,t[4]=h-g,t[5]=1-c-m,t[6]=d+_,t[7]=0,t[8]=l+p,t[9]=d-_,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,e,n,r,i,a,s){var o=1/(n-e),u=1/(i-r),c=1/(a-s);return t[0]=2*a*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*u,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*u,t[10]=(s+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*a*2*c,t[15]=0,t},e.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),s=void 0;return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(s=1/(r-i),t[10]=(i+r)*s,t[14]=2*i*r*s):(t[10]=-1,t[14]=-2*r),t},e.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+o),c=2/(i+a);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(s-o)*u*.5,t[9]=(i-a)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},e.ortho=function(t,e,n,r,i,a,s){var o=1/(e-n),u=1/(r-i),c=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*u,t[14]=(s+a)*c,t[15]=1,t},e.lookAt=function(t,e,n,a){var s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=e[0],g=e[1],v=e[2],E=a[0],T=a[1],M=a[2],A=n[0],L=n[1],I=n[2];return Math.abs(p-A)0&&(h*=d=1/Math.sqrt(d),f*=d,l*=d);var m=u*l-c*f,_=c*h-o*l,p=o*f-u*h;return(d=m*m+_*_+p*p)>0&&(m*=d=1/Math.sqrt(d),_*=d,p*=d),t[0]=m,t[1]=_,t[2]=p,t[3]=0,t[4]=f*p-l*_,t[5]=l*m-h*p,t[6]=h*_-f*m,t[7]=0,t[8]=h,t[9]=f,t[10]=l,t[11]=0,t[12]=i,t[13]=a,t[14]=s,t[15]=1,t},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},e.subtract=o,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=t[9],d=t[10],m=t[11],_=t[12],p=t[13],g=t[14],v=t[15],E=e[0],T=e[1],M=e[2],A=e[3],L=e[4],I=e[5],O=e[6],S=e[7],R=e[8],y=e[9],N=e[10],x=e[11],C=e[12],b=e[13],P=e[14],w=e[15];return Math.abs(n-E)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-M)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-A)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(o-L)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(u-I)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-O)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(h-S)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-R)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(l-y)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(d-N)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(N))&&Math.abs(m-x)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(x))&&Math.abs(_-C)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(C))&&Math.abs(p-b)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(b))&&Math.abs(g-P)<=r.EPSILON*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(v-w)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(w))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function a(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=e[9],d=e[10],m=e[11],_=e[12],p=e[13],g=e[14],v=e[15],E=n[0],T=n[1],M=n[2],A=n[3];return t[0]=E*r+T*o+M*f+A*_,t[1]=E*i+T*u+M*l+A*p,t[2]=E*a+T*c+M*d+A*g,t[3]=E*s+T*h+M*m+A*v,E=n[4],T=n[5],M=n[6],A=n[7],t[4]=E*r+T*o+M*f+A*_,t[5]=E*i+T*u+M*l+A*p,t[6]=E*a+T*c+M*d+A*g,t[7]=E*s+T*h+M*m+A*v,E=n[8],T=n[9],M=n[10],A=n[11],t[8]=E*r+T*o+M*f+A*_,t[9]=E*i+T*u+M*l+A*p,t[10]=E*a+T*c+M*d+A*g,t[11]=E*s+T*h+M*m+A*v,E=n[12],T=n[13],M=n[14],A=n[15],t[12]=E*r+T*o+M*f+A*_,t[13]=E*i+T*u+M*l+A*p,t[14]=E*a+T*c+M*d+A*g,t[15]=E*s+T*h+M*m+A*v,t}function s(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=r+r,u=i+i,c=a+a,h=r*o,f=r*u,l=r*c,d=i*u,m=i*c,_=a*c,p=s*o,g=s*u,v=s*c;return t[0]=1-(d+_),t[1]=f+v,t[2]=l-g,t[3]=0,t[4]=f-v,t[5]=1-(h+_),t[6]=m+p,t[7]=0,t[8]=l+g,t[9]=m-p,t[10]=1-(h+d),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}e.mul=a,e.sub=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},e.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},e.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromValues=function(t,e,n,i,a,s,o,u,c){var h=new r.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=n,h[3]=i,h[4]=a,h[5]=s,h[6]=o,h[7]=u,h[8]=c,h},e.set=function(t,e,n,r,i,a,s,o,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else 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];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=h*s-o*c,l=-h*a+o*u,d=c*a-s*u,m=n*f+r*l+i*d;return m?(m=1/m,t[0]=f*m,t[1]=(-h*r+i*c)*m,t[2]=(o*r-i*s)*m,t[3]=l*m,t[4]=(h*n-i*u)*m,t[5]=(-o*n+i*a)*m,t[6]=d*m,t[7]=(-c*n+r*u)*m,t[8]=(s*n-r*a)*m,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8];return t[0]=s*h-o*c,t[1]=i*c-r*h,t[2]=r*o-i*s,t[3]=o*u-a*h,t[4]=n*h-i*u,t[5]=i*a-n*o,t[6]=a*c-s*u,t[7]=r*u-n*c,t[8]=n*s-r*a,t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8];return e*(c*a-s*u)+n*(-c*i+s*o)+r*(u*i-a*o)},e.multiply=i,e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=u,t[6]=l*r+d*s+c,t[7]=l*i+d*o+h,t[8]=l*a+d*u+f,t},e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=Math.sin(n),d=Math.cos(n);return t[0]=d*r+l*s,t[1]=d*i+l*o,t[2]=d*a+l*u,t[3]=d*s-l*r,t[4]=d*o-l*i,t[5]=d*u-l*a,t[6]=c,t[7]=h,t[8]=f,t},e.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[3]=h-g,t[6]=l+p,t[1]=h+g,t[4]=1-c-m,t[7]=d-_,t[2]=l-p,t[5]=d+_,t[8]=1-c-f,t},e.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(u*S-s*N-c*O)*x,t[2]=(s*y-o*S+c*I)*x,t[3]=(i*y-r*N-a*R)*x,t[4]=(n*N-i*S+a*O)*x,t[5]=(r*S-n*y-a*I)*x,t[6]=(_*L-p*A+g*M)*x,t[7]=(p*T-m*L-g*E)*x,t[8]=(m*A-_*T+g*v)*x,t):null},e.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=e[0],d=e[1],m=e[2],_=e[3],p=e[4],g=e[5],v=e[6],E=e[7],T=e[8];return Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-d)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-m)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(s-_)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(o-p)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(u-g)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-v)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(h-E)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-T)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(T))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1],m=n[2],_=n[3],p=n[4],g=n[5],v=n[6],E=n[7],T=n[8];return t[0]=l*r+d*s+m*c,t[1]=l*i+d*o+m*h,t[2]=l*a+d*u+m*f,t[3]=_*r+p*s+g*c,t[4]=_*i+p*o+g*h,t[5]=_*a+p*u+g*f,t[6]=v*r+E*s+T*c,t[7]=v*i+E*o+T*h,t[8]=v*a+E*u+T*f,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.sqrDist=e.dist=e.div=e.mul=e.sub=e.len=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},e.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},e.set=function(t,e,n){return t[0]=e,t[1]=n,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},e.subtract=a,e.multiply=s,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},e.distance=u,e.squaredDistance=c,e.length=h,e.squaredLength=f,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},e.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},e.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},e.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},e.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},e.rotate=function(t,e,n,r){var i=e[0]-n[0],a=e[1]-n[1],s=Math.sin(r),o=Math.cos(r);return t[0]=i*o-a*s+n[0],t[1]=i*s+a*o+n[1],t},e.angle=function(t,e){var n=t[0],r=t[1],i=e[0],a=e[1],s=n*n+r*r;s>0&&(s=1/Math.sqrt(s));var o=i*i+a*a;o>0&&(o=1/Math.sqrt(o));var u=(n*i+r*a)*s*o;return u>1?0:u<-1?Math.PI:Math.acos(u)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],a=e[0],s=e[1];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function h(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function f(t){var e=t[0],n=t[1];return e*e+n*n}e.len=h,e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=2),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,a=e[2]/n,s=e[3]/n,o=e[4],u=e[5],c=e[6],h=e[7],f=r*o+i*u+a*c+s*h;t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=(o-r*f)/n,t[5]=(u-i*f)/n,t[6]=(c-a*f)/n,t[7]=(h-s*f)/n}return t},e.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=e[0],l=e[1],d=e[2],m=e[3],_=e[4],p=e[5],g=e[6],v=e[7];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-m)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-_)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(u-p)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(c-g)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(h-v)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))};var r=s(n(0)),i=s(n(3)),a=s(n(4));function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e,n){var r=.5*n[0],i=.5*n[1],a=.5*n[2],s=e[0],o=e[1],u=e[2],c=e[3];return t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=r*c+i*u-a*o,t[5]=i*c+a*s-r*u,t[6]=a*c+r*o-i*s,t[7]=-r*s-i*o-a*u,t}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[4],u=n[5],c=n[6],h=n[7],f=e[4],l=e[5],d=e[6],m=e[7],_=n[0],p=n[1],g=n[2],v=n[3];return t[0]=r*v+s*_+i*g-a*p,t[1]=i*v+s*p+a*_-r*g,t[2]=a*v+s*g+r*p-i*_,t[3]=s*v-r*_-i*p-a*g,t[4]=r*h+s*o+i*c-a*u+f*v+m*_+l*g-d*p,t[5]=i*h+s*u+a*o-r*c+l*v+m*p+d*_-f*g,t[6]=a*h+s*c+r*u-i*o+d*v+m*g+f*p-l*_,t[7]=s*h-r*o-i*u-a*c+m*v-f*_-l*p-d*g,t}e.getReal=i.copy,e.setReal=i.copy,e.mul=c;var h=e.dot=i.dot,f=e.length=i.length,l=(e.len=f,e.squaredLength=i.squaredLength);e.sqrLen=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.fromValues=function(t,e,n,i,a,s){var o=new r.ARRAY_TYPE(6);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o[4]=a,o[5]=s,o},e.set=function(t,e,n,r,i,a,s){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=n*a-r*i;return u?(u=1/u,t[0]=a*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t[4]=(i*o-a*s)*u,t[5]=(r*s-n*o)*u,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=Math.sin(n),h=Math.cos(n);return t[0]=r*h+a*c,t[1]=i*h+s*c,t[2]=r*-c+a*h,t[3]=i*-c+s*h,t[4]=o,t[5]=u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r*c,t[1]=i*c,t[2]=a*h,t[3]=s*h,t[4]=o,t[5]=u,t},e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=r*c+a*h+o,t[5]=i*c+s*h+u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=e[0],h=e[1],f=e[2],l=e[3],d=e[4],m=e[5];return Math.abs(n-c)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-f)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-l)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-d)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(u-m)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(m))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1],f=n[2],l=n[3],d=n[4],m=n[5];return t[0]=r*c+a*h,t[1]=i*c+s*h,t[2]=r*f+a*l,t[3]=i*f+s*l,t[4]=r*d+a*m+o,t[5]=i*d+s*m+u,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*a-i*r;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-i*s,t[3]=n*s,t):null},e.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*o,t[1]=i*u+s*o,t[2]=r*-o+a*u,t[3]=i*-o+s*u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1];return t[0]=r*o,t[1]=i*o,t[2]=a*u,t[3]=s*u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=a,e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))},e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*o+a*u,t[1]=i*o+s*u,t[2]=r*c+a*h,t[3]=i*c+s*h,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.vec4=e.vec3=e.vec2=e.quat2=e.quat=e.mat4=e.mat3=e.mat2d=e.mat2=e.glMatrix=void 0;var r=d(n(0)),i=d(n(9)),a=d(n(8)),s=d(n(5)),o=d(n(4)),u=d(n(3)),c=d(n(7)),h=d(n(6)),f=d(n(2)),l=d(n(1));function d(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.glMatrix=r,e.mat2=i,e.mat2d=a,e.mat3=s,e.mat4=o,e.quat=u,e.quat2=c,e.vec2=h,e.vec3=f,e.vec4=l}])},function(t,e,n){"use strict";var r=function(){var t,e;try{t=Object.defineProperty,e=Object.defineProperties,t({},"$",{value:0})}catch(n){"__defineGetter__"in Object&&(t=function(t,e,n){return"value"in n&&(t[e]=n.value),"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),t},e=function(e,n){for(var r in n)n.hasOwnProperty(r)&&t(e,r,n[r]);return e})}var n=function(t){for(var n=1,r=arguments.length;n>1,s=n(t[a],e);if(0===s)return[a,a];s<0?r=a+1:i=a-1}return r>i?[i,r]:[r,i]}function v(t,e,n){var r=g(t,e,n);t.splice(r[1],0,e)}function E(t,e,n){return e<=t.length?t:new Array(e-t.length+1).join(n||"0")+t}function T(t){return t instanceof Float32Array?l:t instanceof Int8Array?o:t instanceof Uint8Array?u:t instanceof Int16Array?c:t instanceof Uint16Array?h:t instanceof Uint32Array?f:l}var M,A,L=(a(M={},o,Int8Array),a(M,u,Uint8Array),a(M,c,Int16Array),a(M,h,Uint16Array),a(M,f,Uint32Array),a(M,l,Float32Array),A=M,function(t){return A[t]||Float32Array});function I(t,e,n,r,i){if(t&&e){e.isGeometryData&&(e=e.data);for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return Array.isArray(t)||(t=Object.values(t)),t.reduce((function(t,n,r){return t.then((function(){return e(n,r)}))}),Promise.resolve())}function b(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector3",isVector3:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec3.round(this.elements,this.elements),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},random:function(t){return r.vec3.random(this.elements,t),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r,i={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r=0,function(t){var e=++r;return t?e=t+"_"+e:e+="",e}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},degToRad:function(t){return t*this.DEG2RAD},radToDeg:function(t){return t*this.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};e.a=i},function(t,e,n){"use strict";var r,i=n(0),a=n(1),s=n(5),o=n(10),u=new s.a,c=new s.a,h=a.a.create({className:"Matrix4",isMatrix4:!0,constructor:function(){this.elements=i.mat4.create()},copy:function(t){return i.mat4.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return i.mat4.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this},identity:function(){return i.mat4.identity(this.elements),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this},fromRotationTranslationScaleOrigin:function(t,e,n,r){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this},lookAt:function(t,e,n){return t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this},targetTo:function(t,e,n){t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],h=n[1],f=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=h*m-f*d,g=f*l-o*m,v=o*d-h*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=h*m-f*d)*p+(g=f*l-(o+=1e-7)*m)*g+(v=o*d-h*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new h),this.determinant()<0&&(n.x*=-1),r.copy(this),u.inverse(n),r.scale(u),t.fromMat4(r),i&&i.set(0,0,0),this}});h.prototype.sub=h.prototype.subtract,h.prototype.mul=h.prototype.multiply,e.a=h},function(t,e,n){"use strict";var r=n(1),i=n(12),a=n(4),s=r.a.create({Extends:i.a,className:"Color",isColor:!0,r:{get:function(){return this.x},set:function(t){this.x=t}},g:{get:function(){return this.y},set:function(t){this.y=t}},b:{get:function(){return this.z},set:function(t){this.z=t}},a:{get:function(){return this.w},set:function(t){this.w=t}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;s.superclass.constructor.call(this,t,e,n,r)},toRGBArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t},fromUintArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e]/255,this.elements[1]=t[e+1]/255,this.elements[2]=t[e+2]/255,this.elements[3]=t[e+3]/255,this},fromHEX:function(t){return"number"==typeof t?t=Object(a.padLeft)(t.toString(16),6):("#"===t[0]&&(t=t.slice(1)),3===t.length&&(t=t.replace(/(\w)/g,"$1$1"))),this.elements[0]=parseInt(t.slice(0,2),16)/255,this.elements[1]=parseInt(t.slice(2,4),16)/255,this.elements[2]=parseInt(t.slice(4,6),16)/255,this},toHEX:function(){for(var t="",e=0;e<3;e++)t+=Object(a.padLeft)(Math.floor(255*this.elements[e]).toString(16),2);return t}});e.a=s},function(t,e,n){"use strict";var r=n(1).a.create({constructor:function(t,e,n){this.type=t,this.target=e,this.detail=n,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),i={_listeners:null,on:function(t,e,n){for(var r=this._listeners=this._listeners||{},i=r[t]=r[t]||[],a=0,s=i.length;a0){if(1===arguments.length)return delete this._listeners[t],this;for(var r=0,i=n.length;r0){var o=s.slice(0);if((n=n||new r(i,this,e))._stopped)return!1;for(var u=0;u-1&&s.splice(h,1)}}return!0}return!1}};e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(11),a=n(1),s=n(9),o=new i.a,u=a.a.create({Mixes:s.a,className:"Quaternion",isQuaternion:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.elements=r.quat.fromValues(t,e,n,i)},copy:function(t,e){return r.quat.copy(this.elements,t.elements),e||this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=this.elements;return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n||this.fire("update"),this},set:function(t,e,n,i,a){return r.quat.set(this.elements,t,e,n,i),a||this.fire("update"),this},identity:function(t){return r.quat.identity(this.elements),t||this.fire("update"),this},rotationTo:function(t,e,n){return r.quat.rotationTo(this.elements,t.elements,e.elements),n||this.fire("update"),this},setAxes:function(t,e,n,i){return r.quat.setAxes(this.elements,t.elements,e.elements,n.elements),i||this.fire("update"),this},setAxisAngle:function(t,e,n){return r.quat.setAxisAngle(this.elements,t.elements,e),n||this.fire("update"),this},getAxisAngle:function(t){return r.quat.getAxisAngle(t.elements,this.elements)},add:function(t,e){return r.quat.add(this.elements,this.elements,t.elements),e||this.fire("update"),this},multiply:function(t,e){return r.quat.multiply(this.elements,this.elements,t.elements),e||this.fire("update"),this},premultiply:function(t,e){return r.quat.multiply(this.elements,t.elements,this.elements),e||this.fire("update"),this},scale:function(t,e){return r.quat.scale(this.elements,this.elements,t),e||this.fire("update"),this},rotateX:function(t,e){return r.quat.rotateX(this.elements,this.elements,t),e||this.fire("update"),this},rotateY:function(t,e){return r.quat.rotateY(this.elements,this.elements,t),e||this.fire("update"),this},rotateZ:function(t,e){return r.quat.rotateZ(this.elements,this.elements,t),e||this.fire("update"),this},calculateW:function(t){return r.quat.calculateW(this.elements,this.elements),t||this.fire("update"),this},dot:function(t){return r.quat.dot(this.elements,t.elements)},lerp:function(t,e,n){return r.quat.lerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},slerp:function(t,e,n){return r.quat.slerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},sqlerp:function(t,e,n,i,a,s){return r.quat.sqlerp(this.elements,t.elements,e.elements,n.elements,i.elements,a),s||this.fire("update"),this},invert:function(t){return r.quat.invert(this.elements,this.elements),t||this.fire("update"),this},conjugate:function(t){return r.quat.conjugate(this.elements,this.elements),t||this.fire("update"),this},length:function(){return r.quat.length(this.elements)},squaredLength:function(){return r.quat.squaredLength(this.elements)},normalize:function(t){return r.quat.normalize(this.elements,this.elements),t||this.fire("update"),this},fromMat3:function(t,e){return r.quat.fromMat3(this.elements,t.elements),e||this.fire("update"),this},fromMat4:function(t,e){return o.fromMat4(t),this.fromMat3(o,e),this},exactEquals:function(t){return r.quat.exactEquals(this.elements,t.elements)},equals:function(t){return r.quat.equals(this.elements,t.elements)},fromEuler:function(t,e){var n=.5*t.x,r=.5*t.y,i=.5*t.z,a=t.order||"ZYX",s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),c=Math.cos(r),h=Math.sin(i),f=Math.cos(i),l=this.elements;return"XYZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"YXZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"ZXY"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"ZYX"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"YZX"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f-s*u*h):"XZY"===a&&(l[0]=s*c*f-o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f+s*u*h),e||this.fire("update"),this},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t,this.fire("update")}}});u.prototype.mul=u.prototype.multiply,u.prototype.len=u.prototype.length,u.prototype.sqrLen=u.prototype.squaredLength,e.a=u},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Matrix3",isMatrix3:!0,constructor:function(){this.elements=r.mat3.create()},copy:function(t){return r.mat3.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return r.mat3.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)n[r]=t[e+r];return this},set:function(t,e,n,i,a,s,o,u,c){return r.mat3.set(this.elements,t,e,n,i,a,s,o,u,c),this},identity:function(){return r.mat3.identity(this.elements),this},transpose:function(){return r.mat3.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.adjoint(this.elements,t.elements),this},determinant:function(){return r.mat3.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),r.mat3.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return r.mat3.translate(this.elements,this.elements,t.elements),this},rotate:function(t){return r.mat3.rotate(this.elements,this.elements,t),this},scale:function(t){return r.mat3.scale(this.elements,this.elements,t.elements),this},fromTranslation:function(t){return r.mat3.fromTranslation(this.elements,t.elements),this},fromRotation:function(t){return r.mat3.fromRotation(this.elements,t),this},fromScaling:function(t){return r.mat3.fromScaling(this.elements,t.elements),this},fromQuat:function(t){return r.mat3.fromQuat(this.elements,t.elements),this},normalFromMat4:function(t){return r.mat3.normalFromMat4(this.elements,t.elements),this},fromMat4:function(t){return r.mat3.fromMat4(this.elements,t.elements),this},frob:function(){return r.mat3.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),r.mat3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.mat3.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.mat3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.mat3.equals(t.elements,e.elements)},fromRotationTranslationScale:function(t,e,n,r,i){var a=Math.cos(t),s=Math.sin(t);return this.set(r*a,-i*s,0,r*s,i*a,0,e,n,1),this}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector4",isVector4:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.elements=r.vec4.fromValues(t,e,n,i)},copy:function(t){return r.vec4.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t[3+e]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],this},set:function(t,e,n,i){return r.vec4.set(this.elements,t,e,n,i),this},add:function(t,e){return e||(e=t,t=this),r.vec4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec4.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec4.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec4.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec4.ceil(this.elements,this.elements),this},floor:function(){return r.vec4.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec4.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec4.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec4.round(this.elements,this.elements),this},scale:function(t){return r.vec4.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec4.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec4.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec4.squaredDistance(t.elements,e.elements)},length:function(){return r.vec4.length(this.elements)},squaredLength:function(){return r.vec4.squaredLength(this.elements)},negate:function(){return r.vec4.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec4.inverse(this.elements,t.elements),this},normalize:function(){return r.vec4.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec4.dot(t.elements,e.elements)},lerp:function(t,e){return r.vec4.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return t=t||1,this.elements[0]=Math.random(),this.elements[1]=Math.random(),this.elements[2]=Math.random(),this.elements[3]=Math.random(),this.normalize(),this.scale(t),this},transformMat4:function(t){return r.vec4.transformMat4(this.elements,this.elements,t.elements),this},transformQuat:function(t){return r.vec4.transformQuat(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec4.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r=n(1),i=n(6),a=n(7),s=n(3),o=new a.a,u=i.a.DEG2RAD,c=i.a.RAD2DEG,h=r.a.create({className:"Euler",isEuler:!0,order:"ZYX",constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=new Float32Array([t,e,n]),this.updateDegrees()},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.elements[0]=t.x,this.elements[1]=t.y,this.elements[2]=t.z,this.order=t.order,this.updateDegrees(),this},set:function(t,e,n){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=n,this.updateDegrees(),this},setDegree:function(t,e,n){return this._degX=t,this._degY=e,this._degZ=n,this.updateRadians(),this},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e],this.elements[1]=t[e+1],this.elements[2]=t[e+2],this.updateDegrees(),this},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.elements[0],t[e+1]=this.elements[1],t[e+2]=this.elements[2],t},fromMat4:function(t,e){var n=t.elements,r=n[0],a=n[1],o=n[2],u=n[4],c=n[5],h=n[6],f=n[8],l=n[9],d=n[10];e=e||this.order,this.order=e;var m=i.a.clamp;return"XYZ"===e?(this.elements[1]=Math.asin(m(f,-1,1)),Math.abs(f)<.99999?(this.elements[0]=Math.atan2(-l,d),this.elements[2]=Math.atan2(-u,r)):(this.elements[0]=Math.atan2(h,c),this.elements[2]=0)):"YXZ"===e?(this.elements[0]=Math.asin(-m(l,-1,1)),Math.abs(l)<.99999?(this.elements[1]=Math.atan2(f,d),this.elements[2]=Math.atan2(a,c)):(this.elements[1]=Math.atan2(-o,r),this.elements[2]=0)):"ZXY"===e?(this.elements[0]=Math.asin(m(h,-1,1)),Math.abs(h)<.99999?(this.elements[1]=Math.atan2(-o,d),this.elements[2]=Math.atan2(-u,c)):(this.elements[1]=0,this.elements[2]=Math.atan2(a,r))):"ZYX"===e?(this.elements[1]=Math.asin(-m(o,-1,1)),Math.abs(o)<.99999?(this.elements[0]=Math.atan2(h,d),this.elements[2]=Math.atan2(a,r)):(this.elements[0]=0,this.elements[2]=Math.atan2(-u,c))):"YZX"===e?(this.elements[2]=Math.asin(m(a,-1,1)),Math.abs(a)<.99999?(this.elements[0]=Math.atan2(-l,c),this.elements[1]=Math.atan2(-o,r)):(this.elements[0]=0,this.elements[1]=Math.atan2(f,d))):"XZY"===e?(this.elements[2]=Math.asin(-m(u,-1,1)),Math.abs(u)<.99999?(this.elements[0]=Math.atan2(h,c),this.elements[1]=Math.atan2(f,r)):(this.elements[0]=Math.atan2(-l,d),this.elements[1]=0)):s.a.warn("Euler fromMat4() unsupported order: "+e),this.updateDegrees(),this},fromQuat:function(t,e){return o.fromQuat(t),this.fromMat4(o,e)},updateDegrees:function(){return this._degX=this.elements[0]*c,this._degY=this.elements[1]*c,this._degZ=this.elements[2]*c,this},updateRadians:function(){return this.elements[0]=this._degX*u,this.elements[1]=this._degY*u,this.elements[2]=this._degZ*u,this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*u}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*u}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*u}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*c}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*c}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*c}}});e.a=h},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector2",isVector2:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.elements=r.vec2.fromValues(t,e)},copy:function(t){return r.vec2.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],this},set:function(t,e){return r.vec2.set(this.elements,t,e),this},add:function(t,e){return e||(e=t,t=this),r.vec2.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec2.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec2.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec2.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec2.ceil(this.elements,this.elements),this},floor:function(){return r.vec2.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec2.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec2.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec2.round(this.elements,this.elements),this},scale:function(t){return r.vec2.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec2.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec2.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec2.squaredDistance(t.elements,e.elements)},length:function(){return r.vec2.length(this.elements)},squaredLength:function(){return r.vec2.squaredLength(this.elements)},negate:function(){return r.vec2.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec2.inverse(this.elements,t.elements),this},normalize:function(){return r.vec2.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec2.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec2.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec2.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return r.vec2.random(this.elements,t),this},transformMat3:function(t){return r.vec2.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec2.transformMat4(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec2.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec2.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){function r(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:4;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.indices=e,this.mode=n,this.attrs=[],this.attrIndexMap={}}return i(t,null,[{key:"cp",value:function(t){return t}},{key:"minus",value:function(t,e){return t-e}},{key:"plus",value:function(t,e){return t+e}},{key:"pp",value:function(t,e,n,r){return r-e-n+t}},{key:"depp",value:function(t,e,n,r){return e+n-t+r}},{key:"ATTR",get:function(){return s}},{key:"ATTR_NAME_ID",get:function(){return u}}]),i(t,[{key:"getAttrLength",value:function(){return this.attrs[0].data.length/this.attrs[0].itemCount}},{key:"attrIdToName",value:function(t){return o[t]||"OTHER"}},{key:"addAttr",value:function(t,e,n){s[t]?(this.attrIndexMap[t]=this.attrs.length,n||(n=f[t])):n||(n=1),this.attrs.push({name:t,itemCount:n,data:e})}},{key:"getAttr",value:function(t){if(this.attrIndexMap[t])return this.attrs[this.attrIndexMap[t]];for(var e=this.attrs.length-1;e>=0;e--){var n=this.attrs[e];if(n.name===t)return n}}},{key:"cal",value:function(t,e,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a=0;c--)o[u+c]=n.apply(null,i.map((function(t){return s[t*r.itemCount+c]})))}))}},{key:"quantize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attrs.forEach((function(e){if("JOINT"!==e.name&&0!=t[e.name]){var n=a.encode(e.data,t[e.name]||12);e.quantizationBit=n.quantizationBit,e.min=n.min,e.max=n.max,e.data=n.data}}))}},{key:"dequantize",value:function(){this.attrs.forEach((function(t){t.quantizationBit&&(t.data=a.decode(t.data,t.quantizationBit,t.min,t.max))}))}},{key:"convertTypedArray",value:function(){!this.indices||this.indices instanceof Array||(this.indices=Array.from(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array||t.data instanceof Float32Array||(t.data=Array.from(t.data))}))}},{key:"clearEBAttrs",value:function(){delete this.clers,delete this.holes,delete this.handles}},{key:"convertToTypedArray",value:function(){this.indices instanceof Array&&(this.getAttrLength()>65535?this.indices=new Uint32Array(this.indices):this.indices=new Uint16Array(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array&&(t.data=new Float32Array(t.data))}))}},{key:"prepareToWorkerSend",value:function(){return this.clearEBAttrs(),this.convertToTypedArray(),this.getAllBuffers()}},{key:"clone",value:function(){var e=new t(Array.from(this.indices),this.mode);return Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=Array.from(e.data),e})),e}},{key:"cloneStruct",value:function(){var e=new t;return e.mode=this.mode,this.indices&&(e.indices=[]),Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=[],e})),e}},{key:"toHilo3dGeometry",value:function(t,e){var n=e||new t.Geometry;return this.indices&&(this.indices.BYTES_PER_ELEMENT?n.indices=new t.GeometryData(this.indices,1):this.getAttrLength()>65535?n.indices=new t.GeometryData(new Uint32Array(this.indices),1):n.indices=new t.GeometryData(new Uint16Array(this.indices),1)),this.attrs.forEach((function(e){var r=c[e.name];r&&(e.data.BYTES_PER_ELEMENT?n[r]=new t.GeometryData(e.data,e.itemCount):n[r]=new t.GeometryData(new Float32Array(e.data),e.itemCount))})),n}},{key:"getAllBuffers",value:function(){var t=[];return this.indices.BYTES_PER_ELEMENT&&t.push(this.indices.buffer),this.attrs.forEach((function(e){e.data&&e.data.BYTES_PER_ELEMENT&&t.push(e.data.buffer)})),t}}],[{key:"fromGLTFPrimitive",value:function(e){var n=new t(e.indices,e.mode),r=e.attributes,i=0;for(var a in r.POSITION&&(i=r.POSITION.length/3),r)if(s[a]){var o=f[s[a]];i&&(o=r[a].length/i),n.addAttr(s[a],r[a],o)}else console.warn("Dont support attribute",a);return n}},{key:"fromHilo3dGeometry",value:function(e){var n=new t(e.indices.data,e.mode);for(var r in h)e[r]&&n.addAttr(h[r],e[r].data,e[r].size);return n}}]),t}();t.exports=l},function(t,e){var n={};function r(t){return n[t]||(n[t]=Math.pow(2,t)-1),n[t]}t.exports={cal:function(t,e,n,i){var a=r(i),s=n-e;return Math.round((t-e)/s*a)},encode:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=t.length,i=r(e),a=1/0,s=-1/0,o=0;o1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8,s=t.length,o=r(a),u=i-n||1,c=0;c1&&void 0!==arguments[1]?arguments[1]:8,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=t.length,s=r(e),o=i-n,u=new Float32Array(a),c=0;c1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=t.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return t instanceof Uint8Array&&(e=t.byteOffset,t=t.buffer),function(t){return new u[t.type](t).decompress()}(function(t,e){var n=new Uint8Array(t,e,4);if(65!==n[0]||77!==n[1]||67!==n[2])throw new Error("The file is not AMC format!");var r=c[n[3]].read(t,e+4);return r.geometry.type=n[3],r.geometry}(t,e))}var f,l=null,d=null;function m(t,e){return!l&&o()?(l=new s({wasmURL:t,memPages:e}),d=l.init()):d||Promise.resolve()}function _(t,e,n){if(l||m(e,n),!l||!l.isReady)return h(t);try{return l.decompress(t)}catch(e){return console.warn("wasm decompress error",e),h(t)}}var p=null;function g(t){return t=t||"https://g.alicdn.com/hilo/amc/0.1.27/worker.js",p||(!1===f||"undefined"==typeof Worker?Promise.reject("dont support web worker"):p=/^(?:http|blob|data:|\/\/)/.test(t)?new Promise((function(e,n){var r=new XMLHttpRequest;r.addEventListener("load",(function(){if("undefined"==typeof URL||"undefined"==typeof Blob)f=new Worker("data:application/javascript, ".concat(this.responseText));else{var t=URL.createObjectURL(new Blob([this.responseText]));f=new Worker(t)}f.onerror=function(t){console.log("web worker error",t),f=!1,n(t)},e(f)})),r.addEventListener("error",(function(t){return n(t)})),r.open("get",t,!0),r.send()})):new Promise((function(e,n){(f=new Worker(t)).onerror=function(t){console.log("web worker init error",t),f=!1,n(t)},e(f)})))}var v=0;function E(t,e,n,i){return e=e&&o(),t=new Uint8Array(t),g(i).then((function(i){return new Promise((function(a,s){var o=v++,u=function(e){if(e.data.id===o)if(i.removeEventListener("message",u),u=null,e.data.data){var n=e.data.data;n.constructor=r,n.__proto__=r.prototype,a(n)}else a(h(t))};i.addEventListener("message",u),i.postMessage({id:o,data:t,useWASM:e,wasmURL:n},[t.buffer])}))})).catch((function(r){return e?_(t,n):h(t)}))}t.exports={initWASM:m,initWorker:g,decompress:function(t,e,n){var r=o();return!r||t.byteLength>1048576?E(t,r,e,n):r?Promise.resolve(_(t,e)):Promise.resolve(h(t))},decompressWithJS:h,decompressWithWASM:_,decompressWithWorker:E,destory:function(){f&&(f.terminate(),f=null,p=null),l&&(l=null,d=null)}}},function(t,e,n){function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e=0;n-=2)e[t[n]]=t[n-1]}},{key:"mapBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex,i=this.currentVertex-n+1,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r,r=i,e[this.prevCorner(t[a])]=i++;this.currentVertex-=n}},{key:"mapHoleBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex-n+1,i=r,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r++,e[this.prevCorner(t[a])]=a?r:i;this.currentVertex-=n}},{key:"fixNegativeIndex",value:function(t){for(var e=t,n=this.indices;n[t]<0;){if(e===-n[-n[t]]||n[t]===n[-n[t]]){console.warn("dead loop bug!!"),n[s]=0;break}n[t]=n[-n[t]]}}},{key:"fixIndicesAndReadVertice",value:function(){for(var t,e=this.indices,n=this.handlesMap,r=this.clers,i=r.length,a=-1,s=[],u=0,c=0;u1&&void 0!==arguments[1]?arguments[1]:-1;if(!this.readedVertexMap[t]&&(this.readedVertexMap[t]=1,!this.noParallelogramPrediction)){var n=this.indices,r=this.geometry;-1===e?void 0!==this.lastReadVertexIndex&&r.cal(r,t,a.plus,this.lastReadVertexIndex,t):r.cal(r,t,a.depp,n[e],n[this.prevCorner(e)],n[this.nextCorner(e)],t),this.lastReadVertexIndex=t}}},{key:"markCorner",value:function(t,e){var n=this.indices;void 0===n[this.nextCorner(t)]&&(n[this.nextCorner(t)]=-this.prevCorner(e[0])),void 0===n[this.prevCorner(t)]&&(n[this.prevCorner(t)]=-this.nextCorner(e[e.length-1]))}},{key:"onFaceC",value:function(t){var e=this.indices,n=3*this.currentFace,r=this.currentVertex--;e[n]=r;var i=t.pop();return e[this.nextCorner(i)]=r,e[this.prevCorner(i)]=-this.nextCorner(t[t.length-1]),i=t.shift(),e[this.prevCorner(i)]=r,e[this.nextCorner(i)]=-this.prevCorner(t[0]),t.push(n),t}},{key:"onFaceL",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.unshift(e+2),t.push(e),t}},{key:"onFaceF",value:function(t,e){return t&&this.mapBoundary(t),this.onFaceE(null,e)}},{key:"onFaceE",value:function(t,e){var n=3*this.currentFace;return t&&e.push(t),[n+2,n+1,n]}},{key:"onFaceR",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.push(e+1,e),t}},{key:"onHandleEnd",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=this.handlesMap[this.currentFace],s=e.splice(0,t);return e.shift(),n.push(s),r[this.nextCorner(a)]=-(i+1),r[this.prevCorner(a)]=-this.nextCorner(s[s.length-1]),r[i]=-this.prevCorner(s[0]),e.push(i),e}},{key:"onHandleStart",value:function(t,e){for(var n,i=this.indices,a=3*this.currentFace,s=this.handlesMap[this.currentFace],o=e.length-1;o>=0;o--){var u=e[o].indexOf(s);if(u>=0){var c,h=(n=e.splice(o,1)[0]).splice(0,u);n.shift(),(c=n).push.apply(c,r(h));break}}return i[this.nextCorner(s)]=-(a+1),i[this.prevCorner(s)]=-this.nextCorner(n[n.length-1]),i[a]=-this.prevCorner(t[0]),(t=n.concat(t)).push(a),t}},{key:"onFaceS",value:function(t,e,n){var r=this.handlesMap,i=this.indices,a=3*this.currentFace;if(r[this.currentFace]){this.markCorner(t.pop(),t);var s=t.indexOf(r[this.currentFace]);t=s>=0?this.onHandleEnd(s,t,n):this.onHandleStart(t,n)}else{var o=t.pop();this.markCorner(o,t),i[a]=-this.nextCorner(o);var u=e.pop();this.markCorner(u.pop(),u),(t=u.concat(t)).push(a)}return t}},{key:"onFaceM",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=t.splice(0,this.holes[this.currentHole--]);this.mapHoleBoundary(a);var s=r[this.prevCorner(a[0])];r[i]=s;var o=t.pop();return r[this.prevCorner(o)]=-this.nextCorner(t[t.length-1]),r[this.nextCorner(o)]=s,o=t.shift(),r[this.prevCorner(o)]=s,r[this.nextCorner(o)]=-this.prevCorner(t[0]),t.push(i),t}},{key:"decompress",value:function(){this.readedVertexMap=new Uint8Array(this.vertexCount);var t=this.faceCount,e=this.indices=new Array(3*t);this.currentFace=t-1,this.currentVertex=this.vertexCount-1,this.currentHole=this.holes.length-1;for(var n,r=this.clers,i=[],a=[];this.currentFace>=0;){var s="onFace"+u[r[this.currentFace]];this[s]?n=this[s](n,i,a):console.warn("has no ".concat(s)),this.currentFace--}return this.mapBoundary(n),this.fixIndicesAndReadVertice(this.indices),this.geometry.indices=e,this.geometry.dequantize(),this.geometry}},{key:"_onDecompressFace",value:function(t,e){this.onDecompressFace&&this.onDecompressFace(t,e)}}])&&i(e.prototype,n),t}();t.exports=c},function(t,e){var n={C:0,R:1,L:2,S:3,E:4,M:5,F:6},r=[];for(var i in n)r[n[i]]=i;n.map=r,t.exports=n},function(t,e,n){var r=n(0);function i(t,e,n,r){return new t(e.slice(n,n+r*t.BYTES_PER_ELEMENT))}t.exports={read:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(t),a=new r,s=function(t,e){var n={};return n.version=t.getUint8(e++),n.faceCount=t.getUint32(e,!0),e+=4,n.vertexCount=t.getUint32(e,!0),e+=4,n.attrCount=t.getUint8(e++),n.noParallelogramPrediction=t.getUint8(e++),n.holesCount=t.getUint16(e,!0),e+=2,n.handlesCount=t.getUint16(e,!0),e+=2,n.headerBytes=15,n}(n,e);return e+=s.headerBytes,a.mode="CLERS",e=function(t,e,n,r){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wasmURL=e.wasmURL||"https://ossgw.alicdn.com/tmall-c3/tmx/70b8d82ccf33e97a124e54c2d6a3e0c7.wasm",this.memPages=e.memPages||256,this.memPages<256&&(this.memPages=256),this.isReady=!1}var e,n;return e=t,(n=[{key:"initASMJS",value:function(){this.isReady=!0,this.dv=new DataView(HEAP8.buffer),this.heap8=HEAP8,this.ins={exports:{__Z7AMCinitj:Module.__Z7AMCinitj,__Z12AMDecompressv:Module.__Z12AMDecompressv}}}},{key:"init",value:function(){var t=this,e=this.memory=new WebAssembly.Memory({initial:this.memPages});this.dv=new DataView(e.buffer);var n=this.heap8=new Uint8Array(e.buffer),r={global:{NaN:5,Infinity:6},env:{memoryBase:0,memory:e,_malloc:function(){return 2097152},_memset:function(t,e,r){return n.fill(e,t,t+r),t},_printf:function(t,e){for(var r=t;n[r];)r++;var i=String.fromCharCode.apply(String,function(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e65536?new Uint32Array(d):new Uint16Array(d);var m=new i(d);return h.forEach((function(t){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(t,3),r=n[0],i=n[1],a=n[2],s=new Float32Array(e.buffer.slice(a,a+u*i*4));m.addAttr(m.attrIdToName(r),s,i)})),m}}])&&r(e.prototype,n),t}();t.exports=a},function(t,e){var n;t.exports=function(){return void 0===n&&(n=function(){if("undefined"==typeof WebAssembly||"undefined"==typeof fetch||function(){if(!/iPad|iPhone|iPod/i.test(navigator.userAgent))return!1;if(/OS (\d+)_(\d+)_?(\d+)?/i.test(navigator.userAgent)){var t=Number(RegExp.$1),e=Number(RegExp.$2);if(11===t&&e>=3||t>11)return!1}return!0}())return!1;try{var t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)}catch(t){return console.log("err while check WebAssembly",t),!1}}()),n}}])},function(t,e,n){"use strict";var r=n(34),i=n.n(r),a=n(1),s=n(5),o=a.a.create({className:"Ray",isRay:!0,origin:{get:function(){return this._origin},set:function(t){this._origin=t,this._ray.origin=t.elements}},direction:{get:function(){return this._direction},set:function(t){this._direction=t,this._ray.direction=t.elements}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._ray=new i.a,this.origin=t.origin||new s.a(0,0,0),this.direction=t.direction||new s.a(0,0,-1)},set:function(t,e){return this.origin=t,this.direction=e,this},copy:function(t){this.origin.copy(t.origin),this.direction.copy(t.direction)},clone:function(){return new this.constructor({origin:this.origin.clone(),direction:this.direction.clone()})},fromCamera:function(t,e,n,r,i){t.isPerspectiveCamera?(t.worldMatrix.getTranslation(this.origin),this.direction.set(e,n,0),this.direction.copy(t.unprojectVector(this.direction,r,i)),this.direction.sub(this.origin).normalize()):t.isOrthographicCamera&&(this.origin.set(e,n,(t.near+t.far)/(t.near-t.far)),this.origin.copy(t.unprojectVector(this.origin,r,i)),this.direction.set(0,0,-1).transformDirection(t.worldMatrix).normalize())},transformMat4:function(t){this.origin.transformMat4(t),this.direction.transformDirection(t).normalize()},sortPoints:function(t,e){var n=this;e?t.sort((function(t,r){return n.squaredDistance(t[e])-n.squaredDistance(r[e])})):t.sort((function(t,e){return n.squaredDistance(t)-n.squaredDistance(e)}))},squaredDistance:function(t){return this.origin.squaredDistance(t)},distance:function(t){return this.origin.distance(t)},intersectsSphere:function(t,e){var n=this._ray.intersectsSphere(t,e);return this._getRes(n)},intersectsPlane:function(t,e){var n=this._ray.intersectsPlane(t,e);return this._getRes(n)},intersectsTriangle:function(t){var e=this._ray.intersectsTriangle(t);return this._getRes(e)},intersectsBox:function(t){var e=this._ray.intersectsBox(t);return this._getRes(e)},intersectsTriangleCell:function(t,e){var n=this._ray.intersectsTriangleCell(t,e);return this._getRes(n)},_getRes:function(t){return t?new s.a(t[0],t[1],t[2]):null}});e.a=o},function(t,e,n){"use strict";var r=n(0),i=n(1),a=n(9),s=n(5),o=i.a.create({Mixes:a.a,Extends:s.a,className:"Vector3Notifier",isVector3Notifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this.fire("update"),this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this.fire("update"),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this.fire("update"),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this.fire("update"),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this.fire("update"),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this.fire("update"),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this.fire("update"),this},round:function(){return r.vec3.round(this.elements,this.elements),this.fire("update"),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this.fire("update"),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this.fire("update"),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this.fire("update"),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this.fire("update"),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this.fire("update"),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this.fire("update"),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this.fire("update"),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},random:function(t){return r.vec3.random(this.elements,t),this.fire("update"),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this.fire("update"),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this.fire("update"),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this.fire("update"),this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this.fire("update"),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}}});e.a=o},function(t,e){t.exports="#define GLSLIFY 1\n#define HILO_FRONT_SIDE 1028\n#define HILO_BACK_SIDE 1029\n#define HILO_FRONT_AND_BACK_SIDE 1032\n#define HILO_PI 3.141592653589793\n#define HILO_INVERSE_PI 0.3183098861837907"},function(t,e,n){"use strict";var r=n(1),i=n(5),a=r.a.create({className:"Plane",isPlane:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=t,this.distance=e},copy:function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},clone:function(){return new this.constructor(this.normal.clone(),this.distance)},set:function(t,e,n,r){return this.normal.set(t,e,n),this.distance=r,this},normalize:function(){var t=1/this.normal.length();return this.normal.scale(t),this.distance*=t,this},distanceToPoint:function(t){return this.normal.dot(t)+this.distance},projectPoint:function(t){return(new i.a).copy(this.normal).scale(-this.distanceToPoint(t)).add(t)}});e.a=a},function(t,e,n){"use strict";var r=n(1),i=n(5),a=new i.a,s=r.a.create({className:"Sphere",isSphere:!0,radius:0,constructor:function(t){Object.assign(this,t),this.center||(this.center=new i.a(0,0,0))},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},fromPoints:function(t){for(var e=this.center,n=0,r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this.fire("update"),this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this.fire("update"),this},identity:function(){return i.mat4.identity(this.elements),this.fire("update"),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this.fire("update"),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this.fire("update"),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this.fire("update"),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},premultiply:function(t){return this.multiply(t,this),this.fire("update"),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this.fire("update"),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this.fire("update"),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this.fire("update"),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this.fire("update"),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this.fire("update"),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this.fire("update"),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this.fire("update"),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this.fire("update"),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this.fire("update"),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this.fire("update"),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this.fire("update"),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this.fire("update"),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this.fire("update"),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},fromRotationTranslationScaleOrigin:function(t,e,n,r,a){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),a||this.fire("update"),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this.fire("update"),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this.fire("update"),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this.fire("update"),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this.fire("update"),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this.fire("update"),this},lookAt:function(t,e,n){return t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},targetTo:function(t,e,n){t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],u=n[1],c=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=u*m-c*d,g=c*l-o*m,v=o*d-u*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=u*m-c*d)*p+(g=c*l-(o+=1e-7)*m)*g+(v=o*d-u*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this.fire("update"),this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new u.a),this.determinant()<0&&(n.x*=-1),r.copy(this),h.inverse(n),r.scale(h),t.fromMat4(r),i&&i.set(0,0,0),this}});e.a=l},function(t,e,n){"use strict";var r=n(1),i=n(9),a=n(6),s=n(13),o=a.a.DEG2RAD,u=a.a.RAD2DEG,c=r.a.create({Mixes:i.a,Extends:s.a,className:"EulerNotifier",isEulerNotifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;s.a.call(this,t,e,n)},updateDegrees:function(){return c.superclass.updateDegrees.call(this),this.fire("update"),this},updateRadians:function(){return c.superclass.updateRadians.call(this),this.fire("update"),this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*o,this.fire("update")}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*o,this.fire("update")}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*o,this.fire("update")}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*u,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*u,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*u,this.fire("update")}}});e.a=c},function(t,e,n){"use strict";var r=n(1),i=n(19),a=r.a.create({className:"Frustum",isFrustum:!0,constructor:function(){this.planes=[];for(var t=6;t--;)this.planes.push(new i.a)},copy:function(t){var e=t.planes;return this.planes.forEach((function(t,n){t.copy(e[n])})),this},clone:function(){var t=new this.constructor;return t.copy(this),t},fromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],s=n[3],o=n[4],u=n[5],c=n[6],h=n[7],f=n[8],l=n[9],d=n[10],m=n[11],_=n[12],p=n[13],g=n[14],v=n[15];return e[0].set(s-r,h-o,m-f,v-_).normalize(),e[1].set(s+r,h+o,m+f,v+_).normalize(),e[2].set(s+i,h+u,m+l,v+p).normalize(),e[3].set(s-i,h-u,m-l,v-p).normalize(),e[4].set(s-a,h-c,m-d,v-g).normalize(),e[5].set(s+a,h+c,m+d,v+g).normalize(),this},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n) 0.0) {\n attenuation *= max(min(1.0 - pow( distance / range, 4.0 ), 1.0), 0.0);\n }\n #else\n attenuation = 1.0/(info.x + info.y * distance + info.z * distance * distance);\n #endif\n\n return attenuation;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nfloat unpackFloat(vec4 rgbaDepth) {\n const vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n float depth = dot(rgbaDepth, bitShift);\n return depth;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nbool isOutOfRange(vec2 pos) {\n if (pos.x < 0.0 || pos.x > 1.0 || pos.y < 0.0 || pos.y > 1.0) {\n return true;\n }\n return false;\n}\n\nfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float bias, vec3 fragPos, mat4 lightSpaceMatrix) {\n vec4 fragPosLightSpace = lightSpaceMatrix * vec4(fragPos, 1.0);\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n projCoords = projCoords * 0.5 + 0.5;\n if (isOutOfRange(projCoords.xy)) {\n return 1.0;\n }\n float currentDepth = projCoords.z;\n float shadow = 0.0;\n vec2 texelSize = 1.0 / shadowMapSize;\n for (int x = -1; x <= 1; ++x) {\n for (int y = -1; y <= 1; ++y) {\n vec2 pos = projCoords.xy + vec2(x, y) * texelSize;\n if (isOutOfRange(pos)) {\n shadow += 1.0;\n } else {\n float pcfDepth = texture2D(shadowMap, pos).r;\n shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n }\n }\n }\n return 1.0 - shadow / 9.0;\n}\n\nfloat getShadow(samplerCube shadowMap, float bias, vec3 lightPos, vec3 position, vec2 camera, mat4 lightSpaceMatrix) {\n vec4 distanceVec = lightSpaceMatrix * vec4(position, 1.0) - lightSpaceMatrix * vec4(lightPos, 1.0);\n float currentDistance = length(distanceVec);\n vec3 direction = normalize(distanceVec).xyz;\n\n float shadow = 0.0;\n const float samples = 2.0;\n const float offset = 0.01;\n const float step = offset / (samples * 0.5);\n for(float x = -offset; x < offset; x +=step)\n {\n for(float y = -offset; y < offset; y +=step)\n {\n for(float z = -offset; z < offset; z +=step)\n {\n float closestDistance = camera[0] + (camera[1] - camera[0]) * unpackFloat(textureCube(shadowMap, direction + vec3(x, y, z)));\n if (closestDistance == camera[0]) {\n continue;\n }\n else if(currentDistance - bias > closestDistance)\n shadow += 1.0;\n }\n }\n }\n shadow /= (samples * samples * samples);\n\n return 1.0 - shadow;\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(64)+"\n\n#ifdef HILO_HAS_LIGHT\n #ifdef HILO_HAS_SPECULAR\n uniform float u_shininess;\n #ifdef HILO_SPECULAR_MAP\n uniform HILO_SAMPLER_2D u_specular;\n #else\n uniform vec4 u_specular;\n #endif\n #endif\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #else\n uniform vec4 u_emission;\n #endif\n #ifdef HILO_AMBIENT_MAP\n uniform HILO_SAMPLER_2D u_ambient;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform mat4 u_specularEnvMatrix;\n uniform float u_reflectivity;\n uniform float u_refractRatio;\n uniform float u_refractivity;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_FIX_MAX_BUG\n float hilo_max(float a, float b){\n if (a > b) {\n return a;\n }\n return b;\n }\n #define HILO_MAX(a, b) hilo_max(a, b);\n#else\n #define HILO_MAX(a, b) max(a, b);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_DIFFUSE_MAP)\n diffuse = HILO_TEXTURE_2D(u_diffuse);\n#elif defined(HILO_DIFFUSE_CUBE_MAP)\n diffuse = textureCube(u_diffuse, v_position);\n#elif defined(HILO_HAS_COLOR)\n diffuse = v_color;\n#else\n diffuse = u_diffuse;\n#endif\ncolor.a = diffuse.a;"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_LIGHT\n vec3 lightDiffuse = vec3(0, 0, 0);\n vec3 lightAmbient = vec3(0, 0, 0);\n vec3 viewPos = vec3(0, 0, 0);\n\n #ifdef HILO_AMBIENT_MAP\n lightAmbient = HILO_TEXTURE_2D(u_ambient).rgb;\n #else\n lightAmbient = diffuse.rgb;\n #endif\n\n #ifdef HILO_HAS_SPECULAR\n vec3 lightSpecular = vec3(0, 0, 0);\n #ifdef HILO_SPECULAR_MAP\n vec4 specular = HILO_TEXTURE_2D(u_specular);\n #else\n vec4 specular = u_specular;\n #endif\n #endif\n \n #ifdef HILO_EMISSION_MAP\n vec4 emission = HILO_TEXTURE_2D(u_emission);\n #else\n vec4 emission = u_emission;\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = -u_directionalLightsInfo[i];\n\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n\n float diff = getDiffuse(normal, lightDir);\n lightDiffuse += diff * u_directionalLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * u_directionalLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = -u_spotLightsDir[i];\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, normalize(distanceVec));\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n\n lightDiffuse += intensity * attenuation * shadow * diff * u_spotLightsColor[i];\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += intensity * attenuation * shadow * spec * u_spotLightsColor[i];\n #endif\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0;i < HILO_POINT_LIGHTS;i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, lightDir);\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n lightDiffuse += diff * attenuation * u_pointLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * attenuation * u_pointLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n #ifndef HILO_HAS_SPECULAR\n vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);\n #endif\n vec3 viewDir = normalize(vec3(0, 0, 0) - v_fragPos);\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuse.rgb, specular.rgb, sqrt(2.0/(u_shininess+2.0)), normal, viewDir, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_AMBIENT_LIGHTS\n color.rgb += u_ambientLightsColor * lightAmbient;\n #endif\n\n #if defined(HILO_SPECULAR_ENV_MAP) && defined(HILO_HAS_SPECULAR)\n vec3 I = normalize(v_fragPos - viewPos);\n if (u_reflectivity > 0.0) {\n vec3 R = reflect(I, normal);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_reflectivity;\n }\n if (u_refractivity > 0.0) {\n vec3 R = refract(I, normal, u_refractRatio);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_refractivity;\n }\n #endif\n\n color.rgb += lightDiffuse * diffuse.rgb;\n #ifdef HILO_HAS_SPECULAR\n color.rgb += lightSpecular * specular.rgb;\n #endif\n\n color.rgb += emission.rgb;\n#else\n color.rgb = diffuse.rgb;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_FOG\n float fogFactor = 1.0;\n\n #ifdef HILO_FOG_LINEAR\n fogFactor = (u_fogInfo.y - v_dist)/(u_fogInfo.y - u_fogInfo.x);\n #elif defined(HILO_FOG_EXP)\n fogFactor = exp(-abs(u_fogInfo * v_dist));\n #elif defined(HILO_FOG_EXP2)\n fogFactor = exp(-(u_fogInfo * v_dist) * (u_fogInfo * v_dist)); \n #endif\n \n fogFactor = clamp(fogFactor, 0.0, 1.0);\n color = mix(u_fogColor, color, fogFactor);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n uniform mat4 u_positionDecodeMat;\n #endif\n #ifdef HILO_NORMAL_QUANTIZED\n uniform mat4 u_normalDecodeMat;\n #endif\n #ifdef HILO_UV_QUANTIZED\n uniform mat3 u_uvDecodeMat;\n #endif\n #ifdef HILO_UV1_QUANTIZED\n uniform mat3 u_uv1DecodeMat;\n #endif\n\n vec2 unQuantize(vec2 data, mat3 decodeMat) {\n vec3 result = vec3(data, 1.0);\n result = decodeMat * result;\n return result.xy;\n }\n\n vec3 unQuantize(vec3 data, mat4 decodeMat) {\n vec4 result = vec4(data, 1.0);\n result = decodeMat * result;\n return result.xyz;\n }\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n attribute vec4 a_skinIndices;\n attribute vec4 a_skinWeights;\n #ifdef HILO_JOINT_MAT_MAP\n uniform sampler2D u_jointMatTexture;\n uniform vec2 u_jointMatTextureSize;\n mat4 getJointMat(float index) {\n index *= 4.0;\n float x = float(mod(index, u_jointMatTextureSize.x));\n float y = float(floor(index / u_jointMatTextureSize.x));\n float dx = 1.0 / float(u_jointMatTextureSize.x);\n float dy = 1.0 / float(u_jointMatTextureSize.y);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(u_jointMatTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(u_jointMatTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(u_jointMatTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(u_jointMatTexture, vec2(dx * (x + 3.5), y));\n mat4 mat = mat4(v1, v2, v3, v4);\n return mat;\n }\n\n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * getJointMat(indices.x);\n mat += weights.y * getJointMat(indices.y);\n mat += weights.z * getJointMat(indices.z);\n mat += weights.w * getJointMat(indices.w);\n return mat;\n }\n #else\n uniform mat4 u_jointMat[HILO_JOINT_COUNT];\n \n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * u_jointMat[int(indices.x)];\n mat += weights.y * u_jointMat[int(indices.y)];\n mat += weights.z * u_jointMat[int(indices.z)];\n mat += weights.w * u_jointMat[int(indices.w)];\n return mat;\n }\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n attribute vec2 a_texcoord0;\n varying vec2 v_texcoord0;\n #ifdef HILO_UV_MATRIX\n uniform mat3 u_uvMatrix;\n #endif\n#endif\n\n#ifdef HILO_HAS_TEXCOORD1\n attribute vec2 a_texcoord1;\n varying vec2 v_texcoord1;\n #ifdef HILO_UV_MATRIX1\n uniform mat3 u_uvMatrix1;\n #endif\n#endif\n\n#ifdef HILO_DIFFUSE_CUBE_MAP\n varying vec3 v_position;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n attribute vec3 a_normal;\n uniform mat3 u_normalMatrix;\n varying vec3 v_normal;\n\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n attribute vec4 a_tangent;\n varying mat3 v_TBN;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n uniform mat4 u_modelViewMatrix;\n #ifdef HILO_HAS_FOG\n varying float v_dist;\n #endif\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS) \n varying vec3 v_fragPos;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n uniform float u_morphWeights[HILO_MORPH_TARGET_COUNT];\n\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition0;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal0;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent0;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition1;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal1;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent1;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition2;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal2;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent2;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition3;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal3;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent3;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition4;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal4;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent4;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition5;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal5;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent5;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition6;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal6;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent6;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition7;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal7;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent7;\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n attribute vec3 a_color;\n #elif HILO_COLOR_SIZE == 4\n attribute vec4 a_color;\n #endif\n varying vec4 v_color;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n varying float v_fragDepth;\n #else\n uniform float u_logDepth;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n v_color = vec4(a_color, 1.0);\n #elif HILO_COLOR_SIZE == 4\n v_color = a_color;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n pos.xyz = unQuantize(pos.xyz, u_positionDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD0) && defined(HILO_UV_QUANTIZED)\n uv = unQuantize(uv, u_uvDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD1) && defined(HILO_UV1_QUANTIZED)\n uv1 = unQuantize(uv1, u_uv1DecodeMat);\n #endif\n #if defined(HILO_HAS_NORMAL) && defined(HILO_NORMAL_QUANTIZED)\n normal = unQuantize(normal, u_normalDecodeMat);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent0 * u_morphWeights[0];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent1 * u_morphWeights[1];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent2 * u_morphWeights[2];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent3 * u_morphWeights[3];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent4 * u_morphWeights[4];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent5 * u_morphWeights[5];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent6 * u_morphWeights[6];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent7 * u_morphWeights[7];\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n mat4 skinMat = getJointMat(a_skinWeights, a_skinIndices);\n pos = skinMat * pos;\n\n #ifdef HILO_HAS_NORMAL\n normal = mat3(skinMat) * normal;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n #ifdef HILO_UV_MATRIX\n v_texcoord0 = (u_uvMatrix * vec3(uv, 1.0)).xy;\n #else\n v_texcoord0 = uv;\n #endif\n#endif\n#ifdef HILO_HAS_TEXCOORD1\n #ifdef HILO_UV_MATRIX1\n v_texcoord1 = (u_uvMatrix1 * vec3(uv1, 1.0)).xy;\n #else\n v_texcoord1 = uv1;\n #endif\n#endif\n#ifdef HILO_DIFFUSE_CUBE_MAP\n v_position = pos.xyz;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n vec3 T = normalize(u_normalMatrix * tangent.xyz);\n vec3 N = normalize(u_normalMatrix * normal);\n T = normalize(T - dot(T, N) * N);\n vec3 B = cross(N, T) * tangent.w;\n v_TBN = mat3(T, B, N);\n #endif\n v_normal = normalize(u_normalMatrix * normal);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n vec3 fragPos = (u_modelViewMatrix * pos).xyz;\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS)\n v_fragPos = fragPos;\n #endif\n\n #ifdef HILO_HAS_FOG\n v_dist = length(fragPos);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n v_fragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2( max( 1e-6, gl_Position.w + 1.0 ) ) * u_logDepth - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n// https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/packDepth.frag\n// Packing a float in GLSL with multiplication and mod\n// http://blog.gradientstudios.com/2012/08/23/shadow-map-improvement\nvec4 packFloat(float depth) {\n const vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n\n // combination of mod and multiplication and division works better\n vec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);\n res -= res.xxyz * bit_mask;\n return res;\n}\n\n\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(86)+"\n"+n(64)+'\n\nuniform vec4 u_baseColor;\nuniform vec4 u_emissionFactor;\n\n#ifdef HILO_BASE_COLOR_MAP\n uniform HILO_SAMPLER_2D u_baseColorMap;\n#endif\n\n#ifdef HILO_NEED_WORLD_NORMAL\n uniform mat3 u_viewInverseNormalMatrix;\n#endif\n\n#ifdef HILO_HAS_LIGHT\n uniform float u_metallic;\n #ifdef HILO_METALLIC_MAP\n uniform HILO_SAMPLER_2D u_metallicMap;\n #endif\n uniform float u_roughness;\n #ifdef HILO_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_roughnessMap;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_metallicRoughnessMap;\n #endif\n #ifdef HILO_OCCLUSION_MAP\n uniform HILO_SAMPLER_2D u_occlusionMap;\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n uniform float u_occlusionStrength;\n #endif\n\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_DIFFUSE_ENV_MAP_CUBE\n uniform samplerCube u_diffuseEnvMap;\n #else\n uniform sampler2D u_diffuseEnvMap;\n #endif\n uniform float u_diffuseEnvIntensity;\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n uniform vec3 u_diffuseEnvSphereHarmonics3[9];\n uniform float u_diffuseEnvIntensity;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n uniform sampler2D u_brdfLUT;\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform float u_specularEnvIntensity;\n\n uniform float u_specularEnvMapMipCount;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n uniform vec4 u_specular;\n uniform float u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n uniform HILO_SAMPLER_2D u_specularGlossinessMap;\n #endif\n #endif\n\n #ifdef HILO_LIGHT_MAP\n uniform HILO_SAMPLER_2D u_lightMap;\n #endif\n\n #ifdef HILO_HAS_CLEARCOAT\n uniform float u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n uniform HILO_SAMPLER_2D u_clearcoatMap;\n #endif\n\n uniform float u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_clearcoatRoughnessMap;\n #endif\n #endif\n\n\n // PBR Based on https://github.com/KhronosGroup/glTF-WebGL-PBR\n\n // Basic Lambertian diffuse\n // Implementation from Lambert\'s Photometria https://archive.org/details/lambertsphotome00lambgoog\n // See also [1], Equation 1\n vec3 diffuse(vec3 diffuseColor) {\n return diffuseColor * HILO_INVERSE_PI;\n }\n\n // The following equation models the Fresnel reflectance term of the spec equation (aka F())\n // Implementation of fresnel from [4], Equation 15\n vec3 specularReflection(vec3 reflectance0, vec3 reflectance90, float VdotH) {\n return reflectance0 + (reflectance90 - reflectance0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n }\n\n // This calculates the specular geometric attenuation (aka G()),\n // where rougher material will reflect less light back to the viewer.\n // This implementation is based on [1] Equation 4, and we adopt their modifications to\n // alphaRoughness as input as originally proposed in [2].\n float geometricOcclusion(float NdotL, float NdotV, float alphaRoughness) {\n float r = alphaRoughness * alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r + (1.0 - r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r + (1.0 - r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n }\n\n // The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())\n // Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz\n // Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.\n float microfacetDistribution(float alphaRoughness, float NdotH) {\n float roughnessSq = alphaRoughness * alphaRoughness;\n float f = (NdotH * roughnessSq - NdotH) * NdotH + 1.0;\n return roughnessSq * HILO_INVERSE_PI / (f * f);\n }\n\n vec3 computeDiffuseSHLight(vec3 normal, in vec3 sh[9]) {\n return sh[0] +\n sh[1] * (normal.y) +\n sh[2] * (normal.z) +\n sh[3] * (normal.x) +\n sh[4] * (normal.y * normal.x) +\n sh[5] * (normal.y * normal.z) +\n sh[6] * ((3.0 * normal.z * normal.z) - 1.0) +\n sh[7] * (normal.z * normal.x) +\n sh[8] * (normal.x * normal.x - (normal.y * normal.y));\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md#rgbd\n vec3 decodeRGBD(in vec4 color){\n return color.rgb / color.a;\n }\n\n vec3 getIBLClearCoatContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif HILO_USE_SHADER_TEXTURE_LOD\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 getIBLContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_NEED_WORLD_NORMAL\n N = u_viewInverseNormalMatrix * N;\n V = u_viewInverseNormalMatrix * V;\n #endif\n #if defined(HILO_DIFFUSE_ENV_MAP) || defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_GAMMA_CORRECTION\n vec3 diffuseLight = sRGBToLinear(textureEnvMap(u_diffuseEnvMap, N)).rgb;\n #else\n vec3 diffuseLight = textureEnvMap(u_diffuseEnvMap, N).rgb;\n #endif\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n vec3 diffuseLight = computeDiffuseSHLight(N, u_diffuseEnvSphereHarmonics3);\n #endif\n color.rgb += diffuseLight * diffuseColor * ao * u_diffuseEnvIntensity;\n #endif\n\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif HILO_USE_SHADER_TEXTURE_LOD\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 calculateLo(vec3 N, vec3 V, vec3 L, vec3 reflectance0, vec3 reflectance90, float alphaRoughness, vec3 diffuseColor, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float LdotH = clamp(dot(L, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n // Calculate the shading terms for the microfacet specular shading model\n vec3 F = specularReflection(reflectance0, reflectance90, VdotH);\n float G = geometricOcclusion(NdotL, NdotV, alphaRoughness);\n float D = microfacetDistribution(alphaRoughness, NdotH);\n\n vec3 diffuseContrib;\n\n #ifdef HILO_LIGHT_MAP\n diffuseContrib = vec3(0.0);\n #else\n diffuseContrib = (1.0 - F) * diffuse(diffuseColor);\n #endif\n vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return NdotL * (diffuseContrib + specContrib);\n }\n\n #ifdef HILO_HAS_CLEARCOAT\n float calculateClearcoatBRDF(vec3 N, vec3 V, vec3 L, float clearcoatAlphaRoughness, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n\n float G = geometricOcclusion(NdotL, NdotV, clearcoatAlphaRoughness);\n float D = microfacetDistribution(clearcoatAlphaRoughness, NdotH);\n\n float clearcoatLayer = G * D / (4.0 * NdotV);\n\n return clearcoatLayer;\n }\n #endif\n#endif'},function(t,e){t.exports="#define GLSLIFY 1\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\n\nvec3 sRGBToLinear( in vec3 value ) {\n return vec3( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ));\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\nvec4 baseColor = u_baseColor;\nvec3 emissionColor = u_emissionFactor.rgb;\n\n#ifdef HILO_BASE_COLOR_MAP\n #ifdef HILO_GAMMA_CORRECTION\n baseColor *= sRGBToLinear(HILO_TEXTURE_2D(u_baseColorMap));\n #else\n baseColor *= HILO_TEXTURE_2D(u_baseColorMap);\n #endif\n#endif\n\n#if defined(HILO_HAS_COLOR)\n baseColor *= v_color;\n#endif\n\ncolor.a = baseColor.a;\n\n"+n(46)+"\n\n#ifdef HILO_HAS_LIGHT\n vec3 viewPos = vec3(0, 0, 0);\n vec3 N = normal;\n vec3 V = normalize(viewPos - v_fragPos);\n\n #ifdef HILO_OCCLUSION_MAP\n float ao = HILO_TEXTURE_2D(u_occlusionMap).r;\n #else\n float ao = 1.0;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n vec3 specular = u_specular.rgb;\n float glossiness = u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n vec4 specularGlossiness = sRGBToLinear(HILO_TEXTURE_2D(u_specularGlossinessMap));\n specular = specularGlossiness.rgb * specular;\n glossiness = specularGlossiness.a * glossiness;\n #endif\n float roughness = 1.0 - glossiness;\n float metallic = 0.0;\n vec3 diffuseColor = baseColor.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n vec3 specularColor = specular;\n #else\n float metallic = u_metallic;\n float roughness = u_roughness;\n #ifdef HILO_METALLIC_MAP\n metallic = HILO_TEXTURE_2D(u_metallicMap).r * u_metallic;\n #endif\n #ifdef HILO_ROUGHNESS_MAP\n roughness = HILO_TEXTURE_2D(u_roughnessMap).r * u_roughness;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughnessMap = HILO_TEXTURE_2D(u_metallicRoughnessMap);\n #ifdef HILO_IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP\n ao = metallicRoughnessMap.r;\n #endif\n roughness = metallicRoughnessMap.g * u_roughness;\n metallic = metallicRoughnessMap.b * u_metallic;\n #endif\n roughness = clamp(roughness, 0.04, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n ao = mix(1.0, ao, u_occlusionStrength);\n #endif\n\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n float NdotV = clamp(abs(dot(N, V)), 0.001, 1.0);\n float alphaRoughness = roughness * roughness;\n\n #ifdef HILO_HAS_CLEARCOAT\n float clearcoatFactor = u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n clearcoatFactor *= HILO_TEXTURE_2D(u_clearcoatMap).r;\n #endif\n float clearcoatRoughnessFactor = u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n clearcoatRoughnessFactor *= HILO_TEXTURE_2D(u_clearcoatRoughnessMap).g;\n #endif\n\n float clearcoatAlphaRoughnessFactor = clearcoatRoughnessFactor * clearcoatRoughnessFactor;\n vec3 NC = clearcoatNormal;\n float NCdotV = clamp(abs(dot(NC, V)), 0.001, 1.0);\n float clearCoatFresnel = 0.04 + (1.0 - 0.04) * pow((1.0 - abs(NCdotV)),5.0);\n vec3 clearCoatLayer = vec3(0.0);\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = normalize(-u_directionalLightsInfo[i]);\n vec3 radiance = u_directionalLightsColor[i];\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = normalize(-u_spotLightsDir[i]);\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n vec3 radiance = intensity * attenuation * u_spotLightsColor[i];\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0; i < HILO_POINT_LIGHTS; i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n vec3 radiance = attenuation * u_pointLightsColor[i];\n\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuseColor, specularColor, roughness, N, V, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_LIGHT_MAP\n vec4 lightMapColor = HILO_TEXTURE_2D(u_lightMap);\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_lights_image_based#rgbd\n color.rgb += baseColor.rgb * decodeRGBD(lightMapColor);\n #endif\n\n // IBL\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += getIBLClearCoatContribution(NC, V, diffuseColor, vec3(.04), ao, NCdotV, clearcoatRoughnessFactor)/clearCoatFresnel;\n #endif\n color.rgb += getIBLContribution(N, V, diffuseColor, specularColor, ao, NdotV, roughness);\n\n #if defined(HILO_AMBIENT_LIGHTS) && (defined(HILO_IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER) || (!defined(HILO_DIFFUSE_ENV_MAP) && !defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)))\n color.rgb += u_ambientLightsColor * baseColor.rgb * ao;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n #ifdef HILO_GAMMA_CORRECTION\n emissionColor *= sRGBToLinear(HILO_TEXTURE_2D(u_emission)).rgb;\n #else\n emissionColor *= HILO_TEXTURE_2D(u_emission).rgb;\n #endif\n #endif\n\n color.rgb += emissionColor;\n\n #ifdef HILO_HAS_CLEARCOAT\n float t = clearcoatFactor * clearCoatFresnel;\n color.rgb = color.rgb * (1.0 - t) + clearCoatLayer * t;\n #endif\n#else\n color.rgb = baseColor.rgb;\n color.rgb += emissionColor;\n#endif"},function(t,e,n){var r=n(89),i=n(26),a=n(30),s=[0,0,0],o=[0,0,0],u=[0,0,0],c=[0,0,0],h=[0,0,0];t.exports=function(t,e,n,f){a(s,f[1],f[0]),a(o,f[2],f[0]),r(c,n,o);var l=i(s,c);if(l<1e-6)return null;a(u,e,f[0]);var d=i(u,c);if(d<0||d>l)return null;r(h,u,s);var m=i(n,h);if(m<0||d+m>l)return null;var _=i(o,h)/l;return t[0]=e[0]+_*n[0],t[1]=e[1]+_*n[1],t[2]=e[2]+_*n[2],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2];return t[0]=i*u-a*o,t[1]=a*s-r*u,t[2]=r*o-i*s,t}},function(t,e,n){var r=n(26),i=n(31),a=n(32),s=n(33);t.exports=function(t,e,n,u,c){var h=r(n,u);if(0!==h){var f=-(r(e,u)+c)/h;return f<0?null:(a(o,n,f),i(t,e,o))}return r(u,e)+c===0?s(t,e):null};var o=[0,0,0]},function(t,e,n){var r=n(92),i=n(26),a=n(30),s=n(93),o=n(32),u=n(31),c=[0,0,0];t.exports=function(t,e,n,h,f){a(c,h,e);var l=i(n,c);if(l<0)return null;s(c,e,n,l);var d=r(h,c),m=f*f;if(d>m)return null;return o(t,n,l-Math.sqrt(m-d)),u(t,t,e)}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}},function(t,e){function n(t,e,n){for(var r=t.length,i=-1/0,a=1/0,s=0;su){var c=o;o=u,u=c}if(ua)return 1/0;o>i&&(i=o),ua?1/0:i}t.exports=function(t,e,r,i){var a=n(e,r,i);if(a===1/0)t=null;else{t=t||[];for(var s=0;s0;){if(d(c)128){if(0==(u=(255&f[0])-128)||u>o-s)throw new Error("Bad scanline data");for(;u-- >0;)h[s++]=f[1]}else{if(0==(u=255&f[0])||u>o-s)throw new Error("Bad scanline data");if(h[s++]=f[1],--u>0){if(m(h,s,u) 0.0 ? v : (0.5 * inversesqrt(max(1.0 - (x * x), 1e-7))) - v;\n return cross(v1, v2) * theta_sintheta;\n}\n\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if (dot(lightNormal, P - rectCoords[0]) < 0.0)\n return vec3(0.0);\n vec3 T1, T2;\n T1 = normalize(V - (N * dot(V, N)));\n T2 = -cross(N, T1);\n mat3 mat = mInv * transpose(mat3(T1, T2, N));\n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n\nvec3 getAreaLight(const in vec3 diffuseColor, const in vec3 specularColor, const in float roughness, const in vec3 normal, const in vec3 viewDir, const in vec3 position, const in vec3 lightPos, const in vec3 lightColor, const in vec3 halfWidth, const in vec3 halfHeight, const in sampler2D areaLightsLtcTexture1, const in sampler2D areaLightsLtcTexture2){\n vec3 rectCoords[4];\n rectCoords[0] = (lightPos - halfWidth) - halfHeight;\n rectCoords[1] = (lightPos + halfWidth) - halfHeight;\n rectCoords[2] = (lightPos + halfWidth) + halfHeight;\n rectCoords[3] = (lightPos - halfWidth) + halfHeight;\n \n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(areaLightsLtcTexture1, uv);\n vec4 t2 = texture2D(areaLightsLtcTexture2, uv);\n\n mat3 mInv = mat3(vec3(t1.x, 0, t1.y), vec3(0, 1, 0), vec3(t1.z, 0, t1.w));\n vec3 fresnel = (specularColor * t2.x) + ((vec3(1.0) - specularColor) * t2.y);\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += ((lightColor * fresnel) * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords));\n color += ((lightColor * diffuseColor) * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords));\n return color;\n}\n\n"},function(t,e,n){"use strict";n.r(e),n.d(e,"util",(function(){return i})),n.d(e,"GLTFExtensions",(function(){return r})),n.d(e,"Class",(function(){return a.a})),n.d(e,"EventMixin",(function(){return s.a})),n.d(e,"Fog",(function(){return cr})),n.d(e,"Mesh",(function(){return mr})),n.d(e,"Node",(function(){return g})),n.d(e,"SkinedMesh",(function(){return vr})),n.d(e,"Skeleton",(function(){return Tr})),n.d(e,"Stage",(function(){return zr})),n.d(e,"Tween",(function(){return di})),n.d(e,"version",(function(){return Mr})),n.d(e,"BoxGeometry",(function(){return _i})),n.d(e,"Geometry",(function(){return Z})),n.d(e,"GeometryData",(function(){return b})),n.d(e,"MorphGeometry",(function(){return qn})),n.d(e,"PlaneGeometry",(function(){return Ti})),n.d(e,"SphereGeometry",(function(){return Ai})),n.d(e,"Camera",(function(){return O})),n.d(e,"PerspectiveCamera",(function(){return Q})),n.d(e,"OrthographicCamera",(function(){return hn})),n.d(e,"Buffer",(function(){return Nt})),n.d(e,"capabilities",(function(){return et})),n.d(e,"extensions",(function(){return tt})),n.d(e,"Framebuffer",(function(){return ce})),n.d(e,"glType",(function(){return Tt})),n.d(e,"logGLResource",(function(){return Ii})),n.d(e,"Program",(function(){return Lt})),n.d(e,"RenderInfo",(function(){return Ar})),n.d(e,"RenderList",(function(){return Sr})),n.d(e,"VertexArrayObject",(function(){return Ft})),n.d(e,"WebGLRenderer",(function(){return Xr})),n.d(e,"WebGLResourceManager",(function(){return yr})),n.d(e,"WebGLState",(function(){return Rr})),n.d(e,"BasicLoader",(function(){return Ni})),n.d(e,"CubeTextureLoader",(function(){return Pi})),n.d(e,"GLTFLoader",(function(){return _a})),n.d(e,"GLTFParser",(function(){return da})),n.d(e,"AliAMCExtension",(function(){return Jn})),n.d(e,"HDRLoader",(function(){return La})),n.d(e,"KTXLoader",(function(){return Sa})),n.d(e,"LoadCache",(function(){return Si})),n.d(e,"LoadQueue",(function(){return Ra})),n.d(e,"ShaderMaterialLoader",(function(){return Na})),n.d(e,"TextureLoader",(function(){return Ca})),n.d(e,"Loader",(function(){return Ci})),n.d(e,"Texture",(function(){return Qt})),n.d(e,"LazyTexture",(function(){return Ui})),n.d(e,"CubeTexture",(function(){return pe})),n.d(e,"DataTexture",(function(){return Le})),n.d(e,"Shader",(function(){return dt})),n.d(e,"BasicMaterial",(function(){return tn})),n.d(e,"GeometryMaterial",(function(){return un})),n.d(e,"Material",(function(){return Je})),n.d(e,"PBRMaterial",(function(){return Hi})),n.d(e,"semantic",(function(){return Ue})),n.d(e,"ShaderMaterial",(function(){return kn})),n.d(e,"AxisHelper",(function(){return Ha})),n.d(e,"AxisNetHelper",(function(){return Ua})),n.d(e,"CameraHelper",(function(){return Xa})),n.d(e,"AmbientLight",(function(){return ka})),n.d(e,"AreaLight",(function(){return Wa})),n.d(e,"DirectionalLight",(function(){return Un})),n.d(e,"CubeLightShadow",(function(){return bn})),n.d(e,"Light",(function(){return M})),n.d(e,"LightManager",(function(){return br})),n.d(e,"LightShadow",(function(){return gn})),n.d(e,"PointLight",(function(){return wn})),n.d(e,"SpotLight",(function(){return Xn})),n.d(e,"Animation",(function(){return ta})),n.d(e,"AnimationStates",(function(){return Ji})),n.d(e,"MeshPicker",(function(){return Ka})),n.d(e,"Ticker",(function(){return Qa})),n.d(e,"log",(function(){return m.a})),n.d(e,"Cache",(function(){return J})),n.d(e,"browser",(function(){return jr})),n.d(e,"WebGLSupport",(function(){return Ja})),n.d(e,"constants",(function(){return P.a})),n.d(e,"Color",(function(){return $a.Color})),n.d(e,"Euler",(function(){return $a.Euler})),n.d(e,"EulerNotifier",(function(){return $a.EulerNotifier})),n.d(e,"Frustum",(function(){return $a.Frustum})),n.d(e,"math",(function(){return $a.math})),n.d(e,"Matrix3",(function(){return $a.Matrix3})),n.d(e,"Matrix4",(function(){return $a.Matrix4})),n.d(e,"Matrix4Notifier",(function(){return $a.Matrix4Notifier})),n.d(e,"Plane",(function(){return $a.Plane})),n.d(e,"Quaternion",(function(){return $a.Quaternion})),n.d(e,"Ray",(function(){return $a.Ray})),n.d(e,"Sphere",(function(){return $a.Sphere})),n.d(e,"SphericalHarmonics3",(function(){return $a.SphericalHarmonics3})),n.d(e,"Vector2",(function(){return $a.Vector2})),n.d(e,"Vector3",(function(){return $a.Vector3})),n.d(e,"Vector3Notifier",(function(){return $a.Vector3Notifier})),n.d(e,"Vector4",(function(){return $a.Vector4}));var r={};n.r(r),n.d(r,"ALI_amc_mesh_compression",(function(){return Jn})),n.d(r,"WEB3D_quantized_attributes",(function(){return tr})),n.d(r,"HILO_animation_clips",(function(){return er})),n.d(r,"ALI_animation_clips",(function(){return nr})),n.d(r,"ALI_bounding_box",(function(){return rr})),n.d(r,"KHR_materials_pbrSpecularGlossiness",(function(){return ir})),n.d(r,"KHR_materials_clearcoat",(function(){return ar})),n.d(r,"KHR_lights_punctual",(function(){return sr})),n.d(r,"KHR_techniques_webgl",(function(){return or}));var i=n(4),a=n(1),s=n(9),o=n(7),u=n(21),c=n(5),h=n(17),f=n(22),l=n(10),d=n(6),m=n(3),_=new c.a(0,1,0),p=new o.a,g=a.a.create({Statics:{TRAVERSE_STOP_NONE:!1,TRAVERSE_STOP_CHILDREN:1,TRAVERSE_STOP_ALL:!0},Mixes:s.a,isNode:!0,className:"Node",name:"",anim:null,animationId:"",jointName:"",autoUpdateWorldMatrix:!0,autoUpdateChildWorldMatrix:!0,parent:null,_quatDirty:!1,_matrixDirty:!1,needCallChildUpdate:!0,visible:!0,pointerEnabled:!0,pointerChildren:!0,useHandCursor:!1,userData:null,onUpdate:null,__forceUseParentWorldMatrix:!1,constructor:function(t){var e=this;this.id=d.a.generateUUID(this.className),this.up=_.clone(),this.children=[],this.worldMatrix=new o.a,this._matrix=new u.a,this._position=new h.a(0,0,0),this._scale=new h.a(1,1,1),this._pivot=new h.a(0,0,0),this._rotation=new f.a,this._quaternion=new l.a,this._matrix.on("update",(function(){e._onMatrixUpdate()})),this._position.on("update",(function(){e._onPositionUpdate()})),this._scale.on("update",(function(){e._onScaleUpdate()})),this._pivot.on("update",(function(){e._onPivotUpdate()})),this._rotation.on("update",(function(){e._onRotationUpdate()})),this._quaternion.on("update",(function(){e._onQuaternionUpdate()})),Object.assign(this,t)},clone:function(t){var e=new this.constructor;return e.name=this.name,e.jointName=this.jointName,e.animationId=this.animationId,e.setPosition(this.x,this.y,this.z),e.setScale(this.scaleX,this.scaleY,this.scaleZ),e.setRotation(this.rotationX,this.rotationY,this.rotationZ),this.children.forEach((function(t){e.addChild(t.clone(!0))})),t||(this.anim&&(e.anim=this.anim.clone(e)),e.resetSkinedMeshRootNode()),e},setAnim:function(t){return this.anim=t,t.rootNode=this,this},resetSkinedMeshRootNode:function(){var t=this;this.traverse((function(e){e.isSkinedMesh&&e.skeleton&&(e.skeleton.rootNode=t)}),!0)},getChildrenNameMap:function(){var t={};return this.traverse((function(e){t[e.name]=e;var n=e._originName;void 0===n||t[n]||(t[n]=e)}),!0),t},addChild:function(t){return t.parent&&t.removeFromParent(),t.parent=this,this.children.push(t),this},removeChild:function(t){var e=this.children.indexOf(t);return e>-1&&(this.children.splice(e,1),t.parent=null),this},addTo:function(t){return t.addChild(this),this},removeFromParent:function(){return this.parent&&this.parent.removeChild(this),this},updateMatrix:function(){return this._matrixDirty&&(this._matrixDirty=!1,this.matrixVersion++,this._matrix.fromRotationTranslationScaleOrigin(this.quaternion,this._position,this._scale,this._pivot,!0)),this},updateQuaternion:function(){return this._quatDirty&&(this._quatDirty=!1,this._quaternion.fromEuler(this._rotation,!0)),this},updateTransform:function(){return this._matrix.decompose(this._quaternion,this._position,this._scale,this._pivot),this._onQuaternionUpdate(),this._matrixDirty=!1,this},updateMatrixWorld:function(t){return this.traverse((function(e){return(e.autoUpdateWorldMatrix||t)&&(e.parent?e.__forceUseParentWorldMatrix?e.worldMatrix.copy(e.parent.worldMatrix):e.worldMatrix.multiply(e.parent.worldMatrix,e.matrix):e.worldMatrix.copy(e.matrix)),!e.autoUpdateChildWorldMatrix&&!t&&1})),this},getConcatenatedMatrix:function(t){for(var e=new o.a,n=this;n&&n!==t;n=n.parent)e.multiply(n.matrix,e);return e},_traverse:function(t,e){if(!e){var n=t(this);if(n)return n}for(var r=this.children,i=0,a=r.length;i1&&void 0!==arguments[1]&&arguments[1];return this._traverse(t,e),this},traverseBFS:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(n=r?this.children:[this];n.length;){e=n,n=[];for(var i=0,a=e.length;i1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return this._scale.set(t,e,n),this},setPosition:function(t,e,n){return this._position.set(t,e,n),this},setRotation:function(t,e,n){return this._rotation.setDegree(t,e,n),this},setPivot:function(t,e,n){return this._pivot.set(t,e,n),this},lookAt:function(t){return this.isCamera?p.targetTo(this,t,this.up):p.targetTo(t,this,this.up),this._quaternion.fromMat4(p),this},raycast:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.visible)return null;var i=[];return this.traverse((function(n){if(r&&!n.pointerEnabled)return 1;if(n.isMesh){var a=n.raycast(t,!1);a&&(i=i.concat(a.map((function(t){return{mesh:n,point:t}}))))}return!(!r||e.pointerChildren)&&1})),i.length?(n&&t.sortPoints(i,"point"),i):null},matrix:{get:function(){return this.updateMatrix(),this._matrix},set:function(t){m.a.warnOnce("Node.matrix.set","node.matrix is readOnly.Use node.matrix.copy instead."),this._matrix.copy(t)}},position:{get:function(){return this._position},set:function(t){m.a.warnOnce("Node.position.set","node.position is readOnly.Use node.position.copy instead."),this._position.copy(t)}},x:{get:function(){return this._position.elements[0]},set:function(t){this._position.elements[0]=t,this._matrixDirty=!0}},y:{get:function(){return this._position.elements[1]},set:function(t){this._position.elements[1]=t,this._matrixDirty=!0}},z:{get:function(){return this._position.elements[2]},set:function(t){this._position.elements[2]=t,this._matrixDirty=!0}},scale:{get:function(){return this._scale},set:function(t){m.a.warnOnce("Node.scale.set","node.scale is readOnly.Use node.scale.copy instead."),this._scale.copy(t)}},scaleX:{get:function(){return this._scale.elements[0]},set:function(t){this._scale.elements[0]=t,this._matrixDirty=!0}},scaleY:{get:function(){return this._scale.elements[1]},set:function(t){this._scale.elements[1]=t,this._matrixDirty=!0}},scaleZ:{get:function(){return this._scale.elements[2]},set:function(t){this._scale.elements[2]=t,this._matrixDirty=!0}},pivot:{get:function(){return this._pivot},set:function(t){m.a.warnOnce("Node.pivot.set","node.pivot is readOnly.Use node.pivot.copy instead."),this._pivot.copy(t)}},pivotX:{get:function(){return this._pivot.elements[0]},set:function(t){this._pivot.elements[0]=t,this._matrixDirty=!0}},pivotY:{get:function(){return this._pivot.elements[1]},set:function(t){this._pivot.elements[1]=t,this._matrixDirty=!0}},pivotZ:{get:function(){return this._pivot.elements[2]},set:function(t){this._pivot.elements[2]=t,this._matrixDirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){m.a.warnOnce("Node.rotation.set","node.rotation is readOnly.Use node.rotation.copy instead."),this._rotation.copy(t)}},rotationX:{get:function(){return this._rotation.degX},set:function(t){this._rotation.degX=t}},rotationY:{get:function(){return this._rotation.degY},set:function(t){this._rotation.degY=t}},rotationZ:{get:function(){return this._rotation.degZ},set:function(t){this._rotation.degZ=t}},quaternion:{get:function(){return this.updateQuaternion(),this._quaternion},set:function(t){m.a.warnOnce("Node.quaternion.set","node.quaternion is readOnly.Use node.quaternion.copy instead."),this._quaternion.copy(t)}},matrixVersion:0,getBounds:function(t,e,n){return e?e.multiply(this.matrix):e=this.getConcatenatedMatrix(t),this.children.forEach((function(t){n=t.getBounds(null,e.clone(),n)})),this.isMesh&&(n=this.geometry.getBounds(e,n)),n},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"===t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=Object.assign({},t);e.type="mouseover",this.fire(e)}}else"mouseout"===t.type&&(this.__mouseOver=!1);var n=this.parent;t._stopped||t._stopPropagationed||!n||n._fireMouseEvent(t)},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getChildrenByBaseClassName("Node");return this.off(),n.forEach((function(n){n.isMesh?n.destroy(t,e):(n.off(),n.removeFromParent())})),this.removeFromParent(),this},_onMatrixUpdate:function(){this.matrixVersion++,this.updateTransform()},_onPositionUpdate:function(){this._matrixDirty=!0},_onScaleUpdate:function(){this._matrixDirty=!0},_onPivotUpdate:function(){this._matrixDirty=!0},_onRotationUpdate:function(){this._quatDirty=!0,this._matrixDirty=!0},_onQuaternionUpdate:function(){this._rotation.fromQuat(this._quaternion),this._quatDirty=!1}}),v=n(8),E=new v.a,T=a.a.create({Extends:g,isLight:!0,className:"Light",amount:1,enabled:!0,constantAttenuation:1,linearAttenuation:0,quadraticAttenuation:0,_range:0,range:{get:function(){return this._range},set:function(t){this.constantAttenuation=1,t<=0?(this.linearAttenuation=0,this.quadraticAttenuation=0):(this.linearAttenuation=4.5/t,this.quadraticAttenuation=75/(t*t)),this._range=t}},shadow:null,isDirty:!1,constructor:function(t){this.color=new v.a(1,1,1),T.superclass.constructor.call(this,t)},toInfoArray:function(t,e){return t[e+0]=this.constantAttenuation,t[e+1]=this.linearAttenuation,t[e+2]=this.quadraticAttenuation,this},getRealColor:function(){return E.copy(this.color).scale(this.amount)},createShadowMap:function(t,e){}}),M=T,A=n(23),L=new o.a,I=a.a.create({Extends:g,isCamera:!0,className:"Camera",_needUpdateProjectionMatrix:!0,_isGeometryDirty:!1,constructor:function(t){this.viewMatrix=new o.a,this.projectionMatrix=new o.a,this.viewProjectionMatrix=new o.a,this._frustum=new A.a,I.superclass.constructor.call(this,t)},updateViewMatrix:function(){return this.updateMatrixWorld(!0),this.viewMatrix.invert(this.worldMatrix),this},updateProjectionMatrix:function(){},getGeometry:function(t){},updateViewProjectionMatrix:function(){return this._needUpdateProjectionMatrix&&(this.updateProjectionMatrix(),this._needUpdateProjectionMatrix=!1),this.updateViewMatrix(),this.viewProjectionMatrix.multiply(this.projectionMatrix,this.viewMatrix),this.updateFrustum(this.viewProjectionMatrix),this},getModelViewMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewMatrix,t.worldMatrix),e},getModelProjectionMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewProjectionMatrix,t.worldMatrix),e},projectVector:function(t,e,n){var r=t.clone();return r.transformMat4(this.viewProjectionMatrix),e&&n&&(r.x=(r.x+1)/2*e,r.y=n-(r.y+1)/2*n),r},unprojectVector:function(t,e,n){var r=t.clone();return e&&n&&(r.x=r.x/e*2-1,r.y=1-r.y/n*2),L.invert(this.viewProjectionMatrix),r.transformMat4(L),r},isPointVisible:function(t){return!!this._frustum.intersectsSphere({center:t,radius:0})},isMeshVisible:function(t){var e=t.geometry;if(e){var n=e.getSphereBounds(t.worldMatrix);if(this._frustum.intersectsSphere(n))return!0}return!1},updateFrustum:function(t){return this._frustum.fromMatrix(t),this}}),O=I,S=n(14),R=n(12),y=n(11),N=n(20),x={2:new S.a,3:new c.a,4:new R.a,16:new o.a},C=a.a.create({className:"GeometryData",isGeometryData:!0,size:void 0,normalized:!1,type:void 0,_isSubDirty:!1,_isAllDirty:!1,isDirty:{get:function(){return this._isSubDirty||this._isAllDirty},set:function(t){this._isAllDirty=t,!1===t&&this.clearSubData()}},bufferViewId:void 0,glBuffer:null,constructor:function(t,e,n){this.id=d.a.generateUUID(this.className),this.data=t,this.size=e,Object.assign(this,n),this.bufferViewId||(this.bufferViewId=this.id),this.size||m.a.warn("GeometryData.constructor: geometryData must set size!",this)},_stride:0,stride:{get:function(){return this._stride},set:function(t){this._stride=t,this.strideSize=0===t?0:t/this.data.BYTES_PER_ELEMENT}},strideSize:0,_offset:0,offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetSize=t/this.data.BYTES_PER_ELEMENT}},offsetSize:0,data:{set:function(t){t&&(this._data=t,this.type=Object(i.getTypedArrayGLType)(t),this.stride=this._stride,this.offset=this._offset,this._isAllDirty=!0)},get:function(){return this._data}},length:{get:function(){return this._data.length}},realLength:{get:function(){return 0===this.strideSize?this._data.length:this._data.length/this.strideSize*this.size}},getByteLength:function(){return this._data.BYTES_PER_ELEMENT*this.realLength},count:{get:function(){return 0===this.strideSize?this._data.length/this.size:this._data.length/this.strideSize}},setSubData:function(t,e){this._isSubDirty=!0,this.data.set(e,t),this.subDataList||(this.subDataList=[]);var n=e.BYTES_PER_ELEMENT*t;this.subDataList.push({byteOffset:n,data:e})},clearSubData:function(){this.subDataList&&(this.subDataList.length=0),this._isSubDirty=!1},clone:function(){var t=new C(null,1);return t.copy(this),t},copy:function(t){var e=t.data;this.data=new e.constructor(e),this.size=t.size,this.stride=t.stride,this.normalized=t.normalized,this.type=t.type,this.offset=t.offset},getOffset:function(t){var e=this.strideSize;return 0===e?t*this.size:t*e+this.offsetSize},get:function(t){var e=this.getOffset(t);return this.getByOffset(e)},getCopy:function(t){return this.get(t).clone()},set:function(t,e){var n=this.getOffset(t);return this.setByOffset(n,e),n},getByOffset:function(t){var e=this.size;return e>1?x[e].fromArray(this._data,t):this._data[t]},setByOffset:function(t,e){var n=this.size,r=this._data;n>1?e.toArray(r,t):r[t]=e,this._isAllDirty=!0},traverse:function(t){for(var e=this.count,n=0;n0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromTranslation(G.set(t,e,n))),this},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.transformMat4(Y.fromScaling(G.set(t,e,n))),this},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromQuat(q.fromEuler({x:t*d.a.DEG2RAD,y:e*d.a.DEG2RAD,z:n*d.a.DEG2RAD}))),this},transformMat4:function(t){var e=this.vertices;if(e&&e.traverse((function(n,r,i){e.setByOffset(i,n.transformMat4(t))})),W.normalFromMat4(t),this._normals){var n=this.normals;n.traverse((function(t,e,r){n.setByOffset(r,t.transformMat3(W).normalize())}))}if(this._tangents){var r=this.tangents;r.traverse((function(t,e,n){r.setByOffset(n,t.transformMat3(W).normalize())}))}return this.isDirty=!0,this},merge:function(t,e){var n=t.vertices;if(n&&this.vertices){var r=this.vertices.count;e&&(n=t.vertices.clone()).traverse((function(t,r,i){n.setByOffset(i,t.transformMat4(e))})),this.vertices.merge(n),this.indices&&t.indices?this.indices.merge(t.indices,(function(t){return t+r})):this.indices=null}return this.uvs&&t.uvs?this.uvs.merge(t.uvs):this.uvs=null,this.uvs1&&t.uvs1?this.uvs1.merge(t.uvs1):this.uvs1=null,this.colors&&t.colors?this.colors.merge(t.colors):this.colors=null,this._normals&&(this._normals=null),this._tangents&&(this._tangents=null),this._tangents1&&(this._tangents1=null),this.isDirty=!0,this},ensureData:function(t,e,n,r){var i=this[t];if(!i||n>i.length){var a=new r(n);i?(a.set(i.data),i.data=a):this[t]=new b(a,e)}},addPoints:function(){var t=this,e=[].slice.call(arguments),n=3*(this.currentVerticesCount+e.length);this.ensureData("vertices",3,n,Float32Array);var r=this.vertices.data;return e.forEach((function(e){var n=3*t.currentVerticesCount++;r[n]=e[0],r[n+1]=e[1],r[n+2]=e[2]})),this.currentVerticesCount-e.length},addIndices:function(){var t=this,e=[].slice.call(arguments),n=this.currentIndicesCount+e.length;this.ensureData("indices",1,n,Uint16Array);var r=this.indices.data;e.forEach((function(e){r[t.currentIndicesCount++]=e})),this._needUpdateNormals=!0},addLine:function(t,e){var n=this.addPoints(t,e);this.addIndices(n,n+1)},addFace:function(t,e,n){var r=this.addPoints(t,e,n);this.addIndices(r,r+1,r+2)},addRect:function(t,e,n,r){var i=this.addPoints(t,e,n,r);this.addIndices(i,i+1,i+2,i,i+2,i+3)},setVertexUV:function(t,e){this.ensureData("uvs",2,this.vertices.length/3*2,Float32Array);for(var n=this.uvs.data,r=0;r0&&void 0!==arguments[0]&&arguments[0];return this._localBounds&&!t||(this._localBounds=this.getBounds()),this._localBounds},getSphereBounds:function(t){this._sphereBounds||(this._sphereBounds=new N.a);var e=this._sphereBounds;return e.copy(this.getLocalSphereBounds()),t&&e.transformMat4(t),e},getLocalSphereBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._localSphereBounds||t){var e=this.getLocalBounds(t),n=new N.a({center:new c.a(e.x,e.y,e.z)}),r=this.vertices;r?n.fromGeometryData(r):(m.a.warnOnce("geometry.getLocalSphereBounds","geometry has no vertices data, geometry.getLocalSphereBounds will return Infinity bounds."),n.radius=1/0),this._localSphereBounds=n}return this._localSphereBounds},convertToNoIndices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.mode===w)if(this.indices){for(var e=this.indices.data,n=e.length,r=new Float32Array(n*t),a=this.uvs?new Float32Array(2*n):null,s=new Float32Array(3*n),o=this.colors?new Float32Array(this.colors.size*n):null,u=this.skinIndices?new Float32Array(4*n):null,c=this.skinWeights?new Float32Array(4*n):null,h=0;h2&&void 0!==arguments[2])||arguments[2];return(n=this.useAABBRaycast?this._aabbRaycast(t):this._raycast(t,e))&&r&&t.sortPoints(n),n},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.positionDecodeMat&&(t.QUANTIZED=1,t.POSITION_QUANTIZED=1),this.normalDecodeMat&&(t.QUANTIZED=1,t.NORMAL_QUANTIZED=1),this.uvDecodeMat&&(t.QUANTIZED=1,t.UV_QUANTIZED=1),this.uv1DecodeMat&&(t.QUANTIZED=1,t.UV1_QUANTIZED=1),this.colors&&(t.HAS_COLOR=1,t.COLOR_SIZE=this.colors.size),t},getShaderKey:function(){return void 0===this._shaderKey&&(this._shaderKey="geometry",this.isMorphGeometry?this._shaderKey+="_id_".concat(this.id):(this.colors&&(this._shaderKey+="_colors"),this.positionDecodeMat&&(this._shaderKey+="positionDecodeMat"))),this._shaderKey},getSize:function(){var t=0;for(var e in this)Object(i.hasOwnProperty)(this,e)&&this[e]&&this[e].isGeometryData&&(t+=this[e].getByteLength());return t},destroy:function(){m.a.warn("Geometry.destroy has been deprecated, use mesh.destroy(renderer) instead.")}}),K=a.a.create({Extends:O,isPerspectiveCamera:!0,className:"PerspectiveCamera",_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:null,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},_fov:50,fov:{get:function(){return this._fov},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._fov=t}},_aspect:1,aspect:{get:function(){return this._aspect},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._aspect=t}},constructor:function(t){K.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.projectionMatrix.elements,e=this.near,n=this.far,r=this.aspect,i=this.fov,a=1/Math.tan(.5*d.a.degToRad(i));if(t[0]=a/r,t[5]=a,t[11]=-1,t[15]=0,n){var s=1/(e-n);t[10]=(e+n)*s,t[14]=2*n*e*s}else t[10]=-1,t[14]=-2*e},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=Math.tan(this.fov/2*Math.PI/180),r=this.near,i=this.far,a=r*n,s=i*n,o=this.aspect*a,u=this.aspect*s,c=[-o,-a,-r],h=[o,-a,-r],f=[o,a,-r],l=[-o,a,-r],d=[-u,-s,-i],m=[u,-s,-i],_=[u,s,-i],p=[-u,s,-i];e.addRect(d,m,_,p),e.addRect(m,h,f,_),e.addRect(h,c,l,f),e.addRect(c,d,p,l),e.addRect(p,_,f,l),e.addRect(c,h,m,d),this._geometry=e}return this._geometry}}),Q=K,J=a.a.create({constructor:function(){this._cache={}},get:function(t){return this._cache[t]},getObject:function(t){return this._cache[t.__cacheId]},add:function(t,e){"object"==typeof e&&(e.__cacheId=t),this._cache[t]=e},remove:function(t){delete this._cache[t]},removeObject:function(t){delete this._cache[t.__cacheId]},removeAll:function(){this._cache={}},each:function(t){var e=this._cache;for(var n in e)t(e[n],n)}}),$={instanced:void 0,vao:void 0,texFloat:void 0,loseContext:void 0,textureFilterAnisotropic:void 0,_usedExtensions:{},_disabledExtensions:{},init:function(t){this.reset(t)},reset:function(t){this.gl=t;var e=this._usedExtensions;for(var n in e){var r=e[n];this[r]=void 0,this.get(n,r)}},use:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.gl?this.get(t,e):this._usedExtensions[t]=e},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this._disabledExtensions[t])return null;var n=this[e];return void 0===n&&(n=this._getExtension(t),this[e]=n),n},disable:function(t){this._disabledExtensions[t]=!0},enable:function(t){this._disabledExtensions[t]=!1},_getExtension:function(t){var e=this.gl;return e&&e.getExtension&&(e.getExtension(t)||e.getExtension("WEBKIT_"+t)||e.getExtension("MOZ_"+t))||null}};$.use("ANGLE_instanced_arrays","instanced"),$.use("OES_vertex_array_object","vao"),$.use("OES_texture_float","texFloat"),$.use("WEBGL_lose_context","loseContext"),$.use("OES_element_index_uint","uintIndices"),$.use("EXT_shader_texture_lod","shaderTextureLod"),$.use("EXT_texture_filter_anisotropic","textureFilterAnisotropic");var tt=$,et={MAX_TEXTURE_INDEX:null,MAX_PRECISION:null,MAX_VERTEX_PRECISION:null,MAX_FRAGMENT_PRECISION:null,VERTEX_TEXTURE_FLOAT:null,FRAGMENT_TEXTURE_FLOAT:null,MAX_TEXTURE_MAX_ANISOTROPY:1,MAX_RENDERBUFFER_SIZE:void 0,MAX_COMBINED_TEXTURE_IMAGE_UNITS:void 0,MAX_CUBE_MAP_TEXTURE_SIZE:void 0,MAX_FRAGMENT_UNIFORM_VECTORS:void 0,MAX_TEXTURE_IMAGE_UNITS:void 0,MAX_TEXTURE_SIZE:void 0,MAX_VARYING_VECTORS:void 0,MAX_VERTEX_ATTRIBS:void 0,MAX_VERTEX_TEXTURE_IMAGE_UNITS:void 0,MAX_VERTEX_UNIFORM_VECTORS:void 0,init:function(t){var e=this;this.gl=t;["MAX_RENDERBUFFER_SIZE","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"].forEach((function(t){e.get(t)})),this.MAX_TEXTURE_INDEX=this.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,this.MAX_VERTEX_PRECISION=this._getMaxSupportPrecision(t.VERTEX_SHADER),this.MAX_FRAGMENT_PRECISION=this._getMaxSupportPrecision(t.FRAGMENT_SHADER),this.MAX_PRECISION=this.getMaxPrecision(this.MAX_FRAGMENT_PRECISION,this.MAX_VERTEX_PRECISION),this.VERTEX_TEXTURE_FLOAT=!!tt.texFloat&&this.MAX_VERTEX_TEXTURE_IMAGE_UNITS>0,this.FRAGMENT_TEXTURE_FLOAT=!!tt.texFloat,this.EXT_FRAG_DEPTH=tt.get("EXT_frag_depth"),this.SHADER_TEXTURE_LOD=!!tt.shaderTextureLod,tt.textureFilterAnisotropic&&(this.MAX_TEXTURE_MAX_ANISOTROPY=t.getParameter(tt.textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},get:function(t){var e=this.gl,n=this[t];return void 0===n&&(n=this[t]=e.getParameter(e[t])),n},_getMaxSupportPrecision:function(t){var e=this.gl,n="lowp";if(e.getShaderPrecisionFormat)for(var r=[{name:"highp",type:e.HIGH_FLOAT},{name:"mediump",type:e.MEDIUM_FLOAT}],i=0;i0){n=a.name;break}}else n="mediump";return n},getMaxPrecision:function(t,e){return"highp"===t||"mediump"===t&&"lowp"===e?e:t}},nt=n(50),rt=n.n(nt),it=n(51),at=n.n(it),st=n(52),ot=n.n(st),ut=n(53),ct=n.n(ut),ht=new J,ft=new J,lt=a.a.create({isShader:!0,className:"Shader",vs:"",fs:"",Statics:{commonOptions:{},shaders:{"chunk/baseDefine.glsl":n(18),"chunk/color.frag":n(36),"chunk/color.vert":n(74),"chunk/color_main.vert":n(76),"chunk/diffuse.frag":n(56),"chunk/diffuse_main.frag":n(65),"chunk/extensions.frag":n(24),"chunk/extensions.vert":n(48),"chunk/fog.frag":n(43),"chunk/fog_main.frag":n(67),"chunk/frag_color.frag":n(47),"chunk/joint.vert":n(69),"chunk/joint_main.vert":n(79),"chunk/light.frag":n(40),"chunk/lightFog.frag":n(39),"chunk/lightFog.vert":n(72),"chunk/lightFog_main.frag":n(45),"chunk/lightFog_main.vert":n(82),"chunk/logDepth.frag":n(28),"chunk/logDepth_main.frag":n(29),"chunk/logDepth.vert":n(75),"chunk/logDepth_main.vert":n(83),"chunk/morph.vert":n(73),"chunk/morph_main.vert":n(78),"chunk/normal.frag":n(38),"chunk/normal.vert":n(71),"chunk/normal_main.frag":n(44),"chunk/normal_main.vert":n(81),"chunk/pbr.frag":n(85),"chunk/pbr_main.frag":n(87),"chunk/phong.frag":n(63),"chunk/phong_main.frag":n(66),"chunk/precision.frag":n(25),"chunk/precision.vert":n(49),"chunk/transparency.frag":n(42),"chunk/transparency_main.frag":n(46),"chunk/unQuantize.vert":n(68),"chunk/unQuantize_main.vert":n(77),"chunk/uv.frag":n(37),"chunk/uv.vert":n(70),"chunk/uv_main.vert":n(80),"method/encoding.glsl":n(86),"method/getDiffuse.glsl":n(58),"method/getLightAttenuation.glsl":n(60),"method/getShadow.glsl":n(62),"method/getSpecular.glsl":n(59),"method/packFloat.glsl":n(84),"method/textureEnvMap.glsl":n(41),"method/transpose.glsl":n(57),"method/unpackFloat.glsl":n(61),"basic.frag":n(50),"basic.vert":n(51),"geometry.frag":n(52),"pbr.frag":n(53),"screen.frag":n(54),"screen.vert":n(55)},init:function(t){this.renderer=t,this.commonHeader=this._getCommonHeader(this.renderer)},cache:{get:function(){return ht}},headerCache:{get:function(){return ft}},reset:function(t){ht.removeAll()},getHeaderKey:function(t,e,n,r,i){var a="header_"+e.id+"_"+n.lightInfo.uid;return t.isSkinedMesh&&(a+="_joint"+t.skeleton.jointCount),r&&(a+="_fog_"+r.mode),a+="_"+t.geometry.getShaderKey(),i&&(a+="_fogDepth"),a},getHeader:function(t,e,n,r,i){var a=this.getHeaderKey(t,e,n,r),s=ft.get(a);if(!s||e.isDirty){var o={};Object.assign(o,this.commonOptions);var u=e.lightType;u&&"NONE"!==u&&n.getRenderOption(o),e.getRenderOption(o),t.getRenderOption(o),r&&(o.HAS_FOG=1,r.getRenderOption(o)),i&&(o.USE_LOG_DEPTH=1,et.EXT_FRAG_DEPTH&&(o.USE_EXT_FRAG_DEPTH=1)),o.HAS_NORMAL&&o.NORMAL_MAP&&(o.HAS_TANGENT=1),o.RECEIVE_SHADOWS||(delete o.DIRECTIONAL_LIGHTS_SMC,delete o.SPOT_LIGHTS_SMC,delete o.POINT_LIGHTS_SMC),s="#define SHADER_NAME ".concat(e.className,"\n"),s+=Object.keys(o).map((function(t){return t.indexOf("HILO_CUSTUM_OPTION_")>-1?"#define ".concat(t.replace("HILO_CUSTUM_OPTION_","")," ").concat(o[t]):"#define HILO_".concat(t," ").concat(o[t])})).join("\n")+"\n",ft.add(a,s)}return s},_getCommonHeader:function(t){var e=et.getMaxPrecision(et.MAX_VERTEX_PRECISION,t.vertexPrecision),n=et.getMaxPrecision(et.MAX_FRAGMENT_PRECISION,t.fragmentPrecision),r=et.getMaxPrecision(e,n);return"\n#define HILO_MAX_PRECISION ".concat(r,"\n#define HILO_MAX_VERTEX_PRECISION ").concat(e,"\n#define HILO_MAX_FRAGMENT_PRECISION ").concat(n,"\n")},getShader:function(t,e,n,r,i,a){var s=this.getHeader(t,e,r,i,a);return e.isBasicMaterial||e.isPBRMaterial?this.getBasicShader(e,n,s):e.isShaderMaterial?this.getCustomShader(e.vs,e.fs,s,e.shaderCacheId||e.id,e.useHeaderCache):null},getBasicShader:function(t,e,n){var r="";e&&(r=(r=t.getInstancedUniforms().map((function(t){return t.name}))).join("|"));var i=t.className+":"+r;t.onBeforeCompile&&(i+=":"+(t.shaderCacheId||t.id));var a=ht.get(i);if(!a){var s="",o=at.a;if(t.isBasicMaterial?t.isGeometryMaterial?s+=ot.a:s+=rt.a:t.isPBRMaterial&&(s+=ct.a),t.onBeforeCompile){var u=t.onBeforeCompile(o,s);s=u.fs,o=u.vs}if(r){var c=new RegExp("^\\s*uniform\\s+(\\w+)\\s+(".concat(r,");"),"gm");o=o.replace(c,"attribute $1 $2;")}a=this.getCustomShader(o,s,n,i,!0)}if(a){var h=this._getNumId(a);null!==h&&(t._shaderNumId=h)}return a},_getNumId:function(t){var e=t.id.match(/_(\d+)/);return e&&e[1]?parseInt(e[1],10):null},getCustomShader:function(t,e,n,r,i){var a,s=this.commonHeader;return r&&(i&&(r+=":"+n),a=ht.get(r)),a||(a=new lt({vs:s+n+t,fs:s+n+e}),r&&ht.add(r,a)),a}},alwaysUse:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(ht.removeObject(this),this._isDestroyed=!0),this}}),dt=lt,mt=n(55),_t=n.n(mt),pt=n(54),gt=n.n(pt),vt=[{name:"FLOAT",byteSize:4,uniformFuncName:"uniform1f",type:"Scalar",size:1},{name:"FLOAT_VEC2",byteSize:8,uniformFuncName:"uniform2f",type:"Vector",size:2},{name:"FLOAT_VEC3",byteSize:12,uniformFuncName:"uniform3f",type:"Vector",size:3},{name:"FLOAT_VEC4",byteSize:16,uniformFuncName:"uniform4f",type:"Vector",size:4},{name:"FLOAT_MAT2",byteSize:16,uniformFuncName:"uniformMatrix2fv",type:"Matrix",size:4},{name:"FLOAT_MAT3",byteSize:36,uniformFuncName:"uniformMatrix3fv",type:"Matrix",size:9},{name:"FLOAT_MAT4",byteSize:64,uniformFuncName:"uniformMatrix4fv",type:"Matrix",size:16},{name:"INT",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"INT_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"INT_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"INT_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"BOOL",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"BOOL_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"BOOL_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"BOOL_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"SAMPLER_2D",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"SAMPLER_CUBE",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1}],Et={},Tt={dict:Et,init:function(t){vt.forEach((function(e){var n,r,i=e.name,a=e.uniformFuncName,s=a+"v";"Matrix"===e.type?n=r=function(e,n){void 0!==n&&t[a](e,!1,n)}:(n=function(e,n){void 0!==n&&t[a](e,n)},r=function(e,n){t[s](e,n)}),Et[t[i]]=Object.assign(e,{glValue:t[i],uniform:n,uniformArray:r})}))},get:function(t){return Et[t]}},Mt=new J,At=a.a.create({Statics:{cache:{get:function(){return Mt}},reset:function(t){Mt.each((function(t){t.destroy()}))},getProgram:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.id,i=Mt.get(r);return i||(i=new At({state:e,vertexShader:t.vs,fragShader:t.fs,ignoreError:n}),Mt.add(r,i)),i},getBlankProgram:function(t){var e=dt.getCustomShader("void main(){}","precision HILO_MAX_FRAGMENT_PRECISION float;void main(){gl_FragColor = vec4(0.0);}","","__hiloBlankShader");return this.getProgram(e,t,!0)}},className:"Program",isProgram:!0,fragShader:"",vertexShader:"",attributes:null,uniforms:null,program:null,gl:null,state:null,alwaysUse:!1,constructor:function(t){return this.id=d.a.generateUUID(this.className),Object.assign(this,t),this._dict={},this.attributes={},this.uniforms={},this.gl=this.state.gl,this.program=this.createProgram(),this.program?(this.initAttributes(),this.initUniforms(),this):this.ignoreError?this:At.getBlankProgram(t.state)},createProgram:function(){var t=this.gl,e=t.createProgram(),n=this.createShader(t.VERTEX_SHADER,this.vertexShader),r=this.createShader(t.FRAGMENT_SHADER,this.fragShader);if(n&&r){if(t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(e,t.LINK_STATUS)){var i=t.getProgramInfoLog(e);return m.a.error("compileProgramError: "+i,this),t.deleteProgram(e),null}return e}return null},useProgram:function(){this.state.useProgram(this.program)},createShader:function(t,e){var n=this.gl,r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(r);return m.a.error("compileShaderError: "+i,e.split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),null}return r},initAttributes:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),i=tt.instanced,a=function(r){var a=e.getActiveAttrib(n,r),s=a.name,o=a.type,u=a.size,c=e.getAttribLocation(n,s),h=Tt.get(o),f=function(t){var n=t.type,r=void 0===n?e.FLOAT:n,i=t.normalized,a=void 0!==i&&i,s=t.stride,o=void 0===s?0:s,u=t.offset,f=void 0===u?0:u,l=t.size,d=void 0===l?h.size:l;e.vertexAttribPointer(c,d,r,a,o,f)},l=function(){e.enableVertexAttribArray(c)},d=function(){},m=function(t,e){t[c]=e};if(i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i.vertexAttribDivisorANGLE(c,t)}),"Matrix"===h.type){var _=h.byteSize,p=h.size,g=Math.sqrt(p),v=4*g,E=function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;E((function(e){i.vertexAttribDivisorANGLE(e,t)}))})}t.attributes[s]={name:s,location:c,type:o,size:u,glTypeInfo:h,pointer:f,enable:l,divisor:d,addTo:m}},s=0;s1||o>1?function(t){f(c,t)}:function(e){t._dict[s]!==e&&(t._dict[s]=e,l(c,e))}})},s=0;s2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,It,e,n)},createBuffer:function(t,e,n,r){var i=n.bufferViewId,a=Rt.get(i);return a||(n.isDirty=!1,a=new yt(t,e,n.data,r),Rt.add(i,a),a)},createIndexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,Ot,e,n)}},className:"Buffer",isBuffer:!0,constructor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St;this.id=d.a.generateUUID(this.className),this.gl=t,this.target=e,this.usage=r,this.buffer=t.createBuffer(),n&&this.bufferData(n)},bind:function(){return this.gl.bindBuffer(this.target,this.buffer),this},bufferData:function(t){var e=this.gl,n=this.target,r=this.usage;return this.bind(),e.bufferData(n,t,r),this.data=t,this},bufferSubData:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.gl,i=this.target;return n||this.bind(),r.bufferSubData(i,t,e),this},uploadGeometryData:function(t){var e=this,n=t.subDataList;return!this.data||this.data.byteLength2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;r0&&void 0!==arguments[0]?arguments[0]:1;this.bind();var e=this.gl,n=this.mode;this.useInstanced&&(this.indexBuffer?this.instancedExtension.drawElementsInstancedANGLE(n,this.vertexCount,e.UNSIGNED_SHORT,0,t):this.instancedExtension.drawArraysInstancedANGLE(n,0,this.getVertexCount(),t))},addIndexBuffer:function(t,e){this.bind();var n=this.gl,r=this.indexBuffer;return this.indexType=t.type,r?t.isDirty&&(r.uploadGeometryData(t),this.vertexCount=t.length):((r=Nt.createIndexBuffer(n,t,e)).bind(),this.indexBuffer=r,this.vertexCount=t.length),r},addAttribute:function(t,e,n,r){this.bind();var i=this.gl,a=e.name,s=this[a];if(!s){var o=Nt.createVertexBuffer(i,t,n);o.bind(),e.enable(),e.pointer(t),s={attribute:e,buffer:o,geometryData:t},this.attributes.push(s),this[a]=s,e.addTo(this.activeStates,s),r&&r(s)}if(t.isDirty){var u=s.buffer;u.bind(),e.enable(),e.pointer(t),u.uploadGeometryData(t)}return s},addInstancedAttribute:function(t,e,n){this.bind();var r=this.gl,i=t.name,a=t.glTypeInfo,s=Ct.getTypedArray(Float32Array,e.length*a.size);e.forEach((function(t,e){void 0!==n(t)?Ct.fillArrayData(s,n(t),e*a.size):m.a.warn("no attributeData:"+i+"-"+t.name)}));var o,u=this[i];return u?(o=u.geometryData).data=s:o=new b(s,1),this.addAttribute(o,t,r.DYNAMIC_DRAW,(function(e){t.divisor(1),e.useInstanced=!0}))},getResources:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.attributes&&this.attributes.forEach((function(e){t.push(e.buffer)})),this.indexBuffer&&t.push(this.indexBuffer),t},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){var t=this;return this._isDestroyed||(this.instancedExtension=null,this.useVao&&(this.vaoExtension.deleteVertexArrayOES(this.vao),this.vao=null,this.vaoExtension=null),this.gl=null,this.indexBuffer=null,this.attributes.forEach((function(e){var n=e.attribute||{};t[n.name]=null})),this.attributes=null,this.activeStates=null,Ht.removeObject(this),this._isDestroyed=!0),this}}),Ft=Dt,Ut=P.a.TEXTURE_2D,Gt=P.a.RGBA,Bt=P.a.LINEAR,Vt=P.a.NEAREST,Xt=P.a.REPEAT,jt=P.a.CLAMP_TO_EDGE,kt=P.a.UNSIGNED_BYTE,zt=P.a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wt=P.a.UNPACK_FLIP_Y_WEBGL,Yt=P.a.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt=P.a.BROWSER_DEFAULT_WEBGL,Zt=P.a.NONE,Kt=new J,Qt=a.a.create({Statics:{cache:{get:function(){return Kt}},reset:function(t){Kt.each((function(e,n){t.deleteTexture(e),Kt.remove(n)}))}},isTexture:!0,className:"Texture",isImageCanRelease:!1,_isImageReleased:!1,_image:null,image:{get:function(){return this._isImageReleased&&m.a.errorOnce("Read Texture.image(".concat(this.id,")"),"Read Texture.image after image released!"),this._image},set:function(t){this._image=t,this._isImageReleased=!1}},_releaseImage:function(){this._canvasImage=null,this._canvasCtx=null,this._originImage=null,this._image=null,this.mipmaps=null,this._isImageReleased=!0},mipmaps:null,target:Ut,internalFormat:Gt,format:Gt,type:kt,width:0,height:0,border:0,magFilter:Bt,minFilter:Bt,wrapS:Xt,wrapT:Xt,name:"",premultiplyAlpha:!1,flipY:!1,colorSpaceConversion:!0,compressed:!1,needUpdate:!0,needDestroy:!1,autoUpdate:!1,uv:0,anisotropic:1,origWidth:{get:function(){return this._originImage?this._originImage.width||this.width:this.image&&this.image.width||this.width}},origHeight:{get:function(){return this.originImage?this._originImage.height||this.height:this.image&&this.image.height||this.height}},useMipmap:{get:function(){return this.minFilter!==Bt&&this.minFilter!==Vt},set:function(){m.a.warn("texture.useMipmap is readOnly!")}},useRepeat:{get:function(){return this.wrapS!==jt||this.wrapT!==jt},set:function(){m.a.warn("texture.useRepeat is readOnly!")}},mipmapCount:{get:function(){return Math.floor(Math.log2(Math.max(this.width,this.height))+1)},set:function(){m.a.warn("texture.mipmapCount is readOnly!")}},constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},isImgPowerOfTwo:function(t){return d.a.isPowerOfTwo(t.width)&&d.a.isPowerOfTwo(t.height)},getSupportSize:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.width,r=t.height;e&&!this.isImgPowerOfTwo(t)&&(n=d.a.nextPowerOfTwo(n),r=d.a.nextPowerOfTwo(r));var i=et.MAX_TEXTURE_SIZE;return i&&(n>i&&(n=i),r>i&&(r=i)),{width:n,height:r}},resizeImgToPowerOfTwo:function(t){var e=this.getSupportSize(t,!0);return this.resizeImg(t,e.width,e.height)},resizeImg:function(t,e,n){if(t.width===e&&t.height===n)return t;var r=this._canvasImage;return r?(r.width=e,r.height=n,this._canvasCtx=r.getContext("2d")):((r=document.createElement("canvas")).width=e,r.height=n,this._canvasImage=r,this._canvasCtx=r.getContext("2d")),this._canvasCtx.drawImage(t,0,0,t.width,t.height,0,0,e,n),m.a.warnOnce("Texture.resizeImg(".concat(this.id,")"),"image size(".concat(t.width,"x").concat(t.height,") is not support. Resized to ").concat(r.width,"x").concat(r.height),t.src),this._originImage=t,r},_glUploadTexture:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.width,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.height,s=t.gl;return this.compressed?s.compressedTexImage2D(e,r,this.internalFormat,i,a,this.border,n):n&&void 0!==n.width?s.texImage2D(e,r,this.internalFormat,this.format,this.type,n):s.texImage2D(e,r,this.internalFormat,i,a,this.border,this.format,this.type,n),this},_uploadTexture:function(t){var e=this;return this.useMipmap&&this.mipmaps?this.mipmaps.forEach((function(n,r){e._glUploadTexture(t,e.target,n.data,r,n.width,n.height)})):this._glUploadTexture(t,this.target,this.image,0),this},_updatePixelStorei:function(){var t=this.state;t.pixelStorei(zt,this.premultiplyAlpha),t.pixelStorei(Wt,!!this.flipY),t.pixelStorei(Yt,this.colorSpaceConversion?qt:Zt)},updateTexture:function(t,e){var n=t.gl;if(this.needUpdate||this.autoUpdate){this._originImage&&this.image===this._canvasImage&&(this.image=this._originImage);var r=this.useMipmap,i=this.useRepeat;if(this.image&&!this.image.length){var a=i||r,s=this.getSupportSize(this.image,a);this.image=this.resizeImg(this.image,s.width,s.height),this.width=this.image.width,this.height=this.image.height}t.activeTexture(n.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._uploadTexture(t),r&&(this.compressed?this.mipmaps||(m.a.warn("Compressed texture has no mipmips, changed the minFilter from ".concat(this.minFilter," to Linear!"),this),this.minFilter=Bt):n.generateMipmap(this.target)),n.texParameterf(this.target,n.TEXTURE_MAG_FILTER,this.magFilter),n.texParameterf(this.target,n.TEXTURE_MIN_FILTER,this.minFilter),n.texParameterf(this.target,n.TEXTURE_WRAP_S,this.wrapS),n.texParameterf(this.target,n.TEXTURE_WRAP_T,this.wrapT);var o=tt.textureFilterAnisotropic;o&&this.anisotropic>1&&n.texParameterf(this.target,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropic,et.MAX_TEXTURE_MAX_ANISOTROPY)),this.needUpdate=!1}return this._needUpdateSubTexture&&(this._uploadSubTextures(t,e),this._needUpdateSubTexture=!1),this},_uploadSubTextures:function(t,e){var n=this;if(this._subTextureList&&this._subTextureList.length>0){var r=t.gl;t.activeTexture(r.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._subTextureList.forEach((function(t){var e=t[0],i=t[1],a=t[2];r.texSubImage2D(n.target,0,e,i,n.format,n.type,a)})),this._subTextureList.length=0}},_needUpdateSubTexture:!1,_subTextureList:null,updateSubTexture:function(t,e,n){this._subTextureList||(this._subTextureList=[]),this._subTextureList.push([t,e,n]),this._needUpdateSubTexture=!0},getGLTexture:function(t){this.state=t;var e=this.gl=t.gl,n=this.id;this.needDestroy&&(this.destroy(),this.needDestroy=!1);var r=Kt.get(n);return r||(r=e.createTexture(),Kt.add(n,r),this.needUpdate=!0),this.updateTexture(t,r),this.isImageCanRelease&&this._releaseImage(),r},setGLTexture:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&this.destroy(),Kt.add(this.id,t),this},destroy:function(){var t=this.id,e=Kt.get(t);return e&&this.gl&&(this.gl.deleteTexture(e),Kt.remove(t)),this},clone:function(){var t=Object.assign({},this);return delete t.id,new this.constructor(t)}}),Jt=P.a.TEXTURE_2D,$t=P.a.RGBA,te=P.a.UNSIGNED_BYTE,ee=P.a.COLOR_ATTACHMENT0,ne=P.a.DEPTH_STENCIL,re=P.a.DEPTH_TEST,ie=P.a.CULL_FACE,ae=P.a.TRIANGLE_STRIP,se=P.a.NEAREST,oe=P.a.CLAMP_TO_EDGE,ue=new J,ce=a.a.create({Statics:{cache:{get:function(){return ue}},reset:function(t){ue.each((function(t){t.reset()}))},destroy:function(t){ue.each((function(t){t.destroy()}))}},className:"Framebuffer",isFramebuffer:!0,bufferInternalFormat:ne,target:Jt,format:$t,internalFormat:$t,type:te,minFilter:se,magFilter:se,wrapS:oe,wrapT:oe,data:null,attachment:ee,needRenderbuffer:!0,useVao:!0,renderer:null,texture:null,renderbuffer:null,framebuffer:null,_isInit:!1,constructor:function(t,e){this.id=d.a.generateUUID(this.className),this.renderer=t,Object.assign(this,e),this.width||(this.width=t.width),this.height||(this.height=t.height),ue.add(this.id,this)},init:function(){if(!this._isInit&&this.renderer.isInit){this._isInit=!0;var t=this.renderer;this.gl=t.gl,this.state=t.state,this.reset()}},reset:function(){this.destroyResource();var t=this.gl;this.framebuffer=t.createFramebuffer(),this.bind(),this.needRenderbuffer&&(this.renderbuffer=this.createRenderbuffer()),this.texture=this.createTexture(),this.isComplete()||m.a.warn("Framebuffer is not complete => "+t.checkFramebufferStatus(t.FRAMEBUFFER)),this.unbind()},isComplete:function(){var t=this.gl;return!(!t||t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)},bind:function(){this.init(),this._isInit&&this.state.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer)},unbind:function(){if(this.init(),this._isInit){var t=this.state;t.bindFramebuffer(this.gl.FRAMEBUFFER,t.preFramebuffer)}},clear:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new v.a(0,0,0,0);if(this._isInit){var e=this.gl;e.clearColor(t.r,t.g,t.b,t.a),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4?arguments[4]:void 0;if(this._isInit){var a=this.gl,s=this.state;s.disable(re),s.disable(ie),i&&this.clear(i);var o=dt.getCustomShader(_t.a,gt.a,"","FramebufferTextureShader"),u=Lt.getProgram(o,s);u.useProgram();var c="".concat(t,"_").concat(e,"_").concat(n,"_").concat(r,"_").concat(u.id),h=Ft.getVao(a,c,{useVao:this.useVao,useInstanced:!1,mode:ae});if(h.isDirty){h.isDirty=!1;var f=[t=2*t-1,e=1-2*e,t+(n*=2),e,t,e-(r*=2),t+n,e-r];h.addAttribute(new b(new Float32Array(f),2),u.attributes.a_position),h.addAttribute(new b(new Float32Array([0,1,1,1,0,0,1,0]),2),u.attributes.a_texcoord0)}s.activeTexture(a.TEXTURE0),s.bindTexture(a.TEXTURE_2D,this.texture.getGLTexture(s)),h.draw()}},createRenderbuffer:function(){var t=this.gl,e=this.width,n=this.height,r=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),r},createTexture:function(){var t=this.state,e=t.gl,n=new Qt({minFilter:this.minFilter,magFilter:this.magFilter,internalFormat:this.internalFormat,format:this.format,type:this.type,width:this.width,height:this.height,image:this.data,wrapS:this.wrapS,wrapT:this.wrapT}),r=n.getGLTexture(t);return e.framebufferTexture2D(e.FRAMEBUFFER,this.attachment,this.target,r,0),n},resize:function(t,e,n){(n||this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this._isInit&&this.reset())},readPixels:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Object(i.getTypedArrayClass)(this.type),s=new a(n*r*4);if(this._isInit){var o=this.gl;e=this.height-e-r,this.bind(),o.readPixels(t,e,n,r,this.format,this.type,s),this.unbind()}return s},destroy:function(){return this._isDestroyed||(this.destroyResource(),this.gl=null,ue.removeObject(this),this._isDestroyed=!0),this},destroyResource:function(){var t=this.gl;t&&(this.framebuffer&&(t.deleteFramebuffer(this.framebuffer),this.framebuffer=null),this.renderbuffer&&(t.deleteRenderbuffer(this.renderbuffer),this.renderbuffer=null),this.texture&&(this.texture.destroy(),this.texture=null))}}),he=P.a.TEXTURE_CUBE_MAP,fe=P.a.RGB,le=P.a.LINEAR,de=P.a.CLAMP_TO_EDGE,me=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,_e=a.a.create({Extends:Qt,isCubeTexture:!0,className:"CubeTexture",target:he,internalFormat:fe,format:fe,magFilter:le,minFilter:le,wrapS:de,wrapT:de,constructor:function(t){_e.superclass.constructor.call(this,t),this.image=this.image||[]},_uploadTexture:function(t){var e=this,n=this.image;Array.isArray(n)&&6===n.length?(n[0]&&n[0].width&&(this.width=n[0].width,this.height=n[0].height),n.forEach((function(n,r){e._glUploadTexture(t,me+r,n,0)}))):m.a.error("CubeTexture image must be an Array of length 6",n)},right:{get:function(){return this.image[0]},set:function(t){this.image[0]=t}},left:{get:function(){return this.image[1]},set:function(t){this.image[1]=t}},top:{get:function(){return this.image[2]},set:function(t){this.image[2]=t}},bottom:{get:function(){return this.image[3]},set:function(t){this.image[3]=t}},front:{get:function(){return this.image[4]},set:function(t){this.image[4]=t}},back:{get:function(){return this.image[5]},set:function(t){this.image[5]=t}}}),pe=_e,ge=P.a.TEXTURE_2D,ve=P.a.RGBA,Ee=P.a.NEAREST,Te=P.a.CLAMP_TO_EDGE,Me=P.a.FLOAT,Ae=a.a.create({Extends:Qt,isDataTexture:!0,className:"DataTexture",target:ge,internalFormat:ve,format:ve,type:Me,magFilter:Ee,minFilter:Ee,wrapS:Te,wrapT:Te,dataLength:0,resetSize:function(t){if(t!==this.dataLength){this.dataLength=t;var e=d.a.nextPowerOfTwo(t/4),n=Math.max(Math.log2(e),4),r=Math.floor(n/2),a=n-r;this.width=Math.pow(2,r),this.height=Math.pow(2,a),this.DataClass=Object(i.getTypedArrayClass)(this.type)}},data:{get:function(){return this.image},set:function(t){if(this.image!==t){this.resetSize(t.length);var e=this.width*this.height*4;e===t.length&&t instanceof this.DataClass?this.image=t:(this.image&&this.image.length===e||(this.image=new this.DataClass(e)),this.image.set(t,0)),this.needUpdate=!0}}},constructor:function(t){Ae.superclass.constructor.call(this,t)}}),Le=Ae;function Ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Oe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},n=this.lightType;e["LIGHT_TYPE_".concat(n)]=1,e.SIDE=this.side,"NONE"!==n&&(e.HAS_LIGHT=1),this.premultiplyAlpha&&(e.PREMULTIPLY_ALPHA=1);var r=this._textureOption.reset(e);return e.HAS_LIGHT&&(e.HAS_NORMAL=1,r.add(this.normalMap,"NORMAL_MAP",(function(){1!==t.normalMapScale&&(e.NORMAL_MAP_SCALE=1)}))),r.add(this.parallaxMap,"PARALLAX_MAP"),r.add(this.emission,"EMISSION_MAP"),r.add(this.transparency,"TRANSPARENCY_MAP"),this.ignoreTranparent&&(e.IGNORE_TRANSPARENT=1),this.alphaCutoff>0&&(e.ALPHA_CUTOFF=1),this.useHDR&&(e.USE_HDR=1),this.gammaCorrection&&(e.GAMMA_CORRECTION=1),this.receiveShadows&&(e.RECEIVE_SHADOWS=1),this.castShadows&&(e.CAST_SHADOWS=1),this.uvMatrix&&(e.UV_MATRIX=1),this.uvMatrix1&&(e.UV_MATRIX1=1),this.usePhysicsLight&&(e.USE_PHYSICS_LIGHT=1),this.isDiffuesEnvAndAmbientLightWorkTogether&&(e.IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER=1),r.update(),e},_textureOption:{uvTypes:null,option:null,reset:function(t){return this.option=t,this.uvTypes={},this},add:function(t,e,n){if(t&&t.isTexture){var r=this.uvTypes,i=this.option,a=t.uv||0;r[a]=1,i[e]=a,t.isCubeTexture&&(i["".concat(e,"_CUBE")]=1),n&&n(t)}return this},update:function(){var t=[0,1],e=this.uvTypes,n=this.option;for(var r in e)-1!==t.indexOf(Number(r))?n["HAS_TEXCOORD".concat(r)]=1:(m.a.warnOnce("Material._textureOption.update(".concat(r,")"),"uv_".concat(r," not support!")),n.HAS_TEXCOORD0=1);return this}},getInstancedUniforms:function(){var t=this._instancedUniforms;if(!this._instancedUniforms){var e=this.uniforms;for(var n in t=this._instancedUniforms=[],e){var r=this.getUniformInfo(n);r.isDependMesh&&!r.notSupportInstanced&&t.push({name:n,info:r})}}return t},getUniformData:function(t,e,n){return this.getUniformInfo(t).get(e,this,n)},getAttributeData:function(t,e,n){return this.getAttributeInfo(t).get(e,this,n)},getUniformInfo:function(t){return this.getInfo("uniforms",t)},getAttributeInfo:function(t){return this.getInfo("attributes",t)},getInfo:function(t,e){var n=this[t][e];return"string"==typeof n&&(n=Ue[n]),n&&n.get||(m.a.warnOnce("material.getInfo-"+e,"Material.getInfo: no this semantic:"+e),n=Qe),n},clone:function(){var t=new this.constructor;for(var e in this)"id"!==e&&(t[e]=this[e]);return t},destroyTextures:function(){this.getTextures().forEach((function(t){t.destroy()}))},getTextures:function(){var t=[];for(var e in this){var n=this[e];n&&n.isTexture&&t.push(n)}return t},_copyProps:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}}),$e=a.a.create({Extends:Je,isBasicMaterial:!0,className:"BasicMaterial",lightType:"BLINN-PHONG",diffuse:null,ambient:null,specular:null,emission:null,specularEnvMap:null,specularEnvMatrix:null,reflectivity:0,refractRatio:0,refractivity:0,shininess:32,usedUniformVectors:11,constructor:function(t){this.diffuse=new v.a(.5,.5,.5),this.specular=new v.a(1,1,1),this.emission=new v.a(0,0,0),$e.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT",u_shininess:"SHININESS",u_reflectivity:"REFLECTIVITY",u_refractRatio:"REFRACTRATIO",u_refractivity:"REFRACTIVITY",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvMatrix:"SPECULARENVMATRIX"}),this.addTextureUniforms({u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$e.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t),n=this.lightType;"PHONG"!==n&&"BLINN-PHONG"!==n||(t.HAS_SPECULAR=1);var r=this.diffuse;return r&&r.isTexture&&(r.isCubeTexture?t.DIFFUSE_CUBE_MAP=1:e.add(this.diffuse,"DIFFUSE_MAP")),t.HAS_LIGHT&&(e.add(this.specular,"SPECULAR_MAP"),e.add(this.ambient,"AMBIENT_MAP"),e.add(this.specularEnvMap,"SPECULAR_ENV_MAP")),e.update(),t}}),tn=$e,en=P.a.POSITION,nn=P.a.NORMAL,rn=P.a.DEPTH,an=P.a.DISTANCE,sn=P.a.NONE,on=a.a.create({Extends:tn,isGeometryMaterial:!0,className:"GeometryMaterial",vertexType:en,lightType:sn,writeOriginData:!1,constructor:function(t){on.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_cameraFar:"CAMERAFAR",u_cameraNear:"CAMERANEAR",u_cameraType:"CAMERATYPE"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(on.superclass.getRenderOption.call(this,t),t["VERTEX_TYPE_".concat(this.vertexType)]=1,this.vertexType){case en:t.HAS_FRAG_POS=1;break;case nn:t.HAS_NORMAL=1;break;case rn:break;case an:t.HAS_FRAG_POS=1}return this.writeOriginData&&(t.WRITE_ORIGIN_DATA=1),t}}),un=on,cn=a.a.create({Extends:O,isOrthographicCamera:!0,className:"OrthographicCamera",_left:-1,left:{get:function(){return this._left},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._left=t}},_right:1,right:{get:function(){return this._right},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._right=t}},_bottom:-1,bottom:{get:function(){return this._bottom},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._bottom=t}},_top:1,top:{get:function(){return this._top},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._top=t}},_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:1,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},constructor:function(t){cn.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=[this.left,this.bottom,-this.near],r=[this.right,this.bottom,-this.near],i=[this.right,this.top,-this.near],a=[this.left,this.top,-this.near],s=[this.left,this.bottom,-this.far],o=[this.right,this.bottom,-this.far],u=[this.right,this.top,-this.far],c=[this.left,this.top,-this.far];e.addRect(s,o,u,c),e.addRect(o,r,i,u),e.addRect(r,n,a,i),e.addRect(n,s,c,a),e.addRect(c,u,i,a),e.addRect(n,r,o,s),this._geometry=e}return this._geometry}}),hn=cn,fn=P.a.DEPTH,ln=P.a.BACK,dn=null,mn=new v.a(1,1,1),_n=new o.a,pn=function(t){return t.material.castShadows},gn=a.a.create({isLightShadow:!0,className:"LightShadow",light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,cameraInfo:null,debug:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},createFramebuffer:function(){this.framebuffer||(this.framebuffer=new ce(this.renderer,{width:this.width,height:this.height}),this.debug&&this.showShadowMap())},updateLightCamera:function(t){this.light.isDirectionalLight?this.updateDirectionalLightCamera(t):this.light.isSpotLight&&this.updateSpotLightCamera(t)},updateDirectionalLightCamera:function(t){var e=this.light;if(this.camera.lookAt(e.direction),this.cameraInfo)this.updateCustumCamera(this.cameraInfo);else{var n=t.getGeometry();if(n){this.camera.updateViewMatrix(),_n.multiply(this.camera.viewMatrix,t.worldMatrix);var r=n.getBounds(_n);this.camera.near=-r.zMax,this.camera.far=-r.zMin,this.camera.left=r.xMin,this.camera.right=r.xMax,this.camera.bottom=r.yMin,this.camera.top=r.yMax}}this.camera.updateViewMatrix()},updateCustumCamera:function(t){for(var e in t)this.camera[e]=t[e]},updateSpotLightCamera:function(t){var e=this.light;this.camera.lookAt(e.direction),this.cameraInfo?this.updateCustumCamera(this.cameraInfo):(this.camera.fov=2*e.outerCutoff,this.camera.near=.01,this.camera.far=t.far,this.camera.aspect=1),this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.light.isDirectionalLight?this.camera=new hn:this.light.isSpotLight&&(this.camera=new Q),this.camera.addTo(this.light)),(this.light.isDirty||this._cameraMatrixVersion!==t.matrixVersion)&&(this.updateLightCamera(t),this._cameraMatrixVersion=t.matrixVersion,this.light.isDirty=!1)},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;dn||(dn=new un({vertexType:fn,side:ln,writeOriginData:!0})),n.bind(),e.state.viewport(0,0,this.width,this.height),e.clear(mn),r.updateViewProjectionMatrix(),Ue.setCamera(r),e.forceMaterial=dn,this.renderShadowScene(e),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){t.renderList.traverse((function(e){pn(e)&&t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e.filter((function(t){return pn(t)})))}))},showShadowMap:function(){var t=this;this.renderer.on("afterRender",(function(){t.framebuffer.render(0,.7,.3,.3)}))}}),vn=P.a.DISTANCE,En=P.a.BACK,Tn=P.a.TEXTURE_CUBE_MAP,Mn=P.a.TEXTURE0,An=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,Ln=P.a.NEAREST,In=P.a.FRAMEBUFFER,On=P.a.FRAMEBUFFER_COMPLETE,Sn=null,Rn=new v.a(0,0,0,0),yn=new c.a,Nn=[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,-1,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,0,-1,0]],xn=function(t,e){if(t.material.castShadows){if(!t.frustumTest)return!0;if(e.isMeshVisible(t))return!0}return!1},Cn=a.a.create({isLightShadow:!0,className:"CubeLightShadow",Extends:gn,light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,debug:!1,constructor:function(t){Cn.superclass.constructor.call(this,t)},createFramebuffer:function(){if(!this.framebuffer){this.framebuffer=new ce(this.renderer,{target:Tn,width:1024,height:1024,createTexture:function(){var t=this.state.gl,e=new pe({image:[null,null,null,null,null,null],type:this.type,format:this.format,internalFormat:this.internalFormat,magFilter:Ln,minFilter:Ln,width:1024,height:1024});return t.checkFramebufferStatus(In)!==On&&m.a.warn("Framebuffer is not complete",t.checkFramebufferStatus(In)),e},bindTexture:function(t){t=t||0;var e=this.state,n=e.gl,r=this.texture.getGLTexture(e);e.activeTexture(Mn+et.MAX_TEXTURE_INDEX),e.bindTexture(this.target,r),n.framebufferTexture2D(In,this.attachment,An+t,r,0)}})}},updateLightCamera:function(t){this.camera.fov=90,this.camera.near=t.near,this.camera.far=t.far,this.camera.aspect=1,this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.camera=new Q,this.updateLightCamera(t))},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;Sn||(Sn=new un({vertexType:vn,side:En,writeOriginData:!1})),n.bind(),e.state.viewport(0,0,n.width,n.height),this.light.worldMatrix.getTranslation(r.position);for(var i=0;i<6;i++)n.bindTexture(i),yn.fromArray(Nn[0],3*i).add(r.position),r.up.fromArray(Nn[1],3*i),r.lookAt(yn),r.updateViewProjectionMatrix(),e.clear(Rn),Ue.setCamera(r),e.forceMaterial=Sn,this.renderShadowScene(e);r.matrix.identity(),r.updateViewProjectionMatrix(),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){var e=t.renderList,n=this.camera;e.traverse((function(e){xn(e,n)&&t.renderMesh(e)}),(function(e){var r=e.filter((function(t){return xn(t,n)}));t.renderInstancedMeshes(r)}))}}),bn=Cn,Pn=a.a.create({Extends:M,isPointLight:!0,className:"PointLight",constructor:function(t){Pn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new bn({light:this,renderer:t}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))}}),wn=Pn,Hn=new o.a,Dn=new c.a,Fn=a.a.create({Extends:M,isDirectionalLight:!0,className:"DirectionalLight",constructor:function(t){this.direction=new c.a(0,0,1),Fn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Dn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Dn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Hn);return Dn.copy(this.direction).transformDirection(e).normalize(),Dn}}),Un=Fn,Gn=new o.a,Bn=new c.a,Vn=a.a.create({Extends:M,isSpotLight:!0,className:"SpotLight",_cutoffCos:.9763,_cutoff:12.5,cutoff:{get:function(){return this._cutoff},set:function(t){this._cutoff=t,this._cutoffCos=Math.cos(d.a.degToRad(t))}},_outerCutoffCos:.9537,_outerCutoff:17.5,outerCutoff:{get:function(){return this._outerCutoff},set:function(t){this._outerCutoff=t,this._outerCutoffCos=Math.cos(d.a.degToRad(t))}},constructor:function(t){this.direction=new c.a(0,0,1),Vn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Bn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Bn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Gn);return Bn.copy(this.direction).transformDirection(e).normalize(),Bn}}),Xn=Vn,jn=a.a.create({Extends:Je,isShaderMaterial:!0,className:"ShaderMaterial",vs:"",fs:"",useHeaderCache:!1,constructor:function(t){jn.superclass.constructor.call(this,t)},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(jn.superclass.getRenderOption.call(this,t),this.getCustomRenderOption){var e=this.getCustomRenderOption({});for(var n in e)t["HILO_CUSTUM_OPTION_".concat(n)]=e[n]}return t},getCustomRenderOption:null}),kn=jn,zn=n(15),Wn=n.n(zn),Yn=a.a.create({Extends:Z,isMorphGeometry:!0,className:"MorphGeometry",isStatic:!1,weights:[],targets:null,constructor:function(t){Yn.superclass.constructor.call(this,t),this.weights=this.weights||[]},update:function(t,e){this.weights=t,this._originalMorphIndices=e},clone:function(){return Z.prototype.clone.call(this,{targets:this.targets,weights:this.weights})},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn.superclass.getRenderOption.call(this,e),this.targets&&(this._maxMorphTargetCount||(this._maxMorphTargetCount=Math.floor(8/Object.keys(this.targets).length)),Object(i.each)(this.targets,(function(n,r){e.MORPH_TARGET_COUNT=Math.min(n.length,t._maxMorphTargetCount),"vertices"===r?e.MORPH_HAS_POSITION=1:"normals"===r?e.MORPH_HAS_NORMAL=1:"tangents"===r&&(e.MORPH_HAS_TANGENT=1)}))),e}}),qn=Yn,Zn={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},Kn={Geometry:Z,GeometryData:b};var Qn={_decodeTotalTime:0,wasmURL:"",workerURL:"",useWASM:!0,useWebWorker:!0,useAuto:!0,init:function(){return Qn.useAuto?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Qn.useWebWorker?Wn.a.initWorker(Qn.workerURL):Qn.useWASM?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Promise.resolve()},parse:function(t,e,n,r){var i=Date.now(),a=e.bufferViews[t.bufferView],s=Qn.wasmURL,o=Qn.workerURL,u=Qn.useAuto,c=Qn.useWASM,h=Qn.useWebWorker,f=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);function l(e){Qn._decodeTotalTime+=Date.now()-i;var n=e.toHilo3dGeometry(Kn,r.primitive._geometry);return t.targets&&(n=function(t,e,n){if(!n.isMorphGeometry){var r=new qn;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&"id"!==i&&(r[i]=n[i]);r.targets={},n=r}for(var a=n.targets,s=0;s0&&void 0!==arguments[0]?arguments[0]:{};return t["FOG_".concat(this.mode)]=1,t}}),hr=n(16),fr=new hr.a,lr=new o.a,dr=a.a.create({Extends:g,isMesh:!0,className:"Mesh",geometry:null,material:null,useInstanced:!1,frustumTest:!0,constructor:function(t){dr.superclass.constructor.call(this,t)},clone:function(t){var e=g.prototype.clone.call(this,t);return Object.assign(e,{geometry:this.geometry,material:this.material}),e},raycast:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.visible)return null;var n=this.geometry,r=this.material,i=this.worldMatrix;if(n&&r){lr.invert(i),fr.copy(t),fr.transformMat4(lr);var a=n.raycast(fr,r.side,e);if(a)return a.forEach((function(t){t.transformMat4(i)})),a}return null},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.geometry.getRenderOption(t),t},isDestroyed:{get:function(){return this._isDestroyed}},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._isDestroyed)return this;this.removeFromParent();var n=t.resourceManager;return n.destroyMesh(this),this.material&&e&&this.material.destroyTextures(),this.off(),this.geometry=null,this.material=null,this._isDestroyed=!0,this}}),mr=dr,_r=new o.a,pr=new o.a,gr=a.a.create({Extends:mr,isSkinedMesh:!0,className:"SkinedMesh",useInstanced:!1,jointMatTexture:null,frustumTest:!1,skeleton:null,constructor:function(t){gr.superclass.constructor.call(this,t)},getJointMat:function(){var t=this;if(this.skeleton&&!(this.skeleton.jointCount<=0)){var e=this.skeleton.jointNodeList,n=this.skeleton.inverseBindMatrices,r=16*this.skeleton.jointCount;return this.jointMat&&this.jointMat.length===r||(this.jointMat=new Float32Array(r)),this.clonedFrom?pr.invert(this.clonedFrom.worldMatrix):pr.invert(this.worldMatrix),e.forEach((function(e,r){_r.copy(pr),_r.multiply(e.worldMatrix),_r.multiply(n[r]),_r.toArray(t.jointMat,16*r)})),this.jointMat}},resetJointNamesByNodeName:function(t){this.skeleton.resetJointNamesByNodeName(t)},resetSkinIndices:function(t){var e=this.skeleton;if(e){var n=this.geometry,r=n.skinIndices;if(r){this.material.isDirty=!0,n.isDirty=!0,r.isDirty=!0;var i=new R.a;r.traverse((function(n,a,s){n.elements.forEach((function(n,r){var a=e.jointNames[n],s=t.jointNames.indexOf(a);s>=0?i.elements[r]=s:m.a.warnOnce("SkinedMesh.resetSkinIndices","SkinedMesh.resetSkinIndices: no jointName found!",a)})),r.setByOffset(s,i)}))}}},initJointMatTexture:function(){if(!this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture=new Le({data:t})}return this.jointMatTexture},updateJointMatTexture:function(){if(this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture.data.set(t,0),this.jointMatTexture.needUpdate=!0}else this.initJointMatTexture()},clone:function(t){var e=mr.prototype.clone.call(this,t);return Object.assign(e,{useInstanced:this.useInstanced,skeleton:this.skeleton.clone()}),e.clonedFrom=this,e},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};gr.superclass.getRenderOption.call(this,t);var e=this.skeleton.jointCount;if(e&&(t.JOINT_COUNT=e,et.VERTEX_TEXTURE_FLOAT)){var n=(et.MAX_VERTEX_UNIFORM_VECTORS-22)/4;e>n&&(t.JOINT_MAT_MAP=1)}return t}}),vr=gr,Er=a.a.create({isSkeleton:!0,className:"Skeleton",userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.jointNodeList=[],this.jointNames=[],this.inverseBindMatrices=[],Object.assign(this,t)},jointCount:{get:function(){return this.jointNodeList.length}},_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,t&&this._initJointNodeList()}},_initJointNodeList:function(){var t={};this.rootNode.traverse((function(e){t[e.jointName]=e})),this.jointNodeList=this.jointNames.map((function(e){return t[e]}))},resetJointNamesByNodeName:function(t){var e=this.jointNames;this.jointNodeList.forEach((function(n,r){var i=t.rootNode.getChildByName(n.name);i&&(e[r]=i.jointName)}))},clone:function(t){var e=new Er;return e.copy(this,t),e},copy:function(t,e){return this.inverseBindMatrices=t.inverseBindMatrices,this.jointNames=t.jointNames.slice(),void 0===e&&(e=t.rootNode),this.rootNode=e,this}}),Tr=Er,Mr="1.15.20",Ar=a.a.create({className:"RenderInfo",isRenderInfo:!0,constructor:function(){this.reset()},addFaceCount:function(t){this._currentFaceCount+=t},addDrawCount:function(t){this._currentDrawCount+=t},reset:function(){this.faceCount=Math.floor(this._currentFaceCount),this.drawCount=Math.floor(this._currentDrawCount),this._currentFaceCount=0,this._currentDrawCount=0}}),Lr=new c.a,Ir=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;if(n!==r)return n-r;var i=t.material._shaderNumId||0,a=e.material._shaderNumId||0;return i!==a?i-a:t._sortRenderZ-e._sortRenderZ},Or=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;return n!==r?n-r:e._sortRenderZ-t._sortRenderZ},Sr=a.a.create({className:"RenderList",isRenderList:!0,useInstanced:!1,constructor:function(){this.opaqueList=[],this.transparentList=[],this.instancedDict={}},reset:function(){this.opaqueList.length=0,this.transparentList.length=0,this.instancedDict={}},traverse:function(t,e){this.opaqueList.forEach((function(e){t(e)}));var n=this.instancedDict;for(var r in n){var i=n[r];i.length>2&&e?e(i):i.forEach((function(e){t(e)}))}this.transparentList.forEach((function(e){t(e)}))},sort:function(){this.transparentList.sort(Or),this.opaqueList.sort(Ir)},addMesh:function(t,e){var n=t.material,r=t.geometry;if(n&&r){if(t.frustumTest&&!e.isMeshVisible(t))return;if(this.useInstanced&&t.useInstanced){var i=this.instancedDict,a=n.id+"_"+r.id,s=i[a];i[a]||(s=i[a]=[]),s.push(t)}else t.worldMatrix.getTranslation(Lr),Lr.transformMat4(e.viewProjectionMatrix),t._sortRenderZ=Lr.z,n.transparent?this.transparentList.push(t):this.opaqueList.push(t)}else m.a.warnOnce("RenderList.addMesh(".concat(t.id,")"),"Mesh must have material and geometry",t)}}),Rr=a.a.create({className:"WebGLState",isWebGLState:!0,systemFramebuffer:null,constructor:function(t){this.gl=t,this.reset()},reset:function(){this._dict={},this.activeTextureIndex=null,this.textureUnitDict={},this.currentFramebuffer=null,this.preFramebuffer=null,this._pixelStorei={}},enable:function(t){!0!==this._dict[t]&&(this._dict[t]=!0,this.gl.enable(t))},disable:function(t){!1!==this._dict[t]&&(this._dict[t]=!1,this.gl.disable(t))},bindFramebuffer:function(t,e){this.currentFramebuffer!==e&&(this.preFramebuffer=this.currentFramebuffer,this.currentFramebuffer=e,this.gl.bindFramebuffer(t,e))},bindSystemFramebuffer:function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,this.systemFramebuffer)},useProgram:function(t){this.set1("useProgram",t)},depthFunc:function(t){this.set1("depthFunc",t)},depthMask:function(t){this.set1("depthMask",t)},clear:function(t){this.gl.clear(t)},depthRange:function(t,e){this.set2("depthRange",t,e)},stencilFunc:function(t,e,n){this.set3("stencilFunc",t,e,n)},stencilMask:function(t){this.set1("stencilMask",t)},stencilOp:function(t,e,n){this.set3("stencilOp",t,e,n)},colorMask:function(t,e,n,r){this.set4("colorMask",t,e,n,r)},cullFace:function(t){this.set1("cullFace",t)},frontFace:function(t){this.set1("frontFace",t)},blendFuncSeparate:function(t,e,n,r){this.set4("blendFuncSeparate",t,e,n,r)},blendEquationSeparate:function(t,e){this.set2("blendEquationSeparate",t,e)},pixelStorei:function(t,e){this._pixelStorei[t]!==e&&(this._pixelStorei[t]=e,this.gl.pixelStorei(t,e))},viewport:function(t,e,n,r){this.set4("viewport",t,e,n,r)},activeTexture:function(t){this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},bindTexture:function(t,e){var n=this.getActiveTextureUnit();n[t]!==e&&(n[t]=e,this.gl.bindTexture(t,e))},getActiveTextureUnit:function(){var t=this.textureUnitDict[this.activeTextureIndex];return t||(t=this.textureUnitDict[this.activeTextureIndex]={}),t},set1:function(t,e){this._dict[t]!==e&&(this._dict[t]=e,this.gl[t](e))},set2:function(t,e,n){var r=this._dict[t];r||(r=this._dict[t]=[]),r[0]===e&&r[1]===n||(r[0]=e,r[1]=n,this.gl[t](e,n))},set3:function(t,e,n,r){var i=this._dict[t];i||(i=this._dict[t]=[]),i[0]===e&&i[1]===n&&i[2]===r||(i[0]=e,i[1]=n,i[2]=r,this.gl[t](e,n,r))},set4:function(t,e,n,r,i){var a=this._dict[t];a||(a=this._dict[t]=[]),a[0]===e&&a[1]===n&&a[2]===r&&a[3]===i||(a[0]=e,a[1]=n,a[2]=r,a[3]=i,this.gl[t](e,n,r,i))},get:function(t){return this._dict[t]}}),yr=a.a.create({Mixes:s.a,className:"WebGLResourceManager",isWebGLResourceManager:!0,hasNeedDestroyResource:!1,constructor:function(t){this._needDestroyResources=[],Object.assign(this,t)},destroyMesh:function(t){var e=this;this.getMeshResources(t).forEach((function(t){e.destroyIfNoRef(t)})),t._vao=t._program=t._shader=null},getMeshResources:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t._shader&&e.push(t._shader),t._vao&&(e.push(t._vao),t._vao.getResources(e)),t._program&&e.push(t._program),e},destroyIfNoRef:function(t){var e=this._needDestroyResources;return t&&e.indexOf(t)<0&&e.push(t),this},getUsedResources:function(t){var e=this,n=[];return t&&t.traverse((function(t){t.isMesh&&!t.isDestroyed&&e.getMeshResources(t,n)})),n},destroyUnsuedResource:function(t){var e=this,n=this._needDestroyResources;if(0===n.length)return this;var r=this.getUsedResources(t);return n.forEach((function(t){r.indexOf(t)<0&&t&&t.destroy&&!t.alwaysUse&&(e.fire("destroyResource",t.id),t.destroy())})),this.reset(),this},reset:function(){return this._needDestroyResources.length=0,this}}),Nr=new o.a,xr=new c.a,Cr=new Float32Array([0,0,0]),br=a.a.create({isLightManager:!0,className:"LightManager",constructor:function(t){this.ambientLights=[],this.directionalLights=[],this.pointLights=[],this.spotLights=[],this.areaLights=[],this.lightInfo={AMBIENT_LIGHTS:0,POINT_LIGHTS:0,DIRECTIONAL_LIGHTS:0,SPOT_LIGHTS:0,AREA_LIGHTS:0,uid:0},Object.assign(this,t)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.each)(this.lightInfo,(function(n,r){if("uid"!==r&&n){e[r]=n;var i=t.getShadowMapCount(r);i&&(e[r+"_SMC"]=i)}})),e},addLight:function(t){var e=null;return t.enabled?(t.isAmbientLight?e=this.ambientLights:t.isDirectionalLight?e=this.directionalLights:t.isPointLight?e=this.pointLights:t.isSpotLight?e=this.spotLights:t.isAreaLight?e=this.areaLights:m.a.warnOnce("LightManager.addLight(".concat(t.id,")"),"Not support this light:",t),e&&(t.shadow?e.unshift(t):e.push(t)),this):this},getDirectionalInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[];this.directionalLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(e,c),o.getViewDirection(t).toArray(n,c),o.shadow&&o.lightShadow&&(r.push(o.lightShadow.framebuffer.texture),i.push(o.lightShadow.width),i.push(o.lightShadow.height),s.push(o.lightShadow.minBias,o.lightShadow.maxBias),Nr.copy(t.worldMatrix),Nr.premultiply(o.lightShadow.camera.viewProjectionMatrix),Nr.toArray(a,16*u))}));var o={colors:new Float32Array(e),infos:new Float32Array(n)};return r.length&&(o.shadowMap=r,o.shadowMapSize=new Float32Array(i),o.shadowBias=new Float32Array(s),o.lightSpaceMatrix=new Float32Array(a)),o},getSpotInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[],c=[],h=[];this.spotLights.forEach((function(f,l){var d=3*l;f.getRealColor().toRGBArray(e,d),f.toInfoArray(n,d),f.getViewDirection(t).toArray(i,d),h.push(f.range),a.push(f._cutoffCos,f._outerCutoffCos),t.getModelViewMatrix(f,Nr),Nr.getTranslation(xr),xr.toArray(r,d),f.shadow&&f.lightShadow&&(s.push(f.lightShadow.framebuffer.texture),o.push(f.lightShadow.width),o.push(f.lightShadow.height),c.push(f.lightShadow.minBias,f.lightShadow.maxBias),Nr.multiply(f.lightShadow.camera.viewProjectionMatrix,t.worldMatrix),Nr.toArray(u,16*l))}));var f={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),dirs:new Float32Array(i),cutoffs:new Float32Array(a),ranges:new Float32Array(h)};return s.length&&(f.shadowMap=s,f.shadowMapSize=new Float32Array(o),f.shadowBias=new Float32Array(c),f.lightSpaceMatrix=new Float32Array(u)),f},getPointInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[];this.pointLights.forEach((function(c,h){var f=3*h;c.getRealColor().toRGBArray(e,f),c.toInfoArray(n,f),u.push(c.range),t.getModelViewMatrix(c,Nr),Nr.getTranslation(xr),xr.toArray(r,f),c.shadow&&c.lightShadow&&(i.push(c.lightShadow.framebuffer.texture),s.push(c.lightShadow.minBias,c.lightShadow.maxBias),t.worldMatrix.toArray(a,16*h),o[2*h]=c.lightShadow.camera.near,o[2*h+1]=c.lightShadow.camera.far)}));var c={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),ranges:new Float32Array(u)};return i.length&&(c.shadowMap=i,c.shadowBias=new Float32Array(s),c.lightSpaceMatrix=new Float32Array(a),c.cameras=new Float32Array(o)),c},getAreaInfo:function(t){var e,n,r=[],i=[],a=[],s=[];return this.areaLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(r,c),t.getModelViewMatrix(o,Nr),Nr.getTranslation(xr),xr.toArray(i,c);var h=Nr.getRotation();Nr.fromQuat(h),xr.set(.5*o.width,0,0),xr.transformMat4(Nr),xr.toArray(a,c),xr.set(0,.5*o.height,0),xr.transformMat4(Nr),xr.toArray(s,c),e=o.ltcTexture1,n=o.ltcTexture2})),{colors:new Float32Array(r),poses:new Float32Array(i),width:new Float32Array(a),height:new Float32Array(s),ltcTexture1:e,ltcTexture2:n}},getAmbientInfo:function(){return Cr[0]=Cr[1]=Cr[2]=0,this.ambientLights.forEach((function(t){var e=t.getRealColor();Cr[0]+=e.r,Cr[1]+=e.g,Cr[2]+=e.b})),Cr[0]=Math.min(1,Cr[0]),Cr[1]=Math.min(1,Cr[1]),Cr[2]=Math.min(1,Cr[2]),Cr},updateInfo:function(t){var e=this.lightInfo,n=this.ambientLights,r=this.directionalLights,i=this.pointLights,a=this.spotLights,s=this.areaLights;e.AMBIENT_LIGHTS=n.length,e.POINT_LIGHTS=i.length,e.DIRECTIONAL_LIGHTS=r.length,e.SPOT_LIGHTS=a.length,e.AREA_LIGHTS=s.length;var o=function(t){return!!t.shadow};e.SHADOW_POINT_LIGHTS=i.filter(o).length,e.SHADOW_SPOT_LIGHTS=a.filter(o).length,e.SHADOW_DIRECTIONAL_LIGHTS=r.filter(o).length,e.uid=[e.AMBIENT_LIGHTS,e.POINT_LIGHTS,e.SHADOW_POINT_LIGHTS,e.DIRECTIONAL_LIGHTS,e.SHADOW_DIRECTIONAL_LIGHTS,e.SPOT_LIGHTS,e.SHADOW_SPOT_LIGHTS,e.AREA_LIGHTS].join("_"),this.directionalInfo=this.getDirectionalInfo(t),this.pointInfo=this.getPointInfo(t),this.spotInfo=this.getSpotInfo(t),this.areaInfo=this.getAreaInfo(t),this.ambientInfo=this.getAmbientInfo()},getInfo:function(){return this.lightInfo},reset:function(){this.ambientLights.length=0,this.directionalLights.length=0,this.pointLights.length=0,this.spotLights.length=0,this.areaLights.length=0},getShadowMapCount:function(t){var e=[];"POINT_LIGHTS"===t?e=this.pointLights:"DIRECTIONAL_LIGHTS"===t?e=this.directionalLights:("SPOT_LIGHTS"===t||"AREA_LIGHTS"===t)&&(e=this.spotLights);var n=0;return e.forEach((function(t){n+=t.shadow?1:0})),n},createShadowMap:function(t,e){this.directionalLights.forEach((function(n){n.createShadowMap(t,e)})),this.spotLights.forEach((function(n){n.createShadowMap(t,e)})),this.pointLights.forEach((function(n){n.createShadowMap(t,e)})),this.areaLights.forEach((function(n){n.createShadowMap(t,e)}))}}),Pr=P.a.DEPTH_TEST,wr=P.a.STENCIL_TEST,Hr=P.a.SAMPLE_ALPHA_TO_COVERAGE,Dr=P.a.CULL_FACE,Fr=P.a.FRONT_AND_BACK,Ur=P.a.BLEND,Gr=P.a.LINES,Br=P.a.STATIC_DRAW,Vr=P.a.DYNAMIC_DRAW,Xr=a.a.create({Mixes:s.a,className:"WebGLRenderer",isWebGLRenderer:!0,gl:null,width:0,height:0,pixelRatio:1,domElement:null,useInstanced:!1,useVao:!0,alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,gameMode:!1,useFramebuffer:!1,framebufferOption:{},useLogDepth:!1,vertexPrecision:"highp",fragmentPrecision:"highp",fog:null,offsetX:0,offsetY:0,isInitFailed:!1,_isInit:!1,_isContextLost:!1,constructor:function(t){this.clearColor=new v.a(1,1,1),Object.assign(this,t),this.renderInfo=new Ar,this.renderList=new Sr,this.lightManager=new br,this.resourceManager=new yr},resize:function(t,e,n){if(n||this.width!==t||this.height!==e){var r=this.domElement;this.width=t,this.height=e,r.width=t,r.height=e,this.framebuffer&&this.framebuffer.resize(this.width,this.height,n),this.viewport()}},setOffset:function(t,e){this.offsetX===t&&this.offsetY===e||(this.offsetX=t,this.offsetY=e,this.viewport())},viewport:function(t,e,n,r){var i=this.state,a=this.gl;i&&(void 0===t?t=this.offsetX:this.offsetX=t,void 0===e?e=this.offsetY:this.offsetY=e,void 0===n&&(n=a.drawingBufferWidth),void 0===r&&(r=a.drawingBufferHeight),i.viewport(t,e,n,r))},isInit:{get:function(){return this._isInit&&!this.isInitFailed}},onInit:function(t){var e=this;this._isInit?t(this):this.on("init",(function(){t(e)}),!0)},initContext:function(){if(!this._isInit){this._isInit=!0;try{this._initContext(),this.fire("init")}catch(t){this.isInitFailed=!0,this.fire("initFailed",t)}}},_initContext:function(){var t=this,e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat};!0===this.preserveDrawingBuffer&&(e.preserveDrawingBuffer=!0),!0===this.gameMode&&(e.gameMode=!0);var n=this.gl=this.domElement.getContext("webgl",e);n.viewport(0,0,this.width,this.height),Tt.init(n),tt.init(n),et.init(n),dt.init(this),this.state=new Rr(n),tt.instanced||(this.useInstanced=!1),this.renderList.useInstanced=this.useInstanced,tt.vao||(this.useVao=!1),this.useFramebuffer&&(this.framebuffer=new ce(this,Object.assign({useVao:this.useVao,width:this.width,height:this.height},this.framebufferOption))),this.domElement.addEventListener("webglcontextlost",(function(e){t._onContextLost(e)}),!1),this.domElement.addEventListener("webglcontextrestored",(function(e){t._onContextRestore(e)}),!1)},_onContextLost:function(t){var e=this.gl;this._isContextLost=!0,t.preventDefault(),Lt.reset(e),dt.reset(e),Qt.reset(e),Nt.reset(e),Ft.reset(e),this.state.reset(e),this._lastMaterial=null,this._lastProgram=null,this.fire("webglContextLost")},_onContextRestore:function(t){var e=this.gl;this._isContextLost=!1,tt.reset(e),ce.reset(e),this.fire("webglContextRestored")},setupDepthTest:function(t){var e=this.state;t.depthTest?(e.enable(Pr),e.depthFunc(t.depthFunc),e.depthMask(t.depthMask),e.depthRange(t.depthRange[0],t.depthRange[1])):e.disable(Pr)},setupSampleAlphaToCoverage:function(t){var e=this.state;t.sampleAlphaToCoverage?e.enable(Hr):e.disable(Hr)},setupCullFace:function(t){var e=this.state;t.cullFace&&t.cullFaceType!==Fr?(e.enable(Dr),e.cullFace(t.cullFaceType),e.frontFace(t.frontFace)):e.disable(Dr)},setupBlend:function(t){var e=this.state;t.blend?(e.enable(Ur),e.blendFuncSeparate(t.blendSrc,t.blendDst,t.blendSrcAlpha,t.blendDstAlpha),e.blendEquationSeparate(t.blendEquation,t.blendEquationAlpha)):e.disable(Ur)},setupStencil:function(t){if(this.stencil){var e=this.state;t.stencilTest?(e.enable(wr),e.stencilMask(t.stencilMask),e.stencilFunc(t.stencilFunc,t.stencilFuncRef,t.stencilFuncMask),e.stencilOp(t.stencilOpFail,t.stencilOpZFail,t.stencilOpZPass)):e.disable(wr)}},setupUniforms:function(t,e,n,r){var i=this.forceMaterial||e.material;for(var a in t.uniforms){var s=i.getUniformInfo(a),o=t.uniforms[a];if(!s.isBlankInfo&&(r||s.isDependMesh&&!n)){var u=s.get(e,i,o);null!=u&&(t[a]=u)}}},setupVao:function(t,e,n){var r=n.geometry,i=r.isStatic;if(t.isDirty||!i||r.isDirty){t.isDirty=!1;var a=this.forceMaterial||n.material,s=a.attributes,o=i?Br:Vr;for(var u in s){var c=e.attributes[u];if(c){var h=a.getAttributeData(u,n,c);null!=h&&t.addAttribute(h,c,o)}}r.indices&&t.addIndexBuffer(r.indices,o),r.isDirty=!1}r.vertexCount&&(t.vertexCount=r.vertexCount)},setupMaterial:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=this.forceMaterial||e.material;(i.isDirty||this._lastMaterial!==i)&&(this.setupDepthTest(i),this.setupSampleAlphaToCoverage(i),this.setupCullFace(i),this.setupBlend(i),this.setupStencil(i),r=!0),this.setupUniforms(t,e,n,r),i.isDirty=!1,this._lastMaterial=i},setupMesh:function(t,e){var n=this.gl,r=this.state,i=this.lightManager,a=t.geometry,s=this.forceMaterial||t.material,o=dt.getShader(t,s,e,i,this.fog,this.useLogDepth),u=Lt.getProgram(o,r);u.useProgram(),this.setupMaterial(u,t,e,this._lastProgram!==u),this._lastProgram=u,t.material.wireframe&&a.mode!==Gr&&a.convertToLinesMode();var c=a.id+u.id,h=Ft.getVao(n,c,{useInstanced:e,useVao:this.useVao,mode:a.mode});return this.setupVao(h,u,t),t._vao=h,t._shader=o,t._program=u,{vao:h,program:u,geometry:a}},addRenderInfo:function(t,e){var n=this.renderInfo;n.addFaceCount(t),n.addDrawCount(e)},render:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.initContext(),!this.isInitFailed&&!this._isContextLost){var r=this.renderList,i=this.renderInfo,a=this.lightManager,s=this.resourceManager,o=this.state;this.fog=t.fog,a.reset(),i.reset(),r.reset(),Ue.init(this,o,e,a,this.fog),t.updateMatrixWorld(),e.updateViewProjectionMatrix(),t.traverse((function(t){return t.visible?(t.isMesh?r.addMesh(t,e):t.isLight&&a.addLight(t),g.TRAVERSE_STOP_NONE):g.TRAVERSE_STOP_CHILDREN})),r.sort(),a.createShadowMap(this,e),a.updateInfo(e),n&&this.fire("beforeRender"),this.useFramebuffer&&this.framebuffer.bind(),this.clear(),n&&this.fire("beforeRenderScene"),this.renderScene(),this.useFramebuffer&&this.renderToScreen(this.framebuffer),n&&this.fire("afterRender"),s.destroyUnsuedResource(t)}},renderScene:function(){var t=this;this.renderList.traverse((function(e){t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e)})),this._gameModeSumbit()},_gameModeSumbit:function(){var t=this.gl;this.gameMode&&t&&t.submit&&t.submit()},clear:function(t){var e=this.gl,n=this.state;t=t||this.clearColor,this._lastMaterial=null,this._lastProgram=null,e.clearColor(t.r,t.g,t.b,t.a),n.depthMask(!0);var r=e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT;this.stencil&&(n.stencilMask(!0),r|=e.STENCIL_BUFFER_BIT),e.clear(r)},clearDepth:function(){var t=this.gl;this.state.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},clearStencil:function(){var t=this.gl;this.state.stencilMask(!0),t.clear(t.STENCIL_BUFFER_BIT)},renderToScreen:function(t){this.state.bindSystemFramebuffer(),t.render(0,0,1,1,this.clearColor)},renderMesh:function(t){var e=this.setupMesh(t,!1).vao;e.draw(),this.addRenderInfo(e.vertexCount/3,1)},renderInstancedMeshes:function(t){var e=t[0];if(e){var n=this.forceMaterial||e.material,r=this.setupMesh(e,!0),i=r.vao,a=r.program;n.getInstancedUniforms().forEach((function(e){var n=e.name,r=e.info,s=a.attributes[n];s&&i.addInstancedAttribute(s,t,(function(t){return r.get(t)}))})),i.drawInstance(t.length),this.addRenderInfo(i.vertexCount/3*t.length,1)}},renderMultipleMeshes:function(t){var e=this;t.forEach((function(t){e.renderMesh(t)}))},releaseGLResource:function(){var t=this.gl;t&&(Lt.reset(t),dt.reset(t),Nt.reset(t),Ft.reset(t),this.state.reset(t),Qt.reset(t),ce.destroy(t))}}),jr=function(){var t,e=navigator.userAgent,n=document,r=window,i=n.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in r,supportCanvas:!!n.createElement("canvas").getContext,supportStorage:void 0,supportOrientation:"orientation"in r||"orientation"in r.screen,supportDeviceMotion:"ondevicemotion"in r};try{localStorage.setItem("hilo","hilo"),localStorage.removeItem("hilo"),a.supportStorage=!0}catch(t){a.supportStorage=!1,m.a.warn("LocalStorage disabled")}t=a.webkit||a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",a.jsVendor=t;var s=a.cssVendor="-"+t+"-",o=n.createElement("div"),u=o.style,c=void 0!==u[t+"Transform"],h=void 0!==u[t+"Perspective"];h&&(o.id="test3d",(u=n.createElement("style")).textContent="@media ("+s+"transform-3d){#test3d{height:3px}}",n.head.appendChild(u),i.appendChild(o),h=3===o.offsetHeight,n.head.removeChild(u),i.removeChild(o)),a.supportTransform=c,a.supportTransform3D=h;var f=a.supportTouch,l=f?"touchstart":"mousedown",d=f?"touchmove":"mousemove",_=f?"touchend":"mouseup";return a.POINTER_START=l,a.POINTER_MOVE=d,a.POINTER_END=_,a}(),kr=a.a.create({Extends:g,isStage:!0,className:"Stage",renderer:null,camera:null,pixelRatio:null,offsetX:0,offsetY:0,width:0,height:0,canvas:null,constructor:function(t){if(t.width||(t.width=window.innerWidth),t.height||(t.height=window.innerHeight),!t.pixelRatio){var e=window.devicePixelRatio||1;e=Math.min(e,1024/Math.max(t.width,t.height),2),e=Math.max(e,1),t.pixelRatio=e}kr.superclass.constructor.call(this,t),this.initRenderer(t),m.a.log("Hilo3d version: ".concat(Mr))},initRenderer:function(t){var e=this.canvas=this.createCanvas(t);this.renderer=new Xr(Object.assign(t,{domElement:e})),this.resize(this.width,this.height,this.pixelRatio,!0)},createCanvas:function(t){var e;return e=t.canvas?t.canvas:document.createElement("canvas"),t.container&&t.container.appendChild(e),e},resize:function(t,e,n,r){if(void 0===n&&(n=this.pixelRatio),r||this.width!==t||this.height!==e||this.pixelRatio!==n){this.width=t,this.height=e,this.pixelRatio=n,this.rendererWidth=t*n,this.rendererHeight=e*n;var i=this.canvas;this.renderer.resize(this.rendererWidth,this.rendererHeight,r),i.style.width=this.width+"px",i.style.height=this.height+"px",this.updateDomViewport()}return this},setOffset:function(t,e){if(this.offsetX!==t||this.offsetY!==e){this.offsetX=t,this.offsetY=e;var n=this.pixelRatio;this.renderer.setOffset(t*n,e*n)}return this},viewport:function(t,e,n,r){return this.resize(n,r,this.pixelRatio,!0),this.setOffset(t,e),this},tick:function(t){return this.traverseUpdate(t),this.camera&&this.renderer.render(this,this.camera,!0),this},enableDOMEvent:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.canvas,i=this._domListener||(this._domListener=function(t){e._onDOMEvent(t)});return(t="string"==typeof t?[t]:t).forEach((function(t){n?r.addEventListener(t,i,!1):r.removeEventListener(t,i)})),this},_onDOMEvent:function(t){var e=this.canvas,n=this._eventTarget,r=t.type,i=0===r.indexOf("touch"),a=t;if(i){var s=t.touches,o=t.changedTouches;s&&s.length?a=s[0]:o&&o.length&&(a=o[0])}var u=this.domViewport||this.updateDomViewport(),c=(a.pageX||a.clientX)-u.left,h=(a.pageY||a.clientY)-u.top;t.stageX=c,t.stageY=h,t.stopPropagation=function(){this._stopPropagationed=!0};var f=this.getMeshResultAtPoint(c,h,!0),l=f.mesh;t.hitPoint=f.point;var d="mouseout"===r;if(n&&(n!==l&&(!n.contains||!n.contains(l))||d)){var m=!1;if("touchmove"===r?m="touchout":"mousemove"!==r&&!d&&l||(m="mouseout"),m){var _=Object.assign({},t);_.type=m,_.eventTarget=n,n._fireMouseEvent(_)}t.lastEventTarget=n,this._eventTarget=null}if(l&&l.pointerEnabled&&"mouseout"!==r&&(t.eventTarget=this._eventTarget=l,l._fireMouseEvent(t)),!i){var p=l&&l.pointerEnabled&&l.useHandCursor?"pointer":"";e.style.cursor=p}jr.android&&"touchmove"===r&&t.preventDefault()},updateDomViewport:function(){var t=this.canvas,e=null;return t.parentNode&&(e=this.domViewport=Object(i.getElementRect)(t)),e},getMeshResultAtPoint:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.camera,i=this._ray;i||(i=this._ray=new hr.a),i.fromCamera(r,t,e,this.width,this.height);var a=this.raycast(i,!0,n);if(a)return a[0];this._stageResultAtPoint||(this._stageResultAtPoint={mesh:this,point:new c.a});var s=this._stageResultAtPoint.point;return s.copy(r.unprojectVector(s.set(t,e,0),this.width,this.height)),this._stageResultAtPoint},releaseGLResource:function(){return this.renderer.releaseGLResource(),this},destroy:function(){return kr.superclass.destroy.call(this,this.renderer),this.releaseGLResource(),this.traverse((function(t){t.off(),t.parent=null})),this.children.length=0,this.renderer.off(),this}}),zr=kr;function Wr(){return+new Date}var Yr=a.a.create({constructor:function(t,e,n,r){var i=this;for(var a in i.target=t,i._startTime=0,i._seekTime=0,i._pausedTime=0,i._pausedStartTime=0,i._reverseFlag=1,i._repeatCount=0,3===arguments.length&&(r=n,n=e,e=null),r)i[a]=r[a];i._fromProps=e,i._toProps=n,!r.duration&&r.time&&(i.duration=r.time||0,i.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(t,e){var n=this.target,r=t||e,i=this._fromProps={},a=this._toProps={};for(var s in t=t||n,e=e||n,r)a[s]=e[s]||0,n[s]=i[s]=t[s]||0;return this},start:function(){var t=this;return t._startTime=Wr()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,Yr.add(t),t},stop:function(){return Yr.remove(this),this},pause:function(){return this.paused=!0,this._pausedStartTime=Wr(),this},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=Wr()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,e){var n=this,r=Wr();return n._startTime=r,n._seekTime=t,n._pausedTime=0,void 0!==e&&(n.paused=e),n._update(r,!0),Yr.add(n),n},link:function(t){var e,n,r=t.delay,i=this._startTime;return"string"==typeof r&&(e=0===r.indexOf("+"),n=0===r.indexOf("-"),r=e||n?Number(r.substr(1))*(e?1:-1):Number(r)),t.delay=r,t._startTime=e||n?i+this.duration+r:i+r,this._next=t,Yr.remove(t),t},_render:function(t){var e=this.target,n=this._fromProps;for(var r in n)e[r]=n[r]+(this._toProps[r]-n[r])*t},_update:function(t,e){var n=this;if(n.paused&&!e)return!1;if(n.isComplete)return!0;var r=t-n._startTime-n._pausedTime+n._seekTime;if(r<0)return!1;var i,a=r/n.duration;a<=0?a=0:a>=1&&(a=1);var s=n.ease?n.ease(a):a;n.reverse&&n.isStart&&(n._reverseFlag<0&&(a=1-a,s=1-s),a<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0===n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=r,n._render(s),(i=n.onUpdate)&&i.call(n,s,n),a>=1&&(n.reverse?(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&u<=t?(o._render(a),o.time=r,Yr.add(o)):n.isComplete&&(u<0||u>t)&&o.start()}return!!n.isComplete&&((i=n.onComplete)&&i.call(n,n),!0)},Statics:{_tweens:[],tick:function(){var t,e,n=Yr._tweens,r=n.length;for(e=0;e-1&&r.splice(e,1);else for(e=0;e1||this.heightSegments>1||this.depthSegments>1},setFrontUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setFrontUV!"):this.setVertexUV(32,t)},setRightUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setRightUV!"):this.setVertexUV(0,t)},setBackUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBackUV!"):this.setVertexUV(40,t)},setLeftUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setLeftUV!"):this.setVertexUV(8,t)},setTopUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setTopUV!"):this.setVertexUV(16,t)},setBottomUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBottomUV!"):this.setVertexUV(24,t)},setAllRectUV:function(t){if(this.isSegments())return m.a.warn("segmented BoxGeometry dont support setAllRectUV!"),null;for(var e=0;e<6;e++)this.setVertexUV(8*e,t);return this},_raycast:function(t,e){return mi.superclass._raycast.call(this,t,e)}}),_i=mi,pi=P.a.FRONT,gi=P.a.BACK,vi=[0,0,1],Ei=a.a.create({Extends:Z,isPlaneGeometry:!0,className:"PlaneGeometry",width:1,height:1,widthSegments:1,heightSegments:1,constructor:function(t){Ei.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.widthSegments,e=this.heightSegments,n=(t+1)*(e+1),r=this.width/t,i=this.height/e,a=new Float32Array(3*n),s=new Float32Array(3*n),o=new Float32Array(2*n),u=new Uint16Array(t*e*6),c=0,h=0;h<=e;h++)for(var f=0;f<=t;f++){var l=h*(t+1)+f;if(a[3*l]=f*r-this.width/2,a[3*l+1]=this.height/2-h*i,s[3*l]=0,s[3*l+1]=0,s[3*l+2]=1,o[2*l]=f/t,o[2*l+1]=1-h/e,h0||n<0))return null;if(e===gi&&(r<0||n>0))return null;var i=t.intersectsPlane(vi,0);if(i){var a=i.x,s=i.y,o=.5*this.width,u=.5*this.height;if(a>=-o&&a<=o&&s>=-u&&s<=u)return[i]}return null}}),Ti=Ei,Mi=a.a.create({Extends:Z,isSphereGeometry:!0,className:"SphereGeometry",radius:1,heightSegments:16,widthSegments:32,constructor:function(t){Mi.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.radius,e=this.heightSegments,n=this.widthSegments,r=(n+1)*(e+1),i=n*e,a=new Float32Array(3*r),s=new Float32Array(4*r),o=new Float32Array(2*r),u=new Uint16Array(6*i),c=0,h=0,f=0,l=0,d=0,m=2*Math.PI,_=Math.PI,p=0;p<=e;p++)for(var g=p/e,v=_*g,E=Math.cos(v)*t,T=Math.sin(v)*t,M=0;M<=n;M++){var A=M/n,L=m*A,I=Math.cos(L),O=Math.sin(L),S=I*T,R=O*T,y=O,N=-I;if(s[f++]=y,s[f++]=0,s[f++]=N,s[f++]=1,a[h++]=S,a[h++]=E,a[h++]=R,o[l++]=A,o[l++]=g,p>0&&M>0){var x=d,C=x-1,P=C-n-1,w=x-n-1;u[c++]=P,u[c++]=w,u[c++]=x,u[c++]=P,u[c++]=x,u[c++]=C}d++}this.vertices=new b(a,3),this.indices=new b(u,1),this.uvs=new b(o,2),this.tangents=new b(s,4),this.normals=new b(new Float32Array(a),3)},_raycast:function(t,e){return Mi.superclass._raycast.call(this,t,e)}}),Ai=Mi,Li=[dt,Lt,Nt,Ft,Qt,ce],Ii=function(){var t="";return Li.forEach((function(e){t+="".concat(e.prototype.className,":").concat(Object.keys(e.cache._cache).length," ")})),m.a.log(t),t},Oi=a.a.create({Mixes:s.a,isLoadCache:!0,className:"LoadCache",Statics:{PENDING:1,LOADED:2,FAILED:3},enabled:!0,constructor:function(){this._files={}},update:function(t,e,n){if(this.enabled){var r={key:t,state:e,data:n};this._files[t]=r,this.fire("update",r),this.fire("update:".concat(r.key),r)}},get:function(t){return this.enabled?this._files[t]:null},getLoaded:function(t){var e=this.get(t);return e&&e.state===Oi.LOADED?e.data:null},remove:function(t){delete this._files[t]},clear:function(){this._files={}},wait:function(t){var e=this;return t?t.state===Oi.LOADED?Promise.resolve(t.data):t.state===Oi.FAILED?Promise.reject():new Promise((function(n,r){e.on("update:".concat(t.key),(function(t){var e=t.detail;e.state===Oi.LOADED?n(e.data):e.state===Oi.FAILED&&r(e.data)}),!0)})):Promise.reject()}}),Si=Oi,Ri=new Si,yi=a.a.create({Mixes:s.a,isBasicLoader:!0,className:"BasicLoader",Statics:{_cache:Ri,enalbeCache:function(){Ri.enabled=!0},disableCache:function(){Ri.enabled=!1},deleteCache:function(t){Ri.remove(t)},clearCache:function(){Ri.clear()},cache:{get:function(){return Ri},set:function(){m.a.warn("BasicLoader.cache is readonly!")}},TYPE_IMAGE:"img",TYPE_JSON:"json",TYPE_BUFFER:"buffer",TYPE_TEXT:"text"},load:function(t){var e=t.src,n=t.type;if(!n){var r=Object(i.getExtension)(e);/^(?:png|jpe?g|gif|webp|bmp)$/i.test(r)&&(n="img"),n||(n=t.defaultType)}return n===yi.TYPE_IMAGE?this.loadImg(e,t.crossOrigin):this.loadRes(e,n)},isCrossOrigin:function(t){var e=window.location,n=document.createElement("a");return n.href=t,n.hostname!==e.hostname||n.port!==e.port||n.protocol!==e.protocol},isBase64:function(t){return/^data:(.+?);base64,/.test(t)},Uint8ArrayFrom:function(t,e){if(Uint8Array.from)return Uint8Array.from(t,e);for(var n=t.length,r=new Uint8Array(n),i=0;i=300)r(new TypeError("Network request failed for ".concat(a.status)));else{var e="response"in a?a.response:a.responseText;if(t.type===yi.TYPE_JSON)try{e=JSON.parse(e)}catch(t){return void r(new TypeError("JSON.parse error"+t))}n(e)}},a.onprogress=function(n){e.fire("progress",{url:t.url,loaded:n.loaded,total:n.total})},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request timed out"))},a.open(t.method||"GET",t.url,!0),"include"===t.credentials&&(a.withCredentials=!0),t.type===yi.TYPE_BUFFER&&(a.responseType="arraybuffer"),Object(i.each)(t.headers,(function(t,e){a.setRequestHeader(e,t)})),a.send(t.body||null)}))}}),Ni=yi,xi=a.a.create({isLoader:!0,className:"Loader",maxConnections:2,Statics:{_loaderClassMap:{},_loaders:{},addLoader:function(t,e){xi._loaderClassMap[t]=e},getLoader:function(t){if(!xi._loaders[t]){var e=xi._loaderClassMap[t]?xi._loaderClassMap[t]:Ni;xi._loaders[t]=new e}return xi._loaders[t]}},preHandlerUrl:null,load:function(t){var e=this;if(t instanceof Array)return Promise.all(t.map((function(t){return e.load(t)})));var n=t.type||Object(i.getExtension)(t.src),r=xi.getLoader(n),a=t;return this.preHandlerUrl&&((a=Object.assign({},t)).src=this.preHandlerUrl(t.src)),r.load(a)}}),Ci=xi,bi=a.a.create({Extends:Ni,isCubeTextureLoader:!0,className:"CubeTextureLoader",constructor:function(){bi.superclass.constructor.call(this)},load:function(t){var e,n=this;return e=t.images&&Array.isArray(t.images)?t.images:[t.right,t.left,t.top,t.bottom,t.front,t.back],Promise.all(e.map((function(e){return n.loadImg(e,t.crossOrigin)}))).then((function(e){var n=Object.assign({},t);return delete n.images,delete n.type,delete n.right,delete n.left,delete n.top,delete n.bottom,delete n.front,delete n.back,n.image=e,new pe(n)})).catch((function(t){throw m.a.error("load CubeTexture failed",t.message,t.stack),t}))}});Ci.addLoader("CubeTexture",bi);var Pi=bi,wi=a.a.create({Extends:Je,isPBRMaterial:!0,className:"PBRMaterial",lightType:"PBR",gammaCorrection:!0,usePhysicsLight:!0,baseColor:null,baseColorMap:null,metallic:1,metallicMap:null,roughness:1,roughnessMap:null,metallicRoughnessMap:null,occlusionMap:null,occlusionStrength:1,isOcclusionInMetallicRoughnessMap:!1,diffuseEnvMap:null,diffuseEnvSphereHarmonics3:null,diffuseEnvIntensity:1,brdfLUT:null,specularEnvIntensity:1,specularEnvMap:null,isSpecularEnvMapIncludeMipmaps:!1,emission:null,emissionFactor:null,isSpecularGlossiness:!1,specular:null,glossiness:1,specularGlossinessMap:null,clearcoatFactor:0,clearcoatMap:null,clearcoatRoughnessFactor:0,clearcoatRoughnessMap:null,clearcoatNormalMap:null,usedUniformVectors:11,constructor:function(t){this.baseColor=new v.a(1,1,1),this.specular=new v.a(1,1,1),this.emissionFactor=new v.a(0,0,0),wi.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_baseColor:"BASECOLOR",u_metallic:"METALLIC",u_roughness:"ROUGHNESS",u_specular:"SPECULAR",u_emissionFactor:"EMISSIONFACTOR",u_glossiness:"GLOSSINESS",u_brdfLUT:"BRDFLUT",u_diffuseEnvMap:"DIFFUSEENVMAP",u_diffuseEnvIntensity:"DIFFUSEENVINTENSITY",u_occlusionStrength:"OCCLUSIONSTRENGTH",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvIntensity:"SPECULARENVINTENSITY",u_specularEnvMapMipCount:"SPECULARENVMAPMIPCOUNT",u_diffuseEnvSphereHarmonics3:"DIFFUSEENVSPHEREHARMONICS3",u_clearcoatFactor:"CLEARCOATFACTOR",u_clearcoatRoughnessFactor:"CLEARCOATROUGHNESSFACTOR"}),this.addTextureUniforms({u_baseColorMap:"BASECOLORMAP",u_metallicMap:"METALLICMAP",u_roughnessMap:"ROUGHNESSMAP",u_metallicRoughnessMap:"METALLICROUGHNESSMAP",u_occlusionMap:"OCCLUSIONMAP",u_specularGlossinessMap:"SPECULARGLOSSINESSMAP",u_lightMap:"LIGHTMAP",u_clearcoatMap:"CLEARCOATMAP",u_clearcoatRoughnessMap:"CLEARCOATROUGHNESSMAP",u_clearcoatNormalMap:"CLEARCOATNORMALMAP"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};wi.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t);return e.add(this.baseColorMap,"BASE_COLOR_MAP"),e.add(this.metallicMap,"METALLIC_MAP"),e.add(this.roughnessMap,"ROUGHNESS_MAP"),e.add(this.metallicRoughnessMap,"METALLIC_ROUGHNESS_MAP"),e.add(this.diffuseEnvMap,"DIFFUSE_ENV_MAP"),e.add(this.occlusionMap,"OCCLUSION_MAP"),e.add(this.lightMap,"LIGHT_MAP"),this.brdfLUT&&(e.add(this.specularEnvMap,"SPECULAR_ENV_MAP"),et.SHADER_TEXTURE_LOD&&this.specularEnvMap&&(t.USE_SHADER_TEXTURE_LOD=1)),this.isSpecularGlossiness&&(t.PBR_SPECULAR_GLOSSINESS=1,e.add(this.specularGlossinessMap,"SPECULAR_GLOSSINESS_MAP")),this.isOcclusionInMetallicRoughnessMap&&(t.IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP=1),1!==this.occlusionStrength&&(t.OCCLUSION_STRENGTH=1),this.diffuseEnvSphereHarmonics3&&(t.HAS_NORMAL=1,t.DIFFUSE_ENV_SPHERE_HARMONICS3=1),(this.specularEnvMap||this.diffuseEnvSphereHarmonics3||this.specularEnvMap)&&(t.NEED_WORLD_NORMAL=1),this.specularEnvMap&&this.isSpecularEnvMapIncludeMipmaps&&(t.IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS=1),this.clearcoatFactor>0&&(t.HAS_CLEARCOAT=1,t.HAS_NORMAL=1,this.clearcoatMap&&e.add(this.clearcoatMap,"CLEARCOAT_MAP"),this.clearcoatNormalMap&&e.add(this.clearcoatNormalMap,"CLEARCOAT_NORMAL_MAP"),this.clearcoatRoughnessMap&&e.add(this.clearcoatRoughnessMap,"CLEARCOAT_ROUGHNESS_MAP")),e.update(),t}}),Hi=wi,Di=new Image;Di.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var Fi=a.a.create({Extends:Qt,Mixes:s.a,isLazyTexture:!0,className:"LazyTexture",_src:"",crossOrigin:!1,autoLoad:!0,resType:"",src:{get:function(){return this._src},set:function(t){this._src!==t&&(this._src=t,this.autoLoad&&this.load())}},constructor:function(t){t&&("crossOrigin"in t&&(this.crossOrigin=t.crossOrigin),"autoLoad"in t&&(this.autoLoad=t.autoLoad)),Fi.superclass.constructor.call(this,t),this.image=this.placeHolder||Di},load:function(t){var e=this;return Fi.loader=Fi.loader||new Ci,Fi.loader.load({src:this.src,crossOrigin:this.crossOrigin,type:this.resType,defaultType:"img"}).then((function(t){t.isTexture?(Object.assign(e,t),e.needUpdate=!0,e.needDestroy=!0,e.fire("load")):(e.image=t,e.needUpdate=!0,e.fire("load"))}),(function(n){if(e.fire("error"),t)throw new Error("LazyTexture Failed ".concat(n));m.a.warn("LazyTexture Failed ".concat(n))}))},_releaseImage:function(){this._src&&"string"!=typeof this._src&&(this._src=""),Fi.superclass._releaseImage.call(this)}}),Ui=Fi,Gi=n(13);function Bi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Vi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vi(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;r--)Zi[r]=t[r]+n*(e[r]-t[r]);return Zi}return t+n*(e-t)},STEP:function(t,e,n){return t},CUBICSPLINE:function(t,e,n,r){var a=t.length/3;if(void 0===e)return 1===a?t[1]:t.slice(a,-a);var s=t[1],o=t[2],u=e[1],c=e[0];return a>1&&(s=t.slice(a,-a),o=t.slice(-a),u=e.slice(a,-a),c=e.slice(0,a)),s.hermite?s.hermite(s,o.scale(r),u,c.scale(r),n):s.isQuaternion?(s.fromArray(this._cubicSpline(s.elements,o.elements,u.elements,c.elements,r,n),0,!0),s.normalize(!0)):(Object(i.isArrayLike)(s)||(s=[s],o=[o],u=[u],c=[c]),s=this._cubicSpline(s,o,u,c,r,n)),s},_cubicSpline:function(t,e,n,r,i,a){var s=a*a,o=s*a,u=2*o-3*s+1,c=o-2*s+a,h=-2*o+3*s,f=o-s;Zi.length=0;for(var l=t.length-1;l>=0;l--)Zi[l]=t[l]*u+c*e[l]*i+n[l]*h+f*r[l]*i;return Zi}},StateType:{TRANSLATE:"Translation",POSITION:"Translation",TRANSLATION:"Translation",SCALE:"Scale",ROTATE:"Rotation",ROTATION:"Rotation",QUATERNION:"Quaternion",WEIGHTS:"Weights"},getType:function(t){return t=String(t).toUpperCase(),Qi.StateType[t]||Qi._extraStateHandlers.type[t]},_extraStateHandlers:{type:{},handler:{}},registerStateHandler:function(t,e){Qi._extraStateHandlers.type[String(t).toUpperCase()]=t,Qi._extraStateHandlers.handler[t]=e}},isAnimationStates:!0,className:"AnimationStates",nodeName:"",type:"",interpolationType:"LINEAR",constructor:function(t){this.id=d.a.generateUUID(this.className),this.keyTime=[],this.states=[],Object.assign(this,t)},findIndexByTime:function(t){return Object(i.getIndexFromSortedArray)(this.keyTime,t,Ki)},getStateByIndex:function(t){var e=this.states.length/this.keyTime.length;return 1===e?this.states[t]:this.states.slice(t*e,t*e+e)},getState:function(t){var e=Bi(this.findIndexByTime(t),2),n=e[0],r=e[1];if(n<0||r>=this.keyTime.length)return null;var a=this.keyTime[n],s=this.keyTime[r],o=this.getStateByIndex(n);if("STEP"===this.interpolationType)return o;if(n===r){var u=this.interpolation(o);return this.type===Qi.StateType.ROTATION&&(u=Xi.fromEuler(qi.fromArray(u))),u.elements||u}var c=this.getStateByIndex(r),h=s-a,f=(t-a)/h;this.type===Qi.StateType.ROTATION?Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromEuler(qi.fromArray(o[0])),o[1]=ji.fromEuler(qi.fromArray(o[1])),o[2]=ki.fromEuler(qi.fromArray(o[2])),c[0]=zi.fromEuler(qi.fromArray(c[0])),c[1]=Wi.fromEuler(qi.fromArray(c[1])),c[2]=Yi.fromEuler(qi.fromArray(c[2]))):(o=Xi.fromEuler(qi.fromArray(o)),c=ji.fromEuler(qi.fromArray(c))):this.type===Qi.StateType.QUATERNION&&(Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromArray(o[0]),o[1]=ji.fromArray(o[1]),o[2]=ki.fromArray(o[2]),c[0]=zi.fromArray(c[0]),c[1]=Wi.fromArray(c[1]),c[2]=Yi.fromArray(c[2])):(o=Xi.fromArray(o),c=ji.fromArray(c)));var l=this.interpolation(o,c,f,h);return l.elements||l},interpolation:function(t,e,n,r){return Qi.interpolation[this.interpolationType](t,e,n,r)},updateNodeTranslation:function(t,e){t.x=e[0],t.y=e[1],t.z=e[2]},updateNodeScale:function(t,e){t.scaleX=e[0],t.scaleY=e[1],t.scaleZ=e[2]},updateNodeQuaternion:function(t,e){t.quaternion.fromArray(e)},updateNodeWeights:function(t,e){var n=this._originalWeightIndices=this._originalWeightIndices||[],r=e.length;e=e.slice();for(var i=0;ie[a]){var o=e[a];e[a]=e[s],e[s]=o,o=n[a],n[a]=n[s],n[s]=o}t.traverse((function(t){t.isMesh&&t.geometry&&t.geometry.isMorphGeometry&&t.geometry.update(e,n)}))},updateNodeState:function(t,e){if(e){var n=this.type;n===Qi.StateType.ROTATION&&(n=Qi.StateType.QUATERNION);var r=this.getState(t);if(r){var i="updateNode"+n;this[i]?this[i](e,r):Qi._extraStateHandlers.handler[n]?Qi._extraStateHandlers.handler[n].call(this,e,r):m.a.warnOnce(i,"updateNodeState failed unknow type(%s)",n)}}},clone:function(){return new this.constructor({keyTime:this.keyTime,states:this.states,type:this.type,nodeName:this.nodeName})}}),Ji=Qi,$i=a.a.create({Statics:{_anims:[],tick:function(t){this._anims.forEach((function(e){return e.tick(t)}))}},Mixes:s.a,isAnimation:!0,className:"Animation",paused:!1,currentLoopCount:0,loop:1/0,currentTime:0,timeScale:1,startTime:0,endTime:0,clipStartTime:0,clipEndTime:0,nodeNameMap:null,_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,this._initNodeNameMap()}},_animStatesList:null,animStatesList:{get:function(){return this._animStatesList},set:function(t){this._animStatesList=t,this._initClipTime()}},validAnimationIds:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.clips={},this._animStatesList=[],Object.assign(this,t)},addClip:function(t,e,n,r){this.clips[t]={start:e,end:n,animStatesList:r}},removeClip:function(t){this.clips[t]=null},getAnimStatesListTimeInfo:function(t){var e=0,n=1/0;return t.forEach((function(t){e=Math.max(t.keyTime[t.keyTime.length-1],e),n=Math.min(t.keyTime[0],n)})),{startTime:n,endTime:e}},_initClipTime:function(){var t=this.getAnimStatesListTimeInfo(this.animStatesList);this.clipStartTime=t.startTime,this.clipEndTime=t.endTime},_initNodeNameMap:function(){if(this._rootNode){var t=this.nodeNameMap={};this._rootNode.traverse((function(e){t[e.animationId]=e;var n=e.name;void 0===n||t[n]||(t[n]=e)}),!1)}},tick:function(t){this.paused||(this.currentTime+=t/1e3*this.timeScale,this.currentTime>=this.endTime?(this.currentLoopCount++,this.currentTime=this.endTime,this.updateAnimStates(),this.fire("loopEnd"),!this.loop||this.currentLoopCount>=this.loop?(this.stop(),this.fire("end")):this.currentTime=this.startTime):this.updateAnimStates())},updateAnimStates:function(){var t=this;return this.animStatesList.forEach((function(e){e.updateNodeState(t.currentTime,t.nodeNameMap[e.nodeName])})),this},play:function(t,e){var n;if("string"==typeof t){var r=this.clips[t];r?(n=r.start,e=r.end,r.animStatesList&&(this.animStatesList=r.animStatesList,this._initClipTime())):m.a.warn("no this animation clip name:"+t)}else n=t;void 0===n&&(n=this.clipStartTime),void 0===e&&(e=this.clipEndTime),this.endTime=Math.min(e,this.clipEndTime),this.startTime=Math.min(n,this.endTime),this.currentTime=this.startTime,this.currentLoopCount=0,this.stop(),this.paused=!1,$i._anims.push(this)},stop:function(){this.paused=!0;var t=$i._anims,e=t.indexOf(this);-1!==e&&t.splice(e,1)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},clone:function(t){var e=new this.constructor({rootNode:t,animStatesList:this.animStatesList,timeScale:this.timeScale,loop:this.loop,paused:this.paused,currentTime:this.currentTime,startTime:this.startTime,endTime:this.endTime,clips:this.clips});return this.paused||e.play(),e}}),ta=$i;function ea(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return na(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function na(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=2&&(this.isGLTF2=!0),this.parseExtensionUsed(),this.loadResources(t).then((function(){return e.parseExtensions(e.json.extensions,null,{isGlobal:!0,methodName:"parseOnLoad"}),Promise.resolve()})).then((function(){return e.parseGeometries()})).then((function(){return e.parseScene()}))},parseExtensionUsed:function(){var t=this;this.extensionsUsed={},i.each(this.json.extensionsUsed,(function(e){t.extensionsUsed[e]=!0})),this.extensionsUsed.WEB3D_quantized_attributes||(this.isUnQuantizeInShader=!1)},getExtensionHandler:function(t){return this.extensionHandlers&&this.extensionHandlers[t]||la.extensionHandlers[t]},parseExtension:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t[e],a=this.getExtensionHandler(e);return a&&a.parse?a.parse(i,this,n,r):n},parseExtensions:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.each(t,(function(t,i){if(!r.ignoreExtensions||!r.ignoreExtensions[i]){var a=n.getExtensionHandler(i),s=r.methodName||"parse";a&&a[s]&&(e=a[s](t,n,e,r))}})),e},isUseExtension:function(t,e){return!!(t&&t.extensions&&t.extensions[e])},parseBinary:function(t){this.isBinary=!0;var e,n=new DataView(t),r=n.getUint32(4,!0),a=n.getUint32(8,!0),s=12;if(r<2){var o=n.getUint32(s,!0);e=new Uint8Array(t,20,o),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e),this.binaryBody=t.slice(20+o)}else{if(2!==r)throw new Error("Dont support glTF version ".concat(r));for(;sa*i.BYTES_PER_ELEMENT)s.array=new i(s.buffer,s.byteOffset,s.byteLength/i.BYTES_PER_ELEMENT),r=new b(s.array,a,{offset:n.byteOffset||0,stride:s.byteStride,bufferViewId:s.id});else{var u,c=(n.byteOffset||0)+s.byteOffset;if(c%i.BYTES_PER_ELEMENT||this.forceCreateNewBuffer)u=new i(s.buffer.slice(c,c+o*i.BYTES_PER_ELEMENT));else u=new i(s.buffer,c,o);r=new b(u,a)}return n.sparse&&(r||(r=new b(new i(o),a)),r=this.sparseAccessorHandler(r,n.sparse)),r=this.parseExtensions(n.extensions,r,{isDecode:e,isAccessor:!0}),n.data=r,n.normalized&&(r.normalized=!0),r},getArrayByAccessor:function(t,e){var n=this.json.accessors[t];if(n.array)return n.array;var r=this.getAccessorData(t,e);if(!r.stride&&!r.offset&&1===r.size)return r.data;var i=[];return r.traverse((function(t){i.push(t.toArray?t.toArray():t)})),n.array=i,i},parseTechnique:function(t,e){var n=null;this.json.techniques&&(n=this.json.techniques[t.technique]),n&&n.states&&(n.states.enable.forEach((function(t){switch(t){case ra:e.blend=!0;break;case ia:e.depthTest=!0;break;case aa:e.cullFace=!0}})),i.each(n.states.functions,(function(t,n){switch(n){case"blendEquationSeparate":e.blendEquation=t[0],e.blendEquationAlpha=t[1];break;case"blendFuncSeparate":e.blendSrc=t[0],e.blendDst=t[1],e.blendSrcAlpha=t[2],e.blendDstAlpha=t[3];break;case"depthMask":e.depthMask=t[0];break;case"cullFace":e.cullFaceType=t[0];break;default:e[n]=t}})),e.cullFace?e.side=e.cullFaceType===sa?oa:sa:e.side=ua)},createMorphGeometry:function(t,e){var n=this,r=new qn,a=r.targets={};return i.each(t.targets,(function(t){i.each(t,(function(t,e){var r=fa[e].name;a[r]||(a[r]=[]);var i=n.getAccessorData(t,!0);a[r].push(i)}))})),r.weights=e||new Float32Array(t.targets.length),r},handlerGeometry:function(t,e){var n=void 0===e.mode?4:e.mode;if(e.extensions){var r=this.parseExtensions(e.extensions,null,{primitive:e,isPrimitive:!0});if(r)return r.mode=n,r}t||(t=new Z({mode:n})),"indices"in e&&(t.indices=this.getAccessorData(e.indices));var i=e.attributes;for(var a in i){var s=fa[a];if(s){var o=!(this.isUnQuantizeInShader&&s.decodeMatName);t[s.name]=this.getAccessorData(i[a],o),o||(t[s.decodeMatName]=t[s.name].decodeMat,delete t[s.name].decodeMat)}else m.a.warn("Unknow attribute named ".concat(a,"!"))}return t},handlerSkinedMesh:function(t,e){e&&(t.skeleton=e,this.useInstanced&&(t.useInstanced=!0))},fixProgressiveGeometry:function(t,e){t._geometry=e,this.isProgressive&&t._meshes&&t._meshes.forEach((function(t){t.visible=!0,t.geometry=e}))},parseGeometries:function(){var t=this,e=i.serialRun(this.json.meshes,(function(e){return i.serialRun(e.primitives,(function(n){var r;n.targets&&n.targets.length&&(r=t.createMorphGeometry(n,e.weights)),n._geometry=r;var i=t.handlerGeometry(r,n);return i&&i.then?i.then((function(e){t.fixProgressiveGeometry(n,e)}),(function(t){m.a.error("geometry parse error",t)})):(t.fixProgressiveGeometry(n,i),i)}))}));return this.isProgressive?null:e},parseMesh:function(t,e,n){var r=this,i=this.json.meshes[t];i.primitives.forEach((function(a){var s,o=r.skins&&r.skins[n.skin];if(a.meshNode)s=a.meshNode.clone();else{var u=r.materials[a.material]||new tn;s=new(o?vr:mr)({geometry:a._geometry,material:u,name:"mesh-"+(i.name||t)}),a.meshNode=s}r.handlerSkinedMesh(s,o),r.isProgressive&&!s.geometry&&(s.visible=!1,a._meshes=a._meshes||[],a._meshes.push(s)),e.addChild(s),r.meshes.push(s)}))},parseCameras:function(){var t=this;this.cameras={};var e=window.innerWidth/window.innerHeight;i.each(this.json.cameras,(function(n,r){var i;"perspective"===n.type&&n.perspective?((i=new Q).fov=d.a.radToDeg(n.perspective.yfov),i.near=n.perspective.znear,i.far=n.perspective.zfar,n.aspectRatio?i.aspect=n.aspectRatio:i.aspect=e):"orthographic"===n.type&&n.orthographic&&((i=new hn).near=n.orthographic.znear,i.far=n.orthographic.zfar,i.right=n.orthographic.xmag,i.left=-1*i.right,i.top=n.orthographic.ymag,i.bottom=-1*i.top),(i=t.parseExtensions(n.extensions,i,{isCamera:!0}))&&(i.name=n.name||r,t.cameras[r]=i)}))},handlerNodeTransform:function(t,e){e.matrix?t.matrix.fromArray(e.matrix):(e.rotation&&t.quaternion.fromArray(e.rotation),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.translation&&(t.x=e.translation[0],t.y=e.translation[1],t.z=e.translation[2]))},parseNode:function(t,e){var n,r=this,i=this.json.nodes[t];i||m.a.warn("GLTFParser.parseNode: nodes[".concat(t,"] has nothing.")),n=new g({name:i.name,animationId:t}),n=this.parseExtensions(i.extensions,n,{isNode:!0}),"camera"in i&&this.cameras[i.camera]&&n.addChild(this.cameras[i.camera]),this.handlerNodeTransform(n,i),i.jointName?(n.jointName=i.jointName,this.jointMap[n.jointName]=n):this.isGLTF2&&(n.jointName=t,this.jointMap[t]=n),i.meshes?i.meshes.forEach((function(t){return r.parseMesh(t,n,i)})):"mesh"in i&&this.parseMesh(i.mesh,n,i),i.children&&i.children.forEach((function(t){return r.parseNode(t,n)})),e.addChild(n)},parseAnimations:function(){var t=this;if(!this.json.animations)return null;var e=this.isMultiAnim,n={},r=[],a={};return i.each(this.json.animations,(function(i){i.channels.forEach((function(e){var n=e.target.path,s=e.target.id;t.isGLTF2&&(s=e.target.node);var o=i.samplers[e.sampler],u=t.isGLTF2?o.input:i.parameters[o.input],c=t.isGLTF2?o.output:i.parameters[n],h=t.getArrayByAccessor(u,!0),f=t.getArrayByAccessor(c,!0);"rotation"===n&&(n="quaternion");var l=new Ji({interpolationType:o.interpolation||"LINEAR",nodeName:s,keyTime:h,states:f,type:Ji.getType(n)});r.push(l),a[s]=!0})),e&&r.length&&(n[i.name]={animStatesList:r},r=[])})),e&&Object.keys(n).length>0&&(r=Object.values(n)[0].animStatesList),r.length?new ta({rootNode:this.node,animStatesList:r,validAnimationIds:a,clips:n}):null},parseScene:function(){var t=this;this.parseMaterials(),this.jointMap={},this.meshes=[],this.lights=[],this.node=new g({needCallChildUpdate:!1}),this.parseCameras();var e=this.json.scenes[this.getDefaultSceneName()];if(!e)return m.a.warn("GLTFParser:no scene!"),{node:this.node,meshes:[],cameras:[],lights:[],textures:[],materials:[]};var n=e.nodes;this.parseSkins(),n.forEach((function(e){return t.parseNode(e,t.node)})),this.resetSkinInfo(this.node);var r={node:this.node,scene:this.node,meshes:this.meshes,json:this.json,cameras:Object.values(this.cameras),lights:this.lights,textures:Object.values(this.textures),materials:Object.values(this.materials)},i=this.parseAnimations();return i&&(this.node.setAnim(i),i.play(),r.anim=i),this.parseExtensions(e.extensions,null,{isScene:!0}),this.parseExtensions(this.json.extensions,r,{isGlobal:!0,methodName:"parseOnEnd"}),r},getDefaultSceneName:function(){return void 0!==this.defaultScene?this.defaultScene:this.json.scenes?Object.keys(this.json.scenes)[0]:null},parseSkins:function(){var t=this;this.skins=[];var e=this.json.skins;e&&e.length&&(this.skins=e.map((function(e){for(var n=new Tr,r=e.joints.length,i=t.getArrayByAccessor(e.inverseBindMatrices,!0),a=0;a ",t)}return null}))}});Ci.addLoader("hdr",Aa);var La=Aa,Ia=a.a.create({Statics:{HEADER_LEN:64,COMPRESSED_2D:0,COMPRESSED_3D:1,TEX_2D:2,TEX_3D:3},isKhronosTextureContainer:!0,className:"KhronosTextureContainer",constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.arrayBuffer=t,this.baseOffset=n;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,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]){var i=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*i),s=a.getUint32(0,!0),o=67305985===s;this.glType=a.getUint32(1*i,o),this.glTypeSize=a.getUint32(2*i,o),this.glFormat=a.getUint32(3*i,o),this.glInternalFormat=a.getUint32(4*i,o),this.glBaseInternalFormat=a.getUint32(5*i,o),this.pixelWidth=a.getUint32(6*i,o),this.pixelHeight=a.getUint32(7*i,o),this.pixelDepth=a.getUint32(8*i,o),this.numberOfArrayElements=a.getUint32(9*i,o),this.numberOfFaces=a.getUint32(10*i,o),this.numberOfMipmapLevels=a.getUint32(11*i,o),this.bytesOfKeyValueData=a.getUint32(12*i,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=Ia.COMPRESSED_2D:this.loadType=Ia.TEX_2D:m.a.warn("number of faces expected"+e+", but found "+this.numberOfFaces):m.a.warn("texture arrays not currently supported"):m.a.warn("only 2D textures currently supported")}else m.a.error("texture missing KTX identifier")},mipmaps:function(t){for(var e=[],n=Ia.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,i=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s2&&void 0!==arguments[2]?arguments[2]:0,r=new Ia(e,1,n),i={compressed:0===r.glType,type:r.glType,width:r.pixelWidth,height:r.pixelHeight,internalFormat:r.glInternalFormat,format:r.glFormat,isCubemap:6===r.numberOfFaces};return r.numberOfMipmapLevels>=Math.floor(Math.log2(Math.max(i.width,i.height))+1)?(i.mipmaps=r.mipmaps(!0),i.image=i.mipmaps[0].data):(i.mipmaps=null,i.image=r.mipmaps(!1)[0].data),new Qt(i)}});Ci.addLoader("ktx",Oa);var Sa=Oa,Ra=a.a.create({Mixes:s.a,isLoadQueue:!0,className:"LoadQueue",Statics:{addLoader:function(t,e){m.a.warn("LoadQueue.addLoader is duplicated, please use Loader.addLoader"),Ci.addLoader(t,e)}},constructor:function(t){this._source=[],this.add(t)},maxConnections:2,_source:null,_loaded:0,_connections:0,_currentIndex:-1,add:function(t){return t&&(t=Array.isArray(t)?t:[t],this._source=this._source.concat(t)),this},get:function(t){if(!t)return null;for(var e=this._source,n=0;n=n)this.fire("complete");else if(this._currentIndex2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.renderer.pixelRatio,a=[],s=this.framebuffer.readPixels(t*i,e*i,n*i,r*i),o=0;o=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=n.slice(0),i=0,a=r.length;i=0&&e.splice(n,1)},nextTick:function(t){var e=this,n={tick:function(){e.removeTick(n),t()}};return e.addTick(n),n},timeout:function(t,e){var n=this,r=(new Date).getTime()+e,i={tick:function(){(new Date).getTime()-r>=0&&(n.removeTick(i),t())}};return n.addTick(i),i},interval:function(t,e){var n=(new Date).getTime()+e,r={tick:function(){var r=(new Date).getTime(),i=r-n;i>=0&&(i0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=a*s),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.lerp=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t[2]=s+r*(n[2]-s),t[3]=o+r*(n[3]-o),t},e.random=function(t,e){var n,i,a,s,o,u;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{u=(a=2*r.RANDOM()-1)*a+(s=2*r.RANDOM()-1)*s}while(u>=1);var c=Math.sqrt((1-o)/u);return t[0]=e*n,t[1]=e*i,t[2]=e*a*c,t[3]=e*s*c,t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*s,t[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*s,t[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*s,t[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*s,t},e.transformQuat=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2],c=n[3],h=c*r+o*a-u*i,f=c*i+u*r-s*a,l=c*a+s*i-o*r,d=-s*r-o*i-u*a;return t[0]=h*c+d*-s+f*-u-l*-o,t[1]=f*c+d*-o+l*-s-h*-u,t[2]=l*c+d*-u+h*-o-f*-s,t[3]=e[3],t},e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+a*a)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return n*n+r*r+i*i+a*a}function h(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}function f(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.len=h,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=4),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u1?0:i<-1?Math.PI:Math.acos(i)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],u=e[2];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-u)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function a(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function s(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function l(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function d(t,e){var n=e[0],r=e[1],i=e[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}function m(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.sub=o,e.mul=u,e.div=c,e.dist=h,e.sqrDist=f,e.len=a,e.sqrLen=l,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=3),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;ur.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n},e.multiply=h,e.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+s*o,t[1]=i*u+a*o,t[2]=a*u-i*o,t[3]=s*u-r*o,t},e.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u-a*o,t[1]=i*u+s*o,t[2]=a*u+r*o,t[3]=s*u-i*o,t},e.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+i*o,t[1]=i*u-r*o,t[2]=a*u+s*o,t[3]=s*u-a*o,t},e.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},e.slerp=f,e.random=function(t){var e=r.RANDOM(),n=r.RANDOM(),i=r.RANDOM(),a=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*n),t[1]=a*Math.cos(2*Math.PI*n),t[2]=s*Math.sin(2*Math.PI*i),t[3]=s*Math.cos(2*Math.PI*i),t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*n+r*r+i*i+a*a,o=s?1/s:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=a*o,t},e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.fromMat3=l,e.fromEuler=function(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var a=Math.sin(e),s=Math.cos(e),o=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);return t[0]=a*u*h-s*o*c,t[1]=s*o*h+a*u*c,t[2]=s*u*c-a*o*h,t[3]=s*u*h+a*o*c,t},e.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var r=o(n(0)),i=o(n(5)),a=o(n(2)),s=o(n(1));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function u(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function h(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*h+s*o+i*c-a*u,t[1]=i*h+s*u+a*o-r*c,t[2]=a*h+s*c+r*u-i*o,t[3]=s*h-r*o-i*u-a*c,t}function f(t,e,n,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=n[0],h=n[1],f=n[2],l=n[3],d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return(m=a*c+s*h+o*f+u*l)<0&&(m=-m,c=-c,h=-h,f=-f,l=-l),1-m>r.EPSILON?(d=Math.acos(m),_=Math.sin(d),p=Math.sin((1-i)*d)/_,g=Math.sin(i*d)/_):(p=1-i,g=i),t[0]=p*a+g*c,t[1]=p*s+g*h,t[2]=p*o+g*f,t[3]=p*u+g*l,t}function l(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+s]-e[3*s+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}e.clone=s.clone,e.fromValues=s.fromValues,e.copy=s.copy,e.set=s.set,e.add=s.add,e.mul=h,e.scale=s.scale,e.dot=s.dot,e.lerp=s.lerp;var d=e.length=s.length,m=(e.len=d,e.squaredLength=s.squaredLength),_=(e.sqrLen=m,e.normalize=s.normalize);e.exactEquals=s.exactEquals,e.equals=s.equals,e.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),n=a.fromValues(0,1,0);return function(r,i,s){var o=a.dot(i,s);return o<-.999999?(a.cross(t,e,i),a.len(t)<1e-6&&a.cross(t,n,i),a.normalize(t,t),c(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(a.cross(t,i,s),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,_(r,r))}}(),e.sqlerp=function(){var t=u(),e=u();return function(n,r,i,a,s,o){return f(t,r,s,o),f(e,i,a,o),f(n,t,e,2*o*(1-o)),n}}(),e.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],_(e,l(e,t))}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.fromValues=function(t,e,n,i,a,s,o,u,c,h,f,l,d,m,_,p){var g=new r.ARRAY_TYPE(16);return g[0]=t,g[1]=e,g[2]=n,g[3]=i,g[4]=a,g[5]=s,g[6]=o,g[7]=u,g[8]=c,g[9]=h,g[10]=f,g[11]=l,g[12]=d,g[13]=m,g[14]=_,g[15]=p,g},e.set=function(t,e,n,r,i,a,s,o,u,c,h,f,l,d,m,_,p){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t[9]=h,t[10]=f,t[11]=l,t[12]=d,t[13]=m,t[14]=_,t[15]=p,t},e.identity=i,e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],a=e[6],s=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=a,t[11]=e[14],t[12]=i,t[13]=s,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(i*y-r*N-a*R)*x,t[2]=(_*L-p*A+g*M)*x,t[3]=(l*A-f*L-d*M)*x,t[4]=(u*S-s*N-c*O)*x,t[5]=(n*N-i*S+a*O)*x,t[6]=(p*T-m*L-g*E)*x,t[7]=(h*L-l*T+d*E)*x,t[8]=(s*y-o*S+c*I)*x,t[9]=(r*S-n*y-a*I)*x,t[10]=(m*A-_*T+g*v)*x,t[11]=(f*T-h*A-d*v)*x,t[12]=(o*O-s*R-u*I)*x,t[13]=(n*R-r*O+i*I)*x,t[14]=(_*E-m*M-p*v)*x,t[15]=(h*M-f*E+l*v)*x,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15];return t[0]=o*(l*g-d*p)-f*(u*g-c*p)+_*(u*d-c*l),t[1]=-(r*(l*g-d*p)-f*(i*g-a*p)+_*(i*d-a*l)),t[2]=r*(u*g-c*p)-o*(i*g-a*p)+_*(i*c-a*u),t[3]=-(r*(u*d-c*l)-o*(i*d-a*l)+f*(i*c-a*u)),t[4]=-(s*(l*g-d*p)-h*(u*g-c*p)+m*(u*d-c*l)),t[5]=n*(l*g-d*p)-h*(i*g-a*p)+m*(i*d-a*l),t[6]=-(n*(u*g-c*p)-s*(i*g-a*p)+m*(i*c-a*u)),t[7]=n*(u*d-c*l)-s*(i*d-a*l)+h*(i*c-a*u),t[8]=s*(f*g-d*_)-h*(o*g-c*_)+m*(o*d-c*f),t[9]=-(n*(f*g-d*_)-h*(r*g-a*_)+m*(r*d-a*f)),t[10]=n*(o*g-c*_)-s*(r*g-a*_)+m*(r*c-a*o),t[11]=-(n*(o*d-c*f)-s*(r*d-a*f)+h*(r*c-a*o)),t[12]=-(s*(f*p-l*_)-h*(o*p-u*_)+m*(o*l-u*f)),t[13]=n*(f*p-l*_)-h*(r*p-i*_)+m*(r*l-i*f),t[14]=-(n*(o*p-u*_)-s*(r*p-i*_)+m*(r*u-i*o)),t[15]=n*(o*l-u*f)-s*(r*l-i*f)+h*(r*u-i*o),t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8],h=t[9],f=t[10],l=t[11],d=t[12],m=t[13],_=t[14],p=t[15];return(e*s-n*a)*(f*p-l*_)-(e*o-r*a)*(h*p-l*m)+(e*u-i*a)*(h*_-f*m)+(n*o-r*s)*(c*p-l*d)-(n*u-i*s)*(c*_-f*d)+(r*u-i*o)*(c*m-h*d)},e.multiply=a,e.translate=function(t,e,n){var r=n[0],i=n[1],a=n[2],s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=void 0,g=void 0;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*a+e[12],t[13]=e[1]*r+e[5]*i+e[9]*a+e[13],t[14]=e[2]*r+e[6]*i+e[10]*a+e[14],t[15]=e[3]*r+e[7]*i+e[11]*a+e[15]):(s=e[0],o=e[1],u=e[2],c=e[3],h=e[4],f=e[5],l=e[6],d=e[7],m=e[8],_=e[9],p=e[10],g=e[11],t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=h,t[5]=f,t[6]=l,t[7]=d,t[8]=m,t[9]=_,t[10]=p,t[11]=g,t[12]=s*r+h*i+m*a+e[12],t[13]=o*r+f*i+_*a+e[13],t[14]=u*r+l*i+p*a+e[14],t[15]=c*r+d*i+g*a+e[15]),t},e.scale=function(t,e,n){var r=n[0],i=n[1],a=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.rotate=function(t,e,n,i){var a,s,o,u,c,h,f,l,d,m,_,p,g,v,E,T,M,A,L,I,O,S,R,y,N=i[0],x=i[1],C=i[2],b=Math.sqrt(N*N+x*x+C*C);return b0?(n[0]=2*(c*u+l*i+h*o-f*a)/d,n[1]=2*(h*u+l*a+f*i-c*o)/d,n[2]=2*(f*u+l*o+c*a-h*i)/d):(n[0]=2*(c*u+l*i+h*o-f*a),n[1]=2*(h*u+l*a+f*i-c*o),n[2]=2*(f*u+l*o+c*a-h*i)),s(t,e,n),t},e.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},e.getScaling=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[4],s=e[5],o=e[6],u=e[8],c=e[9],h=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(a*a+s*s+o*o),t[2]=Math.sqrt(u*u+c*c+h*h),t},e.getRotation=function(t,e){var n=e[0]+e[5]+e[10],r=0;return n>0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},e.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],a=e[1],s=e[2],o=e[3],u=i+i,c=a+a,h=s+s,f=i*u,l=i*c,d=i*h,m=a*c,_=a*h,p=s*h,g=o*u,v=o*c,E=o*h,T=r[0],M=r[1],A=r[2];return t[0]=(1-(m+p))*T,t[1]=(l+E)*T,t[2]=(d-v)*T,t[3]=0,t[4]=(l-E)*M,t[5]=(1-(f+p))*M,t[6]=(_+g)*M,t[7]=0,t[8]=(d+v)*A,t[9]=(_-g)*A,t[10]=(1-(f+m))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var a=e[0],s=e[1],o=e[2],u=e[3],c=a+a,h=s+s,f=o+o,l=a*c,d=a*h,m=a*f,_=s*h,p=s*f,g=o*f,v=u*c,E=u*h,T=u*f,M=r[0],A=r[1],L=r[2],I=i[0],O=i[1],S=i[2],R=(1-(_+g))*M,y=(d+T)*M,N=(m-E)*M,x=(d-T)*A,C=(1-(l+g))*A,b=(p+v)*A,P=(m+E)*L,w=(p-v)*L,H=(1-(l+_))*L;return t[0]=R,t[1]=y,t[2]=N,t[3]=0,t[4]=x,t[5]=C,t[6]=b,t[7]=0,t[8]=P,t[9]=w,t[10]=H,t[11]=0,t[12]=n[0]+I-(R*I+x*O+P*S),t[13]=n[1]+O-(y*I+C*O+w*S),t[14]=n[2]+S-(N*I+b*O+H*S),t[15]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[1]=h+g,t[2]=l-p,t[3]=0,t[4]=h-g,t[5]=1-c-m,t[6]=d+_,t[7]=0,t[8]=l+p,t[9]=d-_,t[10]=1-c-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,e,n,r,i,a,s){var o=1/(n-e),u=1/(i-r),c=1/(a-s);return t[0]=2*a*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*u,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*u,t[10]=(s+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*a*2*c,t[15]=0,t},e.perspective=function(t,e,n,r,i){var a=1/Math.tan(e/2),s=void 0;return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(s=1/(r-i),t[10]=(i+r)*s,t[14]=2*i*r*s):(t[10]=-1,t[14]=-2*r),t},e.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+o),c=2/(i+a);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(s-o)*u*.5,t[9]=(i-a)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},e.ortho=function(t,e,n,r,i,a,s){var o=1/(e-n),u=1/(r-i),c=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*u,t[14]=(s+a)*c,t[15]=1,t},e.lookAt=function(t,e,n,a){var s=void 0,o=void 0,u=void 0,c=void 0,h=void 0,f=void 0,l=void 0,d=void 0,m=void 0,_=void 0,p=e[0],g=e[1],v=e[2],E=a[0],T=a[1],M=a[2],A=n[0],L=n[1],I=n[2];return Math.abs(p-A)0&&(h*=d=1/Math.sqrt(d),f*=d,l*=d);var m=u*l-c*f,_=c*h-o*l,p=o*f-u*h;return(d=m*m+_*_+p*p)>0&&(m*=d=1/Math.sqrt(d),_*=d,p*=d),t[0]=m,t[1]=_,t[2]=p,t[3]=0,t[4]=f*p-l*_,t[5]=l*m-h*p,t[6]=h*_-f*m,t[7]=0,t[8]=h,t[9]=f,t[10]=l,t[11]=0,t[12]=i,t[13]=a,t[14]=s,t[15]=1,t},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},e.subtract=o,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=t[9],d=t[10],m=t[11],_=t[12],p=t[13],g=t[14],v=t[15],E=e[0],T=e[1],M=e[2],A=e[3],L=e[4],I=e[5],O=e[6],S=e[7],R=e[8],y=e[9],N=e[10],x=e[11],C=e[12],b=e[13],P=e[14],w=e[15];return Math.abs(n-E)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(a-M)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-A)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(o-L)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(L))&&Math.abs(u-I)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-O)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(h-S)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-R)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(l-y)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(d-N)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(N))&&Math.abs(m-x)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(x))&&Math.abs(_-C)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(C))&&Math.abs(p-b)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(b))&&Math.abs(g-P)<=r.EPSILON*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(v-w)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(w))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function a(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=e[9],d=e[10],m=e[11],_=e[12],p=e[13],g=e[14],v=e[15],E=n[0],T=n[1],M=n[2],A=n[3];return t[0]=E*r+T*o+M*f+A*_,t[1]=E*i+T*u+M*l+A*p,t[2]=E*a+T*c+M*d+A*g,t[3]=E*s+T*h+M*m+A*v,E=n[4],T=n[5],M=n[6],A=n[7],t[4]=E*r+T*o+M*f+A*_,t[5]=E*i+T*u+M*l+A*p,t[6]=E*a+T*c+M*d+A*g,t[7]=E*s+T*h+M*m+A*v,E=n[8],T=n[9],M=n[10],A=n[11],t[8]=E*r+T*o+M*f+A*_,t[9]=E*i+T*u+M*l+A*p,t[10]=E*a+T*c+M*d+A*g,t[11]=E*s+T*h+M*m+A*v,E=n[12],T=n[13],M=n[14],A=n[15],t[12]=E*r+T*o+M*f+A*_,t[13]=E*i+T*u+M*l+A*p,t[14]=E*a+T*c+M*d+A*g,t[15]=E*s+T*h+M*m+A*v,t}function s(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=r+r,u=i+i,c=a+a,h=r*o,f=r*u,l=r*c,d=i*u,m=i*c,_=a*c,p=s*o,g=s*u,v=s*c;return t[0]=1-(d+_),t[1]=f+v,t[2]=l-g,t[3]=0,t[4]=f-v,t[5]=1-(h+_),t[6]=m+p,t[7]=0,t[8]=l+g,t[9]=m-p,t[10]=1-(h+d),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}e.mul=a,e.sub=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},e.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},e.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromValues=function(t,e,n,i,a,s,o,u,c){var h=new r.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=n,h[3]=i,h[4]=a,h[5]=s,h[6]=o,h[7]=u,h[8]=c,h},e.set=function(t,e,n,r,i,a,s,o,u,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t[6]=o,t[7]=u,t[8]=c,t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else 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];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=h*s-o*c,l=-h*a+o*u,d=c*a-s*u,m=n*f+r*l+i*d;return m?(m=1/m,t[0]=f*m,t[1]=(-h*r+i*c)*m,t[2]=(o*r-i*s)*m,t[3]=l*m,t[4]=(h*n-i*u)*m,t[5]=(-o*n+i*a)*m,t[6]=d*m,t[7]=(-c*n+r*u)*m,t[8]=(s*n-r*a)*m,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8];return t[0]=s*h-o*c,t[1]=i*c-r*h,t[2]=r*o-i*s,t[3]=o*u-a*h,t[4]=n*h-i*u,t[5]=i*a-n*o,t[6]=a*c-s*u,t[7]=r*u-n*c,t[8]=n*s-r*a,t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],s=t[5],o=t[6],u=t[7],c=t[8];return e*(c*a-s*u)+n*(-c*i+s*o)+r*(u*i-a*o)},e.multiply=i,e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=u,t[6]=l*r+d*s+c,t[7]=l*i+d*o+h,t[8]=l*a+d*u+f,t},e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=Math.sin(n),d=Math.cos(n);return t[0]=d*r+l*s,t[1]=d*i+l*o,t[2]=d*a+l*u,t[3]=d*s-l*r,t[4]=d*o-l*i,t[5]=d*u-l*a,t[6]=c,t[7]=h,t[8]=f,t},e.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n+n,o=r+r,u=i+i,c=n*s,h=r*s,f=r*o,l=i*s,d=i*o,m=i*u,_=a*s,p=a*o,g=a*u;return t[0]=1-f-m,t[3]=h-g,t[6]=l+p,t[1]=h+g,t[4]=1-c-m,t[7]=d-_,t[2]=l-p,t[5]=d+_,t[8]=1-c-f,t},e.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],c=e[7],h=e[8],f=e[9],l=e[10],d=e[11],m=e[12],_=e[13],p=e[14],g=e[15],v=n*o-r*s,E=n*u-i*s,T=n*c-a*s,M=r*u-i*o,A=r*c-a*o,L=i*c-a*u,I=h*_-f*m,O=h*p-l*m,S=h*g-d*m,R=f*p-l*_,y=f*g-d*_,N=l*g-d*p,x=v*N-E*y+T*R+M*S-A*O+L*I;return x?(x=1/x,t[0]=(o*N-u*y+c*R)*x,t[1]=(u*S-s*N-c*O)*x,t[2]=(s*y-o*S+c*I)*x,t[3]=(i*y-r*N-a*R)*x,t[4]=(n*N-i*S+a*O)*x,t[5]=(r*S-n*y-a*I)*x,t[6]=(_*L-p*A+g*M)*x,t[7]=(p*T-m*L-g*E)*x,t[8]=(m*A-_*T+g*v)*x,t):null},e.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=t[8],l=e[0],d=e[1],m=e[2],_=e[3],p=e[4],g=e[5],v=e[6],E=e[7],T=e[8];return Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-d)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-m)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(s-_)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(o-p)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(u-g)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-v)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(h-E)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-T)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(T))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=e[6],h=e[7],f=e[8],l=n[0],d=n[1],m=n[2],_=n[3],p=n[4],g=n[5],v=n[6],E=n[7],T=n[8];return t[0]=l*r+d*s+m*c,t[1]=l*i+d*o+m*h,t[2]=l*a+d*u+m*f,t[3]=_*r+p*s+g*c,t[4]=_*i+p*o+g*h,t[5]=_*a+p*u+g*f,t[6]=v*r+E*s+T*c,t[7]=v*i+E*o+T*h,t[8]=v*a+E*u+T*f,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.sqrDist=e.dist=e.div=e.mul=e.sub=e.len=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},e.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},e.set=function(t,e,n){return t[0]=e,t[1]=n,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},e.subtract=a,e.multiply=s,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},e.distance=u,e.squaredDistance=c,e.length=h,e.squaredLength=f,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},e.lerp=function(t,e,n,r){var i=e[0],a=e[1];return t[0]=i+r*(n[0]-i),t[1]=a+r*(n[1]-a),t},e.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},e.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},e.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},e.rotate=function(t,e,n,r){var i=e[0]-n[0],a=e[1]-n[1],s=Math.sin(r),o=Math.cos(r);return t[0]=i*o-a*s+n[0],t[1]=i*s+a*o+n[1],t},e.angle=function(t,e){var n=t[0],r=t[1],i=e[0],a=e[1],s=n*n+r*r;s>0&&(s=1/Math.sqrt(s));var o=i*i+a*a;o>0&&(o=1/Math.sqrt(o));var u=(n*i+r*a)*s*o;return u>1?0:u<-1?Math.PI:Math.acos(u)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],a=e[0],s=e[1];return Math.abs(n-a)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function s(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function u(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function h(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function f(t){var e=t[0],n=t[1];return e*e+n*n}e.len=h,e.sub=a,e.mul=s,e.div=o,e.dist=u,e.sqrDist=c,e.sqrLen=f,e.forEach=function(){var t=i();return function(e,n,r,i,a,s){var o,u=void 0;for(n||(n=2),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,u=r;u0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,a=e[2]/n,s=e[3]/n,o=e[4],u=e[5],c=e[6],h=e[7],f=r*o+i*u+a*c+s*h;t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=(o-r*f)/n,t[5]=(u-i*f)/n,t[6]=(c-a*f)/n,t[7]=(h-s*f)/n}return t},e.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=t[6],h=t[7],f=e[0],l=e[1],d=e[2],m=e[3],_=e[4],p=e[5],g=e[6],v=e[7];return Math.abs(n-f)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(s-m)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-_)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(u-p)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(p))&&Math.abs(c-g)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(h-v)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))};var r=s(n(0)),i=s(n(3)),a=s(n(4));function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e,n){var r=.5*n[0],i=.5*n[1],a=.5*n[2],s=e[0],o=e[1],u=e[2],c=e[3];return t[0]=s,t[1]=o,t[2]=u,t[3]=c,t[4]=r*c+i*u-a*o,t[5]=i*c+a*s-r*u,t[6]=a*c+r*o-i*s,t[7]=-r*s-i*o-a*u,t}function u(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[4],u=n[5],c=n[6],h=n[7],f=e[4],l=e[5],d=e[6],m=e[7],_=n[0],p=n[1],g=n[2],v=n[3];return t[0]=r*v+s*_+i*g-a*p,t[1]=i*v+s*p+a*_-r*g,t[2]=a*v+s*g+r*p-i*_,t[3]=s*v-r*_-i*p-a*g,t[4]=r*h+s*o+i*c-a*u+f*v+m*_+l*g-d*p,t[5]=i*h+s*u+a*o-r*c+l*v+m*p+d*_-f*g,t[6]=a*h+s*c+r*u-i*o+d*v+m*g+f*p-l*_,t[7]=s*h-r*o-i*u-a*c+m*v-f*_-l*p-d*g,t}e.getReal=i.copy,e.setReal=i.copy,e.mul=c;var h=e.dot=i.dot,f=e.length=i.length,l=(e.len=f,e.squaredLength=i.squaredLength);e.sqrLen=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.fromValues=function(t,e,n,i,a,s){var o=new r.ARRAY_TYPE(6);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o[4]=a,o[5]=s,o},e.set=function(t,e,n,r,i,a,s){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s,t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=n*a-r*i;return u?(u=1/u,t[0]=a*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t[4]=(i*o-a*s)*u,t[5]=(r*s-n*o)*u,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=Math.sin(n),h=Math.cos(n);return t[0]=r*h+a*c,t[1]=i*h+s*c,t[2]=r*-c+a*h,t[3]=i*-c+s*h,t[4]=o,t[5]=u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r*c,t[1]=i*c,t[2]=a*h,t[3]=s*h,t[4]=o,t[5]=u,t},e.translate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1];return t[0]=r,t[1]=i,t[2]=a,t[3]=s,t[4]=r*c+a*h+o,t[5]=i*c+s*h+u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},e.subtract=a,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],c=e[0],h=e[1],f=e[2],l=e[3],d=e[4],m=e[5];return Math.abs(n-c)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-f)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-l)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(l))&&Math.abs(o-d)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(u-m)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(m))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=e[4],u=e[5],c=n[0],h=n[1],f=n[2],l=n[3],d=n[4],m=n[5];return t[0]=r*c+a*h,t[1]=i*c+s*h,t[2]=r*f+a*l,t[3]=i*f+s*l,t[4]=r*d+a*m+o,t[5]=i*d+s*m+u,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.fromValues=function(t,e,n,i){var a=new r.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=n,a[3]=i,a},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],s=n*a-i*r;return s?(s=1/s,t[0]=a*s,t[1]=-r*s,t[2]=-i*s,t[3]=n*s,t):null},e.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=Math.sin(n),u=Math.cos(n);return t[0]=r*u+a*o,t[1]=i*u+s*o,t[2]=r*-o+a*u,t[3]=i*-o+s*u,t},e.scale=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1];return t[0]=r*o,t[1]=i*o,t[2]=a*u,t[3]=s*u,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=a,e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],u=e[1],c=e[2],h=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))},e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],a=e[2],s=e[3],o=n[0],u=n[1],c=n[2],h=n[3];return t[0]=r*o+a*u,t[1]=i*o+s*u,t[2]=r*c+a*h,t[3]=i*c+s*h,t}function a(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}e.mul=i,e.sub=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.vec4=e.vec3=e.vec2=e.quat2=e.quat=e.mat4=e.mat3=e.mat2d=e.mat2=e.glMatrix=void 0;var r=d(n(0)),i=d(n(9)),a=d(n(8)),s=d(n(5)),o=d(n(4)),u=d(n(3)),c=d(n(7)),h=d(n(6)),f=d(n(2)),l=d(n(1));function d(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.glMatrix=r,e.mat2=i,e.mat2d=a,e.mat3=s,e.mat4=o,e.quat=u,e.quat2=c,e.vec2=h,e.vec3=f,e.vec4=l}])},function(t,e,n){"use strict";var r=function(){var t,e;try{t=Object.defineProperty,e=Object.defineProperties,t({},"$",{value:0})}catch(n){"__defineGetter__"in Object&&(t=function(t,e,n){return"value"in n&&(t[e]=n.value),"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),t},e=function(e,n){for(var r in n)n.hasOwnProperty(r)&&t(e,r,n[r]);return e})}var n=function(t){for(var n=1,r=arguments.length;n>1,s=n(t[a],e);if(0===s)return[a,a];s<0?r=a+1:i=a-1}return r>i?[i,r]:[r,i]}function v(t,e,n){var r=g(t,e,n);t.splice(r[1],0,e)}function E(t,e,n){return e<=t.length?t:new Array(e-t.length+1).join(n||"0")+t}function T(t){return t instanceof Float32Array?l:t instanceof Int8Array?o:t instanceof Uint8Array?u:t instanceof Int16Array?c:t instanceof Uint16Array?h:t instanceof Uint32Array?f:l}var M,A,L=(a(M={},o,Int8Array),a(M,u,Uint8Array),a(M,c,Int16Array),a(M,h,Uint16Array),a(M,f,Uint32Array),a(M,l,Float32Array),A=M,function(t){return A[t]||Float32Array});function I(t,e,n,r,i){if(t&&e){e.isGeometryData&&(e=e.data);for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return Array.isArray(t)||(t=Object.values(t)),t.reduce((function(t,n,r){return t.then((function(){return e(n,r)}))}),Promise.resolve())}function b(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector3",isVector3:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec3.round(this.elements,this.elements),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this},random:function(t){return r.vec3.random(this.elements,t),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r,i={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r=0,function(t){var e=++r;return t?e=t+"_"+e:e+="",e}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},degToRad:function(t){return t*this.DEG2RAD},radToDeg:function(t){return t*this.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};e.a=i},function(t,e,n){"use strict";var r,i=n(0),a=n(1),s=n(5),o=n(10),u=new s.a,c=new s.a,h=a.a.create({className:"Matrix4",isMatrix4:!0,constructor:function(){this.elements=i.mat4.create()},copy:function(t){return i.mat4.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return i.mat4.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this},identity:function(){return i.mat4.identity(this.elements),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new s.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this},fromRotationTranslationScaleOrigin:function(t,e,n,r){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this},lookAt:function(t,e,n){return t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this},targetTo:function(t,e,n){t.isVector3||(t=u.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],h=n[1],f=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=h*m-f*d,g=f*l-o*m,v=o*d-h*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=h*m-f*d)*p+(g=f*l-(o+=1e-7)*m)*g+(v=o*d-h*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new h),this.determinant()<0&&(n.x*=-1),r.copy(this),u.inverse(n),r.scale(u),t.fromMat4(r),i&&i.set(0,0,0),this}});h.prototype.sub=h.prototype.subtract,h.prototype.mul=h.prototype.multiply,e.a=h},function(t,e,n){"use strict";var r=n(1),i=n(12),a=n(4),s=r.a.create({Extends:i.a,className:"Color",isColor:!0,r:{get:function(){return this.x},set:function(t){this.x=t}},g:{get:function(){return this.y},set:function(t){this.y=t}},b:{get:function(){return this.z},set:function(t){this.z=t}},a:{get:function(){return this.w},set:function(t){this.w=t}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;s.superclass.constructor.call(this,t,e,n,r)},toRGBArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t},fromUintArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e]/255,this.elements[1]=t[e+1]/255,this.elements[2]=t[e+2]/255,this.elements[3]=t[e+3]/255,this},fromHEX:function(t){return"number"==typeof t?t=Object(a.padLeft)(t.toString(16),6):("#"===t[0]&&(t=t.slice(1)),3===t.length&&(t=t.replace(/(\w)/g,"$1$1"))),this.elements[0]=parseInt(t.slice(0,2),16)/255,this.elements[1]=parseInt(t.slice(2,4),16)/255,this.elements[2]=parseInt(t.slice(4,6),16)/255,this},toHEX:function(){for(var t="",e=0;e<3;e++)t+=Object(a.padLeft)(Math.floor(255*this.elements[e]).toString(16),2);return t}});e.a=s},function(t,e,n){"use strict";var r=n(1).a.create({constructor:function(t,e,n){this.type=t,this.target=e,this.detail=n,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),i={_listeners:null,on:function(t,e,n){for(var r=this._listeners=this._listeners||{},i=r[t]=r[t]||[],a=0,s=i.length;a0){if(1===arguments.length)return delete this._listeners[t],this;for(var r=0,i=n.length;r0){var o=s.slice(0);if((n=n||new r(i,this,e))._stopped)return!1;for(var u=0;u-1&&s.splice(h,1)}}return!0}return!1}};e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(11),a=n(1),s=n(9),o=new i.a,u=a.a.create({Mixes:s.a,className:"Quaternion",isQuaternion:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.elements=r.quat.fromValues(t,e,n,i)},copy:function(t,e){return r.quat.copy(this.elements,t.elements),e||this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=this.elements;return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n||this.fire("update"),this},set:function(t,e,n,i,a){return r.quat.set(this.elements,t,e,n,i),a||this.fire("update"),this},identity:function(t){return r.quat.identity(this.elements),t||this.fire("update"),this},rotationTo:function(t,e,n){return r.quat.rotationTo(this.elements,t.elements,e.elements),n||this.fire("update"),this},setAxes:function(t,e,n,i){return r.quat.setAxes(this.elements,t.elements,e.elements,n.elements),i||this.fire("update"),this},setAxisAngle:function(t,e,n){return r.quat.setAxisAngle(this.elements,t.elements,e),n||this.fire("update"),this},getAxisAngle:function(t){return r.quat.getAxisAngle(t.elements,this.elements)},add:function(t,e){return r.quat.add(this.elements,this.elements,t.elements),e||this.fire("update"),this},multiply:function(t,e){return r.quat.multiply(this.elements,this.elements,t.elements),e||this.fire("update"),this},premultiply:function(t,e){return r.quat.multiply(this.elements,t.elements,this.elements),e||this.fire("update"),this},scale:function(t,e){return r.quat.scale(this.elements,this.elements,t),e||this.fire("update"),this},rotateX:function(t,e){return r.quat.rotateX(this.elements,this.elements,t),e||this.fire("update"),this},rotateY:function(t,e){return r.quat.rotateY(this.elements,this.elements,t),e||this.fire("update"),this},rotateZ:function(t,e){return r.quat.rotateZ(this.elements,this.elements,t),e||this.fire("update"),this},calculateW:function(t){return r.quat.calculateW(this.elements,this.elements),t||this.fire("update"),this},dot:function(t){return r.quat.dot(this.elements,t.elements)},lerp:function(t,e,n){return r.quat.lerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},slerp:function(t,e,n){return r.quat.slerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},sqlerp:function(t,e,n,i,a,s){return r.quat.sqlerp(this.elements,t.elements,e.elements,n.elements,i.elements,a),s||this.fire("update"),this},invert:function(t){return r.quat.invert(this.elements,this.elements),t||this.fire("update"),this},conjugate:function(t){return r.quat.conjugate(this.elements,this.elements),t||this.fire("update"),this},length:function(){return r.quat.length(this.elements)},squaredLength:function(){return r.quat.squaredLength(this.elements)},normalize:function(t){return r.quat.normalize(this.elements,this.elements),t||this.fire("update"),this},fromMat3:function(t,e){return r.quat.fromMat3(this.elements,t.elements),e||this.fire("update"),this},fromMat4:function(t,e){return o.fromMat4(t),this.fromMat3(o,e),this},exactEquals:function(t){return r.quat.exactEquals(this.elements,t.elements)},equals:function(t){return r.quat.equals(this.elements,t.elements)},fromEuler:function(t,e){var n=.5*t.x,r=.5*t.y,i=.5*t.z,a=t.order||"ZYX",s=Math.sin(n),o=Math.cos(n),u=Math.sin(r),c=Math.cos(r),h=Math.sin(i),f=Math.cos(i),l=this.elements;return"XYZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"YXZ"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"ZXY"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f-s*u*h):"ZYX"===a?(l[0]=s*c*f-o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f+s*u*h):"YZX"===a?(l[0]=s*c*f+o*u*h,l[1]=o*u*f+s*c*h,l[2]=o*c*h-s*u*f,l[3]=o*c*f-s*u*h):"XZY"===a&&(l[0]=s*c*f-o*u*h,l[1]=o*u*f-s*c*h,l[2]=o*c*h+s*u*f,l[3]=o*c*f+s*u*h),e||this.fire("update"),this},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t,this.fire("update")}}});u.prototype.mul=u.prototype.multiply,u.prototype.len=u.prototype.length,u.prototype.sqrLen=u.prototype.squaredLength,e.a=u},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Matrix3",isMatrix3:!0,constructor:function(){this.elements=r.mat3.create()},copy:function(t){return r.mat3.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return r.mat3.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)n[r]=t[e+r];return this},set:function(t,e,n,i,a,s,o,u,c){return r.mat3.set(this.elements,t,e,n,i,a,s,o,u,c),this},identity:function(){return r.mat3.identity(this.elements),this},transpose:function(){return r.mat3.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.adjoint(this.elements,t.elements),this},determinant:function(){return r.mat3.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),r.mat3.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return r.mat3.translate(this.elements,this.elements,t.elements),this},rotate:function(t){return r.mat3.rotate(this.elements,this.elements,t),this},scale:function(t){return r.mat3.scale(this.elements,this.elements,t.elements),this},fromTranslation:function(t){return r.mat3.fromTranslation(this.elements,t.elements),this},fromRotation:function(t){return r.mat3.fromRotation(this.elements,t),this},fromScaling:function(t){return r.mat3.fromScaling(this.elements,t.elements),this},fromQuat:function(t){return r.mat3.fromQuat(this.elements,t.elements),this},normalFromMat4:function(t){return r.mat3.normalFromMat4(this.elements,t.elements),this},fromMat4:function(t){return r.mat3.fromMat4(this.elements,t.elements),this},frob:function(){return r.mat3.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),r.mat3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.mat3.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.mat3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.mat3.equals(t.elements,e.elements)},fromRotationTranslationScale:function(t,e,n,r,i){var a=Math.cos(t),s=Math.sin(t);return this.set(r*a,-i*s,0,r*s,i*a,0,e,n,1),this}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector4",isVector4:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.elements=r.vec4.fromValues(t,e,n,i)},copy:function(t){return r.vec4.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t[3+e]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],this},set:function(t,e,n,i){return r.vec4.set(this.elements,t,e,n,i),this},add:function(t,e){return e||(e=t,t=this),r.vec4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec4.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec4.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec4.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec4.ceil(this.elements,this.elements),this},floor:function(){return r.vec4.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec4.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec4.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec4.round(this.elements,this.elements),this},scale:function(t){return r.vec4.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec4.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec4.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec4.squaredDistance(t.elements,e.elements)},length:function(){return r.vec4.length(this.elements)},squaredLength:function(){return r.vec4.squaredLength(this.elements)},negate:function(){return r.vec4.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec4.inverse(this.elements,t.elements),this},normalize:function(){return r.vec4.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec4.dot(t.elements,e.elements)},lerp:function(t,e){return r.vec4.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return t=t||1,this.elements[0]=Math.random(),this.elements[1]=Math.random(),this.elements[2]=Math.random(),this.elements[3]=Math.random(),this.normalize(),this.scale(t),this},transformMat4:function(t){return r.vec4.transformMat4(this.elements,this.elements,t.elements),this},transformQuat:function(t){return r.vec4.transformQuat(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec4.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r=n(1),i=n(6),a=n(7),s=n(3),o=new a.a,u=i.a.DEG2RAD,c=i.a.RAD2DEG,h=r.a.create({className:"Euler",isEuler:!0,order:"ZYX",constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=new Float32Array([t,e,n]),this.updateDegrees()},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.elements[0]=t.x,this.elements[1]=t.y,this.elements[2]=t.z,this.order=t.order,this.updateDegrees(),this},set:function(t,e,n){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=n,this.updateDegrees(),this},setDegree:function(t,e,n){return this._degX=t,this._degY=e,this._degZ=n,this.updateRadians(),this},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e],this.elements[1]=t[e+1],this.elements[2]=t[e+2],this.updateDegrees(),this},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.elements[0],t[e+1]=this.elements[1],t[e+2]=this.elements[2],t},fromMat4:function(t,e){var n=t.elements,r=n[0],a=n[1],o=n[2],u=n[4],c=n[5],h=n[6],f=n[8],l=n[9],d=n[10];e=e||this.order,this.order=e;var m=i.a.clamp;return"XYZ"===e?(this.elements[1]=Math.asin(m(f,-1,1)),Math.abs(f)<.99999?(this.elements[0]=Math.atan2(-l,d),this.elements[2]=Math.atan2(-u,r)):(this.elements[0]=Math.atan2(h,c),this.elements[2]=0)):"YXZ"===e?(this.elements[0]=Math.asin(-m(l,-1,1)),Math.abs(l)<.99999?(this.elements[1]=Math.atan2(f,d),this.elements[2]=Math.atan2(a,c)):(this.elements[1]=Math.atan2(-o,r),this.elements[2]=0)):"ZXY"===e?(this.elements[0]=Math.asin(m(h,-1,1)),Math.abs(h)<.99999?(this.elements[1]=Math.atan2(-o,d),this.elements[2]=Math.atan2(-u,c)):(this.elements[1]=0,this.elements[2]=Math.atan2(a,r))):"ZYX"===e?(this.elements[1]=Math.asin(-m(o,-1,1)),Math.abs(o)<.99999?(this.elements[0]=Math.atan2(h,d),this.elements[2]=Math.atan2(a,r)):(this.elements[0]=0,this.elements[2]=Math.atan2(-u,c))):"YZX"===e?(this.elements[2]=Math.asin(m(a,-1,1)),Math.abs(a)<.99999?(this.elements[0]=Math.atan2(-l,c),this.elements[1]=Math.atan2(-o,r)):(this.elements[0]=0,this.elements[1]=Math.atan2(f,d))):"XZY"===e?(this.elements[2]=Math.asin(-m(u,-1,1)),Math.abs(u)<.99999?(this.elements[0]=Math.atan2(h,c),this.elements[1]=Math.atan2(f,r)):(this.elements[0]=Math.atan2(-l,d),this.elements[1]=0)):s.a.warn("Euler fromMat4() unsupported order: "+e),this.updateDegrees(),this},fromQuat:function(t,e){return o.fromQuat(t),this.fromMat4(o,e)},updateDegrees:function(){return this._degX=this.elements[0]*c,this._degY=this.elements[1]*c,this._degZ=this.elements[2]*c,this},updateRadians:function(){return this.elements[0]=this._degX*u,this.elements[1]=this._degY*u,this.elements[2]=this._degZ*u,this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*u}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*u}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*u}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*c}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*c}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*c}}});e.a=h},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector2",isVector2:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.elements=r.vec2.fromValues(t,e)},copy:function(t){return r.vec2.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],this},set:function(t,e){return r.vec2.set(this.elements,t,e),this},add:function(t,e){return e||(e=t,t=this),r.vec2.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec2.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec2.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec2.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec2.ceil(this.elements,this.elements),this},floor:function(){return r.vec2.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec2.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec2.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec2.round(this.elements,this.elements),this},scale:function(t){return r.vec2.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec2.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec2.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec2.squaredDistance(t.elements,e.elements)},length:function(){return r.vec2.length(this.elements)},squaredLength:function(){return r.vec2.squaredLength(this.elements)},negate:function(){return r.vec2.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec2.inverse(this.elements,t.elements),this},normalize:function(){return r.vec2.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec2.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec2.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec2.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return r.vec2.random(this.elements,t),this},transformMat3:function(t){return r.vec2.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec2.transformMat4(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec2.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec2.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){function r(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:4;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.indices=e,this.mode=n,this.attrs=[],this.attrIndexMap={}}return i(t,null,[{key:"cp",value:function(t){return t}},{key:"minus",value:function(t,e){return t-e}},{key:"plus",value:function(t,e){return t+e}},{key:"pp",value:function(t,e,n,r){return r-e-n+t}},{key:"depp",value:function(t,e,n,r){return e+n-t+r}},{key:"ATTR",get:function(){return s}},{key:"ATTR_NAME_ID",get:function(){return u}}]),i(t,[{key:"getAttrLength",value:function(){return this.attrs[0].data.length/this.attrs[0].itemCount}},{key:"attrIdToName",value:function(t){return o[t]||"OTHER"}},{key:"addAttr",value:function(t,e,n){s[t]?(this.attrIndexMap[t]=this.attrs.length,n||(n=f[t])):n||(n=1),this.attrs.push({name:t,itemCount:n,data:e})}},{key:"getAttr",value:function(t){if(this.attrIndexMap[t])return this.attrs[this.attrIndexMap[t]];for(var e=this.attrs.length-1;e>=0;e--){var n=this.attrs[e];if(n.name===t)return n}}},{key:"cal",value:function(t,e,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a=0;c--)o[u+c]=n.apply(null,i.map((function(t){return s[t*r.itemCount+c]})))}))}},{key:"quantize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.attrs.forEach((function(e){if("JOINT"!==e.name&&0!=t[e.name]){var n=a.encode(e.data,t[e.name]||12);e.quantizationBit=n.quantizationBit,e.min=n.min,e.max=n.max,e.data=n.data}}))}},{key:"dequantize",value:function(){this.attrs.forEach((function(t){t.quantizationBit&&(t.data=a.decode(t.data,t.quantizationBit,t.min,t.max))}))}},{key:"convertTypedArray",value:function(){!this.indices||this.indices instanceof Array||(this.indices=Array.from(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array||t.data instanceof Float32Array||(t.data=Array.from(t.data))}))}},{key:"clearEBAttrs",value:function(){delete this.clers,delete this.holes,delete this.handles}},{key:"convertToTypedArray",value:function(){this.indices instanceof Array&&(this.getAttrLength()>65535?this.indices=new Uint32Array(this.indices):this.indices=new Uint16Array(this.indices)),this.attrs.forEach((function(t){t.data instanceof Array&&(t.data=new Float32Array(t.data))}))}},{key:"prepareToWorkerSend",value:function(){return this.clearEBAttrs(),this.convertToTypedArray(),this.getAllBuffers()}},{key:"clone",value:function(){var e=new t(Array.from(this.indices),this.mode);return Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=Array.from(e.data),e})),e}},{key:"cloneStruct",value:function(){var e=new t;return e.mode=this.mode,this.indices&&(e.indices=[]),Object.assign(e.attrIndexMap,this.attrIndexMap),e.attrs=this.attrs.map((function(t){var e=Object.assign({},t);return e.data=[],e})),e}},{key:"toHilo3dGeometry",value:function(t,e){var n=e||new t.Geometry;return this.indices&&(this.indices.BYTES_PER_ELEMENT?n.indices=new t.GeometryData(this.indices,1):this.getAttrLength()>65535?n.indices=new t.GeometryData(new Uint32Array(this.indices),1):n.indices=new t.GeometryData(new Uint16Array(this.indices),1)),this.attrs.forEach((function(e){var r=c[e.name];r&&(e.data.BYTES_PER_ELEMENT?n[r]=new t.GeometryData(e.data,e.itemCount):n[r]=new t.GeometryData(new Float32Array(e.data),e.itemCount))})),n}},{key:"getAllBuffers",value:function(){var t=[];return this.indices.BYTES_PER_ELEMENT&&t.push(this.indices.buffer),this.attrs.forEach((function(e){e.data&&e.data.BYTES_PER_ELEMENT&&t.push(e.data.buffer)})),t}}],[{key:"fromGLTFPrimitive",value:function(e){var n=new t(e.indices,e.mode),r=e.attributes,i=0;for(var a in r.POSITION&&(i=r.POSITION.length/3),r)if(s[a]){var o=f[s[a]];i&&(o=r[a].length/i),n.addAttr(s[a],r[a],o)}else console.warn("Dont support attribute",a);return n}},{key:"fromHilo3dGeometry",value:function(e){var n=new t(e.indices.data,e.mode);for(var r in h)e[r]&&n.addAttr(h[r],e[r].data,e[r].size);return n}}]),t}();t.exports=l},function(t,e){var n={};function r(t){return n[t]||(n[t]=Math.pow(2,t)-1),n[t]}t.exports={cal:function(t,e,n,i){var a=r(i),s=n-e;return Math.round((t-e)/s*a)},encode:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,n=t.length,i=r(e),a=1/0,s=-1/0,o=0;o1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8,s=t.length,o=r(a),u=i-n||1,c=0;c1&&void 0!==arguments[1]?arguments[1]:8,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=t.length,s=r(e),o=i-n,u=new Float32Array(a),c=0;c1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=t.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return t instanceof Uint8Array&&(e=t.byteOffset,t=t.buffer),function(t){return new u[t.type](t).decompress()}(function(t,e){var n=new Uint8Array(t,e,4);if(65!==n[0]||77!==n[1]||67!==n[2])throw new Error("The file is not AMC format!");var r=c[n[3]].read(t,e+4);return r.geometry.type=n[3],r.geometry}(t,e))}var f,l=null,d=null;function m(t,e){return!l&&o()?(l=new s({wasmURL:t,memPages:e}),d=l.init()):d||Promise.resolve()}function _(t,e,n){if(l||m(e,n),!l||!l.isReady)return h(t);try{return l.decompress(t)}catch(e){return console.warn("wasm decompress error",e),h(t)}}var p=null;function g(t){return t=t||"https://g.alicdn.com/hilo/amc/0.1.27/worker.js",p||(!1===f||"undefined"==typeof Worker?Promise.reject("dont support web worker"):p=/^(?:http|blob|data:|\/\/)/.test(t)?new Promise((function(e,n){var r=new XMLHttpRequest;r.addEventListener("load",(function(){if("undefined"==typeof URL||"undefined"==typeof Blob)f=new Worker("data:application/javascript, ".concat(this.responseText));else{var t=URL.createObjectURL(new Blob([this.responseText]));f=new Worker(t)}f.onerror=function(t){console.log("web worker error",t),f=!1,n(t)},e(f)})),r.addEventListener("error",(function(t){return n(t)})),r.open("get",t,!0),r.send()})):new Promise((function(e,n){(f=new Worker(t)).onerror=function(t){console.log("web worker init error",t),f=!1,n(t)},e(f)})))}var v=0;function E(t,e,n,i){return e=e&&o(),t=new Uint8Array(t),g(i).then((function(i){return new Promise((function(a,s){var o=v++,u=function(e){if(e.data.id===o)if(i.removeEventListener("message",u),u=null,e.data.data){var n=e.data.data;n.constructor=r,n.__proto__=r.prototype,a(n)}else a(h(t))};i.addEventListener("message",u),i.postMessage({id:o,data:t,useWASM:e,wasmURL:n},[t.buffer])}))})).catch((function(r){return e?_(t,n):h(t)}))}t.exports={initWASM:m,initWorker:g,decompress:function(t,e,n){var r=o();return!r||t.byteLength>1048576?E(t,r,e,n):r?Promise.resolve(_(t,e)):Promise.resolve(h(t))},decompressWithJS:h,decompressWithWASM:_,decompressWithWorker:E,destory:function(){f&&(f.terminate(),f=null,p=null),l&&(l=null,d=null)}}},function(t,e,n){function r(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e=0;n-=2)e[t[n]]=t[n-1]}},{key:"mapBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex,i=this.currentVertex-n+1,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r,r=i,e[this.prevCorner(t[a])]=i++;this.currentVertex-=n}},{key:"mapHoleBoundary",value:function(t){for(var e=this.indices,n=t.length,r=this.currentVertex-n+1,i=r,a=n-1;a>=0;a--)e[this.nextCorner(t[a])]=r++,e[this.prevCorner(t[a])]=a?r:i;this.currentVertex-=n}},{key:"fixNegativeIndex",value:function(t){for(var e=t,n=this.indices;n[t]<0;){if(e===-n[-n[t]]||n[t]===n[-n[t]]){console.warn("dead loop bug!!"),n[s]=0;break}n[t]=n[-n[t]]}}},{key:"fixIndicesAndReadVertice",value:function(){for(var t,e=this.indices,n=this.handlesMap,r=this.clers,i=r.length,a=-1,s=[],u=0,c=0;u1&&void 0!==arguments[1]?arguments[1]:-1;if(!this.readedVertexMap[t]&&(this.readedVertexMap[t]=1,!this.noParallelogramPrediction)){var n=this.indices,r=this.geometry;-1===e?void 0!==this.lastReadVertexIndex&&r.cal(r,t,a.plus,this.lastReadVertexIndex,t):r.cal(r,t,a.depp,n[e],n[this.prevCorner(e)],n[this.nextCorner(e)],t),this.lastReadVertexIndex=t}}},{key:"markCorner",value:function(t,e){var n=this.indices;void 0===n[this.nextCorner(t)]&&(n[this.nextCorner(t)]=-this.prevCorner(e[0])),void 0===n[this.prevCorner(t)]&&(n[this.prevCorner(t)]=-this.nextCorner(e[e.length-1]))}},{key:"onFaceC",value:function(t){var e=this.indices,n=3*this.currentFace,r=this.currentVertex--;e[n]=r;var i=t.pop();return e[this.nextCorner(i)]=r,e[this.prevCorner(i)]=-this.nextCorner(t[t.length-1]),i=t.shift(),e[this.prevCorner(i)]=r,e[this.nextCorner(i)]=-this.prevCorner(t[0]),t.push(n),t}},{key:"onFaceL",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.unshift(e+2),t.push(e),t}},{key:"onFaceF",value:function(t,e){return t&&this.mapBoundary(t),this.onFaceE(null,e)}},{key:"onFaceE",value:function(t,e){var n=3*this.currentFace;return t&&e.push(t),[n+2,n+1,n]}},{key:"onFaceR",value:function(t){var e=3*this.currentFace;return this.markCorner(t.pop(),t),t.push(e+1,e),t}},{key:"onHandleEnd",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=this.handlesMap[this.currentFace],s=e.splice(0,t);return e.shift(),n.push(s),r[this.nextCorner(a)]=-(i+1),r[this.prevCorner(a)]=-this.nextCorner(s[s.length-1]),r[i]=-this.prevCorner(s[0]),e.push(i),e}},{key:"onHandleStart",value:function(t,e){for(var n,i=this.indices,a=3*this.currentFace,s=this.handlesMap[this.currentFace],o=e.length-1;o>=0;o--){var u=e[o].indexOf(s);if(u>=0){var c,h=(n=e.splice(o,1)[0]).splice(0,u);n.shift(),(c=n).push.apply(c,r(h));break}}return i[this.nextCorner(s)]=-(a+1),i[this.prevCorner(s)]=-this.nextCorner(n[n.length-1]),i[a]=-this.prevCorner(t[0]),(t=n.concat(t)).push(a),t}},{key:"onFaceS",value:function(t,e,n){var r=this.handlesMap,i=this.indices,a=3*this.currentFace;if(r[this.currentFace]){this.markCorner(t.pop(),t);var s=t.indexOf(r[this.currentFace]);t=s>=0?this.onHandleEnd(s,t,n):this.onHandleStart(t,n)}else{var o=t.pop();this.markCorner(o,t),i[a]=-this.nextCorner(o);var u=e.pop();this.markCorner(u.pop(),u),(t=u.concat(t)).push(a)}return t}},{key:"onFaceM",value:function(t,e,n){var r=this.indices,i=3*this.currentFace,a=t.splice(0,this.holes[this.currentHole--]);this.mapHoleBoundary(a);var s=r[this.prevCorner(a[0])];r[i]=s;var o=t.pop();return r[this.prevCorner(o)]=-this.nextCorner(t[t.length-1]),r[this.nextCorner(o)]=s,o=t.shift(),r[this.prevCorner(o)]=s,r[this.nextCorner(o)]=-this.prevCorner(t[0]),t.push(i),t}},{key:"decompress",value:function(){this.readedVertexMap=new Uint8Array(this.vertexCount);var t=this.faceCount,e=this.indices=new Array(3*t);this.currentFace=t-1,this.currentVertex=this.vertexCount-1,this.currentHole=this.holes.length-1;for(var n,r=this.clers,i=[],a=[];this.currentFace>=0;){var s="onFace"+u[r[this.currentFace]];this[s]?n=this[s](n,i,a):console.warn("has no ".concat(s)),this.currentFace--}return this.mapBoundary(n),this.fixIndicesAndReadVertice(this.indices),this.geometry.indices=e,this.geometry.dequantize(),this.geometry}},{key:"_onDecompressFace",value:function(t,e){this.onDecompressFace&&this.onDecompressFace(t,e)}}])&&i(e.prototype,n),t}();t.exports=c},function(t,e){var n={C:0,R:1,L:2,S:3,E:4,M:5,F:6},r=[];for(var i in n)r[n[i]]=i;n.map=r,t.exports=n},function(t,e,n){var r=n(0);function i(t,e,n,r){return new t(e.slice(n,n+r*t.BYTES_PER_ELEMENT))}t.exports={read:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new DataView(t),a=new r,s=function(t,e){var n={};return n.version=t.getUint8(e++),n.faceCount=t.getUint32(e,!0),e+=4,n.vertexCount=t.getUint32(e,!0),e+=4,n.attrCount=t.getUint8(e++),n.noParallelogramPrediction=t.getUint8(e++),n.holesCount=t.getUint16(e,!0),e+=2,n.handlesCount=t.getUint16(e,!0),e+=2,n.headerBytes=15,n}(n,e);return e+=s.headerBytes,a.mode="CLERS",e=function(t,e,n,r){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wasmURL=e.wasmURL||"https://ossgw.alicdn.com/tmall-c3/tmx/70b8d82ccf33e97a124e54c2d6a3e0c7.wasm",this.memPages=e.memPages||256,this.memPages<256&&(this.memPages=256),this.isReady=!1}var e,n;return e=t,(n=[{key:"initASMJS",value:function(){this.isReady=!0,this.dv=new DataView(HEAP8.buffer),this.heap8=HEAP8,this.ins={exports:{__Z7AMCinitj:Module.__Z7AMCinitj,__Z12AMDecompressv:Module.__Z12AMDecompressv}}}},{key:"init",value:function(){var t=this,e=this.memory=new WebAssembly.Memory({initial:this.memPages});this.dv=new DataView(e.buffer);var n=this.heap8=new Uint8Array(e.buffer),r={global:{NaN:5,Infinity:6},env:{memoryBase:0,memory:e,_malloc:function(){return 2097152},_memset:function(t,e,r){return n.fill(e,t,t+r),t},_printf:function(t,e){for(var r=t;n[r];)r++;var i=String.fromCharCode.apply(String,function(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e65536?new Uint32Array(d):new Uint16Array(d);var m=new i(d);return h.forEach((function(t){var n=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}(t,3),r=n[0],i=n[1],a=n[2],s=new Float32Array(e.buffer.slice(a,a+u*i*4));m.addAttr(m.attrIdToName(r),s,i)})),m}}])&&r(e.prototype,n),t}();t.exports=a},function(t,e){var n;t.exports=function(){return void 0===n&&(n=function(){if("undefined"==typeof WebAssembly||"undefined"==typeof fetch||function(){if(!/iPad|iPhone|iPod/i.test(navigator.userAgent))return!1;if(/OS (\d+)_(\d+)_?(\d+)?/i.test(navigator.userAgent)){var t=Number(RegExp.$1),e=Number(RegExp.$2);if(11===t&&e>=3||t>11)return!1}return!0}())return!1;try{var t=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),e=new WebAssembly.Module(t);return 0!==new WebAssembly.Instance(e,{}).exports.test(4)}catch(t){return console.log("err while check WebAssembly",t),!1}}()),n}}])},function(t,e,n){"use strict";var r=n(34),i=n.n(r),a=n(1),s=n(5),o=a.a.create({className:"Ray",isRay:!0,origin:{get:function(){return this._origin},set:function(t){this._origin=t,this._ray.origin=t.elements}},direction:{get:function(){return this._direction},set:function(t){this._direction=t,this._ray.direction=t.elements}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._ray=new i.a,this.origin=t.origin||new s.a(0,0,0),this.direction=t.direction||new s.a(0,0,-1)},set:function(t,e){return this.origin=t,this.direction=e,this},copy:function(t){this.origin.copy(t.origin),this.direction.copy(t.direction)},clone:function(){return new this.constructor({origin:this.origin.clone(),direction:this.direction.clone()})},fromCamera:function(t,e,n,r,i){t.isPerspectiveCamera?(t.worldMatrix.getTranslation(this.origin),this.direction.set(e,n,0),this.direction.copy(t.unprojectVector(this.direction,r,i)),this.direction.sub(this.origin).normalize()):t.isOrthographicCamera&&(this.origin.set(e,n,(t.near+t.far)/(t.near-t.far)),this.origin.copy(t.unprojectVector(this.origin,r,i)),this.direction.set(0,0,-1).transformDirection(t.worldMatrix).normalize())},transformMat4:function(t){this.origin.transformMat4(t),this.direction.transformDirection(t).normalize()},sortPoints:function(t,e){var n=this;e?t.sort((function(t,r){return n.squaredDistance(t[e])-n.squaredDistance(r[e])})):t.sort((function(t,e){return n.squaredDistance(t)-n.squaredDistance(e)}))},squaredDistance:function(t){return this.origin.squaredDistance(t)},distance:function(t){return this.origin.distance(t)},intersectsSphere:function(t,e){var n=this._ray.intersectsSphere(t,e);return this._getRes(n)},intersectsPlane:function(t,e){var n=this._ray.intersectsPlane(t,e);return this._getRes(n)},intersectsTriangle:function(t){var e=this._ray.intersectsTriangle(t);return this._getRes(e)},intersectsBox:function(t){var e=this._ray.intersectsBox(t);return this._getRes(e)},intersectsTriangleCell:function(t,e){var n=this._ray.intersectsTriangleCell(t,e);return this._getRes(n)},_getRes:function(t){return t?new s.a(t[0],t[1],t[2]):null}});e.a=o},function(t,e,n){"use strict";var r=n(0),i=n(1),a=n(9),s=n(5),o=i.a.create({Mixes:a.a,Extends:s.a,className:"Vector3Notifier",isVector3Notifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this.fire("update"),this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this.fire("update"),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this.fire("update"),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this.fire("update"),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this.fire("update"),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this.fire("update"),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this.fire("update"),this},round:function(){return r.vec3.round(this.elements,this.elements),this.fire("update"),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this.fire("update"),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this.fire("update"),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this.fire("update"),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this.fire("update"),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this.fire("update"),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this.fire("update"),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this.fire("update"),this},hermite:function(t,e,n,i,a){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},bezier:function(t,e,n,i,a){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,a),this.fire("update"),this},random:function(t){return r.vec3.random(this.elements,t),this.fire("update"),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this.fire("update"),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this.fire("update"),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],a=e[2];return e[0]=r*n[0]+i*n[4]+a*n[8],e[1]=r*n[1]+i*n[5]+a*n[9],e[2]=r*n[2]+i*n[6]+a*n[10],this.fire("update"),this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this.fire("update"),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}}});e.a=o},function(t,e){t.exports="#define GLSLIFY 1\n#define HILO_FRONT_SIDE 1028\n#define HILO_BACK_SIDE 1029\n#define HILO_FRONT_AND_BACK_SIDE 1032\n#define HILO_PI 3.141592653589793\n#define HILO_INVERSE_PI 0.3183098861837907"},function(t,e,n){"use strict";var r=n(1),i=n(5),a=r.a.create({className:"Plane",isPlane:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=t,this.distance=e},copy:function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},clone:function(){return new this.constructor(this.normal.clone(),this.distance)},set:function(t,e,n,r){return this.normal.set(t,e,n),this.distance=r,this},normalize:function(){var t=1/this.normal.length();return this.normal.scale(t),this.distance*=t,this},distanceToPoint:function(t){return this.normal.dot(t)+this.distance},projectPoint:function(t){return(new i.a).copy(this.normal).scale(-this.distanceToPoint(t)).add(t)}});e.a=a},function(t,e,n){"use strict";var r=n(1),i=n(5),a=new i.a,s=r.a.create({className:"Sphere",isSphere:!0,radius:0,constructor:function(t){Object.assign(this,t),this.center||(this.center=new i.a(0,0,0))},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},fromPoints:function(t){for(var e=this.center,n=0,r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this.fire("update"),this},set:function(t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p){return i.mat4.set(this.elements,t,e,n,r,a,s,o,u,c,h,f,l,d,m,_,p),this.fire("update"),this},identity:function(){return i.mat4.identity(this.elements),this.fire("update"),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this.fire("update"),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this.fire("update"),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this.fire("update"),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},premultiply:function(t){return this.multiply(t,this),this.fire("update"),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this.fire("update"),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this.fire("update"),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this.fire("update"),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this.fire("update"),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this.fire("update"),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this.fire("update"),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this.fire("update"),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this.fire("update"),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this.fire("update"),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this.fire("update"),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this.fire("update"),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this.fire("update"),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this.fire("update"),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},fromRotationTranslationScaleOrigin:function(t,e,n,r,a){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),a||this.fire("update"),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this.fire("update"),this},frustum:function(t,e,n,r,a,s){return i.mat4.frustum(this.elements,t,e,n,r,a,s),this.fire("update"),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this.fire("update"),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this.fire("update"),this},ortho:function(t,e,n,r,a,s){return i.mat4.ortho(this.elements,t,e,n,r,a,s),this.fire("update"),this},lookAt:function(t,e,n){return t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},targetTo:function(t,e,n){t.isVector3||(t=h.set(t.x,t.y,t.z)),e.isVector3||(e=f.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],a=t[1],s=t[2],o=n[0],u=n[1],c=n[2],l=i-e[0],d=a-e[1],m=s-e[2],_=l*l+d*d+m*m;_>0?(l*=_=1/Math.sqrt(_),d*=_,m*=_):m=1;var p=u*m-c*d,g=c*l-o*m,v=o*d-u*l;return(_=p*p+g*g+v*v)>0?(p*=_=1/Math.sqrt(_),g*=_,v*=_):(_=(p=u*m-c*d)*p+(g=c*l-(o+=1e-7)*m)*g+(v=o*d-u*l)*v,p*=_=1/Math.sqrt(_),g*=_,v*=_),r[0]=p,r[1]=g,r[2]=v,r[3]=0,r[4]=d*v-m*g,r[5]=m*p-l*v,r[6]=l*g-d*p,r[7]=0,r[8]=l,r[9]=d,r[10]=m,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,this.fire("update"),this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new u.a),this.determinant()<0&&(n.x*=-1),r.copy(this),h.inverse(n),r.scale(h),t.fromMat4(r),i&&i.set(0,0,0),this}});e.a=l},function(t,e,n){"use strict";var r=n(1),i=n(9),a=n(6),s=n(13),o=a.a.DEG2RAD,u=a.a.RAD2DEG,c=r.a.create({Mixes:i.a,Extends:s.a,className:"EulerNotifier",isEulerNotifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;s.a.call(this,t,e,n)},updateDegrees:function(){return c.superclass.updateDegrees.call(this),this.fire("update"),this},updateRadians:function(){return c.superclass.updateRadians.call(this),this.fire("update"),this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*o,this.fire("update")}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*o,this.fire("update")}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*o,this.fire("update")}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*u,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*u,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*u,this.fire("update")}}});e.a=c},function(t,e,n){"use strict";var r=n(1),i=n(19),a=r.a.create({className:"Frustum",isFrustum:!0,constructor:function(){this.planes=[];for(var t=6;t--;)this.planes.push(new i.a)},copy:function(t){var e=t.planes;return this.planes.forEach((function(t,n){t.copy(e[n])})),this},clone:function(){var t=new this.constructor;return t.copy(this),t},fromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],s=n[3],o=n[4],u=n[5],c=n[6],h=n[7],f=n[8],l=n[9],d=n[10],m=n[11],_=n[12],p=n[13],g=n[14],v=n[15];return e[0].set(s-r,h-o,m-f,v-_).normalize(),e[1].set(s+r,h+o,m+f,v+_).normalize(),e[2].set(s+i,h+u,m+l,v+p).normalize(),e[3].set(s-i,h-u,m-l,v-p).normalize(),e[4].set(s-a,h-c,m-d,v-g).normalize(),e[5].set(s+a,h+c,m+d,v+g).normalize(),this},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n) 0.0) {\n attenuation *= max(min(1.0 - pow( distance / range, 4.0 ), 1.0), 0.0);\n }\n #else\n attenuation = 1.0/(info.x + info.y * distance + info.z * distance * distance);\n #endif\n\n return attenuation;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nfloat unpackFloat(vec4 rgbaDepth) {\n const vec4 bitShift = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);\n float depth = dot(rgbaDepth, bitShift);\n return depth;\n}\n\n"},function(t,e){t.exports="#define GLSLIFY 1\nbool isOutOfRange(vec2 pos) {\n if (pos.x < 0.0 || pos.x > 1.0 || pos.y < 0.0 || pos.y > 1.0) {\n return true;\n }\n return false;\n}\n\nfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float bias, vec3 fragPos, mat4 lightSpaceMatrix) {\n vec4 fragPosLightSpace = lightSpaceMatrix * vec4(fragPos, 1.0);\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n projCoords = projCoords * 0.5 + 0.5;\n if (isOutOfRange(projCoords.xy)) {\n return 1.0;\n }\n float currentDepth = projCoords.z;\n float shadow = 0.0;\n vec2 texelSize = 1.0 / shadowMapSize;\n for (int x = -1; x <= 1; ++x) {\n for (int y = -1; y <= 1; ++y) {\n vec2 pos = projCoords.xy + vec2(x, y) * texelSize;\n if (isOutOfRange(pos)) {\n shadow += 1.0;\n } else {\n float pcfDepth = texture2D(shadowMap, pos).r;\n shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n }\n }\n }\n return 1.0 - shadow / 9.0;\n}\n\nfloat getShadow(samplerCube shadowMap, float bias, vec3 lightPos, vec3 position, vec2 camera, mat4 lightSpaceMatrix) {\n vec4 distanceVec = lightSpaceMatrix * vec4(position, 1.0) - lightSpaceMatrix * vec4(lightPos, 1.0);\n float currentDistance = length(distanceVec);\n vec3 direction = normalize(distanceVec).xyz;\n\n float shadow = 0.0;\n const float samples = 2.0;\n const float offset = 0.01;\n const float step = offset / (samples * 0.5);\n for(float x = -offset; x < offset; x +=step)\n {\n for(float y = -offset; y < offset; y +=step)\n {\n for(float z = -offset; z < offset; z +=step)\n {\n float closestDistance = camera[0] + (camera[1] - camera[0]) * unpackFloat(textureCube(shadowMap, direction + vec3(x, y, z)));\n if (closestDistance == camera[0]) {\n continue;\n }\n else if(currentDistance - bias > closestDistance)\n shadow += 1.0;\n }\n }\n }\n shadow /= (samples * samples * samples);\n\n return 1.0 - shadow;\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(64)+"\n\n#ifdef HILO_HAS_LIGHT\n #ifdef HILO_HAS_SPECULAR\n uniform float u_shininess;\n #ifdef HILO_SPECULAR_MAP\n uniform HILO_SAMPLER_2D u_specular;\n #else\n uniform vec4 u_specular;\n #endif\n #endif\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #else\n uniform vec4 u_emission;\n #endif\n #ifdef HILO_AMBIENT_MAP\n uniform HILO_SAMPLER_2D u_ambient;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform mat4 u_specularEnvMatrix;\n uniform float u_reflectivity;\n uniform float u_refractRatio;\n uniform float u_refractivity;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_FIX_MAX_BUG\n float hilo_max(float a, float b){\n if (a > b) {\n return a;\n }\n return b;\n }\n #define HILO_MAX(a, b) hilo_max(a, b);\n#else\n #define HILO_MAX(a, b) max(a, b);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_DIFFUSE_MAP)\n diffuse = HILO_TEXTURE_2D(u_diffuse);\n#elif defined(HILO_DIFFUSE_CUBE_MAP)\n diffuse = textureCube(u_diffuse, v_position);\n#elif defined(HILO_HAS_COLOR)\n diffuse = v_color;\n#else\n diffuse = u_diffuse;\n#endif\ncolor.a = diffuse.a;"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_LIGHT\n vec3 lightDiffuse = vec3(0, 0, 0);\n vec3 lightAmbient = vec3(0, 0, 0);\n vec3 viewPos = vec3(0, 0, 0);\n\n #ifdef HILO_AMBIENT_MAP\n lightAmbient = HILO_TEXTURE_2D(u_ambient).rgb;\n #else\n lightAmbient = diffuse.rgb;\n #endif\n\n #ifdef HILO_HAS_SPECULAR\n vec3 lightSpecular = vec3(0, 0, 0);\n #ifdef HILO_SPECULAR_MAP\n vec4 specular = HILO_TEXTURE_2D(u_specular);\n #else\n vec4 specular = u_specular;\n #endif\n #endif\n \n #ifdef HILO_EMISSION_MAP\n vec4 emission = HILO_TEXTURE_2D(u_emission);\n #else\n vec4 emission = u_emission;\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = -u_directionalLightsInfo[i];\n\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n\n float diff = getDiffuse(normal, lightDir);\n lightDiffuse += diff * u_directionalLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * u_directionalLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = -u_spotLightsDir[i];\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, normalize(distanceVec));\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n\n lightDiffuse += intensity * attenuation * shadow * diff * u_spotLightsColor[i];\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += intensity * attenuation * shadow * spec * u_spotLightsColor[i];\n #endif\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0;i < HILO_POINT_LIGHTS;i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n \n float diff = getDiffuse(normal, lightDir);\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n lightDiffuse += diff * attenuation * u_pointLightsColor[i] * shadow;\n\n #ifdef HILO_HAS_SPECULAR\n float spec = getSpecular(viewPos, v_fragPos, lightDir, normal, u_shininess);\n lightSpecular += spec * attenuation * u_pointLightsColor[i] * shadow;\n #endif\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n #ifndef HILO_HAS_SPECULAR\n vec4 specular = vec4(0.0, 0.0, 0.0, 0.0);\n #endif\n vec3 viewDir = normalize(vec3(0, 0, 0) - v_fragPos);\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuse.rgb, specular.rgb, sqrt(2.0/(u_shininess+2.0)), normal, viewDir, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_AMBIENT_LIGHTS\n color.rgb += u_ambientLightsColor * lightAmbient;\n #endif\n\n #if defined(HILO_SPECULAR_ENV_MAP) && defined(HILO_HAS_SPECULAR)\n vec3 I = normalize(v_fragPos - viewPos);\n if (u_reflectivity > 0.0) {\n vec3 R = reflect(I, normal);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_reflectivity;\n }\n if (u_refractivity > 0.0) {\n vec3 R = refract(I, normal, u_refractRatio);\n R = normalize(vec3(u_specularEnvMatrix * vec4(R, 1.0)));\n lightSpecular += textureEnvMap(u_specularEnvMap, R).rgb * u_refractivity;\n }\n #endif\n\n color.rgb += lightDiffuse * diffuse.rgb;\n #ifdef HILO_HAS_SPECULAR\n color.rgb += lightSpecular * specular.rgb;\n #endif\n\n color.rgb += emission.rgb;\n#else\n color.rgb = diffuse.rgb;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_FOG\n float fogFactor = 1.0;\n\n #ifdef HILO_FOG_LINEAR\n fogFactor = (u_fogInfo.y - v_dist)/(u_fogInfo.y - u_fogInfo.x);\n #elif defined(HILO_FOG_EXP)\n fogFactor = exp(-abs(u_fogInfo * v_dist));\n #elif defined(HILO_FOG_EXP2)\n fogFactor = exp(-(u_fogInfo * v_dist) * (u_fogInfo * v_dist)); \n #endif\n \n fogFactor = clamp(fogFactor, 0.0, 1.0);\n color = mix(u_fogColor, color, fogFactor);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n uniform mat4 u_positionDecodeMat;\n #endif\n #ifdef HILO_NORMAL_QUANTIZED\n uniform mat4 u_normalDecodeMat;\n #endif\n #ifdef HILO_UV_QUANTIZED\n uniform mat3 u_uvDecodeMat;\n #endif\n #ifdef HILO_UV1_QUANTIZED\n uniform mat3 u_uv1DecodeMat;\n #endif\n\n vec2 unQuantize(vec2 data, mat3 decodeMat) {\n vec3 result = vec3(data, 1.0);\n result = decodeMat * result;\n return result.xy;\n }\n\n vec3 unQuantize(vec3 data, mat4 decodeMat) {\n vec4 result = vec4(data, 1.0);\n result = decodeMat * result;\n return result.xyz;\n }\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n attribute vec4 a_skinIndices;\n attribute vec4 a_skinWeights;\n #ifdef HILO_JOINT_MAT_MAP\n uniform sampler2D u_jointMatTexture;\n uniform vec2 u_jointMatTextureSize;\n mat4 getJointMat(float index) {\n index *= 4.0;\n float x = float(mod(index, u_jointMatTextureSize.x));\n float y = float(floor(index / u_jointMatTextureSize.x));\n float dx = 1.0 / float(u_jointMatTextureSize.x);\n float dy = 1.0 / float(u_jointMatTextureSize.y);\n y = dy * (y + 0.5);\n vec4 v1 = texture2D(u_jointMatTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(u_jointMatTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(u_jointMatTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(u_jointMatTexture, vec2(dx * (x + 3.5), y));\n mat4 mat = mat4(v1, v2, v3, v4);\n return mat;\n }\n\n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * getJointMat(indices.x);\n mat += weights.y * getJointMat(indices.y);\n mat += weights.z * getJointMat(indices.z);\n mat += weights.w * getJointMat(indices.w);\n return mat;\n }\n #else\n uniform mat4 u_jointMat[HILO_JOINT_COUNT];\n \n mat4 getJointMat(vec4 weights, vec4 indices) {\n mat4 mat = weights.x * u_jointMat[int(indices.x)];\n mat += weights.y * u_jointMat[int(indices.y)];\n mat += weights.z * u_jointMat[int(indices.z)];\n mat += weights.w * u_jointMat[int(indices.w)];\n return mat;\n }\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n attribute vec2 a_texcoord0;\n varying vec2 v_texcoord0;\n #ifdef HILO_UV_MATRIX\n uniform mat3 u_uvMatrix;\n #endif\n#endif\n\n#ifdef HILO_HAS_TEXCOORD1\n attribute vec2 a_texcoord1;\n varying vec2 v_texcoord1;\n #ifdef HILO_UV_MATRIX1\n uniform mat3 u_uvMatrix1;\n #endif\n#endif\n\n#ifdef HILO_DIFFUSE_CUBE_MAP\n varying vec3 v_position;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n attribute vec3 a_normal;\n uniform mat3 u_normalMatrix;\n varying vec3 v_normal;\n\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n attribute vec4 a_tangent;\n varying mat3 v_TBN;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n uniform mat4 u_modelViewMatrix;\n #ifdef HILO_HAS_FOG\n varying float v_dist;\n #endif\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS) \n varying vec3 v_fragPos;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n uniform float u_morphWeights[HILO_MORPH_TARGET_COUNT];\n\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition0;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal0;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent0;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition1;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal1;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent1;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition2;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal2;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent2;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition3;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal3;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent3;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition4;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal4;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent4;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition5;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal5;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent5;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition6;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal6;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent6;\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n attribute vec3 a_morphPosition7;\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n attribute vec3 a_morphNormal7;\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n attribute vec3 a_morphTangent7;\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n attribute vec3 a_color;\n #elif HILO_COLOR_SIZE == 4\n attribute vec4 a_color;\n #endif\n varying vec4 v_color;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n varying float v_fragDepth;\n #else\n uniform float u_logDepth;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_COLOR\n #if HILO_COLOR_SIZE == 3\n v_color = vec4(a_color, 1.0);\n #elif HILO_COLOR_SIZE == 4\n v_color = a_color;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_QUANTIZED\n #ifdef HILO_POSITION_QUANTIZED\n pos.xyz = unQuantize(pos.xyz, u_positionDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD0) && defined(HILO_UV_QUANTIZED)\n uv = unQuantize(uv, u_uvDecodeMat);\n #endif\n #if defined(HILO_HAS_TEXCOORD1) && defined(HILO_UV1_QUANTIZED)\n uv1 = unQuantize(uv1, u_uv1DecodeMat);\n #endif\n #if defined(HILO_HAS_NORMAL) && defined(HILO_NORMAL_QUANTIZED)\n normal = unQuantize(normal, u_normalDecodeMat);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_MORPH_TARGET_COUNT\n #if HILO_MORPH_TARGET_COUNT > 0\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal0 * u_morphWeights[0];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent0 * u_morphWeights[0];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 1\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal1 * u_morphWeights[1];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent1 * u_morphWeights[1];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 2\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal2 * u_morphWeights[2];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent2 * u_morphWeights[2];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 3\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal3 * u_morphWeights[3];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent3 * u_morphWeights[3];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 4\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal4 * u_morphWeights[4];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent4 * u_morphWeights[4];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 5\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal5 * u_morphWeights[5];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent5 * u_morphWeights[5];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 6\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal6 * u_morphWeights[6];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent6 * u_morphWeights[6];\n #endif\n #endif\n\n #if HILO_MORPH_TARGET_COUNT > 7\n #ifdef HILO_MORPH_HAS_POSITION\n pos.xyz += a_morphPosition7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_NORMAL) && defined(HILO_HAS_NORMAL)\n normal += a_morphNormal7 * u_morphWeights[7];\n #endif\n #if defined(HILO_MORPH_HAS_TANGENT) && defined(HILO_HAS_TANGENT)\n tangent.xyz += a_morphTangent7 * u_morphWeights[7];\n #endif\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_JOINT_COUNT\n mat4 skinMat = getJointMat(a_skinWeights, a_skinIndices);\n pos = skinMat * pos;\n\n #ifdef HILO_HAS_NORMAL\n normal = mat3(skinMat) * normal;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_TEXCOORD0\n #ifdef HILO_UV_MATRIX\n v_texcoord0 = (u_uvMatrix * vec3(uv, 1.0)).xy;\n #else\n v_texcoord0 = uv;\n #endif\n#endif\n#ifdef HILO_HAS_TEXCOORD1\n #ifdef HILO_UV_MATRIX1\n v_texcoord1 = (u_uvMatrix1 * vec3(uv1, 1.0)).xy;\n #else\n v_texcoord1 = uv1;\n #endif\n#endif\n#ifdef HILO_DIFFUSE_CUBE_MAP\n v_position = pos.xyz;\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_HAS_NORMAL\n #if defined(HILO_NORMAL_MAP) || defined(HILO_CLEARCOAT_NORMAL_MAP)\n vec3 T = normalize(u_normalMatrix * tangent.xyz);\n vec3 N = normalize(u_normalMatrix * normal);\n T = normalize(T - dot(T, N) * N);\n vec3 B = cross(N, T) * tangent.w;\n v_TBN = mat3(T, B, N);\n #endif\n v_normal = normalize(u_normalMatrix * normal);\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FOG) || defined(HILO_HAS_FRAG_POS)\n vec3 fragPos = (u_modelViewMatrix * pos).xyz;\n\n #if defined(HILO_HAS_LIGHT) || defined(HILO_HAS_FRAG_POS)\n v_fragPos = fragPos;\n #endif\n\n #ifdef HILO_HAS_FOG\n v_dist = length(fragPos);\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n#ifdef HILO_USE_LOG_DEPTH\n #ifdef HILO_USE_EXT_FRAG_DEPTH\n v_fragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2( max( 1e-6, gl_Position.w + 1.0 ) ) * u_logDepth - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif"},function(t,e){t.exports="#define GLSLIFY 1\n// https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/packDepth.frag\n// Packing a float in GLSL with multiplication and mod\n// http://blog.gradientstudios.com/2012/08/23/shadow-map-improvement\nvec4 packFloat(float depth) {\n const vec4 bit_shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n\n // combination of mod and multiplication and division works better\n vec4 res = mod(depth * bit_shift * vec4(255), vec4(256) ) / vec4(255);\n res -= res.xxyz * bit_mask;\n return res;\n}\n\n\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\n"+n(41)+"\n"+n(86)+"\n"+n(64)+'\n\nuniform vec4 u_baseColor;\nuniform vec4 u_emissionFactor;\n\n#ifdef HILO_BASE_COLOR_MAP\n uniform HILO_SAMPLER_2D u_baseColorMap;\n#endif\n\n#ifdef HILO_NEED_WORLD_NORMAL\n uniform mat3 u_viewInverseNormalMatrix;\n#endif\n\n#ifdef HILO_HAS_LIGHT\n uniform float u_metallic;\n #ifdef HILO_METALLIC_MAP\n uniform HILO_SAMPLER_2D u_metallicMap;\n #endif\n uniform float u_roughness;\n #ifdef HILO_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_roughnessMap;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_metallicRoughnessMap;\n #endif\n #ifdef HILO_OCCLUSION_MAP\n uniform HILO_SAMPLER_2D u_occlusionMap;\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n uniform float u_occlusionStrength;\n #endif\n\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_DIFFUSE_ENV_MAP_CUBE\n uniform samplerCube u_diffuseEnvMap;\n #else\n uniform sampler2D u_diffuseEnvMap;\n #endif\n uniform float u_diffuseEnvIntensity;\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n uniform vec3 u_diffuseEnvSphereHarmonics3[9];\n uniform float u_diffuseEnvIntensity;\n #endif\n #ifdef HILO_SPECULAR_ENV_MAP\n uniform sampler2D u_brdfLUT;\n #ifdef HILO_SPECULAR_ENV_MAP_CUBE\n uniform samplerCube u_specularEnvMap;\n #else\n uniform sampler2D u_specularEnvMap;\n #endif\n uniform float u_specularEnvIntensity;\n\n uniform float u_specularEnvMapMipCount;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n uniform HILO_SAMPLER_2D u_emission;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n uniform vec4 u_specular;\n uniform float u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n uniform HILO_SAMPLER_2D u_specularGlossinessMap;\n #endif\n #endif\n\n #ifdef HILO_LIGHT_MAP\n uniform HILO_SAMPLER_2D u_lightMap;\n #endif\n\n #ifdef HILO_HAS_CLEARCOAT\n uniform float u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n uniform HILO_SAMPLER_2D u_clearcoatMap;\n #endif\n\n uniform float u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n uniform HILO_SAMPLER_2D u_clearcoatRoughnessMap;\n #endif\n #endif\n\n\n // PBR Based on https://github.com/KhronosGroup/glTF-WebGL-PBR\n\n // Basic Lambertian diffuse\n // Implementation from Lambert\'s Photometria https://archive.org/details/lambertsphotome00lambgoog\n // See also [1], Equation 1\n vec3 diffuse(vec3 diffuseColor) {\n return diffuseColor * HILO_INVERSE_PI;\n }\n\n // The following equation models the Fresnel reflectance term of the spec equation (aka F())\n // Implementation of fresnel from [4], Equation 15\n vec3 specularReflection(vec3 reflectance0, vec3 reflectance90, float VdotH) {\n return reflectance0 + (reflectance90 - reflectance0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n }\n\n // This calculates the specular geometric attenuation (aka G()),\n // where rougher material will reflect less light back to the viewer.\n // This implementation is based on [1] Equation 4, and we adopt their modifications to\n // alphaRoughness as input as originally proposed in [2].\n float geometricOcclusion(float NdotL, float NdotV, float alphaRoughness) {\n float r = alphaRoughness * alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r + (1.0 - r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r + (1.0 - r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n }\n\n // The following equation(s) model the distribution of microfacet normals across the area being drawn (aka D())\n // Implementation from "Average Irregularity Representation of a Roughened Surface for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz\n // Follows the distribution function recommended in the SIGGRAPH 2013 course notes from EPIC Games [1], Equation 3.\n float microfacetDistribution(float alphaRoughness, float NdotH) {\n float roughnessSq = alphaRoughness * alphaRoughness;\n float f = (NdotH * roughnessSq - NdotH) * NdotH + 1.0;\n return roughnessSq * HILO_INVERSE_PI / (f * f);\n }\n\n vec3 computeDiffuseSHLight(vec3 normal, in vec3 sh[9]) {\n return sh[0] +\n sh[1] * (normal.y) +\n sh[2] * (normal.z) +\n sh[3] * (normal.x) +\n sh[4] * (normal.y * normal.x) +\n sh[5] * (normal.y * normal.z) +\n sh[6] * ((3.0 * normal.z * normal.z) - 1.0) +\n sh[7] * (normal.z * normal.x) +\n sh[8] * (normal.x * normal.x - (normal.y * normal.y));\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/extensions/2.0/Vendor/EXT_lights_image_based/README.md#rgbd\n vec3 decodeRGBD(in vec4 color){\n return color.rgb / color.a;\n }\n\n vec3 getIBLClearCoatContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif defined(HILO_USE_SHADER_TEXTURE_LOD)\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 getIBLContribution(in vec3 N, in vec3 V, vec3 diffuseColor, vec3 specularColor, float ao, float NdotV, float perceptualRoughness) {\n vec3 color = vec3(.0, .0, .0);\n #ifdef HILO_NEED_WORLD_NORMAL\n N = u_viewInverseNormalMatrix * N;\n V = u_viewInverseNormalMatrix * V;\n #endif\n #if defined(HILO_DIFFUSE_ENV_MAP) || defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n #ifdef HILO_DIFFUSE_ENV_MAP\n #ifdef HILO_GAMMA_CORRECTION\n vec3 diffuseLight = sRGBToLinear(textureEnvMap(u_diffuseEnvMap, N)).rgb;\n #else\n vec3 diffuseLight = textureEnvMap(u_diffuseEnvMap, N).rgb;\n #endif\n #elif defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)\n vec3 diffuseLight = computeDiffuseSHLight(N, u_diffuseEnvSphereHarmonics3);\n #endif\n color.rgb += diffuseLight * diffuseColor * ao * u_diffuseEnvIntensity;\n #endif\n\n #ifdef HILO_SPECULAR_ENV_MAP\n vec3 R = -normalize(reflect(V, N));\n vec3 brdf = texture2D(u_brdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb;\n #ifdef HILO_IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapIncludeMipmapsLod(u_specularEnvMap, R, lod);\n #elif defined(HILO_USE_SHADER_TEXTURE_LOD)\n float lod = clamp(perceptualRoughness * u_specularEnvMapMipCount, 0.0, u_specularEnvMapMipCount);\n vec4 specularEnvMap = textureEnvMapLod(u_specularEnvMap, R, lod);\n #else\n vec4 specularEnvMap = textureEnvMap(u_specularEnvMap, R);\n #endif\n\n vec3 specularLight = decodeRGBD(specularEnvMap);\n\n #ifdef HILO_GAMMA_CORRECTION\n specularLight = sRGBToLinear(specularLight);\n #endif\n color.rgb += specularLight * (specularColor * brdf.x + brdf.y) * u_specularEnvIntensity;\n #endif\n return color;\n }\n\n vec3 calculateLo(vec3 N, vec3 V, vec3 L, vec3 reflectance0, vec3 reflectance90, float alphaRoughness, vec3 diffuseColor, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float LdotH = clamp(dot(L, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n // Calculate the shading terms for the microfacet specular shading model\n vec3 F = specularReflection(reflectance0, reflectance90, VdotH);\n float G = geometricOcclusion(NdotL, NdotV, alphaRoughness);\n float D = microfacetDistribution(alphaRoughness, NdotH);\n\n vec3 diffuseContrib;\n\n #ifdef HILO_LIGHT_MAP\n diffuseContrib = vec3(0.0);\n #else\n diffuseContrib = (1.0 - F) * diffuse(diffuseColor);\n #endif\n vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV);\n // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)\n return NdotL * (diffuseContrib + specContrib);\n }\n\n #ifdef HILO_HAS_CLEARCOAT\n float calculateClearcoatBRDF(vec3 N, vec3 V, vec3 L, float clearcoatAlphaRoughness, float NdotV) {\n vec3 H = normalize(L + V);\n float NdotL = clamp(dot(N, L), 0.001, 1.0);\n float NdotH = clamp(dot(N, H), 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n\n float G = geometricOcclusion(NdotL, NdotV, clearcoatAlphaRoughness);\n float D = microfacetDistribution(clearcoatAlphaRoughness, NdotH);\n\n float clearcoatLayer = G * D / (4.0 * NdotV);\n\n return clearcoatLayer;\n }\n #endif\n#endif'},function(t,e){t.exports="#define GLSLIFY 1\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\n\nvec3 sRGBToLinear( in vec3 value ) {\n return vec3( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ));\n}\n\n"},function(t,e,n){t.exports="#define GLSLIFY 1\nvec4 baseColor = u_baseColor;\nvec3 emissionColor = u_emissionFactor.rgb;\n\n#ifdef HILO_BASE_COLOR_MAP\n #ifdef HILO_GAMMA_CORRECTION\n baseColor *= sRGBToLinear(HILO_TEXTURE_2D(u_baseColorMap));\n #else\n baseColor *= HILO_TEXTURE_2D(u_baseColorMap);\n #endif\n#endif\n\n#if defined(HILO_HAS_COLOR)\n baseColor *= v_color;\n#endif\n\ncolor.a = baseColor.a;\n\n"+n(46)+"\n\n#ifdef HILO_HAS_LIGHT\n vec3 viewPos = vec3(0, 0, 0);\n vec3 N = normal;\n vec3 V = normalize(viewPos - v_fragPos);\n\n #ifdef HILO_OCCLUSION_MAP\n float ao = HILO_TEXTURE_2D(u_occlusionMap).r;\n #else\n float ao = 1.0;\n #endif\n\n #ifdef HILO_PBR_SPECULAR_GLOSSINESS\n vec3 specular = u_specular.rgb;\n float glossiness = u_glossiness;\n #ifdef HILO_SPECULAR_GLOSSINESS_MAP\n vec4 specularGlossiness = sRGBToLinear(HILO_TEXTURE_2D(u_specularGlossinessMap));\n specular = specularGlossiness.rgb * specular;\n glossiness = specularGlossiness.a * glossiness;\n #endif\n float roughness = 1.0 - glossiness;\n float metallic = 0.0;\n vec3 diffuseColor = baseColor.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n vec3 specularColor = specular;\n #else\n float metallic = u_metallic;\n float roughness = u_roughness;\n #ifdef HILO_METALLIC_MAP\n metallic = HILO_TEXTURE_2D(u_metallicMap).r * u_metallic;\n #endif\n #ifdef HILO_ROUGHNESS_MAP\n roughness = HILO_TEXTURE_2D(u_roughnessMap).r * u_roughness;\n #endif\n #ifdef HILO_METALLIC_ROUGHNESS_MAP\n vec4 metallicRoughnessMap = HILO_TEXTURE_2D(u_metallicRoughnessMap);\n #ifdef HILO_IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP\n ao = metallicRoughnessMap.r;\n #endif\n roughness = metallicRoughnessMap.g * u_roughness;\n metallic = metallicRoughnessMap.b * u_metallic;\n #endif\n roughness = clamp(roughness, 0.04, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n #endif\n\n #ifdef HILO_OCCLUSION_STRENGTH\n ao = mix(1.0, ao, u_occlusionStrength);\n #endif\n\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n // For typical incident reflectance range (between 4% to 100%) set the grazing reflectance to 100% for typical fresnel effect.\n // For very low reflectance range on highly diffuse objects (below 4%), incrementally reduce grazing reflecance to 0%.\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n float NdotV = clamp(abs(dot(N, V)), 0.001, 1.0);\n float alphaRoughness = roughness * roughness;\n\n #ifdef HILO_HAS_CLEARCOAT\n float clearcoatFactor = u_clearcoatFactor;\n #ifdef HILO_CLEARCOAT_MAP\n clearcoatFactor *= HILO_TEXTURE_2D(u_clearcoatMap).r;\n #endif\n float clearcoatRoughnessFactor = u_clearcoatRoughnessFactor;\n #ifdef HILO_CLEARCOAT_ROUGHNESS_MAP\n clearcoatRoughnessFactor *= HILO_TEXTURE_2D(u_clearcoatRoughnessMap).g;\n #endif\n\n float clearcoatAlphaRoughnessFactor = clearcoatRoughnessFactor * clearcoatRoughnessFactor;\n vec3 NC = clearcoatNormal;\n float NCdotV = clamp(abs(dot(NC, V)), 0.001, 1.0);\n float clearCoatFresnel = 0.04 + (1.0 - 0.04) * pow((1.0 - abs(NCdotV)),5.0);\n vec3 clearCoatLayer = vec3(0.0);\n #endif\n\n #ifdef HILO_DIRECTIONAL_LIGHTS\n for(int i = 0;i < HILO_DIRECTIONAL_LIGHTS;i++){\n vec3 lightDir = normalize(-u_directionalLightsInfo[i]);\n vec3 radiance = u_directionalLightsColor[i];\n float shadow = 1.0;\n #ifdef HILO_DIRECTIONAL_LIGHTS_SMC\n if (i < HILO_DIRECTIONAL_LIGHTS_SMC) {\n float bias = HILO_MAX(u_directionalLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_directionalLightsShadowBias[i][0]);\n shadow = getShadow(u_directionalLightsShadowMap[i], u_directionalLightsShadowMapSize[i], bias, v_fragPos, u_directionalLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_SPOT_LIGHTS\n for(int i = 0; i < HILO_SPOT_LIGHTS; i++){\n vec3 lightDir = normalize(-u_spotLightsDir[i]);\n vec3 distanceVec = u_spotLightsPos[i] - v_fragPos;\n\n float theta = dot(normalize(distanceVec), lightDir);\n float epsilon = u_spotLightsCutoffs[i][0] - u_spotLightsCutoffs[i][1];\n float intensity = clamp((theta - u_spotLightsCutoffs[i][1]) / epsilon, 0.0, 1.0);\n float attenuation = getLightAttenuation(distanceVec, u_spotLightsInfo[i], u_spotLightsRange[i]);\n vec3 radiance = intensity * attenuation * u_spotLightsColor[i];\n\n float shadow = 1.0;\n #ifdef HILO_SPOT_LIGHTS_SMC\n if (i < HILO_SPOT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_spotLightsShadowBias[i][1] * (1.0 - dot(N, lightDir)), u_spotLightsShadowBias[i][0]);\n shadow = getShadow(u_spotLightsShadowMap[i], u_spotLightsShadowMapSize[i], bias, v_fragPos, u_spotLightSpaceMatrix[i]);\n }\n #endif\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_POINT_LIGHTS\n for(int i = 0; i < HILO_POINT_LIGHTS; i++){\n vec3 distanceVec = u_pointLightsPos[i] - v_fragPos;\n vec3 lightDir = normalize(distanceVec);\n\n float shadow = 1.0;\n #ifdef HILO_POINT_LIGHTS_SMC\n if (i < HILO_POINT_LIGHTS_SMC) {\n float bias = HILO_MAX(u_pointLightsShadowBias[i][1] * (1.0 - dot(normal, lightDir)), u_pointLightsShadowBias[i][0]);\n shadow = getShadow(u_pointLightsShadowMap[i], bias, u_pointLightsPos[i], v_fragPos, u_pointLightCamera[i], u_pointLightSpaceMatrix[i]);\n }\n #endif\n\n float attenuation = getLightAttenuation(distanceVec, u_pointLightsInfo[i], u_pointLightsRange[i]);\n vec3 radiance = attenuation * u_pointLightsColor[i];\n\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += shadow * radiance * calculateClearcoatBRDF(NC, V, lightDir, clearcoatAlphaRoughnessFactor, NCdotV);\n #endif\n color.rgb += shadow * radiance * calculateLo(N, V, lightDir, specularEnvironmentR0, specularEnvironmentR90, alphaRoughness, diffuseColor, NdotV);\n }\n #endif\n\n #ifdef HILO_AREA_LIGHTS\n for(int i = 0; i < HILO_AREA_LIGHTS; i++){\n color.rgb += getAreaLight(diffuseColor, specularColor, roughness, N, V, v_fragPos, u_areaLightsPos[i], u_areaLightsColor[i], u_areaLightsWidth[i], u_areaLightsHeight[i], u_areaLightsLtcTexture1, u_areaLightsLtcTexture2);\n }\n #endif\n\n #ifdef HILO_LIGHT_MAP\n vec4 lightMapColor = HILO_TEXTURE_2D(u_lightMap);\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_lights_image_based#rgbd\n color.rgb += baseColor.rgb * decodeRGBD(lightMapColor);\n #endif\n\n // IBL\n #ifdef HILO_HAS_CLEARCOAT\n clearCoatLayer += getIBLClearCoatContribution(NC, V, diffuseColor, vec3(.04), ao, NCdotV, clearcoatRoughnessFactor)/clearCoatFresnel;\n #endif\n color.rgb += getIBLContribution(N, V, diffuseColor, specularColor, ao, NdotV, roughness);\n\n #if defined(HILO_AMBIENT_LIGHTS) && (defined(HILO_IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER) || (!defined(HILO_DIFFUSE_ENV_MAP) && !defined(HILO_DIFFUSE_ENV_SPHERE_HARMONICS3)))\n color.rgb += u_ambientLightsColor * baseColor.rgb * ao;\n #endif\n\n #ifdef HILO_EMISSION_MAP\n #ifdef HILO_GAMMA_CORRECTION\n emissionColor *= sRGBToLinear(HILO_TEXTURE_2D(u_emission)).rgb;\n #else\n emissionColor *= HILO_TEXTURE_2D(u_emission).rgb;\n #endif\n #endif\n\n color.rgb += emissionColor;\n\n #ifdef HILO_HAS_CLEARCOAT\n float t = clearcoatFactor * clearCoatFresnel;\n color.rgb = color.rgb * (1.0 - t) + clearCoatLayer * t;\n #endif\n#else\n color.rgb = baseColor.rgb;\n color.rgb += emissionColor;\n#endif"},function(t,e,n){var r=n(89),i=n(26),a=n(30),s=[0,0,0],o=[0,0,0],u=[0,0,0],c=[0,0,0],h=[0,0,0];t.exports=function(t,e,n,f){a(s,f[1],f[0]),a(o,f[2],f[0]),r(c,n,o);var l=i(s,c);if(l<1e-6)return null;a(u,e,f[0]);var d=i(u,c);if(d<0||d>l)return null;r(h,u,s);var m=i(n,h);if(m<0||d+m>l)return null;var _=i(o,h)/l;return t[0]=e[0]+_*n[0],t[1]=e[1]+_*n[1],t[2]=e[2]+_*n[2],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1],a=e[2],s=n[0],o=n[1],u=n[2];return t[0]=i*u-a*o,t[1]=a*s-r*u,t[2]=r*o-i*s,t}},function(t,e,n){var r=n(26),i=n(31),a=n(32),s=n(33);t.exports=function(t,e,n,u,c){var h=r(n,u);if(0!==h){var f=-(r(e,u)+c)/h;return f<0?null:(a(o,n,f),i(t,e,o))}return r(u,e)+c===0?s(t,e):null};var o=[0,0,0]},function(t,e,n){var r=n(92),i=n(26),a=n(30),s=n(93),o=n(32),u=n(31),c=[0,0,0];t.exports=function(t,e,n,h,f){a(c,h,e);var l=i(n,c);if(l<0)return null;s(c,e,n,l);var d=r(h,c),m=f*f;if(d>m)return null;return o(t,n,l-Math.sqrt(m-d)),u(t,t,e)}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}},function(t,e){function n(t,e,n){for(var r=t.length,i=-1/0,a=1/0,s=0;su){var c=o;o=u,u=c}if(ua)return 1/0;o>i&&(i=o),ua?1/0:i}t.exports=function(t,e,r,i){var a=n(e,r,i);if(a===1/0)t=null;else{t=t||[];for(var s=0;s0;){if(d(c)128){if(0==(u=(255&f[0])-128)||u>o-s)throw new Error("Bad scanline data");for(;u-- >0;)h[s++]=f[1]}else{if(0==(u=255&f[0])||u>o-s)throw new Error("Bad scanline data");if(h[s++]=f[1],--u>0){if(m(h,s,u) 0.0 ? v : (0.5 * inversesqrt(max(1.0 - (x * x), 1e-7))) - v;\n return cross(v1, v2) * theta_sintheta;\n}\n\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if (dot(lightNormal, P - rectCoords[0]) < 0.0)\n return vec3(0.0);\n vec3 T1, T2;\n T1 = normalize(V - (N * dot(V, N)));\n T2 = -cross(N, T1);\n mat3 mat = mInv * transpose(mat3(T1, T2, N));\n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n\nvec3 getAreaLight(const in vec3 diffuseColor, const in vec3 specularColor, const in float roughness, const in vec3 normal, const in vec3 viewDir, const in vec3 position, const in vec3 lightPos, const in vec3 lightColor, const in vec3 halfWidth, const in vec3 halfHeight, const in sampler2D areaLightsLtcTexture1, const in sampler2D areaLightsLtcTexture2){\n vec3 rectCoords[4];\n rectCoords[0] = (lightPos - halfWidth) - halfHeight;\n rectCoords[1] = (lightPos + halfWidth) - halfHeight;\n rectCoords[2] = (lightPos + halfWidth) + halfHeight;\n rectCoords[3] = (lightPos - halfWidth) + halfHeight;\n \n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(areaLightsLtcTexture1, uv);\n vec4 t2 = texture2D(areaLightsLtcTexture2, uv);\n\n mat3 mInv = mat3(vec3(t1.x, 0, t1.y), vec3(0, 1, 0), vec3(t1.z, 0, t1.w));\n vec3 fresnel = (specularColor * t2.x) + ((vec3(1.0) - specularColor) * t2.y);\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += ((lightColor * fresnel) * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords));\n color += ((lightColor * diffuseColor) * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords));\n return color;\n}\n\n"},function(t,e,n){"use strict";n.r(e),n.d(e,"util",(function(){return i})),n.d(e,"GLTFExtensions",(function(){return r})),n.d(e,"Class",(function(){return a.a})),n.d(e,"EventMixin",(function(){return s.a})),n.d(e,"Fog",(function(){return cr})),n.d(e,"Mesh",(function(){return mr})),n.d(e,"Node",(function(){return g})),n.d(e,"SkinedMesh",(function(){return vr})),n.d(e,"Skeleton",(function(){return Tr})),n.d(e,"Stage",(function(){return zr})),n.d(e,"Tween",(function(){return di})),n.d(e,"version",(function(){return Mr})),n.d(e,"BoxGeometry",(function(){return _i})),n.d(e,"Geometry",(function(){return Z})),n.d(e,"GeometryData",(function(){return b})),n.d(e,"MorphGeometry",(function(){return qn})),n.d(e,"PlaneGeometry",(function(){return Ti})),n.d(e,"SphereGeometry",(function(){return Ai})),n.d(e,"Camera",(function(){return O})),n.d(e,"PerspectiveCamera",(function(){return Q})),n.d(e,"OrthographicCamera",(function(){return hn})),n.d(e,"Buffer",(function(){return Nt})),n.d(e,"capabilities",(function(){return et})),n.d(e,"extensions",(function(){return tt})),n.d(e,"Framebuffer",(function(){return ce})),n.d(e,"glType",(function(){return Tt})),n.d(e,"logGLResource",(function(){return Ii})),n.d(e,"Program",(function(){return Lt})),n.d(e,"RenderInfo",(function(){return Ar})),n.d(e,"RenderList",(function(){return Sr})),n.d(e,"VertexArrayObject",(function(){return Ft})),n.d(e,"WebGLRenderer",(function(){return Xr})),n.d(e,"WebGLResourceManager",(function(){return yr})),n.d(e,"WebGLState",(function(){return Rr})),n.d(e,"BasicLoader",(function(){return Ni})),n.d(e,"CubeTextureLoader",(function(){return Pi})),n.d(e,"GLTFLoader",(function(){return _a})),n.d(e,"GLTFParser",(function(){return da})),n.d(e,"AliAMCExtension",(function(){return Jn})),n.d(e,"HDRLoader",(function(){return La})),n.d(e,"KTXLoader",(function(){return Sa})),n.d(e,"LoadCache",(function(){return Si})),n.d(e,"LoadQueue",(function(){return Ra})),n.d(e,"ShaderMaterialLoader",(function(){return Na})),n.d(e,"TextureLoader",(function(){return Ca})),n.d(e,"Loader",(function(){return Ci})),n.d(e,"Texture",(function(){return Qt})),n.d(e,"LazyTexture",(function(){return Ui})),n.d(e,"CubeTexture",(function(){return pe})),n.d(e,"DataTexture",(function(){return Le})),n.d(e,"Shader",(function(){return dt})),n.d(e,"BasicMaterial",(function(){return tn})),n.d(e,"GeometryMaterial",(function(){return un})),n.d(e,"Material",(function(){return Je})),n.d(e,"PBRMaterial",(function(){return Hi})),n.d(e,"semantic",(function(){return Ue})),n.d(e,"ShaderMaterial",(function(){return kn})),n.d(e,"AxisHelper",(function(){return Ha})),n.d(e,"AxisNetHelper",(function(){return Ua})),n.d(e,"CameraHelper",(function(){return Xa})),n.d(e,"AmbientLight",(function(){return ka})),n.d(e,"AreaLight",(function(){return Wa})),n.d(e,"DirectionalLight",(function(){return Un})),n.d(e,"CubeLightShadow",(function(){return bn})),n.d(e,"Light",(function(){return M})),n.d(e,"LightManager",(function(){return br})),n.d(e,"LightShadow",(function(){return gn})),n.d(e,"PointLight",(function(){return wn})),n.d(e,"SpotLight",(function(){return Xn})),n.d(e,"Animation",(function(){return ta})),n.d(e,"AnimationStates",(function(){return Ji})),n.d(e,"MeshPicker",(function(){return Ka})),n.d(e,"Ticker",(function(){return Qa})),n.d(e,"log",(function(){return m.a})),n.d(e,"Cache",(function(){return J})),n.d(e,"browser",(function(){return jr})),n.d(e,"WebGLSupport",(function(){return Ja})),n.d(e,"constants",(function(){return P.a})),n.d(e,"Color",(function(){return $a.Color})),n.d(e,"Euler",(function(){return $a.Euler})),n.d(e,"EulerNotifier",(function(){return $a.EulerNotifier})),n.d(e,"Frustum",(function(){return $a.Frustum})),n.d(e,"math",(function(){return $a.math})),n.d(e,"Matrix3",(function(){return $a.Matrix3})),n.d(e,"Matrix4",(function(){return $a.Matrix4})),n.d(e,"Matrix4Notifier",(function(){return $a.Matrix4Notifier})),n.d(e,"Plane",(function(){return $a.Plane})),n.d(e,"Quaternion",(function(){return $a.Quaternion})),n.d(e,"Ray",(function(){return $a.Ray})),n.d(e,"Sphere",(function(){return $a.Sphere})),n.d(e,"SphericalHarmonics3",(function(){return $a.SphericalHarmonics3})),n.d(e,"Vector2",(function(){return $a.Vector2})),n.d(e,"Vector3",(function(){return $a.Vector3})),n.d(e,"Vector3Notifier",(function(){return $a.Vector3Notifier})),n.d(e,"Vector4",(function(){return $a.Vector4}));var r={};n.r(r),n.d(r,"ALI_amc_mesh_compression",(function(){return Jn})),n.d(r,"WEB3D_quantized_attributes",(function(){return tr})),n.d(r,"HILO_animation_clips",(function(){return er})),n.d(r,"ALI_animation_clips",(function(){return nr})),n.d(r,"ALI_bounding_box",(function(){return rr})),n.d(r,"KHR_materials_pbrSpecularGlossiness",(function(){return ir})),n.d(r,"KHR_materials_clearcoat",(function(){return ar})),n.d(r,"KHR_lights_punctual",(function(){return sr})),n.d(r,"KHR_techniques_webgl",(function(){return or}));var i=n(4),a=n(1),s=n(9),o=n(7),u=n(21),c=n(5),h=n(17),f=n(22),l=n(10),d=n(6),m=n(3),_=new c.a(0,1,0),p=new o.a,g=a.a.create({Statics:{TRAVERSE_STOP_NONE:!1,TRAVERSE_STOP_CHILDREN:1,TRAVERSE_STOP_ALL:!0},Mixes:s.a,isNode:!0,className:"Node",name:"",anim:null,animationId:"",jointName:"",autoUpdateWorldMatrix:!0,autoUpdateChildWorldMatrix:!0,parent:null,_quatDirty:!1,_matrixDirty:!1,needCallChildUpdate:!0,visible:!0,pointerEnabled:!0,pointerChildren:!0,useHandCursor:!1,userData:null,onUpdate:null,__forceUseParentWorldMatrix:!1,constructor:function(t){var e=this;this.id=d.a.generateUUID(this.className),this.up=_.clone(),this.children=[],this.worldMatrix=new o.a,this._matrix=new u.a,this._position=new h.a(0,0,0),this._scale=new h.a(1,1,1),this._pivot=new h.a(0,0,0),this._rotation=new f.a,this._quaternion=new l.a,this._matrix.on("update",(function(){e._onMatrixUpdate()})),this._position.on("update",(function(){e._onPositionUpdate()})),this._scale.on("update",(function(){e._onScaleUpdate()})),this._pivot.on("update",(function(){e._onPivotUpdate()})),this._rotation.on("update",(function(){e._onRotationUpdate()})),this._quaternion.on("update",(function(){e._onQuaternionUpdate()})),Object.assign(this,t)},clone:function(t){var e=new this.constructor;return e.name=this.name,e.jointName=this.jointName,e.animationId=this.animationId,e.setPosition(this.x,this.y,this.z),e.setScale(this.scaleX,this.scaleY,this.scaleZ),e.setRotation(this.rotationX,this.rotationY,this.rotationZ),this.children.forEach((function(t){e.addChild(t.clone(!0))})),t||(this.anim&&(e.anim=this.anim.clone(e)),e.resetSkinedMeshRootNode()),e},setAnim:function(t){return this.anim=t,t.rootNode=this,this},resetSkinedMeshRootNode:function(){var t=this;this.traverse((function(e){e.isSkinedMesh&&e.skeleton&&(e.skeleton.rootNode=t)}),!0)},getChildrenNameMap:function(){var t={};return this.traverse((function(e){t[e.name]=e;var n=e._originName;void 0===n||t[n]||(t[n]=e)}),!0),t},addChild:function(t){return t.parent&&t.removeFromParent(),t.parent=this,this.children.push(t),this},removeChild:function(t){var e=this.children.indexOf(t);return e>-1&&(this.children.splice(e,1),t.parent=null),this},addTo:function(t){return t.addChild(this),this},removeFromParent:function(){return this.parent&&this.parent.removeChild(this),this},updateMatrix:function(){return this._matrixDirty&&(this._matrixDirty=!1,this.matrixVersion++,this._matrix.fromRotationTranslationScaleOrigin(this.quaternion,this._position,this._scale,this._pivot,!0)),this},updateQuaternion:function(){return this._quatDirty&&(this._quatDirty=!1,this._quaternion.fromEuler(this._rotation,!0)),this},updateTransform:function(){return this._matrix.decompose(this._quaternion,this._position,this._scale,this._pivot),this._onQuaternionUpdate(),this._matrixDirty=!1,this},updateMatrixWorld:function(t){return this.traverse((function(e){return(e.autoUpdateWorldMatrix||t)&&(e.parent?e.__forceUseParentWorldMatrix?e.worldMatrix.copy(e.parent.worldMatrix):e.worldMatrix.multiply(e.parent.worldMatrix,e.matrix):e.worldMatrix.copy(e.matrix)),!e.autoUpdateChildWorldMatrix&&!t&&1})),this},getConcatenatedMatrix:function(t){for(var e=new o.a,n=this;n&&n!==t;n=n.parent)e.multiply(n.matrix,e);return e},_traverse:function(t,e){if(!e){var n=t(this);if(n)return n}for(var r=this.children,i=0,a=r.length;i1&&void 0!==arguments[1]&&arguments[1];return this._traverse(t,e),this},traverseBFS:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(n=r?this.children:[this];n.length;){e=n,n=[];for(var i=0,a=e.length;i1&&void 0!==arguments[1]?arguments[1]:t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return this._scale.set(t,e,n),this},setPosition:function(t,e,n){return this._position.set(t,e,n),this},setRotation:function(t,e,n){return this._rotation.setDegree(t,e,n),this},setPivot:function(t,e,n){return this._pivot.set(t,e,n),this},lookAt:function(t){return this.isCamera?p.targetTo(this,t,this.up):p.targetTo(t,this,this.up),this._quaternion.fromMat4(p),this},raycast:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.visible)return null;var i=[];return this.traverse((function(n){if(r&&!n.pointerEnabled)return 1;if(n.isMesh){var a=n.raycast(t,!1);a&&(i=i.concat(a.map((function(t){return{mesh:n,point:t}}))))}return!(!r||e.pointerChildren)&&1})),i.length?(n&&t.sortPoints(i,"point"),i):null},matrix:{get:function(){return this.updateMatrix(),this._matrix},set:function(t){m.a.warnOnce("Node.matrix.set","node.matrix is readOnly.Use node.matrix.copy instead."),this._matrix.copy(t)}},position:{get:function(){return this._position},set:function(t){m.a.warnOnce("Node.position.set","node.position is readOnly.Use node.position.copy instead."),this._position.copy(t)}},x:{get:function(){return this._position.elements[0]},set:function(t){this._position.elements[0]=t,this._matrixDirty=!0}},y:{get:function(){return this._position.elements[1]},set:function(t){this._position.elements[1]=t,this._matrixDirty=!0}},z:{get:function(){return this._position.elements[2]},set:function(t){this._position.elements[2]=t,this._matrixDirty=!0}},scale:{get:function(){return this._scale},set:function(t){m.a.warnOnce("Node.scale.set","node.scale is readOnly.Use node.scale.copy instead."),this._scale.copy(t)}},scaleX:{get:function(){return this._scale.elements[0]},set:function(t){this._scale.elements[0]=t,this._matrixDirty=!0}},scaleY:{get:function(){return this._scale.elements[1]},set:function(t){this._scale.elements[1]=t,this._matrixDirty=!0}},scaleZ:{get:function(){return this._scale.elements[2]},set:function(t){this._scale.elements[2]=t,this._matrixDirty=!0}},pivot:{get:function(){return this._pivot},set:function(t){m.a.warnOnce("Node.pivot.set","node.pivot is readOnly.Use node.pivot.copy instead."),this._pivot.copy(t)}},pivotX:{get:function(){return this._pivot.elements[0]},set:function(t){this._pivot.elements[0]=t,this._matrixDirty=!0}},pivotY:{get:function(){return this._pivot.elements[1]},set:function(t){this._pivot.elements[1]=t,this._matrixDirty=!0}},pivotZ:{get:function(){return this._pivot.elements[2]},set:function(t){this._pivot.elements[2]=t,this._matrixDirty=!0}},rotation:{get:function(){return this._rotation},set:function(t){m.a.warnOnce("Node.rotation.set","node.rotation is readOnly.Use node.rotation.copy instead."),this._rotation.copy(t)}},rotationX:{get:function(){return this._rotation.degX},set:function(t){this._rotation.degX=t}},rotationY:{get:function(){return this._rotation.degY},set:function(t){this._rotation.degY=t}},rotationZ:{get:function(){return this._rotation.degZ},set:function(t){this._rotation.degZ=t}},quaternion:{get:function(){return this.updateQuaternion(),this._quaternion},set:function(t){m.a.warnOnce("Node.quaternion.set","node.quaternion is readOnly.Use node.quaternion.copy instead."),this._quaternion.copy(t)}},matrixVersion:0,getBounds:function(t,e,n){return e?e.multiply(this.matrix):e=this.getConcatenatedMatrix(t),this.children.forEach((function(t){n=t.getBounds(null,e.clone(),n)})),this.isMesh&&(n=this.geometry.getBounds(e,n)),n},_fireMouseEvent:function(t){if(t.eventCurrentTarget=this,this.fire(t),"mousemove"===t.type){if(!this.__mouseOver){this.__mouseOver=!0;var e=Object.assign({},t);e.type="mouseover",this.fire(e)}}else"mouseout"===t.type&&(this.__mouseOver=!1);var n=this.parent;t._stopped||t._stopPropagationed||!n||n._fireMouseEvent(t)},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getChildrenByBaseClassName("Node");return this.off(),n.forEach((function(n){n.isMesh?n.destroy(t,e):(n.off(),n.removeFromParent())})),this.removeFromParent(),this},_onMatrixUpdate:function(){this.matrixVersion++,this.updateTransform()},_onPositionUpdate:function(){this._matrixDirty=!0},_onScaleUpdate:function(){this._matrixDirty=!0},_onPivotUpdate:function(){this._matrixDirty=!0},_onRotationUpdate:function(){this._quatDirty=!0,this._matrixDirty=!0},_onQuaternionUpdate:function(){this._rotation.fromQuat(this._quaternion),this._quatDirty=!1}}),v=n(8),E=new v.a,T=a.a.create({Extends:g,isLight:!0,className:"Light",amount:1,enabled:!0,constantAttenuation:1,linearAttenuation:0,quadraticAttenuation:0,_range:0,range:{get:function(){return this._range},set:function(t){this.constantAttenuation=1,t<=0?(this.linearAttenuation=0,this.quadraticAttenuation=0):(this.linearAttenuation=4.5/t,this.quadraticAttenuation=75/(t*t)),this._range=t}},shadow:null,isDirty:!1,constructor:function(t){this.color=new v.a(1,1,1),T.superclass.constructor.call(this,t)},toInfoArray:function(t,e){return t[e+0]=this.constantAttenuation,t[e+1]=this.linearAttenuation,t[e+2]=this.quadraticAttenuation,this},getRealColor:function(){return E.copy(this.color).scale(this.amount)},createShadowMap:function(t,e){}}),M=T,A=n(23),L=new o.a,I=a.a.create({Extends:g,isCamera:!0,className:"Camera",_needUpdateProjectionMatrix:!0,_isGeometryDirty:!1,constructor:function(t){this.viewMatrix=new o.a,this.projectionMatrix=new o.a,this.viewProjectionMatrix=new o.a,this._frustum=new A.a,I.superclass.constructor.call(this,t)},updateViewMatrix:function(){return this.updateMatrixWorld(!0),this.viewMatrix.invert(this.worldMatrix),this},updateProjectionMatrix:function(){},getGeometry:function(t){},updateViewProjectionMatrix:function(){return this._needUpdateProjectionMatrix&&(this.updateProjectionMatrix(),this._needUpdateProjectionMatrix=!1),this.updateViewMatrix(),this.viewProjectionMatrix.multiply(this.projectionMatrix,this.viewMatrix),this.updateFrustum(this.viewProjectionMatrix),this},getModelViewMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewMatrix,t.worldMatrix),e},getModelProjectionMatrix:function(t,e){return(e=e||new o.a).multiply(this.viewProjectionMatrix,t.worldMatrix),e},projectVector:function(t,e,n){var r=t.clone();return r.transformMat4(this.viewProjectionMatrix),e&&n&&(r.x=(r.x+1)/2*e,r.y=n-(r.y+1)/2*n),r},unprojectVector:function(t,e,n){var r=t.clone();return e&&n&&(r.x=r.x/e*2-1,r.y=1-r.y/n*2),L.invert(this.viewProjectionMatrix),r.transformMat4(L),r},isPointVisible:function(t){return!!this._frustum.intersectsSphere({center:t,radius:0})},isMeshVisible:function(t){var e=t.geometry;if(e){var n=e.getSphereBounds(t.worldMatrix);if(this._frustum.intersectsSphere(n))return!0}return!1},updateFrustum:function(t){return this._frustum.fromMatrix(t),this}}),O=I,S=n(14),R=n(12),y=n(11),N=n(20),x={2:new S.a,3:new c.a,4:new R.a,16:new o.a},C=a.a.create({className:"GeometryData",isGeometryData:!0,size:void 0,normalized:!1,type:void 0,_isSubDirty:!1,_isAllDirty:!1,isDirty:{get:function(){return this._isSubDirty||this._isAllDirty},set:function(t){this._isAllDirty=t,!1===t&&this.clearSubData()}},bufferViewId:void 0,glBuffer:null,constructor:function(t,e,n){this.id=d.a.generateUUID(this.className),this.data=t,this.size=e,Object.assign(this,n),this.bufferViewId||(this.bufferViewId=this.id),this.size||m.a.warn("GeometryData.constructor: geometryData must set size!",this)},_stride:0,stride:{get:function(){return this._stride},set:function(t){this._stride=t,this.strideSize=0===t?0:t/this.data.BYTES_PER_ELEMENT}},strideSize:0,_offset:0,offset:{get:function(){return this._offset},set:function(t){this._offset=t,this.offsetSize=t/this.data.BYTES_PER_ELEMENT}},offsetSize:0,data:{set:function(t){t&&(this._data=t,this.type=Object(i.getTypedArrayGLType)(t),this.stride=this._stride,this.offset=this._offset,this._isAllDirty=!0)},get:function(){return this._data}},length:{get:function(){return this._data.length}},realLength:{get:function(){return 0===this.strideSize?this._data.length:this._data.length/this.strideSize*this.size}},getByteLength:function(){return this._data.BYTES_PER_ELEMENT*this.realLength},count:{get:function(){return 0===this.strideSize?this._data.length/this.size:this._data.length/this.strideSize}},setSubData:function(t,e){this._isSubDirty=!0,this.data.set(e,t),this.subDataList||(this.subDataList=[]);var n=e.BYTES_PER_ELEMENT*t;this.subDataList.push({byteOffset:n,data:e})},clearSubData:function(){this.subDataList&&(this.subDataList.length=0),this._isSubDirty=!1},clone:function(){var t=new C(null,1);return t.copy(this),t},copy:function(t){var e=t.data;this.data=new e.constructor(e),this.size=t.size,this.stride=t.stride,this.normalized=t.normalized,this.type=t.type,this.offset=t.offset},getOffset:function(t){var e=this.strideSize;return 0===e?t*this.size:t*e+this.offsetSize},get:function(t){var e=this.getOffset(t);return this.getByOffset(e)},getCopy:function(t){return this.get(t).clone()},set:function(t,e){var n=this.getOffset(t);return this.setByOffset(n,e),n},getByOffset:function(t){var e=this.size;return e>1?x[e].fromArray(this._data,t):this._data[t]},setByOffset:function(t,e){var n=this.size,r=this._data;n>1?e.toArray(r,t):r[t]=e,this._isAllDirty=!0},traverse:function(t){for(var e=this.count,n=0;n0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromTranslation(G.set(t,e,n))),this},scale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.transformMat4(Y.fromScaling(G.set(t,e,n))),this},rotate:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.transformMat4(Y.fromQuat(q.fromEuler({x:t*d.a.DEG2RAD,y:e*d.a.DEG2RAD,z:n*d.a.DEG2RAD}))),this},transformMat4:function(t){var e=this.vertices;if(e&&e.traverse((function(n,r,i){e.setByOffset(i,n.transformMat4(t))})),W.normalFromMat4(t),this._normals){var n=this.normals;n.traverse((function(t,e,r){n.setByOffset(r,t.transformMat3(W).normalize())}))}if(this._tangents){var r=this.tangents;r.traverse((function(t,e,n){r.setByOffset(n,t.transformMat3(W).normalize())}))}return this.isDirty=!0,this},merge:function(t,e){var n=t.vertices;if(n&&this.vertices){var r=this.vertices.count;e&&(n=t.vertices.clone()).traverse((function(t,r,i){n.setByOffset(i,t.transformMat4(e))})),this.vertices.merge(n),this.indices&&t.indices?this.indices.merge(t.indices,(function(t){return t+r})):this.indices=null}return this.uvs&&t.uvs?this.uvs.merge(t.uvs):this.uvs=null,this.uvs1&&t.uvs1?this.uvs1.merge(t.uvs1):this.uvs1=null,this.colors&&t.colors?this.colors.merge(t.colors):this.colors=null,this._normals&&(this._normals=null),this._tangents&&(this._tangents=null),this._tangents1&&(this._tangents1=null),this.isDirty=!0,this},ensureData:function(t,e,n,r){var i=this[t];if(!i||n>i.length){var a=new r(n);i?(a.set(i.data),i.data=a):this[t]=new b(a,e)}},addPoints:function(){var t=this,e=[].slice.call(arguments),n=3*(this.currentVerticesCount+e.length);this.ensureData("vertices",3,n,Float32Array);var r=this.vertices.data;return e.forEach((function(e){var n=3*t.currentVerticesCount++;r[n]=e[0],r[n+1]=e[1],r[n+2]=e[2]})),this.currentVerticesCount-e.length},addIndices:function(){var t=this,e=[].slice.call(arguments),n=this.currentIndicesCount+e.length;this.ensureData("indices",1,n,Uint16Array);var r=this.indices.data;e.forEach((function(e){r[t.currentIndicesCount++]=e})),this._needUpdateNormals=!0},addLine:function(t,e){var n=this.addPoints(t,e);this.addIndices(n,n+1)},addFace:function(t,e,n){var r=this.addPoints(t,e,n);this.addIndices(r,r+1,r+2)},addRect:function(t,e,n,r){var i=this.addPoints(t,e,n,r);this.addIndices(i,i+1,i+2,i,i+2,i+3)},setVertexUV:function(t,e){this.ensureData("uvs",2,this.vertices.length/3*2,Float32Array);for(var n=this.uvs.data,r=0;r0&&void 0!==arguments[0]&&arguments[0];return this._localBounds&&!t||(this._localBounds=this.getBounds()),this._localBounds},getSphereBounds:function(t){this._sphereBounds||(this._sphereBounds=new N.a);var e=this._sphereBounds;return e.copy(this.getLocalSphereBounds()),t&&e.transformMat4(t),e},getLocalSphereBounds:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._localSphereBounds||t){var e=this.getLocalBounds(t),n=new N.a({center:new c.a(e.x,e.y,e.z)}),r=this.vertices;r?n.fromGeometryData(r):(m.a.warnOnce("geometry.getLocalSphereBounds","geometry has no vertices data, geometry.getLocalSphereBounds will return Infinity bounds."),n.radius=1/0),this._localSphereBounds=n}return this._localSphereBounds},convertToNoIndices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;if(this.mode===w)if(this.indices){for(var e=this.indices.data,n=e.length,r=new Float32Array(n*t),a=this.uvs?new Float32Array(2*n):null,s=new Float32Array(3*n),o=this.colors?new Float32Array(this.colors.size*n):null,u=this.skinIndices?new Float32Array(4*n):null,c=this.skinWeights?new Float32Array(4*n):null,h=0;h2&&void 0!==arguments[2])||arguments[2];return(n=this.useAABBRaycast?this._aabbRaycast(t):this._raycast(t,e))&&r&&t.sortPoints(n),n},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.positionDecodeMat&&(t.QUANTIZED=1,t.POSITION_QUANTIZED=1),this.normalDecodeMat&&(t.QUANTIZED=1,t.NORMAL_QUANTIZED=1),this.uvDecodeMat&&(t.QUANTIZED=1,t.UV_QUANTIZED=1),this.uv1DecodeMat&&(t.QUANTIZED=1,t.UV1_QUANTIZED=1),this.colors&&(t.HAS_COLOR=1,t.COLOR_SIZE=this.colors.size),t},getShaderKey:function(){return void 0===this._shaderKey&&(this._shaderKey="geometry",this.isMorphGeometry?this._shaderKey+="_id_".concat(this.id):(this.colors&&(this._shaderKey+="_colors"),this.positionDecodeMat&&(this._shaderKey+="positionDecodeMat"))),this._shaderKey},getSize:function(){var t=0;for(var e in this)Object(i.hasOwnProperty)(this,e)&&this[e]&&this[e].isGeometryData&&(t+=this[e].getByteLength());return t},destroy:function(){m.a.warn("Geometry.destroy has been deprecated, use mesh.destroy(renderer) instead.")}}),K=a.a.create({Extends:O,isPerspectiveCamera:!0,className:"PerspectiveCamera",_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:null,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},_fov:50,fov:{get:function(){return this._fov},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._fov=t}},_aspect:1,aspect:{get:function(){return this._aspect},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._aspect=t}},constructor:function(t){K.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.projectionMatrix.elements,e=this.near,n=this.far,r=this.aspect,i=this.fov,a=1/Math.tan(.5*d.a.degToRad(i));if(t[0]=a/r,t[5]=a,t[11]=-1,t[15]=0,n){var s=1/(e-n);t[10]=(e+n)*s,t[14]=2*n*e*s}else t[10]=-1,t[14]=-2*e},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=Math.tan(this.fov/2*Math.PI/180),r=this.near,i=this.far,a=r*n,s=i*n,o=this.aspect*a,u=this.aspect*s,c=[-o,-a,-r],h=[o,-a,-r],f=[o,a,-r],l=[-o,a,-r],d=[-u,-s,-i],m=[u,-s,-i],_=[u,s,-i],p=[-u,s,-i];e.addRect(d,m,_,p),e.addRect(m,h,f,_),e.addRect(h,c,l,f),e.addRect(c,d,p,l),e.addRect(p,_,f,l),e.addRect(c,h,m,d),this._geometry=e}return this._geometry}}),Q=K,J=a.a.create({constructor:function(){this._cache={}},get:function(t){return this._cache[t]},getObject:function(t){return this._cache[t.__cacheId]},add:function(t,e){"object"==typeof e&&(e.__cacheId=t),this._cache[t]=e},remove:function(t){delete this._cache[t]},removeObject:function(t){delete this._cache[t.__cacheId]},removeAll:function(){this._cache={}},each:function(t){var e=this._cache;for(var n in e)t(e[n],n)}}),$={instanced:void 0,vao:void 0,texFloat:void 0,loseContext:void 0,textureFilterAnisotropic:void 0,_usedExtensions:{},_disabledExtensions:{},init:function(t){this.reset(t)},reset:function(t){this.gl=t;var e=this._usedExtensions;for(var n in e){var r=e[n];this[r]=void 0,this.get(n,r)}},use:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;this.gl?this.get(t,e):this._usedExtensions[t]=e},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this._disabledExtensions[t])return null;var n=this[e];return void 0===n&&(n=this._getExtension(t),this[e]=n),n},disable:function(t){this._disabledExtensions[t]=!0},enable:function(t){this._disabledExtensions[t]=!1},_getExtension:function(t){var e=this.gl;return e&&e.getExtension&&(e.getExtension(t)||e.getExtension("WEBKIT_"+t)||e.getExtension("MOZ_"+t))||null}};$.use("ANGLE_instanced_arrays","instanced"),$.use("OES_vertex_array_object","vao"),$.use("OES_texture_float","texFloat"),$.use("WEBGL_lose_context","loseContext"),$.use("OES_element_index_uint","uintIndices"),$.use("EXT_shader_texture_lod","shaderTextureLod"),$.use("EXT_texture_filter_anisotropic","textureFilterAnisotropic");var tt=$,et={MAX_TEXTURE_INDEX:null,MAX_PRECISION:null,MAX_VERTEX_PRECISION:null,MAX_FRAGMENT_PRECISION:null,VERTEX_TEXTURE_FLOAT:null,FRAGMENT_TEXTURE_FLOAT:null,MAX_TEXTURE_MAX_ANISOTROPY:1,MAX_RENDERBUFFER_SIZE:void 0,MAX_COMBINED_TEXTURE_IMAGE_UNITS:void 0,MAX_CUBE_MAP_TEXTURE_SIZE:void 0,MAX_FRAGMENT_UNIFORM_VECTORS:void 0,MAX_TEXTURE_IMAGE_UNITS:void 0,MAX_TEXTURE_SIZE:void 0,MAX_VARYING_VECTORS:void 0,MAX_VERTEX_ATTRIBS:void 0,MAX_VERTEX_TEXTURE_IMAGE_UNITS:void 0,MAX_VERTEX_UNIFORM_VECTORS:void 0,init:function(t){var e=this;this.gl=t;["MAX_RENDERBUFFER_SIZE","MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_CUBE_MAP_TEXTURE_SIZE","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_TEXTURE_SIZE","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"].forEach((function(t){e.get(t)})),this.MAX_TEXTURE_INDEX=this.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,this.MAX_VERTEX_PRECISION=this._getMaxSupportPrecision(t.VERTEX_SHADER),this.MAX_FRAGMENT_PRECISION=this._getMaxSupportPrecision(t.FRAGMENT_SHADER),this.MAX_PRECISION=this.getMaxPrecision(this.MAX_FRAGMENT_PRECISION,this.MAX_VERTEX_PRECISION),this.VERTEX_TEXTURE_FLOAT=!!tt.texFloat&&this.MAX_VERTEX_TEXTURE_IMAGE_UNITS>0,this.FRAGMENT_TEXTURE_FLOAT=!!tt.texFloat,this.EXT_FRAG_DEPTH=tt.get("EXT_frag_depth"),this.SHADER_TEXTURE_LOD=!!tt.shaderTextureLod,tt.textureFilterAnisotropic&&(this.MAX_TEXTURE_MAX_ANISOTROPY=t.getParameter(tt.textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))},get:function(t){var e=this.gl,n=this[t];return void 0===n&&(n=this[t]=e.getParameter(e[t])),n},_getMaxSupportPrecision:function(t){var e=this.gl,n="lowp";if(e.getShaderPrecisionFormat)for(var r=[{name:"highp",type:e.HIGH_FLOAT},{name:"mediump",type:e.MEDIUM_FLOAT}],i=0;i0){n=a.name;break}}else n="mediump";return n},getMaxPrecision:function(t,e){return"highp"===t||"mediump"===t&&"lowp"===e?e:t}},nt=n(50),rt=n.n(nt),it=n(51),at=n.n(it),st=n(52),ot=n.n(st),ut=n(53),ct=n.n(ut),ht=new J,ft=new J,lt=a.a.create({isShader:!0,className:"Shader",vs:"",fs:"",Statics:{commonOptions:{},shaders:{"chunk/baseDefine.glsl":n(18),"chunk/color.frag":n(36),"chunk/color.vert":n(74),"chunk/color_main.vert":n(76),"chunk/diffuse.frag":n(56),"chunk/diffuse_main.frag":n(65),"chunk/extensions.frag":n(24),"chunk/extensions.vert":n(48),"chunk/fog.frag":n(43),"chunk/fog_main.frag":n(67),"chunk/frag_color.frag":n(47),"chunk/joint.vert":n(69),"chunk/joint_main.vert":n(79),"chunk/light.frag":n(40),"chunk/lightFog.frag":n(39),"chunk/lightFog.vert":n(72),"chunk/lightFog_main.frag":n(45),"chunk/lightFog_main.vert":n(82),"chunk/logDepth.frag":n(28),"chunk/logDepth_main.frag":n(29),"chunk/logDepth.vert":n(75),"chunk/logDepth_main.vert":n(83),"chunk/morph.vert":n(73),"chunk/morph_main.vert":n(78),"chunk/normal.frag":n(38),"chunk/normal.vert":n(71),"chunk/normal_main.frag":n(44),"chunk/normal_main.vert":n(81),"chunk/pbr.frag":n(85),"chunk/pbr_main.frag":n(87),"chunk/phong.frag":n(63),"chunk/phong_main.frag":n(66),"chunk/precision.frag":n(25),"chunk/precision.vert":n(49),"chunk/transparency.frag":n(42),"chunk/transparency_main.frag":n(46),"chunk/unQuantize.vert":n(68),"chunk/unQuantize_main.vert":n(77),"chunk/uv.frag":n(37),"chunk/uv.vert":n(70),"chunk/uv_main.vert":n(80),"method/encoding.glsl":n(86),"method/getDiffuse.glsl":n(58),"method/getLightAttenuation.glsl":n(60),"method/getShadow.glsl":n(62),"method/getSpecular.glsl":n(59),"method/packFloat.glsl":n(84),"method/textureEnvMap.glsl":n(41),"method/transpose.glsl":n(57),"method/unpackFloat.glsl":n(61),"basic.frag":n(50),"basic.vert":n(51),"geometry.frag":n(52),"pbr.frag":n(53),"screen.frag":n(54),"screen.vert":n(55)},init:function(t){this.renderer=t,this.commonHeader=this._getCommonHeader(this.renderer)},cache:{get:function(){return ht}},headerCache:{get:function(){return ft}},reset:function(t){ht.removeAll()},getHeaderKey:function(t,e,n,r,i){var a="header_"+e.id+"_"+n.lightInfo.uid;return t.isSkinedMesh&&(a+="_joint"+t.skeleton.jointCount),r&&(a+="_fog_"+r.mode),a+="_"+t.geometry.getShaderKey(),i&&(a+="_fogDepth"),a},getHeader:function(t,e,n,r,i){var a=this.getHeaderKey(t,e,n,r),s=ft.get(a);if(!s||e.isDirty){var o={};Object.assign(o,this.commonOptions);var u=e.lightType;u&&"NONE"!==u&&n.getRenderOption(o),e.getRenderOption(o),t.getRenderOption(o),r&&(o.HAS_FOG=1,r.getRenderOption(o)),i&&(o.USE_LOG_DEPTH=1,et.EXT_FRAG_DEPTH&&(o.USE_EXT_FRAG_DEPTH=1)),o.HAS_NORMAL&&o.NORMAL_MAP&&(o.HAS_TANGENT=1),o.RECEIVE_SHADOWS||(delete o.DIRECTIONAL_LIGHTS_SMC,delete o.SPOT_LIGHTS_SMC,delete o.POINT_LIGHTS_SMC),s="#define SHADER_NAME ".concat(e.className,"\n"),s+=Object.keys(o).map((function(t){return t.indexOf("HILO_CUSTUM_OPTION_")>-1?"#define ".concat(t.replace("HILO_CUSTUM_OPTION_","")," ").concat(o[t]):"#define HILO_".concat(t," ").concat(o[t])})).join("\n")+"\n",ft.add(a,s)}return s},_getCommonHeader:function(t){var e=et.getMaxPrecision(et.MAX_VERTEX_PRECISION,t.vertexPrecision),n=et.getMaxPrecision(et.MAX_FRAGMENT_PRECISION,t.fragmentPrecision),r=et.getMaxPrecision(e,n);return"\n#define HILO_MAX_PRECISION ".concat(r,"\n#define HILO_MAX_VERTEX_PRECISION ").concat(e,"\n#define HILO_MAX_FRAGMENT_PRECISION ").concat(n,"\n")},getShader:function(t,e,n,r,i,a){var s=this.getHeader(t,e,r,i,a);return e.isBasicMaterial||e.isPBRMaterial?this.getBasicShader(e,n,s):e.isShaderMaterial?this.getCustomShader(e.vs,e.fs,s,e.shaderCacheId||e.id,e.useHeaderCache):null},getBasicShader:function(t,e,n){var r="";e&&(r=(r=t.getInstancedUniforms().map((function(t){return t.name}))).join("|"));var i=t.className+":"+r;t.onBeforeCompile&&(i+=":"+(t.shaderCacheId||t.id));var a=ht.get(i);if(!a){var s="",o=at.a;if(t.isBasicMaterial?t.isGeometryMaterial?s+=ot.a:s+=rt.a:t.isPBRMaterial&&(s+=ct.a),t.onBeforeCompile){var u=t.onBeforeCompile(o,s);s=u.fs,o=u.vs}if(r){var c=new RegExp("^\\s*uniform\\s+(\\w+)\\s+(".concat(r,");"),"gm");o=o.replace(c,"attribute $1 $2;")}a=this.getCustomShader(o,s,n,i,!0)}if(a){var h=this._getNumId(a);null!==h&&(t._shaderNumId=h)}return a},_getNumId:function(t){var e=t.id.match(/_(\d+)/);return e&&e[1]?parseInt(e[1],10):null},getCustomShader:function(t,e,n,r,i){var a,s=this.commonHeader;return r&&(i&&(r+=":"+n),a=ht.get(r)),a||(a=new lt({vs:s+n+t,fs:s+n+e}),r&&ht.add(r,a)),a}},alwaysUse:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){return this._isDestroyed||(ht.removeObject(this),this._isDestroyed=!0),this}}),dt=lt,mt=n(55),_t=n.n(mt),pt=n(54),gt=n.n(pt),vt=[{name:"FLOAT",byteSize:4,uniformFuncName:"uniform1f",type:"Scalar",size:1},{name:"FLOAT_VEC2",byteSize:8,uniformFuncName:"uniform2f",type:"Vector",size:2},{name:"FLOAT_VEC3",byteSize:12,uniformFuncName:"uniform3f",type:"Vector",size:3},{name:"FLOAT_VEC4",byteSize:16,uniformFuncName:"uniform4f",type:"Vector",size:4},{name:"FLOAT_MAT2",byteSize:16,uniformFuncName:"uniformMatrix2fv",type:"Matrix",size:4},{name:"FLOAT_MAT3",byteSize:36,uniformFuncName:"uniformMatrix3fv",type:"Matrix",size:9},{name:"FLOAT_MAT4",byteSize:64,uniformFuncName:"uniformMatrix4fv",type:"Matrix",size:16},{name:"INT",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"INT_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"INT_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"INT_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"BOOL",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"BOOL_VEC2",byteSize:8,uniformFuncName:"uniform2i",type:"Vector",size:2},{name:"BOOL_VEC3",byteSize:12,uniformFuncName:"uniform3i",type:"Vector",size:3},{name:"BOOL_VEC4",byteSize:16,uniformFuncName:"uniform4i",type:"Vector",size:4},{name:"SAMPLER_2D",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1},{name:"SAMPLER_CUBE",byteSize:4,uniformFuncName:"uniform1i",type:"Scalar",size:1}],Et={},Tt={dict:Et,init:function(t){vt.forEach((function(e){var n,r,i=e.name,a=e.uniformFuncName,s=a+"v";"Matrix"===e.type?n=r=function(e,n){void 0!==n&&t[a](e,!1,n)}:(n=function(e,n){void 0!==n&&t[a](e,n)},r=function(e,n){t[s](e,n)}),Et[t[i]]=Object.assign(e,{glValue:t[i],uniform:n,uniformArray:r})}))},get:function(t){return Et[t]}},Mt=new J,At=a.a.create({Statics:{cache:{get:function(){return Mt}},reset:function(t){Mt.each((function(t){t.destroy()}))},getProgram:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.id,i=Mt.get(r);return i||(i=new At({state:e,vertexShader:t.vs,fragShader:t.fs,ignoreError:n}),Mt.add(r,i)),i},getBlankProgram:function(t){var e=dt.getCustomShader("void main(){}","precision HILO_MAX_FRAGMENT_PRECISION float;void main(){gl_FragColor = vec4(0.0);}","","__hiloBlankShader");return this.getProgram(e,t,!0)}},className:"Program",isProgram:!0,fragShader:"",vertexShader:"",attributes:null,uniforms:null,program:null,gl:null,state:null,alwaysUse:!1,constructor:function(t){return this.id=d.a.generateUUID(this.className),Object.assign(this,t),this._dict={},this.attributes={},this.uniforms={},this.gl=this.state.gl,this.program=this.createProgram(),this.program?(this.initAttributes(),this.initUniforms(),this):this.ignoreError?this:At.getBlankProgram(t.state)},createProgram:function(){var t=this.gl,e=t.createProgram(),n=this.createShader(t.VERTEX_SHADER,this.vertexShader),r=this.createShader(t.FRAGMENT_SHADER,this.fragShader);if(n&&r){if(t.attachShader(e,n),t.attachShader(e,r),t.linkProgram(e),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(e,t.LINK_STATUS)){var i=t.getProgramInfoLog(e);return m.a.error("compileProgramError: "+i,this),t.deleteProgram(e),null}return e}return null},useProgram:function(){this.state.useProgram(this.program)},createShader:function(t,e){var n=this.gl,r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS)){var i=n.getShaderInfoLog(r);return m.a.error("compileShaderError: "+i,e.split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),null}return r},initAttributes:function(){for(var t=this,e=this.gl,n=this.program,r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),i=tt.instanced,a=function(r){var a=e.getActiveAttrib(n,r),s=a.name,o=a.type,u=a.size,c=e.getAttribLocation(n,s),h=Tt.get(o),f=function(t){var n=t.type,r=void 0===n?e.FLOAT:n,i=t.normalized,a=void 0!==i&&i,s=t.stride,o=void 0===s?0:s,u=t.offset,f=void 0===u?0:u,l=t.size,d=void 0===l?h.size:l;e.vertexAttribPointer(c,d,r,a,o,f)},l=function(){e.enableVertexAttribArray(c)},d=function(){},m=function(t,e){t[c]=e};if(i&&(d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;i.vertexAttribDivisorANGLE(c,t)}),"Matrix"===h.type){var _=h.byteSize,p=h.size,g=Math.sqrt(p),v=4*g,E=function(t){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;E((function(e){i.vertexAttribDivisorANGLE(e,t)}))})}t.attributes[s]={name:s,location:c,type:o,size:u,glTypeInfo:h,pointer:f,enable:l,divisor:d,addTo:m}},s=0;s1||o>1?function(t){f(c,t)}:function(e){t._dict[s]!==e&&(t._dict[s]=e,l(c,e))}})},s=0;s2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,It,e,n)},createBuffer:function(t,e,n,r){var i=n.bufferViewId,a=Rt.get(i);return a||(n.isDirty=!1,a=new yt(t,e,n.data,r),Rt.add(i,a),a)},createIndexBuffer:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St;return this.createBuffer(t,Ot,e,n)}},className:"Buffer",isBuffer:!0,constructor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:It,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:St;this.id=d.a.generateUUID(this.className),this.gl=t,this.target=e,this.usage=r,this.buffer=t.createBuffer(),n&&this.bufferData(n)},bind:function(){return this.gl.bindBuffer(this.target,this.buffer),this},bufferData:function(t){var e=this.gl,n=this.target,r=this.usage;return this.bind(),e.bufferData(n,t,r),this.data=t,this},bufferSubData:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.gl,i=this.target;return n||this.bind(),r.bufferSubData(i,t,e),this},uploadGeometryData:function(t){var e=this,n=t.subDataList;return!this.data||this.data.byteLength2&&void 0!==arguments[2]?arguments[2]:0,r=0,i=e.length;r0&&void 0!==arguments[0]?arguments[0]:1;this.bind();var e=this.gl,n=this.mode;this.useInstanced&&(this.indexBuffer?this.instancedExtension.drawElementsInstancedANGLE(n,this.vertexCount,e.UNSIGNED_SHORT,0,t):this.instancedExtension.drawArraysInstancedANGLE(n,0,this.getVertexCount(),t))},addIndexBuffer:function(t,e){this.bind();var n=this.gl,r=this.indexBuffer;return this.indexType=t.type,r?t.isDirty&&(r.uploadGeometryData(t),this.vertexCount=t.length):((r=Nt.createIndexBuffer(n,t,e)).bind(),this.indexBuffer=r,this.vertexCount=t.length),r},addAttribute:function(t,e,n,r){this.bind();var i=this.gl,a=e.name,s=this[a];if(!s){var o=Nt.createVertexBuffer(i,t,n);o.bind(),e.enable(),e.pointer(t),s={attribute:e,buffer:o,geometryData:t},this.attributes.push(s),this[a]=s,e.addTo(this.activeStates,s),r&&r(s)}if(t.isDirty){var u=s.buffer;u.bind(),e.enable(),e.pointer(t),u.uploadGeometryData(t)}return s},addInstancedAttribute:function(t,e,n){this.bind();var r=this.gl,i=t.name,a=t.glTypeInfo,s=Ct.getTypedArray(Float32Array,e.length*a.size);e.forEach((function(t,e){void 0!==n(t)?Ct.fillArrayData(s,n(t),e*a.size):m.a.warn("no attributeData:"+i+"-"+t.name)}));var o,u=this[i];return u?(o=u.geometryData).data=s:o=new b(s,1),this.addAttribute(o,t,r.DYNAMIC_DRAW,(function(e){t.divisor(1),e.useInstanced=!0}))},getResources:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.attributes&&this.attributes.forEach((function(e){t.push(e.buffer)})),this.indexBuffer&&t.push(this.indexBuffer),t},destroyIfNoRef:function(t){return t.resourceManager.destroyIfNoRef(this),this},destroy:function(){var t=this;return this._isDestroyed||(this.instancedExtension=null,this.useVao&&(this.vaoExtension.deleteVertexArrayOES(this.vao),this.vao=null,this.vaoExtension=null),this.gl=null,this.indexBuffer=null,this.attributes.forEach((function(e){var n=e.attribute||{};t[n.name]=null})),this.attributes=null,this.activeStates=null,Ht.removeObject(this),this._isDestroyed=!0),this}}),Ft=Dt,Ut=P.a.TEXTURE_2D,Gt=P.a.RGBA,Bt=P.a.LINEAR,Vt=P.a.NEAREST,Xt=P.a.REPEAT,jt=P.a.CLAMP_TO_EDGE,kt=P.a.UNSIGNED_BYTE,zt=P.a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Wt=P.a.UNPACK_FLIP_Y_WEBGL,Yt=P.a.UNPACK_COLORSPACE_CONVERSION_WEBGL,qt=P.a.BROWSER_DEFAULT_WEBGL,Zt=P.a.NONE,Kt=new J,Qt=a.a.create({Statics:{cache:{get:function(){return Kt}},reset:function(t){Kt.each((function(e,n){t.deleteTexture(e),Kt.remove(n)}))}},isTexture:!0,className:"Texture",isImageCanRelease:!1,_isImageReleased:!1,_image:null,image:{get:function(){return this._isImageReleased&&m.a.errorOnce("Read Texture.image(".concat(this.id,")"),"Read Texture.image after image released!"),this._image},set:function(t){this._image=t,this._isImageReleased=!1}},_releaseImage:function(){this._canvasImage=null,this._canvasCtx=null,this._originImage=null,this._image=null,this.mipmaps=null,this._isImageReleased=!0},mipmaps:null,target:Ut,internalFormat:Gt,format:Gt,type:kt,width:0,height:0,border:0,magFilter:Bt,minFilter:Bt,wrapS:Xt,wrapT:Xt,name:"",premultiplyAlpha:!1,flipY:!1,colorSpaceConversion:!0,compressed:!1,needUpdate:!0,needDestroy:!1,autoUpdate:!1,uv:0,anisotropic:1,origWidth:{get:function(){return this._originImage?this._originImage.width||this.width:this.image&&this.image.width||this.width}},origHeight:{get:function(){return this.originImage?this._originImage.height||this.height:this.image&&this.image.height||this.height}},useMipmap:{get:function(){return this.minFilter!==Bt&&this.minFilter!==Vt},set:function(){m.a.warn("texture.useMipmap is readOnly!")}},useRepeat:{get:function(){return this.wrapS!==jt||this.wrapT!==jt},set:function(){m.a.warn("texture.useRepeat is readOnly!")}},mipmapCount:{get:function(){return Math.floor(Math.log2(Math.max(this.width,this.height))+1)},set:function(){m.a.warn("texture.mipmapCount is readOnly!")}},constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},isImgPowerOfTwo:function(t){return d.a.isPowerOfTwo(t.width)&&d.a.isPowerOfTwo(t.height)},getSupportSize:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.width,r=t.height;e&&!this.isImgPowerOfTwo(t)&&(n=d.a.nextPowerOfTwo(n),r=d.a.nextPowerOfTwo(r));var i=et.MAX_TEXTURE_SIZE;return i&&(n>i&&(n=i),r>i&&(r=i)),{width:n,height:r}},resizeImgToPowerOfTwo:function(t){var e=this.getSupportSize(t,!0);return this.resizeImg(t,e.width,e.height)},resizeImg:function(t,e,n){if(t.width===e&&t.height===n)return t;var r=this._canvasImage;return r?(r.width=e,r.height=n,this._canvasCtx=r.getContext("2d")):((r=document.createElement("canvas")).width=e,r.height=n,this._canvasImage=r,this._canvasCtx=r.getContext("2d")),this._canvasCtx.drawImage(t,0,0,t.width,t.height,0,0,e,n),m.a.warnOnce("Texture.resizeImg(".concat(this.id,")"),"image size(".concat(t.width,"x").concat(t.height,") is not support. Resized to ").concat(r.width,"x").concat(r.height),t.src),this._originImage=t,r},_glUploadTexture:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.width,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:this.height,s=t.gl;return this.compressed?s.compressedTexImage2D(e,r,this.internalFormat,i,a,this.border,n):n&&void 0!==n.width?s.texImage2D(e,r,this.internalFormat,this.format,this.type,n):s.texImage2D(e,r,this.internalFormat,i,a,this.border,this.format,this.type,n),this},_uploadTexture:function(t){var e=this;return this.useMipmap&&this.mipmaps?this.mipmaps.forEach((function(n,r){e._glUploadTexture(t,e.target,n.data,r,n.width,n.height)})):this._glUploadTexture(t,this.target,this.image,0),this},_updatePixelStorei:function(){var t=this.state;t.pixelStorei(zt,this.premultiplyAlpha),t.pixelStorei(Wt,!!this.flipY),t.pixelStorei(Yt,this.colorSpaceConversion?qt:Zt)},updateTexture:function(t,e){var n=t.gl;if(this.needUpdate||this.autoUpdate){this._originImage&&this.image===this._canvasImage&&(this.image=this._originImage);var r=this.useMipmap,i=this.useRepeat;if(this.image&&!this.image.length){var a=i||r,s=this.getSupportSize(this.image,a);this.image=this.resizeImg(this.image,s.width,s.height),this.width=this.image.width,this.height=this.image.height}t.activeTexture(n.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._uploadTexture(t),r&&(this.compressed?this.mipmaps||(m.a.warn("Compressed texture has no mipmips, changed the minFilter from ".concat(this.minFilter," to Linear!"),this),this.minFilter=Bt):n.generateMipmap(this.target)),n.texParameterf(this.target,n.TEXTURE_MAG_FILTER,this.magFilter),n.texParameterf(this.target,n.TEXTURE_MIN_FILTER,this.minFilter),n.texParameterf(this.target,n.TEXTURE_WRAP_S,this.wrapS),n.texParameterf(this.target,n.TEXTURE_WRAP_T,this.wrapT);var o=tt.textureFilterAnisotropic;o&&this.anisotropic>1&&n.texParameterf(this.target,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropic,et.MAX_TEXTURE_MAX_ANISOTROPY)),this.needUpdate=!1}return this._needUpdateSubTexture&&(this._uploadSubTextures(t,e),this._needUpdateSubTexture=!1),this},_uploadSubTextures:function(t,e){var n=this;if(this._subTextureList&&this._subTextureList.length>0){var r=t.gl;t.activeTexture(r.TEXTURE0+et.MAX_TEXTURE_INDEX),t.bindTexture(this.target,e),this._updatePixelStorei(),this._subTextureList.forEach((function(t){var e=t[0],i=t[1],a=t[2];r.texSubImage2D(n.target,0,e,i,n.format,n.type,a)})),this._subTextureList.length=0}},_needUpdateSubTexture:!1,_subTextureList:null,updateSubTexture:function(t,e,n){this._subTextureList||(this._subTextureList=[]),this._subTextureList.push([t,e,n]),this._needUpdateSubTexture=!0},getGLTexture:function(t){this.state=t;var e=this.gl=t.gl,n=this.id;this.needDestroy&&(this.destroy(),this.needDestroy=!1);var r=Kt.get(n);return r||(r=e.createTexture(),Kt.add(n,r),this.needUpdate=!0),this.updateTexture(t,r),this.isImageCanRelease&&this._releaseImage(),r},setGLTexture:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&this.destroy(),Kt.add(this.id,t),this},destroy:function(){var t=this.id,e=Kt.get(t);return e&&this.gl&&(this.gl.deleteTexture(e),Kt.remove(t)),this},clone:function(){var t=Object.assign({},this);return delete t.id,new this.constructor(t)}}),Jt=P.a.TEXTURE_2D,$t=P.a.RGBA,te=P.a.UNSIGNED_BYTE,ee=P.a.COLOR_ATTACHMENT0,ne=P.a.DEPTH_STENCIL,re=P.a.DEPTH_TEST,ie=P.a.CULL_FACE,ae=P.a.TRIANGLE_STRIP,se=P.a.NEAREST,oe=P.a.CLAMP_TO_EDGE,ue=new J,ce=a.a.create({Statics:{cache:{get:function(){return ue}},reset:function(t){ue.each((function(t){t.reset()}))},destroy:function(t){ue.each((function(t){t.destroy()}))}},className:"Framebuffer",isFramebuffer:!0,bufferInternalFormat:ne,target:Jt,format:$t,internalFormat:$t,type:te,minFilter:se,magFilter:se,wrapS:oe,wrapT:oe,data:null,attachment:ee,needRenderbuffer:!0,useVao:!0,renderer:null,texture:null,renderbuffer:null,framebuffer:null,_isInit:!1,constructor:function(t,e){this.id=d.a.generateUUID(this.className),this.renderer=t,Object.assign(this,e),this.width||(this.width=t.width),this.height||(this.height=t.height),ue.add(this.id,this)},init:function(){if(!this._isInit&&this.renderer.isInit){this._isInit=!0;var t=this.renderer;this.gl=t.gl,this.state=t.state,this.reset()}},reset:function(){this.destroyResource();var t=this.gl;this.framebuffer=t.createFramebuffer(),this.bind(),this.needRenderbuffer&&(this.renderbuffer=this.createRenderbuffer()),this.texture=this.createTexture(),this.isComplete()||m.a.warn("Framebuffer is not complete => "+t.checkFramebufferStatus(t.FRAMEBUFFER)),this.unbind()},isComplete:function(){var t=this.gl;return!(!t||t.checkFramebufferStatus(t.FRAMEBUFFER)!==t.FRAMEBUFFER_COMPLETE)},bind:function(){this.init(),this._isInit&&this.state.bindFramebuffer(this.gl.FRAMEBUFFER,this.framebuffer)},unbind:function(){if(this.init(),this._isInit){var t=this.state;t.bindFramebuffer(this.gl.FRAMEBUFFER,t.preFramebuffer)}},clear:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new v.a(0,0,0,0);if(this._isInit){var e=this.gl;e.clearColor(t.r,t.g,t.b,t.a),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}},render:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4?arguments[4]:void 0;if(this._isInit){var a=this.gl,s=this.state;s.disable(re),s.disable(ie),i&&this.clear(i);var o=dt.getCustomShader(_t.a,gt.a,"","FramebufferTextureShader"),u=Lt.getProgram(o,s);u.useProgram();var c="".concat(t,"_").concat(e,"_").concat(n,"_").concat(r,"_").concat(u.id),h=Ft.getVao(a,c,{useVao:this.useVao,useInstanced:!1,mode:ae});if(h.isDirty){h.isDirty=!1;var f=[t=2*t-1,e=1-2*e,t+(n*=2),e,t,e-(r*=2),t+n,e-r];h.addAttribute(new b(new Float32Array(f),2),u.attributes.a_position),h.addAttribute(new b(new Float32Array([0,1,1,1,0,0,1,0]),2),u.attributes.a_texcoord0)}s.activeTexture(a.TEXTURE0),s.bindTexture(a.TEXTURE_2D,this.texture.getGLTexture(s)),h.draw()}},createRenderbuffer:function(){var t=this.gl,e=this.width,n=this.height,r=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,r),r},createTexture:function(){var t=this.state,e=t.gl,n=new Qt({minFilter:this.minFilter,magFilter:this.magFilter,internalFormat:this.internalFormat,format:this.format,type:this.type,width:this.width,height:this.height,image:this.data,wrapS:this.wrapS,wrapT:this.wrapT}),r=n.getGLTexture(t);return e.framebufferTexture2D(e.FRAMEBUFFER,this.attachment,this.target,r,0),n},resize:function(t,e,n){(n||this.width!==t||this.height!==e)&&(this.width=t,this.height=e,this._isInit&&this.reset())},readPixels:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Object(i.getTypedArrayClass)(this.type),s=new a(n*r*4);if(this._isInit){var o=this.gl;e=this.height-e-r,this.bind(),o.readPixels(t,e,n,r,this.format,this.type,s),this.unbind()}return s},destroy:function(){return this._isDestroyed||(this.destroyResource(),this.gl=null,ue.removeObject(this),this._isDestroyed=!0),this},destroyResource:function(){var t=this.gl;t&&(this.framebuffer&&(t.deleteFramebuffer(this.framebuffer),this.framebuffer=null),this.renderbuffer&&(t.deleteRenderbuffer(this.renderbuffer),this.renderbuffer=null),this.texture&&(this.texture.destroy(),this.texture=null))}}),he=P.a.TEXTURE_CUBE_MAP,fe=P.a.RGB,le=P.a.LINEAR,de=P.a.CLAMP_TO_EDGE,me=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,_e=a.a.create({Extends:Qt,isCubeTexture:!0,className:"CubeTexture",target:he,internalFormat:fe,format:fe,magFilter:le,minFilter:le,wrapS:de,wrapT:de,constructor:function(t){_e.superclass.constructor.call(this,t),this.image=this.image||[]},_uploadTexture:function(t){var e=this,n=this.image;Array.isArray(n)&&6===n.length?(n[0]&&n[0].width&&(this.width=n[0].width,this.height=n[0].height),n.forEach((function(n,r){e._glUploadTexture(t,me+r,n,0)}))):m.a.error("CubeTexture image must be an Array of length 6",n)},right:{get:function(){return this.image[0]},set:function(t){this.image[0]=t}},left:{get:function(){return this.image[1]},set:function(t){this.image[1]=t}},top:{get:function(){return this.image[2]},set:function(t){this.image[2]=t}},bottom:{get:function(){return this.image[3]},set:function(t){this.image[3]=t}},front:{get:function(){return this.image[4]},set:function(t){this.image[4]=t}},back:{get:function(){return this.image[5]},set:function(t){this.image[5]=t}}}),pe=_e,ge=P.a.TEXTURE_2D,ve=P.a.RGBA,Ee=P.a.NEAREST,Te=P.a.CLAMP_TO_EDGE,Me=P.a.FLOAT,Ae=a.a.create({Extends:Qt,isDataTexture:!0,className:"DataTexture",target:ge,internalFormat:ve,format:ve,type:Me,magFilter:Ee,minFilter:Ee,wrapS:Te,wrapT:Te,dataLength:0,resetSize:function(t){if(t!==this.dataLength){this.dataLength=t;var e=d.a.nextPowerOfTwo(t/4),n=Math.max(Math.log2(e),4),r=Math.floor(n/2),a=n-r;this.width=Math.pow(2,r),this.height=Math.pow(2,a),this.DataClass=Object(i.getTypedArrayClass)(this.type)}},data:{get:function(){return this.image},set:function(t){if(this.image!==t){this.resetSize(t.length);var e=this.width*this.height*4;e===t.length&&t instanceof this.DataClass?this.image=t:(this.image&&this.image.length===e||(this.image=new this.DataClass(e)),this.image.set(t,0)),this.needUpdate=!0}}},constructor:function(t){Ae.superclass.constructor.call(this,t)}}),Le=Ae;function Ie(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Oe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Oe(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Oe(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},n=this.lightType;e["LIGHT_TYPE_".concat(n)]=1,e.SIDE=this.side,"NONE"!==n&&(e.HAS_LIGHT=1),this.premultiplyAlpha&&(e.PREMULTIPLY_ALPHA=1);var r=this._textureOption.reset(e);return e.HAS_LIGHT&&(e.HAS_NORMAL=1,r.add(this.normalMap,"NORMAL_MAP",(function(){1!==t.normalMapScale&&(e.NORMAL_MAP_SCALE=1)}))),r.add(this.parallaxMap,"PARALLAX_MAP"),r.add(this.emission,"EMISSION_MAP"),r.add(this.transparency,"TRANSPARENCY_MAP"),this.ignoreTranparent&&(e.IGNORE_TRANSPARENT=1),this.alphaCutoff>0&&(e.ALPHA_CUTOFF=1),this.useHDR&&(e.USE_HDR=1),this.gammaCorrection&&(e.GAMMA_CORRECTION=1),this.receiveShadows&&(e.RECEIVE_SHADOWS=1),this.castShadows&&(e.CAST_SHADOWS=1),this.uvMatrix&&(e.UV_MATRIX=1),this.uvMatrix1&&(e.UV_MATRIX1=1),this.usePhysicsLight&&(e.USE_PHYSICS_LIGHT=1),this.isDiffuesEnvAndAmbientLightWorkTogether&&(e.IS_DIFFUESENV_AND_AMBIENTLIGHT_WORK_TOGETHER=1),r.update(),e},_textureOption:{uvTypes:null,option:null,reset:function(t){return this.option=t,this.uvTypes={},this},add:function(t,e,n){if(t&&t.isTexture){var r=this.uvTypes,i=this.option,a=t.uv||0;r[a]=1,i[e]=a,t.isCubeTexture&&(i["".concat(e,"_CUBE")]=1),n&&n(t)}return this},update:function(){var t=[0,1],e=this.uvTypes,n=this.option;for(var r in e)-1!==t.indexOf(Number(r))?n["HAS_TEXCOORD".concat(r)]=1:(m.a.warnOnce("Material._textureOption.update(".concat(r,")"),"uv_".concat(r," not support!")),n.HAS_TEXCOORD0=1);return this}},getInstancedUniforms:function(){var t=this._instancedUniforms;if(!this._instancedUniforms){var e=this.uniforms;for(var n in t=this._instancedUniforms=[],e){var r=this.getUniformInfo(n);r.isDependMesh&&!r.notSupportInstanced&&t.push({name:n,info:r})}}return t},getUniformData:function(t,e,n){return this.getUniformInfo(t).get(e,this,n)},getAttributeData:function(t,e,n){return this.getAttributeInfo(t).get(e,this,n)},getUniformInfo:function(t){return this.getInfo("uniforms",t)},getAttributeInfo:function(t){return this.getInfo("attributes",t)},getInfo:function(t,e){var n=this[t][e];return"string"==typeof n&&(n=Ue[n]),n&&n.get||(m.a.warnOnce("material.getInfo-"+e,"Material.getInfo: no this semantic:"+e),n=Qe),n},clone:function(){var t=new this.constructor;for(var e in this)"id"!==e&&(t[e]=this[e]);return t},destroyTextures:function(){this.getTextures().forEach((function(t){t.destroy()}))},getTextures:function(){var t=[];for(var e in this){var n=this[e];n&&n.isTexture&&t.push(n)}return t},_copyProps:function(t,e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}}),$e=a.a.create({Extends:Je,isBasicMaterial:!0,className:"BasicMaterial",lightType:"BLINN-PHONG",diffuse:null,ambient:null,specular:null,emission:null,specularEnvMap:null,specularEnvMatrix:null,reflectivity:0,refractRatio:0,refractivity:0,shininess:32,usedUniformVectors:11,constructor:function(t){this.diffuse=new v.a(.5,.5,.5),this.specular=new v.a(1,1,1),this.emission=new v.a(0,0,0),$e.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT",u_shininess:"SHININESS",u_reflectivity:"REFLECTIVITY",u_refractRatio:"REFRACTRATIO",u_refractivity:"REFRACTIVITY",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvMatrix:"SPECULARENVMATRIX"}),this.addTextureUniforms({u_diffuse:"DIFFUSE",u_specular:"SPECULAR",u_ambient:"AMBIENT"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$e.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t),n=this.lightType;"PHONG"!==n&&"BLINN-PHONG"!==n||(t.HAS_SPECULAR=1);var r=this.diffuse;return r&&r.isTexture&&(r.isCubeTexture?t.DIFFUSE_CUBE_MAP=1:e.add(this.diffuse,"DIFFUSE_MAP")),t.HAS_LIGHT&&(e.add(this.specular,"SPECULAR_MAP"),e.add(this.ambient,"AMBIENT_MAP"),e.add(this.specularEnvMap,"SPECULAR_ENV_MAP")),e.update(),t}}),tn=$e,en=P.a.POSITION,nn=P.a.NORMAL,rn=P.a.DEPTH,an=P.a.DISTANCE,sn=P.a.NONE,on=a.a.create({Extends:tn,isGeometryMaterial:!0,className:"GeometryMaterial",vertexType:en,lightType:sn,writeOriginData:!1,constructor:function(t){on.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_cameraFar:"CAMERAFAR",u_cameraNear:"CAMERANEAR",u_cameraType:"CAMERATYPE"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(on.superclass.getRenderOption.call(this,t),t["VERTEX_TYPE_".concat(this.vertexType)]=1,this.vertexType){case en:t.HAS_FRAG_POS=1;break;case nn:t.HAS_NORMAL=1;break;case rn:break;case an:t.HAS_FRAG_POS=1}return this.writeOriginData&&(t.WRITE_ORIGIN_DATA=1),t}}),un=on,cn=a.a.create({Extends:O,isOrthographicCamera:!0,className:"OrthographicCamera",_left:-1,left:{get:function(){return this._left},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._left=t}},_right:1,right:{get:function(){return this._right},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._right=t}},_bottom:-1,bottom:{get:function(){return this._bottom},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._bottom=t}},_top:1,top:{get:function(){return this._top},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._top=t}},_near:.1,near:{get:function(){return this._near},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._near=t}},_far:1,far:{get:function(){return this._far},set:function(t){this._needUpdateProjectionMatrix=!0,this._isGeometryDirty=!0,this._far=t}},constructor:function(t){cn.superclass.constructor.call(this,t),this.updateProjectionMatrix()},updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},getGeometry:function(t){if(t||!this._geometry||this._isGeometryDirty){this._isGeometryDirty=!1;var e=new Z,n=[this.left,this.bottom,-this.near],r=[this.right,this.bottom,-this.near],i=[this.right,this.top,-this.near],a=[this.left,this.top,-this.near],s=[this.left,this.bottom,-this.far],o=[this.right,this.bottom,-this.far],u=[this.right,this.top,-this.far],c=[this.left,this.top,-this.far];e.addRect(s,o,u,c),e.addRect(o,r,i,u),e.addRect(r,n,a,i),e.addRect(n,s,c,a),e.addRect(c,u,i,a),e.addRect(n,r,o,s),this._geometry=e}return this._geometry}}),hn=cn,fn=P.a.DEPTH,ln=P.a.BACK,dn=null,mn=new v.a(1,1,1),_n=new o.a,pn=function(t){return t.material.castShadows},gn=a.a.create({isLightShadow:!0,className:"LightShadow",light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,cameraInfo:null,debug:!1,constructor:function(t){this.id=d.a.generateUUID(this.className),Object.assign(this,t)},createFramebuffer:function(){this.framebuffer||(this.framebuffer=new ce(this.renderer,{width:this.width,height:this.height}),this.debug&&this.showShadowMap())},updateLightCamera:function(t){this.light.isDirectionalLight?this.updateDirectionalLightCamera(t):this.light.isSpotLight&&this.updateSpotLightCamera(t)},updateDirectionalLightCamera:function(t){var e=this.light;if(this.camera.lookAt(e.direction),this.cameraInfo)this.updateCustumCamera(this.cameraInfo);else{var n=t.getGeometry();if(n){this.camera.updateViewMatrix(),_n.multiply(this.camera.viewMatrix,t.worldMatrix);var r=n.getBounds(_n);this.camera.near=-r.zMax,this.camera.far=-r.zMin,this.camera.left=r.xMin,this.camera.right=r.xMax,this.camera.bottom=r.yMin,this.camera.top=r.yMax}}this.camera.updateViewMatrix()},updateCustumCamera:function(t){for(var e in t)this.camera[e]=t[e]},updateSpotLightCamera:function(t){var e=this.light;this.camera.lookAt(e.direction),this.cameraInfo?this.updateCustumCamera(this.cameraInfo):(this.camera.fov=2*e.outerCutoff,this.camera.near=.01,this.camera.far=t.far,this.camera.aspect=1),this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.light.isDirectionalLight?this.camera=new hn:this.light.isSpotLight&&(this.camera=new Q),this.camera.addTo(this.light)),(this.light.isDirty||this._cameraMatrixVersion!==t.matrixVersion)&&(this.updateLightCamera(t),this._cameraMatrixVersion=t.matrixVersion,this.light.isDirty=!1)},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;dn||(dn=new un({vertexType:fn,side:ln,writeOriginData:!0})),n.bind(),e.state.viewport(0,0,this.width,this.height),e.clear(mn),r.updateViewProjectionMatrix(),Ue.setCamera(r),e.forceMaterial=dn,this.renderShadowScene(e),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){t.renderList.traverse((function(e){pn(e)&&t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e.filter((function(t){return pn(t)})))}))},showShadowMap:function(){var t=this;this.renderer.on("afterRender",(function(){t.framebuffer.render(0,.7,.3,.3)}))}}),vn=P.a.DISTANCE,En=P.a.BACK,Tn=P.a.TEXTURE_CUBE_MAP,Mn=P.a.TEXTURE0,An=P.a.TEXTURE_CUBE_MAP_POSITIVE_X,Ln=P.a.NEAREST,In=P.a.FRAMEBUFFER,On=P.a.FRAMEBUFFER_COMPLETE,Sn=null,Rn=new v.a(0,0,0,0),yn=new c.a,Nn=[[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,-1,0,0,-1,0,0,0,1,0,0,-1,0,-1,0,0,-1,0]],xn=function(t,e){if(t.material.castShadows){if(!t.frustumTest)return!0;if(e.isMeshVisible(t))return!0}return!1},Cn=a.a.create({isLightShadow:!0,className:"CubeLightShadow",Extends:gn,light:null,renderer:null,framebuffer:null,camera:null,width:1024,height:1024,maxBias:.05,minBias:.005,debug:!1,constructor:function(t){Cn.superclass.constructor.call(this,t)},createFramebuffer:function(){if(!this.framebuffer){this.framebuffer=new ce(this.renderer,{target:Tn,width:1024,height:1024,createTexture:function(){var t=this.state.gl,e=new pe({image:[null,null,null,null,null,null],type:this.type,format:this.format,internalFormat:this.internalFormat,magFilter:Ln,minFilter:Ln,width:1024,height:1024});return t.checkFramebufferStatus(In)!==On&&m.a.warn("Framebuffer is not complete",t.checkFramebufferStatus(In)),e},bindTexture:function(t){t=t||0;var e=this.state,n=e.gl,r=this.texture.getGLTexture(e);e.activeTexture(Mn+et.MAX_TEXTURE_INDEX),e.bindTexture(this.target,r),n.framebufferTexture2D(In,this.attachment,An+t,r,0)}})}},updateLightCamera:function(t){this.camera.fov=90,this.camera.near=t.near,this.camera.far=t.far,this.camera.aspect=1,this.camera.updateViewMatrix()},createCamera:function(t){this.camera||(this.camera=new Q,this.updateLightCamera(t))},createShadowMap:function(t){this.createFramebuffer(),this.createCamera(t);var e=this.renderer,n=this.framebuffer,r=this.camera;Sn||(Sn=new un({vertexType:vn,side:En,writeOriginData:!1})),n.bind(),e.state.viewport(0,0,n.width,n.height),this.light.worldMatrix.getTranslation(r.position);for(var i=0;i<6;i++)n.bindTexture(i),yn.fromArray(Nn[0],3*i).add(r.position),r.up.fromArray(Nn[1],3*i),r.lookAt(yn),r.updateViewProjectionMatrix(),e.clear(Rn),Ue.setCamera(r),e.forceMaterial=Sn,this.renderShadowScene(e);r.matrix.identity(),r.updateViewProjectionMatrix(),delete e.forceMaterial,n.unbind(),Ue.setCamera(t),e.viewport()},renderShadowScene:function(t){var e=t.renderList,n=this.camera;e.traverse((function(e){xn(e,n)&&t.renderMesh(e)}),(function(e){var r=e.filter((function(t){return xn(t,n)}));t.renderInstancedMeshes(r)}))}}),bn=Cn,Pn=a.a.create({Extends:M,isPointLight:!0,className:"PointLight",constructor:function(t){Pn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new bn({light:this,renderer:t}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))}}),wn=Pn,Hn=new o.a,Dn=new c.a,Fn=a.a.create({Extends:M,isDirectionalLight:!0,className:"DirectionalLight",constructor:function(t){this.direction=new c.a(0,0,1),Fn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Dn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Dn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Hn);return Dn.copy(this.direction).transformDirection(e).normalize(),Dn}}),Un=Fn,Gn=new o.a,Bn=new c.a,Vn=a.a.create({Extends:M,isSpotLight:!0,className:"SpotLight",_cutoffCos:.9763,_cutoff:12.5,cutoff:{get:function(){return this._cutoff},set:function(t){this._cutoff=t,this._cutoffCos=Math.cos(d.a.degToRad(t))}},_outerCutoffCos:.9537,_outerCutoff:17.5,outerCutoff:{get:function(){return this._outerCutoff},set:function(t){this._outerCutoff=t,this._outerCutoffCos=Math.cos(d.a.degToRad(t))}},constructor:function(t){this.direction=new c.a(0,0,1),Vn.superclass.constructor.call(this,t)},createShadowMap:function(t,e){this.shadow&&(this.lightShadow||(this.lightShadow=new gn({light:this,renderer:t,width:this.shadow.width||t.width,height:this.shadow.height||t.height,debug:this.shadow.debug,cameraInfo:this.shadow.cameraInfo}),"minBias"in this.shadow&&(this.lightShadow.minBias=this.shadow.minBias),"maxBias"in this.shadow&&(this.lightShadow.maxBias=this.shadow.maxBias)),this.lightShadow.createShadowMap(e))},getWorldDirection:function(){return Bn.copy(this.direction).transformDirection(this.worldMatrix).normalize(),Bn},getViewDirection:function(t){var e=t.getModelViewMatrix(this,Gn);return Bn.copy(this.direction).transformDirection(e).normalize(),Bn}}),Xn=Vn,jn=a.a.create({Extends:Je,isShaderMaterial:!0,className:"ShaderMaterial",vs:"",fs:"",useHeaderCache:!1,constructor:function(t){jn.superclass.constructor.call(this,t)},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(jn.superclass.getRenderOption.call(this,t),this.getCustomRenderOption){var e=this.getCustomRenderOption({});for(var n in e)t["HILO_CUSTUM_OPTION_".concat(n)]=e[n]}return t},getCustomRenderOption:null}),kn=jn,zn=n(15),Wn=n.n(zn),Yn=a.a.create({Extends:Z,isMorphGeometry:!0,className:"MorphGeometry",isStatic:!1,weights:[],targets:null,constructor:function(t){Yn.superclass.constructor.call(this,t),this.weights=this.weights||[]},update:function(t,e){this.weights=t,this._originalMorphIndices=e},clone:function(){return Z.prototype.clone.call(this,{targets:this.targets,weights:this.weights})},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Yn.superclass.getRenderOption.call(this,e),this.targets&&(this._maxMorphTargetCount||(this._maxMorphTargetCount=Math.floor(8/Object.keys(this.targets).length)),Object(i.each)(this.targets,(function(n,r){e.MORPH_TARGET_COUNT=Math.min(n.length,t._maxMorphTargetCount),"vertices"===r?e.MORPH_HAS_POSITION=1:"normals"===r?e.MORPH_HAS_NORMAL=1:"tangents"===r&&(e.MORPH_HAS_TANGENT=1)}))),e}}),qn=Yn,Zn={POSITION:{name:"vertices",decodeMatName:"positionDecodeMat"},TEXCOORD_0:{name:"uvs",decodeMatName:"uvDecodeMat"},TEXCOORD_1:{name:"uvs1",decodeMatName:"uv1DecodeMat"},NORMAL:{name:"normals",decodeMatName:"normalDecodeMat"},JOINT:{name:"skinIndices"},JOINTS_0:{name:"skinIndices"},WEIGHT:{name:"skinWeights"},WEIGHTS_0:{name:"skinWeights"},TANGENT:{name:"tangents"},COLOR_0:{name:"colors"}},Kn={Geometry:Z,GeometryData:b};var Qn={_decodeTotalTime:0,wasmURL:"",workerURL:"",useWASM:!0,useWebWorker:!0,useAuto:!0,init:function(){return Qn.useAuto?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Qn.useWebWorker?Wn.a.initWorker(Qn.workerURL):Qn.useWASM?Wn.a.initWASM(Qn.wasmURL,Qn.memPages):Promise.resolve()},parse:function(t,e,n,r){var i=Date.now(),a=e.bufferViews[t.bufferView],s=Qn.wasmURL,o=Qn.workerURL,u=Qn.useAuto,c=Qn.useWASM,h=Qn.useWebWorker,f=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);function l(e){Qn._decodeTotalTime+=Date.now()-i;var n=e.toHilo3dGeometry(Kn,r.primitive._geometry);return t.targets&&(n=function(t,e,n){if(!n.isMorphGeometry){var r=new qn;for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&"id"!==i&&(r[i]=n[i]);r.targets={},n=r}for(var a=n.targets,s=0;s0&&void 0!==arguments[0]?arguments[0]:{};return t["FOG_".concat(this.mode)]=1,t}}),hr=n(16),fr=new hr.a,lr=new o.a,dr=a.a.create({Extends:g,isMesh:!0,className:"Mesh",geometry:null,material:null,useInstanced:!1,frustumTest:!0,constructor:function(t){dr.superclass.constructor.call(this,t)},clone:function(t){var e=g.prototype.clone.call(this,t);return Object.assign(e,{geometry:this.geometry,material:this.material}),e},raycast:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.visible)return null;var n=this.geometry,r=this.material,i=this.worldMatrix;if(n&&r){lr.invert(i),fr.copy(t),fr.transformMat4(lr);var a=n.raycast(fr,r.side,e);if(a)return a.forEach((function(t){t.transformMat4(i)})),a}return null},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.geometry.getRenderOption(t),t},isDestroyed:{get:function(){return this._isDestroyed}},destroy:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._isDestroyed)return this;this.removeFromParent();var n=t.resourceManager;return n.destroyMesh(this),this.material&&e&&this.material.destroyTextures(),this.off(),this.geometry=null,this.material=null,this._isDestroyed=!0,this}}),mr=dr,_r=new o.a,pr=new o.a,gr=a.a.create({Extends:mr,isSkinedMesh:!0,className:"SkinedMesh",useInstanced:!1,jointMatTexture:null,frustumTest:!1,skeleton:null,constructor:function(t){gr.superclass.constructor.call(this,t)},getJointMat:function(){var t=this;if(this.skeleton&&!(this.skeleton.jointCount<=0)){var e=this.skeleton.jointNodeList,n=this.skeleton.inverseBindMatrices,r=16*this.skeleton.jointCount;return this.jointMat&&this.jointMat.length===r||(this.jointMat=new Float32Array(r)),this.clonedFrom?pr.invert(this.clonedFrom.worldMatrix):pr.invert(this.worldMatrix),e.forEach((function(e,r){_r.copy(pr),_r.multiply(e.worldMatrix),_r.multiply(n[r]),_r.toArray(t.jointMat,16*r)})),this.jointMat}},resetJointNamesByNodeName:function(t){this.skeleton.resetJointNamesByNodeName(t)},resetSkinIndices:function(t){var e=this.skeleton;if(e){var n=this.geometry,r=n.skinIndices;if(r){this.material.isDirty=!0,n.isDirty=!0,r.isDirty=!0;var i=new R.a;r.traverse((function(n,a,s){n.elements.forEach((function(n,r){var a=e.jointNames[n],s=t.jointNames.indexOf(a);s>=0?i.elements[r]=s:m.a.warnOnce("SkinedMesh.resetSkinIndices","SkinedMesh.resetSkinIndices: no jointName found!",a)})),r.setByOffset(s,i)}))}}},initJointMatTexture:function(){if(!this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture=new Le({data:t})}return this.jointMatTexture},updateJointMatTexture:function(){if(this.jointMatTexture){var t=this.getJointMat();this.jointMatTexture.data.set(t,0),this.jointMatTexture.needUpdate=!0}else this.initJointMatTexture()},clone:function(t){var e=mr.prototype.clone.call(this,t);return Object.assign(e,{useInstanced:this.useInstanced,skeleton:this.skeleton.clone()}),e.clonedFrom=this,e},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};gr.superclass.getRenderOption.call(this,t);var e=this.skeleton.jointCount;if(e&&(t.JOINT_COUNT=e,et.VERTEX_TEXTURE_FLOAT)){var n=(et.MAX_VERTEX_UNIFORM_VECTORS-22)/4;e>n&&(t.JOINT_MAT_MAP=1)}return t}}),vr=gr,Er=a.a.create({isSkeleton:!0,className:"Skeleton",userData:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.jointNodeList=[],this.jointNames=[],this.inverseBindMatrices=[],Object.assign(this,t)},jointCount:{get:function(){return this.jointNodeList.length}},_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,t&&this._initJointNodeList()}},_initJointNodeList:function(){var t={};this.rootNode.traverse((function(e){t[e.jointName]=e})),this.jointNodeList=this.jointNames.map((function(e){return t[e]}))},resetJointNamesByNodeName:function(t){var e=this.jointNames;this.jointNodeList.forEach((function(n,r){var i=t.rootNode.getChildByName(n.name);i&&(e[r]=i.jointName)}))},clone:function(t){var e=new Er;return e.copy(this,t),e},copy:function(t,e){return this.inverseBindMatrices=t.inverseBindMatrices,this.jointNames=t.jointNames.slice(),void 0===e&&(e=t.rootNode),this.rootNode=e,this}}),Tr=Er,Mr="1.16.0",Ar=a.a.create({className:"RenderInfo",isRenderInfo:!0,constructor:function(){this.reset()},addFaceCount:function(t){this._currentFaceCount+=t},addDrawCount:function(t){this._currentDrawCount+=t},reset:function(){this.faceCount=Math.floor(this._currentFaceCount),this.drawCount=Math.floor(this._currentDrawCount),this._currentFaceCount=0,this._currentDrawCount=0}}),Lr=new c.a,Ir=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;if(n!==r)return n-r;var i=t.material._shaderNumId||0,a=e.material._shaderNumId||0;return i!==a?i-a:t._sortRenderZ-e._sortRenderZ},Or=function(t,e){var n=t.material.renderOrder,r=e.material.renderOrder;return n!==r?n-r:e._sortRenderZ-t._sortRenderZ},Sr=a.a.create({className:"RenderList",isRenderList:!0,useInstanced:!1,constructor:function(){this.opaqueList=[],this.transparentList=[],this.instancedDict={}},reset:function(){this.opaqueList.length=0,this.transparentList.length=0,this.instancedDict={}},traverse:function(t,e){this.opaqueList.forEach((function(e){t(e)}));var n=this.instancedDict;for(var r in n){var i=n[r];i.length>2&&e?e(i):i.forEach((function(e){t(e)}))}this.transparentList.forEach((function(e){t(e)}))},sort:function(){this.transparentList.sort(Or),this.opaqueList.sort(Ir)},addMesh:function(t,e){var n=t.material,r=t.geometry;if(n&&r){if(t.frustumTest&&!e.isMeshVisible(t))return;if(this.useInstanced&&t.useInstanced){var i=this.instancedDict,a=n.id+"_"+r.id,s=i[a];i[a]||(s=i[a]=[]),s.push(t)}else t.worldMatrix.getTranslation(Lr),Lr.transformMat4(e.viewProjectionMatrix),t._sortRenderZ=Lr.z,n.transparent?this.transparentList.push(t):this.opaqueList.push(t)}else m.a.warnOnce("RenderList.addMesh(".concat(t.id,")"),"Mesh must have material and geometry",t)}}),Rr=a.a.create({className:"WebGLState",isWebGLState:!0,systemFramebuffer:null,constructor:function(t){this.gl=t,this.reset()},reset:function(){this._dict={},this.activeTextureIndex=null,this.textureUnitDict={},this.currentFramebuffer=null,this.preFramebuffer=null,this._pixelStorei={}},enable:function(t){!0!==this._dict[t]&&(this._dict[t]=!0,this.gl.enable(t))},disable:function(t){!1!==this._dict[t]&&(this._dict[t]=!1,this.gl.disable(t))},bindFramebuffer:function(t,e){this.currentFramebuffer!==e&&(this.preFramebuffer=this.currentFramebuffer,this.currentFramebuffer=e,this.gl.bindFramebuffer(t,e))},bindSystemFramebuffer:function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,this.systemFramebuffer)},useProgram:function(t){this.set1("useProgram",t)},depthFunc:function(t){this.set1("depthFunc",t)},depthMask:function(t){this.set1("depthMask",t)},clear:function(t){this.gl.clear(t)},depthRange:function(t,e){this.set2("depthRange",t,e)},stencilFunc:function(t,e,n){this.set3("stencilFunc",t,e,n)},stencilMask:function(t){this.set1("stencilMask",t)},stencilOp:function(t,e,n){this.set3("stencilOp",t,e,n)},colorMask:function(t,e,n,r){this.set4("colorMask",t,e,n,r)},cullFace:function(t){this.set1("cullFace",t)},frontFace:function(t){this.set1("frontFace",t)},blendFuncSeparate:function(t,e,n,r){this.set4("blendFuncSeparate",t,e,n,r)},blendEquationSeparate:function(t,e){this.set2("blendEquationSeparate",t,e)},pixelStorei:function(t,e){this._pixelStorei[t]!==e&&(this._pixelStorei[t]=e,this.gl.pixelStorei(t,e))},viewport:function(t,e,n,r){this.set4("viewport",t,e,n,r)},activeTexture:function(t){this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},bindTexture:function(t,e){var n=this.getActiveTextureUnit();n[t]!==e&&(n[t]=e,this.gl.bindTexture(t,e))},getActiveTextureUnit:function(){var t=this.textureUnitDict[this.activeTextureIndex];return t||(t=this.textureUnitDict[this.activeTextureIndex]={}),t},set1:function(t,e){this._dict[t]!==e&&(this._dict[t]=e,this.gl[t](e))},set2:function(t,e,n){var r=this._dict[t];r||(r=this._dict[t]=[]),r[0]===e&&r[1]===n||(r[0]=e,r[1]=n,this.gl[t](e,n))},set3:function(t,e,n,r){var i=this._dict[t];i||(i=this._dict[t]=[]),i[0]===e&&i[1]===n&&i[2]===r||(i[0]=e,i[1]=n,i[2]=r,this.gl[t](e,n,r))},set4:function(t,e,n,r,i){var a=this._dict[t];a||(a=this._dict[t]=[]),a[0]===e&&a[1]===n&&a[2]===r&&a[3]===i||(a[0]=e,a[1]=n,a[2]=r,a[3]=i,this.gl[t](e,n,r,i))},get:function(t){return this._dict[t]}}),yr=a.a.create({Mixes:s.a,className:"WebGLResourceManager",isWebGLResourceManager:!0,hasNeedDestroyResource:!1,constructor:function(t){this._needDestroyResources=[],Object.assign(this,t)},destroyMesh:function(t){var e=this;this.getMeshResources(t).forEach((function(t){e.destroyIfNoRef(t)})),t._vao=t._program=t._shader=null},getMeshResources:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t._shader&&e.push(t._shader),t._vao&&(e.push(t._vao),t._vao.getResources(e)),t._program&&e.push(t._program),e},destroyIfNoRef:function(t){var e=this._needDestroyResources;return t&&e.indexOf(t)<0&&e.push(t),this},getUsedResources:function(t){var e=this,n=[];return t&&t.traverse((function(t){t.isMesh&&!t.isDestroyed&&e.getMeshResources(t,n)})),n},destroyUnsuedResource:function(t){var e=this,n=this._needDestroyResources;if(0===n.length)return this;var r=this.getUsedResources(t);return n.forEach((function(t){r.indexOf(t)<0&&t&&t.destroy&&!t.alwaysUse&&(e.fire("destroyResource",t.id),t.destroy())})),this.reset(),this},reset:function(){return this._needDestroyResources.length=0,this}}),Nr=new o.a,xr=new c.a,Cr=new Float32Array([0,0,0]),br=a.a.create({isLightManager:!0,className:"LightManager",constructor:function(t){this.ambientLights=[],this.directionalLights=[],this.pointLights=[],this.spotLights=[],this.areaLights=[],this.lightInfo={AMBIENT_LIGHTS:0,POINT_LIGHTS:0,DIRECTIONAL_LIGHTS:0,SPOT_LIGHTS:0,AREA_LIGHTS:0,uid:0},Object.assign(this,t)},getRenderOption:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object(i.each)(this.lightInfo,(function(n,r){if("uid"!==r&&n){e[r]=n;var i=t.getShadowMapCount(r);i&&(e[r+"_SMC"]=i)}})),e},addLight:function(t){var e=null;return t.enabled?(t.isAmbientLight?e=this.ambientLights:t.isDirectionalLight?e=this.directionalLights:t.isPointLight?e=this.pointLights:t.isSpotLight?e=this.spotLights:t.isAreaLight?e=this.areaLights:m.a.warnOnce("LightManager.addLight(".concat(t.id,")"),"Not support this light:",t),e&&(t.shadow?e.unshift(t):e.push(t)),this):this},getDirectionalInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[];this.directionalLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(e,c),o.getViewDirection(t).toArray(n,c),o.shadow&&o.lightShadow&&(r.push(o.lightShadow.framebuffer.texture),i.push(o.lightShadow.width),i.push(o.lightShadow.height),s.push(o.lightShadow.minBias,o.lightShadow.maxBias),Nr.copy(t.worldMatrix),Nr.premultiply(o.lightShadow.camera.viewProjectionMatrix),Nr.toArray(a,16*u))}));var o={colors:new Float32Array(e),infos:new Float32Array(n)};return r.length&&(o.shadowMap=r,o.shadowMapSize=new Float32Array(i),o.shadowBias=new Float32Array(s),o.lightSpaceMatrix=new Float32Array(a)),o},getSpotInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[],c=[],h=[];this.spotLights.forEach((function(f,l){var d=3*l;f.getRealColor().toRGBArray(e,d),f.toInfoArray(n,d),f.getViewDirection(t).toArray(i,d),h.push(f.range),a.push(f._cutoffCos,f._outerCutoffCos),t.getModelViewMatrix(f,Nr),Nr.getTranslation(xr),xr.toArray(r,d),f.shadow&&f.lightShadow&&(s.push(f.lightShadow.framebuffer.texture),o.push(f.lightShadow.width),o.push(f.lightShadow.height),c.push(f.lightShadow.minBias,f.lightShadow.maxBias),Nr.multiply(f.lightShadow.camera.viewProjectionMatrix,t.worldMatrix),Nr.toArray(u,16*l))}));var f={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),dirs:new Float32Array(i),cutoffs:new Float32Array(a),ranges:new Float32Array(h)};return s.length&&(f.shadowMap=s,f.shadowMapSize=new Float32Array(o),f.shadowBias=new Float32Array(c),f.lightSpaceMatrix=new Float32Array(u)),f},getPointInfo:function(t){var e=[],n=[],r=[],i=[],a=[],s=[],o=[],u=[];this.pointLights.forEach((function(c,h){var f=3*h;c.getRealColor().toRGBArray(e,f),c.toInfoArray(n,f),u.push(c.range),t.getModelViewMatrix(c,Nr),Nr.getTranslation(xr),xr.toArray(r,f),c.shadow&&c.lightShadow&&(i.push(c.lightShadow.framebuffer.texture),s.push(c.lightShadow.minBias,c.lightShadow.maxBias),t.worldMatrix.toArray(a,16*h),o[2*h]=c.lightShadow.camera.near,o[2*h+1]=c.lightShadow.camera.far)}));var c={colors:new Float32Array(e),infos:new Float32Array(n),poses:new Float32Array(r),ranges:new Float32Array(u)};return i.length&&(c.shadowMap=i,c.shadowBias=new Float32Array(s),c.lightSpaceMatrix=new Float32Array(a),c.cameras=new Float32Array(o)),c},getAreaInfo:function(t){var e,n,r=[],i=[],a=[],s=[];return this.areaLights.forEach((function(o,u){var c=3*u;o.getRealColor().toRGBArray(r,c),t.getModelViewMatrix(o,Nr),Nr.getTranslation(xr),xr.toArray(i,c);var h=Nr.getRotation();Nr.fromQuat(h),xr.set(.5*o.width,0,0),xr.transformMat4(Nr),xr.toArray(a,c),xr.set(0,.5*o.height,0),xr.transformMat4(Nr),xr.toArray(s,c),e=o.ltcTexture1,n=o.ltcTexture2})),{colors:new Float32Array(r),poses:new Float32Array(i),width:new Float32Array(a),height:new Float32Array(s),ltcTexture1:e,ltcTexture2:n}},getAmbientInfo:function(){return Cr[0]=Cr[1]=Cr[2]=0,this.ambientLights.forEach((function(t){var e=t.getRealColor();Cr[0]+=e.r,Cr[1]+=e.g,Cr[2]+=e.b})),Cr[0]=Math.min(1,Cr[0]),Cr[1]=Math.min(1,Cr[1]),Cr[2]=Math.min(1,Cr[2]),Cr},updateInfo:function(t){var e=this.lightInfo,n=this.ambientLights,r=this.directionalLights,i=this.pointLights,a=this.spotLights,s=this.areaLights;e.AMBIENT_LIGHTS=n.length,e.POINT_LIGHTS=i.length,e.DIRECTIONAL_LIGHTS=r.length,e.SPOT_LIGHTS=a.length,e.AREA_LIGHTS=s.length;var o=function(t){return!!t.shadow};e.SHADOW_POINT_LIGHTS=i.filter(o).length,e.SHADOW_SPOT_LIGHTS=a.filter(o).length,e.SHADOW_DIRECTIONAL_LIGHTS=r.filter(o).length,e.uid=[e.AMBIENT_LIGHTS,e.POINT_LIGHTS,e.SHADOW_POINT_LIGHTS,e.DIRECTIONAL_LIGHTS,e.SHADOW_DIRECTIONAL_LIGHTS,e.SPOT_LIGHTS,e.SHADOW_SPOT_LIGHTS,e.AREA_LIGHTS].join("_"),this.directionalInfo=this.getDirectionalInfo(t),this.pointInfo=this.getPointInfo(t),this.spotInfo=this.getSpotInfo(t),this.areaInfo=this.getAreaInfo(t),this.ambientInfo=this.getAmbientInfo()},getInfo:function(){return this.lightInfo},reset:function(){this.ambientLights.length=0,this.directionalLights.length=0,this.pointLights.length=0,this.spotLights.length=0,this.areaLights.length=0},getShadowMapCount:function(t){var e=[];"POINT_LIGHTS"===t?e=this.pointLights:"DIRECTIONAL_LIGHTS"===t?e=this.directionalLights:("SPOT_LIGHTS"===t||"AREA_LIGHTS"===t)&&(e=this.spotLights);var n=0;return e.forEach((function(t){n+=t.shadow?1:0})),n},createShadowMap:function(t,e){this.directionalLights.forEach((function(n){n.createShadowMap(t,e)})),this.spotLights.forEach((function(n){n.createShadowMap(t,e)})),this.pointLights.forEach((function(n){n.createShadowMap(t,e)})),this.areaLights.forEach((function(n){n.createShadowMap(t,e)}))}}),Pr=P.a.DEPTH_TEST,wr=P.a.STENCIL_TEST,Hr=P.a.SAMPLE_ALPHA_TO_COVERAGE,Dr=P.a.CULL_FACE,Fr=P.a.FRONT_AND_BACK,Ur=P.a.BLEND,Gr=P.a.LINES,Br=P.a.STATIC_DRAW,Vr=P.a.DYNAMIC_DRAW,Xr=a.a.create({Mixes:s.a,className:"WebGLRenderer",isWebGLRenderer:!0,gl:null,width:0,height:0,pixelRatio:1,domElement:null,useInstanced:!1,useVao:!0,alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,gameMode:!1,useFramebuffer:!1,framebufferOption:{},useLogDepth:!1,vertexPrecision:"highp",fragmentPrecision:"highp",fog:null,offsetX:0,offsetY:0,isInitFailed:!1,_isInit:!1,_isContextLost:!1,constructor:function(t){this.clearColor=new v.a(1,1,1),Object.assign(this,t),this.renderInfo=new Ar,this.renderList=new Sr,this.lightManager=new br,this.resourceManager=new yr},resize:function(t,e,n){if(n||this.width!==t||this.height!==e){var r=this.domElement;this.width=t,this.height=e,r.width=t,r.height=e,this.framebuffer&&this.framebuffer.resize(this.width,this.height,n),this.viewport()}},setOffset:function(t,e){this.offsetX===t&&this.offsetY===e||(this.offsetX=t,this.offsetY=e,this.viewport())},viewport:function(t,e,n,r){var i=this.state,a=this.gl;i&&(void 0===t?t=this.offsetX:this.offsetX=t,void 0===e?e=this.offsetY:this.offsetY=e,void 0===n&&(n=a.drawingBufferWidth),void 0===r&&(r=a.drawingBufferHeight),i.viewport(t,e,n,r))},isInit:{get:function(){return this._isInit&&!this.isInitFailed}},onInit:function(t){var e=this;this._isInit?t(this):this.on("init",(function(){t(e)}),!0)},initContext:function(){if(!this._isInit){this._isInit=!0;try{this._initContext(),this.fire("init")}catch(t){this.isInitFailed=!0,this.fire("initFailed",t)}}},_initContext:function(){var t=this,e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat};!0===this.preserveDrawingBuffer&&(e.preserveDrawingBuffer=!0),!0===this.gameMode&&(e.gameMode=!0);var n=this.gl=this.domElement.getContext("webgl",e);n.viewport(0,0,this.width,this.height),Tt.init(n),tt.init(n),et.init(n),dt.init(this),this.state=new Rr(n),tt.instanced||(this.useInstanced=!1),this.renderList.useInstanced=this.useInstanced,tt.vao||(this.useVao=!1),this.useFramebuffer&&(this.framebuffer=new ce(this,Object.assign({useVao:this.useVao,width:this.width,height:this.height},this.framebufferOption))),this.domElement.addEventListener("webglcontextlost",(function(e){t._onContextLost(e)}),!1),this.domElement.addEventListener("webglcontextrestored",(function(e){t._onContextRestore(e)}),!1)},_onContextLost:function(t){var e=this.gl;this._isContextLost=!0,t.preventDefault(),Lt.reset(e),dt.reset(e),Qt.reset(e),Nt.reset(e),Ft.reset(e),this.state.reset(e),this._lastMaterial=null,this._lastProgram=null,this.fire("webglContextLost")},_onContextRestore:function(t){var e=this.gl;this._isContextLost=!1,tt.reset(e),ce.reset(e),this.fire("webglContextRestored")},setupDepthTest:function(t){var e=this.state;t.depthTest?(e.enable(Pr),e.depthFunc(t.depthFunc),e.depthMask(t.depthMask),e.depthRange(t.depthRange[0],t.depthRange[1])):e.disable(Pr)},setupSampleAlphaToCoverage:function(t){var e=this.state;t.sampleAlphaToCoverage?e.enable(Hr):e.disable(Hr)},setupCullFace:function(t){var e=this.state;t.cullFace&&t.cullFaceType!==Fr?(e.enable(Dr),e.cullFace(t.cullFaceType),e.frontFace(t.frontFace)):e.disable(Dr)},setupBlend:function(t){var e=this.state;t.blend?(e.enable(Ur),e.blendFuncSeparate(t.blendSrc,t.blendDst,t.blendSrcAlpha,t.blendDstAlpha),e.blendEquationSeparate(t.blendEquation,t.blendEquationAlpha)):e.disable(Ur)},setupStencil:function(t){if(this.stencil){var e=this.state;t.stencilTest?(e.enable(wr),e.stencilMask(t.stencilMask),e.stencilFunc(t.stencilFunc,t.stencilFuncRef,t.stencilFuncMask),e.stencilOp(t.stencilOpFail,t.stencilOpZFail,t.stencilOpZPass)):e.disable(wr)}},setupUniforms:function(t,e,n,r){var i=this.forceMaterial||e.material;for(var a in t.uniforms){var s=i.getUniformInfo(a),o=t.uniforms[a];if(!s.isBlankInfo&&(r||s.isDependMesh&&!n)){var u=s.get(e,i,o);null!=u&&(t[a]=u)}}},setupVao:function(t,e,n){var r=n.geometry,i=r.isStatic;if(t.isDirty||!i||r.isDirty){t.isDirty=!1;var a=this.forceMaterial||n.material,s=a.attributes,o=i?Br:Vr;for(var u in s){var c=e.attributes[u];if(c){var h=a.getAttributeData(u,n,c);null!=h&&t.addAttribute(h,c,o)}}r.indices&&t.addIndexBuffer(r.indices,o),r.isDirty=!1}r.vertexCount&&(t.vertexCount=r.vertexCount)},setupMaterial:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=this.forceMaterial||e.material;(i.isDirty||this._lastMaterial!==i)&&(this.setupDepthTest(i),this.setupSampleAlphaToCoverage(i),this.setupCullFace(i),this.setupBlend(i),this.setupStencil(i),r=!0),this.setupUniforms(t,e,n,r),i.isDirty=!1,this._lastMaterial=i},setupMesh:function(t,e){var n=this.gl,r=this.state,i=this.lightManager,a=t.geometry,s=this.forceMaterial||t.material,o=dt.getShader(t,s,e,i,this.fog,this.useLogDepth),u=Lt.getProgram(o,r);u.useProgram(),this.setupMaterial(u,t,e,this._lastProgram!==u),this._lastProgram=u,t.material.wireframe&&a.mode!==Gr&&a.convertToLinesMode();var c=a.id+u.id,h=Ft.getVao(n,c,{useInstanced:e,useVao:this.useVao,mode:a.mode});return this.setupVao(h,u,t),t._vao=h,t._shader=o,t._program=u,{vao:h,program:u,geometry:a}},addRenderInfo:function(t,e){var n=this.renderInfo;n.addFaceCount(t),n.addDrawCount(e)},render:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.initContext(),!this.isInitFailed&&!this._isContextLost){var r=this.renderList,i=this.renderInfo,a=this.lightManager,s=this.resourceManager,o=this.state;this.fog=t.fog,a.reset(),i.reset(),r.reset(),Ue.init(this,o,e,a,this.fog),t.updateMatrixWorld(),e.updateViewProjectionMatrix(),t.traverse((function(t){return t.visible?(t.isMesh?r.addMesh(t,e):t.isLight&&a.addLight(t),g.TRAVERSE_STOP_NONE):g.TRAVERSE_STOP_CHILDREN})),r.sort(),a.createShadowMap(this,e),a.updateInfo(e),n&&this.fire("beforeRender"),this.useFramebuffer&&this.framebuffer.bind(),this.clear(),n&&this.fire("beforeRenderScene"),this.renderScene(),this.useFramebuffer&&this.renderToScreen(this.framebuffer),n&&this.fire("afterRender"),s.destroyUnsuedResource(t)}},renderScene:function(){var t=this;this.renderList.traverse((function(e){t.renderMesh(e)}),(function(e){t.renderInstancedMeshes(e)})),this._gameModeSumbit()},_gameModeSumbit:function(){var t=this.gl;this.gameMode&&t&&t.submit&&t.submit()},clear:function(t){var e=this.gl,n=this.state;t=t||this.clearColor,this._lastMaterial=null,this._lastProgram=null,e.clearColor(t.r,t.g,t.b,t.a),n.depthMask(!0);var r=e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT;this.stencil&&(n.stencilMask(!0),r|=e.STENCIL_BUFFER_BIT),e.clear(r)},clearDepth:function(){var t=this.gl;this.state.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},clearStencil:function(){var t=this.gl;this.state.stencilMask(!0),t.clear(t.STENCIL_BUFFER_BIT)},renderToScreen:function(t){this.state.bindSystemFramebuffer(),t.render(0,0,1,1,this.clearColor)},renderMesh:function(t){var e=this.setupMesh(t,!1).vao;e.draw(),this.addRenderInfo(e.vertexCount/3,1)},renderInstancedMeshes:function(t){var e=t[0];if(e){var n=this.forceMaterial||e.material,r=this.setupMesh(e,!0),i=r.vao,a=r.program;n.getInstancedUniforms().forEach((function(e){var n=e.name,r=e.info,s=a.attributes[n];s&&i.addInstancedAttribute(s,t,(function(t){return r.get(t)}))})),i.drawInstance(t.length),this.addRenderInfo(i.vertexCount/3*t.length,1)}},renderMultipleMeshes:function(t){var e=this;t.forEach((function(t){e.renderMesh(t)}))},releaseGLResource:function(){var t=this.gl;t&&(Lt.reset(t),dt.reset(t),Nt.reset(t),Ft.reset(t),this.state.reset(t),Qt.reset(t),ce.destroy(t))}}),jr=function(){var t,e=navigator.userAgent,n=document,r=window,i=n.documentElement,a={iphone:/iphone/i.test(e),ipad:/ipad/i.test(e),ipod:/ipod/i.test(e),ios:/iphone|ipad|ipod/i.test(e),android:/android/i.test(e),webkit:/webkit/i.test(e),chrome:/chrome/i.test(e),safari:/safari/i.test(e),firefox:/firefox/i.test(e),ie:/msie/i.test(e),opera:/opera/i.test(e),supportTouch:"ontouchstart"in r,supportCanvas:!!n.createElement("canvas").getContext,supportStorage:void 0,supportOrientation:"orientation"in r||"orientation"in r.screen,supportDeviceMotion:"ondevicemotion"in r};try{localStorage.setItem("hilo","hilo"),localStorage.removeItem("hilo"),a.supportStorage=!0}catch(t){a.supportStorage=!1,m.a.warn("LocalStorage disabled")}t=a.webkit||a.firefox?"webkit":a.opera?"o":a.ie?"ms":"",a.jsVendor=t;var s=a.cssVendor="-"+t+"-",o=n.createElement("div"),u=o.style,c=void 0!==u[t+"Transform"],h=void 0!==u[t+"Perspective"];h&&(o.id="test3d",(u=n.createElement("style")).textContent="@media ("+s+"transform-3d){#test3d{height:3px}}",n.head.appendChild(u),i.appendChild(o),h=3===o.offsetHeight,n.head.removeChild(u),i.removeChild(o)),a.supportTransform=c,a.supportTransform3D=h;var f=a.supportTouch,l=f?"touchstart":"mousedown",d=f?"touchmove":"mousemove",_=f?"touchend":"mouseup";return a.POINTER_START=l,a.POINTER_MOVE=d,a.POINTER_END=_,a}(),kr=a.a.create({Extends:g,isStage:!0,className:"Stage",renderer:null,camera:null,pixelRatio:null,offsetX:0,offsetY:0,width:0,height:0,canvas:null,constructor:function(t){if(t.width||(t.width=window.innerWidth),t.height||(t.height=window.innerHeight),!t.pixelRatio){var e=window.devicePixelRatio||1;e=Math.min(e,1024/Math.max(t.width,t.height),2),e=Math.max(e,1),t.pixelRatio=e}kr.superclass.constructor.call(this,t),this.initRenderer(t),m.a.log("Hilo3d version: ".concat(Mr))},initRenderer:function(t){var e=this.canvas=this.createCanvas(t);this.renderer=new Xr(Object.assign(t,{domElement:e})),this.resize(this.width,this.height,this.pixelRatio,!0)},createCanvas:function(t){var e;return e=t.canvas?t.canvas:document.createElement("canvas"),t.container&&t.container.appendChild(e),e},resize:function(t,e,n,r){if(void 0===n&&(n=this.pixelRatio),r||this.width!==t||this.height!==e||this.pixelRatio!==n){this.width=t,this.height=e,this.pixelRatio=n,this.rendererWidth=t*n,this.rendererHeight=e*n;var i=this.canvas;this.renderer.resize(this.rendererWidth,this.rendererHeight,r),i.style.width=this.width+"px",i.style.height=this.height+"px",this.updateDomViewport()}return this},setOffset:function(t,e){if(this.offsetX!==t||this.offsetY!==e){this.offsetX=t,this.offsetY=e;var n=this.pixelRatio;this.renderer.setOffset(t*n,e*n)}return this},viewport:function(t,e,n,r){return this.resize(n,r,this.pixelRatio,!0),this.setOffset(t,e),this},tick:function(t){return this.traverseUpdate(t),this.camera&&this.renderer.render(this,this.camera,!0),this},enableDOMEvent:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.canvas,i=this._domListener||(this._domListener=function(t){e._onDOMEvent(t)});return(t="string"==typeof t?[t]:t).forEach((function(t){n?r.addEventListener(t,i,!1):r.removeEventListener(t,i)})),this},_onDOMEvent:function(t){var e=this.canvas,n=this._eventTarget,r=t.type,i=0===r.indexOf("touch"),a=t;if(i){var s=t.touches,o=t.changedTouches;s&&s.length?a=s[0]:o&&o.length&&(a=o[0])}var u=this.domViewport||this.updateDomViewport(),c=(a.pageX||a.clientX)-u.left,h=(a.pageY||a.clientY)-u.top;t.stageX=c,t.stageY=h,t.stopPropagation=function(){this._stopPropagationed=!0};var f=this.getMeshResultAtPoint(c,h,!0),l=f.mesh;t.hitPoint=f.point;var d="mouseout"===r;if(n&&(n!==l&&(!n.contains||!n.contains(l))||d)){var m=!1;if("touchmove"===r?m="touchout":"mousemove"!==r&&!d&&l||(m="mouseout"),m){var _=Object.assign({},t);_.type=m,_.eventTarget=n,n._fireMouseEvent(_)}t.lastEventTarget=n,this._eventTarget=null}if(l&&l.pointerEnabled&&"mouseout"!==r&&(t.eventTarget=this._eventTarget=l,l._fireMouseEvent(t)),!i){var p=l&&l.pointerEnabled&&l.useHandCursor?"pointer":"";e.style.cursor=p}jr.android&&"touchmove"===r&&t.preventDefault()},updateDomViewport:function(){var t=this.canvas,e=null;return t.parentNode&&(e=this.domViewport=Object(i.getElementRect)(t)),e},getMeshResultAtPoint:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.camera,i=this._ray;i||(i=this._ray=new hr.a),i.fromCamera(r,t,e,this.width,this.height);var a=this.raycast(i,!0,n);if(a)return a[0];this._stageResultAtPoint||(this._stageResultAtPoint={mesh:this,point:new c.a});var s=this._stageResultAtPoint.point;return s.copy(r.unprojectVector(s.set(t,e,0),this.width,this.height)),this._stageResultAtPoint},releaseGLResource:function(){return this.renderer.releaseGLResource(),this},destroy:function(){return kr.superclass.destroy.call(this,this.renderer),this.releaseGLResource(),this.traverse((function(t){t.off(),t.parent=null})),this.children.length=0,this.renderer.off(),this}}),zr=kr;function Wr(){return+new Date}var Yr=a.a.create({constructor:function(t,e,n,r){var i=this;for(var a in i.target=t,i._startTime=0,i._seekTime=0,i._pausedTime=0,i._pausedStartTime=0,i._reverseFlag=1,i._repeatCount=0,3===arguments.length&&(r=n,n=e,e=null),r)i[a]=r[a];i._fromProps=e,i._toProps=n,!r.duration&&r.time&&(i.duration=r.time||0,i.time=0)},target:null,duration:1e3,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,isStart:!1,isComplete:!1,onStart:null,onUpdate:null,onComplete:null,setProps:function(t,e){var n=this.target,r=t||e,i=this._fromProps={},a=this._toProps={};for(var s in t=t||n,e=e||n,r)a[s]=e[s]||0,n[s]=i[s]=t[s]||0;return this},start:function(){var t=this;return t._startTime=Wr()+t.delay,t._seekTime=0,t._pausedTime=0,t._reverseFlag=1,t._repeatCount=0,t.paused=!1,t.isStart=!1,t.isComplete=!1,Yr.add(t),t},stop:function(){return Yr.remove(this),this},pause:function(){return this.paused=!0,this._pausedStartTime=Wr(),this},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=Wr()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,e){var n=this,r=Wr();return n._startTime=r,n._seekTime=t,n._pausedTime=0,void 0!==e&&(n.paused=e),n._update(r,!0),Yr.add(n),n},link:function(t){var e,n,r=t.delay,i=this._startTime;return"string"==typeof r&&(e=0===r.indexOf("+"),n=0===r.indexOf("-"),r=e||n?Number(r.substr(1))*(e?1:-1):Number(r)),t.delay=r,t._startTime=e||n?i+this.duration+r:i+r,this._next=t,Yr.remove(t),t},_render:function(t){var e=this.target,n=this._fromProps;for(var r in n)e[r]=n[r]+(this._toProps[r]-n[r])*t},_update:function(t,e){var n=this;if(n.paused&&!e)return!1;if(n.isComplete)return!0;var r=t-n._startTime-n._pausedTime+n._seekTime;if(r<0)return!1;var i,a=r/n.duration;a<=0?a=0:a>=1&&(a=1);var s=n.ease?n.ease(a):a;n.reverse&&n.isStart&&(n._reverseFlag<0&&(a=1-a,s=1-s),a<1e-7&&(n.repeat>0&&n._repeatCount++>=n.repeat||0===n.repeat&&!n.loop?n.isComplete=!0:(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1))),n.isStart||(n.setProps(n._fromProps,n._toProps),n.isStart=!0,n.onStart&&n.onStart.call(n,n)),n.time=r,n._render(s),(i=n.onUpdate)&&i.call(n,s,n),a>=1&&(n.reverse?(n._startTime=Wr(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++0&&u<=t?(o._render(a),o.time=r,Yr.add(o)):n.isComplete&&(u<0||u>t)&&o.start()}return!!n.isComplete&&((i=n.onComplete)&&i.call(n,n),!0)},Statics:{_tweens:[],tick:function(){var t,e,n=Yr._tweens,r=n.length;for(e=0;e-1&&r.splice(e,1);else for(e=0;e1||this.heightSegments>1||this.depthSegments>1},setFrontUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setFrontUV!"):this.setVertexUV(32,t)},setRightUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setRightUV!"):this.setVertexUV(0,t)},setBackUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBackUV!"):this.setVertexUV(40,t)},setLeftUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setLeftUV!"):this.setVertexUV(8,t)},setTopUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setTopUV!"):this.setVertexUV(16,t)},setBottomUV:function(t){this.isSegments()?m.a.warn("segmented BoxGeometry dont support setBottomUV!"):this.setVertexUV(24,t)},setAllRectUV:function(t){if(this.isSegments())return m.a.warn("segmented BoxGeometry dont support setAllRectUV!"),null;for(var e=0;e<6;e++)this.setVertexUV(8*e,t);return this},_raycast:function(t,e){return mi.superclass._raycast.call(this,t,e)}}),_i=mi,pi=P.a.FRONT,gi=P.a.BACK,vi=[0,0,1],Ei=a.a.create({Extends:Z,isPlaneGeometry:!0,className:"PlaneGeometry",width:1,height:1,widthSegments:1,heightSegments:1,constructor:function(t){Ei.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.widthSegments,e=this.heightSegments,n=(t+1)*(e+1),r=this.width/t,i=this.height/e,a=new Float32Array(3*n),s=new Float32Array(3*n),o=new Float32Array(2*n),u=new Uint16Array(t*e*6),c=0,h=0;h<=e;h++)for(var f=0;f<=t;f++){var l=h*(t+1)+f;if(a[3*l]=f*r-this.width/2,a[3*l+1]=this.height/2-h*i,s[3*l]=0,s[3*l+1]=0,s[3*l+2]=1,o[2*l]=f/t,o[2*l+1]=1-h/e,h0||n<0))return null;if(e===gi&&(r<0||n>0))return null;var i=t.intersectsPlane(vi,0);if(i){var a=i.x,s=i.y,o=.5*this.width,u=.5*this.height;if(a>=-o&&a<=o&&s>=-u&&s<=u)return[i]}return null}}),Ti=Ei,Mi=a.a.create({Extends:Z,isSphereGeometry:!0,className:"SphereGeometry",radius:1,heightSegments:16,widthSegments:32,constructor:function(t){Mi.superclass.constructor.call(this,t),this.build()},build:function(){for(var t=this.radius,e=this.heightSegments,n=this.widthSegments,r=(n+1)*(e+1),i=n*e,a=new Float32Array(3*r),s=new Float32Array(4*r),o=new Float32Array(2*r),u=new Uint16Array(6*i),c=0,h=0,f=0,l=0,d=0,m=2*Math.PI,_=Math.PI,p=0;p<=e;p++)for(var g=p/e,v=_*g,E=Math.cos(v)*t,T=Math.sin(v)*t,M=0;M<=n;M++){var A=M/n,L=m*A,I=Math.cos(L),O=Math.sin(L),S=I*T,R=O*T,y=O,N=-I;if(s[f++]=y,s[f++]=0,s[f++]=N,s[f++]=1,a[h++]=S,a[h++]=E,a[h++]=R,o[l++]=A,o[l++]=g,p>0&&M>0){var x=d,C=x-1,P=C-n-1,w=x-n-1;u[c++]=P,u[c++]=w,u[c++]=x,u[c++]=P,u[c++]=x,u[c++]=C}d++}this.vertices=new b(a,3),this.indices=new b(u,1),this.uvs=new b(o,2),this.tangents=new b(s,4),this.normals=new b(new Float32Array(a),3)},_raycast:function(t,e){return Mi.superclass._raycast.call(this,t,e)}}),Ai=Mi,Li=[dt,Lt,Nt,Ft,Qt,ce],Ii=function(){var t="";return Li.forEach((function(e){t+="".concat(e.prototype.className,":").concat(Object.keys(e.cache._cache).length," ")})),m.a.log(t),t},Oi=a.a.create({Mixes:s.a,isLoadCache:!0,className:"LoadCache",Statics:{PENDING:1,LOADED:2,FAILED:3},enabled:!0,constructor:function(){this._files={}},update:function(t,e,n){if(this.enabled){var r={key:t,state:e,data:n};this._files[t]=r,this.fire("update",r),this.fire("update:".concat(r.key),r)}},get:function(t){return this.enabled?this._files[t]:null},getLoaded:function(t){var e=this.get(t);return e&&e.state===Oi.LOADED?e.data:null},remove:function(t){delete this._files[t]},clear:function(){this._files={}},wait:function(t){var e=this;return t?t.state===Oi.LOADED?Promise.resolve(t.data):t.state===Oi.FAILED?Promise.reject():new Promise((function(n,r){e.on("update:".concat(t.key),(function(t){var e=t.detail;e.state===Oi.LOADED?n(e.data):e.state===Oi.FAILED&&r(e.data)}),!0)})):Promise.reject()}}),Si=Oi,Ri=new Si,yi=a.a.create({Mixes:s.a,isBasicLoader:!0,className:"BasicLoader",Statics:{_cache:Ri,enalbeCache:function(){Ri.enabled=!0},disableCache:function(){Ri.enabled=!1},deleteCache:function(t){Ri.remove(t)},clearCache:function(){Ri.clear()},cache:{get:function(){return Ri},set:function(){m.a.warn("BasicLoader.cache is readonly!")}},TYPE_IMAGE:"img",TYPE_JSON:"json",TYPE_BUFFER:"buffer",TYPE_TEXT:"text"},load:function(t){var e=t.src,n=t.type;if(!n){var r=Object(i.getExtension)(e);/^(?:png|jpe?g|gif|webp|bmp)$/i.test(r)&&(n="img"),n||(n=t.defaultType)}return n===yi.TYPE_IMAGE?this.loadImg(e,t.crossOrigin):this.loadRes(e,n)},isCrossOrigin:function(t){var e=window.location,n=document.createElement("a");return n.href=t,n.hostname!==e.hostname||n.port!==e.port||n.protocol!==e.protocol},isBase64:function(t){return/^data:(.+?);base64,/.test(t)},Uint8ArrayFrom:function(t,e){if(Uint8Array.from)return Uint8Array.from(t,e);for(var n=t.length,r=new Uint8Array(n),i=0;i=300)r(new TypeError("Network request failed for ".concat(a.status)));else{var e="response"in a?a.response:a.responseText;if(t.type===yi.TYPE_JSON)try{e=JSON.parse(e)}catch(t){return void r(new TypeError("JSON.parse error"+t))}n(e)}},a.onprogress=function(n){e.fire("progress",{url:t.url,loaded:n.loaded,total:n.total})},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request timed out"))},a.open(t.method||"GET",t.url,!0),"include"===t.credentials&&(a.withCredentials=!0),t.type===yi.TYPE_BUFFER&&(a.responseType="arraybuffer"),Object(i.each)(t.headers,(function(t,e){a.setRequestHeader(e,t)})),a.send(t.body||null)}))}}),Ni=yi,xi=a.a.create({isLoader:!0,className:"Loader",maxConnections:2,Statics:{_loaderClassMap:{},_loaders:{},addLoader:function(t,e){xi._loaderClassMap[t]=e},getLoader:function(t){if(!xi._loaders[t]){var e=xi._loaderClassMap[t]?xi._loaderClassMap[t]:Ni;xi._loaders[t]=new e}return xi._loaders[t]}},preHandlerUrl:null,load:function(t){var e=this;if(t instanceof Array)return Promise.all(t.map((function(t){return e.load(t)})));var n=t.type||Object(i.getExtension)(t.src),r=xi.getLoader(n),a=t;return this.preHandlerUrl&&((a=Object.assign({},t)).src=this.preHandlerUrl(t.src)),r.load(a)}}),Ci=xi,bi=a.a.create({Extends:Ni,isCubeTextureLoader:!0,className:"CubeTextureLoader",constructor:function(){bi.superclass.constructor.call(this)},load:function(t){var e,n=this;return e=t.images&&Array.isArray(t.images)?t.images:[t.right,t.left,t.top,t.bottom,t.front,t.back],Promise.all(e.map((function(e){return n.loadImg(e,t.crossOrigin)}))).then((function(e){var n=Object.assign({},t);return delete n.images,delete n.type,delete n.right,delete n.left,delete n.top,delete n.bottom,delete n.front,delete n.back,n.image=e,new pe(n)})).catch((function(t){throw m.a.error("load CubeTexture failed",t.message,t.stack),t}))}});Ci.addLoader("CubeTexture",bi);var Pi=bi,wi=a.a.create({Extends:Je,isPBRMaterial:!0,className:"PBRMaterial",lightType:"PBR",gammaCorrection:!0,usePhysicsLight:!0,baseColor:null,baseColorMap:null,metallic:1,metallicMap:null,roughness:1,roughnessMap:null,metallicRoughnessMap:null,occlusionMap:null,occlusionStrength:1,isOcclusionInMetallicRoughnessMap:!1,diffuseEnvMap:null,diffuseEnvSphereHarmonics3:null,diffuseEnvIntensity:1,brdfLUT:null,specularEnvIntensity:1,specularEnvMap:null,isSpecularEnvMapIncludeMipmaps:!1,emission:null,emissionFactor:null,isSpecularGlossiness:!1,specular:null,glossiness:1,specularGlossinessMap:null,clearcoatFactor:0,clearcoatMap:null,clearcoatRoughnessFactor:0,clearcoatRoughnessMap:null,clearcoatNormalMap:null,usedUniformVectors:11,constructor:function(t){this.baseColor=new v.a(1,1,1),this.specular=new v.a(1,1,1),this.emissionFactor=new v.a(0,0,0),wi.superclass.constructor.call(this,t),Object.assign(this.uniforms,{u_baseColor:"BASECOLOR",u_metallic:"METALLIC",u_roughness:"ROUGHNESS",u_specular:"SPECULAR",u_emissionFactor:"EMISSIONFACTOR",u_glossiness:"GLOSSINESS",u_brdfLUT:"BRDFLUT",u_diffuseEnvMap:"DIFFUSEENVMAP",u_diffuseEnvIntensity:"DIFFUSEENVINTENSITY",u_occlusionStrength:"OCCLUSIONSTRENGTH",u_specularEnvMap:"SPECULARENVMAP",u_specularEnvIntensity:"SPECULARENVINTENSITY",u_specularEnvMapMipCount:"SPECULARENVMAPMIPCOUNT",u_diffuseEnvSphereHarmonics3:"DIFFUSEENVSPHEREHARMONICS3",u_clearcoatFactor:"CLEARCOATFACTOR",u_clearcoatRoughnessFactor:"CLEARCOATROUGHNESSFACTOR"}),this.addTextureUniforms({u_baseColorMap:"BASECOLORMAP",u_metallicMap:"METALLICMAP",u_roughnessMap:"ROUGHNESSMAP",u_metallicRoughnessMap:"METALLICROUGHNESSMAP",u_occlusionMap:"OCCLUSIONMAP",u_specularGlossinessMap:"SPECULARGLOSSINESSMAP",u_lightMap:"LIGHTMAP",u_clearcoatMap:"CLEARCOATMAP",u_clearcoatRoughnessMap:"CLEARCOATROUGHNESSMAP",u_clearcoatNormalMap:"CLEARCOATNORMALMAP"})},getRenderOption:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};wi.superclass.getRenderOption.call(this,t);var e=this._textureOption.reset(t);return e.add(this.baseColorMap,"BASE_COLOR_MAP"),e.add(this.metallicMap,"METALLIC_MAP"),e.add(this.roughnessMap,"ROUGHNESS_MAP"),e.add(this.metallicRoughnessMap,"METALLIC_ROUGHNESS_MAP"),e.add(this.diffuseEnvMap,"DIFFUSE_ENV_MAP"),e.add(this.occlusionMap,"OCCLUSION_MAP"),e.add(this.lightMap,"LIGHT_MAP"),this.brdfLUT&&(e.add(this.specularEnvMap,"SPECULAR_ENV_MAP"),et.SHADER_TEXTURE_LOD&&this.specularEnvMap&&(t.USE_SHADER_TEXTURE_LOD=1)),this.isSpecularGlossiness&&(t.PBR_SPECULAR_GLOSSINESS=1,e.add(this.specularGlossinessMap,"SPECULAR_GLOSSINESS_MAP")),this.isOcclusionInMetallicRoughnessMap&&(t.IS_OCCLUSION_MAP_IN_METALLIC_ROUGHNESS_MAP=1),1!==this.occlusionStrength&&(t.OCCLUSION_STRENGTH=1),this.diffuseEnvSphereHarmonics3&&(t.HAS_NORMAL=1,t.DIFFUSE_ENV_SPHERE_HARMONICS3=1),(this.specularEnvMap||this.diffuseEnvSphereHarmonics3||this.specularEnvMap)&&(t.NEED_WORLD_NORMAL=1),this.specularEnvMap&&this.isSpecularEnvMapIncludeMipmaps&&(t.IS_SPECULAR_ENV_MAP_INCLUDE_MIPMAPS=1),this.clearcoatFactor>0&&(t.HAS_CLEARCOAT=1,t.HAS_NORMAL=1,this.clearcoatMap&&e.add(this.clearcoatMap,"CLEARCOAT_MAP"),this.clearcoatNormalMap&&e.add(this.clearcoatNormalMap,"CLEARCOAT_NORMAL_MAP"),this.clearcoatRoughnessMap&&e.add(this.clearcoatRoughnessMap,"CLEARCOAT_ROUGHNESS_MAP")),e.update(),t}}),Hi=wi,Di=new Image;Di.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";var Fi=a.a.create({Extends:Qt,Mixes:s.a,isLazyTexture:!0,className:"LazyTexture",_src:"",crossOrigin:!1,autoLoad:!0,resType:"",src:{get:function(){return this._src},set:function(t){this._src!==t&&(this._src=t,this.autoLoad&&this.load())}},constructor:function(t){t&&("crossOrigin"in t&&(this.crossOrigin=t.crossOrigin),"autoLoad"in t&&(this.autoLoad=t.autoLoad)),Fi.superclass.constructor.call(this,t),this.image=this.placeHolder||Di},load:function(t){var e=this;return Fi.loader=Fi.loader||new Ci,Fi.loader.load({src:this.src,crossOrigin:this.crossOrigin,type:this.resType,defaultType:"img"}).then((function(t){t.isTexture?(Object.assign(e,t),e.needUpdate=!0,e.needDestroy=!0,e.fire("load")):(e.image=t,e.needUpdate=!0,e.fire("load"))}),(function(n){if(e.fire("error"),t)throw new Error("LazyTexture Failed ".concat(n));m.a.warn("LazyTexture Failed ".concat(n))}))},_releaseImage:function(){this._src&&"string"!=typeof this._src&&(this._src=""),Fi.superclass._releaseImage.call(this)}}),Ui=Fi,Gi=n(13);function Bi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Vi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Vi(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0;r--)Zi[r]=t[r]+n*(e[r]-t[r]);return Zi}return t+n*(e-t)},STEP:function(t,e,n){return t},CUBICSPLINE:function(t,e,n,r){var a=t.length/3;if(void 0===e)return 1===a?t[1]:t.slice(a,-a);var s=t[1],o=t[2],u=e[1],c=e[0];return a>1&&(s=t.slice(a,-a),o=t.slice(-a),u=e.slice(a,-a),c=e.slice(0,a)),s.hermite?s.hermite(s,o.scale(r),u,c.scale(r),n):s.isQuaternion?(s.fromArray(this._cubicSpline(s.elements,o.elements,u.elements,c.elements,r,n),0,!0),s.normalize(!0)):(Object(i.isArrayLike)(s)||(s=[s],o=[o],u=[u],c=[c]),s=this._cubicSpline(s,o,u,c,r,n)),s},_cubicSpline:function(t,e,n,r,i,a){var s=a*a,o=s*a,u=2*o-3*s+1,c=o-2*s+a,h=-2*o+3*s,f=o-s;Zi.length=0;for(var l=t.length-1;l>=0;l--)Zi[l]=t[l]*u+c*e[l]*i+n[l]*h+f*r[l]*i;return Zi}},StateType:{TRANSLATE:"Translation",POSITION:"Translation",TRANSLATION:"Translation",SCALE:"Scale",ROTATE:"Rotation",ROTATION:"Rotation",QUATERNION:"Quaternion",WEIGHTS:"Weights"},getType:function(t){return t=String(t).toUpperCase(),Qi.StateType[t]||Qi._extraStateHandlers.type[t]},_extraStateHandlers:{type:{},handler:{}},registerStateHandler:function(t,e){Qi._extraStateHandlers.type[String(t).toUpperCase()]=t,Qi._extraStateHandlers.handler[t]=e}},isAnimationStates:!0,className:"AnimationStates",nodeName:"",type:"",interpolationType:"LINEAR",constructor:function(t){this.id=d.a.generateUUID(this.className),this.keyTime=[],this.states=[],Object.assign(this,t)},findIndexByTime:function(t){return Object(i.getIndexFromSortedArray)(this.keyTime,t,Ki)},getStateByIndex:function(t){var e=this.states.length/this.keyTime.length;return 1===e?this.states[t]:this.states.slice(t*e,t*e+e)},getState:function(t){var e=Bi(this.findIndexByTime(t),2),n=e[0],r=e[1];if(n<0||r>=this.keyTime.length)return null;var a=this.keyTime[n],s=this.keyTime[r],o=this.getStateByIndex(n);if("STEP"===this.interpolationType)return o;if(n===r){var u=this.interpolation(o);return this.type===Qi.StateType.ROTATION&&(u=Xi.fromEuler(qi.fromArray(u))),u.elements||u}var c=this.getStateByIndex(r),h=s-a,f=(t-a)/h;this.type===Qi.StateType.ROTATION?Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromEuler(qi.fromArray(o[0])),o[1]=ji.fromEuler(qi.fromArray(o[1])),o[2]=ki.fromEuler(qi.fromArray(o[2])),c[0]=zi.fromEuler(qi.fromArray(c[0])),c[1]=Wi.fromEuler(qi.fromArray(c[1])),c[2]=Yi.fromEuler(qi.fromArray(c[2]))):(o=Xi.fromEuler(qi.fromArray(o)),c=ji.fromEuler(qi.fromArray(c))):this.type===Qi.StateType.QUATERNION&&(Object(i.isArrayLike)(o[0])?(o[0]=Xi.fromArray(o[0]),o[1]=ji.fromArray(o[1]),o[2]=ki.fromArray(o[2]),c[0]=zi.fromArray(c[0]),c[1]=Wi.fromArray(c[1]),c[2]=Yi.fromArray(c[2])):(o=Xi.fromArray(o),c=ji.fromArray(c)));var l=this.interpolation(o,c,f,h);return l.elements||l},interpolation:function(t,e,n,r){return Qi.interpolation[this.interpolationType](t,e,n,r)},updateNodeTranslation:function(t,e){t.x=e[0],t.y=e[1],t.z=e[2]},updateNodeScale:function(t,e){t.scaleX=e[0],t.scaleY=e[1],t.scaleZ=e[2]},updateNodeQuaternion:function(t,e){t.quaternion.fromArray(e)},updateNodeWeights:function(t,e){var n=this._originalWeightIndices=this._originalWeightIndices||[],r=e.length;e=e.slice();for(var i=0;ie[a]){var o=e[a];e[a]=e[s],e[s]=o,o=n[a],n[a]=n[s],n[s]=o}t.traverse((function(t){t.isMesh&&t.geometry&&t.geometry.isMorphGeometry&&t.geometry.update(e,n)}))},updateNodeState:function(t,e){if(e){var n=this.type;n===Qi.StateType.ROTATION&&(n=Qi.StateType.QUATERNION);var r=this.getState(t);if(r){var i="updateNode"+n;this[i]?this[i](e,r):Qi._extraStateHandlers.handler[n]?Qi._extraStateHandlers.handler[n].call(this,e,r):m.a.warnOnce(i,"updateNodeState failed unknow type(%s)",n)}}},clone:function(){return new this.constructor({keyTime:this.keyTime,states:this.states,type:this.type,nodeName:this.nodeName})}}),Ji=Qi,$i=a.a.create({Statics:{_anims:[],tick:function(t){this._anims.forEach((function(e){return e.tick(t)}))}},Mixes:s.a,isAnimation:!0,className:"Animation",paused:!1,currentLoopCount:0,loop:1/0,currentTime:0,timeScale:1,startTime:0,endTime:0,clipStartTime:0,clipEndTime:0,nodeNameMap:null,_rootNode:null,rootNode:{get:function(){return this._rootNode},set:function(t){this._rootNode=t,this._initNodeNameMap()}},_animStatesList:null,animStatesList:{get:function(){return this._animStatesList},set:function(t){this._animStatesList=t,this._initClipTime()}},validAnimationIds:null,constructor:function(t){this.id=d.a.generateUUID(this.className),this.clips={},this._animStatesList=[],Object.assign(this,t)},addClip:function(t,e,n,r){this.clips[t]={start:e,end:n,animStatesList:r}},removeClip:function(t){this.clips[t]=null},getAnimStatesListTimeInfo:function(t){var e=0,n=1/0;return t.forEach((function(t){e=Math.max(t.keyTime[t.keyTime.length-1],e),n=Math.min(t.keyTime[0],n)})),{startTime:n,endTime:e}},_initClipTime:function(){var t=this.getAnimStatesListTimeInfo(this.animStatesList);this.clipStartTime=t.startTime,this.clipEndTime=t.endTime},_initNodeNameMap:function(){if(this._rootNode){var t=this.nodeNameMap={};this._rootNode.traverse((function(e){t[e.animationId]=e;var n=e.name;void 0===n||t[n]||(t[n]=e)}),!1)}},tick:function(t){this.paused||(this.currentTime+=t/1e3*this.timeScale,this.currentTime>=this.endTime?(this.currentLoopCount++,this.currentTime=this.endTime,this.updateAnimStates(),this.fire("loopEnd"),!this.loop||this.currentLoopCount>=this.loop?(this.stop(),this.fire("end")):this.currentTime=this.startTime):this.updateAnimStates())},updateAnimStates:function(){var t=this;return this.animStatesList.forEach((function(e){e.updateNodeState(t.currentTime,t.nodeNameMap[e.nodeName])})),this},play:function(t,e){var n;if("string"==typeof t){var r=this.clips[t];r?(n=r.start,e=r.end,r.animStatesList&&(this.animStatesList=r.animStatesList,this._initClipTime())):m.a.warn("no this animation clip name:"+t)}else n=t;void 0===n&&(n=this.clipStartTime),void 0===e&&(e=this.clipEndTime),this.endTime=Math.min(e,this.clipEndTime),this.startTime=Math.min(n,this.endTime),this.currentTime=this.startTime,this.currentLoopCount=0,this.stop(),this.paused=!1,$i._anims.push(this)},stop:function(){this.paused=!0;var t=$i._anims,e=t.indexOf(this);-1!==e&&t.splice(e,1)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},clone:function(t){var e=new this.constructor({rootNode:t,animStatesList:this.animStatesList,timeScale:this.timeScale,loop:this.loop,paused:this.paused,currentTime:this.currentTime,startTime:this.startTime,endTime:this.endTime,clips:this.clips});return this.paused||e.play(),e}}),ta=$i;function ea(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);s=!0);}catch(t){o=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return na(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function na(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=2&&(this.isGLTF2=!0),this.parseExtensionUsed(),this.loadResources(t).then((function(){return e.parseExtensions(e.json.extensions,null,{isGlobal:!0,methodName:"parseOnLoad"}),Promise.resolve()})).then((function(){return e.parseGeometries()})).then((function(){return e.parseScene()}))},parseExtensionUsed:function(){var t=this;this.extensionsUsed={},i.each(this.json.extensionsUsed,(function(e){t.extensionsUsed[e]=!0})),this.extensionsUsed.WEB3D_quantized_attributes||(this.isUnQuantizeInShader=!1)},getExtensionHandler:function(t){return this.extensionHandlers&&this.extensionHandlers[t]||la.extensionHandlers[t]},parseExtension:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t[e],a=this.getExtensionHandler(e);return a&&a.parse?a.parse(i,this,n,r):n},parseExtensions:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.each(t,(function(t,i){if(!r.ignoreExtensions||!r.ignoreExtensions[i]){var a=n.getExtensionHandler(i),s=r.methodName||"parse";a&&a[s]&&(e=a[s](t,n,e,r))}})),e},isUseExtension:function(t,e){return!!(t&&t.extensions&&t.extensions[e])},parseBinary:function(t){this.isBinary=!0;var e,n=new DataView(t),r=n.getUint32(4,!0),a=n.getUint32(8,!0),s=12;if(r<2){var o=n.getUint32(s,!0);e=new Uint8Array(t,20,o),e=i.convertUint8ArrayToString(e,!0),this.json=JSON.parse(e),this.binaryBody=t.slice(20+o)}else{if(2!==r)throw new Error("Dont support glTF version ".concat(r));for(;sa*i.BYTES_PER_ELEMENT)s.array=new i(s.buffer,s.byteOffset,s.byteLength/i.BYTES_PER_ELEMENT),r=new b(s.array,a,{offset:n.byteOffset||0,stride:s.byteStride,bufferViewId:s.id});else{var u,c=(n.byteOffset||0)+s.byteOffset;if(c%i.BYTES_PER_ELEMENT||this.forceCreateNewBuffer)u=new i(s.buffer.slice(c,c+o*i.BYTES_PER_ELEMENT));else u=new i(s.buffer,c,o);r=new b(u,a)}return n.sparse&&(r||(r=new b(new i(o),a)),r=this.sparseAccessorHandler(r,n.sparse)),r=this.parseExtensions(n.extensions,r,{isDecode:e,isAccessor:!0}),n.data=r,n.normalized&&(r.normalized=!0),r},getArrayByAccessor:function(t,e){var n=this.json.accessors[t];if(n.array)return n.array;var r=this.getAccessorData(t,e);if(!r.stride&&!r.offset&&1===r.size)return r.data;var i=[];return r.traverse((function(t){i.push(t.toArray?t.toArray():t)})),n.array=i,i},parseTechnique:function(t,e){var n=null;this.json.techniques&&(n=this.json.techniques[t.technique]),n&&n.states&&(n.states.enable.forEach((function(t){switch(t){case ra:e.blend=!0;break;case ia:e.depthTest=!0;break;case aa:e.cullFace=!0}})),i.each(n.states.functions,(function(t,n){switch(n){case"blendEquationSeparate":e.blendEquation=t[0],e.blendEquationAlpha=t[1];break;case"blendFuncSeparate":e.blendSrc=t[0],e.blendDst=t[1],e.blendSrcAlpha=t[2],e.blendDstAlpha=t[3];break;case"depthMask":e.depthMask=t[0];break;case"cullFace":e.cullFaceType=t[0];break;default:e[n]=t}})),e.cullFace?e.side=e.cullFaceType===sa?oa:sa:e.side=ua)},createMorphGeometry:function(t,e){var n=this,r=new qn,a=r.targets={};return i.each(t.targets,(function(t){i.each(t,(function(t,e){var r=fa[e].name;a[r]||(a[r]=[]);var i=n.getAccessorData(t,!0);a[r].push(i)}))})),r.weights=e||new Float32Array(t.targets.length),r},handlerGeometry:function(t,e){var n=void 0===e.mode?4:e.mode;if(e.extensions){var r=this.parseExtensions(e.extensions,null,{primitive:e,isPrimitive:!0});if(r)return r.mode=n,r}t||(t=new Z({mode:n})),"indices"in e&&(t.indices=this.getAccessorData(e.indices));var i=e.attributes;for(var a in i){var s=fa[a];if(s){var o=!(this.isUnQuantizeInShader&&s.decodeMatName);t[s.name]=this.getAccessorData(i[a],o),o||(t[s.decodeMatName]=t[s.name].decodeMat,delete t[s.name].decodeMat)}else m.a.warn("Unknow attribute named ".concat(a,"!"))}return t},handlerSkinedMesh:function(t,e){e&&(t.skeleton=e,this.useInstanced&&(t.useInstanced=!0))},fixProgressiveGeometry:function(t,e){t._geometry=e,this.isProgressive&&t._meshes&&t._meshes.forEach((function(t){t.visible=!0,t.geometry=e}))},parseGeometries:function(){var t=this,e=i.serialRun(this.json.meshes,(function(e){return i.serialRun(e.primitives,(function(n){var r;n.targets&&n.targets.length&&(r=t.createMorphGeometry(n,e.weights)),n._geometry=r;var i=t.handlerGeometry(r,n);return i&&i.then?i.then((function(e){t.fixProgressiveGeometry(n,e)}),(function(t){m.a.error("geometry parse error",t)})):(t.fixProgressiveGeometry(n,i),i)}))}));return this.isProgressive?null:e},parseMesh:function(t,e,n){var r=this,i=this.json.meshes[t];i.primitives.forEach((function(a){var s,o=r.skins&&r.skins[n.skin];if(a.meshNode)s=a.meshNode.clone();else{var u=r.materials[a.material]||new tn;s=new(o?vr:mr)({geometry:a._geometry,material:u,name:"mesh-"+(i.name||t)}),a.meshNode=s}r.handlerSkinedMesh(s,o),r.isProgressive&&!s.geometry&&(s.visible=!1,a._meshes=a._meshes||[],a._meshes.push(s)),e.addChild(s),r.meshes.push(s)}))},parseCameras:function(){var t=this;this.cameras={};var e=window.innerWidth/window.innerHeight;i.each(this.json.cameras,(function(n,r){var i;"perspective"===n.type&&n.perspective?((i=new Q).fov=d.a.radToDeg(n.perspective.yfov),i.near=n.perspective.znear,i.far=n.perspective.zfar,n.aspectRatio?i.aspect=n.aspectRatio:i.aspect=e):"orthographic"===n.type&&n.orthographic&&((i=new hn).near=n.orthographic.znear,i.far=n.orthographic.zfar,i.right=n.orthographic.xmag,i.left=-1*i.right,i.top=n.orthographic.ymag,i.bottom=-1*i.top),(i=t.parseExtensions(n.extensions,i,{isCamera:!0}))&&(i.name=n.name||r,t.cameras[r]=i)}))},handlerNodeTransform:function(t,e){e.matrix?t.matrix.fromArray(e.matrix):(e.rotation&&t.quaternion.fromArray(e.rotation),e.scale&&t.setScale(e.scale[0],e.scale[1],e.scale[2]),e.translation&&(t.x=e.translation[0],t.y=e.translation[1],t.z=e.translation[2]))},parseNode:function(t,e){var n,r=this,i=this.json.nodes[t];i||m.a.warn("GLTFParser.parseNode: nodes[".concat(t,"] has nothing.")),n=new g({name:i.name,animationId:t}),n=this.parseExtensions(i.extensions,n,{isNode:!0}),"camera"in i&&this.cameras[i.camera]&&n.addChild(this.cameras[i.camera]),this.handlerNodeTransform(n,i),i.jointName?(n.jointName=i.jointName,this.jointMap[n.jointName]=n):this.isGLTF2&&(n.jointName=t,this.jointMap[t]=n),i.meshes?i.meshes.forEach((function(t){return r.parseMesh(t,n,i)})):"mesh"in i&&this.parseMesh(i.mesh,n,i),i.children&&i.children.forEach((function(t){return r.parseNode(t,n)})),e.addChild(n)},parseAnimations:function(){var t=this;if(!this.json.animations)return null;var e=this.isMultiAnim,n={},r=[],a={};return i.each(this.json.animations,(function(i){i.channels.forEach((function(e){var n=e.target.path,s=e.target.id;t.isGLTF2&&(s=e.target.node);var o=i.samplers[e.sampler],u=t.isGLTF2?o.input:i.parameters[o.input],c=t.isGLTF2?o.output:i.parameters[n],h=t.getArrayByAccessor(u,!0),f=t.getArrayByAccessor(c,!0);"rotation"===n&&(n="quaternion");var l=new Ji({interpolationType:o.interpolation||"LINEAR",nodeName:s,keyTime:h,states:f,type:Ji.getType(n)});r.push(l),a[s]=!0})),e&&r.length&&(n[i.name]={animStatesList:r},r=[])})),e&&Object.keys(n).length>0&&(r=Object.values(n)[0].animStatesList),r.length?new ta({rootNode:this.node,animStatesList:r,validAnimationIds:a,clips:n}):null},parseScene:function(){var t=this;this.parseMaterials(),this.jointMap={},this.meshes=[],this.lights=[],this.node=new g({needCallChildUpdate:!1}),this.parseCameras();var e=this.json.scenes[this.getDefaultSceneName()];if(!e)return m.a.warn("GLTFParser:no scene!"),{node:this.node,meshes:[],cameras:[],lights:[],textures:[],materials:[]};var n=e.nodes;this.parseSkins(),n.forEach((function(e){return t.parseNode(e,t.node)})),this.resetSkinInfo(this.node);var r={node:this.node,scene:this.node,meshes:this.meshes,json:this.json,cameras:Object.values(this.cameras),lights:this.lights,textures:Object.values(this.textures),materials:Object.values(this.materials)},i=this.parseAnimations();return i&&(this.node.setAnim(i),i.play(),r.anim=i),this.parseExtensions(e.extensions,null,{isScene:!0}),this.parseExtensions(this.json.extensions,r,{isGlobal:!0,methodName:"parseOnEnd"}),r},getDefaultSceneName:function(){return void 0!==this.defaultScene?this.defaultScene:this.json.scenes?Object.keys(this.json.scenes)[0]:null},parseSkins:function(){var t=this;this.skins=[];var e=this.json.skins;e&&e.length&&(this.skins=e.map((function(e){for(var n=new Tr,r=e.joints.length,i=t.getArrayByAccessor(e.inverseBindMatrices,!0),a=0;a ",t)}return null}))}});Ci.addLoader("hdr",Aa);var La=Aa,Ia=a.a.create({Statics:{HEADER_LEN:64,COMPRESSED_2D:0,COMPRESSED_3D:1,TEX_2D:2,TEX_3D:3},isKhronosTextureContainer:!0,className:"KhronosTextureContainer",constructor:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.arrayBuffer=t,this.baseOffset=n;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,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]){var i=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*i),s=a.getUint32(0,!0),o=67305985===s;this.glType=a.getUint32(1*i,o),this.glTypeSize=a.getUint32(2*i,o),this.glFormat=a.getUint32(3*i,o),this.glInternalFormat=a.getUint32(4*i,o),this.glBaseInternalFormat=a.getUint32(5*i,o),this.pixelWidth=a.getUint32(6*i,o),this.pixelHeight=a.getUint32(7*i,o),this.pixelDepth=a.getUint32(8*i,o),this.numberOfArrayElements=a.getUint32(9*i,o),this.numberOfFaces=a.getUint32(10*i,o),this.numberOfMipmapLevels=a.getUint32(11*i,o),this.bytesOfKeyValueData=a.getUint32(12*i,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=Ia.COMPRESSED_2D:this.loadType=Ia.TEX_2D:m.a.warn("number of faces expected"+e+", but found "+this.numberOfFaces):m.a.warn("texture arrays not currently supported"):m.a.warn("only 2D textures currently supported")}else m.a.error("texture missing KTX identifier")},mipmaps:function(t){for(var e=[],n=Ia.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,i=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s2&&void 0!==arguments[2]?arguments[2]:0,r=new Ia(e,1,n),i={compressed:0===r.glType,type:r.glType,width:r.pixelWidth,height:r.pixelHeight,internalFormat:r.glInternalFormat,format:r.glFormat,isCubemap:6===r.numberOfFaces};return r.numberOfMipmapLevels>=Math.floor(Math.log2(Math.max(i.width,i.height))+1)?(i.mipmaps=r.mipmaps(!0),i.image=i.mipmaps[0].data):(i.mipmaps=null,i.image=r.mipmaps(!1)[0].data),new Qt(i)}});Ci.addLoader("ktx",Oa);var Sa=Oa,Ra=a.a.create({Mixes:s.a,isLoadQueue:!0,className:"LoadQueue",Statics:{addLoader:function(t,e){m.a.warn("LoadQueue.addLoader is duplicated, please use Loader.addLoader"),Ci.addLoader(t,e)}},constructor:function(t){this._source=[],this.add(t)},maxConnections:2,_source:null,_loaded:0,_connections:0,_currentIndex:-1,add:function(t){return t&&(t=Array.isArray(t)?t:[t],this._source=this._source.concat(t)),this},get:function(t){if(!t)return null;for(var e=this._source,n=0;n=n)this.fire("complete");else if(this._currentIndex2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this.renderer.pixelRatio,a=[],s=this.framebuffer.readPixels(t*i,e*i,n*i,r*i),o=0;o=this._targetFPS?(this._measuredFPS=1e3/(this._tickTime/this._tickCount)+.5>>0,this._tickCount=0,this._tickTime=0):this._tickTime+=t-this._lastTime,this._lastTime=t;for(var r=n.slice(0),i=0,a=r.length;i=0&&e.splice(n,1)},nextTick:function(t){var e=this,n={tick:function(r){e.removeTick(n),t(r)}};return e.addTick(n),n},timeout:function(t,e){var n=this,r=(new Date).getTime()+e,i={tick:function(){(new Date).getTime()-r>=0&&(n.removeTick(i),t())}};return n.addTick(i),i},interval:function(t,e){var n=(new Date).getTime()+e,r={tick:function(){var r=(new Date).getTime(),i=r-n;i>=0&&(i0&&(u=1/Math.sqrt(u),t[0]=n*u,t[1]=r*u,t[2]=i*u,t[3]=s*u),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.lerp=function(t,e,n,r){var i=e[0],s=e[1],u=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t[2]=u+r*(n[2]-u),t[3]=o+r*(n[3]-o),t},e.random=function(t,e){var n,i,s,u,o,a;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{a=(s=2*r.RANDOM()-1)*s+(u=2*r.RANDOM()-1)*u}while(a>=1);var c=Math.sqrt((1-o)/a);return t[0]=e*n,t[1]=e*i,t[2]=e*s*c,t[3]=e*u*c,t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*u,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*u,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*u,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*u,t},e.transformQuat=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=n[0],o=n[1],a=n[2],c=n[3],f=c*r+o*s-a*i,h=c*i+a*r-u*s,l=c*s+u*i-o*r,m=-u*r-o*i-a*s;return t[0]=f*c+m*-u+h*-a-l*-o,t[1]=h*c+m*-o+l*-u-f*-a,t[2]=l*c+m*-a+f*-o-h*-u,t[3]=e[3],t},e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=e[0],a=e[1],c=e[2],f=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(s-c)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(u-f)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(f))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function a(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+s*s)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],s=e[3]-t[3];return n*n+r*r+i*i+s*s}function f(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}function h(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}e.sub=s,e.mul=u,e.div=o,e.dist=a,e.sqrDist=c,e.len=f,e.sqrLen=h,e.forEach=function(){var t=i();return function(e,n,r,i,s,u){var o,a=void 0;for(n||(n=4),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,a=r;a1?0:i<-1?Math.PI:Math.acos(i)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=e[0],o=e[1],a=e[2];return Math.abs(n-u)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(s-a)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(a))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function s(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function u(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function a(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function l(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function m(t,e){var n=e[0],r=e[1],i=e[2],s=n*n+r*r+i*i;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s),t}function d(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.sub=o,e.mul=a,e.div=c,e.dist=f,e.sqrDist=h,e.len=s,e.sqrLen=l,e.forEach=function(){var t=i();return function(e,n,r,i,s,u){var o,a=void 0;for(n||(n=3),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,a=r;ar.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n},e.multiply=f,e.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a+u*o,t[1]=i*a+s*o,t[2]=s*a-i*o,t[3]=u*a-r*o,t},e.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a-s*o,t[1]=i*a+u*o,t[2]=s*a+r*o,t[3]=u*a-i*o,t},e.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a+i*o,t[1]=i*a-r*o,t[2]=s*a+u*o,t[3]=u*a-s*o,t},e.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},e.slerp=h,e.random=function(t){var e=r.RANDOM(),n=r.RANDOM(),i=r.RANDOM(),s=Math.sqrt(1-e),u=Math.sqrt(e);return t[0]=s*Math.sin(2*Math.PI*n),t[1]=s*Math.cos(2*Math.PI*n),t[2]=u*Math.sin(2*Math.PI*i),t[3]=u*Math.cos(2*Math.PI*i),t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n*n+r*r+i*i+s*s,o=u?1/u:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=s*o,t},e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.fromMat3=l,e.fromEuler=function(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var s=Math.sin(e),u=Math.cos(e),o=Math.sin(n),a=Math.cos(n),c=Math.sin(r),f=Math.cos(r);return t[0]=s*a*f-u*o*c,t[1]=u*o*f+s*a*c,t[2]=u*a*c-s*o*f,t[3]=u*a*f+s*o*c,t},e.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var r=o(n(0)),i=o(n(5)),s=o(n(2)),u=o(n(1));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function a(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function f(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[0],a=n[1],c=n[2],f=n[3];return t[0]=r*f+u*o+i*c-s*a,t[1]=i*f+u*a+s*o-r*c,t[2]=s*f+u*c+r*a-i*o,t[3]=u*f-r*o-i*a-s*c,t}function h(t,e,n,i){var s=e[0],u=e[1],o=e[2],a=e[3],c=n[0],f=n[1],h=n[2],l=n[3],m=void 0,d=void 0,E=void 0,M=void 0,_=void 0;return(d=s*c+u*f+o*h+a*l)<0&&(d=-d,c=-c,f=-f,h=-h,l=-l),1-d>r.EPSILON?(m=Math.acos(d),E=Math.sin(m),M=Math.sin((1-i)*m)/E,_=Math.sin(i*m)/E):(M=1-i,_=i),t[0]=M*s+_*c,t[1]=M*u+_*f,t[2]=M*o+_*h,t[3]=M*a+_*l,t}function l(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var s=(i+1)%3,u=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*s+s]-e[3*u+u]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*s+u]-e[3*u+s])*r,t[s]=(e[3*s+i]+e[3*i+s])*r,t[u]=(e[3*u+i]+e[3*i+u])*r}return t}e.clone=u.clone,e.fromValues=u.fromValues,e.copy=u.copy,e.set=u.set,e.add=u.add,e.mul=f,e.scale=u.scale,e.dot=u.dot,e.lerp=u.lerp;var m=e.length=u.length,d=(e.len=m,e.squaredLength=u.squaredLength),E=(e.sqrLen=d,e.normalize=u.normalize);e.exactEquals=u.exactEquals,e.equals=u.equals,e.rotationTo=function(){var t=s.create(),e=s.fromValues(1,0,0),n=s.fromValues(0,1,0);return function(r,i,u){var o=s.dot(i,u);return o<-.999999?(s.cross(t,e,i),s.len(t)<1e-6&&s.cross(t,n,i),s.normalize(t,t),c(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(s.cross(t,i,u),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,E(r,r))}}(),e.sqlerp=function(){var t=a(),e=a();return function(n,r,i,s,u,o){return h(t,r,u,o),h(e,i,s,o),h(n,t,e,2*o*(1-o)),n}}(),e.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],E(e,l(e,t))}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.fromValues=function(t,e,n,i,s,u,o,a,c,f,h,l,m,d,E,M){var _=new r.ARRAY_TYPE(16);return _[0]=t,_[1]=e,_[2]=n,_[3]=i,_[4]=s,_[5]=u,_[6]=o,_[7]=a,_[8]=c,_[9]=f,_[10]=h,_[11]=l,_[12]=m,_[13]=d,_[14]=E,_[15]=M,_},e.set=function(t,e,n,r,i,s,u,o,a,c,f,h,l,m,d,E,M){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=u,t[6]=o,t[7]=a,t[8]=c,t[9]=f,t[10]=h,t[11]=l,t[12]=m,t[13]=d,t[14]=E,t[15]=M,t},e.identity=i,e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],s=e[6],u=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=i,t[13]=u,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=e[9],l=e[10],m=e[11],d=e[12],E=e[13],M=e[14],_=e[15],v=n*o-r*u,p=n*a-i*u,T=n*c-s*u,R=r*a-i*o,A=r*c-s*o,S=i*c-s*a,g=f*E-h*d,N=f*M-l*d,y=f*_-m*d,O=h*M-l*E,L=h*_-m*E,P=l*_-m*M,I=v*P-p*L+T*O+R*y-A*N+S*g;return I?(I=1/I,t[0]=(o*P-a*L+c*O)*I,t[1]=(i*L-r*P-s*O)*I,t[2]=(E*S-M*A+_*R)*I,t[3]=(l*A-h*S-m*R)*I,t[4]=(a*y-u*P-c*N)*I,t[5]=(n*P-i*y+s*N)*I,t[6]=(M*T-d*S-_*p)*I,t[7]=(f*S-l*T+m*p)*I,t[8]=(u*L-o*y+c*g)*I,t[9]=(r*y-n*L-s*g)*I,t[10]=(d*A-E*T+_*v)*I,t[11]=(h*T-f*A-m*v)*I,t[12]=(o*N-u*O-a*g)*I,t[13]=(n*O-r*N+i*g)*I,t[14]=(E*p-d*R-M*v)*I,t[15]=(f*R-h*p+l*v)*I,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=e[9],l=e[10],m=e[11],d=e[12],E=e[13],M=e[14],_=e[15];return t[0]=o*(l*_-m*M)-h*(a*_-c*M)+E*(a*m-c*l),t[1]=-(r*(l*_-m*M)-h*(i*_-s*M)+E*(i*m-s*l)),t[2]=r*(a*_-c*M)-o*(i*_-s*M)+E*(i*c-s*a),t[3]=-(r*(a*m-c*l)-o*(i*m-s*l)+h*(i*c-s*a)),t[4]=-(u*(l*_-m*M)-f*(a*_-c*M)+d*(a*m-c*l)),t[5]=n*(l*_-m*M)-f*(i*_-s*M)+d*(i*m-s*l),t[6]=-(n*(a*_-c*M)-u*(i*_-s*M)+d*(i*c-s*a)),t[7]=n*(a*m-c*l)-u*(i*m-s*l)+f*(i*c-s*a),t[8]=u*(h*_-m*E)-f*(o*_-c*E)+d*(o*m-c*h),t[9]=-(n*(h*_-m*E)-f*(r*_-s*E)+d*(r*m-s*h)),t[10]=n*(o*_-c*E)-u*(r*_-s*E)+d*(r*c-s*o),t[11]=-(n*(o*m-c*h)-u*(r*m-s*h)+f*(r*c-s*o)),t[12]=-(u*(h*M-l*E)-f*(o*M-a*E)+d*(o*l-a*h)),t[13]=n*(h*M-l*E)-f*(r*M-i*E)+d*(r*l-i*h),t[14]=-(n*(o*M-a*E)-u*(r*M-i*E)+d*(r*a-i*o)),t[15]=n*(o*l-a*h)-u*(r*l-i*h)+f*(r*a-i*o),t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],u=t[5],o=t[6],a=t[7],c=t[8],f=t[9],h=t[10],l=t[11],m=t[12],d=t[13],E=t[14],M=t[15];return(e*u-n*s)*(h*M-l*E)-(e*o-r*s)*(f*M-l*d)+(e*a-i*s)*(f*E-h*d)+(n*o-r*u)*(c*M-l*m)-(n*a-i*u)*(c*E-h*m)+(r*a-i*o)*(c*d-f*m)},e.multiply=s,e.translate=function(t,e,n){var r=n[0],i=n[1],s=n[2],u=void 0,o=void 0,a=void 0,c=void 0,f=void 0,h=void 0,l=void 0,m=void 0,d=void 0,E=void 0,M=void 0,_=void 0;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*s+e[12],t[13]=e[1]*r+e[5]*i+e[9]*s+e[13],t[14]=e[2]*r+e[6]*i+e[10]*s+e[14],t[15]=e[3]*r+e[7]*i+e[11]*s+e[15]):(u=e[0],o=e[1],a=e[2],c=e[3],f=e[4],h=e[5],l=e[6],m=e[7],d=e[8],E=e[9],M=e[10],_=e[11],t[0]=u,t[1]=o,t[2]=a,t[3]=c,t[4]=f,t[5]=h,t[6]=l,t[7]=m,t[8]=d,t[9]=E,t[10]=M,t[11]=_,t[12]=u*r+f*i+d*s+e[12],t[13]=o*r+h*i+E*s+e[13],t[14]=a*r+l*i+M*s+e[14],t[15]=c*r+m*i+_*s+e[15]),t},e.scale=function(t,e,n){var r=n[0],i=n[1],s=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.rotate=function(t,e,n,i){var s,u,o,a,c,f,h,l,m,d,E,M,_,v,p,T,R,A,S,g,N,y,O,L,P=i[0],I=i[1],b=i[2],C=Math.sqrt(P*P+I*I+b*b);return C0?(n[0]=2*(c*a+l*i+f*o-h*s)/m,n[1]=2*(f*a+l*s+h*i-c*o)/m,n[2]=2*(h*a+l*o+c*s-f*i)/m):(n[0]=2*(c*a+l*i+f*o-h*s),n[1]=2*(f*a+l*s+h*i-c*o),n[2]=2*(h*a+l*o+c*s-f*i)),u(t,e,n),t},e.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},e.getScaling=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[4],u=e[5],o=e[6],a=e[8],c=e[9],f=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(s*s+u*u+o*o),t[2]=Math.sqrt(a*a+c*c+f*f),t},e.getRotation=function(t,e){var n=e[0]+e[5]+e[10],r=0;return n>0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},e.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],s=e[1],u=e[2],o=e[3],a=i+i,c=s+s,f=u+u,h=i*a,l=i*c,m=i*f,d=s*c,E=s*f,M=u*f,_=o*a,v=o*c,p=o*f,T=r[0],R=r[1],A=r[2];return t[0]=(1-(d+M))*T,t[1]=(l+p)*T,t[2]=(m-v)*T,t[3]=0,t[4]=(l-p)*R,t[5]=(1-(h+M))*R,t[6]=(E+_)*R,t[7]=0,t[8]=(m+v)*A,t[9]=(E-_)*A,t[10]=(1-(h+d))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var s=e[0],u=e[1],o=e[2],a=e[3],c=s+s,f=u+u,h=o+o,l=s*c,m=s*f,d=s*h,E=u*f,M=u*h,_=o*h,v=a*c,p=a*f,T=a*h,R=r[0],A=r[1],S=r[2],g=i[0],N=i[1],y=i[2],O=(1-(E+_))*R,L=(m+T)*R,P=(d-p)*R,I=(m-T)*A,b=(1-(l+_))*A,C=(M+v)*A,D=(d+p)*S,U=(M-v)*S,B=(1-(l+E))*S;return t[0]=O,t[1]=L,t[2]=P,t[3]=0,t[4]=I,t[5]=b,t[6]=C,t[7]=0,t[8]=D,t[9]=U,t[10]=B,t[11]=0,t[12]=n[0]+g-(O*g+I*N+D*y),t[13]=n[1]+N-(L*g+b*N+U*y),t[14]=n[2]+y-(P*g+C*N+B*y),t[15]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n+n,o=r+r,a=i+i,c=n*u,f=r*u,h=r*o,l=i*u,m=i*o,d=i*a,E=s*u,M=s*o,_=s*a;return t[0]=1-h-d,t[1]=f+_,t[2]=l-M,t[3]=0,t[4]=f-_,t[5]=1-c-d,t[6]=m+E,t[7]=0,t[8]=l+M,t[9]=m-E,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,e,n,r,i,s,u){var o=1/(n-e),a=1/(i-r),c=1/(s-u);return t[0]=2*s*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*a,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*a,t[10]=(u+s)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=u*s*2*c,t[15]=0,t},e.perspective=function(t,e,n,r,i){var s=1/Math.tan(e/2),u=void 0;return t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(u=1/(r-i),t[10]=(i+r)*u,t[14]=2*i*r*u):(t[10]=-1,t[14]=-2*r),t},e.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),u=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),a=2/(u+o),c=2/(i+s);return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(u-o)*a*.5,t[9]=(i-s)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},e.ortho=function(t,e,n,r,i,s,u){var o=1/(e-n),a=1/(r-i),c=1/(s-u);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*a,t[14]=(u+s)*c,t[15]=1,t},e.lookAt=function(t,e,n,s){var u=void 0,o=void 0,a=void 0,c=void 0,f=void 0,h=void 0,l=void 0,m=void 0,d=void 0,E=void 0,M=e[0],_=e[1],v=e[2],p=s[0],T=s[1],R=s[2],A=n[0],S=n[1],g=n[2];return Math.abs(M-A)0&&(f*=m=1/Math.sqrt(m),h*=m,l*=m);var d=a*l-c*h,E=c*f-o*l,M=o*h-a*f;return(m=d*d+E*E+M*M)>0&&(d*=m=1/Math.sqrt(m),E*=m,M*=m),t[0]=d,t[1]=E,t[2]=M,t[3]=0,t[4]=h*M-l*E,t[5]=l*d-f*M,t[6]=f*E-h*d,t[7]=0,t[8]=f,t[9]=h,t[10]=l,t[11]=0,t[12]=i,t[13]=s,t[14]=u,t[15]=1,t},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},e.subtract=o,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=t[6],f=t[7],h=t[8],l=t[9],m=t[10],d=t[11],E=t[12],M=t[13],_=t[14],v=t[15],p=e[0],T=e[1],R=e[2],A=e[3],S=e[4],g=e[5],N=e[6],y=e[7],O=e[8],L=e[9],P=e[10],I=e[11],b=e[12],C=e[13],D=e[14],U=e[15];return Math.abs(n-p)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(s-R)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(u-A)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(o-S)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-g)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(c-N)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(N))&&Math.abs(f-y)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(y))&&Math.abs(h-O)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(l-L)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(m-P)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(d-I)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(E-b)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(b))&&Math.abs(M-C)<=r.EPSILON*Math.max(1,Math.abs(M),Math.abs(C))&&Math.abs(_-D)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))&&Math.abs(v-U)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(U))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function s(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=e[9],m=e[10],d=e[11],E=e[12],M=e[13],_=e[14],v=e[15],p=n[0],T=n[1],R=n[2],A=n[3];return t[0]=p*r+T*o+R*h+A*E,t[1]=p*i+T*a+R*l+A*M,t[2]=p*s+T*c+R*m+A*_,t[3]=p*u+T*f+R*d+A*v,p=n[4],T=n[5],R=n[6],A=n[7],t[4]=p*r+T*o+R*h+A*E,t[5]=p*i+T*a+R*l+A*M,t[6]=p*s+T*c+R*m+A*_,t[7]=p*u+T*f+R*d+A*v,p=n[8],T=n[9],R=n[10],A=n[11],t[8]=p*r+T*o+R*h+A*E,t[9]=p*i+T*a+R*l+A*M,t[10]=p*s+T*c+R*m+A*_,t[11]=p*u+T*f+R*d+A*v,p=n[12],T=n[13],R=n[14],A=n[15],t[12]=p*r+T*o+R*h+A*E,t[13]=p*i+T*a+R*l+A*M,t[14]=p*s+T*c+R*m+A*_,t[15]=p*u+T*f+R*d+A*v,t}function u(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=r+r,a=i+i,c=s+s,f=r*o,h=r*a,l=r*c,m=i*a,d=i*c,E=s*c,M=u*o,_=u*a,v=u*c;return t[0]=1-(m+E),t[1]=h+v,t[2]=l-_,t[3]=0,t[4]=h-v,t[5]=1-(f+E),t[6]=d+M,t[7]=0,t[8]=l+_,t[9]=d-M,t[10]=1-(f+m),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}e.mul=s,e.sub=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},e.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},e.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromValues=function(t,e,n,i,s,u,o,a,c){var f=new r.ARRAY_TYPE(9);return f[0]=t,f[1]=e,f[2]=n,f[3]=i,f[4]=s,f[5]=u,f[6]=o,f[7]=a,f[8]=c,f},e.set=function(t,e,n,r,i,s,u,o,a,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=u,t[6]=o,t[7]=a,t[8]=c,t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else 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];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=f*u-o*c,l=-f*s+o*a,m=c*s-u*a,d=n*h+r*l+i*m;return d?(d=1/d,t[0]=h*d,t[1]=(-f*r+i*c)*d,t[2]=(o*r-i*u)*d,t[3]=l*d,t[4]=(f*n-i*a)*d,t[5]=(-o*n+i*s)*d,t[6]=m*d,t[7]=(-c*n+r*a)*d,t[8]=(u*n-r*s)*d,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8];return t[0]=u*f-o*c,t[1]=i*c-r*f,t[2]=r*o-i*u,t[3]=o*a-s*f,t[4]=n*f-i*a,t[5]=i*s-n*o,t[6]=s*c-u*a,t[7]=r*a-n*c,t[8]=n*u-r*s,t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],u=t[5],o=t[6],a=t[7],c=t[8];return e*(c*s-u*a)+n*(-c*i+u*o)+r*(a*i-s*o)},e.multiply=i,e.translate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=n[0],m=n[1];return t[0]=r,t[1]=i,t[2]=s,t[3]=u,t[4]=o,t[5]=a,t[6]=l*r+m*u+c,t[7]=l*i+m*o+f,t[8]=l*s+m*a+h,t},e.rotate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=Math.sin(n),m=Math.cos(n);return t[0]=m*r+l*u,t[1]=m*i+l*o,t[2]=m*s+l*a,t[3]=m*u-l*r,t[4]=m*o-l*i,t[5]=m*a-l*s,t[6]=c,t[7]=f,t[8]=h,t},e.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n+n,o=r+r,a=i+i,c=n*u,f=r*u,h=r*o,l=i*u,m=i*o,d=i*a,E=s*u,M=s*o,_=s*a;return t[0]=1-h-d,t[3]=f-_,t[6]=l+M,t[1]=f+_,t[4]=1-c-d,t[7]=m-E,t[2]=l-M,t[5]=m+E,t[8]=1-c-h,t},e.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=e[9],l=e[10],m=e[11],d=e[12],E=e[13],M=e[14],_=e[15],v=n*o-r*u,p=n*a-i*u,T=n*c-s*u,R=r*a-i*o,A=r*c-s*o,S=i*c-s*a,g=f*E-h*d,N=f*M-l*d,y=f*_-m*d,O=h*M-l*E,L=h*_-m*E,P=l*_-m*M,I=v*P-p*L+T*O+R*y-A*N+S*g;return I?(I=1/I,t[0]=(o*P-a*L+c*O)*I,t[1]=(a*y-u*P-c*N)*I,t[2]=(u*L-o*y+c*g)*I,t[3]=(i*L-r*P-s*O)*I,t[4]=(n*P-i*y+s*N)*I,t[5]=(r*y-n*L-s*g)*I,t[6]=(E*S-M*A+_*R)*I,t[7]=(M*T-d*S-_*p)*I,t[8]=(d*A-E*T+_*v)*I,t):null},e.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},e.subtract=s,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=t[6],f=t[7],h=t[8],l=e[0],m=e[1],d=e[2],E=e[3],M=e[4],_=e[5],v=e[6],p=e[7],T=e[8];return Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-m)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(s-d)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(u-E)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(o-M)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(a-_)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(c-v)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(f-p)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(p))&&Math.abs(h-T)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(T))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=n[0],m=n[1],d=n[2],E=n[3],M=n[4],_=n[5],v=n[6],p=n[7],T=n[8];return t[0]=l*r+m*u+d*c,t[1]=l*i+m*o+d*f,t[2]=l*s+m*a+d*h,t[3]=E*r+M*u+_*c,t[4]=E*i+M*o+_*f,t[5]=E*s+M*a+_*h,t[6]=v*r+p*u+T*c,t[7]=v*i+p*o+T*f,t[8]=v*s+p*a+T*h,t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}e.mul=i,e.sub=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.sqrDist=e.dist=e.div=e.mul=e.sub=e.len=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},e.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},e.set=function(t,e,n){return t[0]=e,t[1]=n,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},e.subtract=s,e.multiply=u,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},e.distance=a,e.squaredDistance=c,e.length=f,e.squaredLength=h,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},e.lerp=function(t,e,n,r){var i=e[0],s=e[1];return t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t},e.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},e.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},e.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},e.rotate=function(t,e,n,r){var i=e[0]-n[0],s=e[1]-n[1],u=Math.sin(r),o=Math.cos(r);return t[0]=i*o-s*u+n[0],t[1]=i*u+s*o+n[1],t},e.angle=function(t,e){var n=t[0],r=t[1],i=e[0],s=e[1],u=n*n+r*r;u>0&&(u=1/Math.sqrt(u));var o=i*i+s*s;o>0&&(o=1/Math.sqrt(o));var a=(n*i+r*s)*u*o;return a>1?0:a<-1?Math.PI:Math.acos(a)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],s=e[0],u=e[1];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function a(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function f(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function h(t){var e=t[0],n=t[1];return e*e+n*n}e.len=f,e.sub=s,e.mul=u,e.div=o,e.dist=a,e.sqrDist=c,e.sqrLen=h,e.forEach=function(){var t=i();return function(e,n,r,i,s,u){var o,a=void 0;for(n||(n=2),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,a=r;a0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,s=e[2]/n,u=e[3]/n,o=e[4],a=e[5],c=e[6],f=e[7],h=r*o+i*a+s*c+u*f;t[0]=r,t[1]=i,t[2]=s,t[3]=u,t[4]=(o-r*h)/n,t[5]=(a-i*h)/n,t[6]=(c-s*h)/n,t[7]=(f-u*h)/n}return t},e.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=t[6],f=t[7],h=e[0],l=e[1],m=e[2],d=e[3],E=e[4],M=e[5],_=e[6],v=e[7];return Math.abs(n-h)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-m)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(u-d)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(d))&&Math.abs(o-E)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(a-M)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(c-_)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(f-v)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(v))};var r=u(n(0)),i=u(n(3)),s=u(n(4));function u(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e,n){var r=.5*n[0],i=.5*n[1],s=.5*n[2],u=e[0],o=e[1],a=e[2],c=e[3];return t[0]=u,t[1]=o,t[2]=a,t[3]=c,t[4]=r*c+i*a-s*o,t[5]=i*c+s*u-r*a,t[6]=s*c+r*o-i*u,t[7]=-r*u-i*o-s*a,t}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[4],a=n[5],c=n[6],f=n[7],h=e[4],l=e[5],m=e[6],d=e[7],E=n[0],M=n[1],_=n[2],v=n[3];return t[0]=r*v+u*E+i*_-s*M,t[1]=i*v+u*M+s*E-r*_,t[2]=s*v+u*_+r*M-i*E,t[3]=u*v-r*E-i*M-s*_,t[4]=r*f+u*o+i*c-s*a+h*v+d*E+l*_-m*M,t[5]=i*f+u*a+s*o-r*c+l*v+d*M+m*E-h*_,t[6]=s*f+u*c+r*a-i*o+m*v+d*_+h*M-l*E,t[7]=u*f-r*o-i*a-s*c+d*v-h*E-l*M-m*_,t}e.getReal=i.copy,e.setReal=i.copy,e.mul=c;var f=e.dot=i.dot,h=e.length=i.length,l=(e.len=h,e.squaredLength=i.squaredLength);e.sqrLen=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.fromValues=function(t,e,n,i,s,u){var o=new r.ARRAY_TYPE(6);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o[4]=s,o[5]=u,o},e.set=function(t,e,n,r,i,s,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=u,t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=n*s-r*i;return a?(a=1/a,t[0]=s*a,t[1]=-r*a,t[2]=-i*a,t[3]=n*a,t[4]=(i*o-s*u)*a,t[5]=(r*u-n*o)*a,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=Math.sin(n),f=Math.cos(n);return t[0]=r*f+s*c,t[1]=i*f+u*c,t[2]=r*-c+s*f,t[3]=i*-c+u*f,t[4]=o,t[5]=a,t},e.scale=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=n[0],f=n[1];return t[0]=r*c,t[1]=i*c,t[2]=s*f,t[3]=u*f,t[4]=o,t[5]=a,t},e.translate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=n[0],f=n[1];return t[0]=r,t[1]=i,t[2]=s,t[3]=u,t[4]=r*c+s*f+o,t[5]=i*c+u*f+a,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},e.subtract=s,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=e[0],f=e[1],h=e[2],l=e[3],m=e[4],d=e[5];return Math.abs(n-c)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-f)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(u-l)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(l))&&Math.abs(o-m)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=n[0],f=n[1],h=n[2],l=n[3],m=n[4],d=n[5];return t[0]=r*c+s*f,t[1]=i*c+u*f,t[2]=r*h+s*l,t[3]=i*h+u*l,t[4]=r*m+s*d+o,t[5]=i*m+u*d+a,t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}e.mul=i,e.sub=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.fromValues=function(t,e,n,i){var s=new r.ARRAY_TYPE(4);return s[0]=t,s[1]=e,s[2]=n,s[3]=i,s},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n*s-i*r;return u?(u=1/u,t[0]=s*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t):null},e.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a+s*o,t[1]=i*a+u*o,t[2]=r*-o+s*a,t[3]=i*-o+u*a,t},e.scale=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[0],a=n[1];return t[0]=r*o,t[1]=i*o,t[2]=s*a,t[3]=u*a,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=s,e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=e[0],a=e[1],c=e[2],f=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(s-c)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(u-f)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(f))},e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[0],a=n[1],c=n[2],f=n[3];return t[0]=r*o+s*a,t[1]=i*o+u*a,t[2]=r*c+s*f,t[3]=i*c+u*f,t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}e.mul=i,e.sub=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.vec4=e.vec3=e.vec2=e.quat2=e.quat=e.mat4=e.mat3=e.mat2d=e.mat2=e.glMatrix=void 0;var r=m(n(0)),i=m(n(9)),s=m(n(8)),u=m(n(5)),o=m(n(4)),a=m(n(3)),c=m(n(7)),f=m(n(6)),h=m(n(2)),l=m(n(1));function m(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.glMatrix=r,e.mat2=i,e.mat2d=s,e.mat3=u,e.mat4=o,e.quat=a,e.quat2=c,e.vec2=f,e.vec3=h,e.vec4=l}])},function(t,e,n){"use strict";var r=function(){var t,e;try{t=Object.defineProperty,e=Object.defineProperties,t({},"$",{value:0})}catch(n){"__defineGetter__"in Object&&(t=function(t,e,n){return"value"in n&&(t[e]=n.value),"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),t},e=function(e,n){for(var r in n)n.hasOwnProperty(r)&&t(e,r,n[r]);return e})}var n=function(t){for(var n=1,r=arguments.length;n>1,u=n(t[s],e);if(0===u)return[s,s];u<0?r=s+1:i=s-1}return r>i?[i,r]:[r,i]}function v(t,e,n){var r=_(t,e,n);t.splice(r[1],0,e)}function p(t,e,n){return e<=t.length?t:new Array(e-t.length+1).join(n||"0")+t}function T(t){return t instanceof Float32Array?l:t instanceof Int8Array?o:t instanceof Uint8Array?a:t instanceof Int16Array?c:t instanceof Uint16Array?f:t instanceof Uint32Array?h:l}var R,A,S=(s(R={},o,Int8Array),s(R,a,Uint8Array),s(R,c,Int16Array),s(R,f,Uint16Array),s(R,h,Uint32Array),s(R,l,Float32Array),A=R,function(t){return A[t]||Float32Array});function g(t,e,n,r,i){if(t&&e){e.isGeometryData&&(e=e.data);for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return Array.isArray(t)||(t=Object.values(t)),t.reduce((function(t,n,r){return t.then((function(){return e(n,r)}))}),Promise.resolve())}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector3",isVector3:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec3.round(this.elements,this.elements),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this},hermite:function(t,e,n,i,s){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,s),this},bezier:function(t,e,n,i,s){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,s),this},random:function(t){return r.vec3.random(this.elements,t),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],s=e[2];return e[0]=r*n[0]+i*n[4]+s*n[8],e[1]=r*n[1]+i*n[5]+s*n[9],e[2]=r*n[2]+i*n[6]+s*n[10],this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r,i={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r=0,function(t){var e=++r;return t?e=t+"_"+e:e+="",e}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},degToRad:function(t){return t*this.DEG2RAD},radToDeg:function(t){return t*this.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};e.a=i},function(t,e,n){"use strict";var r,i=n(0),s=n(1),u=n(5),o=n(10),a=new u.a,c=new u.a,f=s.a.create({className:"Matrix4",isMatrix4:!0,constructor:function(){this.elements=i.mat4.create()},copy:function(t){return i.mat4.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return i.mat4.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this},set:function(t,e,n,r,s,u,o,a,c,f,h,l,m,d,E,M){return i.mat4.set(this.elements,t,e,n,r,s,u,o,a,c,f,h,l,m,d,E,M),this},identity:function(){return i.mat4.identity(this.elements),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new u.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new u.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this},fromRotationTranslationScaleOrigin:function(t,e,n,r){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this},frustum:function(t,e,n,r,s,u){return i.mat4.frustum(this.elements,t,e,n,r,s,u),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this},ortho:function(t,e,n,r,s,u){return i.mat4.ortho(this.elements,t,e,n,r,s,u),this},lookAt:function(t,e,n){return t.isVector3||(t=a.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this},targetTo:function(t,e,n){t.isVector3||(t=a.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],s=t[1],u=t[2],o=n[0],f=n[1],h=n[2],l=i-e[0],m=s-e[1],d=u-e[2],E=l*l+m*m+d*d;E>0?(l*=E=1/Math.sqrt(E),m*=E,d*=E):d=1;var M=f*d-h*m,_=h*l-o*d,v=o*m-f*l;return(E=M*M+_*_+v*v)>0?(M*=E=1/Math.sqrt(E),_*=E,v*=E):(E=(M=f*d-h*m)*M+(_=h*l-(o+=1e-7)*d)*_+(v=o*m-f*l)*v,M*=E=1/Math.sqrt(E),_*=E,v*=E),r[0]=M,r[1]=_,r[2]=v,r[3]=0,r[4]=m*v-d*_,r[5]=d*M-l*v,r[6]=l*_-m*M,r[7]=0,r[8]=l,r[9]=m,r[10]=d,r[11]=0,r[12]=i,r[13]=s,r[14]=u,r[15]=1,this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new f),this.determinant()<0&&(n.x*=-1),r.copy(this),a.inverse(n),r.scale(a),t.fromMat4(r),i&&i.set(0,0,0),this}});f.prototype.sub=f.prototype.subtract,f.prototype.mul=f.prototype.multiply,e.a=f},function(t,e,n){"use strict";var r=n(1),i=n(12),s=n(4),u=r.a.create({Extends:i.a,className:"Color",isColor:!0,r:{get:function(){return this.x},set:function(t){this.x=t}},g:{get:function(){return this.y},set:function(t){this.y=t}},b:{get:function(){return this.z},set:function(t){this.z=t}},a:{get:function(){return this.w},set:function(t){this.w=t}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;u.superclass.constructor.call(this,t,e,n,r)},toRGBArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t},fromUintArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e]/255,this.elements[1]=t[e+1]/255,this.elements[2]=t[e+2]/255,this.elements[3]=t[e+3]/255,this},fromHEX:function(t){return"number"==typeof t?t=Object(s.padLeft)(t.toString(16),6):("#"===t[0]&&(t=t.slice(1)),3===t.length&&(t=t.replace(/(\w)/g,"$1$1"))),this.elements[0]=parseInt(t.slice(0,2),16)/255,this.elements[1]=parseInt(t.slice(2,4),16)/255,this.elements[2]=parseInt(t.slice(4,6),16)/255,this},toHEX:function(){for(var t="",e=0;e<3;e++)t+=Object(s.padLeft)(Math.floor(255*this.elements[e]).toString(16),2);return t}});e.a=u},function(t,e,n){"use strict";var r=n(1).a.create({constructor:function(t,e,n){this.type=t,this.target=e,this.detail=n,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),i={_listeners:null,on:function(t,e,n){for(var r=this._listeners=this._listeners||{},i=r[t]=r[t]||[],s=0,u=i.length;s0){if(1===arguments.length)return delete this._listeners[t],this;for(var r=0,i=n.length;r0){var o=u.slice(0);if((n=n||new r(i,this,e))._stopped)return!1;for(var a=0;a-1&&u.splice(f,1)}}return!0}return!1}};e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(11),s=n(1),u=n(9),o=new i.a,a=s.a.create({Mixes:u.a,className:"Quaternion",isQuaternion:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.elements=r.quat.fromValues(t,e,n,i)},copy:function(t,e){return r.quat.copy(this.elements,t.elements),e||this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=this.elements;return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n||this.fire("update"),this},set:function(t,e,n,i,s){return r.quat.set(this.elements,t,e,n,i),s||this.fire("update"),this},identity:function(t){return r.quat.identity(this.elements),t||this.fire("update"),this},rotationTo:function(t,e,n){return r.quat.rotationTo(this.elements,t.elements,e.elements),n||this.fire("update"),this},setAxes:function(t,e,n,i){return r.quat.setAxes(this.elements,t.elements,e.elements,n.elements),i||this.fire("update"),this},setAxisAngle:function(t,e,n){return r.quat.setAxisAngle(this.elements,t.elements,e),n||this.fire("update"),this},getAxisAngle:function(t){return r.quat.getAxisAngle(t.elements,this.elements)},add:function(t,e){return r.quat.add(this.elements,this.elements,t.elements),e||this.fire("update"),this},multiply:function(t,e){return r.quat.multiply(this.elements,this.elements,t.elements),e||this.fire("update"),this},premultiply:function(t,e){return r.quat.multiply(this.elements,t.elements,this.elements),e||this.fire("update"),this},scale:function(t,e){return r.quat.scale(this.elements,this.elements,t),e||this.fire("update"),this},rotateX:function(t,e){return r.quat.rotateX(this.elements,this.elements,t),e||this.fire("update"),this},rotateY:function(t,e){return r.quat.rotateY(this.elements,this.elements,t),e||this.fire("update"),this},rotateZ:function(t,e){return r.quat.rotateZ(this.elements,this.elements,t),e||this.fire("update"),this},calculateW:function(t){return r.quat.calculateW(this.elements,this.elements),t||this.fire("update"),this},dot:function(t){return r.quat.dot(this.elements,t.elements)},lerp:function(t,e,n){return r.quat.lerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},slerp:function(t,e,n){return r.quat.slerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},sqlerp:function(t,e,n,i,s,u){return r.quat.sqlerp(this.elements,t.elements,e.elements,n.elements,i.elements,s),u||this.fire("update"),this},invert:function(t){return r.quat.invert(this.elements,this.elements),t||this.fire("update"),this},conjugate:function(t){return r.quat.conjugate(this.elements,this.elements),t||this.fire("update"),this},length:function(){return r.quat.length(this.elements)},squaredLength:function(){return r.quat.squaredLength(this.elements)},normalize:function(t){return r.quat.normalize(this.elements,this.elements),t||this.fire("update"),this},fromMat3:function(t,e){return r.quat.fromMat3(this.elements,t.elements),e||this.fire("update"),this},fromMat4:function(t,e){return o.fromMat4(t),this.fromMat3(o,e),this},exactEquals:function(t){return r.quat.exactEquals(this.elements,t.elements)},equals:function(t){return r.quat.equals(this.elements,t.elements)},fromEuler:function(t,e){var n=.5*t.x,r=.5*t.y,i=.5*t.z,s=t.order||"ZYX",u=Math.sin(n),o=Math.cos(n),a=Math.sin(r),c=Math.cos(r),f=Math.sin(i),h=Math.cos(i),l=this.elements;return"XYZ"===s?(l[0]=u*c*h+o*a*f,l[1]=o*a*h-u*c*f,l[2]=o*c*f+u*a*h,l[3]=o*c*h-u*a*f):"YXZ"===s?(l[0]=u*c*h+o*a*f,l[1]=o*a*h-u*c*f,l[2]=o*c*f-u*a*h,l[3]=o*c*h+u*a*f):"ZXY"===s?(l[0]=u*c*h-o*a*f,l[1]=o*a*h+u*c*f,l[2]=o*c*f+u*a*h,l[3]=o*c*h-u*a*f):"ZYX"===s?(l[0]=u*c*h-o*a*f,l[1]=o*a*h+u*c*f,l[2]=o*c*f-u*a*h,l[3]=o*c*h+u*a*f):"YZX"===s?(l[0]=u*c*h+o*a*f,l[1]=o*a*h+u*c*f,l[2]=o*c*f-u*a*h,l[3]=o*c*h-u*a*f):"XZY"===s&&(l[0]=u*c*h-o*a*f,l[1]=o*a*h-u*c*f,l[2]=o*c*f+u*a*h,l[3]=o*c*h+u*a*f),e||this.fire("update"),this},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t,this.fire("update")}}});a.prototype.mul=a.prototype.multiply,a.prototype.len=a.prototype.length,a.prototype.sqrLen=a.prototype.squaredLength,e.a=a},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Matrix3",isMatrix3:!0,constructor:function(){this.elements=r.mat3.create()},copy:function(t){return r.mat3.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return r.mat3.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)n[r]=t[e+r];return this},set:function(t,e,n,i,s,u,o,a,c){return r.mat3.set(this.elements,t,e,n,i,s,u,o,a,c),this},identity:function(){return r.mat3.identity(this.elements),this},transpose:function(){return r.mat3.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.adjoint(this.elements,t.elements),this},determinant:function(){return r.mat3.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),r.mat3.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return r.mat3.translate(this.elements,this.elements,t.elements),this},rotate:function(t){return r.mat3.rotate(this.elements,this.elements,t),this},scale:function(t){return r.mat3.scale(this.elements,this.elements,t.elements),this},fromTranslation:function(t){return r.mat3.fromTranslation(this.elements,t.elements),this},fromRotation:function(t){return r.mat3.fromRotation(this.elements,t),this},fromScaling:function(t){return r.mat3.fromScaling(this.elements,t.elements),this},fromQuat:function(t){return r.mat3.fromQuat(this.elements,t.elements),this},normalFromMat4:function(t){return r.mat3.normalFromMat4(this.elements,t.elements),this},fromMat4:function(t){return r.mat3.fromMat4(this.elements,t.elements),this},frob:function(){return r.mat3.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),r.mat3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.mat3.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.mat3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.mat3.equals(t.elements,e.elements)},fromRotationTranslationScale:function(t,e,n,r,i){var s=Math.cos(t),u=Math.sin(t);return this.set(r*s,-i*u,0,r*u,i*s,0,e,n,1),this}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector4",isVector4:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.elements=r.vec4.fromValues(t,e,n,i)},copy:function(t){return r.vec4.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t[3+e]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],this},set:function(t,e,n,i){return r.vec4.set(this.elements,t,e,n,i),this},add:function(t,e){return e||(e=t,t=this),r.vec4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec4.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec4.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec4.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec4.ceil(this.elements,this.elements),this},floor:function(){return r.vec4.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec4.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec4.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec4.round(this.elements,this.elements),this},scale:function(t){return r.vec4.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec4.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec4.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec4.squaredDistance(t.elements,e.elements)},length:function(){return r.vec4.length(this.elements)},squaredLength:function(){return r.vec4.squaredLength(this.elements)},negate:function(){return r.vec4.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec4.inverse(this.elements,t.elements),this},normalize:function(){return r.vec4.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec4.dot(t.elements,e.elements)},lerp:function(t,e){return r.vec4.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return t=t||1,this.elements[0]=Math.random(),this.elements[1]=Math.random(),this.elements[2]=Math.random(),this.elements[3]=Math.random(),this.normalize(),this.scale(t),this},transformMat4:function(t){return r.vec4.transformMat4(this.elements,this.elements,t.elements),this},transformQuat:function(t){return r.vec4.transformQuat(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec4.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r=n(1),i=n(6),s=n(7),u=n(3),o=new s.a,a=i.a.DEG2RAD,c=i.a.RAD2DEG,f=r.a.create({className:"Euler",isEuler:!0,order:"ZYX",constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=new Float32Array([t,e,n]),this.updateDegrees()},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.elements[0]=t.x,this.elements[1]=t.y,this.elements[2]=t.z,this.order=t.order,this.updateDegrees(),this},set:function(t,e,n){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=n,this.updateDegrees(),this},setDegree:function(t,e,n){return this._degX=t,this._degY=e,this._degZ=n,this.updateRadians(),this},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e],this.elements[1]=t[e+1],this.elements[2]=t[e+2],this.updateDegrees(),this},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.elements[0],t[e+1]=this.elements[1],t[e+2]=this.elements[2],t},fromMat4:function(t,e){var n=t.elements,r=n[0],s=n[1],o=n[2],a=n[4],c=n[5],f=n[6],h=n[8],l=n[9],m=n[10];e=e||this.order,this.order=e;var d=i.a.clamp;return"XYZ"===e?(this.elements[1]=Math.asin(d(h,-1,1)),Math.abs(h)<.99999?(this.elements[0]=Math.atan2(-l,m),this.elements[2]=Math.atan2(-a,r)):(this.elements[0]=Math.atan2(f,c),this.elements[2]=0)):"YXZ"===e?(this.elements[0]=Math.asin(-d(l,-1,1)),Math.abs(l)<.99999?(this.elements[1]=Math.atan2(h,m),this.elements[2]=Math.atan2(s,c)):(this.elements[1]=Math.atan2(-o,r),this.elements[2]=0)):"ZXY"===e?(this.elements[0]=Math.asin(d(f,-1,1)),Math.abs(f)<.99999?(this.elements[1]=Math.atan2(-o,m),this.elements[2]=Math.atan2(-a,c)):(this.elements[1]=0,this.elements[2]=Math.atan2(s,r))):"ZYX"===e?(this.elements[1]=Math.asin(-d(o,-1,1)),Math.abs(o)<.99999?(this.elements[0]=Math.atan2(f,m),this.elements[2]=Math.atan2(s,r)):(this.elements[0]=0,this.elements[2]=Math.atan2(-a,c))):"YZX"===e?(this.elements[2]=Math.asin(d(s,-1,1)),Math.abs(s)<.99999?(this.elements[0]=Math.atan2(-l,c),this.elements[1]=Math.atan2(-o,r)):(this.elements[0]=0,this.elements[1]=Math.atan2(h,m))):"XZY"===e?(this.elements[2]=Math.asin(-d(a,-1,1)),Math.abs(a)<.99999?(this.elements[0]=Math.atan2(f,c),this.elements[1]=Math.atan2(h,r)):(this.elements[0]=Math.atan2(-l,m),this.elements[1]=0)):u.a.warn("Euler fromMat4() unsupported order: "+e),this.updateDegrees(),this},fromQuat:function(t,e){return o.fromQuat(t),this.fromMat4(o,e)},updateDegrees:function(){return this._degX=this.elements[0]*c,this._degY=this.elements[1]*c,this._degZ=this.elements[2]*c,this},updateRadians:function(){return this.elements[0]=this._degX*a,this.elements[1]=this._degY*a,this.elements[2]=this._degZ*a,this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*a}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*a}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*a}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*c}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*c}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*c}}});e.a=f},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector2",isVector2:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.elements=r.vec2.fromValues(t,e)},copy:function(t){return r.vec2.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],this},set:function(t,e){return r.vec2.set(this.elements,t,e),this},add:function(t,e){return e||(e=t,t=this),r.vec2.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec2.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec2.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec2.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec2.ceil(this.elements,this.elements),this},floor:function(){return r.vec2.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec2.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec2.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec2.round(this.elements,this.elements),this},scale:function(t){return r.vec2.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec2.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec2.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec2.squaredDistance(t.elements,e.elements)},length:function(){return r.vec2.length(this.elements)},squaredLength:function(){return r.vec2.squaredLength(this.elements)},negate:function(){return r.vec2.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec2.inverse(this.elements,t.elements),this},normalize:function(){return r.vec2.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec2.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec2.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec2.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return r.vec2.random(this.elements,t),this},transformMat3:function(t){return r.vec2.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec2.transformMat4(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec2.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec2.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},,function(t,e,n){"use strict";var r=n(34),i=n.n(r),s=n(1),u=n(5),o=s.a.create({className:"Ray",isRay:!0,origin:{get:function(){return this._origin},set:function(t){this._origin=t,this._ray.origin=t.elements}},direction:{get:function(){return this._direction},set:function(t){this._direction=t,this._ray.direction=t.elements}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._ray=new i.a,this.origin=t.origin||new u.a(0,0,0),this.direction=t.direction||new u.a(0,0,-1)},set:function(t,e){return this.origin=t,this.direction=e,this},copy:function(t){this.origin.copy(t.origin),this.direction.copy(t.direction)},clone:function(){return new this.constructor({origin:this.origin.clone(),direction:this.direction.clone()})},fromCamera:function(t,e,n,r,i){t.isPerspectiveCamera?(t.worldMatrix.getTranslation(this.origin),this.direction.set(e,n,0),this.direction.copy(t.unprojectVector(this.direction,r,i)),this.direction.sub(this.origin).normalize()):t.isOrthographicCamera&&(this.origin.set(e,n,(t.near+t.far)/(t.near-t.far)),this.origin.copy(t.unprojectVector(this.origin,r,i)),this.direction.set(0,0,-1).transformDirection(t.worldMatrix).normalize())},transformMat4:function(t){this.origin.transformMat4(t),this.direction.transformDirection(t).normalize()},sortPoints:function(t,e){var n=this;e?t.sort((function(t,r){return n.squaredDistance(t[e])-n.squaredDistance(r[e])})):t.sort((function(t,e){return n.squaredDistance(t)-n.squaredDistance(e)}))},squaredDistance:function(t){return this.origin.squaredDistance(t)},distance:function(t){return this.origin.distance(t)},intersectsSphere:function(t,e){var n=this._ray.intersectsSphere(t,e);return this._getRes(n)},intersectsPlane:function(t,e){var n=this._ray.intersectsPlane(t,e);return this._getRes(n)},intersectsTriangle:function(t){var e=this._ray.intersectsTriangle(t);return this._getRes(e)},intersectsBox:function(t){var e=this._ray.intersectsBox(t);return this._getRes(e)},intersectsTriangleCell:function(t,e){var n=this._ray.intersectsTriangleCell(t,e);return this._getRes(n)},_getRes:function(t){return t?new u.a(t[0],t[1],t[2]):null}});e.a=o},function(t,e,n){"use strict";var r=n(0),i=n(1),s=n(9),u=n(5),o=i.a.create({Mixes:s.a,Extends:u.a,className:"Vector3Notifier",isVector3Notifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this.fire("update"),this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this.fire("update"),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this.fire("update"),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this.fire("update"),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this.fire("update"),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this.fire("update"),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this.fire("update"),this},round:function(){return r.vec3.round(this.elements,this.elements),this.fire("update"),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this.fire("update"),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this.fire("update"),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this.fire("update"),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this.fire("update"),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this.fire("update"),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this.fire("update"),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this.fire("update"),this},hermite:function(t,e,n,i,s){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,s),this.fire("update"),this},bezier:function(t,e,n,i,s){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,s),this.fire("update"),this},random:function(t){return r.vec3.random(this.elements,t),this.fire("update"),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this.fire("update"),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this.fire("update"),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],s=e[2];return e[0]=r*n[0]+i*n[4]+s*n[8],e[1]=r*n[1]+i*n[5]+s*n[9],e[2]=r*n[2]+i*n[6]+s*n[10],this.fire("update"),this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this.fire("update"),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}}});e.a=o},,function(t,e,n){"use strict";var r=n(1),i=n(5),s=r.a.create({className:"Plane",isPlane:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=t,this.distance=e},copy:function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},clone:function(){return new this.constructor(this.normal.clone(),this.distance)},set:function(t,e,n,r){return this.normal.set(t,e,n),this.distance=r,this},normalize:function(){var t=1/this.normal.length();return this.normal.scale(t),this.distance*=t,this},distanceToPoint:function(t){return this.normal.dot(t)+this.distance},projectPoint:function(t){return(new i.a).copy(this.normal).scale(-this.distanceToPoint(t)).add(t)}});e.a=s},function(t,e,n){"use strict";var r=n(1),i=n(5),s=new i.a,u=r.a.create({className:"Sphere",isSphere:!0,radius:0,constructor:function(t){Object.assign(this,t),this.center||(this.center=new i.a(0,0,0))},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},fromPoints:function(t){for(var e=this.center,n=0,r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this.fire("update"),this},set:function(t,e,n,r,s,u,o,a,c,f,h,l,m,d,E,M){return i.mat4.set(this.elements,t,e,n,r,s,u,o,a,c,f,h,l,m,d,E,M),this.fire("update"),this},identity:function(){return i.mat4.identity(this.elements),this.fire("update"),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this.fire("update"),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this.fire("update"),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this.fire("update"),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},premultiply:function(t){return this.multiply(t,this),this.fire("update"),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this.fire("update"),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this.fire("update"),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this.fire("update"),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this.fire("update"),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this.fire("update"),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this.fire("update"),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this.fire("update"),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this.fire("update"),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this.fire("update"),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this.fire("update"),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this.fire("update"),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this.fire("update"),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this.fire("update"),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},fromRotationTranslationScaleOrigin:function(t,e,n,r,s){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),s||this.fire("update"),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this.fire("update"),this},frustum:function(t,e,n,r,s,u){return i.mat4.frustum(this.elements,t,e,n,r,s,u),this.fire("update"),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this.fire("update"),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this.fire("update"),this},ortho:function(t,e,n,r,s,u){return i.mat4.ortho(this.elements,t,e,n,r,s,u),this.fire("update"),this},lookAt:function(t,e,n){return t.isVector3||(t=f.set(t.x,t.y,t.z)),e.isVector3||(e=h.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this.fire("update"),this},targetTo:function(t,e,n){t.isVector3||(t=f.set(t.x,t.y,t.z)),e.isVector3||(e=h.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],s=t[1],u=t[2],o=n[0],a=n[1],c=n[2],l=i-e[0],m=s-e[1],d=u-e[2],E=l*l+m*m+d*d;E>0?(l*=E=1/Math.sqrt(E),m*=E,d*=E):d=1;var M=a*d-c*m,_=c*l-o*d,v=o*m-a*l;return(E=M*M+_*_+v*v)>0?(M*=E=1/Math.sqrt(E),_*=E,v*=E):(E=(M=a*d-c*m)*M+(_=c*l-(o+=1e-7)*d)*_+(v=o*m-a*l)*v,M*=E=1/Math.sqrt(E),_*=E,v*=E),r[0]=M,r[1]=_,r[2]=v,r[3]=0,r[4]=m*v-d*_,r[5]=d*M-l*v,r[6]=l*_-m*M,r[7]=0,r[8]=l,r[9]=m,r[10]=d,r[11]=0,r[12]=i,r[13]=s,r[14]=u,r[15]=1,this.fire("update"),this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new a.a),this.determinant()<0&&(n.x*=-1),r.copy(this),f.inverse(n),r.scale(f),t.fromMat4(r),i&&i.set(0,0,0),this}});e.a=l},function(t,e,n){"use strict";var r=n(1),i=n(9),s=n(6),u=n(13),o=s.a.DEG2RAD,a=s.a.RAD2DEG,c=r.a.create({Mixes:i.a,Extends:u.a,className:"EulerNotifier",isEulerNotifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;u.a.call(this,t,e,n)},updateDegrees:function(){return c.superclass.updateDegrees.call(this),this.fire("update"),this},updateRadians:function(){return c.superclass.updateRadians.call(this),this.fire("update"),this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*o,this.fire("update")}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*o,this.fire("update")}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*o,this.fire("update")}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*a,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*a,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*a,this.fire("update")}}});e.a=c},function(t,e,n){"use strict";var r=n(1),i=n(19),s=r.a.create({className:"Frustum",isFrustum:!0,constructor:function(){this.planes=[];for(var t=6;t--;)this.planes.push(new i.a)},copy:function(t){var e=t.planes;return this.planes.forEach((function(t,n){t.copy(e[n])})),this},clone:function(){var t=new this.constructor;return t.copy(this),t},fromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],u=n[3],o=n[4],a=n[5],c=n[6],f=n[7],h=n[8],l=n[9],m=n[10],d=n[11],E=n[12],M=n[13],_=n[14],v=n[15];return e[0].set(u-r,f-o,d-h,v-E).normalize(),e[1].set(u+r,f+o,d+h,v+E).normalize(),e[2].set(u+i,f+a,d+l,v+M).normalize(),e[3].set(u-i,f-a,d-l,v-M).normalize(),e[4].set(u-s,f-c,d-m,v-_).normalize(),e[5].set(u+s,f+c,d+m,v+_).normalize(),this},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)l)return null;r(f,a,u);var d=i(n,f);if(d<0||m+d>l)return null;var E=i(o,f)/l;return t[0]=e[0]+E*n[0],t[1]=e[1]+E*n[1],t[2]=e[2]+E*n[2],t}},function(t,e){t.exports=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=n[0],o=n[1],a=n[2];return t[0]=i*a-s*o,t[1]=s*u-r*a,t[2]=r*o-i*u,t}},function(t,e,n){var r=n(26),i=n(31),s=n(32),u=n(33);t.exports=function(t,e,n,a,c){var f=r(n,a);if(0!==f){var h=-(r(e,a)+c)/f;return h<0?null:(s(o,n,h),i(t,e,o))}return r(a,e)+c===0?u(t,e):null};var o=[0,0,0]},function(t,e,n){var r=n(92),i=n(26),s=n(30),u=n(93),o=n(32),a=n(31),c=[0,0,0];t.exports=function(t,e,n,f,h){s(c,f,e);var l=i(n,c);if(l<0)return null;u(c,e,n,l);var m=r(f,c),d=h*h;if(m>d)return null;return o(t,n,l-Math.sqrt(d-m)),a(t,t,e)}},function(t,e){t.exports=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}},function(t,e){t.exports=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}},function(t,e){function n(t,e,n){for(var r=t.length,i=-1/0,s=1/0,u=0;ua){var c=o;o=a,a=c}if(as)return 1/0;o>i&&(i=o),as?1/0:i}t.exports=function(t,e,r,i){var s=n(e,r,i);if(s===1/0)t=null;else{t=t||[];for(var u=0;u0&&(u=1/Math.sqrt(u),t[0]=n*u,t[1]=r*u,t[2]=i*u,t[3]=s*u),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},e.lerp=function(t,e,n,r){var i=e[0],s=e[1],u=e[2],o=e[3];return t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t[2]=u+r*(n[2]-u),t[3]=o+r*(n[3]-o),t},e.random=function(t,e){var n,i,s,u,o,a;e=e||1;do{o=(n=2*r.RANDOM()-1)*n+(i=2*r.RANDOM()-1)*i}while(o>=1);do{a=(s=2*r.RANDOM()-1)*s+(u=2*r.RANDOM()-1)*u}while(a>=1);var c=Math.sqrt((1-o)/a);return t[0]=e*n,t[1]=e*i,t[2]=e*s*c,t[3]=e*u*c,t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*u,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*u,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*u,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*u,t},e.transformQuat=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=n[0],o=n[1],a=n[2],c=n[3],f=c*r+o*s-a*i,h=c*i+a*r-u*s,l=c*s+u*i-o*r,m=-u*r-o*i-a*s;return t[0]=f*c+m*-u+h*-a-l*-o,t[1]=h*c+m*-o+l*-u-f*-a,t[2]=l*c+m*-a+f*-o-h*-u,t[3]=e[3],t},e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=e[0],a=e[1],c=e[2],f=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(s-c)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(u-f)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(f))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function a(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(n*n+r*r+i*i+s*s)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2],s=e[3]-t[3];return n*n+r*r+i*i+s*s}function f(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.sqrt(e*e+n*n+r*r+i*i)}function h(t){var e=t[0],n=t[1],r=t[2],i=t[3];return e*e+n*n+r*r+i*i}e.sub=s,e.mul=u,e.div=o,e.dist=a,e.sqrDist=c,e.len=f,e.sqrLen=h,e.forEach=function(){var t=i();return function(e,n,r,i,s,u){var o,a=void 0;for(n||(n=4),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,a=r;a1?0:i<-1?Math.PI:Math.acos(i)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=e[0],o=e[1],a=e[2];return Math.abs(n-u)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-o)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(s-a)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(a))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(3);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function s(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function u(t,e,n){var i=new r.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=n,i}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function a(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function c(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function f(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)}function h(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function l(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function m(t,e){var n=e[0],r=e[1],i=e[2],s=n*n+r*r+i*i;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s),t}function d(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}e.sub=o,e.mul=a,e.div=c,e.dist=f,e.sqrDist=h,e.len=s,e.sqrLen=l,e.forEach=function(){var t=i();return function(e,n,r,i,s,u){var o,a=void 0;for(n||(n=3),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,a=r;ar.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),n},e.multiply=f,e.rotateX=function(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a+u*o,t[1]=i*a+s*o,t[2]=s*a-i*o,t[3]=u*a-r*o,t},e.rotateY=function(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a-s*o,t[1]=i*a+u*o,t[2]=s*a+r*o,t[3]=u*a-i*o,t},e.rotateZ=function(t,e,n){n*=.5;var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a+i*o,t[1]=i*a-r*o,t[2]=s*a+u*o,t[3]=u*a-s*o,t},e.calculateW=function(t,e){var n=e[0],r=e[1],i=e[2];return t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i)),t},e.slerp=h,e.random=function(t){var e=r.RANDOM(),n=r.RANDOM(),i=r.RANDOM(),s=Math.sqrt(1-e),u=Math.sqrt(e);return t[0]=s*Math.sin(2*Math.PI*n),t[1]=s*Math.cos(2*Math.PI*n),t[2]=u*Math.sin(2*Math.PI*i),t[3]=u*Math.cos(2*Math.PI*i),t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n*n+r*r+i*i+s*s,o=u?1/u:0;return t[0]=-n*o,t[1]=-r*o,t[2]=-i*o,t[3]=s*o,t},e.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},e.fromMat3=l,e.fromEuler=function(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var s=Math.sin(e),u=Math.cos(e),o=Math.sin(n),a=Math.cos(n),c=Math.sin(r),f=Math.cos(r);return t[0]=s*a*f-u*o*c,t[1]=u*o*f+s*a*c,t[2]=u*a*c-s*o*f,t[3]=u*a*f+s*o*c,t},e.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var r=o(n(0)),i=o(n(5)),s=o(n(2)),u=o(n(1));function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function a(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function c(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function f(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[0],a=n[1],c=n[2],f=n[3];return t[0]=r*f+u*o+i*c-s*a,t[1]=i*f+u*a+s*o-r*c,t[2]=s*f+u*c+r*a-i*o,t[3]=u*f-r*o-i*a-s*c,t}function h(t,e,n,i){var s=e[0],u=e[1],o=e[2],a=e[3],c=n[0],f=n[1],h=n[2],l=n[3],m=void 0,d=void 0,E=void 0,M=void 0,_=void 0;return(d=s*c+u*f+o*h+a*l)<0&&(d=-d,c=-c,f=-f,h=-h,l=-l),1-d>r.EPSILON?(m=Math.acos(d),E=Math.sin(m),M=Math.sin((1-i)*m)/E,_=Math.sin(i*m)/E):(M=1-i,_=i),t[0]=M*s+_*c,t[1]=M*u+_*f,t[2]=M*o+_*h,t[3]=M*a+_*l,t}function l(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var s=(i+1)%3,u=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*s+s]-e[3*u+u]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*s+u]-e[3*u+s])*r,t[s]=(e[3*s+i]+e[3*i+s])*r,t[u]=(e[3*u+i]+e[3*i+u])*r}return t}e.clone=u.clone,e.fromValues=u.fromValues,e.copy=u.copy,e.set=u.set,e.add=u.add,e.mul=f,e.scale=u.scale,e.dot=u.dot,e.lerp=u.lerp;var m=e.length=u.length,d=(e.len=m,e.squaredLength=u.squaredLength),E=(e.sqrLen=d,e.normalize=u.normalize);e.exactEquals=u.exactEquals,e.equals=u.equals,e.rotationTo=function(){var t=s.create(),e=s.fromValues(1,0,0),n=s.fromValues(0,1,0);return function(r,i,u){var o=s.dot(i,u);return o<-.999999?(s.cross(t,e,i),s.len(t)<1e-6&&s.cross(t,n,i),s.normalize(t,t),c(r,t,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(s.cross(t,i,u),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+o,E(r,r))}}(),e.sqlerp=function(){var t=a(),e=a();return function(n,r,i,s,u,o){return h(t,r,u,o),h(e,i,s,o),h(n,t,e,2*o*(1-o)),n}}(),e.setAxes=function(){var t=i.create();return function(e,n,r,i){return t[0]=r[0],t[3]=r[1],t[6]=r[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-n[0],t[5]=-n[1],t[8]=-n[2],E(e,l(e,t))}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.fromValues=function(t,e,n,i,s,u,o,a,c,f,h,l,m,d,E,M){var _=new r.ARRAY_TYPE(16);return _[0]=t,_[1]=e,_[2]=n,_[3]=i,_[4]=s,_[5]=u,_[6]=o,_[7]=a,_[8]=c,_[9]=f,_[10]=h,_[11]=l,_[12]=m,_[13]=d,_[14]=E,_[15]=M,_},e.set=function(t,e,n,r,i,s,u,o,a,c,f,h,l,m,d,E,M){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=u,t[6]=o,t[7]=a,t[8]=c,t[9]=f,t[10]=h,t[11]=l,t[12]=m,t[13]=d,t[14]=E,t[15]=M,t},e.identity=i,e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],s=e[6],u=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=i,t[13]=u,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=e[9],l=e[10],m=e[11],d=e[12],E=e[13],M=e[14],_=e[15],v=n*o-r*u,p=n*a-i*u,T=n*c-s*u,R=r*a-i*o,A=r*c-s*o,S=i*c-s*a,g=f*E-h*d,N=f*M-l*d,y=f*_-m*d,O=h*M-l*E,L=h*_-m*E,P=l*_-m*M,I=v*P-p*L+T*O+R*y-A*N+S*g;return I?(I=1/I,t[0]=(o*P-a*L+c*O)*I,t[1]=(i*L-r*P-s*O)*I,t[2]=(E*S-M*A+_*R)*I,t[3]=(l*A-h*S-m*R)*I,t[4]=(a*y-u*P-c*N)*I,t[5]=(n*P-i*y+s*N)*I,t[6]=(M*T-d*S-_*p)*I,t[7]=(f*S-l*T+m*p)*I,t[8]=(u*L-o*y+c*g)*I,t[9]=(r*y-n*L-s*g)*I,t[10]=(d*A-E*T+_*v)*I,t[11]=(h*T-f*A-m*v)*I,t[12]=(o*N-u*O-a*g)*I,t[13]=(n*O-r*N+i*g)*I,t[14]=(E*p-d*R-M*v)*I,t[15]=(f*R-h*p+l*v)*I,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=e[9],l=e[10],m=e[11],d=e[12],E=e[13],M=e[14],_=e[15];return t[0]=o*(l*_-m*M)-h*(a*_-c*M)+E*(a*m-c*l),t[1]=-(r*(l*_-m*M)-h*(i*_-s*M)+E*(i*m-s*l)),t[2]=r*(a*_-c*M)-o*(i*_-s*M)+E*(i*c-s*a),t[3]=-(r*(a*m-c*l)-o*(i*m-s*l)+h*(i*c-s*a)),t[4]=-(u*(l*_-m*M)-f*(a*_-c*M)+d*(a*m-c*l)),t[5]=n*(l*_-m*M)-f*(i*_-s*M)+d*(i*m-s*l),t[6]=-(n*(a*_-c*M)-u*(i*_-s*M)+d*(i*c-s*a)),t[7]=n*(a*m-c*l)-u*(i*m-s*l)+f*(i*c-s*a),t[8]=u*(h*_-m*E)-f*(o*_-c*E)+d*(o*m-c*h),t[9]=-(n*(h*_-m*E)-f*(r*_-s*E)+d*(r*m-s*h)),t[10]=n*(o*_-c*E)-u*(r*_-s*E)+d*(r*c-s*o),t[11]=-(n*(o*m-c*h)-u*(r*m-s*h)+f*(r*c-s*o)),t[12]=-(u*(h*M-l*E)-f*(o*M-a*E)+d*(o*l-a*h)),t[13]=n*(h*M-l*E)-f*(r*M-i*E)+d*(r*l-i*h),t[14]=-(n*(o*M-a*E)-u*(r*M-i*E)+d*(r*a-i*o)),t[15]=n*(o*l-a*h)-u*(r*l-i*h)+f*(r*a-i*o),t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],u=t[5],o=t[6],a=t[7],c=t[8],f=t[9],h=t[10],l=t[11],m=t[12],d=t[13],E=t[14],M=t[15];return(e*u-n*s)*(h*M-l*E)-(e*o-r*s)*(f*M-l*d)+(e*a-i*s)*(f*E-h*d)+(n*o-r*u)*(c*M-l*m)-(n*a-i*u)*(c*E-h*m)+(r*a-i*o)*(c*d-f*m)},e.multiply=s,e.translate=function(t,e,n){var r=n[0],i=n[1],s=n[2],u=void 0,o=void 0,a=void 0,c=void 0,f=void 0,h=void 0,l=void 0,m=void 0,d=void 0,E=void 0,M=void 0,_=void 0;return e===t?(t[12]=e[0]*r+e[4]*i+e[8]*s+e[12],t[13]=e[1]*r+e[5]*i+e[9]*s+e[13],t[14]=e[2]*r+e[6]*i+e[10]*s+e[14],t[15]=e[3]*r+e[7]*i+e[11]*s+e[15]):(u=e[0],o=e[1],a=e[2],c=e[3],f=e[4],h=e[5],l=e[6],m=e[7],d=e[8],E=e[9],M=e[10],_=e[11],t[0]=u,t[1]=o,t[2]=a,t[3]=c,t[4]=f,t[5]=h,t[6]=l,t[7]=m,t[8]=d,t[9]=E,t[10]=M,t[11]=_,t[12]=u*r+f*i+d*s+e[12],t[13]=o*r+h*i+E*s+e[13],t[14]=a*r+l*i+M*s+e[14],t[15]=c*r+m*i+_*s+e[15]),t},e.scale=function(t,e,n){var r=n[0],i=n[1],s=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.rotate=function(t,e,n,i){var s,u,o,a,c,f,h,l,m,d,E,M,_,v,p,T,R,A,S,g,N,y,O,L,P=i[0],I=i[1],b=i[2],C=Math.sqrt(P*P+I*I+b*b);return C0?(n[0]=2*(c*a+l*i+f*o-h*s)/m,n[1]=2*(f*a+l*s+h*i-c*o)/m,n[2]=2*(h*a+l*o+c*s-f*i)/m):(n[0]=2*(c*a+l*i+f*o-h*s),n[1]=2*(f*a+l*s+h*i-c*o),n[2]=2*(h*a+l*o+c*s-f*i)),u(t,e,n),t},e.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},e.getScaling=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[4],u=e[5],o=e[6],a=e[8],c=e[9],f=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(s*s+u*u+o*o),t[2]=Math.sqrt(a*a+c*c+f*f),t},e.getRotation=function(t,e){var n=e[0]+e[5]+e[10],r=0;return n>0?(r=2*Math.sqrt(n+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t},e.fromRotationTranslationScale=function(t,e,n,r){var i=e[0],s=e[1],u=e[2],o=e[3],a=i+i,c=s+s,f=u+u,h=i*a,l=i*c,m=i*f,d=s*c,E=s*f,M=u*f,_=o*a,v=o*c,p=o*f,T=r[0],R=r[1],A=r[2];return t[0]=(1-(d+M))*T,t[1]=(l+p)*T,t[2]=(m-v)*T,t[3]=0,t[4]=(l-p)*R,t[5]=(1-(h+M))*R,t[6]=(E+_)*R,t[7]=0,t[8]=(m+v)*A,t[9]=(E-_)*A,t[10]=(1-(h+d))*A,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,e,n,r,i){var s=e[0],u=e[1],o=e[2],a=e[3],c=s+s,f=u+u,h=o+o,l=s*c,m=s*f,d=s*h,E=u*f,M=u*h,_=o*h,v=a*c,p=a*f,T=a*h,R=r[0],A=r[1],S=r[2],g=i[0],N=i[1],y=i[2],O=(1-(E+_))*R,L=(m+T)*R,P=(d-p)*R,I=(m-T)*A,b=(1-(l+_))*A,C=(M+v)*A,D=(d+p)*S,U=(M-v)*S,B=(1-(l+E))*S;return t[0]=O,t[1]=L,t[2]=P,t[3]=0,t[4]=I,t[5]=b,t[6]=C,t[7]=0,t[8]=D,t[9]=U,t[10]=B,t[11]=0,t[12]=n[0]+g-(O*g+I*N+D*y),t[13]=n[1]+N-(L*g+b*N+U*y),t[14]=n[2]+y-(P*g+C*N+B*y),t[15]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n+n,o=r+r,a=i+i,c=n*u,f=r*u,h=r*o,l=i*u,m=i*o,d=i*a,E=s*u,M=s*o,_=s*a;return t[0]=1-h-d,t[1]=f+_,t[2]=l-M,t[3]=0,t[4]=f-_,t[5]=1-c-d,t[6]=m+E,t[7]=0,t[8]=l+M,t[9]=m-E,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,e,n,r,i,s,u){var o=1/(n-e),a=1/(i-r),c=1/(s-u);return t[0]=2*s*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*a,t[6]=0,t[7]=0,t[8]=(n+e)*o,t[9]=(i+r)*a,t[10]=(u+s)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=u*s*2*c,t[15]=0,t},e.perspective=function(t,e,n,r,i){var s=1/Math.tan(e/2),u=void 0;return t[0]=s/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(u=1/(r-i),t[10]=(i+r)*u,t[14]=2*i*r*u):(t[10]=-1,t[14]=-2*r),t},e.perspectiveFromFieldOfView=function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),u=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),a=2/(u+o),c=2/(i+s);return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(u-o)*a*.5,t[9]=(i-s)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},e.ortho=function(t,e,n,r,i,s,u){var o=1/(e-n),a=1/(r-i),c=1/(s-u);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*o,t[13]=(i+r)*a,t[14]=(u+s)*c,t[15]=1,t},e.lookAt=function(t,e,n,s){var u=void 0,o=void 0,a=void 0,c=void 0,f=void 0,h=void 0,l=void 0,m=void 0,d=void 0,E=void 0,M=e[0],_=e[1],v=e[2],p=s[0],T=s[1],R=s[2],A=n[0],S=n[1],g=n[2];return Math.abs(M-A)0&&(f*=m=1/Math.sqrt(m),h*=m,l*=m);var d=a*l-c*h,E=c*f-o*l,M=o*h-a*f;return(m=d*d+E*E+M*M)>0&&(d*=m=1/Math.sqrt(m),E*=m,M*=m),t[0]=d,t[1]=E,t[2]=M,t[3]=0,t[4]=h*M-l*E,t[5]=l*d-f*M,t[6]=f*E-h*d,t[7]=0,t[8]=f,t[9]=h,t[10]=l,t[11]=0,t[12]=i,t[13]=s,t[14]=u,t[15]=1,t},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},e.subtract=o,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=t[6],f=t[7],h=t[8],l=t[9],m=t[10],d=t[11],E=t[12],M=t[13],_=t[14],v=t[15],p=e[0],T=e[1],R=e[2],A=e[3],S=e[4],g=e[5],N=e[6],y=e[7],O=e[8],L=e[9],P=e[10],I=e[11],b=e[12],C=e[13],D=e[14],U=e[15];return Math.abs(n-p)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(s-R)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(u-A)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(o-S)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-g)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(c-N)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(N))&&Math.abs(f-y)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(y))&&Math.abs(h-O)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(l-L)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(m-P)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(d-I)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(E-b)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(b))&&Math.abs(M-C)<=r.EPSILON*Math.max(1,Math.abs(M),Math.abs(C))&&Math.abs(_-D)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))&&Math.abs(v-U)<=r.EPSILON*Math.max(1,Math.abs(v),Math.abs(U))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function s(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=e[9],m=e[10],d=e[11],E=e[12],M=e[13],_=e[14],v=e[15],p=n[0],T=n[1],R=n[2],A=n[3];return t[0]=p*r+T*o+R*h+A*E,t[1]=p*i+T*a+R*l+A*M,t[2]=p*s+T*c+R*m+A*_,t[3]=p*u+T*f+R*d+A*v,p=n[4],T=n[5],R=n[6],A=n[7],t[4]=p*r+T*o+R*h+A*E,t[5]=p*i+T*a+R*l+A*M,t[6]=p*s+T*c+R*m+A*_,t[7]=p*u+T*f+R*d+A*v,p=n[8],T=n[9],R=n[10],A=n[11],t[8]=p*r+T*o+R*h+A*E,t[9]=p*i+T*a+R*l+A*M,t[10]=p*s+T*c+R*m+A*_,t[11]=p*u+T*f+R*d+A*v,p=n[12],T=n[13],R=n[14],A=n[15],t[12]=p*r+T*o+R*h+A*E,t[13]=p*i+T*a+R*l+A*M,t[14]=p*s+T*c+R*m+A*_,t[15]=p*u+T*f+R*d+A*v,t}function u(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=r+r,a=i+i,c=s+s,f=r*o,h=r*a,l=r*c,m=i*a,d=i*c,E=s*c,M=u*o,_=u*a,v=u*c;return t[0]=1-(m+E),t[1]=h+v,t[2]=l-_,t[3]=0,t[4]=h-v,t[5]=1-(f+E),t[6]=d+M,t[7]=0,t[8]=l+_,t[9]=d-M,t[10]=1-(f+m),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function o(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}e.mul=s,e.sub=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(9);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},e.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},e.clone=function(t){var e=new r.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromValues=function(t,e,n,i,s,u,o,a,c){var f=new r.ARRAY_TYPE(9);return f[0]=t,f[1]=e,f[2]=n,f[3]=i,f[4]=s,f[5]=u,f[6]=o,f[7]=a,f[8]=c,f},e.set=function(t,e,n,r,i,s,u,o,a,c){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=u,t[6]=o,t[7]=a,t[8]=c,t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else 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];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=f*u-o*c,l=-f*s+o*a,m=c*s-u*a,d=n*h+r*l+i*m;return d?(d=1/d,t[0]=h*d,t[1]=(-f*r+i*c)*d,t[2]=(o*r-i*u)*d,t[3]=l*d,t[4]=(f*n-i*a)*d,t[5]=(-o*n+i*s)*d,t[6]=m*d,t[7]=(-c*n+r*a)*d,t[8]=(u*n-r*s)*d,t):null},e.adjoint=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8];return t[0]=u*f-o*c,t[1]=i*c-r*f,t[2]=r*o-i*u,t[3]=o*a-s*f,t[4]=n*f-i*a,t[5]=i*s-n*o,t[6]=s*c-u*a,t[7]=r*a-n*c,t[8]=n*u-r*s,t},e.determinant=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],u=t[5],o=t[6],a=t[7],c=t[8];return e*(c*s-u*a)+n*(-c*i+u*o)+r*(a*i-s*o)},e.multiply=i,e.translate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=n[0],m=n[1];return t[0]=r,t[1]=i,t[2]=s,t[3]=u,t[4]=o,t[5]=a,t[6]=l*r+m*u+c,t[7]=l*i+m*o+f,t[8]=l*s+m*a+h,t},e.rotate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=Math.sin(n),m=Math.cos(n);return t[0]=m*r+l*u,t[1]=m*i+l*o,t[2]=m*s+l*a,t[3]=m*u-l*r,t[4]=m*o-l*i,t[5]=m*a-l*s,t[6]=c,t[7]=f,t[8]=h,t},e.scale=function(t,e,n){var r=n[0],i=n[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},e.fromQuat=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n+n,o=r+r,a=i+i,c=n*u,f=r*u,h=r*o,l=i*u,m=i*o,d=i*a,E=s*u,M=s*o,_=s*a;return t[0]=1-h-d,t[3]=f-_,t[6]=l+M,t[1]=f+_,t[4]=1-c-d,t[7]=m-E,t[2]=l-M,t[5]=m+E,t[8]=1-c-h,t},e.normalFromMat4=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=e[6],c=e[7],f=e[8],h=e[9],l=e[10],m=e[11],d=e[12],E=e[13],M=e[14],_=e[15],v=n*o-r*u,p=n*a-i*u,T=n*c-s*u,R=r*a-i*o,A=r*c-s*o,S=i*c-s*a,g=f*E-h*d,N=f*M-l*d,y=f*_-m*d,O=h*M-l*E,L=h*_-m*E,P=l*_-m*M,I=v*P-p*L+T*O+R*y-A*N+S*g;return I?(I=1/I,t[0]=(o*P-a*L+c*O)*I,t[1]=(a*y-u*P-c*N)*I,t[2]=(u*L-o*y+c*g)*I,t[3]=(i*L-r*P-s*O)*I,t[4]=(n*P-i*y+s*N)*I,t[5]=(r*y-n*L-s*g)*I,t[6]=(E*S-M*A+_*R)*I,t[7]=(M*T-d*S-_*p)*I,t[8]=(d*A-E*T+_*v)*I,t):null},e.projection=function(t,e,n){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/n,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t},e.subtract=s,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=t[6],f=t[7],h=t[8],l=e[0],m=e[1],d=e[2],E=e[3],M=e[4],_=e[5],v=e[6],p=e[7],T=e[8];return Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-m)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(s-d)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(u-E)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(o-M)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(a-_)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(c-v)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(f-p)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(p))&&Math.abs(h-T)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(T))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=e[6],f=e[7],h=e[8],l=n[0],m=n[1],d=n[2],E=n[3],M=n[4],_=n[5],v=n[6],p=n[7],T=n[8];return t[0]=l*r+m*u+d*c,t[1]=l*i+m*o+d*f,t[2]=l*s+m*a+d*h,t[3]=E*r+M*u+_*c,t[4]=E*i+M*o+_*f,t[5]=E*s+M*a+_*h,t[6]=v*r+p*u+T*c,t[7]=v*i+p*o+T*f,t[8]=v*s+p*a+T*h,t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t}e.mul=i,e.sub=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.forEach=e.sqrLen=e.sqrDist=e.dist=e.div=e.mul=e.sub=e.len=void 0,e.create=i,e.clone=function(t){var e=new r.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},e.fromValues=function(t,e){var n=new r.ARRAY_TYPE(2);return n[0]=t,n[1]=e,n},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},e.set=function(t,e,n){return t[0]=e,t[1]=n,t},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t},e.subtract=s,e.multiply=u,e.divide=o,e.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},e.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},e.min=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t},e.max=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t},e.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},e.scale=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},e.scaleAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t},e.distance=a,e.squaredDistance=c,e.length=f,e.squaredLength=h,e.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},e.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},e.normalize=function(t,e){var n=e[0],r=e[1],i=n*n+r*r;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},e.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},e.cross=function(t,e,n){var r=e[0]*n[1]-e[1]*n[0];return t[0]=t[1]=0,t[2]=r,t},e.lerp=function(t,e,n,r){var i=e[0],s=e[1];return t[0]=i+r*(n[0]-i),t[1]=s+r*(n[1]-s),t},e.random=function(t,e){e=e||1;var n=2*r.RANDOM()*Math.PI;return t[0]=Math.cos(n)*e,t[1]=Math.sin(n)*e,t},e.transformMat2=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t},e.transformMat2d=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[2]*i+n[4],t[1]=n[1]*r+n[3]*i+n[5],t},e.transformMat3=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t},e.transformMat4=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},e.rotate=function(t,e,n,r){var i=e[0]-n[0],s=e[1]-n[1],u=Math.sin(r),o=Math.cos(r);return t[0]=i*o-s*u+n[0],t[1]=i*u+s*o+n[1],t},e.angle=function(t,e){var n=t[0],r=t[1],i=e[0],s=e[1],u=n*n+r*r;u>0&&(u=1/Math.sqrt(u));var o=i*i+s*s;o>0&&(o=1/Math.sqrt(o));var a=(n*i+r*s)*u*o;return a>1?0:a<-1?Math.PI:Math.acos(a)},e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},e.equals=function(t,e){var n=t[0],i=t[1],s=e[0],u=e[1];return Math.abs(n-s)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(){var t=new r.ARRAY_TYPE(2);return r.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function u(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t}function o(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t}function a(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(n*n+r*r)}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function f(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)}function h(t){var e=t[0],n=t[1];return e*e+n*n}e.len=f,e.sub=s,e.mul=u,e.div=o,e.dist=a,e.sqrDist=c,e.sqrLen=h,e.forEach=function(){var t=i();return function(e,n,r,i,s,u){var o,a=void 0;for(n||(n=2),r||(r=0),o=i?Math.min(i*n+r,e.length):e.length,a=r;a0){n=Math.sqrt(n);var r=e[0]/n,i=e[1]/n,s=e[2]/n,u=e[3]/n,o=e[4],a=e[5],c=e[6],f=e[7],h=r*o+i*a+s*c+u*f;t[0]=r,t[1]=i,t[2]=s,t[3]=u,t[4]=(o-r*h)/n,t[5]=(a-i*h)/n,t[6]=(c-s*h)/n,t[7]=(f-u*h)/n}return t},e.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=t[6],f=t[7],h=e[0],l=e[1],m=e[2],d=e[3],E=e[4],M=e[5],_=e[6],v=e[7];return Math.abs(n-h)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-l)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-m)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(u-d)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(d))&&Math.abs(o-E)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(a-M)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(c-_)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(f-v)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(v))};var r=u(n(0)),i=u(n(3)),s=u(n(4));function u(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t,e,n){var r=.5*n[0],i=.5*n[1],s=.5*n[2],u=e[0],o=e[1],a=e[2],c=e[3];return t[0]=u,t[1]=o,t[2]=a,t[3]=c,t[4]=r*c+i*a-s*o,t[5]=i*c+s*u-r*a,t[6]=s*c+r*o-i*u,t[7]=-r*u-i*o-s*a,t}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[4],a=n[5],c=n[6],f=n[7],h=e[4],l=e[5],m=e[6],d=e[7],E=n[0],M=n[1],_=n[2],v=n[3];return t[0]=r*v+u*E+i*_-s*M,t[1]=i*v+u*M+s*E-r*_,t[2]=s*v+u*_+r*M-i*E,t[3]=u*v-r*E-i*M-s*_,t[4]=r*f+u*o+i*c-s*a+h*v+d*E+l*_-m*M,t[5]=i*f+u*a+s*o-r*c+l*v+d*M+m*E-h*_,t[6]=s*f+u*c+r*a-i*o+m*v+d*_+h*M-l*E,t[7]=u*f-r*o-i*a-s*c+d*v-h*E-l*M-m*_,t}e.getReal=i.copy,e.setReal=i.copy,e.mul=c;var f=e.dot=i.dot,h=e.length=i.length,l=(e.len=h,e.squaredLength=i.squaredLength);e.sqrLen=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(6);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.fromValues=function(t,e,n,i,s,u){var o=new r.ARRAY_TYPE(6);return o[0]=t,o[1]=e,o[2]=n,o[3]=i,o[4]=s,o[5]=u,o},e.set=function(t,e,n,r,i,s,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=s,t[5]=u,t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=e[4],o=e[5],a=n*s-r*i;return a?(a=1/a,t[0]=s*a,t[1]=-r*a,t[2]=-i*a,t[3]=n*a,t[4]=(i*o-s*u)*a,t[5]=(r*u-n*o)*a,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=Math.sin(n),f=Math.cos(n);return t[0]=r*f+s*c,t[1]=i*f+u*c,t[2]=r*-c+s*f,t[3]=i*-c+u*f,t[4]=o,t[5]=a,t},e.scale=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=n[0],f=n[1];return t[0]=r*c,t[1]=i*c,t[2]=s*f,t[3]=u*f,t[4]=o,t[5]=a,t},e.translate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=n[0],f=n[1];return t[0]=r,t[1]=i,t[2]=s,t[3]=u,t[4]=r*c+s*f+o,t[5]=i*c+u*f+a,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=0,t[5]=0,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t},e.subtract=s,e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t},e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=t[4],a=t[5],c=e[0],f=e[1],h=e[2],l=e[3],m=e[4],d=e[5];return Math.abs(n-c)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-f)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(s-h)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(u-l)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(l))&&Math.abs(o-m)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(a-d)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=e[4],a=e[5],c=n[0],f=n[1],h=n[2],l=n[3],m=n[4],d=n[5];return t[0]=r*c+s*f,t[1]=i*c+u*f,t[2]=r*h+s*l,t[3]=i*h+u*l,t[4]=r*m+s*d+o,t[5]=i*m+u*d+a,t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t}e.mul=i,e.sub=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.sub=e.mul=void 0,e.create=function(){var t=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},e.clone=function(t){var e=new r.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.fromValues=function(t,e,n,i){var s=new r.ARRAY_TYPE(4);return s[0]=t,s[1]=e,s[2]=n,s[3]=i,s},e.set=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},e.transpose=function(t,e){if(t===e){var n=e[1];t[1]=e[2],t[2]=n}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},e.invert=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],u=n*s-i*r;return u?(u=1/u,t[0]=s*u,t[1]=-r*u,t[2]=-i*u,t[3]=n*u,t):null},e.adjoint=function(t,e){var n=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=n,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=i,e.rotate=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=Math.sin(n),a=Math.cos(n);return t[0]=r*a+s*o,t[1]=i*a+u*o,t[2]=r*-o+s*a,t[3]=i*-o+u*a,t},e.scale=function(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[0],a=n[1];return t[0]=r*o,t[1]=i*o,t[2]=s*a,t[3]=u*a,t},e.fromRotation=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t},e.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,e,n,r){return t[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-t[2]*n[1],[t,e,n]},e.add=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},e.subtract=s,e.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},e.equals=function(t,e){var n=t[0],i=t[1],s=t[2],u=t[3],o=e[0],a=e[1],c=e[2],f=e[3];return Math.abs(n-o)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(s-c)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(u-f)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(f))},e.multiplyScalar=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},e.multiplyScalarAndAdd=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t};var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0));function i(t,e,n){var r=e[0],i=e[1],s=e[2],u=e[3],o=n[0],a=n[1],c=n[2],f=n[3];return t[0]=r*o+s*a,t[1]=i*o+u*a,t[2]=r*c+s*f,t[3]=i*c+u*f,t}function s(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t}e.mul=i,e.sub=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.vec4=e.vec3=e.vec2=e.quat2=e.quat=e.mat4=e.mat3=e.mat2d=e.mat2=e.glMatrix=void 0;var r=m(n(0)),i=m(n(9)),s=m(n(8)),u=m(n(5)),o=m(n(4)),a=m(n(3)),c=m(n(7)),f=m(n(6)),h=m(n(2)),l=m(n(1));function m(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}e.glMatrix=r,e.mat2=i,e.mat2d=s,e.mat3=u,e.mat4=o,e.quat=a,e.quat2=c,e.vec2=f,e.vec3=h,e.vec4=l}])},function(t,e,n){"use strict";var r=function(){var t,e;try{t=Object.defineProperty,e=Object.defineProperties,t({},"$",{value:0})}catch(n){"__defineGetter__"in Object&&(t=function(t,e,n){return"value"in n&&(t[e]=n.value),"get"in n&&t.__defineGetter__(e,n.get),"set"in n&&t.__defineSetter__(e,n.set),t},e=function(e,n){for(var r in n)n.hasOwnProperty(r)&&t(e,r,n[r]);return e})}var n=function(t){for(var n=1,r=arguments.length;n>1,u=n(t[s],e);if(0===u)return[s,s];u<0?r=s+1:i=s-1}return r>i?[i,r]:[r,i]}function v(t,e,n){var r=_(t,e,n);t.splice(r[1],0,e)}function p(t,e,n){return e<=t.length?t:new Array(e-t.length+1).join(n||"0")+t}function T(t){return t instanceof Float32Array?l:t instanceof Int8Array?o:t instanceof Uint8Array?a:t instanceof Int16Array?c:t instanceof Uint16Array?f:t instanceof Uint32Array?h:l}var R,A,S=(s(R={},o,Int8Array),s(R,a,Uint8Array),s(R,c,Int16Array),s(R,f,Uint16Array),s(R,h,Uint32Array),s(R,l,Float32Array),A=R,function(t){return A[t]||Float32Array});function g(t,e,n,r,i){if(t&&e){e.isGeometryData&&(e=e.data);for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return Array.isArray(t)||(t=Object.values(t)),t.reduce((function(t,n,r){return t.then((function(){return e(n,r)}))}),Promise.resolve())}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector3",isVector3:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec3.round(this.elements,this.elements),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this},hermite:function(t,e,n,i,s){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,s),this},bezier:function(t,e,n,i,s){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,s),this},random:function(t){return r.vec3.random(this.elements,t),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],s=e[2];return e[0]=r*n[0]+i*n[4]+s*n[8],e[1]=r*n[1]+i*n[5]+s*n[9],e[2]=r*n[2]+i*n[6]+s*n[10],this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r,i={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(r=0,function(t){var e=++r;return t?e=t+"_"+e:e+="",e}),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},degToRad:function(t){return t*this.DEG2RAD},radToDeg:function(t){return t*this.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};e.a=i},function(t,e,n){"use strict";var r,i=n(0),s=n(1),u=n(5),o=n(10),a=new u.a,c=new u.a,f=s.a.create({className:"Matrix4",isMatrix4:!0,constructor:function(){this.elements=i.mat4.create()},copy:function(t){return i.mat4.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return i.mat4.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<16;r++)n[r]=t[e+r];return this},set:function(t,e,n,r,s,u,o,a,c,f,h,l,m,d,E,M){return i.mat4.set(this.elements,t,e,n,r,s,u,o,a,c,f,h,l,m,d,E,M),this},identity:function(){return i.mat4.identity(this.elements),this},transpose:function(){return i.mat4.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return i.mat4.adjoint(this.elements,t.elements),this},determinant:function(){return i.mat4.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),i.mat4.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return i.mat4.translate(this.elements,this.elements,t.elements),this},scale:function(t){return i.mat4.scale(this.elements,this.elements,t.elements),this},rotate:function(t,e){return i.mat4.rotate(this.elements,this.elements,t,e.elements),this},rotateX:function(t){return i.mat4.rotateX(this.elements,this.elements,t),this},rotateY:function(t){return i.mat4.rotateY(this.elements,this.elements,t),this},rotateZ:function(t){return i.mat4.rotateZ(this.elements,this.elements,t),this},fromTranslation:function(t){return i.mat4.fromTranslation(this.elements,t.elements),this},fromScaling:function(t){return i.mat4.fromScaling(this.elements,t.elements),this},fromRotation:function(t,e){return i.mat4.fromRotation(this.elements,t,e.elements),this},fromXRotation:function(t){return i.mat4.fromXRotation(this.elements,t),this},fromYRotation:function(t){return i.mat4.fromYRotation(this.elements,t),this},fromZRotation:function(t){return i.mat4.fromZRotation(this.elements,t),this},fromRotationTranslation:function(t,e){return i.mat4.fromRotationTranslation(this.elements,t.elements,e.elements),this},getTranslation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new u.a;return i.mat4.getTranslation(t.elements,this.elements),t},getScaling:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new u.a;return i.mat4.getScaling(t.elements,this.elements),t},getRotation:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new o.a;return i.mat4.getRotation(t.elements,this.elements),t},fromRotationTranslationScale:function(t,e,n){return i.mat4.fromRotationTranslationScale(this.elements,t.elements,e.elements,n.elements),this},fromRotationTranslationScaleOrigin:function(t,e,n,r){return i.mat4.fromRotationTranslationScaleOrigin(this.elements,t.elements,e.elements,n.elements,r.elements),this},fromQuat:function(t){return i.mat4.fromQuat(this.elements,t.elements),this},frustum:function(t,e,n,r,s,u){return i.mat4.frustum(this.elements,t,e,n,r,s,u),this},perspective:function(t,e,n,r){return i.mat4.perspective(this.elements,t,e,n,r),this},perspectiveFromFieldOfView:function(t,e,n){return i.mat4.perspectiveFromFieldOfView(this.elements,t,e,n),this},ortho:function(t,e,n,r,s,u){return i.mat4.ortho(this.elements,t,e,n,r,s,u),this},lookAt:function(t,e,n){return t.isVector3||(t=a.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),i.mat4.lookAt(this.elements,t.elements,e.elements,n.elements),this},targetTo:function(t,e,n){t.isVector3||(t=a.set(t.x,t.y,t.z)),e.isVector3||(e=c.set(e.x,e.y,e.z)),t=t.elements,e=e.elements,n=n.elements;var r=this.elements,i=t[0],s=t[1],u=t[2],o=n[0],f=n[1],h=n[2],l=i-e[0],m=s-e[1],d=u-e[2],E=l*l+m*m+d*d;E>0?(l*=E=1/Math.sqrt(E),m*=E,d*=E):d=1;var M=f*d-h*m,_=h*l-o*d,v=o*m-f*l;return(E=M*M+_*_+v*v)>0?(M*=E=1/Math.sqrt(E),_*=E,v*=E):(E=(M=f*d-h*m)*M+(_=h*l-(o+=1e-7)*d)*_+(v=o*m-f*l)*v,M*=E=1/Math.sqrt(E),_*=E,v*=E),r[0]=M,r[1]=_,r[2]=v,r[3]=0,r[4]=m*v-d*_,r[5]=d*M-l*v,r[6]=l*_-m*M,r[7]=0,r[8]=l,r[9]=m,r[10]=d,r[11]=0,r[12]=i,r[13]=s,r[14]=u,r[15]=1,this},frob:function(){return i.mat4.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),i.mat4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),i.mat4.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),i.mat4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),i.mat4.equals(t.elements,e.elements)},compose:function(t,e,n,r){return r?this.fromRotationTranslationScaleOrigin(t,e,n,r):this.fromRotationTranslationScale(t,e,n),this},decompose:function(t,e,n,i){return this.getScaling(n),this.getTranslation(e),r||(r=new f),this.determinant()<0&&(n.x*=-1),r.copy(this),a.inverse(n),r.scale(a),t.fromMat4(r),i&&i.set(0,0,0),this}});f.prototype.sub=f.prototype.subtract,f.prototype.mul=f.prototype.multiply,e.a=f},function(t,e,n){"use strict";var r=n(1),i=n(12),s=n(4),u=r.a.create({Extends:i.a,className:"Color",isColor:!0,r:{get:function(){return this.x},set:function(t){this.x=t}},g:{get:function(){return this.y},set:function(t){this.y=t}},b:{get:function(){return this.z},set:function(t){this.z=t}},a:{get:function(){return this.w},set:function(t){this.w=t}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;u.superclass.constructor.call(this,t,e,n,r)},toRGBArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t},fromUintArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e]/255,this.elements[1]=t[e+1]/255,this.elements[2]=t[e+2]/255,this.elements[3]=t[e+3]/255,this},fromHEX:function(t){return"number"==typeof t?t=Object(s.padLeft)(t.toString(16),6):("#"===t[0]&&(t=t.slice(1)),3===t.length&&(t=t.replace(/(\w)/g,"$1$1"))),this.elements[0]=parseInt(t.slice(0,2),16)/255,this.elements[1]=parseInt(t.slice(2,4),16)/255,this.elements[2]=parseInt(t.slice(4,6),16)/255,this},toHEX:function(){for(var t="",e=0;e<3;e++)t+=Object(s.padLeft)(Math.floor(255*this.elements[e]).toString(16),2);return t}});e.a=u},function(t,e,n){"use strict";var r=n(1).a.create({constructor:function(t,e,n){this.type=t,this.target=e,this.detail=n,this.timeStamp=+new Date},type:null,target:null,detail:null,timeStamp:0,stopImmediatePropagation:function(){this._stopped=!0}}),i={_listeners:null,on:function(t,e,n){for(var r=this._listeners=this._listeners||{},i=r[t]=r[t]||[],s=0,u=i.length;s0){if(1===arguments.length)return delete this._listeners[t],this;for(var r=0,i=n.length;r0){var o=u.slice(0);if((n=n||new r(i,this,e))._stopped)return!1;for(var a=0;a-1&&u.splice(f,1)}}return!0}return!1}};e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(11),s=n(1),u=n(9),o=new i.a,a=s.a.create({Mixes:u.a,className:"Quaternion",isQuaternion:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.elements=r.quat.fromValues(t,e,n,i)},copy:function(t,e){return r.quat.copy(this.elements,t.elements),e||this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=this.elements;return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n||this.fire("update"),this},set:function(t,e,n,i,s){return r.quat.set(this.elements,t,e,n,i),s||this.fire("update"),this},identity:function(t){return r.quat.identity(this.elements),t||this.fire("update"),this},rotationTo:function(t,e,n){return r.quat.rotationTo(this.elements,t.elements,e.elements),n||this.fire("update"),this},setAxes:function(t,e,n,i){return r.quat.setAxes(this.elements,t.elements,e.elements,n.elements),i||this.fire("update"),this},setAxisAngle:function(t,e,n){return r.quat.setAxisAngle(this.elements,t.elements,e),n||this.fire("update"),this},getAxisAngle:function(t){return r.quat.getAxisAngle(t.elements,this.elements)},add:function(t,e){return r.quat.add(this.elements,this.elements,t.elements),e||this.fire("update"),this},multiply:function(t,e){return r.quat.multiply(this.elements,this.elements,t.elements),e||this.fire("update"),this},premultiply:function(t,e){return r.quat.multiply(this.elements,t.elements,this.elements),e||this.fire("update"),this},scale:function(t,e){return r.quat.scale(this.elements,this.elements,t),e||this.fire("update"),this},rotateX:function(t,e){return r.quat.rotateX(this.elements,this.elements,t),e||this.fire("update"),this},rotateY:function(t,e){return r.quat.rotateY(this.elements,this.elements,t),e||this.fire("update"),this},rotateZ:function(t,e){return r.quat.rotateZ(this.elements,this.elements,t),e||this.fire("update"),this},calculateW:function(t){return r.quat.calculateW(this.elements,this.elements),t||this.fire("update"),this},dot:function(t){return r.quat.dot(this.elements,t.elements)},lerp:function(t,e,n){return r.quat.lerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},slerp:function(t,e,n){return r.quat.slerp(this.elements,this.elements,t.elements,e),n||this.fire("update"),this},sqlerp:function(t,e,n,i,s,u){return r.quat.sqlerp(this.elements,t.elements,e.elements,n.elements,i.elements,s),u||this.fire("update"),this},invert:function(t){return r.quat.invert(this.elements,this.elements),t||this.fire("update"),this},conjugate:function(t){return r.quat.conjugate(this.elements,this.elements),t||this.fire("update"),this},length:function(){return r.quat.length(this.elements)},squaredLength:function(){return r.quat.squaredLength(this.elements)},normalize:function(t){return r.quat.normalize(this.elements,this.elements),t||this.fire("update"),this},fromMat3:function(t,e){return r.quat.fromMat3(this.elements,t.elements),e||this.fire("update"),this},fromMat4:function(t,e){return o.fromMat4(t),this.fromMat3(o,e),this},exactEquals:function(t){return r.quat.exactEquals(this.elements,t.elements)},equals:function(t){return r.quat.equals(this.elements,t.elements)},fromEuler:function(t,e){var n=.5*t.x,r=.5*t.y,i=.5*t.z,s=t.order||"ZYX",u=Math.sin(n),o=Math.cos(n),a=Math.sin(r),c=Math.cos(r),f=Math.sin(i),h=Math.cos(i),l=this.elements;return"XYZ"===s?(l[0]=u*c*h+o*a*f,l[1]=o*a*h-u*c*f,l[2]=o*c*f+u*a*h,l[3]=o*c*h-u*a*f):"YXZ"===s?(l[0]=u*c*h+o*a*f,l[1]=o*a*h-u*c*f,l[2]=o*c*f-u*a*h,l[3]=o*c*h+u*a*f):"ZXY"===s?(l[0]=u*c*h-o*a*f,l[1]=o*a*h+u*c*f,l[2]=o*c*f+u*a*h,l[3]=o*c*h-u*a*f):"ZYX"===s?(l[0]=u*c*h-o*a*f,l[1]=o*a*h+u*c*f,l[2]=o*c*f-u*a*h,l[3]=o*c*h+u*a*f):"YZX"===s?(l[0]=u*c*h+o*a*f,l[1]=o*a*h+u*c*f,l[2]=o*c*f-u*a*h,l[3]=o*c*h-u*a*f):"XZY"===s&&(l[0]=u*c*h-o*a*f,l[1]=o*a*h-u*c*f,l[2]=o*c*f+u*a*h,l[3]=o*c*h+u*a*f),e||this.fire("update"),this},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t,this.fire("update")}}});a.prototype.mul=a.prototype.multiply,a.prototype.len=a.prototype.length,a.prototype.sqrLen=a.prototype.squaredLength,e.a=a},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Matrix3",isMatrix3:!0,constructor:function(){this.elements=r.mat3.create()},copy:function(t){return r.mat3.copy(this.elements,t.elements),this},clone:function(){var t=new this.constructor;return r.mat3.copy(t.elements,this.elements),t},toArray:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)t[e+r]=n[r];return t},fromArray:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements,r=0;r<9;r++)n[r]=t[e+r];return this},set:function(t,e,n,i,s,u,o,a,c){return r.mat3.set(this.elements,t,e,n,i,s,u,o,a,c),this},identity:function(){return r.mat3.identity(this.elements),this},transpose:function(){return r.mat3.transpose(this.elements,this.elements),this},invert:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.invert(this.elements,t.elements),this},adjoint:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;return r.mat3.adjoint(this.elements,t.elements),this},determinant:function(){return r.mat3.determinant(this.elements)},multiply:function(t,e){return e||(e=t,t=this),r.mat3.multiply(this.elements,t.elements,e.elements),this},premultiply:function(t){return this.multiply(t,this),this},translate:function(t){return r.mat3.translate(this.elements,this.elements,t.elements),this},rotate:function(t){return r.mat3.rotate(this.elements,this.elements,t),this},scale:function(t){return r.mat3.scale(this.elements,this.elements,t.elements),this},fromTranslation:function(t){return r.mat3.fromTranslation(this.elements,t.elements),this},fromRotation:function(t){return r.mat3.fromRotation(this.elements,t),this},fromScaling:function(t){return r.mat3.fromScaling(this.elements,t.elements),this},fromQuat:function(t){return r.mat3.fromQuat(this.elements,t.elements),this},normalFromMat4:function(t){return r.mat3.normalFromMat4(this.elements,t.elements),this},fromMat4:function(t){return r.mat3.fromMat4(this.elements,t.elements),this},frob:function(){return r.mat3.frob(this.elements)},add:function(t,e){return e||(e=t,t=this),r.mat3.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.mat3.subtract(this.elements,t.elements,e.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.mat3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.mat3.equals(t.elements,e.elements)},fromRotationTranslationScale:function(t,e,n,r,i){var s=Math.cos(t),u=Math.sin(t);return this.set(r*s,-i*u,0,r*u,i*s,0,e,n,1),this}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,e.a=i},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector4",isVector4:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.elements=r.vec4.fromValues(t,e,n,i)},copy:function(t){return r.vec4.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2],t[3])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t[3+e]=n[3],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],this},set:function(t,e,n,i){return r.vec4.set(this.elements,t,e,n,i),this},add:function(t,e){return e||(e=t,t=this),r.vec4.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec4.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec4.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec4.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec4.ceil(this.elements,this.elements),this},floor:function(){return r.vec4.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec4.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec4.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec4.round(this.elements,this.elements),this},scale:function(t){return r.vec4.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec4.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec4.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec4.squaredDistance(t.elements,e.elements)},length:function(){return r.vec4.length(this.elements)},squaredLength:function(){return r.vec4.squaredLength(this.elements)},negate:function(){return r.vec4.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec4.inverse(this.elements,t.elements),this},normalize:function(){return r.vec4.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec4.dot(t.elements,e.elements)},lerp:function(t,e){return r.vec4.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return t=t||1,this.elements[0]=Math.random(),this.elements[1]=Math.random(),this.elements[2]=Math.random(),this.elements[3]=Math.random(),this.normalize(),this.scale(t),this},transformMat4:function(t){return r.vec4.transformMat4(this.elements,this.elements,t.elements),this},transformQuat:function(t){return r.vec4.transformQuat(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec4.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec4.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t}},w:{get:function(){return this.elements[3]},set:function(t){this.elements[3]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},function(t,e,n){"use strict";var r=n(1),i=n(6),s=n(7),u=n(3),o=new s.a,a=i.a.DEG2RAD,c=i.a.RAD2DEG,f=r.a.create({className:"Euler",isEuler:!0,order:"ZYX",constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=new Float32Array([t,e,n]),this.updateDegrees()},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.elements[0]=t.x,this.elements[1]=t.y,this.elements[2]=t.z,this.order=t.order,this.updateDegrees(),this},set:function(t,e,n){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=n,this.updateDegrees(),this},setDegree:function(t,e,n){return this._degX=t,this._degY=e,this._degZ=n,this.updateRadians(),this},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.elements[0]=t[e],this.elements[1]=t[e+1],this.elements[2]=t[e+2],this.updateDegrees(),this},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.elements[0],t[e+1]=this.elements[1],t[e+2]=this.elements[2],t},fromMat4:function(t,e){var n=t.elements,r=n[0],s=n[1],o=n[2],a=n[4],c=n[5],f=n[6],h=n[8],l=n[9],m=n[10];e=e||this.order,this.order=e;var d=i.a.clamp;return"XYZ"===e?(this.elements[1]=Math.asin(d(h,-1,1)),Math.abs(h)<.99999?(this.elements[0]=Math.atan2(-l,m),this.elements[2]=Math.atan2(-a,r)):(this.elements[0]=Math.atan2(f,c),this.elements[2]=0)):"YXZ"===e?(this.elements[0]=Math.asin(-d(l,-1,1)),Math.abs(l)<.99999?(this.elements[1]=Math.atan2(h,m),this.elements[2]=Math.atan2(s,c)):(this.elements[1]=Math.atan2(-o,r),this.elements[2]=0)):"ZXY"===e?(this.elements[0]=Math.asin(d(f,-1,1)),Math.abs(f)<.99999?(this.elements[1]=Math.atan2(-o,m),this.elements[2]=Math.atan2(-a,c)):(this.elements[1]=0,this.elements[2]=Math.atan2(s,r))):"ZYX"===e?(this.elements[1]=Math.asin(-d(o,-1,1)),Math.abs(o)<.99999?(this.elements[0]=Math.atan2(f,m),this.elements[2]=Math.atan2(s,r)):(this.elements[0]=0,this.elements[2]=Math.atan2(-a,c))):"YZX"===e?(this.elements[2]=Math.asin(d(s,-1,1)),Math.abs(s)<.99999?(this.elements[0]=Math.atan2(-l,c),this.elements[1]=Math.atan2(-o,r)):(this.elements[0]=0,this.elements[1]=Math.atan2(h,m))):"XZY"===e?(this.elements[2]=Math.asin(-d(a,-1,1)),Math.abs(a)<.99999?(this.elements[0]=Math.atan2(f,c),this.elements[1]=Math.atan2(h,r)):(this.elements[0]=Math.atan2(-l,m),this.elements[1]=0)):u.a.warn("Euler fromMat4() unsupported order: "+e),this.updateDegrees(),this},fromQuat:function(t,e){return o.fromQuat(t),this.fromMat4(o,e)},updateDegrees:function(){return this._degX=this.elements[0]*c,this._degY=this.elements[1]*c,this._degZ=this.elements[2]*c,this},updateRadians:function(){return this.elements[0]=this._degX*a,this.elements[1]=this._degY*a,this.elements[2]=this._degZ*a,this},degX:{get:function(){return this._degX},set:function(t){this._degX=t,this.elements[0]=t*a}},degY:{get:function(){return this._degY},set:function(t){this._degY=t,this.elements[1]=t*a}},degZ:{get:function(){return this._degZ},set:function(t){this._degZ=t,this.elements[2]=t*a}},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this._degX=t*c}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this._degY=t*c}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this._degZ=t*c}}});e.a=f},function(t,e,n){"use strict";var r=n(0),i=n(1).a.create({className:"Vector2",isVector2:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.elements=r.vec2.fromValues(t,e)},copy:function(t){return r.vec2.copy(this.elements,t.elements),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],this},set:function(t,e){return r.vec2.set(this.elements,t,e),this},add:function(t,e){return e||(e=t,t=this),r.vec2.add(this.elements,t.elements,e.elements),this},subtract:function(t,e){return e||(e=t,t=this),r.vec2.subtract(this.elements,t.elements,e.elements),this},multiply:function(t,e){return e||(e=t,t=this),r.vec2.multiply(this.elements,t.elements,e.elements),this},divide:function(t,e){return e||(e=t,t=this),r.vec2.divide(this.elements,t.elements,e.elements),this},ceil:function(){return r.vec2.ceil(this.elements,this.elements),this},floor:function(){return r.vec2.floor(this.elements,this.elements),this},min:function(t,e){return e||(e=t,t=this),r.vec2.min(this.elements,t.elements,e.elements),this},max:function(t,e){return e||(e=t,t=this),r.vec2.max(this.elements,t.elements,e.elements),this},round:function(){return r.vec2.round(this.elements,this.elements),this},scale:function(t){return r.vec2.scale(this.elements,this.elements,t),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec2.scaleAndAdd(this.elements,e.elements,n.elements,t),this},distance:function(t,e){return e||(e=t,t=this),r.vec2.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec2.squaredDistance(t.elements,e.elements)},length:function(){return r.vec2.length(this.elements)},squaredLength:function(){return r.vec2.squaredLength(this.elements)},negate:function(){return r.vec2.negate(this.elements,this.elements),this},inverse:function(t){return t||(t=this),r.vec2.inverse(this.elements,t.elements),this},normalize:function(){return r.vec2.normalize(this.elements,this.elements),this},dot:function(t,e){return e||(e=t,t=this),r.vec2.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec2.cross(this.elements,t.elements,e.elements),this},lerp:function(t,e){return r.vec2.lerp(this.elements,this.elements,t.elements,e),this},random:function(t){return r.vec2.random(this.elements,t),this},transformMat3:function(t){return r.vec2.transformMat3(this.elements,this.elements,t.elements),this},transformMat4:function(t){return r.vec2.transformMat4(this.elements,this.elements,t.elements),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec2.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec2.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t}}});i.prototype.sub=i.prototype.subtract,i.prototype.mul=i.prototype.multiply,i.prototype.div=i.prototype.divide,i.prototype.dist=i.prototype.distance,i.prototype.sqrDist=i.prototype.squaredDistance,i.prototype.len=i.prototype.length,i.prototype.sqrLen=i.prototype.squaredLength,e.a=i},,function(t,e,n){"use strict";var r=n(34),i=n.n(r),s=n(1),u=n(5),o=s.a.create({className:"Ray",isRay:!0,origin:{get:function(){return this._origin},set:function(t){this._origin=t,this._ray.origin=t.elements}},direction:{get:function(){return this._direction},set:function(t){this._direction=t,this._ray.direction=t.elements}},constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._ray=new i.a,this.origin=t.origin||new u.a(0,0,0),this.direction=t.direction||new u.a(0,0,-1)},set:function(t,e){return this.origin=t,this.direction=e,this},copy:function(t){this.origin.copy(t.origin),this.direction.copy(t.direction)},clone:function(){return new this.constructor({origin:this.origin.clone(),direction:this.direction.clone()})},fromCamera:function(t,e,n,r,i){t.isPerspectiveCamera?(t.worldMatrix.getTranslation(this.origin),this.direction.set(e,n,0),this.direction.copy(t.unprojectVector(this.direction,r,i)),this.direction.sub(this.origin).normalize()):t.isOrthographicCamera&&(this.origin.set(e,n,(t.near+t.far)/(t.near-t.far)),this.origin.copy(t.unprojectVector(this.origin,r,i)),this.direction.set(0,0,-1).transformDirection(t.worldMatrix).normalize())},transformMat4:function(t){this.origin.transformMat4(t),this.direction.transformDirection(t).normalize()},sortPoints:function(t,e){var n=this;e?t.sort((function(t,r){return n.squaredDistance(t[e])-n.squaredDistance(r[e])})):t.sort((function(t,e){return n.squaredDistance(t)-n.squaredDistance(e)}))},squaredDistance:function(t){return this.origin.squaredDistance(t)},distance:function(t){return this.origin.distance(t)},intersectsSphere:function(t,e){var n=this._ray.intersectsSphere(t,e);return this._getRes(n)},intersectsPlane:function(t,e){var n=this._ray.intersectsPlane(t,e);return this._getRes(n)},intersectsTriangle:function(t){var e=this._ray.intersectsTriangle(t);return this._getRes(e)},intersectsBox:function(t){var e=this._ray.intersectsBox(t);return this._getRes(e)},intersectsTriangleCell:function(t,e){var n=this._ray.intersectsTriangleCell(t,e);return this._getRes(n)},_getRes:function(t){return t?new u.a(t[0],t[1],t[2]):null}});e.a=o},function(t,e,n){"use strict";var r=n(0),i=n(1),s=n(9),u=n(5),o=i.a.create({Mixes:s.a,Extends:u.a,className:"Vector3Notifier",isVector3Notifier:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.elements=r.vec3.fromValues(t,e,n)},copy:function(t){return r.vec3.copy(this.elements,t.elements),this.fire("update"),this},clone:function(){var t=this.elements;return new this.constructor(t[0],t[1],t[2])},toArray:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[0+e]=n[0],t[1+e]=n[1],t[2+e]=n[2],t},fromArray:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return n[0]=t[e+0],n[1]=t[e+1],n[2]=t[e+2],this.fire("update"),this},set:function(t,e,n){return r.vec3.set(this.elements,t,e,n),this.fire("update"),this},add:function(t,e){return e||(e=t,t=this),r.vec3.add(this.elements,t.elements,e.elements),this.fire("update"),this},subtract:function(t,e){return e||(e=t,t=this),r.vec3.subtract(this.elements,t.elements,e.elements),this.fire("update"),this},multiply:function(t,e){return e||(e=t,t=this),r.vec3.multiply(this.elements,t.elements,e.elements),this.fire("update"),this},divide:function(t,e){return e||(e=t,t=this),r.vec3.divide(this.elements,t.elements,e.elements),this.fire("update"),this},ceil:function(){return r.vec3.ceil(this.elements,this.elements),this.fire("update"),this},floor:function(){return r.vec3.floor(this.elements,this.elements),this.fire("update"),this},min:function(t,e){return e||(e=t,t=this),r.vec3.min(this.elements,t.elements,e.elements),this.fire("update"),this},max:function(t,e){return e||(e=t,t=this),r.vec3.max(this.elements,t.elements,e.elements),this.fire("update"),this},round:function(){return r.vec3.round(this.elements,this.elements),this.fire("update"),this},scale:function(t){return r.vec3.scale(this.elements,this.elements,t),this.fire("update"),this},scaleAndAdd:function(t,e,n){return n||(n=e,e=this),r.vec3.scaleAndAdd(this.elements,e.elements,n.elements,t),this.fire("update"),this},distance:function(t,e){return e||(e=t,t=this),r.vec3.distance(t.elements,e.elements)},squaredDistance:function(t,e){return e||(e=t,t=this),r.vec3.squaredDistance(t.elements,e.elements)},length:function(){return r.vec3.length(this.elements)},squaredLength:function(){return r.vec3.squaredLength(this.elements)},negate:function(){return r.vec3.negate(this.elements,this.elements),this.fire("update"),this},inverse:function(t){return t||(t=this),r.vec3.inverse(this.elements,t.elements),this.fire("update"),this},normalize:function(){return r.vec3.normalize(this.elements,this.elements),this.fire("update"),this},dot:function(t,e){return e||(e=t,t=this),r.vec3.dot(t.elements,e.elements)},cross:function(t,e){return e||(e=t,t=this),r.vec3.cross(this.elements,t.elements,e.elements),this.fire("update"),this},lerp:function(t,e){return r.vec3.lerp(this.elements,this.elements,t.elements,e),this.fire("update"),this},hermite:function(t,e,n,i,s){return r.vec3.hermite(this.elements,t.elements,e.elements,n.elements,i.elements,s),this.fire("update"),this},bezier:function(t,e,n,i,s){return r.vec3.bezier(this.elements,t.elements,e.elements,n.elements,i.elements,s),this.fire("update"),this},random:function(t){return r.vec3.random(this.elements,t),this.fire("update"),this},transformMat3:function(t){return r.vec3.transformMat3(this.elements,this.elements,t.elements),this.fire("update"),this},transformMat4:function(t){return r.vec3.transformMat4(this.elements,this.elements,t.elements),this.fire("update"),this},transformDirection:function(t){var e=this.elements,n=t.elements,r=e[0],i=e[1],s=e[2];return e[0]=r*n[0]+i*n[4]+s*n[8],e[1]=r*n[1]+i*n[5]+s*n[9],e[2]=r*n[2]+i*n[6]+s*n[10],this.fire("update"),this},transformQuat:function(t){return r.vec3.transformQuat(this.elements,this.elements,t.elements),this.fire("update"),this},rotateX:function(t,e){return r.vec3.rotateX(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateY:function(t,e){return r.vec3.rotateY(this.elements,this.elements,t.elements,e),this.fire("update"),this},rotateZ:function(t,e){return r.vec3.rotateZ(this.elements,this.elements,t.elements,e),this.fire("update"),this},exactEquals:function(t,e){return e||(e=t,t=this),r.vec3.exactEquals(t.elements,e.elements)},equals:function(t,e){return e||(e=t,t=this),r.vec3.equals(t.elements,e.elements)},x:{get:function(){return this.elements[0]},set:function(t){this.elements[0]=t,this.fire("update")}},y:{get:function(){return this.elements[1]},set:function(t){this.elements[1]=t,this.fire("update")}},z:{get:function(){return this.elements[2]},set:function(t){this.elements[2]=t,this.fire("update")}}});e.a=o},,function(t,e,n){"use strict";var r=n(1),i=n(5),s=r.a.create({className:"Plane",isPlane:!0,constructor:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.a,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.normal=t,this.distance=e},copy:function(t){return this.normal.copy(t.normal),this.distance=t.distance,this},clone:function(){return new this.constructor(this.normal.clone(),this.distance)},set:function(t,e,n,r){return this.normal.set(t,e,n),this.distance=r,this},normalize:function(){var t=1/this.normal.length();return this.normal.scale(t),this.distance*=t,this},distanceToPoint:function(t){return this.normal.dot(t)+this.distance},projectPoint:function(t){return(new i.a).copy(this.normal).scale(-this.distanceToPoint(t)).add(t)}});e.a=s},function(t,e,n){"use strict";var r=n(1),i=n(5),s=new i.a,u=r.a.create({className:"Sphere",isSphere:!0,radius:0,constructor:function(t){Object.assign(this,t),this.center||(this.center=new i.a(0,0,0))},clone:function(){var t=new this.constructor;return t.copy(this),t},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},fromPoints:function(t){for(var e=this.center,n=0,r=0;r