@blockv/threejs-to-v3d
Version:
Converts any format supported by ThreeJS to V3D.
1 lines • 582 kB
JavaScript
var ThreeJSConverter=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,r){"use strict";function n(){}function i(t,e){this.x=t||0,this.y=e||0}function a(t,e,r,n,o,s,c,u,h,l){Object.defineProperty(this,"id",{value:Es++}),this.uuid=Ms.generateUUID(),this.name="",this.image=void 0!==t?t:a.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:a.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:yo,this.wrapT=void 0!==n?n:yo,this.magFilter=void 0!==o?o:Mo,this.minFilter=void 0!==s?s:To,this.anisotropy=void 0!==h?h:1,this.format=void 0!==c?c:Go,this.type=void 0!==u?u:So,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:ps,this.version=0,this.onUpdate=null}function o(t,e,r,n){this.x=t||0,this.y=e||0,this.z=r||0,this.w=void 0!==n?n:1}function s(t,e,r){this.uuid=Ms.generateUUID(),this.width=t,this.height=e,this.scissor=new o(0,0,t,e),this.scissorTest=!1,this.viewport=new o(0,0,t,e),r=r||{},void 0===r.minFilter&&(r.minFilter=Mo),this.texture=new a(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function c(t,e,r){s.call(this,t,e,r),this.activeCubeFace=0,this.activeMipMapLevel=0}function u(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._w=void 0!==n?n:1}function h(t,e,r){this.x=t||0,this.y=e||0,this.z=r||0}function l(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function d(t,e,r,n,i,o,s,c,u,h,l,d){a.call(this,null,o,s,c,u,h,n,i,l,d),this.image={data:t,width:e,height:r},this.magFilter=void 0!==u?u:bo,this.minFilter=void 0!==h?h:bo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function p(t,e,r,n,i,o,s,c,u,h){t=void 0!==t?t:[],e=void 0!==e?e:uo,a.call(this,t,e,r,n,i,o,s,c,u,h),this.flipY=!1}function f(){this.seq=[],this.map={}}function m(t,e,r){var n=t[0];if(n<=0||n>0)return t;var i=e*r,a=As[i];if(void 0===a&&(a=new Float32Array(i),As[i]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=r,t[o].toArray(a,s)}return a}function v(t,e){var r=Ls[e];void 0===r&&(r=new Int32Array(e),Ls[e]=r);for(var n=0;n!==e;++n)r[n]=t.allocTextureUnit();return r}function g(t,e){t.uniform1f(this.addr,e)}function y(t,e){t.uniform1i(this.addr,e)}function x(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function b(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function _(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function w(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function M(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Ps.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Ps))}function E(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Rs.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Rs))}function T(t,e,r){var n=r.allocTextureUnit();t.uniform1i(this.addr,n),r.setTexture2D(e||Ts,n)}function S(t,e,r){var n=r.allocTextureUnit();t.uniform1i(this.addr,n),r.setTextureCube(e||Ss,n)}function A(t,e){t.uniform2iv(this.addr,e)}function L(t,e){t.uniform3iv(this.addr,e)}function R(t,e){t.uniform4iv(this.addr,e)}function P(t){switch(t){case 5126:return g;case 35664:return x;case 35665:return b;case 35666:return _;case 35674:return w;case 35675:return M;case 35676:return E;case 35678:return T;case 35680:return S;case 5124:case 35670:return y;case 35667:case 35671:return A;case 35668:case 35672:return L;case 35669:case 35673:return R}}function C(t,e){t.uniform1fv(this.addr,e)}function I(t,e){t.uniform1iv(this.addr,e)}function U(t,e){t.uniform2fv(this.addr,m(e,this.size,2))}function N(t,e){t.uniform3fv(this.addr,m(e,this.size,3))}function O(t,e){t.uniform4fv(this.addr,m(e,this.size,4))}function B(t,e){t.uniformMatrix2fv(this.addr,!1,m(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,m(e,this.size,9))}function F(t,e){t.uniformMatrix4fv(this.addr,!1,m(e,this.size,16))}function z(t,e,r){var n=e.length,i=v(r,n);t.uniform1iv(this.addr,i);for(var a=0;a!==n;++a)r.setTexture2D(e[a]||Ts,i[a])}function G(t,e,r){var n=e.length,i=v(r,n);t.uniform1iv(this.addr,i);for(var a=0;a!==n;++a)r.setTextureCube(e[a]||Ss,i[a])}function k(t){switch(t){case 5126:return C;case 35664:return U;case 35665:return N;case 35666:return O;case 35674:return B;case 35675:return D;case 35676:return F;case 35678:return z;case 35680:return G;case 5124:case 35670:return I;case 35667:case 35671:return A;case 35668:case 35672:return L;case 35669:case 35673:return R}}function H(t,e,r){this.id=t,this.addr=r,this.setValue=P(e.type)}function V(t,e,r){this.id=t,this.addr=r,this.size=e.size,this.setValue=k(e.type)}function j(t){this.id=t,f.call(this)}function W(t,e){t.seq.push(e),t.map[e.id]=e}function X(t,e,r){var n=t.name,i=n.length;for(Cs.lastIndex=0;;){var a=Cs.exec(n),o=Cs.lastIndex,s=a[1],c="]"===a[2],u=a[3];if(c&&(s|=0),void 0===u||"["===u&&o+2===i){W(r,void 0===u?new H(s,t,e):new V(s,t,e));break}var h=r.map,l=h[s];void 0===l&&(l=new j(s),W(r,l)),r=l}}function q(t,e,r){f.call(this),this.renderer=r;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i<n;++i){var a=t.getActiveUniform(e,i),o=a.name;X(a,t.getUniformLocation(e,o),this)}}function Y(t,e,r){return void 0===e&&void 0===r?this.set(t):this.setRGB(t,e,r)}function Z(t,e){this.min=void 0!==t?t:new i(1/0,1/0),this.max=void 0!==e?e:new i(-1/0,-1/0)}function J(t,e){function r(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),d=f.createTexture(),p=f.createTexture(),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},c=n(s),u={vertex:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},l={renderType:f.getUniformLocation(c,"renderType"),map:f.getUniformLocation(c,"map"),occlusionMap:f.getUniformLocation(c,"occlusionMap"),opacity:f.getUniformLocation(c,"opacity"),color:f.getUniformLocation(c,"color"),scale:f.getUniformLocation(c,"scale"),rotation:f.getUniformLocation(c,"rotation"),screenPosition:f.getUniformLocation(c,"screenPosition")}}function n(e){var r=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),i=f.createShader(f.VERTEX_SHADER),a="precision "+t.getPrecision()+" float;\n";return f.shaderSource(n,a+e.fragmentShader),f.shaderSource(i,a+e.vertexShader),f.compileShader(n),f.compileShader(i),f.attachShader(r,n),f.attachShader(r,i),f.linkProgram(r),r}var a,o,s,c,u,l,d,p,f=t.context,m=t.state;this.render=function(n,s,v){if(0!==e.length){var g=new h,y=v.w/v.z,x=.5*v.z,b=.5*v.w,_=16/v.w,w=new i(_*y,_),M=new h(1,1,0),E=new i(1,1),T=new Z;T.min.set(v.x,v.y),T.max.set(v.x+(v.z-16),v.y+(v.w-16)),void 0===c&&r(),f.useProgram(c),m.initAttributes(),m.enableAttribute(u.vertex),m.enableAttribute(u.uv),m.disableUnusedAttributes(),f.uniform1i(l.occlusionMap,0),f.uniform1i(l.map,1),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(u.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),m.disable(f.CULL_FACE),m.buffers.depth.setMask(!1);for(var S=0,A=e.length;S<A;S++){_=16/v.w,w.set(_*y,_);var L=e[S];if(g.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyMatrix4(s.projectionMatrix),M.copy(g),E.x=v.x+M.x*x+x-8,E.y=v.y+M.y*b+b-8,!0===T.containsPoint(E)){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,E.x,E.y,16,16,0),f.uniform1i(l.renderType,0),f.uniform2f(l.scale,w.x,w.y),f.uniform3f(l.screenPosition,M.x,M.y,M.z),m.disable(f.BLEND),m.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,E.x,E.y,16,16,0),f.uniform1i(l.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,d),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),L.positionScreen.copy(M),L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares(),f.uniform1i(l.renderType,2),m.enable(f.BLEND);for(var R=0,P=L.lensFlares.length;R<P;R++){var C=L.lensFlares[R];C.opacity>.001&&C.scale>.001&&(M.x=C.x,M.y=C.y,M.z=C.z,_=C.size*C.scale/v.w,w.x=_*y,w.y=_,f.uniform3f(l.screenPosition,M.x,M.y,M.z),f.uniform2f(l.scale,w.x,w.y),f.uniform1f(l.rotation,C.rotation),f.uniform1f(l.opacity,C.opacity),f.uniform3f(l.color,C.color.r,C.color.g,C.color.b),m.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),t.setTexture2D(C.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.buffers.depth.setMask(!0),t.resetGLState()}}}function Q(t,e){function r(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),s=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),c=n(),l={position:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},d={uvOffset:f.getUniformLocation(c,"uvOffset"),uvScale:f.getUniformLocation(c,"uvScale"),rotation:f.getUniformLocation(c,"rotation"),scale:f.getUniformLocation(c,"scale"),color:f.getUniformLocation(c,"color"),map:f.getUniformLocation(c,"map"),opacity:f.getUniformLocation(c,"opacity"),modelViewMatrix:f.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(c,"projectionMatrix"),fogType:f.getUniformLocation(c,"fogType"),fogDensity:f.getUniformLocation(c,"fogDensity"),fogNear:f.getUniformLocation(c,"fogNear"),fogFar:f.getUniformLocation(c,"fogFar"),fogColor:f.getUniformLocation(c,"fogColor"),alphaTest:f.getUniformLocation(c,"alphaTest")};var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=8,r.height=8;var i=r.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),p=new a(r),p.needsUpdate=!0}function n(){var e=f.createProgram(),r=f.createShader(f.VERTEX_SHADER),n=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(r),f.compileShader(n),f.attachShader(e,r),f.attachShader(e,n),f.linkProgram(e),e}function i(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var o,s,c,l,d,p,f=t.context,m=t.state,v=new h,g=new u,y=new h;this.render=function(n,a){if(0!==e.length){void 0===c&&r(),f.useProgram(c),m.initAttributes(),m.enableAttribute(l.position),m.enableAttribute(l.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(l.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.uniformMatrix4fv(d.projectionMatrix,!1,a.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(d.map,0);var u=0,h=0,x=n.fog;x?(f.uniform3f(d.fogColor,x.color.r,x.color.g,x.color.b),x.isFog?(f.uniform1f(d.fogNear,x.near),f.uniform1f(d.fogFar,x.far),f.uniform1i(d.fogType,1),u=1,h=1):x.isFogExp2&&(f.uniform1f(d.fogDensity,x.density),f.uniform1i(d.fogType,2),u=2,h=2)):(f.uniform1i(d.fogType,0),u=0,h=0);for(var b=0,_=e.length;b<_;b++){var w=e[b];w.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(i);for(var M=[],b=0,_=e.length;b<_;b++){var w=e[b],E=w.material;if(!1!==E.visible){f.uniform1f(d.alphaTest,E.alphaTest),f.uniformMatrix4fv(d.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(v,g,y),M[0]=y.x,M[1]=y.y;var T=0;n.fog&&E.fog&&(T=h),u!==T&&(f.uniform1i(d.fogType,T),u=T),null!==E.map?(f.uniform2f(d.uvOffset,E.map.offset.x,E.map.offset.y),f.uniform2f(d.uvScale,E.map.repeat.x,E.map.repeat.y)):(f.uniform2f(d.uvOffset,0,0),f.uniform2f(d.uvScale,1,1)),f.uniform1f(d.opacity,E.opacity),f.uniform3f(d.color,E.color.r,E.color.g,E.color.b),f.uniform1f(d.rotation,E.rotation),f.uniform2fv(d.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.buffers.depth.setTest(E.depthTest),m.buffers.depth.setMask(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(p,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),t.resetGLState()}}}function K(){Object.defineProperty(this,"id",{value:Ds++}),this.uuid=Ms.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Ta,this.side=va,this.shading=ba,this.vertexColors=_a,this.opacity=1,this.transparent=!1,this.blendSrc=za,this.blendDst=Ga,this.blendEquation=Pa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Za,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function $(t){K.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){K.call(this),this.type="MeshDepthMaterial",this.depthPacking=_s,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new h(1/0,1/0,1/0),this.max=void 0!==e?e:new h(-1/0,-1/0,-1/0)}function rt(t,e){this.center=void 0!==t?t:new h,this.radius=void 0!==e?e:0}function nt(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function it(t,e){this.normal=void 0!==t?t:new h(1,0,0),this.constant=void 0!==e?e:0}function at(t,e,r,n,i,a){this.planes=[void 0!==t?t:new it,void 0!==e?e:new it,void 0!==r?r:new it,void 0!==n?n:new it,void 0!==i?i:new it,void 0!==a?a:new it]}function ot(t,e,r,n){function a(e,r,n,i){var a=e.geometry,o=null,s=M,c=e.customDepthMaterial;if(n&&(s=E,c=e.customDistanceMaterial),c)o=c;else{var u=!1;r.morphTargets&&(a&&a.isBufferGeometry?u=a.morphAttributes&&a.morphAttributes.position&&a.morphAttributes.position.length>0:a&&a.isGeometry&&(u=a.morphTargets&&a.morphTargets.length>0)),e.isSkinnedMesh&&!1===r.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var h=e.isSkinnedMesh&&r.skinning,l=0;u&&(l|=b),h&&(l|=_),o=s[l]}if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var d=o.uuid,p=r.uuid,f=T[d];void 0===f&&(f={},T[d]=f);var m=f[p];void 0===m&&(m=o.clone(),f[p]=m),o=m}o.visible=r.visible,o.wireframe=r.wireframe;var v=r.side;return D.renderSingleSided&&v==ya&&(v=va),D.renderReverseSided&&(v===va?v=ga:v===ga&&(v=va)),o.side=v,o.clipShadows=r.clipShadows,o.clippingPlanes=r.clippingPlanes,o.wireframeLinewidth=r.wireframeLinewidth,o.linewidth=r.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(i),o}function c(e,n,i,o){if(!1!==e.visible){if(e.layers.test(n.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||p.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld);var s=r.update(e),u=e.material;if(Array.isArray(u))for(var h=s.groups,l=0,d=h.length;l<d;l++){var f=h[l],m=u[f.materialIndex];if(m&&m.visible){var v=a(e,m,o,x);t.renderBufferDirect(i,null,s,v,e,f)}}else if(u.visible){var v=a(e,u,o,x);t.renderBufferDirect(i,null,s,v,e,null)}}for(var g=e.children,y=0,b=g.length;y<b;y++)c(g[y],n,i,o)}}var u=t.context,d=t.state,p=new at,f=new l,m=e.shadows,v=new i,g=new i(n.maxTextureSize,n.maxTextureSize),y=new h,x=new h,b=1,_=2,w=1+(b|_),M=new Array(w),E=new Array(w),T={},S=[new h(1,0,0),new h(-1,0,0),new h(0,0,1),new h(0,0,-1),new h(0,1,0),new h(0,-1,0)],A=[new h(0,1,0),new h(0,1,0),new h(0,1,0),new h(0,1,0),new h(0,0,1),new h(0,0,-1)],L=[new o,new o,new o,new o,new o,new o],R=new tt;R.depthPacking=ws,R.clipping=!0;for(var P=Bs.distanceRGBA,C=Ns.clone(P.uniforms),I=0;I!==w;++I){var U=0!=(I&b),N=0!=(I&_),O=R.clone();O.morphTargets=U,O.skinning=N,M[I]=O;var B=new $({defines:{USE_SHADOWMAP:""},uniforms:C,vertexShader:P.vertexShader,fragmentShader:P.fragmentShader,morphTargets:U,skinning:N,clipping:!0});E[I]=B}var D=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=fa,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,r){if(!1!==D.enabled&&(!1!==D.autoUpdate||!1!==D.needsUpdate)&&0!==m.length){d.disable(u.BLEND),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var n,i,a=0,o=m.length;a<o;a++){var h=m[a],l=h.shadow;if(void 0!==l){var b=l.camera,_=l.matrix;if(x.setFromMatrixPosition(h.matrixWorld),b.position.copy(x),v.copy(l.mapSize),v.min(g),h&&h.isPointLight){n=6,i=!0;var w=v.x,M=v.y;L[0].set(2*w,M,w,M),L[1].set(0,M,w,M),L[2].set(3*w,M,w,M),L[3].set(w,M,w,M),L[4].set(3*w,0,w,M),L[5].set(w,0,w,M),v.x*=4,v.y*=2,_.makeTranslation(-x.x,-x.y,-x.z)}else n=1,i=!1,y.setFromMatrixPosition(h.target.matrixWorld),b.lookAt(y),b.updateMatrixWorld(),b.matrixWorldInverse.getInverse(b.matrixWorld),_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(b.projectionMatrix),_.multiply(b.matrixWorldInverse);if(null===l.map){var E={minFilter:bo,magFilter:bo,format:Go};l.map=new s(v.x,v.y,E),l.map.texture.name=h.name+".shadowMap",b.updateProjectionMatrix()}l.isSpotLightShadow&&l.update(h);var T=l.map;t.setRenderTarget(T),t.clear();for(var R=0;R<n;R++){if(i){y.copy(b.position),y.add(S[R]),b.up.copy(A[R]),b.lookAt(y),b.updateMatrixWorld(),b.matrixWorldInverse.getInverse(b.matrixWorld);var P=L[R];d.viewport(P)}f.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),p.setFromMatrix(f),c(e,r,b,i)}}else console.warn("THREE.WebGLShadowMap:",h,"has no shadow.")}var C=t.getClearColor(),I=t.getClearAlpha();t.setClearColor(C,I),D.needsUpdate=!1}}}function st(t,e){this.origin=void 0!==t?t:new h,this.direction=void 0!==e?e:new h}function ct(t,e,r,n){this._x=t||0,this._y=e||0,this._z=r||0,this._order=n||ct.DefaultOrder}function ut(){this.mask=1}function ht(){function t(){i.setFromEuler(n,!1)}function e(){n.setFromQuaternion(i,void 0,!1)}Object.defineProperty(this,"id",{value:Fs++}),this.uuid=Ms.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DefaultUp.clone();var r=new h,n=new ct,i=new u,a=new h(1,1,1);n.onChange(t),i.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new l},normalMatrix:{value:new nt}}),this.matrix=new l,this.matrixWorld=new l,this.matrixAutoUpdate=ht.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ut,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function lt(t,e){this.start=void 0!==t?t:new h,this.end=void 0!==e?e:new h}function dt(t,e,r){this.a=void 0!==t?t:new h,this.b=void 0!==e?e:new h,this.c=void 0!==r?r:new h}function pt(t,e,r,n,i,a){this.a=t,this.b=e,this.c=r,this.normal=n&&n.isVector3?n:new h,this.vertexNormals=Array.isArray(n)?n:[],this.color=i&&i.isColor?i:new Y,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}function ft(t){K.call(this),this.type="MeshBasicMaterial",this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=to,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function mt(t,e,r){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Ms.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===r,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function vt(t,e){mt.call(this,new Int8Array(t),e)}function gt(t,e){mt.call(this,new Uint8Array(t),e)}function yt(t,e){mt.call(this,new Uint8ClampedArray(t),e)}function xt(t,e){mt.call(this,new Int16Array(t),e)}function bt(t,e){mt.call(this,new Uint16Array(t),e)}function _t(t,e){mt.call(this,new Int32Array(t),e)}function wt(t,e){mt.call(this,new Uint32Array(t),e)}function Mt(t,e){mt.call(this,new Float32Array(t),e)}function Et(t,e){mt.call(this,new Float64Array(t),e)}function Tt(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function St(t){if(0===t.length)return-1/0;for(var e=t[0],r=1,n=t.length;r<n;++r)t[r]>e&&(e=t[r]);return e}function At(){return zs++}function Lt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Ms.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Rt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Ms.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Pt(t,e){ht.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new ft({color:16777215*Math.random()}),this.drawMode=hs,this.updateMorphTargets()}function Ct(t,e,r,n,i,a){Lt.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new It(t,e,r,n,i,a)),this.mergeVertices()}function It(t,e,r,n,i,a){function o(t,e,r,n,i,a,o,m,v,g,y){var x,b,_=a/v,w=o/g,M=a/2,E=o/2,T=m/2,S=v+1,A=g+1,L=0,R=0,P=new h;for(b=0;b<A;b++){var C=b*w-E;for(x=0;x<S;x++){var I=x*_-M;P[t]=I*n,P[e]=C*i,P[r]=T,u.push(P.x,P.y,P.z),P[t]=0,P[e]=0,P[r]=m>0?1:-1,l.push(P.x,P.y,P.z),d.push(x/v),d.push(1-b/g),L+=1}}for(b=0;b<g;b++)for(x=0;x<v;x++){var U=p+x+S*b,N=p+x+S*(b+1),O=p+(x+1)+S*(b+1),B=p+(x+1)+S*b;c.push(U,N,B),c.push(N,O,B),R+=6}s.addGroup(f,R,y),f+=R,p+=L}Rt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:r,widthSegments:n,heightSegments:i,depthSegments:a};var s=this;n=Math.floor(n)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var c=[],u=[],l=[],d=[],p=0,f=0;o("z","y","x",-1,-1,r,e,t,a,i,0),o("z","y","x",1,-1,r,e,-t,a,i,1),o("x","z","y",1,1,t,r,e,n,a,2),o("x","z","y",1,-1,t,r,-e,n,a,3),o("x","y","z",1,-1,t,e,r,n,i,4),o("x","y","z",-1,-1,t,e,-r,n,i,5),this.setIndex(c),this.addAttribute("position",new Mt(u,3)),this.addAttribute("normal",new Mt(l,3)),this.addAttribute("uv",new Mt(d,2))}function Ut(t,e,r,n){Lt.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new Nt(t,e,r,n)),this.mergeVertices()}function Nt(t,e,r,n){Rt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:r,heightSegments:n};var i,a,o=t/2,s=e/2,c=Math.floor(r)||1,u=Math.floor(n)||1,h=c+1,l=u+1,d=t/c,p=e/u,f=[],m=[],v=[],g=[];for(a=0;a<l;a++){var y=a*p-s;for(i=0;i<h;i++){var x=i*d-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/c),g.push(1-a/u)}}for(a=0;a<u;a++)for(i=0;i<c;i++){var b=i+h*a,_=i+h*(a+1),w=i+1+h*(a+1),M=i+1+h*a;f.push(b,_,M),f.push(_,w,M)}this.setIndex(f),this.addAttribute("position",new Mt(m,3)),this.addAttribute("normal",new Mt(v,3)),this.addAttribute("uv",new Mt(g,2))}function Ot(){ht.call(this),this.type="Camera",this.matrixWorldInverse=new l,this.projectionMatrix=new l}function Bt(t,e,r,n){Ot.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Dt(t,e,r,n,i,a){Ot.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=r,this.bottom=n,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Ft(t){function e(e,r){var n=e.array,i=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,a=t.createBuffer();t.bindBuffer(r,a),t.bufferData(r,n,i),e.onUploadCallback();var o=t.FLOAT;return n instanceof Float32Array?o=t.FLOAT:n instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):n instanceof Uint16Array?o=t.UNSIGNED_SHORT:n instanceof Int16Array?o=t.SHORT:n instanceof Uint32Array?o=t.UNSIGNED_INT:n instanceof Int32Array?o=t.INT:n instanceof Int8Array?o=t.BYTE:n instanceof Uint8Array&&(o=t.UNSIGNED_BYTE),{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}function r(e,r,n){var i=r.array,a=r.updateRange;t.bindBuffer(n,e),!1===r.dynamic?t.bufferData(n,i,t.STATIC_DRAW):-1===a.count?t.bufferSubData(n,0,i):0===a.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(n,a.offset*i.BYTES_PER_ELEMENT,i.subarray(a.offset,a.offset+a.count)),a.count=0)}function n(t){return t.isInterleavedBufferAttribute&&(t=t.data),o[t.uuid]}function i(e){var r=o[e.uuid];r&&(t.deleteBuffer(r.buffer),delete o[e.uuid])}function a(t,n){t.isInterleavedBufferAttribute&&(t=t.data);var i=o[t.uuid];void 0===i?o[t.uuid]=e(t,n):i.version<t.version&&(r(i.buffer,t,n),i.version=t.version)}var o={};return{get:n,remove:i,update:a}}function zt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Gt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function kt(){function t(){a=-1,s=-1}function e(t,e,r,n,c){var u,h;r.transparent?(u=o,h=++s):(u=i,h=++a);var l=u[h];l?(l.id=t.id,l.object=t,l.geometry=e,l.material=r,l.program=r.program,l.renderOrder=t.renderOrder,l.z=n,l.group=c):(l={id:t.id,object:t,geometry:e,material:r,program:r.program,renderOrder:t.renderOrder,z:n,group:c},u.push(l))}function r(){i.length=a+1,o.length=s+1}function n(){i.sort(zt),o.sort(Gt)}var i=[],a=-1,o=[],s=-1;return{opaque:i,transparent:o,init:t,push:e,finish:r,sort:n}}function Ht(){function t(t,e){var n=t.id+","+e.id,i=r[n];return void 0===i&&(i=new kt,r[n]=i),i}function e(){r={}}var r={};return{get:t,dispose:e}}function Vt(t,e,r){function n(t){s=t}function i(r){r.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,u=4):r.array instanceof Uint16Array?(c=t.UNSIGNED_SHORT,u=2):(c=t.UNSIGNED_BYTE,u=1)}function a(e,n){t.drawElements(s,n,c,e*u),r.calls++,r.vertices+=n,s===t.TRIANGLES&&(r.faces+=n/3)}function o(n,i,a){var o=e.get("ANGLE_instanced_arrays");if(null===o)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");o.drawElementsInstancedANGLE(s,a,c,i*u,n.maxInstancedCount),r.calls++,r.vertices+=a*n.maxInstancedCount,s===t.TRIANGLES&&(r.faces+=n.maxInstancedCount*a/3)}var s,c,u;this.setMode=n,this.setIndex=i,this.render=a,this.renderInstances=o}function jt(t,e,r){function n(t){o=t}function i(e,n){t.drawArrays(o,e,n),r.calls++,r.vertices+=n,o===t.TRIANGLES&&(r.faces+=n/3)}function a(n,i,a){var s=e.get("ANGLE_instanced_arrays");if(null===s)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var c=n.attributes.position;c.isInterleavedBufferAttribute?(a=c.data.count,s.drawArraysInstancedANGLE(o,0,a,n.maxInstancedCount)):s.drawArraysInstancedANGLE(o,i,a,n.maxInstancedCount),r.calls++,r.vertices+=a*n.maxInstancedCount,o===t.TRIANGLES&&(r.faces+=n.maxInstancedCount*a/3)}var o;this.setMode=n,this.render=i,this.renderInstances=a}function Wt(t,e,r){function n(t){var i=t.target,a=s[i.id];null!==a.index&&e.remove(a.index);for(var o in a.attributes)e.remove(a.attributes[o]);i.removeEventListener("dispose",n),delete s[i.id];var u=c[i.id];u&&(e.remove(u),delete c[i.id]),u=c[a.id],u&&(e.remove(u),delete c[a.id]),r.geometries--}function i(t,e){var i=s[e.id];return i||(e.addEventListener("dispose",n),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Rt).setFromObject(t)),i=e._bufferGeometry),s[e.id]=i,r.geometries++,i)}function a(r){var n=r.index,i=r.attributes;null!==n&&e.update(n,t.ELEMENT_ARRAY_BUFFER);for(var a in i)e.update(i[a],t.ARRAY_BUFFER);var o=r.morphAttributes;for(var a in o)for(var s=o[a],c=0,u=s.length;c<u;c++)e.update(s[c],t.ARRAY_BUFFER)}function o(r){var n=c[r.id];if(n)return n;var i=[],a=r.index,o=r.attributes;if(null!==a)for(var s=a.array,u=0,h=s.length;u<h;u+=3){var l=s[u+0],d=s[u+1],p=s[u+2];i.push(l,d,d,p,p,l)}else for(var s=o.position.array,u=0,h=s.length/3-1;u<h;u+=3){var l=u+0,d=u+1,p=u+2;i.push(l,d,d,p,p,l)}return n=new(St(i)>65535?wt:bt)(i,1),e.update(n,t.ELEMENT_ARRAY_BUFFER),c[r.id]=n,n}var s={},c={};return{get:i,update:a,getWireframeAttribute:o}}function Xt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var r;switch(e.type){case"DirectionalLight":r={direction:new h,color:new Y,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":r={position:new h,direction:new h,color:new Y,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":r={position:new h,color:new Y,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":r={direction:new h,skyColor:new Y,groundColor:new Y};break;case"RectAreaLight":r={color:new Y,position:new h,halfWidth:new h,halfHeight:new h}}return t[e.id]=r,r}}}function qt(t,e,r){function n(t){var n=r.frame,i=t.geometry,o=e.get(t,i);return a[o.id]!==n&&(i.isGeometry&&o.updateFromObject(t),e.update(o),a[o.id]=n),o}function i(){a={}}var a={};return{update:n,clear:i}}function Yt(t){for(var e=t.split("\n"),r=0;r<e.length;r++)e[r]=r+1+": "+e[r];return e.join("\n")}function Zt(t,e,r){var n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),Yt(r)),n}function Jt(t){switch(t){case ps:return["Linear","( value )"];case fs:return["sRGB","( value )"];case vs:return["RGBE","( value )"];case ys:return["RGBM","( value, 7.0 )"];case xs:return["RGBM","( value, 16.0 )"];case bs:return["RGBD","( value, 256.0 )"];case ms:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Qt(t,e){var r=Jt(e);return"vec4 "+t+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function Kt(t,e){var r=Jt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function $t(t,e){var r;switch(e){case io:r="Linear";break;case ao:r="Reinhard";break;case oo:r="Uncharted2";break;case so:r="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}function te(t,e,r){return t=t||{},[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ne).join("\n")}function ee(t){var e=[];for(var r in t){var n=t[r];!1!==n&&e.push("#define "+r+" "+n)}return e.join("\n")}function re(t,e,r){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),a=0;a<i;a++){var o=t.getActiveAttrib(e,a),s=o.name;n[s]=t.getAttribLocation(e,s)}return n}function ne(t){return""!==t}function ie(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function ae(t){function e(t,e){var r=Os[e];if(void 0===r)throw new Error("Can not resolve #include <"+e+">");return ae(r)}var r=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(r,e)}function oe(t){function e(t,e,r,n){for(var i="",a=parseInt(e);a<parseInt(r);a++)i+=n.replace(/\[ i \]/g,"[ "+a+" ]");return i}var r=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(r,e)}function se(t,e,r,n){var i=t.context,a=r.extensions,o=r.defines,s=r.__webglShader.vertexShader,c=r.__webglShader.fragmentShader,u="SHADOWMAP_TYPE_BASIC";n.shadowMapType===fa?u="SHADOWMAP_TYPE_PCF":n.shadowMapType===ma&&(u="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",l="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(r.envMap.mapping){case uo:case ho:h="ENVMAP_TYPE_CUBE";break;case mo:case vo:h="ENVMAP_TYPE_CUBE_UV";break;case lo:case po:h="ENVMAP_TYPE_EQUIREC";break;case fo:h="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case ho:case po:l="ENVMAP_MODE_REFRACTION"}switch(r.combine){case to:d="ENVMAP_BLENDING_MULTIPLY";break;case eo:d="ENVMAP_BLENDING_MIX";break;case ro:d="ENVMAP_BLENDING_ADD"}}var p,f,m=t.gammaFactor>0?t.gammaFactor:1,v=te(a,n,t.extensions),g=ee(o),y=i.createProgram();r.isRawShaderMaterial?(p=[g,"\n"].filter(ne).join("\n"),f=[v,g,"\n"].filter(ne).join("\n")):(p=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+r.__webglShader.name,g,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ne).join("\n"),f=[v,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+r.__webglShader.name,g,n.alphaTest?"#define ALPHATEST "+n.alphaTest:"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+l:"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexColors?"#define USE_COLOR":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(n.numClippingPlanes-n.numClipIntersection),n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==no?"#define TONE_MAPPING":"",n.toneMapping!==no?Os.tonemapping_pars_fragment:"",n.toneMapping!==no?$t("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?Os.encodings_pars_fragment:"",n.mapEncoding?Qt("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Qt("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Qt("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?Kt("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(ne).join("\n")),s=ae(s,n),s=ie(s,n),c=ae(c,n),c=ie(c,n),r.isShaderMaterial||(s=oe(s),c=oe(c));var x=p+s,b=f+c,_=Zt(i,i.VERTEX_SHADER,x),w=Zt(i,i.FRAGMENT_SHADER,b);i.attachShader(y,_),i.attachShader(y,w),void 0!==r.index0AttributeName?i.bindAttribLocation(y,0,r.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);var M=i.getProgramInfoLog(y),E=i.getShaderInfoLog(_),T=i.getShaderInfoLog(w),S=!0,A=!0;!1===i.getProgramParameter(y,i.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.VALIDATE_STATUS),"gl.getProgramInfoLog",M,E,T)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==E&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:r,programLog:M,vertexShader:{log:E,prefix:p},fragmentShader:{log:T,prefix:f}}),i.deleteShader(_),i.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new q(i,y,t)),L};var R;return this.getAttributes=function(){return void 0===R&&(R=re(i,y)),R},this.destroy=function(){i.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Gs++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=_,this.fragmentShader=w,this}function ce(t,e){function r(t){var r=t.skeleton,n=r.bones;if(e.floatVertexTextures)return 1024;var i=e.maxVertexUniforms,a=Math.floor((i-20)/4),o=Math.min(a,n.length);return o<n.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+n.length+" bones. This GPU supports "+o+"."),0):o}function n(t,e){var r;return t?t.isTexture?r=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),r=t.texture.encoding):r=ps,r===ps&&e&&(r=ms),r}var i=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},o=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];this.getParameters=function(i,o,s,c,u,h){var l=a[i.type],d=h.isSkinnedMesh?r(h):0,p=t.getPrecision();null!==i.precision&&(p=e.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",p,"instead.");var f=t.getRenderTarget();return{shaderID:l,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:n(f?f.texture:null,t.gammaOutput),map:!!i.map,mapEncoding:n(i.map,t.gammaInput),envMap:!!i.envMap,envMapMode:i.envMap&&i.envMap.mapping,envMapEncoding:n(i.envMap,t.gammaInput),envMapCubeUV:!!i.envMap&&(i.envMap.mapping===mo||i.envMap.mapping===vo),lightMap:!!i.lightMap,aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:n(i.emissiveMap,t.gammaInput),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,combine:i.combine,vertexColors:i.vertexColors,fog:!!s,useFog:i.fog,fogExp:s&&s.isFogExp2,flatShading:i.shading===xa,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:i.skinning&&d>0,maxBones:d,useVertexTexture:e.floatVertexTextures,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numClippingPlanes:c,numClipIntersection:u,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&o.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===ya,flipSided:i.side===ga,depthPacking:void 0!==i.depthPacking&&i.depthPacking}},this.getProgramCode=function(t,e){var r=[];if(e.shaderID?r.push(e.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)r.push(n),r.push(t.defines[n]);for(var i=0;i<o.length;i++)r.push(e[o[i]]);return r.join()},this.acquireProgram=function(e,r,n){for(var a,o=0,s=i.length;o<s;o++){var c=i[o];if(c.code===n){a=c,++a.usedTimes;break}}return void 0===a&&(a=new se(t,n,e,r),i.push(a)),a},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=i.indexOf(t);i[e]=i[i.length-1],i.pop(),t.destroy()}},this.programs=i}function ue(t,e,r,n,i,a,o){function s(t,e){if(t.width>e||t.height>e){var r=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(t.width*r),n.height=Math.floor(t.height*r);return n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function c(t){return Ms.isPowerOfTwo(t.width)&&Ms.isPowerOfTwo(t.height)}function u(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=Ms.nearestPowerOfTwo(t.width),e.height=Ms.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function h(t){return t.wrapS!==yo||t.wrapT!==yo||t.minFilter!==bo&&t.minFilter!==Mo}function l(e){return e===bo||e===_o||e===wo?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),f(e),o.textures--}function p(t){var e=t.target;e.removeEventListener("dispose",p),m(e),o.textures--}function f(e){var r=n.get(e);if(e.image&&r.__image__webglTextureCube)t.deleteTexture(r.__image__webglTextureCube);else{if(void 0===r.__webglInit)return;t.deleteTexture(r.__webglTexture)}n.remove(e)}function m(e){var r=n.get(e),i=n.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(r.__webglFramebuffer[a]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[a]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}}function v(e,i){var a=n.get(e);if(e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==o.complete)return void b(a,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}r.activeTexture(t.TEXTURE0+i),r.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function g(e,u){var h=n.get(e);if(6===e.image.length)if(e.version>0&&h.__version!==e.version){h.__image__webglTextureCube||(e.addEventListener("dispose",d),h.__image__webglTextureCube=t.createTexture(),o.textures++),r.activeTexture(t.TEXTURE0+u),r.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var l=e&&e.isCompressedTexture,p=e.image[0]&&e.image[0].isDataTexture,f=[],m=0;m<6;m++)f[m]=l||p?p?e.image[m].image:e.image[m]:s(e.image[m],i.maxCubemapSize);var v=f[0],g=c(v),y=a(e.format),b=a(e.type);x(t.TEXTURE_CUBE_MAP,e,g);for(var m=0;m<6;m++)if(l)for(var _,w=f[m].mipmaps,M=0,E=w.length;M<E;M++)_=w[M],e.format!==Go&&e.format!==zo?r.getCompressedTextureFormats().indexOf(y)>-1?r.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,M,y,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,M,y,_.width,_.height,0,y,b,_.data);else p?r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,f[m].width,f[m].height,0,y,b,f[m].data):r.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,b,f[m]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),h.__version=e.version,e.onUpdate&&e.onUpdate(e)}else r.activeTexture(t.TEXTURE0+u),r.bindTexture(t.TEXTURE_CUBE_MAP,h.__image__webglTextureCube)}function y(e,i){r.activeTexture(t.TEXTURE0+i),r.bindTexture(t.TEXTURE_CUBE_MAP,n.get(e).__webglTexture)}function x(r,o,s){var c;if(s?(t.texParameteri(r,t.TEXTURE_WRAP_S,a(o.wrapS)),t.texParameteri(r,t.TEXTURE_WRAP_T,a(o.wrapT)),t.texParameteri(r,t.TEXTURE_MAG_FILTER,a(o.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,a(o.minFilter))):(t.texParameteri(r,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(r,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),o.wrapS===yo&&o.wrapT===yo||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),t.texParameteri(r,t.TEXTURE_MAG_FILTER,l(o.magFilter)),t.texParameteri(r,t.TEXTURE_MIN_FILTER,l(o.minFilter)),o.minFilter!==bo&&o.minFilter!==Mo&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),c=e.get("EXT_texture_filter_anisotropic")){if(o.type===Io&&null===e.get("OES_texture_float_linear"))return;if(o.type===Uo&&null===e.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(r,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function b(e,n,l){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),o.textures++),r.activeTexture(t.TEXTURE0+l),r.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment);var p=s(n.image,i.maxTextureSize);h(n)&&!1===c(p)&&(p=u(p));var f=c(p),m=a(n.format),v=a(n.type);x(t.TEXTURE_2D,n,f);var g,y=n.mipmaps;if(n.isDepthTexture){var b=t.DEPTH_COMPONENT;if(n.type===Io){if(!A)throw new Error("Float Depth Texture only supported in WebGL2.0");b=t.DEPTH_COMPONENT32F}else A&&(b=t.DEPTH_COMPONENT16);n.format===jo&&b===t.DEPTH_COMPONENT&&n.type!==Ro&&n.type!==Co&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=Ro,v=a(n.type)),n.format===Wo&&(b=t.DEPTH_STENCIL,n.type!==Do&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=Do,v=a(n.type))),r.texImage2D(t.TEXTURE_2D,0,b,p.width,p.height,0,m,v,null)}else if(n.isDataTexture)if(y.length>0&&f){for(var _=0,w=y.length;_<w;_++)g=y[_],r.texImage2D(t.TEXTURE_2D,_,m,g.width,g.height,0,m,v,g.data);n.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,m,p.width,p.height,0,m,v,p.data);else if(n.isCompressedTexture)for(var _=0,w=y.length;_<w;_++)g=y[_],n.format!==Go&&n.format!==zo?r.getCompressedTextureFormats().indexOf(m)>-1?r.compressedTexImage2D(t.TEXTURE_2D,_,m,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.texImage2D(t.TEXTURE_2D,_,m,g.width,g.height,0,m,v,g.data);else if(y.length>0&&f){for(var _=0,w=y.length;_<w;_++)g=y[_],r.texImage2D(t.TEXTURE_2D,_,m,m,v,g);n.generateMipmaps=!1}else r.texImage2D(t.TEXTURE_2D,0,m,m,v,p);n.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function _(e,i,o,s){var c=a(i.texture.format),u=a(i.texture.type);r.texImage2D(s,0,c,i.width,i.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,o,s,n.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,r){t.bindRenderbuffer(t.RENDERBUFFER,e),r.depthBuffer&&!r.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,r.width,r.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):r.depthBuffer&&r.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,r.width,r.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,r.width,r.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,r){if(r&&r.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),v(r.depthTexture,0);var i=n.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===jo)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(r.depthTexture.format!==Wo)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}function E(e){var r=n.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");M(r.__webglFramebuffer,e)}else if(i){r.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[a]),r.__webglDepthbuffer[a]=t.createRenderbuffer(),w(r.__webglDepthbuffer[a],e)}else t.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),w(r.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var i=n.get(e),a=n.get(e.texture);e.addEventListener("dispose",p),a.__webglTexture=t.createTexture(),o.textures++;var s=!0===e.isWebGLRenderTargetCube,u=c(e);if(s){i.__webglFramebuffer=[];for(var h=0;h<6;h++)i.__webglFramebuffer[h]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(s){r.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture),x(t.TEXTURE_CUBE_MAP,e.texture,u);for(var h=0;h<6;h++)_(i.__webglFramebuffer[h],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+h);e.texture.generateMipmaps&&u&&t.generateMipmap(t.TEXTURE_CUBE_MAP),r.bindTexture(t.TEXTURE_CUBE_MAP,null)}else r.bindTexture(t.TEXTURE_2D,a.__webglTexture),x(t.TEXTURE_2D,e.texture,u),_(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&u&&t.generateMipmap(t.TEXTURE_2D),r.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function S(e){var i=e.texture;if(i.generateMipmaps&&c(e)&&i.minFilter!==bo&&i.minFilter!==Mo){var a=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,o=n.get(i).__webglTexture;r.bindTexture(a,o),t.generateMipmap(a),r.bindTexture(a,null)}}var A="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=g,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function he(){function t(t){var e=t.uuid,r=n[e];return void 0===r&&(r={},n[e]=r),r}function e(t){delete n[t.uuid]}function r(){n={}}var n={};return{get:t,remove:e,clear:r}}function le(t,e,r){function n(){var e=!1,r=new o,n=null,i=new o;return{setMask:function(r){n===r||e||(t.colorMask(r,r,r,r),n=r)},setLocked:function(t){e=t},setClear:function(e,n,a,o,s){!0===s&&(e*=o,n*=o,a*=o),r.set(e,n,a,o),!1===i.equals(r)&&(t.clearColor(e,n,a,o),i.copy(r))},reset:function(){e=!1,n=null,i.set(0,0,0,1)}}}function i(){var e=!1,r=null,n=null,i=null;return{setTest:function(e){e?p(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(n){r===n||e||(t.depthMask(n),r=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case Xa:t.depthFunc(t.NEVER);break;case qa:t.depthFunc(t.ALWAYS);break;case Ya:t.depthFunc(t.LESS);break;case Za:t.depthFunc(t.LEQUAL);break;case Ja:t.depthFunc(t.EQUAL);break;case Qa:t.depthFunc(t.GEQUAL);break;case Ka:t.depthFunc(t.GREATER);break;case $a:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);n=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,r=null,n=null,i=null}}}function a(){var e=!1,r=null,n=null,i=null,a=null,o=null,s=null,c=null,u=null;return{setTest:function(e){e?p(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(n){r===n||e||(t.stencilMask(n),r=n)},setFunc:function(e,r,o){n===e&&i===r&&a===o||(t.stencilFunc(e,r,o),n=e,i=r,a=o)},setOp:function(e,r,n){o===e&&s===r&&c===n||(t.stencilOp(e,r,n),o=e,s=r,c=n)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,r=null,n=null,i=null,a=null,o=null,s=null,c=null,u=null}}}function s(e,r,n){var i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var o=0;o<n;o++)t.texImage2D(r+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);return a}function c(){C.setClear(0,0,0,1),I.setClear(1),U.setClear(0),p(t.DEPTH_TEST),I.setFunc(Za),y(!1),x(ca),p(t.CULL_FACE),p(t.BLEND),v(Ta)}function u(){for(var t=0,e=O.length;t<e;t++)O[t]=0}function h(r){if(O[r]=1,0===B[r]&&(t.enableVertexAttribArray(r),B[r]=1),0!==D[r]){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,0),D[r]=0}}function l(r,n){if(O[r]=1,0===B[r]&&(t.enableVertexAttribArray(r),B[r]=1),D[r]!==n){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(r,n),D[r]=n}}function d(){for(var e=0,r=B.length;e!==r;++e)B[e]!==O[e]&&(t.disableVertexAttribArray(e),B[e]=0)}function p(e){!0!==F[e]&&(t.enable(e),F[e]=!0)}function f(e){!1!==F[e]&&(t.disable(e),F[e]=!1)}function m(){if(null===z&&(z=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var r=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),n=0;n<r.length;n++)z.push(r[n]);return z}function v(e,n,i,a,o,s,c,u){e!==Ea?p(t.BLEND):f(t.BLEND),e===G&&u===q||(e===Sa?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===Aa?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===La?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),G=e,q=u),e===Ra?(o=o||n,s=s||i,c=c||a,n===k&&o===j||(t.blendEquationSeparate(r(n),r(o)),k=n,j=o),i===H&&a===V&&s===W&&c===X||(t.blendFuncSeparate(r(i),r(a),r(s),r(c)),H=i,V=a,W=s,X=c)):(k=null,H=null,V=null,j=null,W=null,X=null)}function g(e){e.side===ya?f(t.CULL_FACE):p(t.CULL_FACE),y(e.side===ga),!0===e.transparent?v(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):v(Ea),I.setFunc(e.depthFunc),I.setTest(e.depthTest),I.setMask(e.depthWrite),C.setMask(e.colorWrite),_(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function y(e){Y!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),Y=e)}function x(e){e!==sa?(p(t.CULL_FACE),e!==Z&&(e===ca?t.cullFace(t.BACK):e===ua?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):f(t.CULL_FACE),Z=e}function b(e){e!==J&&(rt&&t.lineWidth(e),J=e)}function _(e,r,n){e?(p(t.POLYGON_OFFSET_FILL),Q===r&&K===n||(t.polygonOffset(r,n),Q=r,K=n)):f(t.POLYGON_OFFSET_FILL)}function w(){return $}function M(e){$=e,e?p(t.SCISSOR_TEST):f(t.SCISSOR_TEST)}function E(e){void 0===e&&(e=t.TEXTURE0+tt-1),nt!==e&&(t.activeTexture(e),nt=e)}function T(e,r){null===nt&&E();var n=it[nt];void 0===n&&(n={type:void 0,texture:void 0},it[nt]=n),n.type===e&&n.texture===r||(t.bindTexture(e,r||st[e]),n.type=e,n.texture=r)}function S(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function A(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function L(e){!1===at.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),at.copy(e))}function R(e){!1===ot.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),ot.copy(e))}function P(){for(var e=0;e<B.length;e++)1===B[e]&&(t.disableVertexAttribArray(e),B[e]=0);F={},z=null,nt=null,it={},G=null,Y=null,Z=null,C.reset(),I.reset(),U.reset()}var C=new n,I=new i,U=new a,N=t.getParameter(t.MAX_VERTEX_ATTRIBS),O=new Uint8Array(N),B=new Uint8Array(N),D=new Uint8Array(N),F={},z=null,G=null,k=null,H=null,V=null,j=null,W=null,X=null,q=!1,Y=null,Z=null,J=null,Q=null,K=null,$=null,tt=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),et=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),rt=parseFloat(et)>=1,nt=null,it={},at=new o,ot=new o,st={};return st[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),st[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:C,depth:I,stencil:U},init:c,initAttributes:u,enableAttribute:h,enableAttributeAndDivisor:l,disableUnusedAttributes:d,enable:p,disable:f,getCompressedTextureFormats:m,setBlending:v,setMaterial:g,setFlipSided:y,setCullFace:x,setLineWidth:b,setPolygonOffset:_,getScissorTest:w,setScissorTest:M,activeTexture:E,bindTexture:T,compressedTexImage2D:S,texImage2D:A,scissor:L,viewport:R,reset:P}}function de(t,e,r){function n(){if(void 0!==a)return a;var r=e.get("EXT_texture_filter_anisotropic");return a=null!==r?t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==r.precision?r.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===r.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=h>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:n,getMaxPrecision:i,precision:o,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function pe(t){var e={};return{get:function(r){if(void 0!==e[r])return e[r];var n;switch(r){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=t.getExtension("WEBGL_compressed_texture_etc1");break;default:n=t.getExtension(r)}return null===n&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),e[r]=n,n}}}function fe(){function t(){u.value!==n&&(u.value=n,u.needsUpdate=i>0),r.numPlanes=i,r.numIntersection=0}function e(t,e,n,i){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=u.value,!0!==i||null===o){var h=n+4*a,l=e.matrixWorldInverse;c.getNormalMatrix(l),(null===o||o.length<h)&&(o=new Float32Array(h));for(var d=0,p=n;d!==a;++d,p+=4)s.copy(t[d]).applyMatrix4(l,c),s.normal.toArray(o,p),o[p+3]=s.constant}u.value=o,u.needsUpdate=!0}return r.numPlanes=a,o}var r=this,n=null,i=0,a=!1,o=!1,s=new it,c=new nt,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(t,r,o){var s=0!==t.length||r||0!==i||a;return a=r,n=e(t,o,0),i=t.length,s},this.beginShadows=function(){o=!0,e(null)},this.endShadows=function(){o=!1,t()},this.setState=function(r,s,c,h,l,d){if(!a||null===r||0===r.length||o&&!c)o?e(null):t();else{var p=o?0:i,f=4*p,m=l.clippingState||null;u.value=m,m=e(r,h,f,d);for(var v=0;v!==f;++v)m[v]=n[v];l.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=p}}}function me(t){function e(){return null===rt?yt:1}function r(){Jt.init(),Jt.scissor(ut.copy(xt).multiplyScalar(yt)),Jt.viewport(lt.copy(_t).multiplyScalar(yt)),Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H)}function n(){et=null,ct=null,st="",it=-1,Jt.reset()}function i(t){t.preventDefault(),n(),r(),Qt.clear(),ee.clear()}function a(t){var e=t.target;e.removeEventListener("dispose",a),s(e)}function s(t){c(t),Qt.remove(t)}function c(t){var e=Qt.get(t).program;t.program=void 0,void 0!==e&&re.releaseProgram(e)}function u(t,e,r){t.render(function(t){tt.renderBufferImmediate(t,e,r)})}function p(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e,r,n){if(r&&r.isInstancedBufferGeometry&&null===Yt.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),Jt.initAttributes();var i=r.attributes,a=e.getAttributes(),o=t.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var u=i[s];if(void 0!==u){var h=u.normalized,l=u.itemSize,d=$t.get(u),p=d.buffer,f=d.type,m=d.bytesPerElement;if(u.isInterleavedBufferAttribute){var v=u.data,g=v.stride,y=u.offset;v&&v.isInstancedInterleavedBuffer?(Jt.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=v.meshPerAttribute*v.count)):Jt.enableAttribute(c),Gt.bindBuffer(Gt.ARRAY_BUFFER,p),Gt.vertexAttribPointer(c,l,f,h,g*m,(n*g+y)*m)}else u.isInstancedBufferAttribute?(Jt.enableAttributeAndDivisor(c,u.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=u.meshPerAttribute*u.count)):Jt.enableAttribute(c),Gt.bindBuffer(Gt.ARRAY_BUFFER,p),Gt.vertexAttribPointer(c,l,f,h,0,n*l*m)}else if(void 0!==o){var x=o[s];if(void 0!==x)switch(x.length){case 2:Gt.vertexAttrib2fv(c,x);break;case 3:Gt.vertexAttrib3fv(c,x);break;case 4:Gt.vertexAttrib4fv(c,x);break;default:Gt.vertexAttrib1fv(c,x)}}}}Jt.disableUnusedAttributes()}function m(t,e,r){if(t.visible){if(t.layers.test(e.layers))if(t.isLight)j.push(t);else if(t.isSprite)t.frustumCulled&&!wt.intersectsSprite(t)||Z.push(t);else if(t.isLensFlare)K.push(t);else if(t.isImmediateRenderObject)r&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St),W.push(t,null,t.material,At.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||wt.intersectsObject(t))){r&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St);var n=ee.update(t),i=t.material;if(Array.isArray(i))for(var a=n.groups,o=0,s=a.length;o<s;o++){var c=a[o],u=i[c.materialIndex];u&&u.visible&&W.push(t,n,u,At.z,c)}else i.visible&&W.push(t,n,i,At.z,null)}for(var h=t.children,o=0,s=h.length;o<s;o++)m(h[o],e,r)}}function v(t,e,r,n){for(var i=0,a=t.length;i<a;i++){var o=t[i],s=o.object,c=o.geometry,u=void 0===n?o.material:n,h=o.group;if(s.onBeforeRender(tt,e,r,c,u,h),r.isArrayCamera&&r.enabled)for(var l=r.cameras,d=0,p=l.length;d<p;d++){var f=l[d],m=f.bounds;tt.setViewport(m.x*vt*yt,m.y*gt*yt,m.z*vt*yt,m.w*gt*yt),tt.setScissor(m.x*vt*yt,m.y*gt*yt,m.z*vt*yt,m.w*gt*yt),tt.setScissorTest(!0),g(s,e,f,c,u,h)}else g(s,e,r,c,u,h);s.onAfterRender(tt,e,r,c,u,h)}}function g(t,e,r,n,i,a){if(t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){Jt.setMaterial(i);var o=x(r,e.fog,i,t);st="",u(t,o,i)}else tt.renderBufferDirect(r,e.fog,n,i,t,a)}function y(t,e,r){var n=Qt.get(t),i=re.getParameters(t,Ut,e,Mt.numPlanes,Mt.numIntersection,r),o=re.getProgramCode(t,i),s=n.program,u=!0;if(void 0===s)t.addEventListener("dispose",a);else if(s.code!==o)c(t);else{if(void 0!==i.shaderID)return;u=!1}if(u){if(i.shaderID){var h=Bs[i.shaderID];n.__webglShader={name:t.type,uniforms:Ns.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else n.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=n.__webglShader,s=re.acquireProgram(t,i,o),n.program=s,t.program=s}var l=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var d=0;d<tt.maxMorphTargets;d++)l["morphTarget"+d]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d<tt.maxMorphNormals;d++)l["morphNormal"+d]>=0&&t.numSupportedMorphNormals++}var p=n.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=Mt.numPlanes,n.numIntersection=Mt.numIntersection,p.clippingPlanes=Mt.uniform),n.fog=e,n.lightsHash=Ut.hash,t.lights&&(p.ambientLightColor.value=Ut.ambient,p.directionalLights.value=Ut.directional,p.spotLights.value=Ut.spot,p.rectAreaLights.value=Ut.rectArea,p.pointLights.value=Ut.point,p.hemisphereLights.value=Ut.hemi,p.directionalShadowMap.value=Ut.directionalShadowMap,p.directionalShadowMatrix.value=Ut.directionalShadowMatrix,p.spotShadowMap.value=Ut.spotShadowMap,p.spotShadowMatrix.value=Ut.spotShadowMatrix,p.pointShadowMap.value=Ut.pointShadowMap,p.pointShadowMatrix.value=Ut.pointShadowMatrix);var f=n.program.getUniforms(),m=q.seqWithValue(f.seq,p);n.uniformsList=m}function x(t,e,r,n){dt=0;var i=Qt.get(r);if(Et&&(Tt||t!==ct)){var a=t===ct&&r.id===it;Mt.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,t,i,a)}!1===r.needsUpdate&&(void 0===i.program?r.needsUpdate=!0:r.fog&&i.fog!==e?r.needsUpdate=!0:r.lights&&i.lightsHash!==Ut.hash?r.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Mt.numPlanes&&i.numIntersection===Mt.numIntersection||(r.needsUpdate=!0)),r.needsUpdate&&(y(r,e,n),r.needsUpdate=!1);var o=!1,s=!1,c=!1,u=i.program,h=u.getUniforms(),l=i.__webglShader.uniforms;if(u.id!==et&&(Gt.useProgram(u.program),et=u.id,o=!0,s=!0,c=!0),r.id!==it&&(it=r.id,s=!0),o||t!==ct){if(h.setValue(Gt,"projectionMatrix",t.projectionMatrix),Zt.logarithmicDepthBuffer&&h.setValue(Gt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.envMap){var p=h.map.cameraPosition;void 0!==p&&p.setValue(Gt,At.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&h.setValue(Gt,"viewMatrix",t.matrixWorldInverse),h.setValue(Gt,"toneMappingExposure",tt.toneMappingExposure),h.setValue(Gt,"toneMappingWhitePoint",tt.toneMappingWhitePoint)}if(r.skinning){h.setOptional(Gt,n,"bindMatrix"),h.setOptional(Gt,n,"bindMatrixInverse");var f=n.skeleton;if(f){var m=f.bones;if(Zt.floatVertexTextures){if(void 0===f.boneTexture){var v=Math.sqrt(4*m.length);v=Ms.nextPowerOfTwo(Math.ceil(v)),v=Math.max(v,4);var g=new Float32Array(v*v*4);g.set(f.boneMatrices);var x=new d(g,v,v,Go,Io);f.boneMatrices=g,f.boneTexture=x,f.boneTextureSize=v}h.setValue(Gt,"boneTexture",f.boneTexture),h.setValue(Gt,"boneTextureSize",f.boneTextureSize)}else h.setOptional(Gt,f,"boneMatrices")}}return s&&(r.lights&&C(l,c),e&&r.fog&&E(l,e),(r.isMeshBasicMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshNormalMaterial||r.isMeshDepthMaterial)&&b(l,r),r.isLineBasicMaterial?_(l,r):r.isLineDashedMaterial?(_(l,r),w(l,r)):r.isPointsMaterial?M(l,r):r.isMeshLambertMaterial?T(l,r):r.isMeshToonMaterial?A(l,r):r.isMeshPhongMaterial?S(l,r):r.isMeshPhysicalMaterial?R(l,r):r.isMeshStandardMaterial?L(l,r):r.isMeshDepthMaterial?r.displacementMap&&(l.displacementMap.value=r.displacementMap,l.displacementScale.value=r.displacementScale,l.displacementBias.value=r.displacementBias):r.isMeshNormalMaterial&&P(l,r),void 0!==l.ltcMat&&(l.ltcMat.value=Us.LTC_MAT_TEXTURE),void 0!==l.ltcMag&&(l.ltcMag.value=Us.LTC_MAG_TEXTURE),q.upload(Gt,i.uniformsList,l,tt)),h.setValue(Gt,"modelViewMatrix",n.modelViewMatrix),h.setValue(Gt,"normalMatrix",n.normalMatrix),h.setValue(Gt,"modelMatrix",n.matrixWorld),u}function b(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var r;if(e.map?r=e.map:e.specularMap?r=e.specularMap:e.displacementMap?r=e.displacementMap:e.normalMap?r=e.normalMap:e.bumpMap?r=e.bumpMap:e.roughnessMap?r=e.roughnessMap:e.metalnessMap?r=e.metalnessMap:e.alphaMap?r=e.alphaMap:e.emissiveMap&&(r=e.emissiveMap),void 0!==r){r.isWebGLRenderTarget&&(r=r.texture);var n=r.offset,i=r.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function _(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function w(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*yt,t.scale.value=.5*gt,t.map.value=e.map,null!==e.map){var r=e.map.offset,n=e.map.repeat;t.offsetRepeat.value.set(r.x,r.y,n.x,n.y)}}function E(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function T(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function S(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function A(t,e){S(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function L(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function R(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,L(t,e)}function P(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function C(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function I(t){for(var e=0,r=0,n=t.length;r<n;r++){var i=t[r];i.castShadow&&(Ut.shadows[e]=i,e++)}Ut.shadows.length=e}function U(t,e){var r,n,i,a,o,s,c,u,h=0,l=0,d=0,p=e.matrixWorldInverse,f=0,m=0,v=0,g=0,y=0;for(r=0,n=t.length;r<n;r++)if(i=t[r],o=i.color,s=i.intensity,c=i.distance,u=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i.isAmbientLight)h+=o.r*s,l+=o.g*s,d+=o.b*s;else if(i.isDirectionalLight){var x=ne.get(i);x.color.copy(i.color).multiplyScalar(i.intensity),x.direction.setFromMatrixPosition(i.matrixWorld),At.setFromMatrixPosition(i.target.matrixWorld),x.direction.sub(At),x.direction.transformDirection(p),x.shadow=i.castShadow,i.castShadow&&(a=i.shadow,x.shadowBias=a.bias,x.shadowRadius=a.radius,x.shadowMapSize=a.mapSize),Ut.directionalShadowMap[f]=u,Ut.directionalShadowMatrix[f]=i.shadow.matrix,Ut.directional[f]=x,f++}else if(i.isSpotLight){var x=ne.get(i);x.position.setFromMatrixPosition(i.matrixWorld),x.position.applyMatrix4(p),x.color.copy(o).multiplyScalar(s),x.distance=c,x.direction.setFromMatrixPosition(i.matrixWorld),At.setFromMatrixPosition(i.target.matrixWorld),x.direction.sub(At),x.direction.transformDirection(p),x.coneCos=Math.cos(i.angle),x.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),x.decay=0===i.distance?0:i.decay,x.shadow=i.castShadow,i.castShadow&&(a=i.shadow,x.shadowBias=a.bias,x.shadowRadius=a.radius,x.shadowMapSize=a.mapSize),Ut.spotShadowMap[v]=u,Ut.spotShadowMatrix[v]=i.shadow.matrix,Ut.spot[v]=x,v++}else if(i.isRectAreaLight){var x=ne.get(i);x.color.copy(o).multiplyScalar(s/(i.width*i.height)),x.position.setFromMatrixPosition(i.matrixWorld),x.position.applyMatrix4(p),Ct.identity(),Lt.copy(i.matrixWorld),Lt.premultiply(p),Ct.extractRotation(Lt),x.halfWidth.set(.5*i.width,0,0),x.halfHeight.set(0,.5*i.height,0),x.halfWidth.applyMatrix4(Ct),x.halfHeight.applyMatrix4(Ct),Ut.rectArea[g]=x,g++}else if(i.isPointLight){var x=ne.get(i);x.position.setFromMatrixPosition(i.matrixWorld),x.position.applyMatrix4(p),x.color.copy(i.color).multiplyScalar(i.intensity),x.distance=i.distance,x.decay=0===i.distance?0:i.decay,x.shadow=i.castShadow,i.castShadow&&(a=i.shadow,x.shadowBias=a.bias,x.shadowRadius=a.radius,x.shadowMapSize=a.mapSize),Ut.pointShadowMap[m]=u,Ut.pointShadowMatrix[m]=i.shadow.matrix,Ut.point[m]=x,m++}else if(i.isHemisphereLight){var x=ne.get(i);x.direction.setFromMatrixPosition(i.matrixWorld),x.direction.transformDirection(p),x.direction.normalize(),x.skyColor.copy(i.color).multiplyScalar(s),x.groundColor.copy(i.groundColor).multiplyScalar(s),Ut.hemi[y]=x,y++}Ut.ambient[0]=h,Ut.ambient[1]=l,Ut.ambient[2]=d,Ut.directional.length=f,Ut.spot.length=v,Ut.rectArea.length=g,Ut.point.length=m,Ut.hemi.length=y,Ut.hash=f+","+m+","+v+","+g+","+y+","+Ut.shadows.length}function N(){var t=dt;return t>=Zt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Zt.maxTextures),dt+=1,t}function O(t){var e;if(t===go)return Gt.REPEAT;if(t===yo)return Gt.CLAMP_TO_EDGE;if(t===xo)return Gt.MIRRORED_REPEAT;if(t===bo)return Gt.NEAREST;if(t===_o)return Gt.NEAREST_MIPMAP_NEAREST;if(t===wo)return Gt.NEAREST_MIPMAP_LINEAR;if(t===Mo)return Gt.LINEAR;if(t===Eo)return Gt.LINEAR_MIPMAP_NEAREST;if(t===To)return Gt.LINEAR_MIPMAP_LINEAR;if(t===So)return Gt.UNSIGNED_BYTE;if(t===No)return Gt.UNSIGNED_SHORT_4_4_4_4;if(t===Oo)return Gt.UNSIGNED_SHORT_5_5_5_1;if(t===Bo)return Gt.UNSIGNED_SHORT_5_6_5;if(t===Ao)return Gt.BYTE;if(t===Lo)return Gt.SHORT;if(t===Ro)return Gt.UNSIGNED_SHORT;if(t===Po)return Gt.INT;if(t===Co)return Gt.UNSIGNED_INT;if(t===Io)return Gt.FLOAT;if(t===Uo&&null!==(e=Yt.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Fo)return Gt.ALPHA;if(t===zo)return Gt.RGB;if(t===Go)return Gt.RGBA;if(t===ko)return Gt.LUMINANCE;if(t===Ho)return Gt.LUMINANCE_ALPHA;if(t===jo)return Gt.DEPTH_COMPONENT;if(t===Wo)return Gt.DEPTH_STENCIL;if(t===Pa)return Gt.FUNC_ADD;if(t===Ca)return Gt.FUNC_SUBTRACT;if(t===Ia)return Gt.FUNC_REVERSE_SUBTRACT;if(t===Oa)return Gt.ZERO;if(t===Ba)return Gt.ONE;if(t===Da)return Gt.SRC_COLOR;if(t===Fa)return Gt.ONE_MINUS_SRC_COLOR;if(t===za)return Gt.SRC_ALPHA;if(t===Ga)return Gt.ONE_MINUS_SRC_ALPHA;if(t===ka)return Gt.DST_ALPHA;if(t===Ha)return Gt.ONE_MINUS_DST_ALPHA;if(t===Va)return Gt.DST_COLOR;if(t===ja)return Gt.ONE_MINUS_DST_COLOR;if(t===Wa)return Gt.SRC_ALPHA_SATURATE;if((t===Xo||t===qo||t===Yo||t===Zo)&&null!==(e=Yt.get("WEBGL_compressed_texture_s3tc"))){if(t===Xo)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===qo)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Yo)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Zo)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Jo||t===Qo||t===Ko||t===$o)&&null!==(e=Yt.get("WEBGL_compressed_texture_pvrtc"))){if(t===Jo)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Qo)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Ko)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===$o)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ts&&null!==(e=Yt.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Ua||t===Na)&&null!==(e=Yt.get("EXT_blend_minmax"))){if(t===Ua)return e.MIN_EXT;if(t===Na)return e.MAX_EXT}return t===Do&&null!==(e=Yt.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",aa),t=t||{};var B=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),D=void 0!==t.context?t.context:null,F=void 0!==t.alpha&&t.alpha,z=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,k=void 0!==t.antialias&&t.antialias,H=void 0===t.premultipliedAlpha||t.premultipliedAlpha,V=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,j=[],W=null,X=new Float32Array(8),Z=[],K=[];this.domElement=B,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=io,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var tt=this,et=null,rt=null,nt=null,it=-1,st="",ct=null,ut=new o,ht=null,lt=new o,dt=0,pt=new Y(0),mt=0,vt=B.width,gt=B.height,yt=1,xt=new o(0,0,vt,gt),bt=!1,_t=new o(0,0,vt,gt),wt=new at,Mt=new fe,Et=!1,Tt=!1,St=new l,At=new h,Lt=new l,Ct=new l,Ut={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ot={geometries:0,textures:0},zt={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:zt,memory:Ot,programs:null};var Gt;try{var kt={alpha:F,depth:z,stencil:G,antialias:k,premultipliedAlpha:H,preserveDrawingBuffer:V};if(null===(Gt=D||B.getContext("webgl",kt)||B.getContext("experimental-webgl",kt)))throw null!==B.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Gt.getShaderPrecisionFormat&&(Gt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),B.addEventListener("webglcontextlost",i,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Yt=new pe(Gt);Yt.get("WEBGL_depth_texture"),Yt.get("OES_texture_float"),Yt.get("OES_texture_float_linear"),Yt.get("OES_texture_half_float"),Yt.get("OES_texture_half_float_linear"),Yt.get("OES_standard_derivatives"),Yt.get("ANGLE_instanced_arrays"),Yt.get("OES_element_index_uint")&&(Rt.MaxIndex=4294967296);var Zt=new de(Gt,Yt,t),Jt=new le(Gt,Yt,O),Qt=new he,Kt=new ue(Gt,Yt,Jt,Qt,Zt,O,Ot),$t=new Ft(Gt),te=new Wt(Gt,$t,Ot),ee=new qt(Gt,te,zt),re=new ce(this,Zt),ne=new Xt,ie=new Ht;this.info.programs=re.programs;var ae,oe,se,me,ve=new jt(Gt,Yt,zt),ge=new Vt(Gt,Yt,zt);r(),this.context=Gt,this.capabilities=Zt,this.extensions=Yt,this.properties=Qt,this.state=Jt;var ye=new ot(this,Ut,ee,Zt);this.shadowMap=ye;var xe=new Q(this,Z),be=new J(this,K);this.getContext=function(){return Gt},this.getContextAttributes=function(){return Gt.getContextAttributes()},this.forceContextLoss=function(){var t=Yt.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return Zt.getMaxAnisotropy()},this.getPrecision=function(){return Zt.precision},this.getPixelRatio=function(){return yt},this.setPixelRatio=function(t){void 0!==t&&(yt=t,this.setSize(_t.z,_t.w,!1))},this.getSize=function(){return{width:vt,height:gt}},this.setSize=function(t,e,r){vt=t,gt=e,B.width=t*yt,B.height=e*yt,!1!==r&&(B.style.width=t+"px",B.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,r,n){Jt.viewport(_t.set(t,e,r,n))},this.setScissor=function(t,e,r,n){Jt.scissor(xt.set(t,e,r,n))},this.setScissorTest=function(t){Jt.setScissorTest(bt=t)},this.getClearColor=function(){return pt},this.setClearColor=function(t,e){pt.set(t),mt=void 0!==e?e:1,Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H)},this.getClearAlpha=function(){return mt},this.setClearAlpha=function(t){mt=t,Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H)},this.clear=function(t,e,r){var n=0;(void 0===t||t)&&(n|=Gt.COLOR_BUFFER_BIT),(void 0===e||e)&&(n|=Gt.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=Gt.STENCIL_BUFFER_BIT),Gt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,r,n){this.setRenderTarget(t),this.clear(e,r,n)},this.resetGLState=n,this.dispose=function(){B.removeEventListener("webglcontextlost",i,!1),ie.dispose()},this.renderBufferImmediate=function(t,e,r){Jt.initAttributes();var n=Qt.get(t);t.hasPositions&&!n.position&&(n.position=Gt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=Gt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=Gt.createBuffer()),t.hasColors&&!n.color&&(n.color=Gt.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(Gt.bindBuffer(Gt.ARRAY_BUFFER,n.position),Gt.bufferData(Gt.ARRAY_BUFFER,t.positionArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(i.position),Gt.vertexAttribPointer(i.position,3,Gt.FLOAT,!1,0,0)),t.hasNormals){if(Gt.bindBuffer(Gt.ARRAY_BUFFER,n.normal),!r.isMeshPhongMaterial&&!r.isMeshStandardMaterial&&!r.isMeshNormalMaterial&&r.shading===xa)for(var a=0,o=3*t.count;a<o;a+=9){var s=t.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,u=(s[a+1]+s[a+4]+s[a+7])/3,h=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=u,s[a+2]=h,s[a+3]=c,s[a+4]=u,s[a+5]=h,s[a+6]=c,s[a+7]=u,s[a+8]=h}Gt.bufferData(Gt.ARRAY_BUFFER,t.normalArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(i.normal),Gt.vertexAttribPointer(i.normal,3,Gt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(Gt.bindBuffer(Gt.ARRAY_BUFFER,n.uv),Gt.bufferData(Gt.ARRAY_BUFFER,t.uvArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(i.uv),Gt.vertexAttribPointer($t.uv,2,Gt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==_a&&(Gt.bindBuffer(Gt.ARRAY_BUFFER,n.color),Gt.bufferData(Gt.ARRAY_BUFFER,t.colorArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(i.color),Gt.vertexAttribPointer(i.color,3,Gt.FLOAT,!1,0,0)),Jt.disableUnusedAttributes(),Gt.drawArrays(Gt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,r,n,i,a,o){Jt.setMaterial(i);var s=x(t,r,i,a),c=n.id+"_"+s.id+"_"+(!0===i.wireframe),u=!1;c!==st&&(st=c,u=!0);var h=a.morphTargetInfluences;if(void 0!==h){for(var l=[],d=0,m=h.length;d<m;d++){var v=h[d];l.push([v,d])}l.sort(p),l.length>8&&(l.length=8);for(var g=n.morphAttributes,d=0,m=l.length;d<m;d++){var v=l[d];if(X[d]=v[0],0!==v[0]){var y=v[1];!0===i.morphTargets&&g.position&&n.addAttribute("morphTarget"+d,g.position[y]),!0===i.morphNormals&&g.normal&&n.addAttribute("morphNormal"+d,g.normal[y])}else!0===i.morphTargets&&n.removeAttribute("morphTarget"+d),!0===i.morphNormals&&n.removeAttribute("morphNormal"+d)}for(var d=l.length,b=X.length;d<b;d++)X[d]=0;s.getUniforms().setValue(Gt,"morphTargetInfluences",X),u=!0}var y=n.index,_=n.attributes.position,w=1;!0===i.wireframe&&(y=te.getWireframeAttribute(n),w=2);var M=ve;null!==y&&(M=ge,M.setIndex(y)),u&&(f(i,s,n),null!==y&&Gt.bindBuffer(Gt.ELEMENT_ARRAY_BUFFER,$t.get(y).buffer));var E=0;null!==y?E=y.count:void 0!==_&&(E=_.count);var T=n.drawRange.start*w,S=n.drawRange.count*w,A=null!==o?o.start*w:0,L=null!==o?o.count*w:1/0,R=Math.max(T,A),P=Math.min(E,T+S,A+L)-1,C=Math.max(0,P-R+1);if(0!==C){if(a.isMesh)if(!0===i.wireframe)Jt.setLineWidth(i.wireframeLinewidth*e()),M.setMode(Gt.LINES);else switch(a.drawMode){case hs:M.setMode(Gt.TRIANGLES);break;case ls:M.setMode(Gt.TRIANGLE_STRIP);break;case ds:M.setMode(Gt.TRIANGLE_FAN)}else if(a.isLine){var I=i.linewidth;void 0===I&&(I=1),Jt.setLineWidth(I*e()),a.isLineSegments?M.setMode(Gt.LINES):a.isLineLoop?M.setMode(Gt.LINE_LOOP):M.setMode(Gt.LINE_STRIP)}else a.isPoints&&M.setMode(Gt.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&M.renderInstances(n,R,C):M.render(R,C)}},this.compile=function(t,e){j=[],t.traverse(function(t){t.isLight&&j.push(t)}),U(j,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var r=0;r<e.material.length;r++)y(e.material[r],t.fog,e);else y(e.material,t.fog,e)})},this.render=function(t,e,r,n){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");st="",it=-1,ct=null,!0===t.autoUpdate&&t.updateMatrixWorld(),e.onBeforeRender(tt),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),St.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),wt.setFromMatrix(St),j.length=0,Z.length=0,K.length=0,Tt=this.localClippingEnabled,Et=Mt.init(this.clippingPlanes,Tt,e),W=ie.get(t,e),W.init(),m(t,e,tt.sortObjects),W.finish(),!0===tt.sortObjects&&W.sort(),Et&&Mt.beginShadows(),I(j),ye.render(t,e),U(j,e),Et&&Mt.endShadows(),zt.frame++,zt.calls=0,zt.vertices=0,zt.faces=0,zt.points=0,void 0===r&&(r=null),this.setRenderTarget(r);var i=t.background;null===i?Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H):i&&i.isColor&&(Jt.buffers.color.setClear(i.r,i.g,i.b,1,H),n=!0),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===se&&(se=new Bt,me=new Pt(new It(5,5,5),new $({uniforms:Bs.cube.uniforms,vertexShader:Bs.cube.vertexShader,fragmentShader:Bs.cube.fragmentShader,side:ga,depthTest:!1,depthWrite:!1,fog:!1}))),se.projectionMatrix.copy(e.projectionMatrix),se.matrixWorld.extractRotation(e.matrixWorld),se.matrixWorldInverse.getInverse(se.matrixWorld),me.material.uniforms.tCube.value=i,me.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,me.matrixWorld),ee.update(me),tt.renderBufferDirect(se,null,me.geometry,me.material,me,null)):i&&i.isTexture&&(void 0===ae&&(ae=new Dt(-1,1,1,-1,0,1),oe=new Pt(new Nt(2,2),new ft({depthTest:!1,depthWrite:!1,fog:!1}))),oe.material.map=i,ee.update(oe),tt.renderBufferDirect(ae,null,oe.geometry,oe.material,oe,null));var a=W.opaque,o=W.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&v(a,t,e,s),o.length&&v(o,t,e,s)}else a.length&&v(a,t,e),o.length&&v(o,t,e);xe.render(t,e),be.render(t,e,lt),r&&Kt.updateRenderTargetMipmap(r),Jt.buffers.depth.setTest(!0),Jt.buffers.depth.setMask(!0),Jt.buffers.color.setMask(!0),e.isArrayCamera&&e.enabled&&tt.setScissorTest(!1),e.onAfterRender(tt)},this.setFaceCulling=function(t,e){Jt.setCullFace(t),Jt.setFlipSided(e===la)},this.allocTextureUnit=N,this.setTexture2D=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Kt.setTexture2D(e,r)}}(),this.setTexture=function(){var t=!1;return function(e,r){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Kt.setTexture2D(e,r)}}(),this.setTextureCube=function(){var t=!1;return function(e,r){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Kt.setTextureCube(e,r):Kt.setTextureCubeDynamic(e,r)}}(),this.getRenderTarget=function(){return rt},this.setRenderTarget=function(t){rt=t,t&&void 0===Qt.get(t).__webglFramebuffer&&Kt.setupRenderTarget(t);var e,r=t&&t.isWebGLRenderTargetCube;if(t){var n=Qt.get(t);e=r?n.__webglFramebuffer[t.activeCubeFace]:n.__webglFramebuffer,ut.copy(t.scissor),ht=t.scissorTest,lt.copy(t.viewport)}else e=null,ut.copy(xt).multiplyScalar(yt),ht=bt,lt.copy(_t).multiplyScalar(yt);if(nt!==e&&(Gt.bindFramebuffer(Gt.FRAMEBUFFER,e),nt=e),Jt.scissor(ut),Jt.setScissorTest(ht),Jt.viewport(lt),r){var i=Qt.get(t.texture);Gt.framebufferTexture2D(Gt.FRAMEBUFFER,Gt.COLOR_ATTACHMENT0,Gt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,r,n,i,a){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var o=Qt.get(t).__webglFramebuffer;if(o){var s=!1;o!==nt&&(Gt.bindFramebuffer(Gt.FRAMEBUFFER,o),s=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==Go&&O(u)!==Gt.getParameter(Gt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===So||O(h)===Gt.getParameter(Gt.IMPLEMENTATION_COLOR_READ_TYPE)||h===Io&&(Yt.get("OES_texture_float")||Yt.get("WEBGL_color_buffer_float"))||h===Uo&&Yt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Gt.checkFramebufferStatus(Gt.FRAMEBUFFER)===Gt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&r>=0&&r<=t.height-i&&Gt.readPixels(e,r,n,i,O(u),O(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Gt.bindFramebuffer(Gt.FRAMEBUFFER,nt)}}}}function ve(t,e){this.name="",this.color=new Y(t),this.density=void 0!==e?e:25e-5}function ge(t,e,r){this.name="",this.color=new Y(t),this.near=void 0!==e?e:1,this.far=void 0!==r?r:1e3}function ye(){ht.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function xe(t,e,r,n,i){ht.call(this),this.lensFlares=[],this.positionScreen=new h,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,r,n,i)}function be(t){K.call(this),this.type="SpriteMaterial",this.color=new Y(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function _e(t){ht.call(this),this.type="Sprite",this.material=void 0!==t?t:new be}function we(){ht.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Me(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var r=0,n=this.bones.length;r<n;r++)this.boneInverses.push(new l)}}function Ee(){ht.call(this),this.type="Bone"}function Te(t,e){Pt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new l,this.bindMatrixInverse=new l;var r=this.initBones(),n=new Me(r);this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function Se(t){K.call(this),this.type="LineBasicMaterial",this.color=new Y(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function Ae(t,e,r){if(1===r)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Le(t,e);ht.call(this),this.type="Line",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new Se({color:16777215*Math.random()})}function Le(t,e){Ae.call(this,t,e),this.type="LineSegments"}function Re(t,e){Ae.call(this,t,e),this.type="LineLoop"}function Pe(t){K.call(this),this.type="PointsMaterial",this.color=new Y(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Ce(t,e){ht.call(this),this.type="Points",this.geometry=void 0!==t?t:new Rt,this.material=void 0!==e?e:new Pe({color:16777215*Math.random()})}function Ie(){ht.call(this),this.type="Group"}function Ue(t,e,r,n,i,o,s,c,u){function h(){requestAnimationFrame(h),t.readyState>=t.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}a.call(this,t,e,r,n,i,o,s,c,u),this.generateMipmaps=!1;var l=this;h()}function Ne(t,e,r,n,i,o,s,c,u,h,l,d){a.call(this,null,o,s,c,u,h,n,i,l,d),this.image={width:e,height:r},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Oe(t,e,r,n,i,o,s,c,u){a.call(this,t,e,r,n,i,o,s,c,u),this.needsUpdate=!0}function Be(t,e,r,n,i,o,s,c,u,h){if((h=void 0!==h?h:jo)!==jo&&h!==Wo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&h===jo&&(r=Ro),void 0===r&&h===Wo&&(r=Do),a.call(this,null,n,i,o,s,c,h,r,u),this.image={width:t,height:e},this.magFilter=void 0!==s?s:bo,this.minFilter=void 0!==c?c:bo,this.flipY=!1,this.generateMipmaps=!1}function De(t){Rt.call(this),this.type="WireframeGeometry";var e,r,n,i,a,o,s,c,u,l,d=[],p=[0,0],f={},m=["a","b","c"];if(t&&t.isGeometry){var v=t.faces;for(e=0,n=v.length;e<n;e++){var g=v[e];for(r=0;r<3;r++)s=g[m[r]],c=g[m[(r+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),u=p[0]+","+p[1],void 0===f[u]&&(f[u]={index1:p[0],index2:p[1]})}for(u in f)o=f[u],l=t.vertices[o.index1],d.push(l.x,l.y,l.z),l=t.vertices[o.index2],d.push(l.x,l.y,l.z)}else if(t&&t.isBufferGeometry){var y,x,b,_,w,M,E,T;if(l=new h,null!==t.index){for(y=t.attributes.position,x=t.index,b=t.groups,0===b.length&&(b=[{start:0,count:x.count,materialIndex:0}]),i=0,a=b.length;i<a;++i)for(_=b[i],w=_.start,M=_.count,e=w,n=w+M;e<n;e+=3)for(r=0;r<3;r++)s=x.getX(e+r),c=x.getX(e+(r+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),u=p[0]+","+p[1],void 0===f[u]&&(f[u]={index1:p[0],index2:p[1]});for(u in f)o=f[u],l.fromBufferAttribute(y,o.index1),d.push(l.x,l.y,l.z),l.fromBufferAttribute(y,o.index2),d.push(l.x,l.y,l.z)}else for(y=t.attributes.position,e=0,n=y.count/3;e<n;e++)for(r=0;r<3;r++)E=3*e+r,l.fromBufferAttribute(y,E),d.push(l.x,l.y,l.z),T=3*e+(r+1)%3,l.fromBufferAttribute(y,T),d.push(l.x,l.y,l.z)}this.addAttribute("position",new Mt(d,3))}function Fe(t,e,r){Lt.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:r},this.fromBufferGeometry(new ze(t,e,r)),this.mergeVertices()}function ze(t,e,r){Rt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:r};var n,i,a=[],o=[],s=[],c=[],u=new h,l=new h,d=new h,p=new h,f=new h,m=e+1;for(n=0;n<=r;n++){var v=n/r;for(i=0;i<=e;i++){var g=i/e;l=t(g,v,l),o.push(l.x,l.y,l.z),g-1e-5>=0?(d=t(g-1e-5,v,d),p.subVectors(l,d)):(d=t(g+1e-5,v,d),p.subVectors(d,l)),v-1e-5>=0?(d=t(g,v-1e-5,d),f.subVectors(l,d)):(d=t(g,v+1e-5,d),f.subVectors(d,l)),u.crossVectors(p,f).normalize(),s.push(u.x,u.y,u.z),c.push(g,v)}}for(n=0;n<r;n++)for(i=0;i<e;i++){var y=n*m+i,x=n*m+i+1,b=(n+1)*m+i+1,_=(n+1)*m+i;a.push(y,x,_),a.push(x,b,_)}this.setIndex(a),this.addAttribute("position",new Mt(o,3)),this.addAttribute("normal",new Mt(s,3)),this.addAttribute("uv",new Mt(c,2))}function Ge(t,e,r,n){Lt.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:n},this.fromBufferGeometry(new ke(t,e,r,n)),this.mergeVertices()}function ke(t,e,r,n){function a(t,e,r,n){var i,a,o=Math.pow(2,n),c=[];for(i=0;i<=o;i++){c[i]=[];var u=t.clone().lerp(r,i/o),h=e.clone().lerp(r,i/o),l=o-i;for(a=0;a<=l;a++)c[i][a]=0===a&&i===o?u:u.clone().lerp(h,a/l)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var d=Math.floor(a/2);a%2==0?(s(c[i][d+1]),s(c[i+1][d]),s(c[i][d])):(s(c[i][d+1]),s(c[i+1][d+1]),s(c[i+1][d]))}}function o(){for(var t=0;t<m.length;t+=6){var e=m[t+0],r=m[t+2],n=m[t+4],i=Math.max(e,r,n),a=Math.min(e,r,n);i>.9&&a<.1&&(e<.2&&(m[t+0]+=1),r<.2&&(m[t+2]+=1),n<.2&&(m[t+4]+=1))}}function s(t){f.push(t.x,t.y,t.z)}function c(e,r){var n=3*e;r.x=t[n+0],r.y=t[n+1],r.z=t[n+2]}function u(){for(var t=new h,e=new h,r=new h,n=new h,a=new i,o=new i,s=new i,c=0,u=0;c<f.length;c+=9,u+=6){t.set(f[c+0],f[c+1],f[c+2]),e.set(f[c+3],f[c+4],f[c+5]),r.set(f[c+6],f[c+7],f[c+8]),a.set(m[u+0],m[u+1]),o.set(m[u+2],m[u+3]),s.set(m[u+4],m[u+5]),n.copy(t).add(e).add(r).divideScalar(3);var p=d(n);l(a,u+0,t,p),l(o,u+2,e,p),l(s,u+4,r,p)}}function l(t,e,r,n){n<0&&1===t.x&&(m[e]=t.x-1),0===r.x&&0===r.z&&(m[e]=n/2/Math.PI+.5)}function d(t){return Math.atan2(t.z,-t.x)}function p(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Rt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:r,detail:n},r=r||1,n=n||0;var f=[],m=[];!function(t){for(var r=new h,n=new h,i=new h,o=0;o<e.length;o+=3)c(e[o+0],r),c(e[o+1],n),c(e[o+2],i),a(r,n,i,t)}(n),function(t){for(var e=new h,r=0;r<f.length;r+=3)e.x=f[r+0],e.y=f[r+1],e.z=f[r+2],e.normalize().multiplyScalar(t),f[r+0]=e.x,f[r+1]=e.y,f[r+2]=e.z}(r),function(){for(var t=new h,e=0;e<f.length;e+=3){t.x=f[e+0],t.y=f[e+1],t.z=f[e+2];var r=d(t)/2/Math.PI+.5,n=p(t)/Math.PI+.5;m.push(r,1-n)}u(),o()}(),this.addAttribute("position",new Mt(f,3)),this.addAttribute("normal",new Mt(f.slice(),3)),this.addAttribute("uv",new Mt(m,2)),this.normalizeNormals()}function He(t,e){Lt.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ve(t,e)),this.mergeVertices()}function Ve(t,e){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];ke.call(this,r,n,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function je(t,e){Lt.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new We(t,e)),this.mergeVertices()}function We(t,e){var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];ke.call(this,r,n,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xe(t,e){Lt.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new qe(t,e)),this.mergeVertices()}function qe(t,e){var r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],i=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];ke.call(this,n,i,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ye(t,e){Lt.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ze(t,e)),this.mergeVertices()}function Ze(t,e){var r=(1+Math.sqrt(5))/2,n=1/r,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];ke.call(this,i,a,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Je(t,e,r,n,i,a){Lt.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:n,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Qe(t,e,r,n,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Qe(t,e,r,n,a){function o(i){var a=t.getPointAt(i/e),o=u.normals[i],s=u.binormals[i];for(d=0;d<=n;d++){var c=d/n*Math.PI*2,h=Math.sin(c),l=-Math.cos(c);f.x=l*o.x+h*s.x,f.y=l*o.y+h*s.y,f.z=l*o.z+h*s.z,f.normalize(),g.push(f.x,f.y,f.z),p.x=a.x+r*f.x,p.y=a.y+r*f.y,p.z=a.z+r*f.z,v.push(p.x,p.y,p.z)}}function s(){for(d=1;d<=e;d++)for(l=1;l<=n;l++){var t=(n+1)*(d-1)+(l-1),r=(n+1)*d+(l-1),i=(n+1)*d+l,a=(n+1)*(d-1)+l;x.push(t,r,a),x.push(r,i,a)}}function c(){for(l=0;l<=e;l++)for(d=0;d<=n;d++)m.x=l/e,m.y=d/n,y.push(m.x,m.y)}Rt.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:r,radialSegments:n,closed:a},e=e||64,r=r||1,n=n||8,a=a||!1;var u=t.computeFrenetFrames(e,a);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var l,d,p=new h,f=new h,m=new i,v=[],g=[],y=[],x=[];!function(){for(l=0;l<e;l++)o(l);o(!1===a?e:0),c(),s()}(),this.setIndex(x),this.addAttribute("position",new Mt(v,3)),this.addAttribute("normal",new Mt(g,3)),this.addAttribute("uv",new Mt(y,2))}function Ke(t,e,r,n,i,a,o){Lt.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new $e(t,e,r,n,i,a)),this.mergeVertices()}function $e(t,e,r,n,i,a){function o(t,e,r,n,i){var a=Math.cos(t),o=Math.sin(t),s=r/e*t,c=Math.cos(s);i.x=n*(2+c)*.5*a,i.y=n*(2+c)*o*.5,i.z=n*Math.sin(s)*.5}Rt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:r,radialSegments:n,p:i,q:a},t=t||100,e=e||40,r=Math.floor(r)||64,n=Math.floor(n)||8,i=i||2,a=a||3;var s,c,u=[],l=[],d=[],p=[],f=new h,m=new h,v=new h,g=new h,y=new h,x=new h,b=new h;for(s=0;s<=r;++s){var _=s/r*i*Math.PI*2;for(o(_,i,a,t,v),o(_+.01,i,a,t,g),x.subVectors(g,v),b.addVectors(g,v),y.crossVectors(x,b),b.crossVectors(y,x),y.normalize(),b.normalize(),c=0;c<=n;++c){var w=c/n*Math.PI*2,M=-e*Math.cos(w),E=e*Math.sin(w);f.x=v.x+(M*b.x+E*y.x),f.y=v.y+(M*b.y+E*y.y),f.z=v.z+(M*b.z+E*y.z),l.push(f.x,f.y,f.z),m.subVectors(f,v).normalize(),d.push(m.x,m.y,m.z),p.push(s/r),p.push(c/n)}}for(c=1;c<=r;c++)for(s=1;s<=n;s++){var T=(n+1)*(c-1)+(s-1),S=(n+1)*c+(s-1),A=(n+1)*c+s,L=(n+1)*(c-1)+s;u.push(T,S,L),u.push(S,A,L)}this.setIndex(u),this.addAttribute("position",new Mt(l,3)),this.addAttribute("normal",new Mt(d,3)),this.addAttribute("uv",new Mt(p,2))}function tr(t,e,r,n,i){Lt.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new er(t,e,r,n,i)),this.mergeVertices()}function er(t,e,r,n,i){Rt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:r,tubularSegments:n,arc:i},t=t||100,e=e||40,r=Math.floor(r)||8,n=Math.floor(n)||6,i=i||2*Math.PI;var a,o,s=[],c=[],u=[],l=[],d=new h,p=new h,f=new h;for(a=0;a<=r;a++)for(o=0;o<=n;o++){var m=o/n*i,v=a/r*Math.PI*2;p.x=(t+e*Math.cos(v))*Math.cos(m),p.y=(t+e*Math.cos(v))*Math.sin(m),p.z=e*Math.sin(v),c.push(p.x,p.y,p.z),d.x=t*Math.cos(m),d.y=t*Math.sin(m),f.subVectors(p,d).normalize(),u.push(f.x,f.y,f.z),l.push(o/n),l.push(a/r)}for(a=1;a<=r;a++)for(o=1;o<=n;o++){var g=(n+1)*a+o-1,y=(n+1)*(a-1)+o-1,x=(n+1)*(a-1)+o,b=(n+1)*a+o;s.push(g,y,b),s.push(y,x,b)}this.setIndex(s),this.addAttribute("position",new Mt(c,3)),this.addAttribute("normal",new Mt(u,3)),this.addAttribute("uv",new Mt(l,2))}function rr(t,e){Lt.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new nr(t,e)),this.mergeVertices()}function nr(t,e){if(void 0===t)return void(t=[]);Rt.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals()}function ir(t,e){Lt.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new ar(t,e)),this.mergeVertices()}function ar(t,e){e=e||{};var r=e.font;if(!1===(r&&r.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Lt;var n=r.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),nr.call(this,n,e),this.type="TextBufferGeometry"}function or(t,e,r,n,i,a,o){Lt.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new sr(t,e,r,n,i,a,o)),this.mergeVertices()}function sr(t,e,r,n,i,a,o){Rt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},t=t||50,e=Math.max(3,Math.floor(e)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,u=a+o,l=0,d=[],p=new h,f=new h,m=[],v=[],g=[],y=[];for(c=0;c<=r;c++){var x=[],b=c/r;for(s=0;s<=e;s++){var _=s/e;p.x=-t*Math.cos(n+_*i)*Math.sin(a+b*o),p.y=t*Math.cos(a+b*o),p.z=t*Math.sin(n+_*i)*Math.sin(a+b*o),v.push(p.x,p.y,p.z),f.set(p.x,p.y,p.z).normalize(),g.push(f.x,f.y,f.z),y.push(_,1-b),x.push(l++)}d.push(x)}for(c=0;c<r;c++)for(s=0;s<e;s++){var w=d[c][s+1],M=d[c][s],E=d[c+1][s],T=d[c+1][s+1];(0!==c||a>0)&&m.push(w,M,T),(c!==r-1||u<Math.PI)&&m.push(M,E,T)}this.setIndex(m),this.addAttribute("position",new Mt(v,3)),this.addAttribute("normal",new Mt(g,3)),this.addAttribute("uv",new Mt(y,2))}function cr(t,e,r,n,i,a){Lt.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new ur(t,e,r,n,i,a)),this.mergeVertices()}function ur(t,e,r,n,a,o){Rt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:r,phiSegments:n,thetaStart:a,thetaLength:o},t=t||20,e=e||50,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,r=void 0!==r?Math.max(3,r):8,n=void 0!==n?Math.max(1,n):1;var s,c,u,l=[],d=[],p=[],f=[],m=t,v=(e-t)/n,g=new h,y=new i;for(c=0;c<=n;c++){for(u=0;u<=r;u++)s=a+u/r*o,g.x=m*Math.cos(s),g.y=m*Math.sin(s),d.push(g.x,g.y,g.z),p.push(0,0,1),y.x=(g.x/e+1)/2,y.y=(g.y/e+1)/2,f.push(y.x,y.y);m+=v}for(c=0;c<n;c++){var x=c*(r+1);for(u=0;u<r;u++){s=u+x;var b=s,_=s+r+1,w=s+r+2,M=s+1;l.push(b,_,M),l.push(_,w,M)}}this.setIndex(l),this.addAttribute("position",new Mt(d,3)),this.addAttribute("normal",new Mt(p,3)),this.addAttribute("uv",new Mt(f,2))}function hr(t,e,r,n){Lt.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:n},this.fromBufferGeometry(new lr(t,e,r,n)),this.mergeVertices()}function lr(t,e,r,n){Rt.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:r,phiLength:n},e=Math.floor(e)||12,r=r||0,n=n||2*Math.PI,n=Ms.clamp(n,0,2*Math.PI);var a,o,s,c=[],u=[],l=[],d=1/e,p=new h,f=new i;for(o=0;o<=e;o++){var m=r+o*d*n,v=Math.sin(m),g=Math.cos(m);for(s=0;s<=t.length-1;s++)p.x=t[s].x*v,p.y=t[s].y,p.z=t[s].x*g,u.push(p.x,p.y,p.z),f.x=o/e,f.y=s/(t.length-1),l.push(f.x,f.y)}for(o=0;o<e;o++)for(s=0;s<t.length-1;s++){a=s+o*t.length;var y=a,x=a+t.length,b=a+t.length+1,_=a+1;c.push(y,x,_),c.push(x,b,_)}if(this.setIndex(c),this.addAttribute("position",new Mt(u,3)),this.addAttribute("uv",new Mt(l,2)),this.computeVertexNormals(),n===2*Math.PI){var w=this.attributes.normal.array,M=new h,E=new h,T=new h;for(a=e*t.length*3,o=0,s=0;o<t.length;o++,s+=3)M.x=w[s+0],M.y=w[s+1],M.z=w[s+2],E.x=w[a+s+0],E.y=w[a+s+1],E.z=w[a+s+2],T.addVectors(M,E).normalize(),w[s+0]=w[a+s+0]=T.x,w[s+1]=w[a+s+1]=T.y,w[s+2]=w[a+s+2]=T.z}}function dr(t,e){Lt.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new pr(t,e)),this.mergeVertices()}function pr(t,e){function r(t){var r,s,u,h=i.length/3,l=t.extractPoints(e),d=l.shape,p=l.holes;if(!1===ks.isClockWise(d))for(d=d.reverse(),r=0,s=p.length;r<s;r++)u=p[r],!0===ks.isClockWise(u)&&(p[r]=u.reverse());var f=ks.triangulateShape(d,p);for(r=0,s=p.length;r<s;r++)u=p[r],d=d.concat(u);for(r=0,s=d.length;r<s;r++){var m=d[r];i.push(m.x,m.y,0),a.push(0,0,1),o.push(m.x,m.y)}for(r=0,s=f.length;r<s;r++){var v=f[r],g=v[0]+h,y=v[1]+h,x=v[2]+h;n.push(g,y,x),c+=3}}Rt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],i=[],a=[],o=[],s=0,c=0;if(!1===Array.isArray(t))r(t);else for(var u=0;u<t.length;u++)r(t[u]),this.addGroup(s,c,u),s+=c,c=0;this.setIndex(n),this.addAttribute("position",new Mt(i,3)),this.addAttribute("normal",new Mt(a,3)),this.addAttribute("uv",new Mt(o,2))}function fr(t,e){Rt.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var r,n,i,a,o=[],s=Math.cos(Ms.DEG2RAD*e),c=[0,0],u={},h=["a","b","c"];t.isBufferGeometry?(a=new Lt,a.fromBufferGeometry(t)):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var l=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],v=0;v<3;v++)r=m[h[v]],n=m[h[(v+1)%3]],c[0]=Math.min(r,n),c[1]=Math.max(r,n),i=c[0]+","+c[1],void 0===u[i]?u[i]={index1:c[0],index2:c[1],face1:p,face2:void 0}:u[i].face2=p;for(i in u){var g=u[i];if(void 0===g.face2||d[g.face1].normal.dot(d[g.face2].normal)<=s){var y=l[g.index1];o.push(y.x,y.y,y.z),y=l[g.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new Mt(o,3))}function mr(t,e,r,n,i,a,o,s){Lt.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new vr(t,e,r,n,i,a,o,s)),this.mergeVertices()}function vr(t,e,r,n,a,o,s,c){function u(r){var a,o,u,g=new i,b=new h,_=0,w=!0===r?t:e,M=!0===r?1:-1;for(o=v,a=1;a<=n;a++)p.push(0,y*M,0),f.push(0,M,0),m.push(.5,.5),v++;for(u=v,a=0;a<=n;a++){var E=a/n,T=E*c+s,S=Math.cos(T),A=Math.sin(T);b.x=w*A,b.y=y*M,b.z=w*S,p.push(b.x,b.y,b.z),f.push(0,M,0),g.x=.5*S+.5,g.y=.5*A*M+.5,m.push(g.x,g.y),v++}for(a=0;a<n;a++){var L=o+a,R=u+a;!0===r?d.push(R,R+1,L):d.push(R+1,R,L),_+=3}l.addGroup(x,_,!0===r?1:2),x+=_}Rt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:r,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:c};var l=this;t=void 0!==t?t:20,e=void 0!==e?e:20,r=void 0!==r?r:100,n=Math.floor(n)||8,a=Math.floor(a)||1,o=void 0!==o&&o,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var d=[],p=[],f=[],m=[],v=0,g=[],y=r/2,x=0;!function(){var i,o,u=new h,b=new h,_=0,w=(e-t)/r;for(o=0;o<=a;o++){var M=[],E=o/a,T=E*(e-t)+t;for(i=0;i<=n;i++){var S=i/n,A=S*c+s,L=Math.sin(A),R=Math.cos(A);b.x=T*L,b.y=-E*r+y,b.z=T*R,p.push(b.x,b.y,b.z),u.set(L,w,R).normalize(),f.push(u.x,u.y,u.z),m.push(S,1-E),M.push(v++)}g.push(M)}for(i=0;i<n;i++)for(o=0;o<a;o++){var P=g[o][i],C=g[o+1][i],I=g[o+1][i+1],U=g[o][i+1];d.push(P,C,U),d.push(C,I,U),_+=6}l.addGroup(x,_,0),x+=_}(),!1===o&&(t>0&&u(!0),e>0&&u(!1)),this.setIndex(d),this.addAttribute("position",new Mt(p,3)),this.addAttribute("normal",new Mt(f,3)),this.addAttribute("uv",new Mt(m,2))}function gr(t,e,r,n,i,a,o){mr.call(this,0,t,e,r,n,i,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function yr(t,e,r,n,i,a,o){vr.call(this,0,t,e,r,n,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function xr(t,e,r,n){Lt.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new br(t,e,r,n)),this.mergeVertices()}function br(t,e,r,n){Rt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:r,thetaLength:n},t=t||50,e=void 0!==e?Math.max(3,e):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var a,o,s=[],c=[],u=[],l=[],d=new h,p=new i;for(c.push(0,0,0),u.push(0,0,1),l.push(.5,.5),o=0,a=3;o<=e;o++,a+=3){var f=r+o/e*n;d.x=t*Math.cos(f),d.y=t*Math.sin(f),c.push(d.x,d.y,d.z),u.push(0,0,1),p.x=(c[a]/t+1)/2,p.y=(c[a+1]/t+1)/2,l.push(p.x,p.y)}for(a=1;a<=e;a++)s.push(a,a+1,0);this.setIndex(s),this.addAttribute("position",new Mt(c,3)),this.addAttribute("normal",new Mt(u,3)),this.addAttribute("uv",new Mt(l,2))}function _r(t){$.call(this,{uniforms:Ns.merge([Us.lights,{opacity:{value:1}}]),vertexShader:Os.shadow_vert,fragmentShader:Os.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function wr(t){$.call(this,t),this.type="RawShaderMaterial"}function Mr(t){K.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Y(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Er(t){Mr.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Tr(t){K.call(this),this.type="MeshPhongMaterial",this.color=new Y(16777215),this.specular=new Y(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=to,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Sr(t){Tr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Ar(t){K.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Lr(t){K.call(this),this.type="MeshLambertMaterial",this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=to,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Rr(t){K.call(this),this.type="LineDashedMaterial",this.color=new Y(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Pr(t,e,r){var n=this,i=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=r,this.itemStart=function(t){o++,!1===i&&void 0!==n.onStart&&n.onStart(t,a,o),i=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(i=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)}}function Cr(t){this.manager=void 0!==t?t:Ws}function Ir(t){this.manager=void 0!==t?t:Ws,this._parser=null}function Ur(t){this.manager=void 0!==t?t:Ws,this._parser=null}function Nr(t){this.manager=void 0!==t?t:Ws}function Or(t){this.manager=void 0!==t?t:Ws}function Br(t){this.manager=void 0!==t?t:Ws}function Dr(t,e){ht.call(this),this.type="Light",this.color=new Y(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Fr(t,e,r){Dr.call(this,t,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ht.DefaultUp),this.updateMatrix(),this.groundColor=new Y(e)}function zr(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new l}function Gr(){zr.call(this,new Bt(50,1,.5,500))}function kr(t,e,r,n,i,a){Dr.call(this,t,e),this.type="SpotLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new Gr}function Hr(t,e,r,n){Dr.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new zr(new Bt(90,1,.5,500))}function Vr(){zr.call(this,new Dt(-5,5,5,-5,.5,500))}function jr(t,e){Dr.call(this,t,e),this.type="DirectionalLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.shadow=new Vr}function Wr(t,e){Dr.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Xr(t,e,r,n){Dr.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==r?r:10,this.height=void 0!==n?n:10}function qr(t,e,r,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(r),this.sampleValues=e,this.valueSize=r}function Yr(t,e,r,n){qr.call(this,t,e,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Zr(t,e,r,n){qr.call(this,t,e,r,n)}function Jr(t,e,r,n){qr.call(this,t,e,r,n)}function Qr(t,e,r,n){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Xs.convertArray(e,this.TimeBufferType),this.values=Xs.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function Kr(t,e,r,n){Qr.call(this,t,e,r,n)}function $r(t,e,r,n){qr.call(this,t,e,r,n)}function tn(t,e,r,n){Qr.call(this,t,e,r,n)}function en(t,e,r,n){Qr.call(this,t,e,r,n)}function rn(t,e,r,n){Qr.call(this,t,e,r,n)}function nn(t,e,r){Qr.call(this,t,e,r)}function an(t,e,r,n){Qr.call(this,t,e,r,n)}function on(t,e,r,n){Qr.apply(this,arguments)}function sn(t,e,r){this.name=t,this.tracks=r,this.duration=void 0!==e?e:-1,this.uuid=Ms.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function cn(t){this.manager=void 0!==t?t:Ws,this.textures={}}function un(t){this.manager=void 0!==t?t:Ws}function hn(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ln(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Ws,this.withCredentials=!1}function dn(t){this.manager=void 0!==t?t:Ws,this.texturePath=""}function pn(t,e,r,n,i){var a=.5*(n-e),o=.5*(i-r),s=t*t;return(2*r-2*n+a+o)*(t*s)+(-3*r+3*n-2*a-o)*s+a*t+r}function fn(t,e){var r=1-t;return r*r*e}function mn(t,e){return 2*(1-t)*t*e}function vn(t,e){return t*t*e}function gn(t,e,r,n){return fn(t,e)+mn(t,r)+vn(t,n)}function yn(t,e){var r=1-t;return r*r*r*e}function xn(t,e){var r=1-t;return 3*r*r*t*e}function bn(t,e){return 3*(1-t)*t*t*e}function _n(t,e){return t*t*t*e}function wn(t,e,r,n,i){return yn(t,e)+xn(t,r)+bn(t,n)+_n(t,i)}function Mn(){this.arcLengthDivisions=200}function En(t,e){Mn.call(this),this.v1=t,this.v2=e}function Tn(){Mn.call(this),this.curves=[],this.autoClose=!1}function Sn(t,e,r,n,i,a,o,s){Mn.call(this),this.aX=t,this.aY=e,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function An(t){Mn.call(this),this.points=void 0===t?[]:t}function Ln(t,e,r,n){Mn.call(this),this.v0=t,this.v1=e,this.v2=r,this.v3=n}function Rn(t,e,r){Mn.call(this),this.v0=t,this.v1=e,this.v2=r}function Pn(t){Tn.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function Cn(){Pn.apply(this,arguments),this.holes=[]}function In(){this.subPaths=[],this.currentPath=null}function Un(t){this.data=t}function Nn(t){this.manager=void 0!==t?t:Ws}function On(t){this.manager=void 0!==t?t:Ws}function Bn(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Bt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Bt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Dn(t,e,r){ht.call(this),this.type="CubeCamera";var n=new Bt(90,1,t,e);n.up.set(0,-1,0),n.lookAt(new h(1,0,0)),this.add(n);var i=new Bt(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new h(-1,0,0)),this.add(i);var a=new Bt(90,1,t,e);a.up.set(0,0,1),a.lookAt(new h(0,1,0)),this.add(a);var o=new Bt(90,1,t,e);o.up.set(0,0,-1),o.lookAt(new h(0,-1,0)),this.add(o);var s=new Bt(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new h(0,0,1)),this.add(s);var u=new Bt(90,1,t,e);u.up.set(0,-1,0),u.lookAt(new h(0,0,-1)),this.add(u);var l={format:zo,magFilter:Mo,minFilter:Mo};this.renderTarget=new c(r,r,l),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,c=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,t.render(e,n,r),r.activeCubeFace=1,t.render(e,i,r),r.activeCubeFace=2,t.render(e,a,r),r.activeCubeFace=3,t.render(e,o,r),r.activeCubeFace=4,t.render(e,s,r),r.texture.generateMipmaps=c,r.activeCubeFace=5,t.render(e,u,r),t.setRenderTarget(null)}}function Fn(t){Bt.call(this),this.enabled=!1,this.cameras=t||[]}function zn(){ht.call(this),this.type="AudioListener",this.context=tc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Gn(t){ht.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function kn(t){Gn.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Hn(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Vn(t,e,r){this.binding=t,this.valueSize=r;var n,i=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(4*r),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function jn(t,e,r){var n=r||Wn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function Wn(t,e,r){this.path=e,this.parsedPath=r||Wn.parseTrackName(e),this.node=Wn.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Xn(t){this.uuid=Ms.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function qn(t,e,r){this._mixer=t,this._clip=e,this._localRoot=r||null;for(var n=e.tracks,i=n.length,a=new Array(i),o={endingStart:ss,endingEnd:ss},s=0;s!==i;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=rs,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Yn(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Zn(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Jn(){Rt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Qn(t,e,r,n){this.uuid=Ms.generateUUID(),this.data=t,this.itemSize=e,this.offset=r,this.normalized=!0===n}function Kn(t,e){this.uuid=Ms.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function $n(t,e,r){Kn.call(this,t,e),this.meshPerAttribute=r||1}function ti(t,e,r){mt.call(this,t,e),this.meshPerAttribute=r||1}function ei(t,e,r,n){this.ray=new st(t,e),this.near=r||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ri(t,e){return t.distance-e.distance}function ni(t,e,r,n){if(!1!==t.visible&&(t.raycast(e,r),!0===n))for(var i=t.children,a=0,o=i.length;a<o;a++)ni(i[a],e,r,!0)}function ii(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function ai(t,e,r){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==r?r:0,this}function oi(t,e,r){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==r?r:0,this}function si(t,e){Pt.call(this,t,e),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,n=r-1,i=r/1;this.createAnimation("__default",0,n,i),this.setAnimationWeight("__default",1)}function ci(t){ht.call(this),this.material=t,this.render=function(t){}}function ui(t,e,r,n){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==r?r:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Rt,u=new Mt(2*o*3,3);c.addAttribute("position",u),Le.call(this,c,new Se({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function hi(t){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Rt,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,i=1;n<32;n++,i++){var a=n/32*Math.PI*2,o=i/32*Math.PI*2;r.push(Math.cos(a),Math.sin(a),1,Math.cos(o),Math.sin(o),1)}e.addAttribute("position",new Mt(r,3));var s=new Se({fog:!1});this.cone=new Le(e,s),this.add(this.cone),this.update()}function li(t){this.bones=this.getBoneList(t);for(var e=new Rt,r=[],n=[],i=new Y(0,0,1),a=new Y(0,1,0),o=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),n.push(i.r,i.g,i.b),n.push(a.r,a.g,a.b))}e.addAttribute("position",new Mt(r,3)),e.addAttribute("color",new Mt(n,3));var c=new Se({vertexColors:Ma,depthTest:!1,depthWrite:!1,transparent:!0});Le.call(this,e,c),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function di(t,e){this.light=t,this.light.updateMatrixWorld();var r=new sr(e,4,2),n=new ft({wireframe:!0,fog:!1});n.color.copy(this.light.color),Pt.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function pi(t){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var e=new Se({color:t.color}),r=new Rt;r.addAttribute("position",new mt(new Float32Array(15),3)),this.add(new Ae(r,e)),this.update()}function fi(t,e){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var r=new We(e);r.rotateY(.5*Math.PI);var n=new ft({vertexColors:Ma,wireframe:!0}),i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.addAttribute("color",new mt(a,3)),this.add(new Pt(r,n)),this.update()}function mi(t,e,r,n){t=t||10,e=e||10,r=new Y(void 0!==r?r:4473924),n=new Y(void 0!==n?n:8947848);for(var i=e/2,a=t/e,o=t/2,s=[],c=[],u=0,h=0,l=-o;u<=e;u++,l+=a){s.push(-o,0,l,o,0,l),s.push(l,0,-o,l,0,o);var d=u===i?r:n;d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3}var p=new Rt;p.addAttribute("position",new Mt(s,3)),p.addAttribute("color",new Mt(c,3));var f=new Se({vertexColors:Ma});Le.call(this,p,f)}function vi(t,e,r,n,i,a){t=t||10,e=e||16,r=r||8,n=n||64,i=new Y(void 0!==i?i:4473924),a=new Y(void 0!==a?a:8947848);var o,s,c,u,h,l,d,p=[],f=[];for(u=0;u<=e;u++)c=u/e*(2*Math.PI),o=Math.sin(c)*t,s=Math.cos(c)*t,p.push(0,0,0),p.push(o,0,s),d=1&u?i:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(u=0;u<=r;u++)for(d=1&u?i:a,l=t-t/r*u,h=0;h<n;h++)c=h/n*(2*Math.PI),o=Math.sin(c)*l,s=Math.cos(c)*l,p.push(o,0,s),f.push(d.r,d.g,d.b),c=(h+1)/n*(2*Math.PI),o=Math.sin(c)*l,s=Math.cos(c)*l,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Rt;m.addAttribute("position",new Mt(p,3)),m.addAttribute("color",new Mt(f,3));var v=new Se({vertexColors:Ma});Le.call(this,m,v)}function gi(t,e,r,n){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==r?r:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Rt,u=new Mt(2*o*3,3);c.addAttribute("position",u),Le.call(this,c,new Se({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function yi(t,e){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var r=new Rt;r.addAttribute("position",new Mt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new Se({fog:!1});this.add(new Ae(r,n)),r=new Rt,r.addAttribute("position",new Mt([0,0,0,0,0,1],3)),this.add(new Ae(r,n)),this.update()}function xi(t){function e(t,e,n){r(t,n),r(e,n)}function r(t,e){a.push(0,0,0),o.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(a.length/3-1)}var n=new Rt,i=new Se({color:16777215,vertexColors:wa}),a=[],o=[],s={},c=new Y(16755200),u=new Y(16711680),h=new Y(43775),l=new Y(16777215),d=new Y(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",u),e("p","n2",u),e("p","n3",u),e("p","n4",u),e("u1","u2",h),e("u2","u3",h),e("u3","u1",h),e("c","t",l),e("p","c",d),e("cn1","cn2",d),e("cn3","cn4",d),e("cf1","cf2",d),e("cf3","cf4",d),n.addAttribute("position",new Mt(a,3)),n.addAttribute("color",new Mt(o,3)),Le.call(this,n,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function bi(t,e){this.object=t,void 0===e&&(e=16776960);var r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),i=new Rt;i.setIndex(new mt(r,1)),i.addAttribute("position",new mt(n,3)),Le.call(this,i,new Se({color:e})),this.matrixAutoUpdate=!1,this.update()}function _i(t,e,r,n,i,a){ht.call(this),void 0===n&&(n=16776960),void 0===r&&(r=1),void 0===i&&(i=.2*r),void 0===a&&(a=.2*i),void 0===ec&&(ec=new Rt,ec.addAttribute("position",new Mt([0,0,0,0,1,0],3)),rc=new vr(0,.5,1,5,1),rc.translate(0,-.5,0)),this.position.copy(e),this.line=new Ae(ec,new Se({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Pt(rc,new ft({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(r,i,a)}function wi(t){t=t||1;var e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Rt;n.addAttribute("position",new Mt(e,3)),n.addAttribute("color",new Mt(r,3));var i=new Se({vertexColors:Ma});Le.call(this,n,i)}function Mi(){function t(t,a,o,s){e=t,r=o,n=-3*t+3*a-2*o-s,i=2*t-2*a+o+s}var e=0,r=0,n=0,i=0;return{initCatmullRom:function(e,r,n,i,a){t(r,n,a*(n-e),a*(i-r))},initNonuniformCatmullRom:function(e,r,n,i,a,o,s){var c=(r-e)/a-(n-e)/(a+o)+(n-r)/o,u=(n-r)/o-(i-r)/(o+s)+(i-n)/s;c*=o,u*=o,t(r,n,c,u)},calc:function(t){var a=t*t;return e+r*t+n*a+i*(a*t)}}}function Ei(t){Mn.call(this),this.points=t||[],this.closed=!1}function Ti(t,e,r,n){Mn.call(this),this.v0=t,this.v1=e,this.v2=r,this.v3=n}function Si(t,e,r){Mn.call(this),this.v0=t,this.v1=e,this.v2=r}function Ai(t,e){Mn.call(this),this.v1=t,this.v2=e}function Li(t,e,r,n,i,a){Sn.call(this,t,e,r,r,n,i,a)}function Ri(t,e,r,n,i,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new pt(t,e,r,i,a,o)}function Pi(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Ci(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Ii(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Ce(t,e)}function Ui(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new _e(t)}function Ni(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Ce(t,e)}function Oi(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Pe(t)}function Bi(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Pe(t)}function Di(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Pe(t)}function Fi(t,e,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new h(t,e,r)}function zi(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new mt(t,e).setDynamic(!0)}function Gi(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new vt(t,e)}function ki(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new gt(t,e)}function Hi(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new yt(t,e)}function Vi(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new xt(t,e)}function ji(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new bt(t,e)}function Wi(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new _t(t,e)}function Xi(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new wt(t,e)}function qi(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Mt(t,e)}function Yi(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Et(t,e)}function Zi(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ei.call(this,t),this.type="catmullrom",this.closed=!0}function Ji(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ei.call(this,t),this.type="catmullrom"}function Qi(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Ei.call(this,t),this.type="catmullrom"}function Ki(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new bi(t,e)}function $i(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Le(new fr(t.geometry),new Se({color:void 0!==e?e:16777215}))}function ta(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Le(new De(t.geometry),new Se({color:void 0!==e?e:16777215}))}function ea(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Cr(t)}function ra(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Ur(t)}function na(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function ia(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}Object.defineProperty(e,"__esModule",{value:!0}),r.d(e,"WebGLRenderTargetCube",function(){return c}),r.d(e,"WebGLRenderTarget",function(){return s}),r.d(e,"WebGLRenderer",function(){return me}),r.d(e,"ShaderLib",function(){return Bs}),r.d(e,"UniformsLib",function(){return Us}),r.d(e,"UniformsUtils",function(){return Ns}),r.d(e,"ShaderChunk",function(){return Os}),r.d(e,"FogExp2",function(){return ve}),r.d(e,"Fog",function(){return ge}),r.d(e,"Scene",function(){return ye}),r.d(e,"LensFlare",function(){return xe}),r.d(e,"Sprite",function(){return _e}),r.d(e,"LOD",function(){return we}),r.d(e,"SkinnedMesh",function(){return Te}),r.d(e,"Skeleton",function(){return Me}),r.d(e,"Bone",function(){return Ee}),r.d(e,"Mesh",function(){return Pt}),r.d(e,"LineSegments",function(){return Le}),r.d(e,"LineLoop",function(){return Re}),r.d(e,"Line",function(){return Ae}),r.d(e,"Points",function(){return Ce}),r.d(e,"Group",function(){return Ie}),r.d(e,"VideoTexture",function(){return Ue}),r.d(e,"DataTexture",function(){return d}),r.d(e,"CompressedTexture",function(){return Ne}),r.d(e,"CubeTexture",function(){return p}),r.d(e,"CanvasTexture",function(){return Oe}),r.d(e,"DepthTexture",function(){return Be}),r.d(e,"Texture",function(){return a}),r.d(e,"CompressedTextureLoader",function(){return Ir}),r.d(e,"DataTextureLoader",function(){return Ur}),r.d(e,"CubeTextureLoader",function(){return Or}),r.d(e,"TextureLoader",function(){return Br}),r.d(e,"ObjectLoader",function(){return dn}),r.d(e,"MaterialLoader",function(){return cn}),r.d(e,"BufferGeometryLoader",function(){return un}),r.d(e,"DefaultLoadingManager",function(){return Ws}),r.d(e,"LoadingManager",function(){return Pr}),r.d(e,"JSONLoader",function(){return ln}),r.d(e,"ImageLoader",function(){return Nr}),r.d(e,"FontLoader",function(){return Nn}),r.d(e,"FileLoader",function(){return Cr}),r.d(e,"Loader",function(){return hn}),r.d(e,"Cache",function(){return js}),r.d(e,"AudioLoader",function(){return On}),r.d(e,"SpotLightShadow",function(){return Gr}),r.d(e,"SpotLight",function(){return kr}),r.d(e,"PointLight",function(){return Hr}),r.d(e,"RectAreaLight",function(){return Xr}),r.d(e,"HemisphereLight",function(){return Fr}),r.d(e,"DirectionalLightShadow",function(){return Vr}),r.d(e,"DirectionalLight",function(){return jr}),r.d(e,"AmbientLight",function(){return Wr}),r.d(e,"LightShadow",function(){return zr}),r.d(e,"Light",function(){return Dr}),r.d(e,"StereoCamera",function(){return Bn}),r.d(e,"PerspectiveCamera",function(){return Bt}),r.d(e,"OrthographicCamera",function(){return Dt}),r.d(e,"CubeCamera",function(){return Dn}),r.d(e,"ArrayCamera",function(){return Fn}),r.d(e,"Camera",function(){return Ot}),r.d(e,"AudioListener",function(){return zn}),r.d(e,"PositionalAudio",function(){return kn}),r.d(e,"AudioContext",function(){return tc}),r.d(e,"AudioAnalyser",function(){return Hn}),r.d(e,"Audio",function(){return Gn}),r.d(e,"VectorKeyframeTrack",function(){return Kr}),r.d(e,"StringKeyframeTrack",function(){return rn}),r.d(e,"QuaternionKeyframeTrack",function(){return tn}),r.d(e,"NumberKeyframeTrack",function(){return en}),r.d(e,"ColorKeyframeTrack",function(){return an}),r.d(e,"BooleanKeyframeTrack",function(){return nn}),r.d(e,"PropertyMixer",function(){return Vn}),r.d(e,"PropertyBinding",function(){return Wn}),r.d(e,"KeyframeTrack",function(){return on}),r.d(e,"AnimationUtils",function(){return Xs}),r.d(e,"AnimationObjectGroup",function(){return Xn}),r.d(e,"AnimationMixer",function(){return Yn}),r.d(e,"AnimationClip",function(){return sn}),r.d(e,"Uniform",function(){return Zn}),r.d(e,"InstancedBufferGeometry",function(){return Jn}),r.d(e,"BufferGeometry",function(){return Rt}),r.d(e,"GeometryIdCount",function(){return At}),r.d(e,"Geometry",function(){return Lt}),r.d(e,"InterleavedBufferAttribute",function(){return Qn}),r.d(e,"InstancedInterleavedBuffer",function(){return $n}),r.d(e,"InterleavedBuffer",function(){return Kn}),r.d(e,"InstancedBufferAttribute",function(){return ti}),r.d(e,"Face3",function(){return pt}),r.d(e,"Object3D",function(){return ht}),r.d(e,"Raycaster",function(){return ei}),r.d(e,"Layers",function(){return ut}),r.d(e,"EventDispatcher",function(){return n}),r.d(e,"Clock",function(){return ii}),r.d(e,"QuaternionLinearInterpolant",function(){return $r}),r.d(e,"LinearInterpolant",function(){return Zr}),r.d(e,"DiscreteInterpolant",function(){return Jr}),r.d(e,"CubicInterpolant",function(){return Yr}),r.d(e,"Interpolant",function(){return qr}),r.d(e,"Triangle",function(){return dt}),r.d(e,"Math",function(){return Ms}),r.d(e,"Spherical",function(){return ai}),r.d(e,"Cylindrical",function(){return oi}),r.d(e,"Plane",function(){return it}),r.d(e,"Frustum",function(){return at}),r.d(e,"Sphere",function(){return rt}),r.d(e,"Ray",function(){return st}),r.d(e,"Matrix4",function(){return l}),r.d(e,"Matrix3",function(){return nt}),r.d(e,"Box3",function(){return et}),r.d(e,"Box2",function(){return Z}),r.d(e,"Line3",function(){return lt}),r.d(e,"Euler",function(){return ct}),r.d(e,"Vector4",function(){return o}),r.d(e,"Vector3",function(){return h}),r.d(e,"Vector2",function(){return i}),r.d(e,"Quaternion",function(){return u}),r.d(e,"Color",function(){return Y}),r.d(e,"MorphBlendMesh",function(){return si}),r.d(e,"ImmediateRenderObject",function(){return ci}),r.d(e,"VertexNormalsHelper",function(){return ui}),r.d(e,"SpotLightHelper",function(){return hi}),r.d(e,"SkeletonHelper",function(){return li}),r.d(e,"PointLightHelper",function(){return di}),r.d(e,"RectAreaLightHelper",function(){return pi}),r.d(e,"HemisphereLightHelper",function(){return fi}),r.d(e,"GridHelper",function(){return mi}),r.d(e,"PolarGridHelper",function(){return vi}),r.d(e,"FaceNormalsHelper",function(){return gi}),r.d(e,"DirectionalLightHelper",function(){return yi}),r.d(e,"CameraHelper",function(){return xi}),r.d(e,"BoxHelper",function(){return bi}),r.d(e,"ArrowHelper",function(){return _i}),r.d(e,"AxisHelper",function(){return wi}),r.d(e,"CatmullRomCurve3",function(){return Ei}),r.d(e,"CubicBezierCurve3",function(){return Ti}),r.d(e,"QuadraticBezierCurve3",function(){return Si}),r.d(e,"LineCurve3",function(){return Ai}),r.d(e,"ArcCurve",function(){return Li}),r.d(e,"EllipseCurve",function(){return Sn}),r.d(e,"SplineCurve",function(){return An}),r.d(e,"CubicBezierCurve",function(){return Ln}),r.d(e,"QuadraticBezierCurve",function(){return Rn}),r.d(e,"LineCurve",function(){return En}),r.d(e,"Shape",function(){return Cn}),r.d(e,"Path",function(){return Pn}),r.d(e,"ShapePath",function(){return In}),r.d(e,"Font",function(){return Un}),r.d(e,"CurvePath",function(){return Tn}),r.d(e,"Curve",function(){return Mn}),r.d(e,"ShapeUtils",function(){return ks}),r.d(e,"SceneUtils",function(){return sc}),r.d(e,"WireframeGeometry",function(){return De}),r.d(e,"ParametricGeometry",function(){return Fe}),r.d(e,"ParametricBufferGeometry",function(){return ze}),r.d(e,"TetrahedronGeometry",function(){return He}),r.d(e,"TetrahedronBufferGeometry",function(){return Ve}),r.d(e,"OctahedronGeometry",function(){return je}),r.d(e,"OctahedronBufferGeometry",function(){return We}),r.d(e,"IcosahedronGeometry",function(){return Xe}),r.d(e,"IcosahedronBufferGeometry",function(){return qe}),r.d(e,"DodecahedronGeometry",function(){return Ye}),r.d(e,"DodecahedronBufferGeometry",function(){return Ze}),r.d(e,"PolyhedronGeometry",function(){return Ge}),r.d(e,"PolyhedronBufferGeometry",function(){return ke}),r.d(e,"TubeGeometry",function(){return Je}),r.d(e,"TubeBufferGeometry",function(){return Qe}),r.d(e,"TorusKnotGeometry",function(){return Ke}),r.d(e,"TorusKnotBufferGeometry",function(){return $e}),r.d(e,"TorusGeometry",function(){return tr}),r.d(e,"TorusBufferGeometry",function(){return er}),r.d(e,"TextGeometry",function(){return ir}),r.d(e,"TextBufferGeometry",function(){return ar}),r.d(e,"SphereGeometry",function(){return or}),r.d(e,"SphereBufferGeometry",function(){return sr}),r.d(e,"RingGeometry",function(){return cr}),r.d(e,"RingBufferGeometry",function(){return ur}),r.d(e,"PlaneGeometry",function(){return Ut}),r.d(e,"PlaneBufferGeometry",function(){return Nt}),r.d(e,"LatheGeometry",function(){return hr}),r.d(e,"LatheBufferGeometry",function(){return lr}),r.d(e,"ShapeGeometry",function(){return dr}),r.d(e,"ShapeBufferGeometry",function(){return pr}),r.d(e,"ExtrudeGeometry",function(){return rr}),r.d(e,"ExtrudeBufferGeometry",function(){return nr}),r.d(e,"EdgesGeometry",function(){return fr}),r.d(e,"ConeGeometry",function(){return gr}),r.d(e,"ConeBufferGeometry",function(){return yr}),r.d(e,"CylinderGeometry",function(){return mr}),r.d(e,"CylinderBufferGeometry",function(){return vr}),r.d(e,"CircleGeometry",function(){return xr}),r.d(e,"CircleBufferGeometry",function(){return br}),r.d(e,"BoxGeometry",function(){return Ct}),r.d(e,"BoxBufferGeometry",function(){return It}),r.d(e,"ShadowMaterial",function(){return _r}),r.d(e,"SpriteMaterial",function(){return be}),r.d(e,"RawShaderMaterial",function(){return wr}),r.d(e,"ShaderMaterial",function(){return $}),r.d(e,"PointsMaterial",function(){return Pe});r.d(e,"MeshPhysicalMaterial",function(){return Er}),r.d(e,"MeshStandardMaterial",function(){return Mr}),r.d(e,"MeshPhongMaterial",function(){return Tr}),r.d(e,"MeshToonMaterial",function(){return Sr}),r.d(e,"MeshNormalMaterial",function(){return Ar}),r.d(e,"MeshLambertMaterial",function(){return Lr}),r.d(e,"MeshDepthMaterial",function(){return tt}),r.d(e,"MeshBasicMaterial",function(){return ft}),r.d(e,"LineDashedMaterial",function(){return Rr}),r.d(e,"LineBasicMaterial",function(){return Se}),r.d(e,"Material",function(){return K}),r.d(e,"Float64BufferAttribute",function(){return Et}),r.d(e,"Float32BufferAttribute",function(){return Mt}),r.d(e,"Uint32BufferAttribute",function(){return wt}),r.d(e,"Int32BufferAttribute",function(){return _t}),r.d(e,"Uint16BufferAttribute",function(){return bt}),r.d(e,"Int16BufferAttribute",function(){return xt}),r.d(e,"Uint8ClampedBufferAttribute",function(){return yt}),r.d(e,"Uint8BufferAttribute",function(){return gt}),r.d(e,"Int8BufferAttribute",function(){return vt}),r.d(e,"BufferAttribute",function(){return mt}),r.d(e,"REVISION",function(){return aa}),r.d(e,"MOUSE",function(){return oa}),r.d(e,"CullFaceNone",function(){return sa}),r.d(e,"CullFaceBack",function(){return ca}),r.d(e,"CullFaceFront",function(){return ua}),r.d(e,"CullFaceFrontBack",function(){return ha}),r.d(e,"FrontFaceDirectionCW",function(){return la}),r.d(e,"FrontFaceDirectionCCW",function(){return da}),r.d(e,"BasicShadowMap",function(){return pa}),r.d(e,"PCFShadowMap",function(){return fa}),r.d(e,"PCFSoftShadowMap",function(){return ma}),r.d(e,"FrontSide",function(){return va}),r.d(e,"BackSide",function(){return ga}),r.d(e,"DoubleSide",function(){return ya}),r.d(e,"FlatShading",function(){return xa}),r.d(e,"SmoothShading",function(){return ba}),r.d(e,"NoColors",function(){return _a}),r.d(e,"FaceColors",function(){return wa}),r.d(e,"VertexColors",function(){return Ma}),r.d(e,"NoBlending",function(){return Ea}),r.d(e,"NormalBlending",function(){return Ta}),r.d(e,"AdditiveBlending",function(){return Sa}),r.d(e,"SubtractiveBlending",function(){return Aa}),r.d(e,"MultiplyBlending",function(){return La}),r.d(e,"CustomBlending",function(){return Ra}),r.d(e,"AddEquation",function(){return Pa}),r.d(e,"SubtractEquation",function(){return Ca}),r.d(e,"ReverseSubtractEquation",function(){return Ia}),r.d(e,"MinEquation",function(){return Ua}),r.d(e,"MaxEquation",function(){return Na}),r.d(e,"ZeroFactor",function(){return Oa}),r.d(e,"OneFactor",function(){return Ba}),r.d(e,"SrcColorFactor",function(){return Da}),r.d(e,"OneMinusSrcColorFactor",function(){return Fa}),r.d(e,"SrcAlphaFactor",function(){return za}),r.d(e,"OneMinusSrcAlphaFactor",function(){return Ga}),r.d(e,"DstAlphaFactor",function(){return ka}),r.d(e,"OneMinusDstAlphaFactor",function(){return Ha}),r.d(e,"DstColorFactor",function(){return Va}),r.d(e,"OneMinusDstColorFactor",function(){return ja}),r.d(e,"SrcAlphaSaturateFactor",function(){return Wa}),r.d(e,"NeverDepth",function(){return Xa}),r.d(e,"AlwaysDepth",function(){return qa}),r.d(e,"LessDepth",function(){return Ya}),r.d(e,"LessEqualDepth",function(){return Za}),r.d(e,"EqualDepth",function(){return Ja}),r.d(e,"GreaterEqualDepth",function(){return Qa}),r.d(e,"GreaterDepth",function(){return Ka}),r.d(e,"NotEqualDepth",function(){return $a}),r.d(e,"MultiplyOperation",function(){return to}),r.d(e,"MixOperation",function(){return eo}),r.d(e,"AddOperation",function(){return ro}),r.d(e,"NoToneMapping",function(){return no}),r.d(e,"LinearToneMapping",function(){return io}),r.d(e,"ReinhardToneMapping",function(){return ao}),r.d(e,"Uncharted2ToneMapping",function(){return oo}),r.d(e,"CineonToneMapping",function(){return so}),r.d(e,"UVMapping",function(){return co}),r.d(e,"CubeReflectionMapping",function(){return uo}),r.d(e,"CubeRefractionMapping",function(){return ho}),r.d(e,"EquirectangularReflectionMapping",function(){return lo}),r.d(e,"EquirectangularRefractionMapping",function(){return po}),r.d(e,"SphericalReflectionMapping",function(){return fo}),r.d(e,"CubeUVReflectionMapping",function(){return mo}),r.d(e,"CubeUVRefractionMapping",function(){return vo}),r.d(e,"RepeatWrapping",function(){return go}),r.d(e,"ClampToEdgeWrapping",function(){return yo}),r.d(e,"MirroredRepeatWrapping",function(){return xo}),r.d(e,"NearestFilter",function(){return bo}),r.d(e,"NearestMipMapNearestFilter",function(){return _o}),r.d(e,"NearestMipMapLinearFilter",function(){return wo}),r.d(e,"LinearFilter",function(){return Mo}),r.d(e,"LinearMipMapNearestFilter",function(){return Eo}),r.d(e,"LinearMipMapLinearFilter",function(){return To}),r.d(e,"UnsignedByteType",function(){return So}),r.d(e,"ByteType",function(){return Ao}),r.d(e,"ShortType",function(){return Lo}),r.d(e,"UnsignedShortType",function(){return Ro}),r.d(e,"IntType",function(){return Po}),r.d(e,"UnsignedIntType",function(){return Co}),r.d(e,"FloatType",function(){return Io}),r.d(e,"HalfFloatType",function(){return Uo}),r.d(e,"UnsignedShort4444Type",function(){return No}),r.d(e,"UnsignedShort5551Type",function(){return Oo}),r.d(e,"UnsignedShort565Type",function(){return Bo}),r.d(e,"UnsignedInt248Type",function(){return Do}),r.d(e,"AlphaFormat",function(){return Fo}),r.d(e,"RGBFormat",function(){return zo}),r.d(e,"RGBAFormat",function(){return Go}),r.d(e,"LuminanceFormat",function(){return ko}),r.d(e,"LuminanceAlphaFormat",function(){return Ho}),r.d(e,"RGBEFormat",function(){return Vo}),r.d(e,"DepthFormat",function(){return jo}),r.d(e,"DepthStencilFormat",function(){return Wo}),r.d(e,"RGB_S3TC_DXT1_Format",function(){return Xo}),r.d(e,"RGBA_S3TC_DXT1_Format",function(){return qo}),r.d(e,"RGBA_S3TC_DXT3_Format",function(){return Yo}),r.d(e,"RGBA_S3TC_DXT5_Format",function(){return Zo}),r.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return Jo}),r.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return Qo}),r.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return Ko}),r.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return $o}),r.d(e,"RGB_ETC1_Format",function(){return ts}),r.d(e,"LoopOnce",function(){return es}),r.d(e,"LoopRepeat",function(){return rs}),r.d(e,"LoopPingPong",function(){return ns}),r.d(e,"InterpolateDiscrete",function(){return is}),r.d(e,"InterpolateLinear",function(){return as}),r.d(e,"InterpolateSmooth",function(){return os}),r.d(e,"ZeroCurvatureEnding",function(){return ss}),r.d(e,"ZeroSlopeEnding",function(){return cs}),r.d(e,"WrapAroundEnding",function(){return us}),r.d(e,"TrianglesDrawMode",function(){return hs}),r.d(e,"TriangleStripDrawMode",function(){return ls}),r.d(e,"TriangleFanDrawMode",function(){return ds}),r.d(e,"LinearEncoding",function(){return ps}),r.d(e,"sRGBEncoding",function(){return fs}),r.d(e,"GammaEncoding",function(){return ms}),r.d(e,"RGBEEncoding",function(){return vs}),r.d(e,"LogLuvEncoding",function(){return gs}),r.d(e,"RGBM7Encoding",function(){return ys}),r.d(e,"RGBM16Encoding",function(){return xs}),r.d(e,"RGBDEncoding",function(){return bs}),r.d(e,"BasicDepthPacking",function(){return _s}),r.d(e,"RGBADepthPacking",function(){return ws}),r.d(e,"CubeGeometry",function(){return Ct}),r.d(e,"Face4",function(){return Ri}),r.d(e,"LineStrip",function(){return cc}),r.d(e,"LinePieces",function(){return uc}),r.d(e,"MeshFaceMaterial",function(){return Pi}),r.d(e,"MultiMaterial",function(){return Ci}),r.d(e,"PointCloud",function(){return Ii}),r.d(e,"Particle",function(){return Ui}),r.d(e,"ParticleSystem",function(){return Ni}),r.d(e,"PointCloudMaterial",function(){return Oi}),r.d(e,"ParticleBasicMaterial",function(){return Bi}),r.d(e,"ParticleSystemMaterial",function(){return Di}),r.d(e,"Vertex",function(){return Fi}),r.d(e,"DynamicBufferAttribute",function(){return zi}),r.d(e,"Int8Attribute",function(){return Gi}),r.d(e,"Uint8Attribute",function(){return ki}),r.d(e,"Uint8ClampedAttribute",function(){return Hi}),r.d(e,"Int16Attribute",function(){return Vi}),r.d(e,"Uint16Attribute",function(){return ji}),r.d(e,"Int32Attribute",function(){return Wi}),r.d(e,"Uint32Attribute",function(){return Xi}),r.d(e,"Float32Attribute",function(){return qi}),r.d(e,"Float64Attribute",function(){return Yi}),r.d(e,"ClosedSplineCurve3",function(){return Zi}),r.d(e,"SplineCurve3",function(){return Ji}),r.d(e,"Spline",function(){return Qi}),r.d(e,"BoundingBoxHelper",function(){return Ki}),r.d(e,"EdgesHelper",function(){return $i}),r.d(e,"WireframeHelper",function(){return ta}),r.d(e,"XHRLoader",function(){return ea}),r.d(e,"BinaryTextureLoader",function(){return ra}),r.d(e,"GeometryUtils",function(){return hc}),r.d(e,"ImageUtils",function(){return lc}),r.d(e,"Projector",function(){return na}),r.d(e,"CanvasRenderer",function(){return ia}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var n=arguments[r];if(void 0!==n&&null!==n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}}(),Object.assign(n.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[t]&&(r[t]=[]),-1===r[t].indexOf(e)&&r[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[t]&&-1!==r[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var r=this._listeners,n=r[t];if(void 0!==n){var i=n.indexOf(e);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,r=e[t.type];if(void 0!==r){t.target=this;var n=[],i=0,a=r.length;for(i=0;i<a;i++)n[i]=r[i];for(i=0;i<a;i++)n[i].call(this,t)}}}});var aa="85",oa={LEFT:0,MIDDLE:1,RIGHT:2},sa=0,ca=1,ua=2,ha=3,la=0,da=1,pa=0,fa=1,ma=2,va=0,ga=1,ya=2,xa=1,ba=2,_a=0,wa=1,Ma=2,Ea=0,Ta=1,Sa=2,Aa=3,La=4,Ra=5,Pa=100,Ca=101,Ia=102,Ua=103,Na=104,Oa=200,Ba=201,Da=202,Fa=203,za=204,Ga=205,ka=206,Ha=207,Va=208,ja=209,Wa=210,Xa=0,qa=1,Ya=2,Za=3,Ja=4,Qa=5,Ka=6,$a=7,to=0,eo=1,ro=2,no=0,io=1,ao=2,oo=3,so=4,co=300,uo=301,ho=302,lo=303,po=304,fo=305,mo=306,vo=307,go=1e3,yo=1001,xo=1002,bo=1003,_o=1004,wo=1005,Mo=1006,Eo=1007,To=1008,So=1009,Ao=1010,Lo=1011,Ro=1012,Po=1013,Co=1014,Io=1015,Uo=1016,No=1017,Oo=1018,Bo=1019,Do=1020,Fo=1021,zo=1022,Go=1023,ko=1024,Ho=1025,Vo=Go,jo=1026,Wo=1027,Xo=2001,qo=2002,Yo=2003,Zo=2004,Jo=2100,Qo=2101,Ko=2102,$o=2103,ts=2151,es=2200,rs=2201,ns=2202,is=2300,as=2301,os=2302,ss=2400,cs=2401,us=2402,hs=0,ls=1,ds=2,ps=3e3,fs=3001,ms=3007,vs=3002,gs=3003,ys=3004,xs=3005,bs=3006,_s=3200,ws=3201,Ms={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),n=0;return function(){for(var i=0;i<36;i++)8===i||13===i||18===i||23===i?r[i]="-":14===i?r[i]="4":(n<=2&&(n=33554432+16777216*Math.random()|0),t=15&n,n>>=4,r[i]=e[19===i?3&t|8:t]);return r.join("")}}(),clamp:function(t,e,r){return Math.max(e,Math.min(r,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,r,n,i){return n+(t-e)*(i-n)/(r-e)},lerp:function(t,e,r){return(1-r)*t+r*e},smoothstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*(3-2*t)},smootherstep:function(t,e,r){return t<=e?0:t>=r?1:(t=(t-e)/(r-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ms.DEG2RAD},radToDeg:function(t){return t*Ms.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}};Object.defineProperties(i.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(i.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new i,e=new i;return function(r,n){return t.set(r,r),e.set(n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*r-a*n+t.x,this.y=i*n+a*r+t.y,this}});var Es=0;a.DEFAULT_IMAGE=void 0,a.DEFAULT_MAPPING=co,Object.defineProperty(a.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(a.prototype,n.prototype,{constructor:a,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;void 0===r.uuid&&(r.uuid=Ms.generateUUID()),void 0===t.images[r.uuid]&&(t.images[r.uuid]={uuid:r.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(r)}),e.image=r.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===co){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case go:t.x=t.x-Math.floor(t.x);break;case yo:t.x=t.x<0?0:1;break;case xo:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case go:t.y=t.y-Math.floor(t.y);break;case yo:t.y=t.y<0?0:1;break;case xo:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(o.prototype,{isVector4:!0,set:function(t,e,r,n){return this.x=t,this.y=e,this.z=r,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*r+a[8]*n+a[12]*i,this.y=a[1]*e+a[5]*r+a[9]*n+a[13]*i,this.z=a[2]*e+a[6]*r+a[10]*n+a[14]*i,this.w=a[3]*e+a[7]*r+a[11]*n+a[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,r,n,i,a=t.elements,o=a[0],s=a[4],c=a[8],u=a[1],h=a[5],l=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-u)<.01&&Math.abs(c-d)<.01&&Math.abs(l-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(c+d)<.1&&Math.abs(l+p)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,v=(h+1)/2,g=(f+1)/2,y=(s+u)/4,x=(c+d)/4,b=(l+p)/4;return m>v&&m>g?m<.01?(r=0,n=.707106781,i=.707106781):(r=Math.sqrt(m),n=y/r,i=x/r):v>g?v<.01?(r=.707106781,n=0,i=.707106781):(n=Math.sqrt(v),r=y/n,i=b/n):g<.01?(r=.707106781,n=.707106781,i=0):(i=Math.sqrt(g),r=x/i,n=b/i),this.set(r,n,i,e),this}var _=Math.sqrt((p-l)*(p-l)+(c-d)*(c-d)+(u-s)*(u-s));return Math.abs(_)<.001&&(_=1),this.x=(p-l)/_,this.y=(c-d)/_,this.z=(u-s)/_,this.w=Math.acos((o+h+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t=new o,e=new o;return function(r,n){return t.set(r,r,r,r),e.set(n,n,n,n),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(s.prototype,n.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.isWebGLRenderTargetCube=!0,Object.assign(u,{slerp:function(t,e,r,n){return r.copy(t).slerp(e,n)},slerpFlat:function(t,e,r,n,i,a,o){var s=r[n+0],c=r[n+1],u=r[n+2],h=r[n+3],l=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(h!==f||s!==l||c!==d||u!==p){var m=1-o,v=s*l+c*d+u*p+h*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var _=o*g;if(s=s*m+l*_,c=c*m+d*_,u=u*m+p*_,h=h*m+f*_,m===1-o){var w=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=w,c*=w,u*=w,h*=w}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(u.prototype,{set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=t._x,n=t._y,i=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(r/2),u=o(n/2),h=o(i/2),l=s(r/2),d=s(n/2),p=s(i/2);return"XYZ"===a?(this._x=l*u*h+c*d*p,this._y=c*d*h-l*u*p,this._z=c*u*p+l*d*h,this._w=c*u*h-l*d*p):"YXZ"===a?(this._x=l*u*h+c*d*p,this._y=c*d*h-l*u*p,this._z=c*u*p-l*d*h,this._w=c*u*h+l*d*p):"ZXY"===a?(this._x=l*u*h-c*d*p,this._y=c*d*h+l*u*p,this._z=c*u*p+l*d*h,this._w=c*u*h-l*d*p):"ZYX"===a?(this._x=l*u*h-c*d*p,this._y=c*d*h+l*u*p,this._z=c*u*p-l*d*h,this._w=c*u*h+l*d*p):"YZX"===a?(this._x=l*u*h+c*d*p,this._y=c*d*h+l*u*p,this._z=c*u*p-l*d*h,this._w=c*u*h-l*d*p):"XZY"===a&&(this._x=l*u*h-c*d*p,this._y=c*d*h-l*u*p,this._z=c*u*p+l*d*h,this._w=c*u*h+l*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,r=t.elements,n=r[0],i=r[4],a=r[8],o=r[1],s=r[5],c=r[9],u=r[2],h=r[6],l=r[10],d=n+s+l;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(a-u)*e,this._z=(o-i)*e):n>s&&n>l?(e=2*Math.sqrt(1+n-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(i+o)/e,this._z=(a+u)/e):s>l?(e=2*Math.sqrt(1+s-n-l),this._w=(a-u)/e,this._x=(i+o)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-n-s),this._w=(o-i)/e,this._x=(a+u)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new h;return function(r,n){return void 0===e&&(e=new h),t=r.dot(n)+1,t<1e-6?(t=0,Math.abs(r.x)>Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var r=t._x,n=t._y,i=t._z,a=t._w,o=e._x,s=e._y,c=e._z,u=e._w;return this._x=r*u+a*o+n*c-i*s,this._y=n*u+a*s+i*o-r*c,this._z=i*u+a*c+r*s-n*o,this._w=a*u-r*o-n*s-i*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,a=this._w,o=a*t._w+r*t._x+n*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=r,this._y=n,this._z=i,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(i+this._z),this;var c=Math.atan2(s,o),u=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=a*u+this._w*h,this._x=r*u+this._x*h,this._y=n*u+this._y*h,this._z=i*u+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(h.prototype,{isVector3:!0,set:function(t,e,r){return this.x=t,this.y=e,this.z=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new u;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new u;return function(e,r){return this.applyQuaternion(t.setFromAxisAngle(e,r))}}(),applyMatrix3:function(t){var e=this.x,r=this.y,n=this.z,i=t.elements;return this.x=i[0]*e+i[3]*r+i[6]*n,this.y=i[1]*e+i[4]*r+i[7]*n,this.z=i[2]*e+i[5]*r+i[8]*n,this},applyMatrix4:function(t){var e=this.x,r=this.y,n=this.z,i=t.elements;this.x=i[0]*e+i[4]*r+i[8]*n+i[12],this.y=i[1]*e+i[5]*r+i[9]*n+i[13],this.z=i[2]*e+i[6]*r+i[10]*n+i[14];var a=i[3]*e+i[7]*r+i[11]*n+i[15];return this.divideScalar(a)},applyQuaternion:function(t){var e=this.x,r=this.y,n=this.z,i=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*r,u=s*r+o*e-i*n,h=s*n+i*r-a*e,l=-i*e-a*r-o*n;return this.x=c*s+l*-i+u*-o-h*-a,this.y=u*s+l*-a+h*-i-c*-o,this.z=h*s+l*-o+c*-a-u*-i,this},project:function(){var t=new l;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new l;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,r=this.y,n=this.z,i=t.elements;return this.x=i[0]*e+i[4]*r+i[8]*n,this.y=i[1]*e+i[5]*r+i[9]*n,this.z=i[2]*e+i[6]*r+i[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new h,e=new h;return function(r,n){return t.set(r,r,r),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var r=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,r))/r)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,r){return this.subVectors(e,t).multiplyScalar(r).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var r=this.x,n=this.y,i=this.z;return this.x=n*t.z-i*t.y,this.y=i*t.x-r*t.z,this.z=r*t.y-n*t.x,this},crossVectors:function(t,e){var r=t.x,n=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-i*o,this.y=i*a-r*s,this.z=r*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new h;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new h;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ms.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return e*e+r*r+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=r,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(l.prototype,{isMatrix4:!0,set:function(t,e,r,n,i,a,o,s,c,u,h,l,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=n,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=u,v[10]=h,v[14]=l,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new l).fromArray(this.elements)},copy:function(t){var e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],this},copyPosition:function(t){var e=this.elements,r=t.elements;return e[12]=r[12],e[13]=r[13],e[14]=r[14],this},extractBasis:function(t,e,r){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,r){return this.set(t.x,e.x,r.x,0,t.y,e.y,r.y,0,t.z,e.z,r.z,0,0,0,0,1),this},extractRotation:function(){var t=new h;return function(e){var r=this.elements,n=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),a=1/t.setFromMatrixColumn(e,1).length(),o=1/t.setFromMatrixColumn(e,2).length();return r[0]=n[0]*i,r[1]=n[1]*i,r[2]=n[2]*i,r[4]=n[4]*a,r[5]=n[5]*a,r[6]=n[6]*a,r[8]=n[8]*o,r[9]=n[9]*o,r[10]=n[10]*o,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,r=t.x,n=t.y,i=t.z,a=Math.cos(r),o=Math.sin(r),s=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){var l=a*u,d=a*h,p=o*u,f=o*h;e[0]=s*u,e[4]=-s*h,e[8]=c,e[1]=d+p*c,e[5]=l-f*c,e[9]=-o*s,e[2]=f-l*c,e[6]=p+d*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*u,v=s*h,g=c*u,y=c*h;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*h,e[5]=a*u,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*u,v=s*h,g=c*u,y=c*h;e[0]=m-y*o,e[4]=-a*h,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*u,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var l=a*u,d=a*h,p=o*u,f=o*h;e[0]=s*u,e[4]=p*c-d,e[8]=l*c+f,e[1]=s*h,e[5]=f*c+l,e[9]=d*c-p,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*u,e[4]=w-x*h,e[8]=_*h+b,e[1]=h,e[5]=a*u,e[9]=-o*u,e[2]=-c*u,e[6]=b*h+_,e[10]=x-w*h}else if("XZY"===t.order){var x=a*s,b=a*c,_=o*s,w=o*c;e[0]=s*u,e[4]=-h,e[8]=c*u,e[1]=x*h+w,e[5]=a*u,e[9]=b*h-_,e[2]=_*h-b,e[6]=o*u,e[10]=w*h+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,r=t._x,n=t._y,i=t._z,a=t._w,o=r+r,s=n+n,c=i+i,u=r*o,h=r*s,l=r*c,d=n*s,p=n*c,f=i*c,m=a*o,v=a*s,g=a*c;return e[0]=1-(d+f),e[4]=h-g,e[8]=l+v,e[1]=h+g,e[5]=1-(u+f),e[9]=p-m,e[2]=l-v,e[6]=p+m,e[10]=1-(u+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new h,e=new h,r=new h;return function(n,i,a){var o=this.elements;return r.subVectors(n,i),0===r.lengthSq()&&(r.z=1),r.normalize(),t.crossVectors(a,r),0===t.lengthSq()&&(r.z+=1e-4,t.crossVectors(a,r)),t.normalize(),e.crossVectors(r,t),o[0]=t.x,o[4]=e.x,o[8]=r.x,o[1]=t.y,o[5]=e.y,o[9]=r.y,o[2]=t.z,o[6]=e.z,o[10]=r.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,a=r[0],o=r[4],s=r[8],c=r[12],u=r[1],h=r[5],l=r[9],d=r[13],p=r[2],f=r[6],m=r[10],v=r[14],g=r[3],y=r[7],x=r[11],b=r[15],_=n[0],w=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],L=n[13],R=n[2],P=n[6],C=n[10],I=n[14],U=n[3],N=n[7],O=n[11],B=n[15];return i[0]=a*_+o*T+s*R+c*U,i[4]=a*w+o*S+s*P+c*N,i[8]=a*M+o*A+s*C+c*O,i[12]=a*E+o*L+s*I+c*B,i[1]=u*_+h*T+l*R+d*U,i[5]=u*w+h*S+l*P+d*N,i[9]=u*M+h*A+l*C+d*O,i[13]=u*E+h*L+l*I+d*B,i[2]=p*_+f*T+m*R+v*U,i[6]=p*w+f*S+m*P+v*N,i[10]=p*M+f*A+m*C+v*O,i[14]=p*E+f*L+m*I+v*B,i[3]=g*_+y*T+x*R+b*U,i[7]=g*w+y*S+x*P+b*N,i[11]=g*M+y*A+x*C+b*O,i[15]=g*E+y*L+x*I+b*B,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new h;return function(e){for(var r=0,n=e.count;r<n;r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix4(this),e.setXYZ(r,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],r=t[4],n=t[8],i=t[12],a=t[1],o=t[5],s=t[9],c=t[13],u=t[2],h=t[6],l=t[10],d=t[14];return t[3]*(+i*s*h-n*c*h-i*o*l+r*c*l+n*o*d-r*s*d)+t[7]*(+e*s*d-e*c*l+i*a*l-n*a*d+n*c*u-i*s*u)+t[11]*(+e*c*h-e*o*d-i*a*h+r*a*d+i*o*u-r*c*u)+t[15]*(-n*o*u-e*s*h+e*o*l+n*a*h-r*a*l+r*s*u)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var r=this.elements,n=t.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],u=n[5],h=n[6],l=n[7],d=n[8],p=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],b=p*y*l-g*f*l+g*h*m-u*y*m-p*h*x+u*f*x,_=v*f*l-d*y*l-v*h*m+c*y*m+d*h*x-c*f*x,w=d*g*l-v*p*l+v*u*m-c*g*m-d*u*x+c*p*x,M=v*p*h-d*g*h-v*u*f+c*g*f+d*u*y-c*p*y,E=i*b+a*_+o*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return r[0]=b*S,r[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*x-a*f*x)*S,r[2]=(u*y*s-g*h*s+g*o*l-a*y*l-u*o*x+a*h*x)*S,r[3]=(p*h*s-u*f*s-p*o*l+a*f*l+u*o*m-a*h*m)*S,r[4]=_*S,r[5]=(d*y*s-v*f*s+v*o*m-i*y*m-d*o*x+i*f*x)*S,r[6]=(v*h*s-c*y*s-v*o*l+i*y*l+c*o*x-i*h*x)*S,r[7]=(c*f*s-d*h*s+d*o*l-i*f*l-c*o*m+i*h*m)*S,r[8]=w*S,r[9]=(v*p*s-d*g*s-v*a*m+i*g*m+d*a*x-i*p*x)*S,r[10]=(c*g*s-v*u*s+v*a*l-i*g*l-c*a*x+i*u*x)*S,r[11]=(d*u*s-c*p*s-d*a*l+i*p*l+c*a*m-i*u*m)*S,r[12]=M*S,r[13]=(d*g*o-v*p*o+v*a*f-i*g*f-d*a*y+i*p*y)*S,r[14]=(v*u*o-c*g*o-v*a*h+i*g*h+c*a*y-i*u*y)*S,r[15]=(c*p*o-d*u*o+d*a*h-i*p*h-c*a*f+i*u*f)*S,this},scale:function(t){var e=this.elements,r=t.x,n=t.y,i=t.z;return e[0]*=r,e[4]*=n,e[8]*=i,e[1]*=r,e[5]*=n,e[9]*=i,e[2]*=r,e[6]*=n,e[10]*=i,e[3]*=r,e[7]*=n,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],r=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,r,n))},makeTranslation:function(t,e,r){return this.set(1,0,0,t,0,1,0,e,0,0,1,r,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,-r,0,0,r,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,r,0,0,1,0,0,-r,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,0,r,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var r=Math.cos(e),n=Math.sin(e),i=1-r,a=t.x,o=t.y,s=t.z,c=i*a,u=i*o;return this.set(c*a+r,c*o-n*s,c*s+n*o,0,c*o+n*s,u*o+r,u*s-n*a,0,c*s-n*o,u*s+n*a,i*s*s+r,0,0,0,0,1),this},makeScale:function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(t,e,r){return this.set(1,e,r,0,t,1,r,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,r){return this.makeRotationFromQuaternion(e),this.scale(r),this.setPosition(t),this},decompose:function(){var t=new h,e=new l;return function(r,n,i){var a=this.elements,o=t.set(a[0],a[1],a[2]).length(),s=t.set(a[4],a[5],a[6]).length(),c=t.set(a[8],a[9],a[10]).length();this.determinant()<0&&(o=-o),r.x=a[12],r.y=a[13],r.z=a[14],e.copy(this);var u=1/o,h=1/s,l=1/c;return e.elements[0]*=u,e.elements[1]*=u,e.elements[2]*=u,e.elements[4]*=h,e.elements[5]*=h,e.elements[6]*=h,e.elements[8]*=l,e.elements[9]*=l,e.elements[10]*=l,n.setFromRotationMatrix(e),i.x=o,i.y=s,i.z=c,this}}(),makePerspective:function(t,e,r,n,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(e-t),c=2*i/(r-n),u=(e+t)/(e-t),h=(r+n)/(r-n),l=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=l,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,r,n,i,a){var o=this.elements,s=1/(e-t),c=1/(r-n),u=1/(a-i),h=(e+t)*s,l=(r+n)*c,d=(a+i)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-l,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,r=t.elements,n=0;n<16;n++)if(e[n]!==r[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15],t}}),d.prototype=Object.create(a.prototype),d.prototype.constructor=d,d.prototype.isDataTexture=!0,p.prototype=Object.create(a.prototype),p.prototype.constructor=p,p.prototype.isCubeTexture=!0,Object.defineProperty(p.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Ts=new a,Ss=new p,As=[],Ls=[],Rs=new Float32Array(16),Ps=new Float32Array(9);j.prototype.setValue=function(t,e){for(var r=this.seq,n=0,i=r.length;n!==i;++n){var a=r[n];a.setValue(t,e[a.id])}};var Cs=/([\w\d_]+)(\])?(\[|\.)?/g;q.prototype.setValue=function(t,e,r){var n=this.map[e];void 0!==n&&n.setValue(t,r,this.renderer)},q.prototype.setOptional=function(t,e,r){var n=e[r];void 0!==n&&this.setValue(t,r,n)},q.upload=function(t,e,r,n){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=r[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},q.seqWithValue=function(t,e){for(var r=[],n=0,i=t.length;n!==i;++n){var a=t[n];a.id in e&&r.push(a)}return r};var Is={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(Y.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,r){return this.r=t,this.g=e,this.b=r,this},setHSL:function(){function t(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+6*(e-t)*(2/3-r):t}return function(e,r,n){if(e=Ms.euclideanModulo(e,1),r=Ms.clamp(r,0,1),n=Ms.clamp(n,0,1),0===r)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+r):n+r-n*r,a=2*n-i;this.r=t(a,i,e+1/3),this.g=t(a,i,e),this.b=t(a,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,i=r[1],a=r[2];switch(i){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(o,s,c)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=r[1],h=u.length;if(3===h)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=Is[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var r=e>0?1/e:1;return this.r=Math.pow(t.r,r),this.g=Math.pow(t.g,r),this.b=Math.pow(t.b,r),this},convertGammaToLinear:function(){var t=this.r,e=this.g,r=this.b;return this.r=t*t,this.g=e*e,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,r,n=t||{h:0,s:0,l:0},i=this.r,a=this.g,o=this.b,s=Math.max(i,a,o),c=Math.min(i,a,o),u=(c+s)/2;if(c===s)e=0,r=0;else{var h=s-c;switch(r=u<=.5?h/(s+c):h/(2-s-c),s){case i:e=(a-o)/h+(a<o?6:0);break;case a:e=(o-i)/h+2;break;case o:e=(i-a)/h+4}e/=6}return n.h=e,n.s=r,n.l=u,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,r){var n=this.getHSL();return n.h+=t,n.s+=e,n.l+=r,this.setHSL(n.h,n.s,n.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Us={common:{diffuse:{value:new Y(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new o(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new i(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Y(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Y(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new o(0,0,1,1)}}},Ns={merge:function(t){for(var e={},r=0;r<t.length;r++){var n=this.clone(t[r]);for(var i in n)e[i]=n[i]}return e},clone:function(t){var e={};for(var r in t){e[r]={};for(var n in t[r]){var i=t[r][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[r][n]=i.clone():Array.isArray(i)?e[r][n]=i.slice():e[r][n]=i}}return e}},Os={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\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\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},Bs={basic:{uniforms:Ns.merge([Us.common,Us.aomap,Us.lightmap,Us.fog]),vertexShader:Os.meshbasic_vert,fragmentShader:Os.meshbasic_frag},lambert:{uniforms:Ns.merge([Us.common,Us.aomap,Us.lightmap,Us.emissivemap,Us.fog,Us.lights,{emissive:{value:new Y(0)}}]),vertexShader:Os.meshlambert_vert,fragmentShader:Os.meshlambert_frag},phong:{uniforms:Ns.merge([Us.common,Us.aomap,Us.lightmap,Us.emissivemap,Us.bumpmap,Us.normalmap,Us.displacementmap,Us.gradientmap,Us.fog,Us.lights,{emissive:{value:new Y(0)},specular:{value:new Y(1118481)},shininess:{value:30}}]),vertexShader:Os.meshphong_vert,fragmentShader:Os.meshphong_frag},standard:{uniforms:Ns.merge([Us.common,Us.aomap,Us.lightmap,Us.emissivemap,Us.bumpmap,Us.normalmap,Us.displacementmap,Us.roughnessmap,Us.metalnessmap,Us.fog,Us.lights,{emissive:{value:new Y(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Os.meshphysical_vert,fragmentShader:Os.meshphysical_frag},points:{uniforms:Ns.merge([Us.points,Us.fog]),vertexShader:Os.points_vert,fragmentShader:Os.points_frag},dashed:{uniforms:Ns.merge([Us.common,Us.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Os.linedashed_vert,fragmentShader:Os.linedashed_frag},depth:{uniforms:Ns.merge([Us.common,Us.displacementmap]),vertexShader:Os.depth_vert,fragmentShader:Os.depth_frag},normal:{uniforms:Ns.merge([Us.common,Us.bumpmap,Us.normalmap,Us.displacementmap,{opacity:{value:1}}]),vertexShader:Os.normal_vert,fragmentShader:Os.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Os.cube_vert,fragmentShader:Os.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Os.equirect_vert,fragmentShader:Os.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new h}},vertexShader:Os.distanceRGBA_vert,fragmentShader:Os.distanceRGBA_frag}};Bs.physical={uniforms:Ns.merge([Bs.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Os.meshphysical_vert,fragmentShader:Os.meshphysical_frag},Object.assign(Z.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new i;return function(e,r){var n=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Ds=0;Object.assign(K.prototype,n.prototype,{isMaterial:!0,setValues:function(t){if(void 0!==t)for(var e in t){var r=t[e];if(void 0!==r){var n=this[e];void 0!==n?n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[e]="overdraw"===e?Number(r):r:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var r in t){var n=t[r];delete n.metadata,e.push(n)}return e}var r=void 0===t;r&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ta&&(n.blending=this.blending),this.shading!==ba&&(n.shading=this.shading),this.side!==va&&(n.side=this.side),this.vertexColors!==_a&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),n.skinning=this.skinning,n.morphTargets=this.morphTargets,n.dithering=this.dithering,r){var i=e(t.textures),a=e(t.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,r=null;if(null!==e){var n=e.length;r=new Array(n);for(var i=0;i!==n;++i)r[i]=e[i].clone()}return this.clippingPlanes=r,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$.prototype=Object.create(K.prototype),$.prototype.constructor=$,$.prototype.isShaderMaterial=!0,$.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ns.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},$.prototype.toJSON=function(t){var e=K.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create(K.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(et.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var u=t[s],h=t[s+1],l=t[s+2];u<e&&(e=u),h<r&&(r=h),l<n&&(n=l),u>i&&(i=u),h>a&&(a=h),l>o&&(o=l)}return this.min.set(e,r,n),this.max.set(i,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var u=t.getX(s),h=t.getY(s),l=t.getZ(s);u<e&&(e=u),h<r&&(r=h),l<n&&(n=l),u>i&&(i=u),h>a&&(a=h),l>o&&(o=l)}return this.min.set(e,r,n),this.max.set(i,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new h;return function(e,r){var n=t.copy(r).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new h;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new h;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new h;return function(e){var r=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var n,i,a=e.geometry;if(void 0!==a)if(a.isGeometry){var o=a.vertices;for(n=0,i=o.length;n<i;n++)t.copy(o[n]),t.applyMatrix4(e.matrixWorld),r.expandByPoint(t)}else if(a.isBufferGeometry){var s=a.attributes.position;if(void 0!==s)for(n=0,i=s.count;n<i;n++)t.fromBufferAttribute(s,n).applyMatrix4(e.matrixWorld),r.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new h).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new h;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,r;return t.normal.x>0?(e=t.normal.x*this.min.x,r=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,r=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,r+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,r+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,r+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,r+=t.normal.z*this.min.z),e<=t.constant&&r>=t.constant},clampPoint:function(t,e){return(e||new h).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new h;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new h;return function(e){var r=e||new rt;return this.getCenter(r.center),r.radius=.5*this.getSize(t).length(),r}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new h,new h,new h,new h,new h,new h,new h,new h];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(rt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new et;return function(e,r){var n=this.center;void 0!==r?n.copy(r):t.setFromPoints(e).getCenter(n);for(var i=0,a=0,o=e.length;a<o;a++)i=Math.max(i,n.distanceToSquared(e[a]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var r=this.center.distanceToSquared(t),n=e||new h;return n.copy(t),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(nt.prototype,{isMatrix3:!0,set:function(t,e,r,n,i,a,o,s,c){var u=this.elements;return u[0]=t,u[1]=n,u[2]=o,u[3]=e,u[4]=i,u[5]=s,u[6]=r,u[7]=a,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new h;return function(e){for(var r=0,n=e.count;r<n;r++)t.x=e.getX(r),t.y=e.getY(r),t.z=e.getZ(r),t.applyMatrix3(this),e.setXYZ(r,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var r=t.elements,n=e.elements,i=this.elements,a=r[0],o=r[3],s=r[6],c=r[1],u=r[4],h=r[7],l=r[2],d=r[5],p=r[8],f=n[0],m=n[3],v=n[6],g=n[1],y=n[4],x=n[7],b=n[2],_=n[5],w=n[8];return i[0]=a*f+o*g+s*b,i[3]=a*m+o*y+s*_,i[6]=a*v+o*x+s*w,i[1]=c*f+u*g+h*b,i[4]=c*m+u*y+h*_,i[7]=c*v+u*x+h*w,i[2]=l*f+d*g+p*b,i[5]=l*m+d*y+p*_,i[8]=l*v+d*x+p*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],u=t[8];return e*a*u-e*o*c-r*i*u+r*o*s+n*i*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var r=t.elements,n=this.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],u=r[5],h=r[6],l=r[7],d=r[8],p=d*c-u*l,f=u*h-d*s,m=l*s-c*h,v=i*p+a*f+o*m;if(0===v){var g="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return n[0]=p*y,n[1]=(o*l-d*a)*y,n[2]=(u*a-o*c)*y,n[3]=f*y,n[4]=(d*i-o*h)*y,n[5]=(o*s-u*i)*y,n[6]=m*y,n[7]=(a*h-l*i)*y,n[8]=(c*i-a*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,r=t.elements,n=0;n<9;n++)if(e[n]!==r[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[r+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var r=this.elements;return t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t}}),Object.assign(it.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,r,n){return this.normal.set(t,e,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new h,e=new h;return function(r,n,i){var a=t.subVectors(i,n).cross(e.subVectors(r,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var r=this.distanceToPoint(t);return(e||new h).copy(this.normal).multiplyScalar(r)},intersectLine:function(){var t=new h;return function(e,r){var n=r||new h,i=e.delta(t),a=this.normal.dot(i);if(0!==a){var o=-(e.start.dot(this.normal)+this.constant)/a;if(!(o<0||o>1))return n.copy(i).multiplyScalar(o).add(e.start)}else if(0===this.distanceToPoint(e.start))return n.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),r=this.distanceToPoint(t.end);return e<0&&r>0||r<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new h).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new h,e=new nt;return function(r,n){var i=this.coplanarPoint(t).applyMatrix4(r),a=n||e.getNormalMatrix(r),o=this.normal.applyMatrix3(a).normalize();return this.constant=-i.dot(o),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(at.prototype,{set:function(t,e,r,n,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(r),o[3].copy(n),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,r=0;r<6;r++)e[r].copy(t.planes[r]);return this},setFromMatrix:function(t){var e=this.planes,r=t.elements,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],u=r[6],h=r[7],l=r[8],d=r[9],p=r[10],f=r[11],m=r[12],v=r[13],g=r[14],y=r[15];return e[0].setComponents(o-n,h-s,f-l,y-m).normalize(),e[1].setComponents(o+n,h+s,f+l,y+m).normalize(),e[2].setComponents(o+i,h+c,f+d,y+v).normalize(),e[3].setComponents(o-i,h-c,f-d,y-v).normalize(),e[4].setComponents(o-a,h-u,f-p,y-g).normalize(),e[5].setComponents(o+a,h+u,f+p,y+g).normalize(),this},intersectsObject:function(){var t=new rt;return function(e){var r=e.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),t.copy(r.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new rt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,r=t.center,n=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(r)<n)return!1}return!0},intersectsBox:function(){var t=new h,e=new h;return function(r){for(var n=this.planes,i=0;i<6;i++){var a=n[i];t.x=a.normal.x>0?r.min.x:r.max.x,e.x=a.normal.x>0?r.max.x:r.min.x,t.y=a.normal.y>0?r.min.y:r.max.y,e.y=a.normal.y>0?r.max.y:r.min.y,t.z=a.normal.z>0?r.min.z:r.max.z,e.z=a.normal.z>0?r.max.z:r.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,r=0;r<6;r++)if(e[r].distanceToPoint(t)<0)return!1;return!0}}),Object.assign(st.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new h).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new h;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var r=e||new h;r.subVectors(t,this.origin);var n=r.dot(this.direction);return n<0?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new h;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);return r<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(r).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new h,e=new h,r=new h;return function(n,i,a,o){t.copy(n).add(i).multiplyScalar(.5),e.copy(i).sub(n).normalize(),r.copy(this.origin).sub(t);var s,c,u,h,l=.5*n.distanceTo(i),d=-this.direction.dot(e),p=r.dot(this.direction),f=-r.dot(e),m=r.lengthSq(),v=Math.abs(1-d*d);if(v>0)if(s=d*f-p,c=d*p-f,h=l*v,s>=0)if(c>=-h)if(c<=h){var g=1/v;s*=g,c*=g,u=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=l,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;else c=-l,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;else c<=-h?(s=Math.max(0,-(-d*l+p)),c=s>0?-l:Math.min(Math.max(-l,-f),l),u=-s*s+c*(c+2*f)+m):c<=h?(s=0,c=Math.min(Math.max(-l,-f),l),u=c*(c+2*f)+m):(s=Math.max(0,-(d*l+p)),c=s>0?l:Math.min(Math.max(-l,-f),l),u=-s*s+c*(c+2*f)+m);else c=d>0?-l:l,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new h;return function(e,r){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),i=t.dot(t)-n*n,a=e.radius*e.radius;if(i>a)return null;var o=Math.sqrt(a-i),s=n-o,c=n+o;return s<0&&c<0?null:s<0?this.at(c,r):this.at(s,r)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(t.normal)+t.constant)/e;return r>=0?r:null},intersectPlane:function(t,e){var r=this.distanceToPlane(t);return null===r?null:this.at(r,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var r,n,i,a,o,s,c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,l=this.origin;return c>=0?(r=(t.min.x-l.x)*c,n=(t.max.x-l.x)*c):(r=(t.max.x-l.x)*c,n=(t.min.x-l.x)*c),u>=0?(i=(t.min.y-l.y)*u,a=(t.max.y-l.y)*u):(i=(t.max.y-l.y)*u,a=(t.min.y-l.y)*u),r>a||i>n?null:((i>r||r!==r)&&(r=i),(a<n||n!==n)&&(n=a),h>=0?(o=(t.min.z-l.z)*h,s=(t.max.z-l.z)*h):(o=(t.max.z-l.z)*h,s=(t.min.z-l.z)*h),r>s||o>n?null:((o>r||r!==r)&&(r=o),(s<n||n!==n)&&(n=s),n<0?null:this.at(r>=0?r:n,e)))},intersectsBox:function(){var t=new h;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new h,e=new h,r=new h,n=new h;return function(i,a,o,s,c){e.subVectors(a,i),r.subVectors(o,i),n.crossVectors(e,r);var u,h=this.direction.dot(n);if(h>0){if(s)return null;u=1}else{if(!(h<0))return null;u=-1,h=-h}t.subVectors(this.origin,i);var l=u*this.direction.dot(r.crossVectors(t,r));if(l<0)return null;var d=u*this.direction.dot(e.cross(t));if(d<0)return null;if(l+d>h)return null;var p=-u*t.dot(n);return p<0?null:this.at(p/h,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),ct.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ct.DefaultOrder="XYZ",Object.defineProperties(ct.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ct.prototype,{isEuler:!0,set:function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,r){var n=Ms.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],c=i[1],u=i[5],h=i[9],l=i[2],d=i[6],p=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-l,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,u))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,u),this._y=Math.atan2(-l,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,u),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==r&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new l;return function(e,r,n){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,r,n)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new u;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new h(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(ut.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Fs=0;ht.DefaultUp=new h(0,1,0),ht.DefaultMatrixAutoUpdate=!0,Object.assign(ht.prototype,n.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new u;return function(e,r){return t.setFromAxisAngle(e,r),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new h(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new h(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new h(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new h;return function(e,r){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(r)),this}}(),translateX:function(){var t=new h(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new h(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new h(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new l;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new l;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var r=this.children.indexOf(t);-1!==r&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r],a=i.getObjectByProperty(t,e);if(void 0!==a)return a}},getWorldPosition:function(t){var e=t||new h;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new h,e=new h;return function(r){var n=r||new u;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,n,e),n}}(),getWorldRotation:function(){var t=new u;return function(e){var r=e||new ct;return this.getWorldQuaternion(t),r.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new h,e=new u;return function(r){var n=r||new h;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,n),n}}(),getWorldDirection:function(){var t=new u;return function(e){var r=e||new h;return this.getWorldQuaternion(t),r.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,r=0,n=e.length;r<n;r++)e[r].updateMatrixWorld(t)},toJSON:function(t){function e(e,r){return void 0===e[r.uuid]&&(e[r.uuid]=r.toJSON(t)),r.uuid}function r(t){var e=[];for(var r in t){var n=t[r];delete n.metadata,e.push(n)}return e}var n=void 0===t||""===t,i={};n&&(t={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var a={};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),a.matrix=this.matrix.toArray(),void 0!==this.geometry&&(a.geometry=e(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var o=[],s=0,c=this.material.length;s<c;s++)o.push(e(t.materials,this.material[s]));a.material=o}else a.material=e(t.materials,this.material);if(this.children.length>0){a.children=[];for(var s=0;s<this.children.length;s++)a.children.push(this.children[s].toJSON(t).object)}if(n){var u=r(t.geometries),h=r(t.materials),l=r(t.textures),d=r(t.images);u.length>0&&(i.geometries=u),h.length>0&&(i.materials=h),l.length>0&&(i.textures=l),d.length>0&&(i.images=d)}return i.object=a,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var r=0;r<t.children.length;r++){var n=t.children[r];this.add(n.clone())}return this}}),Object.assign(lt.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new h).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new h).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var r=e||new h;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new h,e=new h;return function(r,n){t.subVectors(r,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),a=e.dot(t),o=a/i;return n&&(o=Ms.clamp(o,0,1)),o}}(),closestPointToPoint:function(t,e,r){var n=this.closestPointToPointParameter(t,e),i=r||new h;return this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(dt,{normal:function(){var t=new h;return function(e,r,n,i){var a=i||new h;a.subVectors(n,r),t.subVectors(e,r),a.cross(t);var o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new h,e=new h,r=new h;return function(n,i,a,o,s){t.subVectors(o,i),e.subVectors(a,i),r.subVectors(n,i);var c=t.dot(t),u=t.dot(e),l=t.dot(r),d=e.dot(e),p=e.dot(r),f=c*d-u*u,m=s||new h;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(d*l-u*p)*v,y=(c*p-u*l)*v;return m.set(1-g-y,y,g)}}(),containsPoint:function(){var t=new h;return function(e,r,n,i){var a=dt.barycoordFromPoint(e,r,n,i,t);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}()}),Object.assign(dt.prototype,{set:function(t,e,r){return this.a.copy(t),this.b.copy(e),this.c.copy(r),this},setFromPointsAndIndices:function(t,e,r,n){return this.a.copy(t[e]),this.b.copy(t[r]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new h,e=new h;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new h).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return dt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new it).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return dt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return dt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new it,e=[new lt,new lt,new lt],r=new h,n=new h;return function(i,a){var o=a||new h,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,r),!0===this.containsPoint(r))o.copy(r);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c<e.length;c++){e[c].closestPointToPoint(r,!0,n);var u=r.distanceToSquared(n);u<s&&(s=u,o.copy(n))}}return o}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Object.assign(pt.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,r=t.vertexNormals.length;e<r;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,r=t.vertexColors.length;e<r;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}),ft.prototype=Object.create(K.prototype),ft.prototype.constructor=ft,ft.prototype.isMeshBasicMaterial=!0,ft.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(mt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(mt.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.itemSize,r*=e.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[t+n]=e.array[r+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new Y),e[r++]=a.r,e[r++]=a.g,e[r++]=a.b}return this},copyIndicesArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];e[r++]=a.a,e[r++]=a.b,e[r++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,r=0,n=0,a=t.length;n<a;n++){var o=t[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),o=new i),e[r++]=o.x,e[r++]=o.y}return this},copyVector3sArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new h),e[r++]=a.x,e[r++]=a.y,e[r++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,r=0,n=0,i=t.length;n<i;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new o),e[r++]=a.x,e[r++]=a.y,e[r++]=a.z,e[r++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this},setXYZ:function(t,e,r,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=n,this},setXYZW:function(t,e,r,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=r,this.array[t+2]=n,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),vt.prototype=Object.create(mt.prototype),vt.prototype.constructor=vt,gt.prototype=Object.create(mt.prototype),gt.prototype.constructor=gt,yt.prototype=Object.create(mt.prototype),yt.prototype.constructor=yt,xt.prototype=Object.create(mt.prototype),xt.prototype.constructor=xt,bt.prototype=Object.create(mt.prototype),bt.prototype.constructor=bt,_t.prototype=Object.create(mt.prototype),_t.prototype.constructor=_t,wt.prototype=Object.create(mt.prototype),wt.prototype.constructor=wt,Mt.prototype=Object.create(mt.prototype),Mt.prototype.constructor=Mt,Et.prototype=Object.create(mt.prototype),Et.prototype.constructor=Et,Object.assign(Tt.prototype,{computeGroups:function(t){for(var e,r=[],n=void 0,i=t.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,r.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,r.push(e)),this.groups=r},fromGeometry:function(t){var e,r=t.faces,n=t.vertices,a=t.faceVertexUvs,o=a[0]&&a[0].length>0,s=a[1]&&a[1].length>0,c=t.morphTargets,u=c.length;if(u>0){e=[];for(var h=0;h<u;h++)e[h]=[];this.morphTargets.position=e}var l,d=t.morphNormals,p=d.length;if(p>0){l=[];for(var h=0;h<p;h++)l[h]=[];this.morphTargets.normal=l}for(var f=t.skinIndices,m=t.skinWeights,v=f.length===n.length,g=m.length===n.length,h=0;h<r.length;h++){var y=r[h];this.vertices.push(n[y.a],n[y.b],n[y.c]);var x=y.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var b=y.normal;this.normals.push(b,b,b)}var _=y.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var w=y.color;this.colors.push(w,w,w)}if(!0===o){var M=a[0][h];void 0!==M?this.uvs.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new i,new i,new i))}if(!0===s){var M=a[1][h];void 0!==M?this.uvs2.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new i,new i,new i))}for(var E=0;E<u;E++){var T=c[E].vertices;e[E].push(T[y.a],T[y.b],T[y.c])}for(var E=0;E<p;E++){var S=d[E].vertexNormals[h];l[E].push(S.a,S.b,S.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var zs=0;Object.assign(Lt.prototype,n.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new nt).getNormalMatrix(t),r=0,n=this.vertices.length;r<n;r++){this.vertices[r].applyMatrix4(t)}for(var r=0,n=this.faces.length;r<n;r++){var i=this.faces[r];i.normal.applyMatrix3(e).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new l;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new l;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new l;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new l;return function(e,r,n){return t.makeTranslation(e,r,n),this.applyMatrix(t),this}}(),scale:function(){var t=new l;return function(e,r,n){return t.makeScale(e,r,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ht;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,n,i){var a=void 0!==s?[d[t].clone(),d[e].clone(),d[n].clone()]:[],o=void 0!==c?[r.colors[t].clone(),r.colors[e].clone(),r.colors[n].clone()]:[],h=new pt(t,e,n,a,o,i);r.faces.push(h),void 0!==u&&r.faceVertexUvs[0].push([p[t].clone(),p[e].clone(),p[n].clone()]),void 0!==l&&r.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[n].clone()])}var r=this,n=null!==t.index?t.index.array:void 0,a=t.attributes,o=a.position.array,s=void 0!==a.normal?a.normal.array:void 0,c=void 0!==a.color?a.color.array:void 0,u=void 0!==a.uv?a.uv.array:void 0,l=void 0!==a.uv2?a.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var d=[],p=[],f=[],m=0,v=0;m<o.length;m+=3,v+=2)r.vertices.push(new h(o[m],o[m+1],o[m+2])),void 0!==s&&d.push(new h(s[m],s[m+1],s[m+2])),void 0!==c&&r.colors.push(new Y(c[m],c[m+1],c[m+2])),void 0!==u&&p.push(new i(u[v],u[v+1])),void 0!==l&&f.push(new i(l[v],l[v+1]));var g=t.groups;if(g.length>0)for(var m=0;m<g.length;m++)for(var y=g[m],x=y.start,b=y.count,v=x,_=x+b;v<_;v+=3)void 0!==n?e(n[v],n[v+1],n[v+2],y.materialIndex):e(v,v+1,v+2,y.materialIndex);else if(void 0!==n)for(var m=0;m<n.length;m+=3)e(n[m],n[m+1],n[m+2]);else for(var m=0;m<o.length/3;m+=3)e(m,m+1,m+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,r=0===e?1:1/e,n=new l;return n.set(r,0,0,-r*t.x,0,r,0,-r*t.y,0,0,r,-r*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new h,e=new h,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,r,n,i,a,o;for(o=new Array(this.vertices.length),e=0,r=this.vertices.length;e<r;e++)o[e]=new h;if(t){var s,c,u,l=new h,d=new h;for(n=0,i=this.faces.length;n<i;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c],l.subVectors(u,c),d.subVectors(s,c),l.cross(d),o[a.a].add(l),o[a.b].add(l),o[a.c].add(l)}else for(this.computeFaceNormals(),n=0,i=this.faces.length;n<i;n++)a=this.faces[n],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,r=this.vertices.length;e<r;e++)o[e].normalize();for(n=0,i=this.faces.length;n<i;n++){a=this.faces[n];var p=a.vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,r;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){r=this.faces[t];var n=r.vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,r,n,i;for(r=0,n=this.faces.length;r<n;r++)for(i=this.faces[r],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var a=new Lt;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o,s,c=this.morphNormals[t].faceNormals,u=this.morphNormals[t].vertexNormals;for(r=0,n=this.faces.length;r<n;r++)o=new h,s={a:new h,b:new h,c:new h},c.push(o),u.push(s)}var l=this.morphNormals[t];a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals();var o,s;for(r=0,n=this.faces.length;r<n;r++)i=this.faces[r],o=l.faceNormals[r],s=l.vertexNormals[r],o.copy(i.normal),s.a.copy(i.vertexNormals[0]),s.b.copy(i.vertexNormals[1]),s.c.copy(i.vertexNormals[2])}for(r=0,n=this.faces.length;r<n;r++)i=this.faces[r],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,r=0,n=e.length;r<n;r++)r>0&&(t+=e[r].distanceTo(e[r-1])),this.lineDistances[r]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new rt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,r){if(!1===(t&&t.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var n,i=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0],l=this.colors,d=t.colors;void 0===r&&(r=0),void 0!==e&&(n=(new nt).getNormalMatrix(e));for(var p=0,f=o.length;p<f;p++){var m=o[p],v=m.clone();void 0!==e&&v.applyMatrix4(e),a.push(v)}for(var p=0,f=d.length;p<f;p++)l.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var g,y,x,b=c[p],_=b.vertexNormals,w=b.vertexColors;g=new pt(b.a+i,b.b+i,b.c+i),g.normal.copy(b.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var M=0,E=_.length;M<E;M++)y=_[M].clone(),void 0!==n&&y.applyMatrix3(n).normalize(),g.vertexNormals.push(y);g.color.copy(b.color);for(var M=0,E=w.length;M<E;M++)x=w[M],g.vertexColors.push(x.clone());g.materialIndex=b.materialIndex+r,s.push(g)}for(p=0,f=h.length;p<f;p++){var T=h[p],S=[];if(void 0!==T){for(var M=0,E=T.length;M<E;M++)S.push(T[M].clone());u.push(S)}}},mergeMesh:function(t){if(!1===(t&&t.isMesh))return void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)},mergeVertices:function(){var t,e,r,n,i,a,o,s,c={},u=[],h=[],l=Math.pow(10,4);for(r=0,n=this.vertices.length;r<n;r++)t=this.vertices[r],e=Math.round(t.x*l)+"_"+Math.round(t.y*l)+"_"+Math.round(t.z*l),void 0===c[e]?(c[e]=r,u.push(this.vertices[r]),h[r]=u.length-1):h[r]=h[c[e]];var d=[];for(r=0,n=this.faces.length;r<n;r++){i=this.faces[r],i.a=h[i.a],i.b=h[i.b],i.c=h[i.c],a=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(r);break}}for(r=d.length-1;r>=0;r--){var f=d[r];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-u.length;return this.vertices=u,m},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,r=e.length,n=0;n<r;n++)e[n]._id=n;e.sort(t);var i,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===r&&(i=[]),s&&s.length===r&&(a=[]);for(var n=0;n<r;n++){var c=e[n]._id;i&&i.push(o[c]),a&&a.push(s[c])}i&&(this.faceVertexUvs[0]=i),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function t(t,e,r){return r?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==d[e]?d[e]:(d[e]=l.length/3,l.push(t.x,t.y,t.z),d[e])}function r(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==f[e]?f[e]:(f[e]=p.length,p.push(t.getHex()),f[e])}function n(t){var e=t.x.toString()+t.y.toString();return void 0!==v[e]?v[e]:(v[e]=m.length/2,m.push(t.x,t.y),v[e])}var i={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(i[o]=a[o]);return i}for(var s=[],c=0;c<this.vertices.length;c++){var u=this.vertices[c];s.push(u.x,u.y,u.z)}for(var h=[],l=[],d={},p=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=void 0!==this.faceVertexUvs[0][c],x=g.normal.length()>0,b=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,!0),M=t(M,2,!1),M=t(M,3,y),M=t(M,4,x),M=t(M,5,b),M=t(M,6,_),M=t(M,7,w),h.push(M),h.push(g.a,g.b,g.c),h.push(g.materialIndex),y){var E=this.faceVertexUvs[0][c];h.push(n(E[0]),n(E[1]),n(E[2]))}if(x&&h.push(e(g.normal)),b){var T=g.vertexNormals;h.push(e(T[0]),e(T[1]),e(T[2]))}if(_&&h.push(r(g.color)),w){var S=g.vertexColors;h.push(r(S[0]),r(S[1]),r(S[2]))}}return i.data={},i.data.vertices=s,i.data.normals=l,p.length>0&&(i.data.colors=p),m.length>0&&(i.data.uvs=[m]),i.data.faces=h,i},clone:function(){return(new Lt).copy(this)},copy:function(t){var e,r,n,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,r=s.length;e<r;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,r=c.length;e<r;e++)this.colors.push(c[e].clone());var u=t.faces;for(e=0,r=u.length;e<r;e++)this.faces.push(u[e].clone());for(e=0,r=t.faceVertexUvs.length;e<r;e++){var h=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),n=0,i=h.length;n<i;n++){var l=h[n],d=[];for(a=0,o=l.length;a<o;a++){var p=l[a];d.push(p.clone())}this.faceVertexUvs[e].push(d)}}var f=t.morphTargets;for(e=0,r=f.length;e<r;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],n=0,i=f[e].vertices.length;n<i;n++)m.vertices.push(f[e].vertices[n].clone());if(void 0!==f[e].normals)for(m.normals=[],n=0,i=f[e].normals.length;n<i;n++)m.normals.push(f[e].normals[n].clone());this.morphTargets.push(m)}var v=t.morphNormals;for(e=0,r=v.length;e<r;e++){var g={};if(void 0!==v[e].vertexNormals)for(g.vertexNormals=[],n=0,i=v[e].vertexNormals.length;n<i;n++){var y=v[e].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[e].faceNormals)for(g.faceNormals=[],n=0,i=v[e].faceNormals.length;n<i;n++)g.faceNormals.push(v[e].faceNormals[n].clone());this.morphNormals.push(g)}var b=t.skinWeights;for(e=0,r=b.length;e<r;e++)this.skinWeights.push(b[e].clone());var _=t.skinIndices;for(e=0,r=_.length;e<r;e++)this.skinIndices.push(_[e].clone());var w=t.lineDistances;for(e=0,r=w.length;e<r;e++)this.lineDistances.push(w[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Rt.MaxIndex=65535,Object.assign(Rt.prototype,n.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(St(t)>65535?wt:bt)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new mt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){(new nt).getNormalMatrix(t).applyToBufferAttribute(r),r.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new l;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new l;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new l;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new l;return function(e,r,n){return t.makeTranslation(e,r,n),this.applyMatrix(t),this}}(),scale:function(){var t=new l;return function(e,r,n){return t.makeScale(e,r,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ht;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var r=new Mt(3*e.vertices.length,3),n=new Mt(3*e.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new Mt(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var r=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(r=void 0,e.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(e);r.verticesNeedUpdate=e.verticesNeedUpdate,r.normalsNeedUpdate=e.normalsNeedUpdate,r.colorsNeedUpdate=e.colorsNeedUpdate,r.uvsNeedUpdate=e.uvsNeedUpdate,r.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=r}var n;return!0===e.verticesNeedUpdate&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Tt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new mt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var r=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(r,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=St(t.indices)>65535?Uint32Array:Uint16Array,s=new o(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],l=0,d=h.length;l<d;l++){var p=h[l],f=new Mt(3*p.length,3);u.push(f.copyVector3sArray(p))}this.morphAttributes[c]=u}if(t.skinIndices.length>0){var m=new Mt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new Mt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new et,e=new h;return function(){null===this.boundingSphere&&(this.boundingSphere=new rt);var r=this.attributes.position;if(r){var n=this.boundingSphere.center;t.setFromBufferAttribute(r),t.getCenter(n);for(var i=0,a=0,o=r.count;a<o;a++)e.x=r.getX(a),e.y=r.getY(a),e.z=r.getZ(a),i=Math.max(i,n.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,r=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new mt(new Float32Array(n.length),3));else for(var i=e.normal.array,a=0,o=i.length;a<o;a++)i[a]=0;var s,c,u,l=e.normal.array,d=new h,p=new h,f=new h,m=new h,v=new h;if(t){var g=t.array;0===r.length&&this.addGroup(0,g.length);for(var y=0,x=r.length;y<x;++y)for(var b=r[y],_=b.start,w=b.count,a=_,o=_+w;a<o;a+=3)s=3*g[a+0],c=3*g[a+1],u=3*g[a+2],d.fromArray(n,s),p.fromArray(n,c),f.fromArray(n,u),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),l[s]+=m.x,l[s+1]+=m.y,l[s+2]+=m.z,l[c]+=m.x,l[c+1]+=m.y,l[c+2]+=m.z,l[u]+=m.x,l[u+1]+=m.y,l[u+2]+=m.z}else for(var a=0,o=n.length;a<o;a+=9)d.fromArray(n,a),p.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),l[a]=m.x,l[a+1]=m.y,l[a+2]=m.z,l[a+3]=m.x,l[a+4]=m.y,l[a+5]=m.z,l[a+6]=m.x,l[a+7]=m.y,l[a+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(!1===(t&&t.isBufferGeometry))return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var r=this.attributes;for(var n in r)if(void 0!==t.attributes[n])for(var i=r[n],a=i.array,o=t.attributes[n],s=o.array,c=o.itemSize,u=0,h=c*e;u<s.length;u++,h++)a[h]=s[u];return this},normalizeNormals:function(){for(var t,e,r,n,i=this.attributes.normal,a=0,o=i.count;a<o;a++)t=i.getX(a),e=i.getY(a),r=i.getZ(a),n=1/Math.sqrt(t*t+e*e+r*r),i.setXYZ(a,t*n,e*n,r*n)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Rt,e=this.index.array,r=this.attributes;for(var n in r){for(var i=r[n],a=i.array,o=i.itemSize,s=new a.constructor(e.length*o),c=0,u=0,h=0,l=e.length;h<l;h++){c=e[h]*o;for(var d=0;d<o;d++)s[u++]=a[c++]}t.addAttribute(n,new mt(s,o))}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var r in e)void 0!==e[r]&&(t[r]=e[r]);return t}t.data={attributes:{}};var n=this.index;if(null!==n){var i=Array.prototype.slice.call(n.array);t.data.index={type:n.array.constructor.name,array:i}}var a=this.attributes;for(var r in a){var o=a[r],i=Array.prototype.slice.call(o.array);t.data.attributes[r]={itemSize:o.itemSize,type:o.array.constructor.name,array:i,normalized:o.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Rt).copy(this)},copy:function(t){var e,r,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],u=s[e];for(r=0,n=u.length;r<n;r++)c.push(u[r].clone());this.morphAttributes[e]=c}var h=t.groups;for(r=0,n=h.length;r<n;r++){var l=h[r];this.addGroup(l.start,l.count,l.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Pt.prototype=Object.assign(Object.create(ht.prototype),{constructor:Pt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return ht.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&t.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,r=t.length;e<r;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){function t(t,e,r,n,i,a,o){return dt.barycoordFromPoint(t,e,r,n,y),i.multiplyScalar(y.x),a.multiplyScalar(y.y),o.multiplyScalar(y.z),i.add(a).add(o),i.clone()}function e(t,e,r,n,i,a,o){var s=t.material;if(null===(s.side===ga?r.intersectTriangle(a,i,n,!0,o):r.intersectTriangle(n,i,a,s.side!==ya,o)))return null;b.copy(o),b.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(b);return c<e.near||c>e.far?null:{distance:c,point:b.clone(),object:t}}function r(r,n,i,a,o,h,l,d){s.fromBufferAttribute(a,h),c.fromBufferAttribute(a,l),u.fromBufferAttribute(a,d);var p=e(r,n,i,s,c,u,x);return p&&(o&&(m.fromBufferAttribute(o,h),v.fromBufferAttribute(o,l),g.fromBufferAttribute(o,d),p.uv=t(x,s,c,u,m,v,g)),p.face=new pt(h,l,d,dt.normal(s,c,u)),p.faceIndex=h),p}var n=new l,a=new st,o=new rt,s=new h,c=new h,u=new h,d=new h,p=new h,f=new h,m=new i,v=new i,g=new i,y=new h,x=new h,b=new h;return function(i,h){var l=this.geometry,y=this.material,b=this.matrixWorld;if(void 0!==y&&(null===l.boundingSphere&&l.computeBoundingSphere(),o.copy(l.boundingSphere),o.applyMatrix4(b),!1!==i.ray.intersectsSphere(o)&&(n.getInverse(b),a.copy(i.ray).applyMatrix4(n),null===l.boundingBox||!1!==a.intersectsBox(l.boundingBox)))){var _;if(l.isBufferGeometry){var w,M,E,T,S,A=l.index,L=l.attributes.position,R=l.attributes.uv;if(null!==A)for(T=0,S=A.count;T<S;T+=3)w=A.getX(T),M=A.getX(T+1),E=A.getX(T+2),(_=r(this,i,a,L,R,w,M,E))&&(_.faceIndex=Math.floor(T/3),h.push(_));else for(T=0,S=L.count;T<S;T+=3)w=T,M=T+1,E=T+2,(_=r(this,i,a,L,R,w,M,E))&&(_.index=w,h.push(_))}else if(l.isGeometry){var P,C,I,U,N=Array.isArray(y),O=l.vertices,B=l.faces,D=l.faceVertexUvs[0];D.length>0&&(U=D);for(var F=0,z=B.length;F<z;F++){var G=B[F],k=N?y[G.materialIndex]:y;if(void 0!==k){if(P=O[G.a],C=O[G.b],I=O[G.c],!0===k.morphTargets){var H=l.morphTargets,V=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(var j=0,W=H.length;j<W;j++){var X=V[j];if(0!==X){var q=H[j].vertices;s.addScaledVector(d.subVectors(q[G.a],P),X),c.addScaledVector(p.subVectors(q[G.b],C),X),u.addScaledVector(f.subVectors(q[G.c],I),X)}}s.add(P),c.add(C),u.add(I),P=s,C=c,I=u}if(_=e(this,i,a,P,C,I,x)){if(U&&U[F]){var Y=U[F];m.copy(Y[0]),v.copy(Y[1]),g.copy(Y[2]),_.uv=t(x,P,C,I,m,v,g)}_.face=G,_.faceIndex=F,h.push(_)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ct.prototype=Object.create(Lt.prototype),Ct.prototype.constructor=Ct,It.prototype=Object.create(Rt.prototype),It.prototype.constructor=It,Ut.prototype=Object.create(Lt.prototype),Ut.prototype.constructor=Ut,Nt.prototype=Object.create(Rt.prototype),Nt.prototype.constructor=Nt,Ot.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ot,isCamera:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new u;return function(e){var r=e||new h;return this.getWorldQuaternion(t),r.set(0,0,-1).applyQuaternion(t)}}(),clone:function(){return(new this.constructor).copy(this)}}),Bt.prototype=Object.assign(Object.create(Ot.prototype),{constructor:Bt,isPerspectiveCamera:!0,copy:function(t){return Ot.prototype.copy.call(this,t),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Ms.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Ms.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Ms.RAD2DEG*Math.atan(Math.tan(.5*Ms.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,r,n,i,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:r,offsetY:n,width:i,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Ms.DEG2RAD*this.fov)/this.zoom,r=2*e,n=this.aspect*r,i=-.5*n,a=this.view;if(null!==a){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*n/o,e-=a.offsetY*r/s,n*=a.width/o,r*=a.height/s}var c=this.filmOffset;0!==c&&(i+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+n,e,e-r,t,this.far)},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Dt.prototype=Object.assign(Object.create(Ot.prototype),{constructor:Dt,isOrthographicCamera:!0,copy:function(t){return Ot.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,r,n,i,a){this.view={fullWidth:t,fullHeight:e,offsetX:r,offsetY:n,width:i,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,i=r-t,a=r+t,o=n+e,s=n-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,l=(this.top-this.bottom)/this.view.height;i+=h*(this.view.offsetX/c),a=i+h*(this.view.width/c),o-=l*(this.view.offsetY/u),s=o-l*(this.view.height/u)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far)},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}});var Gs=0;ve.prototype.isFogExp2=!0,ve.prototype.clone=function(){return new ve(this.color.getHex(),this.density)},ve.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},ge.prototype.isFog=!0,ge.prototype.clone=function(){return new ge(this.color.getHex(),this.near,this.far)},ge.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ye.prototype=Object.assign(Object.create(ht.prototype),{constructor:ye,copy:function(t,e){return ht.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),xe.prototype=Object.assign(Object.create(ht.prototype),{constructor:xe,isLensFlare:!0,copy:function(t){ht.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,r=t.lensFlares.length;e<r;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,r,n,i,a){void 0===e&&(e=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===i&&(i=new Y(16777215)),void 0===n&&(n=Ta),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:e,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:i,blending:n})},updateLensFlares:function(){var t,e,r=this.lensFlares.length,n=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(t=0;t<r;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+n*e.distance,e.y=this.positionScreen.y+i*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),be.prototype=Object.create(K.prototype),be.prototype.constructor=be,be.prototype.isSpriteMaterial=!0,be.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},_e.prototype=Object.assign(Object.create(ht.prototype),{constructor:_e,isSprite:!0,raycast:function(){var t=new h,e=new h,r=new h;return function(n,i){e.setFromMatrixPosition(this.matrixWorld),n.ray.closestPointToPoint(e,t),r.setFromMatrixScale(this.matrixWorld);var a=r.x*r.y/4;if(!(e.distanceToSquared(t)>a)){var o=n.ray.origin.distanceTo(t);o<n.near||o>n.far||i.push({distance:o,point:t.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),we.prototype=Object.assign(Object.create(ht.prototype),{constructor:we,copy:function(t){ht.prototype.copy.call(this,t,!1);for(var e=t.levels,r=0,n=e.length;r<n;r++){var i=e[r];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var r=this.levels,n=0;n<r.length&&!(e<r[n].distance);n++);r.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,r=1,n=e.length;r<n&&!(t<e[r].distance);r++);return e[r-1].object},raycast:function(){var t=new h;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(t);this.getObjectForDistance(n).raycast(e,r)}}(),update:function(){var t=new h,e=new h;return function(r){var n=this.levels;if(n.length>1){t.setFromMatrixPosition(r.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);n[0].object.visible=!0;for(var a=1,o=n.length;a<o&&i>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;a<o;a++)n[a].object.visible=!1}}}(),toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);e.object.levels=[];for(var r=this.levels,n=0,i=r.length;n<i;n++){var a=r[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Object.assign(Me.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var r=new l;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},pose:function(){var t,e,r;for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,r=this.bones.length;e<r;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new l,e=new l;return function(){for(var r=this.bones,n=this.boneInverses,i=this.boneMatrices,a=this.boneTexture,o=0,s=r.length;o<s;o++){var c=r[o]?r[o].matrixWorld:e;t.multiplyMatrices(c,n[o]),t.toArray(i,16*o)}void 0!==a&&(a.needsUpdate=!0)}}(),clone:function(){return new Me(this.bones,this.boneInverses)}}),Ee.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ee,isBone:!0}),Te.prototype=Object.assign(Object.create(Pt.prototype),{constructor:Te,isSkinnedMesh:!0,initBones:function(){var t,e,r,n,i=[];if(this.geometry&&void 0!==this.geometry.bones){for(r=0,n=this.geometry.bones.length;r<n;r++)e=this.geometry.bones[r],t=new Ee,i.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(r=0,n=this.geometry.bones.length;r<n;r++)e=this.geometry.bones[r],-1!==e.parent&&null!==e.parent&&void 0!==i[e.parent]?i[e.parent].add(i[r]):this.add(i[r])}return this.updateMatrixWorld(!0),i},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var r=this.geometry.skinWeights[e];t=1/r.lengthManhattan(),t!==1/0?r.multiplyScalar(t):r.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var n=new o,i=this.geometry.attributes.skinWeight;for(e=0;e<i.count;e++)n.x=i.getX(e),n.y=i.getY(e),n.z=i.getZ(e),n.w=i.getW(e),t=1/n.lengthManhattan(),t!==1/0?n.multiplyScalar(t):n.set(1,0,0,0),i.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(t){Pt.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Se.prototype=Object.create(K.prototype),Se.prototype.constructor=Se,Se.prototype.isLineBasicMaterial=!0,Se.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Ae.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ae,isLine:!0,raycast:function(){var t=new l,e=new st,r=new rt;return function(n,i){var a=n.linePrecision,o=a*a,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(c),!1!==n.ray.intersectsSphere(r)){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var u=new h,l=new h,d=new h,p=new h,f=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var m=s.index,v=s.attributes,g=v.position.array;if(null!==m)for(var y=m.array,x=0,b=y.length-1;x<b;x+=f){var _=y[x],w=y[x+1];u.fromArray(g,3*_),l.fromArray(g,3*w);var M=e.distanceSqToSegment(u,l,p,d);if(!(M>o)){p.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(p);E<n.near||E>n.far||i.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=g.length/3-1;x<b;x+=f){u.fromArray(g,3*x),l.fromArray(g,3*x+3);var M=e.distanceSqToSegment(u,l,p,d);if(!(M>o)){p.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(p);E<n.near||E>n.far||i.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,x=0;x<S-1;x+=f){var M=e.distanceSqToSegment(T[x],T[x+1],p,d);if(!(M>o)){p.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(p);E<n.near||E>n.far||i.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Le.prototype=Object.assign(Object.create(Ae.prototype),{constructor:Le,isLineSegments:!0}),Re.prototype=Object.assign(Object.create(Ae.prototype),{constructor:Re,isLineLoop:!0}),Pe.prototype=Object.create(K.prototype),Pe.prototype.constructor=Pe,Pe.prototype.isPointsMaterial=!0,Pe.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Ce.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ce,isPoints:!0,raycast:function(){var t=new l,e=new st,r=new rt;return function(n,i){function a(t,r){var a=e.distanceSqToPoint(t);if(a<d){var s=e.closestPointToPoint(t);s.applyMatrix4(c);var u=n.ray.origin.distanceTo(s);if(u<n.near||u>n.far)return;i.push({distance:u,distanceToRay:Math.sqrt(a),point:s.clone(),index:r,face:null,object:o})}}var o=this,s=this.geometry,c=this.matrixWorld,u=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(c),r.radius+=u,!1!==n.ray.intersectsSphere(r)){t.getInverse(c),e.copy(n.ray).applyMatrix4(t);var l=u/((this.scale.x+this.scale.y+this.scale.z)/3),d=l*l,p=new h;if(s.isBufferGeometry){var f=s.index,m=s.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,x=g.length;y<x;y++){var b=g[y];p.fromArray(v,3*b),a(p,b)}else for(var y=0,_=v.length/3;y<_;y++)p.fromArray(v,3*y),a(p,y)}else for(var w=s.vertices,y=0,_=w.length;y<_;y++)a(w[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ie.prototype=Object.assign(Object.create(ht.prototype),{constructor:Ie}),Ue.prototype=Object.create(a.prototype),Ue.prototype.constructor=Ue,Ne.prototype=Object.create(a.prototype),Ne.prototype.constructor=Ne,Ne.prototype.isCompressedTexture=!0,Oe.prototype=Object.create(a.prototype),Oe.prototype.constructor=Oe,Be.prototype=Object.create(a.prototype),Be.prototype.constructor=Be,Be.prototype.isDepthTexture=!0,De.prototype=Object.create(Rt.prototype),De.prototype.constructor=De,Fe.prototype=Object.create(Lt.prototype),Fe.prototype.constructor=Fe,ze.prototype=Object.create(Rt.prototype),ze.prototype.constructor=ze,Ge.prototype=Object.create(Lt.prototype),Ge.prototype.constructor=Ge,ke.prototype=Object.create(Rt.prototype),ke.prototype.constructor=ke,He.prototype=Object.create(Lt.prototype),He.prototype.constructor=He,Ve.prototype=Object.create(ke.prototype),Ve.prototype.constructor=Ve,je.prototype=Object.create(Lt.prototype),je.prototype.constructor=je,We.prototype=Object.create(ke.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(Lt.prototype),Xe.prototype.constructor=Xe,qe.prototype=Object.create(ke.prototype),qe.prototype.constructor=qe,Ye.prototype=Object.create(Lt.prototype),Ye.prototype.constructor=Ye,Ze.prototype=Object.create(ke.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(Lt.prototype),Je.prototype.constructor=Je,Qe.prototype=Object.create(Rt.prototype),Qe.prototype.constructor=Qe,Ke.prototype=Object.create(Lt.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(Rt.prototype),$e.prototype.constructor=$e,tr.prototype=Object.create(Lt.prototype),tr.prototype.constructor=tr,er.prototype=Object.create(Rt.prototype),er.prototype.constructor=er;var ks={area:function(t){for(var e=t.length,r=0,n=e-1,i=0;i<e;n=i++)r+=t[n].x*t[i].y-t[i].x*t[n].y;return.5*r},triangulate:function(){function t(t,e,r,n,i,a){var o,s,c,u,h,l,d,p,f;if(s=t[a[e]].x,c=t[a[e]].y,u=t[a[r]].x,h=t[a[r]].y,l=t[a[n]].x,d=t[a[n]].y,(u-s)*(d-c)-(h-c)*(l-s)<=0)return!1;var m,v,g,y,x,b,_,w,M,E,T,S,A,L,R;for(m=l-u,v=d-h,g=s-l,y=c-d,x=u-s,b=h-c,o=0;o<i;o++)if(p=t[a[o]].x,f=t[a[o]].y,!(p===s&&f===c||p===u&&f===h||p===l&&f===d)&&(_=p-s,w=f-c,M=p-u,E=f-h,T=p-l,S=f-d,R=m*E-v*M,A=x*w-b*_,L=g*S-y*T,R>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,r){var n=e.length;if(n<3)return null;var i,a,o,s=[],c=[],u=[];if(ks.area(e)>0)for(a=0;a<n;a++)c[a]=a;else for(a=0;a<n;a++)c[a]=n-1-a;var h=n,l=2*h;for(a=h-1;h>2;){if(l--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),r?u:s;if(i=a,h<=i&&(i=0),a=i+1,h<=a&&(a=0),o=a+1,h<=o&&(o=0),t(e,i,a,o,h,c)){var d,p,f,m,v;for(d=c[i],p=c[a],f=c[o],s.push([e[d],e[p],e[f]]),u.push([c[i],c[a],c[o]]),m=a,v=a+1;v<h;m++,v++)c[m]=c[v];h--,l=2*h}}return r?u:s}}(),triangulateShape:function(t,e){function r(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function n(t,e,r){return t.x!==e.x?t.x<e.x?t.x<=r.x&&r.x<=e.x:e.x<=r.x&&r.x<=t.x:t.y<e.y?t.y<=r.y&&r.y<=e.y:e.y<=r.y&&r.y<=t.y}function i(t,e,r,i,a){var o=e.x-t.x,s=e.y-t.y,c=i.x-r.x,u=i.y-r.y,h=t.x-r.x,l=t.y-r.y,d=s*c-o*u,p=s*h-o*l;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if((f=u*h-c*l)<0||f>d)return[]}else{if(p>0||p<d)return[];if((f=u*h-c*l)>0||f<d)return[]}if(0===f)return!a||0!==p&&p!==d?[t]:[];if(f===d)return!a||0!==p&&p!==d?[e]:[];if(0===p)return[r];if(p===d)return[i];var m=f/d;return[{x:t.x+m*o,y:t.y+m*s}]}if(0!==p||u*h!=c*l)return[];var v=0===o&&0===s,g=0===c&&0===u;if(v&&g)return t.x!==r.x||t.y!==r.y?[]:[t];if(v)return n(r,i,t)?[t]:[];if(g)return n(t,e,r)?[r]:[];var y,x,b,_,w,M,E,T;return 0!==o?(t.x<e.x?(y=t,b=t.x,x=e,_=e.x):(y=e,b=e.x,x=t,_=t.x),r.x<i.x?(w=r,E=r.x,M=i,T=i.x):(w=i,E=i.x,M=r,T=r.x)):(t.y<e.y?(y=t,b=t.y,x=e,_=e.y):(y=e,b=e.y,x=t,_=t.y),r.y<i.y?(w=r,E=r.y,M=i,T=i.y):(w=i,E=i.y,M=r,T=r.y)),b<=E?_<E?[]:_===E?a?[]:[w]:_<=T?[w,x]:[w,M]:b>T?[]:b===T?a?[]:[y]:_<=T?[y,x]:[y,M]}function a(t,e,r,n){var i=e.x-t.x,a=e.y-t.y,o=r.x-t.x,s=r.y-t.y,c=n.x-t.x,u=n.y-t.y,h=i*s-a*o,l=i*u-a*c;if(Math.abs(h)>Number.EPSILON){var d=c*s-u*o;return h>0?l>=0&&d>=0:l>=0||d>=0}return l>0}r(t),e.forEach(r);for(var o,s,c,u,h,l,d={},p=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(p,e[f]);for(o=0,s=p.length;o<s;o++)h=p[o].x+":"+p[o].y,void 0!==d[h]&&console.warn("THREE.ShapeUtils: Duplicate point",h,o),d[h]=o;var v=function(t,e){for(var r,n,o,s,c,u,h,l,d,p,f,m=t.concat(),v=[],g=[],y=0,x=e.length;y<x;y++)v.push(y);for(var b=0,_=2*v.length;v.length>0;){if(--_<0){console.log("Infinite Loop! Holes left:"+v.length+", Probably Hole outside Shape!");break}for(o=b;o<m.length;o++){s=m[o],n=-1;for(var y=0;y<v.length;y++)if(u=v[y],h=s.x+":"+s.y+":"+u,void 0===g[h]){r=e[u];for(var w=0;w<r.length;w++)if(c=r[w],function(t,e){var n=m.length-1,i=t-1;i<0&&(i=n);var o=t+1;o>n&&(o=0);var s=a(m[t],m[i],m[o],r[e]);if(!s)return!1;var c=r.length-1,u=e-1;u<0&&(u=c);var h=e+1;return h>c&&(h=0),!!(s=a(r[e],r[u],r[h],m[t]))}(o,w)&&!function(t,e){var r,n,a;for(r=0;r<m.length;r++)if(n=r+1,n%=m.length,a=i(t,e,m[r],m[n],!0),a.length>0)return!0;return!1}(s,c)&&!function(t,r){var n,a,o,s,c;for(n=0;n<v.length;n++)for(a=e[v[n]],o=0;o<a.length;o++)if(s=o+1,s%=a.length,c=i(t,r,a[o],a[s],!0),c.length>0)return!0;return!1}(s,c)){n=w,v.splice(y,1),l=m.slice(0,o+1),d=m.slice(o),p=r.slice(n),f=r.slice(0,n+1),m=l.concat(p).concat(f).concat(d),b=o;break}if(n>=0)break;g[h]=!0}if(n>=0)break}}return m}(t,e),g=ks.triangulate(v,!1);for(o=0,s=g.length;o<s;o++)for(u=g[o],c=0;c<3;c++)h=u[c].x+":"+u[c].y,void 0!==(l=d[h])&&(u[c]=l);return g.concat()},isClockWise:function(t){return ks.area(t)<0}};rr.prototype=Object.create(Lt.prototype),rr.prototype.constructor=rr,nr.prototype=Object.create(Rt.prototype),nr.prototype.constructor=nr,nr.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],r=this.getAttribute("uv"),n=r?Array.prototype.slice.call(r.array):[],i=this.index;return{position:e,uv:n,index:i?Array.prototype.slice.call(i.array):[]}},nr.prototype.addShapeList=function(t,e){var r=t.length;e.arrays=this.getArrays();for(var n=0;n<r;n++){var i=t[n];this.addShape(i,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new Mt(e.arrays.position,3)),this.addAttribute("uv",new Mt(e.arrays.uv,2))},nr.prototype.addShape=function(t,e){function r(t,e,r){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(r).add(t)}function n(t,e,r){var n,a,o=1,s=t.x-e.x,c=t.y-e.y,u=r.x-t.x,h=r.y-t.y,l=s*s+c*c,d=s*h-c*u;if(Math.abs(d)>Number.EPSILON){var p=Math.sqrt(l),f=Math.sqrt(u*u+h*h),m=e.x-c/p,v=e.y+s/p,g=r.x-h/f,y=r.y+u/f,x=((g-m)*h-(y-v)*u)/(s*h-c*u);n=m+s*x-t.x,a=v+c*x-t.y;var b=n*n+a*a;if(b<=2)return new i(n,a);o=Math.sqrt(b/2)}else{var _=!1;s>Number.EPSILON?u>Number.EPSILON&&(_=!0):s<-Number.EPSILON?u<-Number.EPSILON&&(_=!0):Math.sign(c)===Math.sign(h)&&(_=!0),_?(n=-c,a=s,o=Math.sqrt(l)):(n=s,a=c,o=Math.sqrt(l/2))}return new i(n/o,a/o)}function a(t,e){var r,n;for(Q=t.length;--Q>=0;){r=Q,n=Q-1,n<0&&(n=t.length-1);var i=0,a=L+2*T;for(i=0;i<a;i++){var o=Y*i,s=Y*(i+1);c(e+r+o,e+n+o,e+n+s,e+r+s,t,i,a,r,n)}}}function o(t,e,r){_.push(t),_.push(e),_.push(r)}function s(t,e,r){u(t),u(e),u(r);var n=y.length/3,i=C.generateTopUV(O,y,n-3,n-2,n-1);l(i[0]),l(i[1]),l(i[2])}function c(t,e,r,n,i,a,o,s,c){u(t),u(e),u(n),u(e),u(r),u(n);var h=y.length/3,d=C.generateSideWallUV(O,y,h-6,h-3,h-2,h-1);l(d[0]),l(d[1]),l(d[3]),l(d[1]),l(d[2]),l(d[3])}function u(t){x.push(y.length/3),y.push(_[3*t+0]),y.push(_[3*t+1]),y.push(_[3*t+2])}function l(t){b.push(t.x),b.push(t.y)}var d,p,f,m,v,g=e.arrays?e.arrays:this.getArrays(),y=g.position,x=g.index,b=g.uv,_=[],w=void 0!==e.amount?e.amount:100,M=void 0!==e.bevelThickness?e.bevelThickness:6,E=void 0!==e.bevelSize?e.bevelSize:M-2,T=void 0!==e.bevelSegments?e.bevelSegments:3,S=void 0===e.bevelEnabled||e.bevelEnabled,A=void 0!==e.curveSegments?e.curveSegments:12,L=void 0!==e.steps?e.steps:1,R=e.extrudePath,P=!1,C=void 0!==e.UVGenerator?e.UVGenerator:rr.WorldUVGenerator;R&&(d=R.getSpacedPoints(L),P=!0,S=!1,p=void 0!==e.frames?e.frames:R.computeFrenetFrames(L,!1),f=new h,m=new h,v=new h),S||(T=0,M=0,E=0);var I,U,N,O=this,B=t.extractPoints(A),D=B.shape,F=B.holes,z=!ks.isClockWise(D);if(z){for(D=D.reverse(),U=0,N=F.length;U<N;U++)I=F[U],ks.isClockWise(I)&&(F[U]=I.reverse());z=!1}var G=ks.triangulateShape(D,F),k=D;for(U=0,N=F.length;U<N;U++)I=F[U],D=D.concat(I);for(var H,V,j,W,X,q,Y=D.length,Z=G.length,J=[],Q=0,K=k.length,$=K-1,tt=Q+1;Q<K;Q++,$++,tt++)$===K&&($=0),tt===K&&(tt=0),J[Q]=n(k[Q],k[$],k[tt]);var et,rt=[],nt=J.concat();for(U=0,N=F.length;U<N;U++){for(I=F[U],et=[],Q=0,K=I.length,$=K-1,tt=Q+1;Q<K;Q++,$++,tt++)$===K&&($=0),tt===K&&(tt=0),et[Q]=n(I[Q],I[$],I[tt]);rt.push(et),nt=nt.concat(et)}for(H=0;H<T;H++){for(j=H/T,W=M*Math.cos(j*Math.PI/2),V=E*Math.sin(j*Math.PI/2),Q=0,K=k.length;Q<K;Q++)X=r(k[Q],J[Q],V),o(X.x,X.y,-W);for(U=0,N=F.length;U<N;U++)for(I=F[U],et=rt[U],Q=0,K=I.length;Q<K;Q++)X=r(I[Q],et[Q],V),o(X.x,X.y,-W)}for(V=E,Q=0;Q<Y;Q++)X=S?r(D[Q],nt[Q],V):D[Q],P?(m.copy(p.normals[0]).multiplyScalar(X.x),f.copy(p.binormals[0]).multiplyScalar(X.y),v.copy(d[0]).add(m).add(f),o(v.x,v.y,v.z)):o(X.x,X.y,0);var it;for(it=1;it<=L;it++)for(Q=0;Q<Y;Q++)X=S?r(D[Q],nt[Q],V):D[Q],P?(m.copy(p.normals[it]).multiplyScalar(X.x),f.copy(p.binormals[it]).multiplyScalar(X.y),v.copy(d[it]).add(m).add(f),o(v.x,v.y,v.z)):o(X.x,X.y,w/L*it);for(H=T-1;H>=0;H--){for(j=H/T,W=M*Math.cos(j*Math.PI/2),V=E*Math.sin(j*Math.PI/2),Q=0,K=k.length;Q<K;Q++)X=r(k[Q],J[Q],V),o(X.x,X.y,w+W);for(U=0,N=F.length;U<N;U++)for(I=F[U],et=rt[U],Q=0,K=I.length;Q<K;Q++)X=r(I[Q],et[Q],V),P?o(X.x,X.y+d[L-1].y,d[L-1].x+W):o(X.x,X.y,w+W)}!function(){var t=y.length/3;if(S){var r=0,n=Y*r;for(Q=0;Q<Z;Q++)q=G[Q],s(q[2]+n,q[1]+n,q[0]+n);for(r=L+2*T,n=Y*r,Q=0;Q<Z;Q++)q=G[Q],s(q[0]+n,q[1]+n,q[2]+n)}else{for(Q=0;Q<Z;Q++)q=G[Q],s(q[2],q[1],q[0]);for(Q=0;Q<Z;Q++)q=G[Q],s(q[0]+Y*L,q[1]+Y*L,q[2]+Y*L)}O.addGroup(t,y.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=y.length/3,r=0;for(a(k,r),r+=k.length,U=0,N=F.length;U<N;U++)I=F[U],a(I,r),r+=I.length;O.addGroup(t,y.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(x),this.addAttribute("position",new Mt(y,3)),this.addAttribute("uv",new Mt(e.arrays.uv,2)))},rr.WorldUVGenerator={generateTopUV:function(t,e,r,n,a){var o=e[3*r],s=e[3*r+1],c=e[3*n],u=e[3*n+1],h=e[3*a],l=e[3*a+1];return[new i(o,s),new i(c,u),new i(h,l)]},generateSideWallUV:function(t,e,r,n,a,o){var s=e[3*r],c=e[3*r+1],u=e[3*r+2],h=e[3*n],l=e[3*n+1],d=e[3*n+2],p=e[3*a],f=e[3*a+1],m=e[3*a+2],v=e[3*o],g=e[3*o+1],y=e[3*o+2];return Math.abs(c-l)<.01?[new i(s,1-u),new i(h,1-d),new i(p,1-m),new i(v,1-y)]:[new i(c,1-u),new i(l,1-d),new i(f,1-m),new i(g,1-y)]}},ir.prototype=Object.create(Lt.prototype),ir.prototype.constructor=ir,ar.prototype=Object.create(nr.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(Lt.prototype),or.prototype.constructor=or,sr.prototype=Object.create(Rt.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(Lt.prototype),cr.prototype.constructor=cr,ur.prototype=Object.create(Rt.prototype),ur.prototype.constructor=ur,hr.prototype=Object.create(Lt.prototype),hr.prototype.constructor=hr,lr.prototype=Object.create(Rt.prototype),lr.prototype.constructor=lr,dr.prototype=Object.create(Lt.prototype),dr.prototype.constructor=dr,pr.prototype=Object.create(Rt.prototype),pr.prototype.constructor=pr,fr.prototype=Object.create(Rt.prototype),fr.prototype.constructor=fr,mr.prototype=Object.create(Lt.prototype),mr.prototype.constructor=mr,vr.prototype=Object.create(Rt.prototype),vr.prototype.constructor=vr,gr.prototype=Object.create(mr.prototype),gr.prototype.constructor=gr,yr.prototype=Object.create(vr.prototype),yr.prototype.constructor=yr,xr.prototype=Object.create(Lt.prototype),xr.prototype.constructor=xr,br.prototype=Object.create(Rt.prototype),br.prototype.constructor=br;var Hs=Object.freeze({WireframeGeometry:De,ParametricGeometry:Fe,ParametricBufferGeometry:ze,TetrahedronGeometry:He,TetrahedronBufferGeometry:Ve,OctahedronGeometry:je,OctahedronBufferGeometry:We,IcosahedronGeometry:Xe,IcosahedronBufferGeometry:qe,DodecahedronGeometry:Ye,DodecahedronBufferGeometry:Ze,PolyhedronGeometry:Ge,PolyhedronBufferGeometry:ke,TubeGeometry:Je,TubeBufferGeometry:Qe,TorusKnotGeometry:Ke,TorusKnotBufferGeometry:$e,TorusGeometry:tr,TorusBufferGeometry:er,TextGeometry:ir,TextBufferGeometry:ar,SphereGeometry:or,SphereBufferGeometry:sr,RingGeometry:cr,RingBufferGeometry:ur,PlaneGeometry:Ut,PlaneBufferGeometry:Nt,LatheGeometry:hr,LatheBufferGeometry:lr,ShapeGeometry:dr,ShapeBufferGeometry:pr,ExtrudeGeometry:rr,ExtrudeBufferGeometry:nr,EdgesGeometry:fr,ConeGeometry:gr,ConeBufferGeometry:yr,CylinderGeometry:mr,CylinderBufferGeometry:vr,CircleGeometry:xr,CircleBufferGeometry:br,BoxGeometry:Ct,BoxBufferGeometry:It});_r.prototype=Object.create($.prototype),_r.prototype.constructor=_r,_r.prototype.isShadowMaterial=!0,wr.prototype=Object.create($.prototype),wr.prototype.constructor=wr,wr.prototype.isRawShaderMaterial=!0,Mr.prototype=Object.create(K.prototype),Mr.prototype.constructor=Mr,Mr.prototype.isMeshStandardMaterial=!0,Mr.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Er.prototype=Object.create(Mr.prototype),Er.prototype.constructor=Er,Er.prototype.isMeshPhysicalMaterial=!0,Er.prototype.copy=function(t){return Mr.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Tr.prototype=Object.create(K.prototype),Tr.prototype.constructor=Tr,Tr.prototype.isMeshPhongMaterial=!0,Tr.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Sr.prototype=Object.create(Tr.prototype),Sr.prototype.constructor=Sr,Sr.prototype.isMeshToonMaterial=!0,Sr.prototype.copy=function(t){return Tr.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Ar.prototype=Object.create(K.prototype),Ar.prototype.constructor=Ar,Ar.prototype.isMeshNormalMaterial=!0,Ar.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Lr.prototype=Object.create(K.prototype),Lr.prototype.constructor=Lr,Lr.prototype.isMeshLambertMaterial=!0,Lr.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Rr.prototype=Object.create(K.prototype),Rr.prototype.constructor=Rr,Rr.prototype.isLineDashedMaterial=!0,Rr.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Vs=Object.freeze({ShadowMaterial:_r,SpriteMaterial:be,RawShaderMaterial:wr,ShaderMaterial:$,PointsMaterial:Pe,MeshPhysicalMaterial:Er,MeshStandardMaterial:Mr,MeshPhongMaterial:Tr,MeshToonMaterial:Sr,MeshNormalMaterial:Ar,MeshLambertMaterial:Lr,MeshDepthMaterial:tt,MeshBasicMaterial:ft,LineDashedMaterial:Rr,LineBasicMaterial:Se,Material:K}),js={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Ws=new Pr;Object.assign(Cr.prototype,{load:function(t,e,r,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,a=js.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){e&&e(a),i.manager.itemEnd(t)},0),a;var o=/^data:(.*?)(;base64)?,(.*)$/,s=t.match(o);if(s){var c=s[1],u=!!s[2],h=s[3];h=window.decodeURIComponent(h),u&&(h=window.atob(h));try{var l,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":l=new ArrayBuffer(h.length);for(var p=new Uint8Array(l),f=0;f<h.length;f++)p[f]=h.charCodeAt(f);"blob"===d&&(l=new Blob([l],{type:c}));break;case"document":var m=new DOMParser;l=m.parseFromString(h,c);break;case"json":l=JSON.parse(h);break;default:l=h}window.setTimeout(function(){e&&e(l),i.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)},0)}}else{var v=new XMLHttpRequest;v.open("GET",t,!0),v.addEventListener("load",function(r){var a=r.target.response;js.add(t,a),200===this.status?(e&&e(a),i.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(a),i.manager.itemEnd(t)):(n&&n(r),i.manager.itemEnd(t),i.manager.itemError(t))},!1),void 0!==r&&v.addEventListener("progress",function(t){r(t)},!1),v.addEventListener("error",function(e){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)},!1),void 0!==this.responseType&&(v.responseType=this.responseType),void 0!==this.withCredentials&&(v.withCredentials=this.withCredentials),v.overrideMimeType&&v.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(var g in this.requestHeader)v.setRequestHeader(g,this.requestHeader[g]);v.send(null)}return i.manager.itemStart(t),v},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(Ir.prototype,{load:function(t,e,r,n){var i=this,a=[],o=new Ne;o.image=a;var s=new Cr(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,u=0,h=t.length;u<h;++u)!function(u){s.load(t[u],function(t){var r=i._parser(t,!0);a[u]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(c+=1)&&(1===r.mipmapCount&&(o.minFilter=Mo),o.format=r.format,o.needsUpdate=!0,e&&e(o))},r,n)}(u);else s.load(t,function(t){var r=i._parser(t,!0);if(r.isCubemap)for(var n=r.mipmaps.length/r.mipmapCount,s=0;s<n;s++){a[s]={mipmaps:[]};for(var c=0;c<r.mipmapCount;c++)a[s].mipmaps.push(r.mipmaps[s*r.mipmapCount+c]),a[s].format=r.format,a[s].width=r.width,a[s].height=r.height}else o.image.width=r.width,o.image.height=r.height,o.mipmaps=r.mipmaps;1===r.mipmapCount&&(o.minFilter=Mo),o.format=r.format,o.needsUpdate=!0,e&&e(o)},r,n);return o},setPath:function(t){return this.path=t,this}}),Object.assign(Ur.prototype,{load:function(t,e,r,n){var i=this,a=new d,o=new Cr(this.manager);return o.setResponseType("arraybuffer"),o.load(t,function(t){var r=i._parser(t);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:yo,a.wrapT=void 0!==r.wrapT?r.wrapT:yo,a.magFilter=void 0!==r.magFilter?r.magFilter:Mo,a.minFilter=void 0!==r.minFilter?r.minFilter:To,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps),1===r.mipmapCount&&(a.minFilter=Mo),a.needsUpdate=!0,e&&e(a,r))},r,n),a}}),Object.assign(Nr.prototype,{load:function(t,e,r,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var i=this,a=js.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){e&&e(a),i.manager.itemEnd(t)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");return o.addEventListener("load",function(){js.add(t,this),e&&e(this),i.manager.itemEnd(t)},!1),o.addEventListener("error",function(e){n&&n(e),i.manager.itemEnd(t),i.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Or.prototype,{load:function(t,e,r,n){var i=new p,a=new Nr(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);for(var o=0,s=0;s<t.length;++s)!function(r){a.load(t[r],function(t){i.images[r]=t,6==++o&&(i.needsUpdate=!0,e&&e(i))},void 0,n)}(s);return i},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Br.prototype,{load:function(t,e,r,n){var i=new Nr(this.manager);i.setCrossOrigin(this.crossOrigin),i.setPath(this.path);var o=new a;return o.image=i.load(t,function(){var r=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);o.format=r?zo:Go,o.needsUpdate=!0,void 0!==e&&e(o)},r,n),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Dr.prototype=Object.assign(Object.create(ht.prototype),{constructor:Dr,isLight:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Fr.prototype=Object.assign(Object.create(Dr.prototype),{constructor:Fr,isHemisphereLight:!0,copy:function(t){return Dr.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(zr.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Gr.prototype=Object.assign(Object.create(zr.prototype),{constructor:Gr,isSpotLightShadow:!0,update:function(t){var e=this.camera,r=2*Ms.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;r===e.fov&&n===e.aspect&&i===e.far||(e.fov=r,e.aspect=n,e.far=i,e.updateProjectionMatrix())}}),kr.prototype=Object.assign(Object.create(Dr.prototype),{constructor:kr,isSpotLight:!0,copy:function(t){return Dr.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Hr.prototype=Object.assign(Object.create(Dr.prototype),{constructor:Hr,isPointLight:!0,copy:function(t){return Dr.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Vr.prototype=Object.assign(Object.create(zr.prototype),{constructor:Vr}),jr.prototype=Object.assign(Object.create(Dr.prototype),{constructor:jr,isDirectionalLight:!0,copy:function(t){return Dr.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Wr.prototype=Object.assign(Object.create(Dr.prototype),{constructor:Wr,isAmbientLight:!0}),Xr.prototype=Object.assign(Object.create(Dr.prototype),{constructor:Xr,isRectAreaLight:!0,copy:function(t){return Dr.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Dr.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var Xs={arraySlice:function(t,e,r){return Xs.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==r?r:t.length)):t.slice(e,r)},convertArray:function(t,e,r){return!t||!r&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,r){return t[e]-t[r]}for(var r=t.length,n=new Array(r),i=0;i!==r;++i)n[i]=i;return n.sort(e),n},sortedArray:function(t,e,r){for(var n=t.length,i=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=r[a]*e,c=0;c!==e;++c)i[o++]=t[s+c];return i},flattenJSON:function(t,e,r,n){for(var i=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[i++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{o=a[n],void 0!==o&&(e.push(a.time),r.push.apply(r,o)),a=t[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[n],void 0!==o&&(e.push(a.time),o.toArray(r,r.length)),a=t[i++]}while(void 0!==a);else do{o=a[n],void 0!==o&&(e.push(a.time),r.push(o)),a=t[i++]}while(void 0!==a)}}};Object.assign(qr.prototype,{evaluate:function(t){var e=this.parameterPositions,r=this._cachedIndex,n=e[r],i=e[r-1];t:{e:{var a;r:{n:if(!(t<n)){for(var o=r+2;;){if(void 0===n){if(t<i)break n;return r=e.length,this._cachedIndex=r,this.afterEnd_(r-1,t,i)}if(r===o)break;if(i=n,n=e[++r],t<n)break e}a=e.length;break r}{if(t>=i)break t;var s=e[1];t<s&&(r=2,i=s);for(var o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(r===o)break;if(n=i,i=e[--r-1],t>=i)break e}a=r,r=0}}for(;r<a;){var c=r+a>>>1;t<e[c]?a=c:r=c+1}if(n=e[r],void 0===(i=e[r-1]))return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return r=e.length,this._cachedIndex=r,this.afterEnd_(r-1,i,t)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,t,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=t*n,a=0;a!==n;++a)e[a]=r[i+a];return e},interpolate_:function(t,e,r,n){throw new Error("call to abstract method")},intervalChanged_:function(t,e,r){}}),Object.assign(qr.prototype,{beforeStart_:qr.prototype.copySampleValue_,afterEnd_:qr.prototype.copySampleValue_}),Yr.prototype=Object.assign(Object.create(qr.prototype),{constructor:Yr,DefaultSettings_:{endingStart:ss,endingEnd:ss},intervalChanged_:function(t,e,r){var n=this.parameterPositions,i=t-2,a=t+1,o=n[i],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case cs:i=t,o=2*e-r;break;case us:i=n.length-2,o=e+n[i]-n[i+1];break;default:i=t,o=r}if(void 0===s)switch(this.getSettings_().endingEnd){case cs:a=t,s=2*r-e;break;case us:a=1,s=r+n[1]-n[0];break;default:a=t-1,s=e}var c=.5*(r-e),u=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-r),this._offsetPrev=i*u,this._offsetNext=a*u},interpolate_:function(t,e,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,u=this._offsetPrev,h=this._offsetNext,l=this._weightPrev,d=this._weightNext,p=(r-e)/(n-e),f=p*p,m=f*p,v=-l*m+2*l*f-l*p,g=(1+l)*m+(-1.5-2*l)*f+(-.5+l)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)i[b]=v*a[u+b]+g*a[c+b]+y*a[s+b]+x*a[h+b];return i}}),Zr.prototype=Object.assign(Object.create(qr.prototype),{constructor:Zr,interpolate_:function(t,e,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,u=(r-e)/(n-e),h=1-u,l=0;l!==o;++l)i[l]=a[c+l]*h+a[s+l]*u;return i}}),Jr.prototype=Object.assign(Object.create(qr.prototype),{constructor:Jr,interpolate_:function(t,e,r,n){return this.copySampleValue_(t-1)}});var qs;qs={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:as,InterpolantFactoryMethodDiscrete:function(t){return new Jr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Zr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Yr(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case is:e=this.InterpolantFactoryMethodDiscrete;break;case as:e=this.InterpolantFactoryMethodLinear;break;case os:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(r)}this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return is;case this.InterpolantFactoryMethodLinear:return as;case this.InterpolantFactoryMethodSmooth:return os}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,r=0,n=e.length;r!==n;++r)e[r]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,r=0,n=e.length;r!==n;++r)e[r]*=t;return this},trim:function(t,e){for(var r=this.times,n=r.length,i=0,a=n-1;i!==n&&r[i]<t;)++i;for(;-1!==a&&r[a]>e;)--a;if(++a,0!==i||a!==n){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=Xs.arraySlice(r,i,a),this.values=Xs.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("invalid value size in track",this),t=!1);var r=this.times,n=this.values,i=r.length;0===i&&(console.error("track is empty",this),t=!1);for(var a=null,o=0;o!==i;o++){var s=r[o];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("out of order keys",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&Xs.isTypedArray(n))for(var o=0,c=n.length;o!==c;++o){var u=n[o];if(isNaN(u)){console.error("value is not a valid number",this,o,u),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,r=this.getValueSize(),n=this.getInterpolation()===os,i=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var u=o*r,h=u-r,l=u+r,d=0;d!==r;++d){var p=e[u+d];if(p!==e[h+d]||p!==e[l+d]){s=!0;break}}if(s){if(o!==i){t[i]=t[o];for(var f=o*r,m=i*r,d=0;d!==r;++d)e[m+d]=e[f+d]}++i}}if(a>0){t[i]=t[a];for(var f=a*r,m=i*r,d=0;d!==r;++d)e[m+d]=e[f+d];++i}return i!==t.length&&(this.times=Xs.arraySlice(t,0,i),this.values=Xs.arraySlice(e,0,i*r)),this}},Kr.prototype=Object.assign(Object.create(qs),{constructor:Kr,ValueTypeName:"vector"}),$r.prototype=Object.assign(Object.create(qr.prototype),{constructor:$r,interpolate_:function(t,e,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=(r-e)/(n-e),h=s+o;s!==h;s+=4)u.slerpFlat(i,0,a,s-o,a,s,c);return i}}),tn.prototype=Object.assign(Object.create(qs),{constructor:tn,ValueTypeName:"quaternion",DefaultInterpolation:as,InterpolantFactoryMethodLinear:function(t){return new $r(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),en.prototype=Object.assign(Object.create(qs),{constructor:en,ValueTypeName:"number"}),rn.prototype=Object.assign(Object.create(qs),{constructor:rn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:is,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),nn.prototype=Object.assign(Object.create(qs),{constructor:nn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:is,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),an.prototype=Object.assign(Object.create(qs),{constructor:an,ValueTypeName:"color"}),on.prototype=qs,qs.constructor=on,Object.assign(on,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=on._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var r=[],n=[];Xs.flattenJSON(t.keys,r,n,"value"),t.times=r,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,r=t.constructor;if(void 0!==r.toJSON)e=r.toJSON(t);else{e={name:t.name,times:Xs.convertArray(t.times,Array),values:Xs.convertArray(t.values,Array)};var n=t.getInterpolation();n!==t.DefaultInterpolation&&(e.interpolation=n)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return en;case"vector":case"vector2":case"vector3":case"vector4":return Kr;case"color":return an;case"quaternion":return tn;case"bool":case"boolean":return nn;case"string":return rn}throw new Error("Unsupported typeName: "+t)}}),Object.assign(sn,{parse:function(t){for(var e=[],r=t.tracks,n=1/(t.fps||1),i=0,a=r.length;i!==a;++i)e.push(on.parse(r[i]).scale(n));return new sn(t.name,t.duration,e)},toJSON:function(t){for(var e=[],r=t.tracks,n={name:t.name,duration:t.duration,tracks:e},i=0,a=r.length;i!==a;++i)e.push(on.toJSON(r[i]));return n},CreateFromMorphTargetSequence:function(t,e,r,n){for(var i=e.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var u=Xs.getKeyframeOrder(s);s=Xs.sortedArray(s,1,u),c=Xs.sortedArray(c,1,u),n||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new en(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/r))}return new sn(t,-1,a)},findByName:function(t,e){var r=t;if(!Array.isArray(t)){var n=t;r=n.geometry&&n.geometry.animations||n.animations}for(var i=0;i<r.length;i++)if(r[i].name===e)return r[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,r){for(var n={},i=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(i);if(c&&c.length>1){var u=c[1],h=n[u];h||(n[u]=h=[]),h.push(s)}}var l=[];for(var u in n)l.push(sn.CreateFromMorphTargetSequence(u,n[u],e,r));return l},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var r=function(t,e,r,n,i){if(0!==r.length){var a=[],o=[];Xs.flattenJSON(r,a,o,n),0!==a.length&&i.push(new t(e,a,o))}},n=[],i=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var u=s[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var h={},l=0;l<u.length;l++)if(u[l].morphTargets)for(var d=0;d<u[l].morphTargets.length;d++)h[u[l].morphTargets[d]]=-1;for(var p in h){for(var f=[],m=[],d=0;d!==u[l].morphTargets.length;++d){var v=u[l];f.push(v.time),m.push(v.morphTarget===p?1:0)}n.push(new en(".morphTargetInfluence["+p+"]",f,m))}a=h.length*(o||1)}else{var g=".bones["+e[c].name+"]";r(Kr,g+".position",u,"pos",n),r(tn,g+".quaternion",u,"rot",n),r(Kr,g+".scale",u,"scl",n)}}return 0===n.length?null:new sn(i,a,n)}}),Object.assign(sn.prototype,{resetDuration:function(){for(var t=this.tracks,e=0,r=0,n=t.length;r!==n;++r){var i=this.tracks[r];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(cn.prototype,{load:function(t,e,r,n){var i=this,a=new Cr(i.manager);a.setResponseType("json"),a.load(t,function(t){e(i.parse(t))},r,n)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===r[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),r[t]}var r=this.textures,n=new Vs[t.type];if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearCoat&&(n.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(n.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(n.uniforms=t.uniforms),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(n.vertexColors=t.vertexColors),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.shading&&(n.shading=t.shading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(n.skinning=t.skinning),void 0!==t.morphTargets&&(n.morphTargets=t.morphTargets),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=e(t.map)),void 0!==t.alphaMap&&(n.alphaMap=e(t.alphaMap),n.transparent=!0),void 0!==t.bumpMap&&(n.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=e(t.normalMap)),void 0!==t.normalScale){var a=t.normalScale;!1===Array.isArray(a)&&(a=[a,a]),n.normalScale=(new i).fromArray(a)}return void 0!==t.displacementMap&&(n.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=e(t.specularMap)),void 0!==t.envMap&&(n.envMap=e(t.envMap)),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.lightMap&&(n.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=e(t.gradientMap)),n}}),Object.assign(un.prototype,{load:function(t,e,r,n){var i=this,a=new Cr(i.manager);a.setResponseType("json"),a.load(t,function(t){e(i.parse(t))},r,n)},parse:function(t){var e=new Rt,r=t.data.index;if(void 0!==r){var n=new Ys[r.type](r.array);e.setIndex(new mt(n,1))}var i=t.data.attributes;for(var a in i){var o=i[a],n=new Ys[o.type](o.array);e.addAttribute(a,new mt(n,o.itemSize,o.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,u=s.length;c!==u;++c){var l=s[c];e.addGroup(l.start,l.count,l.materialIndex)}var d=t.data.boundingSphere;if(void 0!==d){var p=new h;void 0!==d.center&&p.fromArray(d.center),e.boundingSphere=new rt(p,d.radius)}return e}});var Ys={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};hn.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,r=0,n=e.length;r<n;r+=2){var i=e[r],a=e[r+1];if(i.test(t))return a}return null}},Object.assign(hn.prototype,{crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,r){for(var n=[],i=0;i<t.length;++i)n[i]=this.createMaterial(t[i],e,r);return n},createMaterial:function(){var t={NoBlending:Ea,NormalBlending:Ta,AdditiveBlending:Sa,SubtractiveBlending:Aa,MultiplyBlending:La,CustomBlending:Ra},e=new Y,r=new Br,n=new cn;return function(i,a,o){function s(t,e,n,i,s){var u,h=a+t,l=hn.Handlers.get(h);null!==l?u=l.load(h):(r.setCrossOrigin(o),u=r.load(h)),void 0!==e&&(u.repeat.fromArray(e),1!==e[0]&&(u.wrapS=go),1!==e[1]&&(u.wrapT=go)),void 0!==n&&u.offset.fromArray(n),void 0!==i&&("repeat"===i[0]&&(u.wrapS=go),"mirror"===i[0]&&(u.wrapS=xo),"repeat"===i[1]&&(u.wrapT=go),"mirror"===i[1]&&(u.wrapT=xo)),void 0!==s&&(u.anisotropy=s);var d=Ms.generateUUID();return c[d]=u,d}var c={},u={uuid:Ms.generateUUID(),type:"MeshLambertMaterial"};for(var h in i){var l=i[h];switch(h){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=l;break;case"blending":u.blending=t[l];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",h,"is no longer supported.");break;case"colorDiffuse":u.color=e.fromArray(l).getHex();break;case"colorSpecular":u.specular=e.fromArray(l).getHex();break;case"colorEmissive":u.emissive=e.fromArray(l).getHex();break;case"specularCoef":u.shininess=l;break;case"shading":"basic"===l.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===l.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===l.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=s(l,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=s(l,i.mapEmissiveRepeat,i.mapEmissiveOffset,i.mapEmissiveWrap,i.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=s(l,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=s(l,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=s(l,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=l;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=s(l,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[l,l];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=s(l,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=s(l,i.mapMetalnessRepeat,i.mapMetalnessOffset,i.mapMetalnessWrap,i.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=s(l,i.mapRoughnessRepeat,i.mapRoughnessOffset,i.mapRoughnessWrap,i.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=s(l,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=ga;break;case"doubleSided":u.side=ya;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=l;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[h]=l;break;case"vertexColors":!0===l&&(u.vertexColors=Ma),"face"===l&&(u.vertexColors=wa);break;default:console.error("THREE.Loader.createMaterial: Unsupported",h,l)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,u.opacity<1&&(u.transparent=!0),n.setTextures(c),n.parse(u)}}()}),Object.assign(ln.prototype,{load:function(t,e,r,n){var i=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:hn.prototype.extractUrlBase(t),o=new Cr(this.manager);o.setResponseType("json"),o.setWithCredentials(this.withCredentials),o.load(t,function(r){var n=r.metadata;if(void 0!==n){var o=n.type;if(void 0!==o){if("object"===o.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===o.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var s=i.parse(r,a);e(s.geometry,s.materials)},r,n)},setTexturePath:function(t){this.texturePath=t},parse:function(){function t(t,e){function r(t,e){return t&1<<e}var n,a,o,s,c,u,l,d,p,f,m,v,g,y,x,b,_,w,M,E,T,S,A,L,R,P,C,I=t.faces,U=t.vertices,N=t.normals,O=t.colors,B=t.scale,D=0;if(void 0!==t.uvs){for(n=0;n<t.uvs.length;n++)t.uvs[n].length&&D++;for(n=0;n<D;n++)e.faceVertexUvs[n]=[]}for(s=0,c=U.length;s<c;)w=new h,w.x=U[s++]*B,w.y=U[s++]*B,w.z=U[s++]*B,e.vertices.push(w);for(s=0,c=I.length;s<c;)if(f=I[s++],m=r(f,0),v=r(f,1),g=r(f,3),y=r(f,4),x=r(f,5),b=r(f,6),_=r(f,7),m){if(E=new pt,E.a=I[s],E.b=I[s+1],E.c=I[s+3],T=new pt,T.a=I[s+1],T.b=I[s+2],T.c=I[s+3],s+=4,v&&(p=I[s++],E.materialIndex=p,T.materialIndex=p),o=e.faces.length,g)for(n=0;n<D;n++)for(L=t.uvs[n],e.faceVertexUvs[n][o]=[],e.faceVertexUvs[n][o+1]=[],a=0;a<4;a++)d=I[s++],P=L[2*d],C=L[2*d+1],R=new i(P,C),2!==a&&e.faceVertexUvs[n][o].push(R),0!==a&&e.faceVertexUvs[n][o+1].push(R);if(y&&(l=3*I[s++],E.normal.set(N[l++],N[l++],N[l]),T.normal.copy(E.normal)),x)for(n=0;n<4;n++)l=3*I[s++],A=new h(N[l++],N[l++],N[l]),2!==n&&E.vertexNormals.push(A),0!==n&&T.vertexNormals.push(A);if(b&&(u=I[s++],S=O[u],E.color.setHex(S),T.color.setHex(S)),_)for(n=0;n<4;n++)u=I[s++],S=O[u],2!==n&&E.vertexColors.push(new Y(S)),0!==n&&T.vertexColors.push(new Y(S));e.faces.push(E),e.faces.push(T)}else{if(M=new pt,M.a=I[s++],M.b=I[s++],M.c=I[s++],v&&(p=I[s++],M.materialIndex=p),o=e.faces.length,g)for(n=0;n<D;n++)for(L=t.uvs[n],e.faceVertexUvs[n][o]=[],a=0;a<3;a++)d=I[s++],P=L[2*d],C=L[2*d+1],R=new i(P,C),e.faceVertexUvs[n][o].push(R);if(y&&(l=3*I[s++],M.normal.set(N[l++],N[l++],N[l])),x)for(n=0;n<3;n++)l=3*I[s++],A=new h(N[l++],N[l++],N[l]),M.vertexNormals.push(A);if(b&&(u=I[s++],M.color.setHex(O[u])),_)for(n=0;n<3;n++)u=I[s++],M.vertexColors.push(new Y(O[u]));e.faces.push(M)}}function e(t,e){var r=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,i=t.skinWeights.length;n<i;n+=r){var a=t.skinWeights[n],s=r>1?t.skinWeights[n+1]:0,c=r>2?t.skinWeights[n+2]:0,u=r>3?t.skinWeights[n+3]:0;e.skinWeights.push(new o(a,s,c,u))}if(t.skinIndices)for(var n=0,i=t.skinIndices.length;n<i;n+=r){var h=t.skinIndices[n],l=r>1?t.skinIndices[n+1]:0,d=r>2?t.skinIndices[n+2]:0,p=r>3?t.skinIndices[n+3]:0;e.skinIndices.push(new o(h,l,d,p))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function r(t,e){var r=t.scale;if(void 0!==t.morphTargets)for(var n=0,i=t.morphTargets.length;n<i;n++){e.morphTargets[n]={},e.morphTargets[n].name=t.morphTargets[n].name,e.morphTargets[n].vertices=[];for(var a=e.morphTargets[n].vertices,o=t.morphTargets[n].vertices,s=0,c=o.length;s<c;s+=3){var u=new h;u.x=o[s]*r,u.y=o[s+1]*r,u.z=o[s+2]*r,a.push(u)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var l=e.faces,d=t.morphColors[0].colors,n=0,i=l.length;n<i;n++)l[n].color.fromArray(d,3*n)}}function n(t,e){var r=[],n=[];void 0!==t.animation&&n.push(t.animation),void 0!==t.animations&&(t.animations.length?n=n.concat(t.animations):n.push(t.animations));for(var i=0;i<n.length;i++){var a=sn.parseAnimation(n[i],e.bones);a&&r.push(a)}if(e.morphTargets){var o=sn.CreateClipsFromMorphTargetSequences(e.morphTargets,10);r=r.concat(o)}r.length>0&&(e.animations=r)}return function(i,a){void 0!==i.data&&(i=i.data),void 0!==i.scale?i.scale=1/i.scale:i.scale=1;var o=new Lt;return t(i,o),e(i,o),r(i,o),n(i,o),o.computeFaceNormals(),o.computeBoundingSphere(),void 0===i.materials||0===i.materials.length?{geometry:o}:{geometry:o,materials:hn.prototype.initMaterials(i.materials,a,this.crossOrigin)}}}()}),Object.assign(dn.prototype,{load:function(t,e,r,n){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new Cr(i.manager).load(t,function(r){var a=null;try{a=JSON.parse(r)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");i.parse(a,e)},r,n)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var r=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(o)}),i=this.parseTextures(t.textures,n),a=this.parseMaterials(t.materials,i),o=this.parseObject(t.object,r,a);return t.animations&&(o.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(o),o},parseGeometries:function(t){var e={};if(void 0!==t)for(var r=new ln,n=new un,i=0,a=t.length;i<a;i++){var o,s=t[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Hs[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Hs[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Hs[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Hs[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Hs[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Hs[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new Hs[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Hs[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Hs[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Hs[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Hs[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":o=r.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),e[s.uuid]=o}return e},parseMaterials:function(t,e){var r={};if(void 0!==t){var n=new cn;n.setTextures(e);for(var i=0,a=t.length;i<a;i++){var o=t[i];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(n.parse(o.materials[c]));r[o.uuid]=s}else r[o.uuid]=n.parse(o)}}return r},parseAnimations:function(t){for(var e=[],r=0;r<t.length;r++){var n=sn.parse(t[r]);e.push(n)}return e},parseImages:function(t,e){var r=this,n={};if(void 0!==t&&t.length>0){var i=new Pr(e),a=new Nr(i);a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var c=t[o],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:r.texturePath+c.url;n[c.uuid]=function(t){return r.manager.itemStart(t),a.load(t,function(){r.manager.itemEnd(t)},void 0,function(){r.manager.itemEnd(t),r.manager.itemError(t)})}(u)}}return n},parseTextures:function(t,e){function r(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var n={};if(void 0!==t)for(var i=0,o=t.length;i<o;i++){var s=t[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new a(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=r(s.mapping,Zs)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=r(s.wrap[0],Js),c.wrapT=r(s.wrap[1],Js)),void 0!==s.minFilter&&(c.minFilter=r(s.minFilter,Qs)),void 0!==s.magFilter&&(c.magFilter=r(s.magFilter,Qs)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),n[s.uuid]=c}return n},parseObject:function(){var t=new l;return function(e,r,n){function i(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,i=t.length;r<i;r++){var a=t[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(n[a])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}var o;switch(e.type){case"Scene":o=new ye,void 0!==e.background&&Number.isInteger(e.background)&&(o.background=new Y(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?o.fog=new ge(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(o.fog=new ve(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Bt(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(o.focus=e.focus),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.filmGauge&&(o.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(o.filmOffset=e.filmOffset),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Dt(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":o=new Wr(e.color,e.intensity);break;case"DirectionalLight":o=new jr(e.color,e.intensity);break;case"PointLight":o=new Hr(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Xr(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new kr(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new Fr(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var s=i(e.geometry),c=a(e.material);o=s.bones&&s.bones.length>0?new Te(s,c):new Pt(s,c);break;case"LOD":o=new we;break;case"Line":o=new Ae(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":o=new Re(i(e.geometry),a(e.material));break;case"LineSegments":o=new Le(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":o=new Ce(i(e.geometry),a(e.material));break;case"Sprite":o=new _e(a(e.material));break;case"Group":o=new Ie;break;default:o=new ht}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.quaternion&&o.quaternion.fromArray(e.quaternion),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(o.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(o.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&o.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(o.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.children)for(var u in e.children)o.add(this.parseObject(e.children[u],r,n));if("LOD"===e.type)for(var h=e.levels,l=0;l<h.length;l++){var d=h[l],u=o.getObjectByProperty("uuid",d.object);void 0!==u&&o.addLevel(u,d.distance)}return o}}()});var Zs={UVMapping:co,CubeReflectionMapping:uo,CubeRefractionMapping:ho,EquirectangularReflectionMapping:lo,EquirectangularRefractionMapping:po,SphericalReflectionMapping:fo,CubeUVReflectionMapping:mo,CubeUVRefractionMapping:vo},Js={RepeatWrapping:go,ClampToEdgeWrapping:yo,MirroredRepeatWrapping:xo},Qs={NearestFilter:bo,NearestMipMapNearestFilter:_o,NearestMipMapLinearFilter:wo,LinearFilter:Mo,LinearMipMapNearestFilter:Eo,LinearMipMapLinearFilter:To};Object.assign(Mn.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,r,n=[],i=this.getPoint(0),a=0;for(n.push(0),r=1;r<=t;r++)e=this.getPoint(r/t),a+=e.distanceTo(i),n.push(a),i=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var r,n=this.getLengths(),i=0,a=n.length;r=e||t*n[a-1];for(var o,s=0,c=a-1;s<=c;)if(i=Math.floor(s+(c-s)/2),(o=n[i]-r)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(i=c,n[i]===r)return i/(a-1);var u=n[i];return(i+(r-u)/(n[i+1]-u))/(a-1)},getTangent:function(t){var e=t-1e-4,r=t+1e-4;e<0&&(e=0),r>1&&(r=1);var n=this.getPoint(e);return this.getPoint(r).clone().sub(n).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var r,n,i,a=new h,o=[],s=[],c=[],u=new h,d=new l;for(r=0;r<=t;r++)n=r/t,o[r]=this.getTangentAt(n),o[r].normalize();s[0]=new h,c[0]=new h;var p=Number.MAX_VALUE,f=Math.abs(o[0].x),m=Math.abs(o[0].y),v=Math.abs(o[0].z);for(f<=p&&(p=f,a.set(1,0,0)),m<=p&&(p=m,a.set(0,1,0)),v<=p&&a.set(0,0,1),u.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],u),c[0].crossVectors(o[0],s[0]),r=1;r<=t;r++)s[r]=s[r-1].clone(),c[r]=c[r-1].clone(),u.crossVectors(o[r-1],o[r]),u.length()>Number.EPSILON&&(u.normalize(),i=Math.acos(Ms.clamp(o[r-1].dot(o[r]),-1,1)),s[r].applyMatrix4(d.makeRotationAxis(u,i))),c[r].crossVectors(o[r],s[r]);if(!0===e)for(i=Math.acos(Ms.clamp(s[0].dot(s[t]),-1,1)),i/=t,o[0].dot(u.crossVectors(s[0],s[t]))>0&&(i=-i),r=1;r<=t;r++)s[r].applyMatrix4(d.makeRotationAxis(o[r],i*r)),c[r].crossVectors(o[r],s[r]);return{tangents:o,normals:s,binormals:c}}}),En.prototype=Object.create(Mn.prototype),En.prototype.constructor=En,En.prototype.isLineCurve=!0,En.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},En.prototype.getPointAt=function(t){return this.getPoint(t)},En.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Tn.prototype=Object.assign(Object.create(Mn.prototype),{constructor:Tn,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new En(e,t))},getPoint:function(t){for(var e=t*this.getLength(),r=this.getCurveLengths(),n=0;n<r.length;){if(r[n]>=e){var i=r[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,r=[],n=0,i=this.curves;n<i.length;n++)for(var a=i[n],o=a&&a.isEllipseCurve?2*t:a&&a.isLineCurve?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var u=s[c];e&&e.equals(u)||(r.push(u),e=u)}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new Lt,r=0,n=t.length;r<n;r++){var i=t[r];e.vertices.push(new h(i.x,i.y,i.z||0))}return e}}),Sn.prototype=Object.create(Mn.prototype),Sn.prototype.constructor=Sn,Sn.prototype.isEllipseCurve=!0,Sn.prototype.getPoint=function(t){for(var e=2*Math.PI,r=this.aEndAngle-this.aStartAngle,n=Math.abs(r)<Number.EPSILON;r<0;)r+=e;for(;r>e;)r-=e;r<Number.EPSILON&&(r=n?0:e),!0!==this.aClockwise||n||(r===e?r=-e:r-=e);var a=this.aStartAngle+t*r,o=this.aX+this.xRadius*Math.cos(a),s=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=o-this.aX,l=s-this.aY;o=h*c-l*u+this.aX,s=h*u+l*c+this.aY}return new i(o,s)},An.prototype=Object.create(Mn.prototype),An.prototype.constructor=An,An.prototype.isSplineCurve=!0,An.prototype.getPoint=function(t){var e=this.points,r=(e.length-1)*t,n=Math.floor(r),a=r-n,o=e[0===n?n:n-1],s=e[n],c=e[n>e.length-2?e.length-1:n+1],u=e[n>e.length-3?e.length-1:n+2];return new i(pn(a,o.x,s.x,c.x,u.x),pn(a,o.y,s.y,c.y,u.y))},Ln.prototype=Object.create(Mn.prototype),Ln.prototype.constructor=Ln,Ln.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2,a=this.v3;return new i(wn(t,e.x,r.x,n.x,a.x),wn(t,e.y,r.y,n.y,a.y))},Rn.prototype=Object.create(Mn.prototype),Rn.prototype.constructor=Rn,Rn.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2;return new i(gn(t,e.x,r.x,n.x),gn(t,e.y,r.y,n.y))};var Ks=Object.assign(Object.create(Tn.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,r=t.length;e<r;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var r=new En(this.currentPoint.clone(),new i(t,e));this.curves.push(r),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,r,n){var a=new Rn(this.currentPoint.clone(),new i(t,e),new i(r,n));this.curves.push(a),this.currentPoint.set(r,n)},bezierCurveTo:function(t,e,r,n,a,o){var s=new Ln(this.currentPoint.clone(),new i(t,e),new i(r,n),new i(a,o));this.curves.push(s),this.currentPoint.set(a,o)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),r=new An(e);this.curves.push(r),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,r,n,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,r,n,i,a)},absarc:function(t,e,r,n,i,a){this.absellipse(t,e,r,r,n,i,a)},ellipse:function(t,e,r,n,i,a,o,s){var c=this.currentPoint.x,u=this.currentPoint.y;this.absellipse(t+c,e+u,r,n,i,a,o,s)},absellipse:function(t,e,r,n,i,a,o,s){var c=new Sn(t,e,r,n,i,a,o,s);if(this.curves.length>0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});Pn.prototype=Ks,Ks.constructor=Pn,Cn.prototype=Object.assign(Object.create(Ks),{constructor:Cn,getPointsHoles:function(t){for(var e=[],r=0,n=this.holes.length;r<n;r++)e[r]=this.holes[r].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(In.prototype,{moveTo:function(t,e){this.currentPath=new Pn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,r,n){this.currentPath.quadraticCurveTo(t,e,r,n)},bezierCurveTo:function(t,e,r,n,i,a){this.currentPath.bezierCurveTo(t,e,r,n,i,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function r(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r],a=new Cn;a.curves=i.curves,e.push(a)}return e}var n=ks.isClockWise,i=this.subPaths;if(0===i.length)return[];if(!0===e)return r(i);var a,o,s,c=[];if(1===i.length)return o=i[0],s=new Cn,s.curves=o.curves,c.push(s),c;var u=!n(i[0].getPoints());u=t?!u:u;var h,l=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,v=i.length;m<v;m++)o=i[m],h=o.getPoints(),a=n(h),a=t?!a:a,a?(!u&&d[f]&&f++,d[f]={s:new Cn,p:h},d[f].s.curves=o.curves,u&&f++,p[f]=[]):p[f].push({h:o,p:h[0]});if(!d[0])return r(i);if(d.length>1){for(var g=!1,y=[],x=0,b=d.length;x<b;x++)l[x]=[];for(var x=0,b=d.length;x<b;x++)for(var _=p[x],w=0;w<_.length;w++){for(var M=_[w],E=!0,T=0;T<d.length;T++)(function(t,e){for(var r=e.length,n=!1,i=r-1,a=0;a<r;i=a++){var o=e[i],s=e[a],c=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=e[a],c=-c,s=e[i],u=-u),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var h=u*(t.x-o.x)-c*(t.y-o.y);if(0===h)return!0;if(h<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n})(M.p,d[T].p)&&(x!==T&&y.push({froms:x,tos:T,hole:w}),E?(E=!1,l[T].push(M)):g=!0);E&&l[x].push(M)}y.length>0&&(g||(p=l))}for(var S,m=0,A=d.length;m<A;m++){s=d[m].s,c.push(s),S=p[m];for(var L=0,R=S.length;L<R;L++)s.holes.push(S[L].h)}return c}}),Object.assign(Un.prototype,{isFont:!0,generateShapes:function(t,e,r){function n(t,e,n,a){var o=i.glyphs[t]||i.glyphs["?"];if(o){var s,c,u,h,l,d,p,f,m,v,g,y=new In,x=[];if(o.o)for(var b=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),_=0,w=b.length;_<w;){var M=b[_++];switch(M){case"m":s=b[_++]*e+n,c=b[_++]*e+a,y.moveTo(s,c);break;case"l":s=b[_++]*e+n,c=b[_++]*e+a,y.lineTo(s,c);break;case"q":if(u=b[_++]*e+n,h=b[_++]*e+a,p=b[_++]*e+n,f=b[_++]*e+a,y.quadraticCurveTo(p,f,u,h),g=x[x.length-1]){l=g.x,d=g.y;for(var E=1;E<=r;E++){var T=E/r;gn(T,l,p,u),gn(T,d,f,h)}}break;case"b":if(u=b[_++]*e+n,h=b[_++]*e+a,p=b[_++]*e+n,f=b[_++]*e+a,m=b[_++]*e+n,v=b[_++]*e+a,y.bezierCurveTo(p,f,m,v,u,h),g=x[x.length-1]){l=g.x,d=g.y;for(var E=1;E<=r;E++){var T=E/r;wn(T,l,p,m,u),wn(T,d,f,v,h)}}}}return{offsetX:o.ha*e,path:y}}}void 0===e&&(e=100),void 0===r&&(r=4);for(var i=this.data,a=function(t){for(var r=String(t).split(""),a=e/i.resolution,o=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*a,s=0,c=0,u=[],h=0;h<r.length;h++){var l=r[h];if("\n"===l)s=0,c-=o;else{var d=n(l,a,s,c);s+=d.offsetX,u.push(d.path)}}return u}(t),o=[],s=0,c=a.length;s<c;s++)Array.prototype.push.apply(o,a[s].toShapes());return o}}),Object.assign(Nn.prototype,{load:function(t,e,r,n){var i=this;new Cr(this.manager).load(t,function(t){var r;try{r=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(t.substring(65,t.length-2))}var n=i.parse(r);e&&e(n)},r,n)},parse:function(t){return new Un(t)}});var $s,tc={getContext:function(){return void 0===$s&&($s=new(window.AudioContext||window.webkitAudioContext)),$s},setContext:function(t){$s=t}};Object.assign(On.prototype,{load:function(t,e,r,n){var i=new Cr(this.manager);i.setResponseType("arraybuffer"),i.load(t,function(t){tc.getContext().decodeAudioData(t,function(t){e(t)})},r,n)}}),Object.assign(Bn.prototype,{update:function(){var t,e,r,n,i,a,o,s,c=new l,u=new l;return function(h){if(t!==this||e!==h.focus||r!==h.fov||n!==h.aspect*this.aspect||i!==h.near||a!==h.far||o!==h.zoom||s!==this.eyeSep){t=this,e=h.focus,r=h.fov,n=h.aspect*this.aspect,i=h.near,a=h.far,o=h.zoom;var l=h.projectionMatrix.clone();s=this.eyeSep/2;var d,p,f=s*i/e,m=i*Math.tan(Ms.DEG2RAD*r*.5)/o;u.elements[12]=-s,c.elements[12]=s,d=-m*n+f,p=m*n+f,l.elements[0]=2*i/(p-d),l.elements[8]=(p+d)/(p-d),this.cameraL.projectionMatrix.copy(l),d=-m*n-f,p=m*n-f,l.elements[0]=2*i/(p-d),l.elements[8]=(p+d)/(p-d),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(u),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(c)}}()}),Dn.prototype=Object.create(ht.prototype),Dn.prototype.constructor=Dn,Fn.prototype=Object.assign(Object.create(Bt.prototype),{constructor:Fn,isArrayCamera:!0}),zn.prototype=Object.assign(Object.create(ht.prototype),{constructor:zn,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new h,e=new u,r=new h,n=new h;return function(i){ht.prototype.updateMatrixWorld.call(this,i);var a=this.context.listener,o=this.up;this.matrixWorld.decompose(t,e,r),n.set(0,0,-1).applyQuaternion(e),a.positionX?(a.positionX.setValueAtTime(t.x,this.context.currentTime),a.positionY.setValueAtTime(t.y,this.context.currentTime),a.positionZ.setValueAtTime(t.z,this.context.currentTime),a.forwardX.setValueAtTime(n.x,this.context.currentTime),a.forwardY.setValueAtTime(n.y,this.context.currentTime),a.forwardZ.setValueAtTime(n.z,this.context.currentTime),a.upX.setValueAtTime(o.x,this.context.currentTime),a.upY.setValueAtTime(o.y,this.context.currentTime),a.upZ.setValueAtTime(o.z,this.context.currentTime)):(a.setPosition(t.x,t.y,t.z),a.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z))}}()}),Gn.prototype=Object.assign(Object.create(ht.prototype),{constructor:Gn,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()},pause:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this)},stop:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0,this.isPlaying=!1,this)},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),kn.prototype=Object.assign(Object.create(Gn.prototype),{constructor:kn,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new h;return function(e){ht.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Hn.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),r=0;r<e.length;r++)t+=e[r];return t/e.length}}),Object.assign(Vn.prototype,{accumulate:function(t,e){var r=this.buffer,n=this.valueSize,i=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)r[i+o]=r[o];a=e}else{a+=e;var s=e/a;this._mixBufferRegion(r,i,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,r=this.buffer,n=t*e+e,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*e;this._mixBufferRegion(r,n,o,1-i,e)}for(var s=e,c=e+e;s!==c;++s)if(r[s]!==r[s+e]){a.setValue(r,n);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,r=this.valueSize,n=3*r;t.getValue(e,n);for(var i=r,a=n;i!==a;++i)e[i]=e[n+i%r];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,r,n,i){if(n>=.5)for(var a=0;a!==i;++a)t[e+a]=t[r+a]},_slerp:function(t,e,r,n){u.slerpFlat(t,e,t,e,t,r,n)},_lerp:function(t,e,r,n,i){for(var a=1-n,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[r+o]*n}}}),Object.assign(jn.prototype,{getValue:function(t,e){this.bind();var r=this._targetGroup.nCachedObjects_,n=this._bindings[r];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,r=t.length;e!==r;++e)t[e].unbind()}}),Object.assign(Wn,{Composite:jn,create:function(t,e,r){return t&&t.isAnimationObjectGroup?new Wn.Composite(t,e,r):new Wn(t,e,r)},parseTrackName:function(){var t=/((?:[\w-]+[\/:])*)/,e=/([\w-\.]+)?/,r=/(?:\.([\w-]+)(?:\[(.+)\])?)?/,n=/\.([\w-]+)(?:\[(.+)\])?/,i=new RegExp("^"+t.source+e.source+r.source+n.source+"$"),a=["material","materials","bones"];return function(t){var e=i.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var r={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){var o=r.nodeName.substring(n+1);-1!==a.indexOf(o)&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=o)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return r}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var r=function(t){for(var r=0;r<t.bones.length;r++){var n=t.bones[r];if(n.name===e)return n}return null}(t.skeleton);if(r)return r}if(t.children){var n=function(t){for(var r=0;r<t.length;r++){var i=t[r];if(i.name===e||i.uuid===e)return i;var a=n(i.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}}),Object.assign(Wn.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)t[e++]=r[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++]},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,r=e.objectName,n=e.propertyName,i=e.propertyIndex;if(t||(t=Wn.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(r){var a=e.objectIndex;switch(r){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[r])return void console.error(" can not bind to objectName of node, undefined",this);t=t[r]}if(void 0!==a){if(void 0===t[a])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[a]}}var s=t[n];if(void 0===s){var c=e.nodeName;return void console.error(" trying to update property for track: "+c+"."+n+" but it wasn't found.",t)}var u=this.Versioning.None;void 0!==t.needsUpdate?(u=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===i){i=o;break}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][u]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Wn.prototype,{_getValue_unbound:Wn.prototype.getValue,_setValue_unbound:Wn.prototype.setValue}),Object.assign(Xn.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,u=0,h=arguments.length;u!==h;++u){var l=arguments[u],d=l.uuid,p=i[d],f=void 0;if(void 0===p){p=r++,i[d]=p,e.push(l);for(var m=0,v=c;m!==v;++m)s[m].push(new Wn(l,a[m],o[m]))}else if(p<n){f=e[p];var g=--n,y=e[g];i[y.uuid]=p,e[p]=y,i[d]=g,e[g]=l;for(var m=0,v=c;m!==v;++m){var x=s[m],b=x[g],_=x[p];x[p]=b,void 0===_&&(_=new Wn(l,a[m],o[m])),x[g]=_}}else e[p]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=n},remove:function(t){for(var e=this._objects,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],u=c.uuid,h=n[u];if(void 0!==h&&h>=r){var l=r++,d=e[l];n[d.uuid]=h,e[h]=d,n[u]=l,e[l]=c;for(var p=0,f=a;p!==f;++p){var m=i[p],v=m[l],g=m[h];m[h]=v,m[l]=g}}}this.nCachedObjects_=r},uncache:function(t){for(var e=this._objects,r=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var u=arguments[s],h=u.uuid,l=i[h];if(void 0!==l)if(delete i[h],l<n){var d=--n,p=e[d],f=--r,m=e[f];i[p.uuid]=l,e[l]=p,i[m.uuid]=d,e[d]=m,e.pop();for(var v=0,g=o;v!==g;++v){var y=a[v],x=y[d],b=y[f];y[l]=x,y[d]=b,y.pop()}}else{var f=--r,m=e[f];i[m.uuid]=l,e[l]=m,e.pop();for(var v=0,g=o;v!==g;++v){var y=a[v];y[l]=y[f],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var r=this._bindingsIndicesByPath,n=r[t],i=this._bindings;if(void 0!==n)return i[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,h=new Array(c);n=i.length,r[t]=n,a.push(t),o.push(e),i.push(h);for(var l=u,d=s.length;l!==d;++l){var p=s[l];h[l]=new Wn(p,t,e)}return h},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,r=e[t];if(void 0!==r){var n=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=r,a[r]=s,a.pop(),i[r]=i[o],i.pop(),n[r]=n[o],n.pop()}}}),Object.assign(qn.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,r){if(t.fadeOut(e),this.fadeIn(e),r){var n=this._clip.duration,i=t._clip.duration,a=i/n,o=n/i;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,r){return t.crossFadeFrom(this,e,r)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,r){var n=this._mixer,i=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+r,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,r,n){if(!this.enabled)return void this._updateWeight(t);var i=this._startTime;if(null!==i){var a=(t-i)*r;if(a<0||0===r)return;this._startTime=null,e=r*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,u=this._propertyBindings,h=0,l=c.length;h!==l;++h)c[h].evaluate(o),u[h].accumulate(n,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(t)[0];e*=n,t>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r){e*=r.evaluate(t)[0],t>r.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var r=this._clip.duration,n=this.loop,i=this._loopCount;if(n===es){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=r)e=r;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var a=n===ns;if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=r||e<0){var o=Math.floor(e/r);e-=r*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&i))return this.time=e,r-e}return this.time=e,e},_setEndings:function(t,e,r){var n=this._interpolantSettings;r?(n.endingStart=cs,n.endingEnd=cs):(n.endingStart=t?this.zeroSlopeAtStart?cs:ss:us,n.endingEnd=e?this.zeroSlopeAtEnd?cs:ss:us)},_scheduleFading:function(t,e,r){var n=this._mixer,i=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=r,this}}),Object.assign(Yn.prototype,n.prototype,{_bindAction:function(t,e){var r=t._localRoot||this._root,n=t._clip.tracks,i=n.length,a=t._propertyBindings,o=t._interpolants,s=r.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var h=0;h!==i;++h){var l=n[h],d=l.name,p=u[d];if(void 0!==p)a[h]=p;else{if(void 0!==(p=a[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[h].binding.parsedPath;p=new Vn(Wn.create(r,d,f),l.ValueTypeName,l.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,d),a[h]=p}o[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,r=t._clip.uuid,n=this._actionsByClip[r];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,r,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,r){var n=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[r]=t},_removeInactiveAction:function(t){var e=this._actions,r=e[e.length-1],n=t._cacheIndex;r._cacheIndex=n,e[n]=r,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],u=t._byClipCacheIndex;c._byClipCacheIndex=u,s[u]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,r=0,n=e.length;r!==n;++r){var i=e[r];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,r=t._cacheIndex,n=this._nActiveActions++,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_takeBackAction:function(t){var e=this._actions,r=t._cacheIndex,n=--this._nActiveActions,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_addInactiveBinding:function(t,e,r){var n=this._bindingsByRootAndName,i=n[e],a=this._bindings;void 0===i&&(i={},n[e]=i),i[r]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,r=t.binding,n=r.rootNode.uuid,i=r.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[i];t:{for(var u in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,r=t._cacheIndex,n=this._nActiveBindings++,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_takeBackBinding:function(t){var e=this._bindings,r=t._cacheIndex,n=--this._nActiveBindings,i=e[n];t._cacheIndex=n,e[n]=t,i._cacheIndex=r,e[r]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,r=t[e];return void 0===r&&(r=new Zr(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=e,t[e]=r),r},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,r=t.__cacheIndex,n=--this._nActiveControlInterpolants,i=e[n];t.__cacheIndex=n,e[n]=t,i.__cacheIndex=r,e[r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var r=e||this._root,n=r.uuid,i="string"==typeof t?sn.findByName(r,t):t,a=null!==i?i.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var u=new qn(this,i,e);return this._bindAction(u,s),this._addInactiveAction(u,a,n),u},existingAction:function(t,e){var r=e||this._root,n=r.uuid,i="string"==typeof t?sn.findByName(r,t):t,a=i?i.uuid:t,o=this._actionsByClip[a];return void 0!==o?o.actionByRoot[n]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,r=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==e;++i)t[i].reset();for(var i=0;i!==n;++i)r[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,r=this._nActiveActions,n=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==r;++o){e[o]._update(n,t,i,a)}for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,r=t.uuid,n=this._actionsByClip,i=n[r];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var u=c._cacheIndex,h=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,e[u]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}},uncacheRoot:function(t){var e=t.uuid,r=this._actionsByClip;for(var n in r){var i=r[n].actionByRoot,a=i[e];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[e];if(void 0!==s)for(var c in s){var u=s[c];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(t,e){var r=this.existingAction(t,e);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),Zn.prototype.clone=function(){return new Zn(void 0===this.value.clone?this.value:this.value.clone())},Jn.prototype=Object.assign(Object.create(Rt.prototype),{constructor:Jn,isInstancedBufferGeometry:!0,addGroup:function(t,e,r){this.groups.push({start:t,count:e,materialIndex:r})},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var r=t.attributes;for(var n in r){var i=r[n];this.addAttribute(n,i.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this}}),Object.defineProperties(Qn.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Qn.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this},setXYZ:function(t,e,r,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=n,this},setXYZW:function(t,e,r,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=r,this.data.array[t+2]=n,this.data.array[t+3]=i,this}}),Object.defineProperty(Kn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Kn.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,r){t*=this.stride,r*=e.stride;for(var n=0,i=this.stride;n<i;n++)this.array[t+n]=e.array[r+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),$n.prototype=Object.assign(Object.create(Kn.prototype),{constructor:$n,isInstancedInterleavedBuffer:!0,copy:function(t){return Kn.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),ti.prototype=Object.assign(Object.create(mt.prototype),{constructor:ti,isInstancedBufferAttribute:!0,copy:function(t){return mt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(ei.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var r=[];return ni(t,this,r,e),r.sort(ri),r},intersectObjects:function(t,e){var r=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var n=0,i=t.length;n<i;n++)ni(t[n],this,r,e);return r.sort(ri),r}}),Object.assign(ii.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(ai.prototype,{set:function(t,e,r){return this.radius=t,this.phi=e,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(Ms.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(oi.prototype,{set:function(t,e,r){return this.radius=t,this.theta=e,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),si.prototype=Object.create(Pt.prototype),si.prototype.constructor=si,si.prototype.createAnimation=function(t,e,r,n){var i={start:e,end:r,length:r-e+1,fps:n,duration:(r-e)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=i,this.animationsList.push(i)},si.prototype.autoCreateAnimations=function(t){for(var e,r=/([a-z]+)_?(\d+)/i,n={},i=this.geometry,a=0,o=i.morphTargets.length;a<o;a++){var s=i.morphTargets[a],c=s.name.match(r);if(c&&c.length>1){var u=c[1];n[u]||(n[u]={start:1/0,end:-1/0});var h=n[u];a<h.start&&(h.start=a),a>h.end&&(h.end=a),e||(e=u)}}for(var u in n){var h=n[u];this.createAnimation(u,h.start,h.end,t)}this.firstAnimation=e},si.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},si.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},si.prototype.setAnimationFPS=function(t,e){var r=this.animationsMap[t];r&&(r.fps=e,r.duration=(r.end-r.start)/r.fps)},si.prototype.setAnimationDuration=function(t,e){var r=this.animationsMap[t];r&&(r.duration=e,r.fps=(r.end-r.start)/r.duration)},si.prototype.setAnimationWeight=function(t,e){var r=this.animationsMap[t];r&&(r.weight=e)},si.prototype.setAnimationTime=function(t,e){var r=this.animationsMap[t];r&&(r.time=e)},si.prototype.getAnimationTime=function(t){var e=0,r=this.animationsMap[t];return r&&(e=r.time),e},si.prototype.getAnimationDuration=function(t){var e=-1,r=this.animationsMap[t];return r&&(e=r.duration),e},si.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},si.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},si.prototype.update=function(t){for(var e=0,r=this.animationsList.length;e<r;e++){var n=this.animationsList[e];if(n.active){var i=n.duration/n.length;n.time+=n.direction*t,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var a=n.start+Ms.clamp(Math.floor(n.time/i),0,n.length-1),o=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*o,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a);var s=n.time%i/i;n.directionBackwards&&(s=1-s),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=s*o,this.morphTargetInfluences[n.lastFrame]=(1-s)*o):this.morphTargetInfluences[n.currentFrame]=o}}},ci.prototype=Object.create(ht.prototype),ci.prototype.constructor=ci,ci.prototype.isImmediateRenderObject=!0,ui.prototype=Object.create(Le.prototype),ui.prototype.constructor=ui,ui.prototype.update=function(){var t=new h,e=new h,r=new nt;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,u=0,h=0,l=c.length;h<l;h++)for(var d=c[h],p=0,f=d.vertexNormals.length;p<f;p++){var m=s[d[n[p]]],v=d.vertexNormals[p];t.copy(m).applyMatrix4(i),e.copy(v).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),a.setXYZ(u,t.x,t.y,t.z),u+=1,a.setXYZ(u,e.x,e.y,e.z),u+=1}else if(o&&o.isBufferGeometry)for(var g=o.attributes.position,y=o.attributes.normal,u=0,p=0,f=g.count;p<f;p++)t.set(g.getX(p),g.getY(p),g.getZ(p)).applyMatrix4(i),e.set(y.getX(p),y.getY(p),y.getZ(p)),e.applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),a.setXYZ(u,t.x,t.y,t.z),u+=1,a.setXYZ(u,e.x,e.y,e.z),u+=1;a.needsUpdate=!0}}(),hi.prototype=Object.create(ht.prototype),hi.prototype.constructor=hi,hi.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},hi.prototype.update=function(){var t=new h,e=new h;return function(){var r=this.light.distance?this.light.distance:1e3,n=r*Math.tan(this.light.angle);this.cone.scale.set(n,n,r),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color)}}(),li.prototype=Object.create(Le.prototype),li.prototype.constructor=li,li.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var r=0;r<t.children.length;r++)e.push.apply(e,this.getBoneList(t.children[r]));return e},li.prototype.update=function(){var t=new h,e=new l,r=new l;return function(){var n=this.geometry,i=n.getAttribute("position");r.getInverse(this.root.matrixWorld);for(var a=0,o=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(e.multiplyMatrices(r,s.matrixWorld),t.setFromMatrixPosition(e),i.setXYZ(o,t.x,t.y,t.z),e.multiplyMatrices(r,s.parent.matrixWorld),t.setFromMatrixPosition(e),i.setXYZ(o+1,t.x,t.y,t.z),o+=2)}n.getAttribute("position").needsUpdate=!0}}(),di.prototype=Object.create(Pt.prototype),di.prototype.constructor=di,di.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},di.prototype.update=function(){this.material.color.copy(this.light.color)},pi.prototype=Object.create(ht.prototype),pi.prototype.constructor=pi,pi.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},pi.prototype.update=function(){var t=this.children[0];t.material.color.copy(this.light.color);var e=.5*this.light.width,r=.5*this.light.height,n=t.geometry.attributes.position,i=n.array;i[0]=e,i[1]=-r,i[2]=0,i[3]=e,i[4]=r,i[5]=0,i[6]=-e,i[7]=r,i[8]=0,i[9]=-e,i[10]=-r,i[11]=0,i[12]=e,i[13]=-r,i[14]=0,n.needsUpdate=!0},fi.prototype=Object.create(ht.prototype),fi.prototype.constructor=fi,fi.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},fi.prototype.update=function(){var t=new h,e=new Y,r=new Y;return function(){var n=this.children[0],i=n.geometry.getAttribute("color");e.copy(this.light.color),r.copy(this.light.groundColor);for(var a=0,o=i.count;a<o;a++){var s=a<o/2?e:r;i.setXYZ(a,s.r,s.g,s.b)}n.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),i.needsUpdate=!0}}(),mi.prototype=Object.create(Le.prototype),mi.prototype.constructor=mi,vi.prototype=Object.create(Le.prototype),vi.prototype.constructor=vi,gi.prototype=Object.create(Le.prototype),gi.prototype.constructor=gi,gi.prototype.update=function(){var t=new h,e=new h,r=new nt;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,i=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,u=0,h=s.length;u<h;u++){var l=s[u],d=l.normal;t.copy(o[l.a]).add(o[l.b]).add(o[l.c]).divideScalar(3).applyMatrix4(n),e.copy(d).applyMatrix3(r).normalize().multiplyScalar(this.size).add(t),i.setXYZ(c,t.x,t.y,t.z),c+=1,i.setXYZ(c,e.x,e.y,e.z),c+=1}i.needsUpdate=!0}}(),yi.prototype=Object.create(ht.prototype),yi.prototype.constructor=yi,yi.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},yi.prototype.update=function(){var t=new h,e=new h,r=new h;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(e,t);var n=this.children[0],i=this.children[1];n.lookAt(r),n.material.color.copy(this.light.color),i.lookAt(r),i.scale.z=r.length()}}(),xi.prototype=Object.create(Le.prototype),xi.prototype.constructor=xi,xi.prototype.update=function(){function t(t,a,o,s){n.set(a,o,s).unproject(i);var c=r[t];if(void 0!==c)for(var u=e.getAttribute("position"),h=0,l=c.length;h<l;h++)u.setXYZ(c[h],n.x,n.y,n.z)}var e,r,n=new h,i=new Ot;return function(){e=this.geometry,r=this.pointMap;i.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),bi.prototype=Object.create(Le.prototype),bi.prototype.constructor=bi,bi.prototype.update=function(){var t=new et;return function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){var r=t.min,n=t.max,i=this.geometry.attributes.position,a=i.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=r.x,a[4]=n.y,a[5]=n.z,a[6]=r.x,a[7]=r.y,a[8]=n.z,a[9]=n.x,a[10]=r.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=r.z,a[15]=r.x,a[16]=n.y,a[17]=r.z,a[18]=r.x,a[19]=r.y,a[20]=r.z,a[21]=n.x,a[22]=r.y,a[23]=r.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),bi.prototype.setFromObject=function(t){return this.object=t,this.update(),this};var ec,rc;_i.prototype=Object.create(ht.prototype),_i.prototype.constructor=_i,_i.prototype.setDirection=function(){var t,e=new h;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(r.z,0,-r.x).normalize(),t=Math.acos(r.y),this.quaternion.setFromAxisAngle(e,t))}}(),_i.prototype.setLength=function(t,e,r){void 0===e&&(e=.2*t),void 0===r&&(r=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(r,e,r),this.cone.position.y=t,this.cone.updateMatrix()},_i.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},wi.prototype=Object.create(Le.prototype),wi.prototype.constructor=wi;var nc=new h,ic=new Mi,ac=new Mi,oc=new Mi;Ei.prototype=Object.create(Mn.prototype),Ei.prototype.constructor=Ei,Ei.prototype.getPoint=function(t){var e=this.points,r=e.length;r<2&&console.log("duh, you need at least 2 points");var n=(r-(this.closed?0:1))*t,i=Math.floor(n),a=n-i;this.closed?i+=i>0?0:(Math.floor(Math.abs(i)/e.length)+1)*e.length:0===a&&i===r-1&&(i=r-2,a=1);var o,s,c,u;if(this.closed||i>0?o=e[(i-1)%r]:(nc.subVectors(e[0],e[1]).add(e[0]),o=nc),s=e[i%r],c=e[(i+1)%r],this.closed||i+2<r?u=e[(i+2)%r]:(nc.subVectors(e[r-1],e[r-2]).add(e[r-1]),u=nc),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var l="chordal"===this.type?.5:.25,d=Math.pow(o.distanceToSquared(s),l),p=Math.pow(s.distanceToSquared(c),l),f=Math.pow(c.distanceToSquared(u),l);p<1e-4&&(p=1),d<1e-4&&(d=p),f<1e-4&&(f=p),ic.initNonuniformCatmullRom(o.x,s.x,c.x,u.x,d,p,f),ac.initNonuniformCatmullRom(o.y,s.y,c.y,u.y,d,p,f),oc.initNonuniformCatmullRom(o.z,s.z,c.z,u.z,d,p,f)}else if("catmullrom"===this.type){var m=void 0!==this.tension?this.tension:.5;ic.initCatmullRom(o.x,s.x,c.x,u.x,m),ac.initCatmullRom(o.y,s.y,c.y,u.y,m),oc.initCatmullRom(o.z,s.z,c.z,u.z,m)}return new h(ic.calc(a),ac.calc(a),oc.calc(a))},Ti.prototype=Object.create(Mn.prototype),Ti.prototype.constructor=Ti,Ti.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2,i=this.v3;return new h(wn(t,e.x,r.x,n.x,i.x),wn(t,e.y,r.y,n.y,i.y),wn(t,e.z,r.z,n.z,i.z))},Si.prototype=Object.create(Mn.prototype),Si.prototype.constructor=Si,Si.prototype.getPoint=function(t){var e=this.v0,r=this.v1,n=this.v2;return new h(gn(t,e.x,r.x,n.x),gn(t,e.y,r.y,n.y),gn(t,e.z,r.z,n.z))},Ai.prototype=Object.create(Mn.prototype),Ai.prototype.constructor=Ai,Ai.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new h;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},Li.prototype=Object.create(Sn.prototype),Li.prototype.constructor=Li;var sc={createMultiMaterialObject:function(t,e){for(var r=new Ie,n=0,i=e.length;n<i;n++)r.add(new Pt(t,e[n]));return r},detach:function(t,e,r){t.applyMatrix(e.matrixWorld),e.remove(t),r.add(t)},attach:function(t,e,r){var n=new l;n.getInverse(r.matrixWorld),t.applyMatrix(n),e.remove(t),r.add(t)}},cc=0,uc=1;Mn.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Mn.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Zi.prototype=Object.create(Ei.prototype),Ji.prototype=Object.create(Ei.prototype),Qi.prototype=Object.create(Ei.prototype),Object.assign(Qi.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),mi.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(Z.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(et.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),lt.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Ms.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(nt.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(l.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new h),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,r){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,r){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,r,n,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,r,i,a)}}),it.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},u.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(st.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(Cn.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new rr(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new dr(this,t)}}),Object.assign(i.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(h.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,r){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Object.assign(o.prototype,{fromAttribute:function(t,e,r){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,r)}}),Lt.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ht.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ht.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(we.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Me.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Mn.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Bt.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Dr.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(mt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Rt.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Rt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Zn.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(K.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Y}}}),Object.defineProperties(Tr.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties($.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(me.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(me.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(ot.prototype,{cullFace:{get:function(){return this.renderReverseSided?ua:ca},set:function(t){var e=t!==ca;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(s.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Gn.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new On).load(t,function(t){e.setBuffer(t)}),this},Hn.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var hc={merge:function(t,e,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,r)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},lc={crossOrigin:void 0,loadTexture:function(t,e,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new Br;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,r,void 0,n);return e&&(a.mapping=e),a},loadTextureCube:function(t,e,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Or;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,r,void 0,n);return e&&(a.mapping=e),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();t.exports=function(){function t(e){n(this,t),this.path=e,this.error=null,this.used=!1}return i(t,null,[{key:"isSupported",value:function(t){return!1}}]),i(t,[{key:"replaceText",value:function(t,e,r){if(t||(t=""),!e)return t;r||(r="");for(var n=0;-1!=(n=t.indexOf(e));)t=t.substring(0,n)+r+t.substring(n+e.length);return t}},{key:"loadText",value:function(){return this.used=!0,Promise.reject(this.error||new Error("No data."))}},{key:"loadBytes",value:function(){return this.used=!0,Promise.reject(this.error||new Error("No data."))}},{key:"name",get:function(){var t=this.replaceText(this.path,"\\","/"),e=t.lastIndexOf("/");return-1!=e&&(t=t.substring(e+1)),t}}]),t}()},function(t,e,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i={},a={};i.document=a;var o=r(13).Zlib;i.Zlib=o,t.exports=function(t,e){function r(t){var e=new Map;if("Connections"in t)for(var r=t.Connections.properties.connections,n=0,i=r.length;n<i;++n){var a=r[n];e.has(a[0])||e.set(a[0],{parents:[],children:[]});var o={ID:a[1],relationship:a[2]};e.get(a[0]).parents.push(o),e.has(a[1])||e.set(a[1],{parents:[],children:[]});var s={ID:a[0],relationship:a[2]};e.get(a[1]).children.push(s)}return e}function a(t){var e=new Map;if("Video"in t.Objects.subNodes){var r=t.Objects.subNodes.Video;for(var n in r){if("Content"in r[n].properties){var i=s(r[n]);e.set(parseInt(n),i)}}}return e}function s(t){var e,r=t.properties.Content,n=(new Uint8Array(r),t.properties.RelativeFilename||t.properties.Filename),i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":e="image/bmp";break;case"jpg":e="image/jpeg";break;case"png":e="image/png";break;case"tif":e="image/tiff";break;default:return void console.warn("FBXLoader: No support image type "+i)}return{type:"arraybuffer",mimetype:e,data:r}}function c(t,e,r,n){var i=new Map;if("Texture"in t.Objects.subNodes){var a=t.Objects.subNodes.Texture;for(var o in a){var s=u(a[o],e,r,n);i.set(parseInt(o),s)}}return i}function u(e,r,n,i){var a,o=e.id,s=e.name,c=e.properties.FileName,u=e.properties.RelativeFilename,h=i.get(o).children;if(void 0!==h&&h.length>0&&n.has(h[0].ID))a=n.get(h[0].ID);else if(void 0!==u&&"/"!==u[0]&&null===u.match(/^[a-zA-Z]:/))a=u;else{var l=c.split(/[\\\/]/);a=l.length>0?l[l.length-1]:c}var d=r.path;if(a&&"arraybuffer"==a.type){var p=new t.Texture;return p.arrayBuffer=a.data,p.mimetype=a.mimetype,p.wrapS=t.RepeatWrapping,p.wrapT=t.RepeatWrapping,p}a&&0===a.indexOf("blob:")&&r.setPath(void 0);var f=r.load(a);return f.name=s,f.FBX_ID=o,r.setPath(d),f}function h(t,e,r){var n=new Map;if("Material"in t.Objects.subNodes){var i=t.Objects.subNodes.Material;for(var a in i){var o=l(i[a],e,r);n.set(parseInt(a),o)}}return n}function l(e,r,i){var a=e.id,o=e.attrName,s=e.properties.ShadingModel;"object"===(void 0===s?"undefined":n(s))&&(s=s.value);var c,u=i.get(a).children,h=d(e.properties,r,u);switch(s){case"phong":c=new t.MeshPhongMaterial;break;case"lambert":c=new t.MeshLambertMaterial;break;default:console.warn("No implementation given for material type "+s+" in FBXLoader.js. Defaulting to basic material"),c=new t.MeshBasicMaterial({color:3342591})}return c.setValues(h),c.name=o,c}function d(t,e,r){var n={};t.Diffuse&&(n.color=K(t.Diffuse)),t.Specular&&(n.specular=K(t.Specular)),t.Shininess&&(n.shininess=t.Shininess.value),t.Emissive&&(n.emissive=K(t.Emissive)),t.EmissiveFactor&&(n.emissiveIntensity=t.EmissiveFactor.value),t.Opacity&&(n.opacity=t.Opacity.value),n.opacity<1&&(n.transparent=!0);for(var i=0,a=r.length;i<a;++i){var o=r[i],s=o.relationship;switch(s){case"DiffuseColor":case' "DiffuseColor':if(n.map=e.get(o.ID),!n.map){console.warn("WARNING: Invalid relationship ID in FBX file! We've used the first texture, but that's probably wrong!");var c=!0,u=!1,h=void 0;try{for(var l,d=e[Symbol.iterator]();!(c=(l=d.next()).done);c=!0){var p=l.value;if(n.map=p[1],n.map)break}}catch(t){u=!0,h=t}finally{try{!c&&d.return&&d.return()}finally{if(u)throw h}}}break;case"Bump":case' "Bump':n.bumpMap=e.get(o.ID);break;case"NormalMap":case' "NormalMap':n.normalMap=e.get(o.ID);break;case' "AmbientColor':case' "EmissiveColor':case"AmbientColor":case"EmissiveColor":default:console.warn("Unknown texture application of type "+s+", skipping texture")}}return n}function p(t,e){var r={};if("Deformer"in t.Objects.subNodes){var n=t.Objects.subNodes.Deformer;for(var i in n){if("Skin"===n[i].attrType){var a=e.get(parseInt(i)),o=f(a,n);o.FBX_ID=parseInt(i),r[i]=o}}}return r}function f(t,e){for(var r={},n=t.children,i=0,a=n.length;i<a;++i){var o=n[i],s=e[o.ID],c={FBX_ID:o.ID,index:i,indices:[],weights:[],transform:$(s.subNodes.Transform.properties.a),transformLink:$(s.subNodes.TransformLink.properties.a),linkMode:s.properties.Mode};"Indexes"in s.subNodes&&(c.indices=J(s.subNodes.Indexes.properties.a),c.weights=Z(s.subNodes.Weights.properties.a)),r[o.ID]=c}return{map:r,bones:[]}}function m(t,e,r){var n=new Map;if("Geometry"in t.Objects.subNodes){var i=t.Objects.subNodes.Geometry;for(var a in i){var o=e.get(parseInt(a)),s=v(i[a],o,r);n.set(parseInt(a),s)}}return n}function v(t,e,r){switch(t.attrType){case"Mesh":return g(t,e,r);case"NurbsCurve":return E(t)}}function g(t,e,r){for(var n=0;n<e.children.length;++n){var i=r[e.children[n].ID];if(void 0!==i)break}return y(t,i)}function y(e,r){var n=new G,i=e.subNodes,a=Z(i.Vertices.properties.a),o=J(i.PolygonVertexIndex.properties.a);if(i.LayerElementNormal)var s=x(i.LayerElementNormal[0]);if(i.LayerElementUV)var c=b(i.LayerElementUV[0]);if(i.LayerElementColor)var u=_(i.LayerElementColor[0]);if(i.LayerElementMaterial)var h=w(i.LayerElementMaterial[0]);for(var l=[],d=0,p=0;p<o.length;p++){var f=o[p],m=!1;f<0&&(f^=-1,o[p]=f,m=!0);var v=new D,g=[],y=[];if(v.position.fromArray(a,3*f),r){var E=r.map;for(var T in E)for(var S=E[T],A=S.indices,L=0;L<A.length;L++){var R=A[L];if(R===f){y.push(S.weights[L]),g.push(S.index);break}}if(y.length>4){console.warn("FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.");var P=[0,0,0,0],C=[0,0,0,0];y.forEach(function(t,e){var r=t,n=g[e];C.forEach(function(t,e,i){if(r>t){i[e]=r,r=t;var a=P[e];P[e]=n,n=a}})}),g=P,y=C}for(var I=y.length;I<4;++I)y[I]=0,g[I]=0;v.skinWeights.fromArray(y),v.skinIndices.fromArray(g)}if(s&&v.normal.fromArray(M(p,d,f,s)),c&&v.uv.fromArray(M(p,d,f,c)),u&&v.color.fromArray(M(p,d,f,u)),l.push(v),m){var U=new z;if(U.genTrianglesFromVertices(l),void 0!==h){var N=M(p,d,f,h);U.materialIndex=N[0]}else U.materialIndex=0;n.faces.push(U),l=[],d++,m=!1}}var O=n.flattenToBuffers(),B=new t.BufferGeometry;B.name=e.name,B.addAttribute("position",new t.Float32BufferAttribute(O.vertexBuffer,3)),O.normalBuffer.length>0&&B.addAttribute("normal",new t.Float32BufferAttribute(O.normalBuffer,3)),O.uvBuffer.length>0&&B.addAttribute("uv",new t.Float32BufferAttribute(O.uvBuffer,2)),i.LayerElementColor&&B.addAttribute("color",new t.Float32BufferAttribute(O.colorBuffer,3)),r&&(B.addAttribute("skinIndex",new t.Float32BufferAttribute(O.skinIndexBuffer,4)),B.addAttribute("skinWeight",new t.Float32BufferAttribute(O.skinWeightBuffer,4)),B.FBX_Deformer=r);for(var F=O.materialIndexBuffer,k=F[0],H=0,I=0;I<F.length;++I)F[I]!==k&&(B.addGroup(H,I-H,k),k=F[I],H=I);return B}function x(t){var e=t.properties.MappingInformationType,r=t.properties.ReferenceInformationType,n=Z(t.subNodes.Normals.properties.a),i=[];return"IndexToDirect"===r&&("NormalIndex"in t.subNodes?i=J(t.subNodes.NormalIndex.properties.a):"NormalsIndex"in t.subNodes&&(i=J(t.subNodes.NormalsIndex.properties.a))),{dataSize:3,buffer:n,indices:i,mappingType:e,referenceType:r}}function b(t){var e=t.properties.MappingInformationType,r=t.properties.ReferenceInformationType,n=Z(t.subNodes.UV.properties.a),i=[];return"IndexToDirect"===r&&(i=J(t.subNodes.UVIndex.properties.a)),{dataSize:2,buffer:n,indices:i,mappingType:e,referenceType:r}}function _(t){var e=t.properties.MappingInformationType,r=t.properties.ReferenceInformationType,n=Z(t.subNodes.Colors.properties.a),i=[];return"IndexToDirect"===r&&(i=Z(t.subNodes.ColorIndex.properties.a)),{dataSize:4,buffer:n,indices:i,mappingType:e,referenceType:r}}function w(t){var e=t.properties.MappingInformationType,r=t.properties.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=J(t.subNodes.Materials.properties.a),i=[],a=0,o=n.length;a<o;++a)i.push(a);return{dataSize:1,buffer:n,indices:i,mappingType:e,referenceType:r}}function M(t,e,r,n){return ot[n.mappingType][n.referenceType](t,e,r,n)}function E(e){if(void 0===t.NURBSCurve)return console.error("THREE.FBXLoader relies on THREE.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new t.BufferGeometry;var r=parseInt(e.properties.Order);if(isNaN(r))return console.error("FBXLoader: Invalid Order "+e.properties.Order+" given for geometry ID: "+e.id),new t.BufferGeometry;for(var n=r-1,i=Z(e.subNodes.KnotVector.properties.a),a=[],o=Z(e.subNodes.Points.properties.a),s=0,c=o.length;s<c;s+=4)a.push((new t.Vector4).fromArray(o,s));var u,h;if("Closed"===e.properties.Form)a.push(a[0]);else if("Periodic"===e.properties.Form){u=n,h=i.length-1-u;for(var s=0;s<n;++s)a.push(a[s])}for(var l=new t.NURBSCurve(n,i,a,u,h),d=l.getPoints(7*a.length),p=new Float32Array(3*d.length),s=0,c=d.length;s<c;++s)d[s].toArray(p,3*s);var f=new t.BufferGeometry;return f.addAttribute("position",new t.BufferAttribute(p,3)),f}function T(e,r,n,i,a){var o=new t.Group,s=e.Objects.subNodes.Model,c=[],u=new Map;for(var h in s){for(var l=parseInt(h),d=s[h],p=r.get(l),f=null,m=0;m<p.parents.length;++m)for(var v in n){var g=n[v],y=g.map,x=y[p.parents[m].ID];if(x){var b=f;f=new t.Bone,g.bones[x.index]=f,null!==b&&f.add(b)}}if(!f)switch(d.attrType){case"Mesh":for(var _=null,w=null,M=[],E=0,T=p.children.length;E<T;++E){var A=p.children[E];i.has(A.ID)&&(_=i.get(A.ID)),a.has(A.ID)&&M.push(a.get(A.ID))}if(M.length>1?w=M:M.length>0?w=M[0]:(w=new t.MeshBasicMaterial({color:3342591}),M.push(w)),"color"in _.attributes)for(var L=0,R=M.length;L<R;++L)M[L].vertexColors=t.VertexColors;if(_.FBX_Deformer){for(var P=0,C=M.length;P<C;++P)M[P].skinning=!0;f=new t.SkinnedMesh(_,w)}else f=new t.Mesh(_,w);break;case"NurbsCurve":for(var _=null,E=0,T=p.children.length;E<T;++E){var A=p.children[E];i.has(A.ID)&&(_=i.get(A.ID))}w=new t.LineBasicMaterial({color:3342591,linewidth:5}),f=new t.Line(_,w);break;default:f=new t.Object3D}f.name=d.attrName.replace(/:/,"").replace(/_/,"").replace(/-/,""),f.FBX_ID=l,c.push(f),u.set(l,f)}for(var U=0,N=c.length;U<N;++U){var f=c[U],d=s[f.FBX_ID];if("Lcl_Translation"in d.properties&&f.position.fromArray(Z(d.properties.Lcl_Translation.value)),"Lcl_Rotation"in d.properties){var O=Z(d.properties.Lcl_Rotation.value).map(et);O.push("ZYX"),f.rotation.fromArray(O)}if("Lcl_Scaling"in d.properties&&f.scale.fromArray(Z(d.properties.Lcl_Scaling.value)),"PreRotation"in d.properties){var B=(new t.Euler).setFromVector3(Q(d.properties.PreRotation).multiplyScalar(ht),"ZYX");B=(new t.Quaternion).setFromEuler(B);var D=(new t.Quaternion).setFromEuler(f.rotation);B.multiply(D),f.rotation.setFromQuaternion(B,"ZYX")}for(var p=r.get(f.FBX_ID),F=0;F<p.parents.length;F++){var z=rt(c,function(t){return t.FBX_ID===p.parents[F].ID});if(z>-1){c[z].add(f);break}}null===f.parent&&o.add(f)}o.updateMatrixWorld(!0);var G=e.Objects.subNodes.Pose;for(var h in G)if("BindPose"===G[h].attrType){G=G[h];break}if(G)for(var k=G.subNodes.PoseNode,H=new Map,V=0,j=k.length;V<j;++V){var d=k[V],W=$(d.subNodes.Matrix.properties.a);H.set(parseInt(d.id),W)}for(var v in n){var g=n[v],y=g.map;for(var X in y){var x=y[X],q=x.index,Y=g.bones[q];if(!H.has(Y.FBX_ID))break;var J=H.get(Y.FBX_ID);Y.matrixWorld.copy(J)}g.skeleton=new t.Skeleton(g.bones);for(var p=r.get(g.FBX_ID),K=p.parents,tt=0,nt=K.length;tt<nt;++tt){var it=K[tt];if(i.has(it.ID))for(var at=it.ID,ot=r.get(at),m=0;m<ot.parents.length;++m)if(u.has(ot.parents[m].ID)){var f=u.get(ot.parents[m].ID);f.bind(g.skeleton,f.matrixWorld);break}}}return o.updateMatrixWorld(!0),o.skeleton={bones:c},I(o,S(e,r,o)),o}function S(e,r,n){var i=e.Objects.subNodes.AnimationCurveNode,a=e.Objects.subNodes.AnimationCurve,o=e.Objects.subNodes.AnimationLayer,s=e.Objects.subNodes.AnimationStack,c={curves:new Map,layers:{},stacks:{},length:0,fps:30,frames:0},u=[];for(var h in i)if(h.match(/\d+/)){var l=A(e,i[h],r,n);u.push(l)}for(var d=new Map,p=0;p<u.length;++p)null!==u[p]&&d.set(u[p].id,u[p]);var f=[];for(h in a)if(h.match(/\d+/)){var m=L(a[h]);if(!r.has(m.id))continue;f.push(m);var v=r.get(m.id).parents[0],g=v.ID,y=v.relationship,x="";if(y.match(/X/))x="x";else if(y.match(/Y/))x="y";else{if(!y.match(/Z/))continue;x="z"}d.get(g).curves[x]=m}d.forEach(function(e){var r=e.containerBoneID;if(c.curves.has(r)||c.curves.set(r,{T:null,R:null,S:null}),c.curves.get(r)[e.attr]=e,"R"===e.attr){var n=e.curves;if(n.x.values=n.x.values.map(et),n.y.values=n.y.values.map(et),n.z.values=n.z.values.map(et),null!==e.preRotations){var i=(new t.Euler).setFromVector3(e.preRotations,"ZYX");i=(new t.Quaternion).setFromEuler(i);for(var a=new t.Euler,o=new t.Quaternion,s=0;s<n.x.times.length;++s)a.set(n.x.values[s],n.y.values[s],n.z.values[s],"ZYX"),o.setFromEuler(a).premultiply(i),a.setFromQuaternion(o,"ZYX"),n.x.values[s]=a.x,n.y.values[s]=a.y,n.z.values[s]=a.z}}});for(var h in o){for(var b=[],_=r.get(parseInt(h)).children,w=0;w<_.length;w++)if(d.has(_[w].ID)){var M=d.get(_[w].ID),E=M.containerBoneID;void 0===b[E]&&(b[E]={T:null,R:null,S:null}),b[E][M.attr]=M}c.layers[h]=b}for(var h in s){for(var T=[],_=r.get(parseInt(h)).children,S={max:0,min:Number.MAX_VALUE},w=0;w<_.length;++w){var P=c.layers[_[w].ID];if(void 0!==P){T.push(P);for(var C=0,I=P.length;C<I;++C){var b=P[C];b&&R(b,S)}}}S.max>S.min&&(c.stacks[h]={name:s[h].attrName,layers:T,length:S.max-S.min,frames:30*(S.max-S.min)})}return c}function A(t,e,r,n){var i=t.Objects.subNodes.Model,a={id:e.id,attr:e.attrName,internalID:e.id,attrX:!1,attrY:!1,attrZ:!1,containerBoneID:-1,containerID:-1,curves:{x:null,y:null,z:null},preRotations:null};if(!a.attr.match(/S|R|T/))return null;for(var o in e.properties)o.match(/X/)&&(a.attrX=!0),o.match(/Y/)&&(a.attrY=!0),o.match(/Z/)&&(a.attrZ=!0);for(var s=r.get(a.id),c=s.parents,u=c.length-1;u>=0;--u){var h=rt(n.skeleton.bones,function(t){return t.FBX_ID===c[u].ID});if(h>-1){a.containerBoneID=h,a.containerID=c[u].ID;var l=i[a.containerID.toString()];"PreRotation"in l.properties&&(a.preRotations=Q(l.properties.PreRotation).multiplyScalar(Math.PI/180));break}}return a}function L(t){return{version:null,id:t.id,internalID:t.id,times:Z(t.subNodes.KeyTime.properties.a).map(Y),values:Z(t.subNodes.KeyValueFloat.properties.a),attrFlag:J(t.subNodes.KeyAttrFlags.properties.a),attrData:Z(t.subNodes.KeyAttrDataFloat.properties.a)}}function R(t,e){t.R&&P(t.R.curves,e),t.S&&P(t.S.curves,e),t.T&&P(t.T.curves,e)}function P(t,e){t.x&&C(t.x,e),t.y&&C(t.y,e),t.z&&C(t.z,e)}function C(t,e){e.max=t.times[t.times.length-1]>e.max?t.times[t.times.length-1]:e.max,e.min=t.times[0]<e.min?t.times[0]:e.min}function I(e,r){void 0===e.animations&&(e.animations=[]);var n=r.stacks;for(var i in n){for(var a=n[i],o={name:a.name,fps:30,length:a.length,hierarchy:[]},s=e.skeleton.bones,c=0,u=s.length;c<u;++c){var h=s[c],l=h.name.replace(/.*:/,""),d=rt(s,function(t){return h.parent===t});o.hierarchy.push({parent:d,name:l,keys:[]})}for(var p=0;p<=a.frames;p++)for(var c=0,u=s.length;c<u;++c)for(var h=s[c],f=c,m=a.layers[0][f],v=0,g=o.hierarchy.length;v<g;++v){var y=o.hierarchy[v];y.name===h.name&&y.keys.push(U(r,m,h,p))}e.animations.push(t.AnimationClip.parseAnimation(o,s))}}function U(t,e,r,n){var i={time:n/t.fps,pos:r.position.toArray(),rot:r.quaternion.toArray(),scl:r.scale.toArray()};if(void 0===e)return i;try{if(N(e,"T")&&O(e.T,n)&&(i.pos=[e.T.curves.x.values[n],e.T.curves.y.values[n],e.T.curves.z.values[n]]),N(e,"R")&&O(e.R,n)){var a=e.R.curves.x.values[n],o=e.R.curves.y.values[n],s=e.R.curves.z.values[n];ct.setFromEuler(st.set(a,o,s,"ZYX")),i.rot=ct.toArray()}N(e,"S")&&O(e.S,n)&&(i.scl=[e.S.curves.x.values[n],e.S.curves.y.values[n],e.S.curves.z.values[n]])}catch(t){console.log(r),console.log(t)}return i}function N(t,e){if(void 0===t)return!1;var r=t[e];return!!r&&ut.every(function(t){return null!==r.curves[t]})}function O(t,e){return ut.every(function(r){return B(t.curves[r],e)})}function B(t,e){return void 0!==t.values[e]}function D(){this.position=new t.Vector3,this.normal=new t.Vector3,this.uv=new t.Vector2,this.color=new t.Vector3,this.skinIndices=new t.Vector4(0,0,0,0),this.skinWeights=new t.Vector4(0,0,0,0)}function F(){this.vertices=[]}function z(){this.triangles=[],this.materialIndex=0}function G(){this.faces=[],this.skeleton=null}function k(){}function H(){}function V(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e}function j(){}function W(t){var e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===tt(t,0,e.length)}function X(t){for(var e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<e.length;++n){if(function(e){var n=t[e-1];return t=t.slice(r+e),r++,n}(1)==e[n])return!1}return!0}function q(t){var e=/FBXVersion: (\d+)/,r=t.match(e);if(r){return parseInt(r[1])}throw new Error("FBXLoader: Cannot find the version number for the file given.")}function Y(t){return t/46186158e3}function Z(t){for(var e=t.split(","),r=0,n=e.length;r<n;r++)e[r]=parseFloat(e[r]);return e}function J(t){for(var e=t.split(","),r=0,n=e.length;r<n;r++)e[r]=parseInt(e[r]);return e}function Q(e){return(new t.Vector3).fromArray(e.value)}function K(e){return(new t.Color).fromArray(e.value)}function $(e){return(new t.Matrix4).fromArray(Z(e))}function tt(t,e,r){void 0===e&&(e=0),void 0===r&&(r=t.byteLength);var n=new Uint8Array(t,e,r);if(void 0!==i.TextDecoder)return(new TextDecoder).decode(n);for(var a="",o=0,s=n.length;o<s;o++)a+=String.fromCharCode(n[o]);return a}function et(t){return t*ht}function rt(t,e){for(var r=0,n=t.length;r<n;r++)if(e(t[r]))return r;return-1}function nt(t,e){for(var r=0,n=t.length,i=e.length;r<i;r++,n++)t[n]=e[r]}function it(t,e,r,n){for(var i=r,a=0;i<n;i++,a++)t[a]=e[i];return t}t.FBXLoader=function(e){this.manager=void 0!==e?e:t.DefaultLoadingManager},Object.assign(t.FBXLoader.prototype,{load:function(e,r,n,a){var o=this,s=e.split(/[\\\/]/);s.pop(),s=s.join("/")+"/";var c=new t.FileLoader(this.manager);c.setResponseType("arraybuffer"),c.load(e,function(t){try{var n=o.parse(t,s);r(n)}catch(t){i.setTimeout(function(){a&&a(t),o.manager.itemError(e)},0)}},n,a)},parse:function(n,i){var o;if(W(n))o=(new H).parse(n);else{var s=tt(n);if(!X(s))throw self.manager.itemError(url),new Error("FBXLoader: Unknown format.");if(q(s)<7e3)throw self.manager.itemError(url),new Error("FBXLoader: FBX version not supported for file at "+url+", FileVersion: "+q(s));o=(new k).parse(s)}var u=r(o),l=a(o),d=c(o,e||new t.TextureLoader(this.manager).setPath(i),l,u),f=h(o,d,u),v=p(o,u);return T(o,u,v,m(o,u,v),f)}});var at=[],ot={ByPolygonVertex:{Direct:function(t,e,r,n){var i=t*n.dataSize,a=t*n.dataSize+n.dataSize;return it(at,n.buffer,i,a)},IndexToDirect:function(t,e,r,n){var i=n.indices[t],a=i*n.dataSize,o=i*n.dataSize+n.dataSize;return it(at,n.buffer,a,o)}},ByPolygon:{Direct:function(t,e,r,n){var i=e*n.dataSize,a=e*n.dataSize+n.dataSize;return it(at,n.buffer,i,a)},IndexToDirect:function(t,e,r,n){var i=n.indices[e],a=i*n.dataSize,o=i*n.dataSize+n.dataSize;return it(at,n.buffer,a,o)}},ByVertice:{Direct:function(t,e,r,n){var i=r*n.dataSize,a=r*n.dataSize+n.dataSize;return it(at,n.buffer,i,a)}},AllSame:{IndexToDirect:function(t,e,r,n){var i=n.indices[0]*n.dataSize,a=n.indices[0]*n.dataSize+n.dataSize;return it(at,n.buffer,i,a)}}},st=new t.Euler,ct=new t.Quaternion,ut=["x","y","z"];Object.assign(D.prototype,{copy:function(t){var e=t||new D;return e.position.copy(this.position),e.normal.copy(this.normal),e.uv.copy(this.uv),e.skinIndices.copy(this.skinIndices),e.skinWeights.copy(this.skinWeights),e},flattenToBuffers:function(t,e,r,n,i,a){this.position.toArray(t,t.length),this.normal.toArray(e,e.length),this.uv.toArray(r,r.length),this.color.toArray(n,n.length),this.skinIndices.toArray(i,i.length),this.skinWeights.toArray(a,a.length)}}),Object.assign(F.prototype,{copy:function(t){for(var e=t||new F,r=0;r<this.vertices.length;++r)this.vertices[r].copy(e.vertices[r]);return e},flattenToBuffers:function(t,e,r,n,i,a){for(var o=this.vertices,s=0,c=o.length;s<c;++s)o[s].flattenToBuffers(t,e,r,n,i,a)}}),Object.assign(z.prototype,{copy:function(t){for(var e=t||new z,r=0;r<this.triangles.length;++r)this.triangles[r].copy(e.triangles[r]);return e.materialIndex=this.materialIndex,e},genTrianglesFromVertices:function(t){for(var e=2;e<t.length;++e){var r=new F;r.vertices[0]=t[0],r.vertices[1]=t[e-1],r.vertices[2]=t[e],this.triangles.push(r)}},flattenToBuffers:function(t,e,r,n,i,a,o){for(var s=this.triangles,c=this.materialIndex,u=0,h=s.length;u<h;++u)s[u].flattenToBuffers(t,e,r,n,i,a),nt(o,[c,c,c])}}),Object.assign(G.prototype,{flattenToBuffers:function(){for(var t=[],e=[],r=[],n=[],i=[],a=[],o=[],s=this.faces,c=0,u=s.length;c<u;++c)s[c].flattenToBuffers(t,e,r,n,i,a,o);return{vertexBuffer:t,normalBuffer:e,uvBuffer:r,colorBuffer:n,skinIndexBuffer:i,skinWeightBuffer:a,materialIndexBuffer:o}}}),Object.assign(k.prototype,{getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(t){this.nodeStack.push(t),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(t,e){this.currentProp=t,this.currentPropName=e},parse:function(t){this.currentIndent=0,this.allNodes=new j,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var e=t.split("\n");for(var r in e){var n=e[r];if(!n.match(/^[\s\t]*;/)&&!n.match(/^[\s\t]*$/)){var i=new RegExp("^\\t{"+this.currentIndent+"}(\\w+):(.*){",""),a=n.match(i);if(a){for(var o=a[1].trim().replace(/^"/,"").replace(/"$/,""),s=a[2].split(","),c=0,n=s.length;c<n;c++)s[c]=s[c].trim().replace(/^"/,"").replace(/"$/,"");this.parseNodeBegin(n,o,s||null)}else{var u=new RegExp("^\\t{"+this.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=n.match(u);if(a){var h=a[1].replace(/^"/,"").replace(/"$/,"").trim(),l=a[2].replace(/^"/,"").replace(/"$/,"").trim();this.parseNodeProperty(n,h,l)}else{var d=new RegExp("^\\t{"+(this.currentIndent-1)+"}}");n.match(d)?this.nodeEnd():n.match(/^[^\s\t}]/)&&this.parseNodePropertyContinued(n)}}}}return this.allNodes},parseNodeBegin:function(t,e,r){var n={name:e,properties:{},subNodes:{}},i=this.parseNodeAttr(r),a=this.getCurrentNode();if(0===this.currentIndent)this.allNodes.add(e,n);else if(e in a.subNodes){var o=a.subNodes[e];this.isFlattenNode(a.subNodes[e])&&(""===i.id?(a.subNodes[e]=[],a.subNodes[e].push(o)):(a.subNodes[e]={},a.subNodes[e][o.id]=o)),""===i.id?a.subNodes[e].push(n):a.subNodes[e][i.id]=n}else"number"==typeof i.id||i.id.match(/^\d+$/)?(a.subNodes[e]={},a.subNodes[e][i.id]=n):a.subNodes[e]=n;r&&(n.id=i.id,n.attrName=i.name,n.attrType=i.type),this.pushStack(n)},parseNodeAttr:function(t){var e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));var r="",n="";return t.length>1&&(r=t[1].replace(/^(\w+)::/,""),n=t[2]),{id:e,name:r,type:n}},parseNodeProperty:function(t,e,r){var n=this.getCurrentNode(),i=n.name;if(void 0!==i){if(i.match(/Properties(\d)+/))return void this.parseNodeSpecialProperty(t,e,r)}if("C"==e){var a=r.split(",").slice(1),o=parseInt(a[0]),s=parseInt(a[1]),c=r.split(",").slice(3);e="connections",r=[o,s],nt(r,c),void 0===n.properties[e]&&(n.properties[e]=[])}if("Node"==e){var u=parseInt(r);n.properties.id=u,n.id=u}e in n.properties?Array.isArray(n.properties[e])?n.properties[e].push(r):n.properties[e]+=r:Array.isArray(n.properties[e])?n.properties[e].push(r):n.properties[e]=r,this.setCurrentProp(n.properties,e)},parseNodePropertyContinued:function(t){this.currentProp[this.currentPropName]+=t},parseNodeSpecialProperty:function(t,e,r){for(var n=r.split('",'),i=0,a=n.length;i<a;i++)n[i]=n[i].trim().replace(/^\"/,"").replace(/\s/,"_");var o=n[0],s=n[1],c=n[2],u=n[3],h=n[4];switch(s){case"int":h=parseInt(h);break;case"double":h=parseFloat(h);break;case"ColorRGB":case"Vector3D":h=Z(h)}this.getPrevNode().properties[o]={type:s,type2:c,flag:u,value:h},this.setCurrentProp(this.getPrevNode().properties,o)},nodeEnd:function(){this.popStack()},isFlattenNode:function(t){return"subNodes"in t&&"properties"in t}}),Object.assign(H.prototype,{parse:function(t){var e=new V(t);e.skip(23);var r=e.getUint32();console.log("FBX binary version: "+r);for(var n=new j;!this.endOfContent(e);){var i=this.parseNode(e,r);null!==i&&n.add(i.name,i)}return n},endOfContent:function(t){return t.size()%16==0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+15>=t.size()},parseNode:function(t,e){var r=e>=7500?t.getUint64():t.getUint32(),n=e>=7500?t.getUint64():t.getUint32(),i=(e>=7500?t.getUint64():t.getUint32(),t.getUint8()),a=t.getString(i);if(0===r)return null;for(var o=[],s=0;s<n;s++)o.push(this.parseProperty(t));var c=o.length>0?o[0]:"",u=o.length>1?o[1]:"",h=o.length>2?o[2]:"",l={},d={},p=!1;for(1===n&&t.getOffset()===r&&(p=!0);r>t.getOffset();){var f=this.parseNode(t,e);if(null!==f)if(!0!==f.singleProperty)if("Connections"!==a||"C"!==f.name)if(f.name.match(/^Properties\d+$/))for(var m=Object.keys(f.properties),s=0,v=m.length;s<v;s++){var g=m[s];d[g]=f.properties[g]}else if(a.match(/^Properties\d+$/)&&"P"===f.name){var y,x=f.propertyList[0],b=f.propertyList[1],_=f.propertyList[2],w=f.propertyList[3];0===x.indexOf("Lcl ")&&(x=x.replace("Lcl ","Lcl_")),0===b.indexOf("Lcl ")&&(b=b.replace("Lcl ","Lcl_")),y="ColorRGB"===b||"Vector"===b||"Vector3D"===b||0===b.indexOf("Lcl_")?[f.propertyList[4],f.propertyList[5],f.propertyList[6]]:f.propertyList[4],0===b.indexOf("Lcl_")&&(y=y.toString()),d[x]={type:b,type2:_,flag:w,value:y}}else void 0===l[f.name]?"number"==typeof f.id?(l[f.name]={},l[f.name][f.id]=f):l[f.name]=f:""===f.id?(Array.isArray(l[f.name])||(l[f.name]=[l[f.name]]),l[f.name].push(f)):void 0===l[f.name][f.id]?l[f.name][f.id]=f:(Array.isArray(l[f.name][f.id])||(l[f.name][f.id]=[l[f.name][f.id]]),l[f.name][f.id].push(f));else{for(var M=[],s=1,v=f.propertyList.length;s<v;s++)M[s-1]=f.propertyList[s];void 0===d.connections&&(d.connections=[]),d.connections.push(M)}else{var E=f.propertyList[0];Array.isArray(E)?(f.properties[f.name]=f.propertyList[0],l[f.name]=f,f.properties.a=E.toString()):d[f.name]=E}}return{singleProperty:p,id:c,attrName:u,attrType:h,name:a,properties:d,propertyList:o,subNodes:l}},parseProperty:function(t){var e=t.getChar();switch(e){case"F":return t.getFloat32();case"D":return t.getFloat64();case"L":return t.getInt64();case"I":return t.getInt32();case"Y":return t.getInt16();case"C":return t.getBoolean();case"f":case"d":case"l":case"i":case"b":var r=t.getUint32(),n=t.getUint32(),a=t.getUint32();if(0===n)switch(e){case"f":return t.getFloat32Array(r);case"d":return t.getFloat64Array(r);case"l":return t.getInt64Array(r);case"i":return t.getInt32Array(r);case"b":return t.getBooleanArray(r)}if(void 0===i.Zlib)throw new Error("FBXLoader: Import inflate.min.js from https://github.com/imaya/zlib.js");var s=new o.Inflate(new Uint8Array(t.getArrayBuffer(a))),c=new V(s.decompress().buffer);switch(e){case"f":return c.getFloat32Array(r);case"d":return c.getFloat64Array(r);case"l":return c.getInt64Array(r);case"i":return c.getInt32Array(r);case"b":return c.getBooleanArray(r)}case"S":var u=t.getUint32();return t.getString(u);case"R":var u=t.getUint32();return t.getArrayBuffer(u);default:throw new Error("FBXLoader: Unknown property type "+JSON.stringify(e))}}}),Object.assign(V.prototype,{getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(t){this.offset+=t},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getBoolean());return e},getInt8:function(){var t=this.dv.getInt8(this.offset);return this.offset+=1,t},getInt8Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt8());return e},getUint8:function(){var t=this.dv.getUint8(this.offset);return this.offset+=1,t},getUint8Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getUint8());return e},getInt16:function(){var t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},getInt16Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt16());return e},getUint16:function(){var t=this.dv.getUint16(this.offset,this.littleEndian);return this.offset+=2,t},getUint16Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getUint16());return e},getInt32:function(){var t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},getInt32Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt32());return e},getUint32:function(){var t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},getUint32Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getUint32());return e},getInt64:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,t=4294967295&~t,4294967295===t&&(e=e+1&4294967295),t=t+1&4294967295,-(4294967296*e+t)):4294967296*e+t},getInt64Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getInt64());return e},getUint64:function(){var t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t},getUint64Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getUint64());return e},getFloat32:function(){var t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},getFloat32Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat32());return e},getFloat64:function(){var t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},getFloat64Array:function(t){for(var e=[],r=0;r<t;r++)e.push(this.getFloat64());return e},getArrayBuffer:function(t){var e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},getChar:function(){return String.fromCharCode(this.getUint8())},getString:function(t){for(var e="";t>0;){var r=this.getUint8();if(t--,0===r)break;e+=String.fromCharCode(r)}return this.skip(t),e}}),Object.assign(j.prototype,{add:function(t,e){this[t]=e},searchConnectionParent:function(t){if(void 0===this.__cache_search_connection_parent&&(this.__cache_search_connection_parent=[]),void 0!==this.__cache_search_connection_parent[t])return this.__cache_search_connection_parent[t];this.__cache_search_connection_parent[t]=[];for(var e=this.Connections.properties.connections,r=[],n=0;n<e.length;++n)if(e[n][0]==t){var i=0===e[n][1]?-1:e[n][1];r.push(i)}return r.length>0?(nt(this.__cache_search_connection_parent[t],r),r):(this.__cache_search_connection_parent[t]=[-1],[-1])},searchConnectionChildren:function(t){if(void 0===this.__cache_search_connection_children&&(this.__cache_search_connection_children=[]),void 0!==this.__cache_search_connection_children[t])return this.__cache_search_connection_children[t];this.__cache_search_connection_children[t]=[];for(var e=this.Connections.properties.connections,r=[],n=0;n<e.length;++n)e[n][1]==t&&r.push(0===e[n][0]?-1:e[n][0]);return r.length>0?(nt(this.__cache_search_connection_children[t],r),r):(this.__cache_search_connection_children[t]=[],[])},searchConnectionType:function(t,e){var r=t+","+e;if(void 0===this.__cache_search_connection_type&&(this.__cache_search_connection_type={}),void 0!==this.__cache_search_connection_type[r])return this.__cache_search_connection_type[r];this.__cache_search_connection_type[r]="";for(var n=this.Connections.properties.connections,i=0;i<n.length;++i)if(n[i][0]==t&&n[i][1]==e)return this.__cache_search_connection_type[r]=n[i][2],n[i][2];return this.__cache_search_connection_type[t]=null,null}});var ht=Math.PI/180}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(0);t.exports=function(){function t(){n(this,t)}return i(t,[{key:"load",value:function(t,e,r,n){var i=new a.Texture;return i.path=t,i}},{key:"setPath",value:function(t){}}]),t}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(7);t.exports=function(){function t(){n(this,t),this.lastBlockID=1,this.blocks=[],this.fileProperties={version:1,title:"Untitled Scene","source.exporter":"Vatomic 3D Exporter"}}return i(t,[{key:"newBlock",value:function(){var t=new o;return t.builder=this,t.id=this.lastBlockID++,this.blocks.push(t),t}},{key:"build",value:function(){var t=new a,e=JSON.stringify(this.fileProperties),r=4+t.stringLengthInBytes(e);t.addByte(61),t.addByte(11),t.addByte(30),t.addByte(199),t.addString(e);var n=12,i=!0,o=!1,s=void 0;try{for(var c,u=this.blocks[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var h=c.value;h.metadataStr=JSON.stringify(h.properties),h.metadataStrLen=t.stringLengthInBytes(h.metadataStr),n+=7+h.metadataStrLen+8+8}}catch(t){o=!0,s=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw s}}t.addByte(68),t.addByte(73),t.addByte(82),t.addByte(66),t.addUInt32(n),t.addUInt32(this.blocks.length);var l=!0,d=!1,p=void 0;try{for(var f,m=this.blocks[Symbol.iterator]();!(l=(f=m.next()).done);l=!0){var h=f.value,v=r+n,g=!0,y=!1,x=void 0;try{for(var b,_=this.blocks[Symbol.iterator]();!(g=(b=_.next()).done);g=!0){var w=b.value;if(v+=17,w===h)break;v+=w.data.length}}catch(t){y=!0,x=t}finally{try{!g&&_.return&&_.return()}finally{if(y)throw x}}t.addUInt32(h.id),t.addUInt8(h.levelOfDetail),t.addUInt16(h.metadataStrLen),t.addString(h.metadataStr),t.addUInt64(v),t.addUInt64(h.data.length)}}catch(t){d=!0,p=t}finally{try{!l&&m.return&&m.return()}finally{if(d)throw p}}var M=!0,E=!1,T=void 0;try{for(var S,A=this.blocks[Symbol.iterator]();!(M=(S=A.next()).done);M=!0){var h=S.value;t.addByte(68),t.addByte(65),t.addByte(84),t.addByte(65),t.addUInt32(h.id),t.addUInt8(h.levelOfDetail),t.addUInt64(h.data.length),t.addBlobBuilder(h.data)}}catch(t){E=!0,T=t}finally{try{!M&&A.return&&A.return()}finally{if(E)throw T}}return t.buildArrayBuffer()}}]),t}();var o=function(){function t(){n(this,t),this.builder=null,this.id=0,this.levelOfDetail=0,this.data=new a,this.properties={type:"",parent:0}}return i(t,[{key:"newChildBlock",value:function(){var t=this.builder.newBlock();return t.properties.parent=this.id,t}}]),t}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=r(1);t.exports=function(t){function e(t){n(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t.webkitRelativePath||t.name));return r._file=t,r}return a(e,t),o(e,null,[{key:"isSupported",value:function(t){return"undefined"!=typeof FileReader&&t instanceof File}}]),o(e,[{key:"loadText",value:function(){var t=this;return new Promise(function(e,r){var n=new FileReader;n.onerror=r,n.onload=function(t){return e(n.result)},n.readAsText(t._file)})}},{key:"loadBytes",value:function(){var t=this;return new Promise(function(e,r){var n=new FileReader;n.onerror=r,n.onload=function(t){return e(n.result)},n.readAsArrayBuffer(t._file)})}}]),e}(s)},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var o=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=r(1);try{var c=r(14)}catch(t){}t.exports=function(t){function e(t){return n(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t))}return a(e,t),o(e,null,[{key:"isSupported",value:function(t){return!!c&&"string"==typeof t}}]),o(e,[{key:"loadText",value:function(){var t=this;return this.used=!0,c.readFile(this.path,"utf8").catch(function(e){throw t.error=e,e})}},{key:"loadBytes",value:function(){var t=this;return this.used=!0,c.readFile(this.path).then(function(t){return t.buffer}).catch(function(e){throw t.error=e,e})}}]),e}(s)},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(11);t.exports=function(){function t(){n(this,t),this.buffers=[],this.bufferCapacity=1048576,this.currentBuffer=new Uint8Array(this.bufferCapacity),this.currentBufferOffset=0}return i(t,[{key:"addByte",value:function(t){this.currentBufferOffset>=this.bufferCapacity&&(this.buffers.push(this.currentBuffer),this.currentBuffer=new Uint8Array(this.bufferCapacity),this.currentBufferOffset=0),this.currentBuffer[this.currentBufferOffset]=t,this.currentBufferOffset+=1}},{key:"addUInt8",value:function(t){this.addByte(t)}},{key:"addUInt16",value:function(t){var e=new Uint8Array(2);new DataView(e.buffer).setUint16(0,t,!0);for(var r=0;r<e.length;r++)this.addByte(e[r])}},{key:"addUInt32",value:function(t){var e=new Uint8Array(4);new DataView(e.buffer).setUint32(0,t,!0);for(var r=0;r<e.length;r++)this.addByte(e[r])}},{key:"addUInt64",value:function(t){var e=new Uint8Array(4);new DataView(e.buffer).setUint32(0,t,!0);for(var r=0;r<e.length;r++)this.addByte(e[r]);this.addByte(0),this.addByte(0),this.addByte(0),this.addByte(0)}},{key:"addFloat32",value:function(t){var e=new Uint8Array(4);new DataView(e.buffer).setFloat32(0,t,!0);for(var r=0;r<e.length;r++)this.addByte(e[r])}},{key:"addString",value:function(t,e){var r=a.setBytesFromString(t),n=!0,i=!1,o=void 0;try{for(var s,c=r[Symbol.iterator]();!(n=(s=c.next()).done);n=!0){var u=s.value;this.addByte(u)}}catch(t){i=!0,o=t}finally{try{!n&&c.return&&c.return()}finally{if(i)throw o}}!1!==e&&this.addByte(0)}},{key:"addBlobBuilder",value:function(t){var e=!0,r=!1,n=void 0;try{for(var i,a=t.buffers[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)for(var o=i.value,s=0;s<o.length;s++)this.addByte(o[s])}catch(t){r=!0,n=t}finally{try{!e&&a.return&&a.return()}finally{if(r)throw n}}for(var s=0;s<t.currentBufferOffset;s++)this.addByte(t.currentBuffer[s])}},{key:"addArrayBuffer",value:function(t){for(var t=new Uint8Array(t),e=0;e<t.length;e++)this.addByte(t[e])}},{key:"stringLengthInBytes",value:function(t,e){return a.setBytesFromString(t).length+(!1===e?0:1)}},{key:"buildBlob",value:function(t){var e=this.buffers.slice();return e.push(this.currentBuffer.slice(0,this.currentBufferOffset)),new Blob(e,{type:t})}},{key:"buildArrayBuffer",value:function(){var t=new Uint8Array(this.buffers.length*this.bufferCapacity+this.currentBufferOffset),e=0,r=!0,n=!1,i=void 0;try{for(var a,o=this.buffers[Symbol.iterator]();!(r=(a=o.next()).done);r=!0)for(var s=a.value,c=0;c<s.length;c++)t[e++]=s[c]}catch(t){n=!0,i=t}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}for(var c=0;c<this.currentBufferOffset;c++)t[e++]=this.currentBuffer[c];return t.buffer}},{key:"length",get:function(){var t=this.buffers.length*this.bufferCapacity;return t+=this.currentBufferOffset}}]),t}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=r(6),o=r(5),s=r(4),c=r(3),u=r(0);r(2)(u,new c),t.exports=function(){function t(e){if(n(this,t),this.status="Idle",this.files=[],this.issues=[],this.result=null,this.waitingPromises=[],this.onprogress=null,this.v3d=null,this.builder=new s,this.builder.fileProperties["source.exporter"]="ThreeJS to V3D converter",e){var r=!0,i=!1,a=void 0;try{for(var o,c=(e||[e])[Symbol.iterator]();!(r=(o=c.next()).done);r=!0){var u=o.value;this.addFile(u)}}catch(t){i=!0,a=t}finally{try{!r&&c.return&&c.return()}finally{if(i)throw a}}}}return i(t,null,[{key:"convert",value:function(e,r){var n=new t(e);return n.onprogress=r,n.convert()}}]),i(t,[{key:"convert",value:function(){var t=this,e=null,r=!0,n=!1,i=void 0;try{for(var a,o=this.files[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){var s=a.value;s.path.toLowerCase().lastIndexOf(".fbx")==s.path.length-4&&(e&&this.addIssue("warning","invalid_filelist","Please only provide one .fbx file. "+e.path+" will be ignored."),e=s)}}catch(t){n=!0,i=t}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}if(!e)return Promise.reject(new Error("No .fbx file in file list!"));this.builder.fileProperties.title=e.path,this.builder.fileProperties.title=this.replaceText(this.builder.fileProperties.title,"\\","/");var c=this.builder.fileProperties.title.lastIndexOf("/");return-1!=c&&(this.builder.fileProperties.title=this.builder.fileProperties.title.substring(c+1)),this.updateStatus("Loading "+e.path),e.loadBytes().then(function(e){return t.parseFBX(e)}).then(function(e){return t.updateStatus("Generating V3D blocks")}).then(function(e){return t.buildScene()}).then(function(e){return t.updateStatus("Loading associated files...")}).then(function(e){return t.waitForAllPromises()}).then(function(e){return t.updateStatus("Building file...")}).then(function(e){return t.result=t.builder.build()})}},{key:"waitForAllPromises",value:function(){var t=this;if(0==this.waitingPromises.length)return!0;var e=this.waitingPromises[0];return e.then(function(r){for(var n=0;n<t.waitingPromises.length;n++)t.waitingPromises[n]===e&&t.waitingPromises.splice(n--,1);return t.waitForAllPromises()})}},{key:"addFile",value:function(t){o.isSupported(t)?this.files.push(new o(t)):a.isSupported(t)?this.files.push(new a(t)):this.addIssue("warning","unknown_file_object","Unable to load file data for "+t+". Please pass in a File object in the browser, or a file path string in Node.")}},{key:"addIssue",value:function(t,e,r){var n=!0,i=!1,a=void 0;try{for(var o,s=this.issues[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){if(o.value.code==e)return}}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}this.issues.push({type:t,code:e,description:r})}},{key:"getFile",value:function(t){if("string"!=typeof t)return null;t=this.replaceText(t.toLowerCase(),"\\","/"),0==t.indexOf("/")&&(t=t.substring(1).trim()),0==t.indexOf("./")&&(t=t.substring(2).trim()),0==t.indexOf("../")&&(t=t.substring(3).trim());var e=!0,r=!1,n=void 0;try{for(var i,a=this.files[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value,s=this.replaceText(o.path.toLowerCase(),"\\","/"),c=s.lastIndexOf(t);if(-1!=c&&c==s.length-t.length)return o}}catch(t){r=!0,n=t}finally{try{!e&&a.return&&a.return()}finally{if(r)throw n}}var c=t.lastIndexOf("/");return-1!=c?(t=t.substring(c+1),this.getFile(t)):void 0}},{key:"updateStatus",value:function(t){t.data&&t.properties&&(t="Generated "+t.properties.type+" block : "+t.properties.name),this.status=t,this.onprogress&&this.onprogress(t)}},{key:"parseFBX",value:function(t){this.updateStatus("Parsing FBX data");var e=new u.FBXLoader;this.scene=e.parse(t)}},{key:"replaceText",value:function(t,e,r){if(t||(t=""),!e)return t;r||(r="");for(var n=0;-1!=(n=t.indexOf(e));)t=t.substring(0,n)+r+t.substring(n+e.length);return t}},{key:"buildScene",value:function(){if(!this.scene)throw new Error("We didn't load a scene! This is most likely a bug with the threejs-to-v3d exporter, please log a bug report.");var t=this.builder.newBlock();t.properties.type="scene",t.properties.name=this.scene.name||"Scene",this.updateStatus("Generated scene block : "+t.properties.name);var e=!0,r=!1,n=void 0;try{for(var i,a=this.scene.children[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value;this.buildSceneNode(o,t)}}catch(t){r=!0,n=t}finally{try{!e&&a.return&&a.return()}finally{if(r)throw n}}}},{key:"buildSceneNode",value:function(t,e){var r=e.newChildBlock();if(r.properties.type="scene.group",r.properties.name=t.name||t.type||"Group",r.properties.translation=[t.position.x,t.position.y,t.position.z],r.properties.scale=[t.scale.x,t.scale.y,t.scale.z],r.properties["rotation.quaternion"]=[t.quaternion.x,t.quaternion.y,t.quaternion.z,t.quaternion.w],"Group"==t.type||"Object3D"==t.type);else if("Mesh"==t.type){r.properties.type="scene.mesh";var n=t.geometry;t.geometry instanceof u.BufferGeometry&&(n=new u.Geometry,n.fromBufferGeometry(t.geometry)),n.computeFaceNormals();var i=this.builder.newBlock();r.properties.faces=i.id,i.properties.type="data.face-indexes";var a=!0,o=!1,s=void 0;try{for(var c,h=n.faces[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var l=c.value;i.data.addUInt32(l.a),i.data.addUInt32(l.b),i.data.addUInt32(l.c)}}catch(t){o=!0,s=t}finally{try{!a&&h.return&&h.return()}finally{if(o)throw s}}var d=this.builder.newBlock();r.properties.vertexData=d.id,d.properties.type="data.vertices";var p=!0,f=!1,m=void 0;try{for(var v,g=n.vertices[Symbol.iterator]();!(p=(v=g.next()).done);p=!0){var y=v.value;d.data.addFloat32(y.x),d.data.addFloat32(y.y),d.data.addFloat32(y.z)}}catch(t){f=!0,m=t}finally{try{!p&&g.return&&g.return()}finally{if(f)throw m}}var x=this.builder.newBlock();r.properties.normals=x.id,x.properties.type="data.normals";var b=!0,_=!1,w=void 0;try{for(var M,E=n.faces[Symbol.iterator]();!(b=(M=E.next()).done);b=!0){var l=M.value;if(3==l.vertexNormals.length)for(var T=0;T<3;T++)x.data.addFloat32(l.vertexNormals[T].x),x.data.addFloat32(l.vertexNormals[T].y),x.data.addFloat32(l.vertexNormals[T].z);else for(var T=0;T<3;T++)x.data.addFloat32(l.normal.x),x.data.addFloat32(l.normal.y),x.data.addFloat32(l.normal.z)}}catch(t){_=!0,w=t}finally{try{!b&&E.return&&E.return()}finally{if(_)throw w}}if(n.faceVertexUvs&&n.faceVertexUvs[0]&&n.faceVertexUvs[0].length>0){var S=this.builder.newBlock();if(r.properties.uvs=S.id,S.properties.type="data.uvs",n.faceVertexUvs[0].length==n.faces.length)for(var T=0;T<n.faces.length;T++)for(var A=0;A<3;A++)S.data.addFloat32(n.faceVertexUvs[0][T][A].x),S.data.addFloat32(n.faceVertexUvs[0][T][A].y);else this.addIssue("warning","invalid_uv_count_"+r.id,"Invalid number of UVs, found "+n.faceVertexUvs[0].length+" but there should have been "+3*n.faces.length),r.properties.uvs=void 0}if(t.material){if(t.material.length&&(this.addIssue("warning","multimaterial","This object contains multiple materials per object, we don't support that yet."),t.material=t.material[0]),t.material.vertexColors!=u.NoColors&&(n.faces[0].vertexColors&&3==n.faces[0].vertexColors.length||n.faces[0].color)){var L=this.builder.newBlock();r.properties.faceVertexColors=L.id,L.properties.type="data.face-vertex-colors";var R=!0,P=!1,C=void 0;try{for(var I,U=n.faces[Symbol.iterator]();!(R=(I=U.next()).done);R=!0){var l=I.value;if(l.vertexColors&&3==l.vertexColors.length)for(var T=0;T<3;T++)L.data.addFloat32(l.vertexColors[T].r),L.data.addFloat32(l.vertexColors[T].g),L.data.addFloat32(l.vertexColors[T].b);else if(l.color)for(var T=0;T<3;T++)L.data.addFloat32(l.color.r),L.data.addFloat32(l.color.g),L.data.addFloat32(l.color.b);else this.addIssue("warning","missing_face_vertex_color","Unable to read some face vertex colors."),L.data.addFloat32(0),L.data.addFloat32(0),L.data.addFloat32(0)}}catch(t){P=!0,C=t}finally{try{!R&&U.return&&U.return()}finally{if(P)throw C}}}var N=this.builder.newBlock();r.properties.material=N.id,N.properties.type="data.material",N.properties.name=t.material.name||"Material",N.properties["diffuse.color"]=[.5,.5,.5],N.properties.textures=[],this.updateStatus(N),t.material.color&&(N.properties["diffuse.color"]=[t.material.color.r,t.material.color.g,t.material.color.b]),t.material instanceof u.MeshBasicMaterial?N.properties.lightingMode="none":t.material instanceof u.MeshPhongMaterial?N.properties.lightingMode="phong":N.properties.lightingMode="lambert",t.material.map&&N.properties.textures.push(this.createTextureBlock(t.material.map,"diffuse").id)}}else this.addIssue("warning","unknown_object_"+t.type,"Unknown object type "+t.type+", it was ignored.");this.updateStatus(r);var O=!0,B=!1,D=void 0;try{for(var F,z=t.children[Symbol.iterator]();!(O=(F=z.next()).done);O=!0){var G=F.value;this.buildSceneNode(G,r)}}catch(t){B=!0,D=t}finally{try{!O&&z.return&&z.return()}finally{if(B)throw D}}}},{key:"createTextureBlock",value:function(t,e){if(t.v3dBlock)return e!=t.v3dBlock.properties["texture.type"]&&this.addIssue("warning","texture_reuse_different_type","A texture block was reused, but a different type was specified."),t.v3dBlock;if(t.v3dBlock=this.builder.newBlock(),t.v3dBlock.properties.type="data.texture",t.v3dBlock.properties.name=t.name||t.path||"Texture",t.v3dBlock.properties.mimetype=-1==t.v3dBlock.properties.name.indexOf(".png")?"image/jpeg":"image/png",t.v3dBlock.properties["texture.type"]=e,t.v3dBlock.properties.wrapS=!0,t.v3dBlock.properties.wrapT=!0,t.arrayBuffer)t.v3dBlock.data.addArrayBuffer(t.arrayBuffer),t.v3dBlock.properties.mimetype=t.mimetype||t.v3dBlock.properties.mimetype,this.updateStatus("Added embedded texture : "+t.v3dBlock.properties.name);else if(t.path){var r=this.getFile(t.path);if(!r)return this.addIssue("warning","missing_file_"+t.path,"Unable to load texture from "+t.path),t.v3dBlock;this.waitingPromises.push(r.loadBytes().then(function(e){return t.v3dBlock.data.addArrayBuffer(e)})),this.updateStatus("Added texture from file : "+r.path)}else this.addIssue("warning","texture_no_data","Unable to find data for texture "+(t.name||t.uuid||t.FBX_ID));return t.v3dBlock}}]),t}()},function(t,e){String.fromCodePoint||function(){var t=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(t){}return r}(),e=String.fromCharCode,r=Math.floor,n=function(t){var n,i,a=[],o=-1,s=arguments.length;if(!s)return"";for(var c="";++o<s;){var u=Number(arguments[o]);if(!isFinite(u)||u<0||u>1114111||r(u)!=u)throw RangeError("Invalid code point: "+u);u<=65535?a.push(u):(u-=65536,n=55296+(u>>10),i=u%1024+56320,a.push(n,i)),(o+1==s||a.length>16384)&&(c+=e.apply(null,a),a.length=0)}return c};t?t(String,"fromCodePoint",{value:n,configurable:!0,writable:!0}):String.fromCodePoint=n}()},function(t,e){String.prototype.codePointAt||function(){"use strict";var t=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(t){}return r}(),e=function(t){if(null==this)throw TypeError();var e=String(this),r=e.length,n=t?Number(t):0;if(n!=n&&(n=0),!(n<0||n>=r)){var i,a=e.charCodeAt(n);return a>=55296&&a<=56319&&r>n+1&&(i=e.charCodeAt(n+1))>=56320&&i<=57343?1024*(a-55296)+i-56320+65536:a}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}()},function(t,e,r){(function(t){t.require&&(r(9),r(10));var e={isNotUTF8:function(t,r,n){try{e.getStringFromBytes(t,r,n,!0)}catch(t){return!0}return!1},getCharLength:function(t){return 240==(240&t)?4:224==(224&t)?3:192==(192&t)?2:t==(127&t)?1:0},getCharCode:function(t,r,n){var i=0,a="";if(r=r||0,0==(n=n||e.getCharLength(t[r])))throw new Error(t[r].toString(2)+" is not a significative byte (offset:"+r+").");if(1===n)return t[r];if(a="00000000".slice(0,n)+1+"00000000".slice(n+1),t[r]&parseInt(a,2))throw Error("Index "+r+": A "+n+" bytes encoded char cannot encode the "+(n+1)+"th rank bit to 1.");for(a="0000".slice(0,n+1)+"11111111".slice(n+1),i+=(t[r]&parseInt(a,2))<<6*--n;n;){if(128!=(128&t[r+1])||64==(64&t[r+1]))throw Error("Index "+(r+1)+': Next bytes of encoded char must begin with a "10" bit sequence.');i+=(63&t[++r])<<6*--n}return i},getStringFromBytes:function(t,r,n,i){var a,o=[];for(r|=0,n="number"==typeof n?n:t.byteLength||t.length;r<n;r++){if(a=e.getCharLength(t[r]),r+a>n){if(i)throw Error("Index "+r+": Found a "+a+" bytes encoded char declaration but only "+(n-r)+" bytes are available.")}else o.push(String.fromCodePoint(e.getCharCode(t,r,a,i)));r+=a-1}return o.join("")},getBytesForCharCode:function(t){if(t<128)return 1;if(t<2048)return 2;if(t<65536)return 3;if(t<2097152)return 4;throw new Error("CharCode "+t+" cannot be encoded with UTF8.")},setBytesFromCharCode:function(t,r,n,i){if(t|=0,r=r||[],n|=0,1==(i=i||e.getBytesForCharCode(t)))r[n]=t;else for(r[n++]=(parseInt("1111".slice(0,i),2)<<8-i)+(t>>>6*--i);i>0;)r[n++]=t>>>6*--i&63|128;return r},setBytesFromString:function(t,r,n,i,a){t=t||"",r=r||[],n|=0,i="number"==typeof i?i:r.byteLength||1/0;for(var o=0,s=t.length;o<s;o++){var c=e.getBytesForCharCode(t[o].codePointAt(0));if(a&&n+c>i)throw new Error('Not enought bytes to encode the char "'+t[o]+'" at the offset "'+n+'".');e.setBytesFromCharCode(t[o].codePointAt(0),r,n,c,a),n+=c}return r}};t.exports=e}).call(e,r(12)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){(function(){"use strict";function t(t,e){var r=t.split("."),n=s;!(r[0]in n)&&n.execScript&&n.execScript("var "+r[0]);for(var i;r.length&&(i=r.shift());)r.length||void 0===e?n=n[i]?n[i]:n[i]={}:n[i]=e}function e(t){var e,r,n,i,a,o,s,u,h,l,d=t.length,p=0,f=Number.POSITIVE_INFINITY;for(u=0;u<d;++u)t[u]>p&&(p=t[u]),t[u]<f&&(f=t[u]);for(e=1<<p,r=new(c?Uint32Array:Array)(e),n=1,i=0,a=2;n<=p;){for(u=0;u<d;++u)if(t[u]===n){for(o=0,s=i,h=0;h<n;++h)o=o<<1|1&s,s>>=1;for(l=n<<16|u,h=o;h<e;h+=a)r[h]=l;++i}++n,i<<=1,a<<=1}return[r,p,f]}function r(t,e){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=c?new Uint8Array(t):t,this.m=!1,this.i=h,this.s=!1,!e&&(e={})||(e.index&&(this.a=e.index),e.bufferSize&&(this.h=e.bufferSize),e.bufferType&&(this.i=e.bufferType),e.resize&&(this.s=e.resize)),this.i){case u:this.b=32768,this.c=new(c?Uint8Array:Array)(32768+this.h+258);break;case h:this.b=0,this.c=new(c?Uint8Array:Array)(this.h),this.e=this.A,this.n=this.w,this.j=this.z;break;default:throw Error("invalid inflate mode")}}function n(t,e){for(var r,n=t.f,i=t.d,a=t.input,o=t.a,s=a.length;i<e;){if(o>=s)throw Error("input buffer is broken");n|=a[o++]<<i,i+=8}return r=n&(1<<e)-1,t.f=n>>>e,t.d=i-e,t.a=o,r}function i(t,e){for(var r,n,i=t.f,a=t.d,o=t.input,s=t.a,c=o.length,u=e[0],h=e[1];a<h&&!(s>=c);)i|=o[s++]<<a,a+=8;return r=u[i&(1<<h)-1],n=r>>>16,t.f=i>>n,t.d=a-n,t.a=s,65535&r}function a(t){function r(t,e,r){var a,o,s,c=this.q;for(s=0;s<t;)switch(a=i(this,e)){case 16:for(o=3+n(this,2);o--;)r[s++]=c;break;case 17:for(o=3+n(this,3);o--;)r[s++]=0;c=0;break;case 18:for(o=11+n(this,7);o--;)r[s++]=0;c=0;break;default:c=r[s++]=a}return this.q=c,r}var a,o,s,u,h=n(t,5)+257,l=n(t,5)+1,d=n(t,4)+4,p=new(c?Uint8Array:Array)(m.length);for(u=0;u<d;++u)p[m[u]]=n(t,3);if(!c)for(u=d,d=p.length;u<d;++u)p[m[u]]=0;a=e(p),o=new(c?Uint8Array:Array)(h),s=new(c?Uint8Array:Array)(l),t.q=0,t.j(e(r.call(t,h,a,o)),e(r.call(t,l,a,s)))}function o(t,e){var n,i;switch(this.input=t,this.a=0,!e&&(e={})||(e.index&&(this.a=e.index),e.verify&&(this.B=e.verify)),n=t[this.a++],i=t[this.a++],15&n){case P:this.method=P;break;default:throw Error("unsupported compression method")}if(0!=((n<<8)+i)%31)throw Error("invalid fcheck flag:"+((n<<8)+i)%31);if(32&i)throw Error("fdict flag is not supported");this.r=new r(t,{index:this.a,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})}var s=this,c="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView,u=0,h=1,l={u:u,t:h};r.prototype.k=function(){for(;!this.m;){var t=n(this,3);switch(1&t&&(this.m=!0),t>>>=1){case 0:var e=this.input,r=this.a,i=this.c,o=this.b,s=e.length,l=void 0,d=void 0,p=i.length,f=void 0;if(this.d=this.f=0,r+1>=s)throw Error("invalid uncompressed block header: LEN");if(l=e[r++]|e[r++]<<8,r+1>=s)throw Error("invalid uncompressed block header: NLEN");if(d=e[r++]|e[r++]<<8,l===~d)throw Error("invalid uncompressed block header: length verify");if(r+l>e.length)throw Error("input buffer is broken");switch(this.i){case u:for(;o+l>i.length;){if(f=p-o,l-=f,c)i.set(e.subarray(r,r+f),o),o+=f,r+=f;else for(;f--;)i[o++]=e[r++];this.b=o,i=this.e(),o=this.b}break;case h:for(;o+l>i.length;)i=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(c)i.set(e.subarray(r,r+l),o),o+=l,r+=l;else for(;l--;)i[o++]=e[r++];this.a=r,this.b=o,this.c=i;break;case 1:this.j(A,R);break;case 2:a(this);break;default:throw Error("unknown BTYPE: "+t)}}return this.n()};var d,p,f=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],m=c?new Uint16Array(f):f,v=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],g=c?new Uint16Array(v):v,y=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],x=c?new Uint8Array(y):y,b=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],_=c?new Uint16Array(b):b,w=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],M=c?new Uint8Array(w):w,E=new(c?Uint8Array:Array)(288);for(d=0,p=E.length;d<p;++d)E[d]=143>=d?8:255>=d?9:279>=d?7:8;var T,S,A=e(E),L=new(c?Uint8Array:Array)(30);for(T=0,S=L.length;T<S;++T)L[T]=5;var R=e(L);r.prototype.j=function(t,e){var r=this.c,a=this.b;this.o=t;for(var o,s,c,u,h=r.length-258;256!==(o=i(this,t));)if(256>o)a>=h&&(this.b=a,r=this.e(),a=this.b),r[a++]=o;else for(s=o-257,u=g[s],0<x[s]&&(u+=n(this,x[s])),o=i(this,e),c=_[o],0<M[o]&&(c+=n(this,M[o])),a>=h&&(this.b=a,r=this.e(),a=this.b);u--;)r[a]=r[a++-c];for(;8<=this.d;)this.d-=8,this.a--;this.b=a},r.prototype.z=function(t,e){var r=this.c,a=this.b;this.o=t;for(var o,s,c,u,h=r.length;256!==(o=i(this,t));)if(256>o)a>=h&&(r=this.e(),h=r.length),r[a++]=o;else for(s=o-257,u=g[s],0<x[s]&&(u+=n(this,x[s])),o=i(this,e),c=_[o],0<M[o]&&(c+=n(this,M[o])),a+u>h&&(r=this.e(),h=r.length);u--;)r[a]=r[a++-c];for(;8<=this.d;)this.d-=8,this.a--;this.b=a},r.prototype.e=function(){var t,e,r=new(c?Uint8Array:Array)(this.b-32768),n=this.b-32768,i=this.c;if(c)r.set(i.subarray(32768,r.length));else for(t=0,e=r.length;t<e;++t)r[t]=i[t+32768];if(this.g.push(r),this.l+=r.length,c)i.set(i.subarray(n,n+32768));else for(t=0;32768>t;++t)i[t]=i[n+t];return this.b=32768,i},r.prototype.A=function(t){var e,r,n,i,a=this.input.length/this.a+1|0,o=this.input,s=this.c;return t&&("number"==typeof t.p&&(a=t.p),"number"==typeof t.v&&(a+=t.v)),2>a?(r=(o.length-this.a)/this.o[2],i=r/2*258|0,n=i<s.length?s.length+i:s.length<<1):n=s.length*a,c?(e=new Uint8Array(n),e.set(s)):e=s,this.c=e},r.prototype.n=function(){var t,e,r,n,i,a=0,o=this.c,s=this.g,u=new(c?Uint8Array:Array)(this.l+(this.b-32768));if(0===s.length)return c?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(e=0,r=s.length;e<r;++e)for(t=s[e],n=0,i=t.length;n<i;++n)u[a++]=t[n];for(e=32768,r=this.b;e<r;++e)u[a++]=o[e];return this.g=[],this.buffer=u},r.prototype.w=function(){var t,e=this.b;return c?this.s?(t=new Uint8Array(e),t.set(this.c.subarray(0,e))):t=this.c.subarray(0,e):(this.c.length>e&&(this.c.length=e),t=this.c),this.buffer=t},o.prototype.k=function(){var t,e,r=this.input;if(t=this.r.k(),this.a=this.r.a,this.B){e=(r[this.a++]<<24|r[this.a++]<<16|r[this.a++]<<8|r[this.a++])>>>0;var n=t;if("string"==typeof n){var i,a,o=n.split("");for(i=0,a=o.length;i<a;i++)o[i]=(255&o[i].charCodeAt(0))>>>0;n=o}for(var s,c=1,u=0,h=n.length,l=0;0<h;){s=1024<h?1024:h,h-=s;do{c+=n[l++],u+=c}while(--s);c%=65521,u%=65521}if(e!==(u<<16|c)>>>0)throw Error("invalid adler-32 checksum")}return t};var P=8;t("Zlib.Inflate",o),t("Zlib.Inflate.prototype.decompress",o.prototype.k);var C,I,U,N,O={ADAPTIVE:l.t,BLOCK:l.u};if(Object.keys)C=Object.keys(O);else for(I in C=[],U=0,O)C[U++]=I;for(U=0,N=C.length;U<N;++U)I=C[U],t("Zlib.Inflate.BufferType."+I,O[I])}).call(this)},function(t,e){if(void 0===fs.promised){var r=new Error('Cannot find module "fs.promised"');throw r.code="MODULE_NOT_FOUND",r}t.exports=fs.promised}]);