!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.THREE=e.THREE||{})}(this,function(e){"use strict";function t(){}function i(e,t){this.x=e||0,this.y=t||0}function n(t,a,o,s,c,l,h,u,p,d){Object.defineProperty(this,"id",{value:r()}),this.uuid=e.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==t?t:n.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==a?a:n.DEFAULT_MAPPING,this.wrapS=void 0!==o?o:_a,this.wrapT=void 0!==s?s:_a,this.magFilter=void 0!==c?c:Aa,this.minFilter=void 0!==l?l:Ca,this.anisotropy=void 0!==p?p:1,this.format=void 0!==h?h:Xa,this.type=void 0!==u?u:Ua,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!==d?d:bo,this.version=0,this.onUpdate=null}function r(){return Co++}function a(e,t,i,n){this.x=e||0,this.y=t||0,this.z=i||0,this.w=void 0!==n?n:1}function o(t,i,r){this.uuid=e.Math.generateUUID(),this.width=t,this.height=i,this.scissor=new a(0,0,t,i),this.scissorTest=!1,this.viewport=new a(0,0,t,i),r=r||{},void 0===r.minFilter&&(r.minFilter=Aa),this.texture=new n(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:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function s(e,t,i){o.call(this,e,t,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function c(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==n?n:1}function l(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function h(){this.elements=new Float32Array([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 u(e,t,i,r,a,o,s,c,l,h){e=void 0!==e?e:[],t=void 0!==t?t:da,n.call(this,e,t,i,r,a,o,s,c,l,h),this.flipY=!1}function p(){this.seq=[],this.map={}}function d(e,t,i){var n=e[0];if(0>=n||n>0)return e;var r=t*i,a=Io[r];if(void 0===a&&(a=new Float32Array(r),Io[r]=a),0!==t){n.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=i,e[o].toArray(a,s)}return a}function f(e,t){var i=Oo[t];void 0===i&&(i=new Int32Array(t),Oo[t]=i);for(var n=0;n!==t;++n)i[n]=e.allocTextureUnit();return i}function m(e,t){e.uniform1f(this.addr,t)}function v(e,t){e.uniform1i(this.addr,t)}function g(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function y(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function x(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function b(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function w(e,t){e.uniformMatrix3fv(this.addr,!1,t.elements||t)}function _(e,t){e.uniformMatrix4fv(this.addr,!1,t.elements||t)}function E(e,t,i){var n=i.allocTextureUnit();e.uniform1i(this.addr,n),i.setTexture2D(t||Po,n)}function M(e,t,i){var n=i.allocTextureUnit();e.uniform1i(this.addr,n),i.setTextureCube(t||Uo,n)}function T(e,t){e.uniform2iv(this.addr,t)}function S(e,t){e.uniform3iv(this.addr,t)}function R(e,t){e.uniform4iv(this.addr,t)}function A(e){switch(e){case 5126:return m;case 35664:return g;case 35665:return y;case 35666:return x;case 35674:return b;case 35675:return w;case 35676:return _;case 35678:return E;case 35680:return M;case 5124:case 35670:return v;case 35667:case 35671:return T;case 35668:case 35672:return S;case 35669:case 35673:return R}}function L(e,t){e.uniform1fv(this.addr,t)}function C(e,t){e.uniform1iv(this.addr,t)}function P(e,t){e.uniform2fv(this.addr,d(t,this.size,2))}function U(e,t){e.uniform3fv(this.addr,d(t,this.size,3))}function I(e,t){e.uniform4fv(this.addr,d(t,this.size,4))}function O(e,t){e.uniformMatrix2fv(this.addr,!1,d(t,this.size,4))}function D(e,t){e.uniformMatrix3fv(this.addr,!1,d(t,this.size,9))}function N(e,t){e.uniformMatrix4fv(this.addr,!1,d(t,this.size,16))}function F(e,t,i){var n=t.length,r=f(i,n);e.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTexture2D(t[a]||Po,r[a])}function z(e,t,i){var n=t.length,r=f(i,n);e.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTextureCube(t[a]||Uo,r[a])}function B(e){switch(e){case 5126:return L;case 35664:return P;case 35665:return U;case 35666:return I;case 35674:return O;case 35675:return D;case 35676:return N;case 35678:return F;case 35680:return z;case 5124:case 35670:return C;case 35667:case 35671:return T;case 35668:case 35672:return S;case 35669:case 35673:return R}}function H(e,t,i){this.id=e,this.addr=i,this.setValue=A(t.type)}function G(e,t,i){this.id=e,this.addr=i,this.size=t.size,this.setValue=B(t.type)}function V(e){this.id=e,p.call(this)}function k(e,t){e.seq.push(t),e.map[t.id]=t}function j(e,t,i){var n=e.name,r=n.length;for(Do.lastIndex=0;;){var a=Do.exec(n),o=Do.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s=0|s),void 0===l||"["===l&&o+2===r){k(i,void 0===l?new H(s,e,t):new G(s,e,t));break}var h=i.map,u=h[s];void 0===u&&(u=new V(s),k(i,u)),i=u}}function W(e,t,i){p.call(this),this.renderer=i;for(var n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;r!==n;++r){var a=e.getActiveUniform(t,r),o=a.name,s=e.getUniformLocation(t,o);j(a,s,this)}}function X(e,t,i){return void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}function Y(e,t){this.min=void 0!==e?e:new i(+(1/0),+(1/0)),this.max=void 0!==t?t:new i(-(1/0),-(1/0))}function q(e,t){function n(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=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,e,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,t,f.STATIC_DRAW),p=f.createTexture(),d=f.createTexture(),m.bindTexture(f.TEXTURE_2D,p),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,d),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=r(s),h={vertex:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},u={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 r(t){var i=f.createProgram(),n=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),a="precision "+e.getPrecision()+" float;\n";return f.shaderSource(n,a+t.fragmentShader),f.shaderSource(r,a+t.vertexShader),f.compileShader(n),f.compileShader(r),f.attachShader(i,n),f.attachShader(i,r),f.linkProgram(i),i}var a,o,s,c,h,u,p,d,f=e.context,m=e.state;this.render=function(r,s,v){if(0!==t.length){var g=new l,y=v.w/v.z,x=.5*v.z,b=.5*v.w,w=16/v.w,_=new i(w*y,w),E=new l(1,1,0),M=new i(1,1),T=new Y;T.min.set(0,0),T.max.set(v.z-16,v.w-16),void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(h.vertex),m.enableAttribute(h.uv),m.disableUnusedAttributes(),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(h.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(h.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),m.disable(f.CULL_FACE),m.setDepthWrite(!1);for(var S=0,R=t.length;R>S;S++){w=16/v.w,_.set(w*y,w);var A=t[S];if(g.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyProjection(s.projectionMatrix),E.copy(g),M.x=v.x+E.x*x+x-8,M.y=v.y+E.y*b+b-8,T.containsPoint(M)===!0){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,M.x,M.y,16,16,0),f.uniform1i(u.renderType,0),f.uniform2f(u.scale,_.x,_.y),f.uniform3f(u.screenPosition,E.x,E.y,E.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,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,M.x,M.y,16,16,0),f.uniform1i(u.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,p),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),A.positionScreen.copy(E),A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares(),f.uniform1i(u.renderType,2),m.enable(f.BLEND);for(var L=0,C=A.lensFlares.length;C>L;L++){var P=A.lensFlares[L];P.opacity>.001&&P.scale>.001&&(E.x=P.x,E.y=P.y,E.z=P.z,w=P.size*P.scale/v.w,_.x=w*y,_.y=w,f.uniform3f(u.screenPosition,E.x,E.y,E.z),f.uniform2f(u.scale,_.x,_.y),f.uniform1f(u.rotation,P.rotation),f.uniform1f(u.opacity,P.opacity),f.uniform3f(u.color,P.color.r,P.color.g,P.color.b),m.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),e.setTexture2D(P.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.setDepthWrite(!0),e.resetGLState()}}}function Z(e,t){function i(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=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,e,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,t,f.STATIC_DRAW),h=r(),u={position:f.getAttribLocation(h,"position"),uv:f.getAttribLocation(h,"uv")},p={uvOffset:f.getUniformLocation(h,"uvOffset"),uvScale:f.getUniformLocation(h,"uvScale"),rotation:f.getUniformLocation(h,"rotation"),scale:f.getUniformLocation(h,"scale"),color:f.getUniformLocation(h,"color"),map:f.getUniformLocation(h,"map"),opacity:f.getUniformLocation(h,"opacity"),modelViewMatrix:f.getUniformLocation(h,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(h,"projectionMatrix"),fogType:f.getUniformLocation(h,"fogType"),fogDensity:f.getUniformLocation(h,"fogDensity"),fogNear:f.getUniformLocation(h,"fogNear"),fogFar:f.getUniformLocation(h,"fogFar"),fogColor:f.getUniformLocation(h,"fogColor"),alphaTest:f.getUniformLocation(h,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var a=i.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),d=new n(i),d.needsUpdate=!0}function r(){var t=f.createProgram(),i=f.createShader(f.VERTEX_SHADER),n=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(i,["precision "+e.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 "+e.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(i),f.compileShader(n),f.attachShader(t,i),f.attachShader(t,n),f.linkProgram(t),t}function a(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}var o,s,h,u,p,d,f=e.context,m=e.state,v=new l,g=new c,y=new l;this.render=function(n,r){if(0!==t.length){void 0===h&&i(),f.useProgram(h),m.initAttributes(),m.enableAttribute(u.position),m.enableAttribute(u.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(u.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.uniformMatrix4fv(p.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(p.map,0);var c=0,l=0,x=n.fog;x?(f.uniform3f(p.fogColor,x.color.r,x.color.g,x.color.b),x&&x.isFog?(f.uniform1f(p.fogNear,x.near),f.uniform1f(p.fogFar,x.far),f.uniform1i(p.fogType,1),c=1,l=1):x&&x.isFogExp2&&(f.uniform1f(p.fogDensity,x.density),f.uniform1i(p.fogType,2),c=2,l=2)):(f.uniform1i(p.fogType,0),c=0,l=0);for(var b=0,w=t.length;w>b;b++){var _=t[b];_.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,_.matrixWorld),_.z=-_.modelViewMatrix.elements[14]}t.sort(a);for(var E=[],b=0,w=t.length;w>b;b++){var _=t[b],M=_.material;if(M.visible!==!1){f.uniform1f(p.alphaTest,M.alphaTest),f.uniformMatrix4fv(p.modelViewMatrix,!1,_.modelViewMatrix.elements),_.matrixWorld.decompose(v,g,y),E[0]=y.x,E[1]=y.y;var T=0;n.fog&&M.fog&&(T=l),c!==T&&(f.uniform1i(p.fogType,T),c=T),null!==M.map?(f.uniform2f(p.uvOffset,M.map.offset.x,M.map.offset.y),f.uniform2f(p.uvScale,M.map.repeat.x,M.map.repeat.y)):(f.uniform2f(p.uvOffset,0,0),f.uniform2f(p.uvScale,1,1)),f.uniform1f(p.opacity,M.opacity),f.uniform3f(p.color,M.color.r,M.color.g,M.color.b),f.uniform1f(p.rotation,M.rotation),f.uniform2fv(p.scale,E),m.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),m.setDepthTest(M.depthTest),m.setDepthWrite(M.depthWrite),M.map?e.setTexture2D(M.map,0):e.setTexture2D(d,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),e.resetGLState()}}}function J(){Object.defineProperty(this,"id",{value:Q()}),this.uuid=e.Math.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Ar,this.side=xr,this.shading=Er,this.vertexColors=Mr,this.opacity=1,this.transparent=!1,this.blendSrc=kr,this.blendDst=jr,this.blendEquation=Or,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=$r,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function Q(){return Nc++}function K(e){J.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n	gl_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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function $(e){J.call(this),this.type="MeshDepthMaterial",this.depthPacking=Ao,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(e)}function ee(e,t){this.min=void 0!==e?e:new l(+(1/0),+(1/0),+(1/0)),this.max=void 0!==t?t:new l(-(1/0),-(1/0),-(1/0))}function te(e,t){this.center=void 0!==e?e:new l,this.radius=void 0!==t?t:0}function ie(){this.elements=new Float32Array([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 ne(e,t){this.normal=void 0!==e?e:new l(1,0,0),this.constant=void 0!==t?t:0}function re(e,t,i,n,r,a){this.planes=[void 0!==e?e:new ne,void 0!==t?t:new ne,void 0!==i?i:new ne,void 0!==n?n:new ne,void 0!==r?r:new ne,void 0!==a?a:new ne]}function ae(t,n,r,s){function c(e,i,n,r){var a=e.geometry,o=null,s=T,c=e.customDepthMaterial;if(n&&(s=S,c=e.customDistanceMaterial),c)o=c;else{var l=!1;i.morphTargets&&(a&&a.isBufferGeometry?l=a.morphAttributes&&a.morphAttributes.position&&a.morphAttributes.position.length>0:a&&a.isGeometry&&(l=a.morphTargets&&a.morphTargets.length>0));var h=e.isSkinnedMesh&&i.skinning,u=0;l&&(u|=_),h&&(u|=E),o=s[u]}if(t.localClippingEnabled&&i.clipShadows===!0&&0!==i.clippingPlanes.length){var p=o.uuid,d=i.uuid,f=R[p];void 0===f&&(f={},R[p]=f);var m=f[d];void 0===m&&(m=o.clone(),f[d]=m),o=m}o.visible=i.visible,o.wireframe=i.wireframe;var v=i.side;return B.renderSingleSided&&v==wr&&(v=xr),B.renderReverseSided&&(v===xr?v=br:v===br&&(v=xr)),o.side=v,o.clipShadows=i.clipShadows,o.clippingPlanes=i.clippingPlanes,o.wireframeLinewidth=i.wireframeLinewidth,o.linewidth=i.linewidth,n&&void 0!==o.uniforms.lightPos&&o.uniforms.lightPos.value.copy(r),o}function u(e,t,i){if(e.visible!==!1){var n=0!==(e.layers.mask&t.layers.mask);if(n&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(e.frustumCulled===!1||f.intersectsObject(e)===!0)){var r=e.material;r.visible===!0&&(e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),w.push(e))}for(var a=e.children,o=0,s=a.length;s>o;o++)u(a[o],t,i)}}var p=t.context,d=t.state,f=new re,m=new h,v=n.shadows,g=new i,y=new i(s.maxTextureSize,s.maxTextureSize),x=new l,b=new l,w=[],_=1,E=2,M=(_|E)+1,T=new Array(M),S=new Array(M),R={},A=[new l(1,0,0),new l(-1,0,0),new l(0,0,1),new l(0,0,-1),new l(0,1,0),new l(0,-1,0)],L=[new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,0,1),new l(0,0,-1)],C=[new a,new a,new a,new a,new a,new a],P=new $;P.depthPacking=Lo,P.clipping=!0;for(var U=Dc.distanceRGBA,I=e.UniformsUtils.clone(U.uniforms),O=0;O!==M;++O){var D=0!==(O&_),N=0!==(O&E),F=P.clone();F.morphTargets=D,F.skinning=N,T[O]=F;var z=new K({defines:{USE_SHADOWMAP:""},uniforms:I,vertexShader:U.vertexShader,fragmentShader:U.fragmentShader,morphTargets:D,skinning:N,clipping:!0});S[O]=z}var B=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=gr,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,i){if(B.enabled!==!1&&(B.autoUpdate!==!1||B.needsUpdate!==!1)&&0!==v.length){d.clearColor(1,1,1,1),d.disable(p.BLEND),d.setDepthTest(!0),d.setScissorTest(!1);for(var n,a,s=0,l=v.length;l>s;s++){var h=v[s],_=h.shadow;if(void 0!==_){var E=_.camera;if(g.copy(_.mapSize),g.min(y),h&&h.isPointLight){n=6,a=!0;var M=g.x,T=g.y;C[0].set(2*M,T,M,T),C[1].set(0,T,M,T),C[2].set(3*M,T,M,T),C[3].set(M,T,M,T),C[4].set(3*M,0,M,T),C[5].set(M,0,M,T),g.x*=4,g.y*=2}else n=1,a=!1;if(null===_.map){var S={minFilter:Ta,magFilter:Ta,format:Xa};_.map=new o(g.x,g.y,S),E.updateProjectionMatrix()}_&&_.isSpotLightShadow&&_.update(h);var R=_.map,P=_.matrix;b.setFromMatrixPosition(h.matrixWorld),E.position.copy(b),t.setRenderTarget(R),t.clear();for(var U=0;n>U;U++){if(a){x.copy(E.position),x.add(A[U]),E.up.copy(L[U]),E.lookAt(x);var I=C[U];d.viewport(I)}else x.setFromMatrixPosition(h.target.matrixWorld),E.lookAt(x);E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),P.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),P.multiply(E.projectionMatrix),P.multiply(E.matrixWorldInverse),m.multiplyMatrices(E.projectionMatrix,E.matrixWorldInverse),f.setFromMatrix(m),w.length=0,u(e,i,E);for(var O=0,D=w.length;D>O;O++){var N=w[O],F=r.update(N),z=N.material;if(z&&z.isMultiMaterial)for(var H=F.groups,G=z.materials,V=0,k=H.length;k>V;V++){var j=H[V],W=G[j.materialIndex];if(W.visible===!0){var X=c(N,W,a,b);t.renderBufferDirect(E,null,F,X,N,j)}}else{var X=c(N,z,a,b);t.renderBufferDirect(E,null,F,X,N,null)}}}}else console.warn("THREE.WebGLShadowMap:",h,"has no shadow.")}var Y=t.getClearColor(),q=t.getClearAlpha();t.setClearColor(Y,q),B.needsUpdate=!1}}}function oe(e,t){this.origin=void 0!==e?e:new l,this.direction=void 0!==t?t:new l}function se(e,t,i,n){this._x=e||0,this._y=t||0,this._z=i||0,this._order=n||se.DefaultOrder}function ce(){this.mask=1}function le(){function t(){a.setFromEuler(r,!1)}function i(){r.setFromQuaternion(a,void 0,!1)}Object.defineProperty(this,"id",{value:he()}),this.uuid=e.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=le.DefaultUp.clone();var n=new l,r=new se,a=new c,o=new l(1,1,1);r.onChange(t),a.onChange(i),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:r},quaternion:{enumerable:!0,value:a},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new h},normalMatrix:{value:new ie}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=le.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ce,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=null}function he(){return Fc++}function ue(e,t){this.start=void 0!==e?e:new l,this.end=void 0!==t?t:new l}function pe(e,t,i){this.a=void 0!==e?e:new l,this.b=void 0!==t?t:new l,this.c=void 0!==i?i:new l}function de(e,t,i,n,r,a){this.a=e,this.b=t,this.c=i,this.normal=n&&n.isVector3?n:new l,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new X,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}function fe(e){J.call(this),this.type="MeshBasicMaterial",this.color=new X(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ra,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(e)}function me(t,i,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=e.Math.generateUUID(),this.array=t,this.itemSize=i,this.count=void 0!==t?t.length/i:0,this.normalized=n===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function ve(e,t){return new me(new Int8Array(e),t)}function ge(e,t){return new me(new Uint8Array(e),t)}function ye(e,t){return new me(new Uint8ClampedArray(e),t)}function xe(e,t){return new me(new Int16Array(e),t)}function be(e,t){return new me(new Uint16Array(e),t)}function we(e,t){return new me(new Int32Array(e),t)}function _e(e,t){return new me(new Uint32Array(e),t)}function Ee(e,t){return new me(new Float32Array(e),t)}function Me(e,t){return new me(new Float64Array(e),t)}function Te(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new me(e,t).setDynamic(!0)}function Se(){Object.defineProperty(this,"id",{value:Re()}),this.uuid=e.Math.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 Re(){return zc++}function Ae(){Object.defineProperty(this,"id",{value:Re()}),this.uuid=e.Math.generateUUID(),this.name="",this.type="DirectGeometry",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 Le(){Object.defineProperty(this,"id",{value:Re()}),this.uuid=e.Math.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 Ce(e,t){le.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Le,this.material=void 0!==t?t:new fe({color:16777215*Math.random()}),this.drawMode=go,this.updateMorphTargets()}function Pe(e,t,i,n,r,a){function o(e,t,i){var n=0;return n+=(e+1)*(t+1)*2,n+=(e+1)*(i+1)*2,n+=(i+1)*(t+1)*2}function s(e,t,i){var n=0;return n+=e*t*2,n+=e*i*2,n+=i*t*2,6*n}function c(e,t,i,n,r,a,o,s,c,u,p){for(var _=a/c,E=o/u,M=a/2,T=o/2,S=s/2,R=c+1,A=u+1,L=0,C=0,P=new l,U=0;A>U;U++)for(var I=U*E-T,O=0;R>O;O++){var D=O*_-M;P[e]=D*n,P[t]=I*r,P[i]=S,f[g]=P.x,f[g+1]=P.y,f[g+2]=P.z,P[e]=0,P[t]=0,P[i]=s>0?1:-1,m[g]=P.x,m[g+1]=P.y,m[g+2]=P.z,v[y]=O/c,v[y+1]=1-U/u,g+=3,y+=2,L+=1}for(U=0;u>U;U++)for(O=0;c>O;O++){var N=b+O+R*U,F=b+O+R*(U+1),z=b+(O+1)+R*(U+1),B=b+(O+1)+R*U;d[x]=N,d[x+1]=F,d[x+2]=B,d[x+3]=F,d[x+4]=z,d[x+5]=B,x+=6,C+=6}h.addGroup(w,C,p),w+=C,b+=L}Le.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var h=this;n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var u=o(n,r,a),p=s(n,r,a),d=new(p>65535?Uint32Array:Uint16Array)(p),f=new Float32Array(3*u),m=new Float32Array(3*u),v=new Float32Array(2*u),g=0,y=0,x=0,b=0,w=0;c("z","y","x",-1,-1,i,t,e,a,r,0),c("z","y","x",1,-1,i,t,-e,a,r,1),c("x","z","y",1,1,e,i,t,n,a,2),c("x","z","y",1,-1,e,i,-t,n,a,3),c("x","y","z",1,-1,e,t,i,n,r,4),c("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(new me(d,1)),this.addAttribute("position",new me(f,3)),this.addAttribute("normal",new me(m,3)),this.addAttribute("uv",new me(v,2))}function Ue(e,t,i,n){Le.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};for(var r=e/2,a=t/2,o=Math.floor(i)||1,s=Math.floor(n)||1,c=o+1,l=s+1,h=e/o,u=t/s,p=new Float32Array(c*l*3),d=new Float32Array(c*l*3),f=new Float32Array(c*l*2),m=0,v=0,g=0;l>g;g++)for(var y=g*u-a,x=0;c>x;x++){var b=x*h-r;p[m]=b,p[m+1]=-y,d[m+2]=1,f[v]=x/o,f[v+1]=1-g/s,m+=3,v+=2}m=0;for(var w=new(p.length/3>65535?Uint32Array:Uint16Array)(o*s*6),g=0;s>g;g++)for(var x=0;o>x;x++){var _=x+c*g,E=x+c*(g+1),M=x+1+c*(g+1),T=x+1+c*g;w[m]=_,w[m+1]=E,w[m+2]=T,w[m+3]=E,w[m+4]=M,w[m+5]=T,m+=6}this.setIndex(new me(w,1)),this.addAttribute("position",new me(p,3)),this.addAttribute("normal",new me(d,3)),this.addAttribute("uv",new me(f,2))}function Ie(){le.call(this),this.type="Camera",this.matrixWorldInverse=new h,this.projectionMatrix=new h}function Oe(e,t,i,n){Ie.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function De(e,t,i,n,r,a){Ie.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Ne(e,t,i){function n(e){s=e}function r(i){i.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(c=e.UNSIGNED_INT,l=4):(c=e.UNSIGNED_SHORT,l=2)}function a(t,n){e.drawElements(s,n,c,t*l),i.calls++,i.vertices+=n,s===e.TRIANGLES&&(i.faces+=n/3)}function o(n,r,a){var o=t.get("ANGLE_instanced_arrays");return null===o?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(o.drawElementsInstancedANGLE(s,a,c,r*l,n.maxInstancedCount),i.calls++,i.vertices+=a*n.maxInstancedCount,void(s===e.TRIANGLES&&(i.faces+=n.maxInstancedCount*a/3)))}var s,c,l;return{setMode:n,setIndex:r,render:a,renderInstances:o}}function Fe(e,t,i){function n(e){o=e}function r(t,n){e.drawArrays(o,t,n),i.calls++,i.vertices+=n,o===e.TRIANGLES&&(i.faces+=n/3)}function a(n){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var a=n.attributes.position,s=0;a&&a.isInterleavedBufferAttribute?(s=a.data.count,r.drawArraysInstancedANGLE(o,0,s,n.maxInstancedCount)):(s=a.count,r.drawArraysInstancedANGLE(o,0,s,n.maxInstancedCount)),i.calls++,i.vertices+=s*n.maxInstancedCount,o===e.TRIANGLES&&(i.faces+=n.maxInstancedCount*s/3)}var o;return{setMode:n,render:r,renderInstances:a}}function ze(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new l,color:new X,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new l,direction:new l,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new l,color:new X,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":n={direction:new l,skyColor:new X,
groundColor:new X}}return e[t.id]=n,n}}}function Be(e){for(var t=e.split("\n"),i=0;i<t.length;i++)t[i]=i+1+": "+t[i];return t.join("\n")}function He(e,t,i){var n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(n),Be(i)),n}function Ge(e){switch(e){case bo:return["Linear","( value )"];case wo:return["sRGB","( value )"];case Eo:return["RGBE","( value )"];case To:return["RGBM","( value, 7.0 )"];case So:return["RGBM","( value, 16.0 )"];case Ro:return["RGBD","( value, 256.0 )"];case _o:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function Ve(e,t){var i=Ge(t);return"vec4 "+e+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function ke(e,t){var i=Ge(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function je(e,t){var i;switch(t){case ca:i="Linear";break;case la:i="Reinhard";break;case ha:i="Uncharted2";break;case ua:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function We(e,t,i){e=e||{};var n=[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return n.filter(qe).join("\n")}function Xe(e){var t=[];for(var i in e){var n=e[i];n!==!1&&t.push("#define "+i+" "+n)}return t.join("\n")}function Ye(e,t,i){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),a=0;r>a;a++){var o=e.getActiveAttrib(t,a),s=o.name;n[s]=e.getAttribLocation(t,s)}return n}function qe(e){return""!==e}function Ze(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Je(e){function t(e,t){var i=Ic[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return Je(i)}var i=/#include +<([\w\d.]+)>/g;return e.replace(i,t)}function Qe(e){function t(e,t,i,n){for(var r="",a=parseInt(t);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r}var i=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return e.replace(i,t)}function Ke(e,t,i,n){var r=e.context,a=i.extensions,o=i.defines,s=i.__webglShader.vertexShader,c=i.__webglShader.fragmentShader,l="SHADOWMAP_TYPE_BASIC";n.shadowMapType===gr?l="SHADOWMAP_TYPE_PCF":n.shadowMapType===yr&&(l="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(n.envMap){switch(i.envMap.mapping){case da:case fa:h="ENVMAP_TYPE_CUBE";break;case ya:case xa:h="ENVMAP_TYPE_CUBE_UV";break;case ma:case va:h="ENVMAP_TYPE_EQUIREC";break;case ga:h="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case fa:case va:u="ENVMAP_MODE_REFRACTION"}switch(i.combine){case ra:p="ENVMAP_BLENDING_MULTIPLY";break;case aa:p="ENVMAP_BLENDING_MIX";break;case oa:p="ENVMAP_BLENDING_ADD"}}var d,f,m=e.gammaFactor>0?e.gammaFactor:1,v=We(a,n,e.extensions),g=Xe(o),y=r.createProgram();i.isRawShaderMaterial?(d=[g,"\n"].filter(qe).join("\n"),f=[v,g,"\n"].filter(qe).join("\n")):(d=["precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__webglShader.name,g,n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",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&&n.flatShading===!1?"#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 "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&e.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","	attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(qe).join("\n"),f=[v,"precision "+n.precision+" float;","precision "+n.precision+" int;","#define SHADER_NAME "+i.__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 "+u:"",n.envMap?"#define "+p:"",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.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+n.numClippingPlanes,n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&e.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",n.envMap&&e.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",n.toneMapping!==sa?"#define TONE_MAPPING":"",n.toneMapping!==sa?Ic.tonemapping_pars_fragment:"",n.toneMapping!==sa?je("toneMapping",n.toneMapping):"",n.outputEncoding||n.mapEncoding||n.envMapEncoding||n.emissiveMapEncoding?Ic.encodings_pars_fragment:"",n.mapEncoding?Ve("mapTexelToLinear",n.mapEncoding):"",n.envMapEncoding?Ve("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Ve("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.outputEncoding?ke("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(qe).join("\n")),s=Je(s,n),s=Ze(s,n),c=Je(c,n),c=Ze(c,n),i.isShaderMaterial||(s=Qe(s),c=Qe(c));var x=d+s,b=f+c,w=He(r,r.VERTEX_SHADER,x),_=He(r,r.FRAGMENT_SHADER,b);r.attachShader(y,w),r.attachShader(y,_),void 0!==i.index0AttributeName?r.bindAttribLocation(y,0,i.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var E=r.getProgramInfoLog(y),M=r.getShaderInfoLog(w),T=r.getShaderInfoLog(_),S=!0,R=!0;r.getProgramParameter(y,r.LINK_STATUS)===!1?(S=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",E,M,T)):""!==E?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",E):""!==M&&""!==T||(R=!1),R&&(this.diagnostics={runnable:S,material:i,programLog:E,vertexShader:{log:M,prefix:d},fragmentShader:{log:T,prefix:f}}),r.deleteShader(w),r.deleteShader(_);var A;this.getUniforms=function(){return void 0===A&&(A=new W(r,y,e)),A};var L;return this.getAttributes=function(){return void 0===L&&(L=Ye(r,y)),L},this.destroy=function(){r.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=Bc++,this.code=t,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=_,this}function $e(e,t){function i(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var i=t.maxVertexUniforms,n=Math.floor((i-20)/4),r=n;return void 0!==e&&e&&e.isSkinnedMesh&&(r=Math.min(e.skeleton.bones.length,r),r<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+r+" (try OpenGL instead of ANGLE)")),r}function n(e,t){var i;return e?e&&e.isTexture?i=e.encoding:e&&e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=e.texture.encoding):i=bo,i===bo&&t&&(i=_o),i}var r=[],a={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"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","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","depthPacking"];this.getParameters=function(r,o,s,c,l){var h=a[r.type],u=i(l),p=e.getPrecision();null!==r.precision&&(p=t.getMaxPrecision(r.precision),p!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead."));var d=e.getCurrentRenderTarget(),f={shaderID:h,precision:p,supportsVertexTextures:t.vertexTextures,outputEncoding:n(d?d.texture:null,e.gammaOutput),map:!!r.map,mapEncoding:n(r.map,e.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:n(r.envMap,e.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===ya||r.envMap.mapping===xa),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:n(r.emissiveMap,e.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!s,useFog:r.fog,fogExp:s&&s.isFogExp2,flatShading:r.shading===_r,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:r.skinning,maxBones:u,useVertexTexture:t.floatVertexTextures&&l&&l.skeleton&&l.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numHemiLights:o.hemi.length,numClippingPlanes:c,shadowMapEnabled:e.shadowMap.enabled&&l.receiveShadow&&o.shadows.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===wr,flipSided:r.side===br,depthPacking:void 0!==r.depthPacking?r.depthPacking:!1};return f},this.getProgramCode=function(e,t){var i=[];if(t.shaderID?i.push(t.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)i.push(n),i.push(e.defines[n]);for(var r=0;r<o.length;r++)i.push(t[o[r]]);return i.join()},this.acquireProgram=function(t,i,n){for(var a,o=0,s=r.length;s>o;o++){var c=r[o];if(c.code===n){a=c,++a.usedTimes;break}}return void 0===a&&(a=new Ke(e,n,t,i),r.push(a)),a},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function et(e,t,i){function n(e){var r=e.target,s=c[r.id];null!==s.index&&a(s.index),o(s.attributes),r.removeEventListener("dispose",n),delete c[r.id];var l=t.get(r);l.wireframe&&a(l.wireframe),t["delete"](r);var h=t.get(s);h.wireframe&&a(h.wireframe),t["delete"](s),i.memory.geometries--}function r(e){return e.isInterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function a(t){var i=r(t);void 0!==i&&(e.deleteBuffer(i),s(t))}function o(e){for(var t in e)a(e[t])}function s(e){e.isInterleavedBufferAttribute?t["delete"](e.data):t["delete"](e)}var c={};return{get:function(e){var t=e.geometry;if(void 0!==c[t.id])return c[t.id];t.addEventListener("dispose",n);var r;return t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Le).setFromObject(e)),r=t._bufferGeometry),c[t.id]=r,i.memory.geometries++,r}}}function tt(e,t,i){function n(t){var i=l.get(t);t.geometry.isGeometry&&i.updateFromObject(t);var n=i.index,a=i.attributes;null!==n&&r(n,e.ELEMENT_ARRAY_BUFFER);for(var o in a)r(a[o],e.ARRAY_BUFFER);var s=i.morphAttributes;for(var o in s)for(var c=s[o],h=0,u=c.length;u>h;h++)r(c[h],e.ARRAY_BUFFER);return i}function r(e,i){var n=e.isInterleavedBufferAttribute?e.data:e,r=t.get(n);void 0===r.__webglBuffer?a(r,n,i):r.version!==n.version&&o(r,n,i)}function a(t,i,n){t.__webglBuffer=e.createBuffer(),e.bindBuffer(n,t.__webglBuffer);var r=i.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(n,i.array,r),t.version=i.version}function o(t,i,n){e.bindBuffer(n,t.__webglBuffer),i.dynamic===!1||-1===i.updateRange.count?e.bufferSubData(n,0,i.array):0===i.updateRange.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."):(e.bufferSubData(n,i.updateRange.offset*i.array.BYTES_PER_ELEMENT,i.array.subarray(i.updateRange.offset,i.updateRange.offset+i.updateRange.count)),i.updateRange.count=0),t.version=i.version}function s(e){return e.isInterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function c(i){var n=t.get(i);if(void 0!==n.wireframe)return n.wireframe;var a=[],o=i.index,s=i.attributes,c=s.position;if(null!==o)for(var l=o.array,h=0,u=l.length;u>h;h+=3){var p=l[h+0],d=l[h+1],f=l[h+2];a.push(p,d,d,f,f,p)}else for(var l=s.position.array,h=0,u=l.length/3-1;u>h;h+=3){var p=h+0,d=h+1,f=h+2;a.push(p,d,d,f,f,p)}var m=c.count>65535?Uint32Array:Uint16Array,v=new me(new m(a),1);return r(v,e.ELEMENT_ARRAY_BUFFER),n.wireframe=v,v}var l=new et(e,t,i);return{getAttributeBuffer:s,getWireframeAttribute:c,update:n}}function it(t,i,n,r,a,o,s){function c(e,t){if(e.width>t||e.height>t){var i=t/Math.max(e.width,e.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=Math.floor(e.width*i),n.height=Math.floor(e.height*i);var r=n.getContext("2d");return r.drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+n.width+"x"+n.height,e),n}return e}function l(t){return e.Math.isPowerOfTwo(t.width)&&e.Math.isPowerOfTwo(t.height)}function h(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=e.Math.nearestPowerOfTwo(t.width),i.height=e.Math.nearestPowerOfTwo(t.height);var n=i.getContext("2d");return n.drawImage(t,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function u(e){return e.wrapS!==_a||e.wrapT!==_a?!0:e.minFilter!==Ta&&e.minFilter!==Aa}function p(e){return e===Ta||e===Sa||e===Ra?t.NEAREST:t.LINEAR}function d(e){var t=e.target;t.removeEventListener("dispose",d),m(t),A.textures--}function f(e){var t=e.target;t.removeEventListener("dispose",f),v(t),A.textures--}function m(e){var i=r.get(e);if(e.image&&i.__image__webglTextureCube)t.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture)}r["delete"](e)}function v(e){var i=r.get(e),n=r.get(e.texture);if(e){if(void 0!==n.__webglTexture&&t.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var a=0;6>a;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);r["delete"](e.texture),r["delete"](e)}}function g(e,i){var a=r.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(o.complete!==!1)return void w(a,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function y(e,i){var s=r.get(e);if(6===e.image.length)if(e.version>0&&s.__version!==e.version){s.__image__webglTextureCube||(e.addEventListener("dispose",d),s.__image__webglTextureCube=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,s.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,u=e.image[0]&&e.image[0].isDataTexture,p=[],f=0;6>f;f++)h||u?p[f]=u?e.image[f].image:e.image[f]:p[f]=c(e.image[f],a.maxCubemapSize);var m=p[0],v=l(m),g=o(e.format),y=o(e.type);b(t.TEXTURE_CUBE_MAP,e,v);for(var f=0;6>f;f++)if(h)for(var x,w=p[f].mipmaps,_=0,E=w.length;E>_;_++)x=w[_],e.format!==Xa&&e.format!==Wa?n.getCompressedTextureFormats().indexOf(g)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,_,g,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,_,g,x.width,x.height,0,g,y,x.data);else u?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,g,p[f].width,p[f].height,0,g,y,p[f].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,g,g,y,p[f]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),s.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,s.__image__webglTextureCube)}function x(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function b(e,n,s){var c;if(s?(t.texParameteri(e,t.TEXTURE_WRAP_S,o(n.wrapS)),t.texParameteri(e,t.TEXTURE_WRAP_T,o(n.wrapT)),t.texParameteri(e,t.TEXTURE_MAG_FILTER,o(n.magFilter)),t.texParameteri(e,t.TEXTURE_MIN_FILTER,o(n.minFilter))):(t.texParameteri(e,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n.wrapS===_a&&n.wrapT===_a||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",n),t.texParameteri(e,t.TEXTURE_MAG_FILTER,p(n.magFilter)),t.texParameteri(e,t.TEXTURE_MIN_FILTER,p(n.minFilter)),n.minFilter!==Ta&&n.minFilter!==Aa&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",n)),c=i.get("EXT_texture_filter_anisotropic")){if(n.type===za&&null===i.get("OES_texture_float_linear"))return;if(n.type===Ba&&null===i.get("OES_texture_half_float_linear"))return;(n.anisotropy>1||r.get(n).__currentAnisotropy)&&(t.texParameterf(e,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(n.anisotropy,a.getMaxAnisotropy())),r.get(n).__currentAnisotropy=n.anisotropy)}}function w(e,i,r){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var s=c(i.image,a.maxTextureSize);u(i)&&l(s)===!1&&(s=h(s));var p=l(s),f=o(i.format),m=o(i.type);b(t.TEXTURE_2D,i,p);var v,g=i.mipmaps;if(i&&i.isDepthTexture){var y=t.DEPTH_COMPONENT;if(i.type===za){if(!L)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else L&&(y=t.DEPTH_COMPONENT16);i.format===Qa&&(y=t.DEPTH_STENCIL),n.texImage2D(t.TEXTURE_2D,0,y,s.width,s.height,0,f,m,null)}else if(i&&i.isDataTexture)if(g.length>0&&p){for(var x=0,w=g.length;w>x;x++)v=g[x],n.texImage2D(t.TEXTURE_2D,x,f,v.width,v.height,0,f,m,v.data);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,f,s.width,s.height,0,f,m,s.data);else if(i&&i.isCompressedTexture)for(var x=0,w=g.length;w>x;x++)v=g[x],i.format!==Xa&&i.format!==Wa?n.getCompressedTextureFormats().indexOf(f)>-1?n.compressedTexImage2D(t.TEXTURE_2D,x,f,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,x,f,v.width,v.height,0,f,m,v.data);else if(g.length>0&&p){for(var x=0,w=g.length;w>x;x++)v=g[x],n.texImage2D(t.TEXTURE_2D,x,f,f,m,v);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,f,f,m,s);i.generateMipmaps&&p&&t.generateMipmap(t.TEXTURE_2D),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function _(e,i,a,s){var c=o(i.texture.format),l=o(i.texture.type);n.texImage2D(s,0,c,i.width,i.height,0,c,l,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function E(e,i){t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):i.depthBuffer&&i.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,i.width,i.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,i){var n=i&&i.isWebGLRenderTargetCube;if(n)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),g(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Ja)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(i.depthTexture.format!==Qa)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}function T(e){var i=r.get(e),n=e&&e.isWebGLRenderTargetCube;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");M(i.__webglFramebuffer,e)}else if(n){i.__webglDepthbuffer=[];for(var a=0;6>a;a++)t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer[a]),i.__webglDepthbuffer[a]=t.createRenderbuffer(),E(i.__webglDepthbuffer[a],e)}else t.bindFramebuffer(t.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),E(i.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function S(e){var i=r.get(e),a=r.get(e.texture);e.addEventListener("dispose",f),a.__webglTexture=t.createTexture(),A.textures++;var o=e&&e.isWebGLRenderTargetCube,s=l(e);if(o){i.__webglFramebuffer=[];for(var c=0;6>c;c++)i.__webglFramebuffer[c]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(o){n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture),b(t.TEXTURE_CUBE_MAP,e.texture,s);for(var c=0;6>c;c++)_(i.__webglFramebuffer[c],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+c);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,a.__webglTexture),b(t.TEXTURE_2D,e.texture,s),_(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&T(e)}function R(e){var i=e.texture;if(i.generateMipmaps&&l(e)&&i.minFilter!==Ta&&i.minFilter!==Aa){var a=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,o=r.get(i).__webglTexture;n.bindTexture(a,o),t.generateMipmap(a),n.bindTexture(a,null)}}var A=s.memory,L="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=y,this.setTextureCubeDynamic=x,this.setupRenderTarget=S,this.updateRenderTargetMipmap=R}function nt(){var e={};return{get:function(t){var i=t.uuid,n=e[i];return void 0===n&&(n={},e[i]=n),n},"delete":function(t){delete e[t.uuid]},clear:function(){e={}}}}function rt(e,t,i){function n(){var t=!1,i=new a,n=null,r=new a;return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,a,o){i.set(t,n,a,o),r.equals(i)===!1&&(e.clearColor(t,n,a,o),r.copy(i))},reset:function(){t=!1,n=null,r.set(0,0,0,1)}}}function r(){var t=!1,i=null,n=null,r=null;return{setTest:function(t){t?d(e.DEPTH_TEST):f(e.DEPTH_TEST)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){if(t)switch(t){case Jr:e.depthFunc(e.NEVER);break;case Qr:e.depthFunc(e.ALWAYS);break;case Kr:e.depthFunc(e.LESS);break;case $r:e.depthFunc(e.LEQUAL);break;case ea:e.depthFunc(e.EQUAL);break;case ta:e.depthFunc(e.GEQUAL);break;case ia:e.depthFunc(e.GREATER);break;case na:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}}function o(){var t=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(t){t?d(e.STENCIL_TEST):f(e.STENCIL_TEST)},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,o){n===t&&r===i&&a===o||(e.stencilFunc(t,i,o),n=t,r=i,a=o)},setOp:function(t,i,n){o===t&&s===i&&c===n||(e.stencilOp(t,i,n),o=t,s=i,c=n)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,l=null}}}function s(t,i,n){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var o=0;n>o;o++)e.texImage2D(i+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r);return a}function c(){D(0,0,0,1),N(1),F(0),d(e.DEPTH_TEST),b($r),T(!1),S(ur),d(e.CULL_FACE),d(e.BLEND),v(Ar)}function l(){for(var e=0,t=W.length;t>e;e++)W[e]=0}function h(i){if(W[i]=1,0===X[i]&&(e.enableVertexAttribArray(i),X[i]=1),0!==Y[i]){var n=t.get("ANGLE_instanced_arrays");n.vertexAttribDivisorANGLE(i,0),Y[i]=0}}function u(t,i,n){W[t]=1,0===X[t]&&(e.enableVertexAttribArray(t),X[t]=1),Y[t]!==i&&(n.vertexAttribDivisorANGLE(t,i),Y[t]=i)}function p(){for(var t=0,i=X.length;t!==i;++t)X[t]!==W[t]&&(e.disableVertexAttribArray(t),X[t]=0)}function d(t){q[t]!==!0&&(e.enable(t),q[t]=!0)}function f(t){q[t]!==!1&&(e.disable(t),q[t]=!1)}function m(){if(null===Z&&(Z=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var i=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),n=0;n<i.length;n++)Z.push(i[n]);return Z}function v(t,n,r,a,o,s,c,l){return t===Rr?(f(e.BLEND),void(J=t)):(d(e.BLEND),t===J&&l===ne||(t===Lr?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===Cr?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===Pr?l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),J=t,ne=l),void(t===Ur?(o=o||n,s=s||r,c=c||a,n===Q&&o===ee||(e.blendEquationSeparate(i(n),i(o)),Q=n,ee=o),r===K&&a===$&&s===te&&c===ie||(e.blendFuncSeparate(i(r),i(a),i(s),i(c)),K=r,$=a,te=s,ie=c)):(Q=null,K=null,$=null,ee=null,te=null,ie=null)))}function g(e){G.setMask(e)}function y(e){V.setTest(e)}function x(e){V.setMask(e)}function b(e){V.setFunc(e)}function w(e){k.setTest(e)}function _(e){k.setMask(e)}function E(e,t,i){k.setFunc(e,t,i)}function M(e,t,i){k.setOp(e,t,i)}function T(t){re!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),re=t)}function S(t){t!==hr?(d(e.CULL_FACE),t!==ae&&(t===ur?e.cullFace(e.BACK):t===pr?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):f(e.CULL_FACE),ae=t}function R(t){t!==oe&&(e.lineWidth(t),oe=t)}function A(t,i,n){t?(d(e.POLYGON_OFFSET_FILL),se===i&&ce===n||(e.polygonOffset(i,n),se=i,ce=n)):f(e.POLYGON_OFFSET_FILL)}function L(){return le}function C(t){le=t,t?d(e.SCISSOR_TEST):f(e.SCISSOR_TEST)}function P(t){void 0===t&&(t=e.TEXTURE0+he-1),ue!==t&&(e.activeTexture(t),ue=t)}function U(t,i){null===ue&&P();var n=pe[ue];void 0===n&&(n={type:void 0,texture:void 0},pe[ue]=n),n.type===t&&n.texture===i||(e.bindTexture(t,i||me[t]),n.type=t,n.texture=i)}function I(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}}function O(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}}function D(e,t,i,n){G.setClear(e,t,i,n)}function N(e){V.setClear(e)}function F(e){k.setClear(e)}function z(t){de.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),de.copy(t))}function B(t){fe.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),fe.copy(t))}function H(){for(var t=0;t<X.length;t++)1===X[t]&&(e.disableVertexAttribArray(t),X[t]=0);q={},Z=null,ue=null,pe={},J=null,re=null,ae=null,G.reset(),V.reset(),k.reset()}var G=new n,V=new r,k=new o,j=e.getParameter(e.MAX_VERTEX_ATTRIBS),W=new Uint8Array(j),X=new Uint8Array(j),Y=new Uint8Array(j),q={},Z=null,J=null,Q=null,K=null,$=null,ee=null,te=null,ie=null,ne=!1,re=null,ae=null,oe=null,se=null,ce=null,le=null,he=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),ue=null,pe={},de=new a,fe=new a,me={};
return me[e.TEXTURE_2D]=s(e.TEXTURE_2D,e.TEXTURE_2D,1),me[e.TEXTURE_CUBE_MAP]=s(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:G,depth:V,stencil:k},init:c,initAttributes:l,enableAttribute:h,enableAttributeAndDivisor:u,disableUnusedAttributes:p,enable:d,disable:f,getCompressedTextureFormats:m,setBlending:v,setColorWrite:g,setDepthTest:y,setDepthWrite:x,setDepthFunc:b,setStencilTest:w,setStencilWrite:_,setStencilFunc:E,setStencilOp:M,setFlipSided:T,setCullFace:S,setLineWidth:R,setPolygonOffset:A,getScissorTest:L,setScissorTest:C,activeTexture:P,bindTexture:U,compressedTexImage2D:I,texImage2D:O,clearColor:D,clearDepth:N,clearStencil:F,scissor:z,viewport:B,reset:H}}function at(e,t,i){function n(){if(void 0!==a)return a;var i=t.get("EXT_texture_filter_anisotropic");return a=null!==i?e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=i.logarithmicDepthBuffer===!0&&!!t.get("EXT_frag_depth"),l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=e.getParameter(e.MAX_TEXTURE_SIZE),p=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),f=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),g=h>0,y=!!t.get("OES_texture_float"),x=g&&y;return{getMaxAnisotropy:n,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:x}}function ot(e){var t={};return{get:function(i){if(void 0!==t[i])return t[i];var n;switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":n=e.getExtension("WEBGL_compressed_texture_etc1");break;default:n=e.getExtension(i)}return null===n&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),t[i]=n,n}}}function st(){function e(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),i.numPlanes=r}function t(e,t,n,r){var a=null!==e?e.length:0,o=null;if(0!==a){if(o=l.value,r!==!0||null===o){var h=n+4*a,u=t.matrixWorldInverse;c.getNormalMatrix(u),(null===o||o.length<h)&&(o=new Float32Array(h));for(var p=0,d=n;p!==a;++p,d+=4)s.copy(e[p]).applyMatrix4(u,c),s.normal.toArray(o,d),o[d+3]=s.constant}l.value=o,l.needsUpdate=!0}return i.numPlanes=a,o}var i=this,n=null,r=0,a=!1,o=!1,s=new ne,c=new ie,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.init=function(e,i,o){var s=0!==e.length||i||0!==r||a;return a=i,n=t(e,o,0),r=e.length,s},this.beginShadows=function(){o=!0,t(null)},this.endShadows=function(){o=!1,e()},this.setState=function(i,s,c,h,u){if(!a||null===i||0===i.length||o&&!s)o?t(null):e();else{var p=o?0:r,d=4*p,f=h.clippingState||null;l.value=f,f=t(i,c,d,u);for(var m=0;m!==d;++m)f[m]=n[m];h.clippingState=f,this.numPlanes+=p}}}function ct(t){function i(){return null===pe?Se:1}function n(e,t,i,n){J===!0&&(e*=n,t*=n,i*=n),et.clearColor(e,t,i,n)}function r(){et.init(),et.scissor(ye.copy(Re).multiplyScalar(Se)),et.viewport(be.copy(Ie).multiplyScalar(Se)),n(_e.r,_e.g,_e.b,Ee)}function o(){ue=null,ge=null,ve="",me=-1,et.reset()}function s(e){e.preventDefault(),o(),r(),ct.clear()}function c(e){var t=e.target;t.removeEventListener("dispose",c),u(t)}function u(e){p(e),ct["delete"](e)}function p(e){var t=ct.get(e).program;e.program=void 0,void 0!==t&&ut.releaseProgram(t)}function d(e,t,i,n){var r;if(i&&i.isInstancedBufferGeometry&&(r=Qe.get("ANGLE_instanced_arrays"),null===r))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),et.initAttributes();var a=i.attributes,o=t.getAttributes(),s=e.defaultAttributeValues;for(var c in o){var l=o[c];if(l>=0){var h=a[c];if(void 0!==h){var u=qe.FLOAT,p=h.array,d=h.normalized;p instanceof Float32Array?u=qe.FLOAT:p instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):p instanceof Uint16Array?u=qe.UNSIGNED_SHORT:p instanceof Int16Array?u=qe.SHORT:p instanceof Uint32Array?u=qe.UNSIGNED_INT:p instanceof Int32Array?u=qe.INT:p instanceof Int8Array?u=qe.BYTE:p instanceof Uint8Array&&(u=qe.UNSIGNED_BYTE);var f=h.itemSize,m=ht.getAttributeBuffer(h);if(h&&h.isInterleavedBufferAttribute){var v=h.data,g=v.stride,y=h.offset;v&&v.isInstancedInterleavedBuffer?(et.enableAttributeAndDivisor(l,v.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):et.enableAttribute(l),qe.bindBuffer(qe.ARRAY_BUFFER,m),qe.vertexAttribPointer(l,f,u,d,g*v.array.BYTES_PER_ELEMENT,(n*g+y)*v.array.BYTES_PER_ELEMENT)}else h&&h.isInstancedBufferAttribute?(et.enableAttributeAndDivisor(l,h.meshPerAttribute,r),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):et.enableAttribute(l),qe.bindBuffer(qe.ARRAY_BUFFER,m),qe.vertexAttribPointer(l,f,u,d,0,n*f*h.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var x=s[c];if(void 0!==x)switch(x.length){case 2:qe.vertexAttrib2fv(l,x);break;case 3:qe.vertexAttrib3fv(l,x);break;case 4:qe.vertexAttrib4fv(l,x);break;default:qe.vertexAttrib1fv(l,x)}}}}et.disableUnusedAttributes()}function f(e,t){return Math.abs(t[0])-Math.abs(e[0])}function m(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.program&&t.material.program&&e.material.program!==t.material.program?e.material.program.id-t.material.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function g(e,t,i,n,r){var a,o;i.transparent?(a=ne,o=++oe):(a=ee,o=++ie);var s=a[o];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=i,s.z=We.z,s.group=r):(s={id:e.id,object:e,geometry:t,material:i,z:We.z,group:r},a.push(s))}function y(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ke.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),b(ke)}function x(e){return ke.center.set(0,0,0),ke.radius=.7071067811865476,ke.applyMatrix4(e.matrixWorld),b(ke)}function b(e){if(!Be.intersectsSphere(e))return!1;var t=He.numPlanes;if(0===t)return!0;var i=he.clippingPlanes,n=e.center,r=-e.radius,a=0;do if(i[a].distanceToPoint(n)<r)return!1;while(++a!==t);return!0}function w(e,t){if(e.visible!==!1){var i=0!==(e.layers.mask&t.layers.mask);if(i)if(e.isLight)$.push(e);else if(e.isSprite)e.frustumCulled!==!1&&x(e)!==!0||ce.push(e);else if(e.isLensFlare)le.push(e);else if(e.isImmediateRenderObject)he.sortObjects===!0&&(We.setFromMatrixPosition(e.matrixWorld),We.applyProjection(je)),g(e,null,e.material,We.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),e.frustumCulled===!1||y(e)===!0)){var n=e.material;if(n.visible===!0){he.sortObjects===!0&&(We.setFromMatrixPosition(e.matrixWorld),We.applyProjection(je));var r=ht.update(e);if(n.isMultiMaterial)for(var a=r.groups,o=n.materials,s=0,c=a.length;c>s;s++){var l=a[s],h=o[l.materialIndex];h.visible===!0&&g(e,r,h,We.z,l)}else g(e,r,n,We.z,null)}}for(var u=e.children,s=0,c=u.length;c>s;s++)w(u[s],t)}}function _(e,t,i,n){for(var r=0,a=e.length;a>r;r++){var o=e[r],s=o.object,c=o.geometry,l=void 0===n?o.material:n,h=o.group;if(s.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.isImmediateRenderObject){M(l);var u=T(t,i,l,s);ve="",s.render(function(e){he.renderBufferImmediate(e,u,l)})}else null!==s.onBeforeRender&&s.onBeforeRender(),he.renderBufferDirect(t,i,c,l,s,h)}}function E(t,i,n){var r=ct.get(t),a=ut.getParameters(t,Xe,i,He.numPlanes,n),o=ut.getProgramCode(t,a),s=r.program,l=!0;if(void 0===s)t.addEventListener("dispose",c);else if(s.code!==o)p(t);else{if(void 0!==a.shaderID)return;l=!1}if(l){if(a.shaderID){var h=Dc[a.shaderID];r.__webglShader={name:t.type,uniforms:e.UniformsUtils.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else r.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=r.__webglShader,s=ut.acquireProgram(t,a,o),r.program=s,t.program=s}var u=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var d=0;d<he.maxMorphTargets;d++)u["morphTarget"+d]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d<he.maxMorphNormals;d++)u["morphNormal"+d]>=0&&t.numSupportedMorphNormals++}var f=r.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&t.clipping!==!0||(r.numClippingPlanes=He.numPlanes,f.clippingPlanes=He.uniform),r.fog=i,r.lightsHash=Xe.hash,t.lights&&(f.ambientLightColor.value=Xe.ambient,f.directionalLights.value=Xe.directional,f.spotLights.value=Xe.spot,f.pointLights.value=Xe.point,f.hemisphereLights.value=Xe.hemi,f.directionalShadowMap.value=Xe.directionalShadowMap,f.directionalShadowMatrix.value=Xe.directionalShadowMatrix,f.spotShadowMap.value=Xe.spotShadowMap,f.spotShadowMatrix.value=Xe.spotShadowMatrix,f.pointShadowMap.value=Xe.pointShadowMap,f.pointShadowMatrix.value=Xe.pointShadowMatrix);var m=r.program.getUniforms(),v=W.seqWithValue(m.seq,f);r.uniformsList=v,r.dynamicUniforms=W.splitDynamic(v,f)}function M(e){e.side===wr?et.disable(qe.CULL_FACE):et.enable(qe.CULL_FACE),et.setFlipSided(e.side===br),e.transparent===!0?et.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):et.setBlending(Rr),et.setDepthFunc(e.depthFunc),et.setDepthTest(e.depthTest),et.setDepthWrite(e.depthWrite),et.setColorWrite(e.colorWrite),et.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function T(e,t,i,n){we=0;var r=ct.get(i);if(Ge&&(Ve||e!==ge)){var a=e===ge&&i.id===me;He.setState(i.clippingPlanes,i.clipShadows,e,r,a)}i.needsUpdate===!1&&(void 0===r.program?i.needsUpdate=!0:i.fog&&r.fog!==t?i.needsUpdate=!0:i.lights&&r.lightsHash!==Xe.hash?i.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==He.numPlanes&&(i.needsUpdate=!0)),i.needsUpdate&&(E(i,t,n),i.needsUpdate=!1);var o=!1,s=!1,c=!1,l=r.program,h=l.getUniforms(),u=r.__webglShader.uniforms;if(l.id!==ue&&(qe.useProgram(l.program),ue=l.id,o=!0,s=!0,c=!0),i.id!==me&&(me=i.id,s=!0),o||e!==ge){if(h.set(qe,e,"projectionMatrix"),Ke.logarithmicDepthBuffer&&h.setValue(qe,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),e!==ge&&(ge=e,s=!0,c=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var p=h.map.cameraPosition;void 0!==p&&p.setValue(qe,We.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&h.setValue(qe,"viewMatrix",e.matrixWorldInverse),h.set(qe,he,"toneMappingExposure"),h.set(qe,he,"toneMappingWhitePoint")}if(i.skinning){h.setOptional(qe,n,"bindMatrix"),h.setOptional(qe,n,"bindMatrixInverse");var d=n.skeleton;d&&(Ke.floatVertexTextures&&d.useVertexTexture?(h.set(qe,d,"boneTexture"),h.set(qe,d,"boneTextureWidth"),h.set(qe,d,"boneTextureHeight")):h.setOptional(qe,d,"boneMatrices"))}s&&(i.lights&&D(u,c),t&&i.fog&&C(u,t),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshDepthMaterial)&&S(u,i),i.isLineBasicMaterial?R(u,i):i.isLineDashedMaterial?(R(u,i),A(u,i)):i.isPointsMaterial?L(u,i):i.isMeshLambertMaterial?P(u,i):i.isMeshPhongMaterial?U(u,i):i.isMeshPhysicalMaterial?O(u,i):i.isMeshStandardMaterial?I(u,i):i.isMeshDepthMaterial?i.displacementMap&&(u.displacementMap.value=i.displacementMap,u.displacementScale.value=i.displacementScale,u.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&(u.opacity.value=i.opacity),W.upload(qe,r.uniformsList,u,he)),h.set(qe,n,"modelViewMatrix"),h.set(qe,n,"normalMatrix"),h.setValue(qe,"modelMatrix",n.matrixWorld);var f=r.dynamicUniforms;return null!==f&&(W.evalDynamic(f,u,n,i,e),W.upload(qe,f,u,he)),l}function S(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var i;if(t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i){i.isWebGLRenderTarget&&(i=i.texture);var n=i.offset,r=i.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function R(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function A(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function L(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*Se,e.scale.value=.5*H.clientHeight,e.map.value=t.map,null!==t.map){var i=t.map.offset,n=t.map.repeat;e.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}}function C(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}function P(e,t){t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function U(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function I(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function O(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,I(e,t)}function D(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function N(e){for(var t=0,i=0,n=e.length;n>i;i++){var r=e[i];r.castShadow&&(Xe.shadows[t++]=r)}Xe.shadows.length=t}function F(e,t){var i,n,r,a,o,s,c,l=0,u=0,p=0,d=t.matrixWorldInverse,f=0,m=0,v=0,g=0;for(i=0,n=e.length;n>i;i++)if(r=e[i],a=r.color,o=r.intensity,s=r.distance,c=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)l+=a.r*o,u+=a.g*o,p+=a.b*o;else if(r.isDirectionalLight){var y=pt.get(r);y.color.copy(r.color).multiplyScalar(r.intensity),y.direction.setFromMatrixPosition(r.matrixWorld),We.setFromMatrixPosition(r.target.matrixWorld),y.direction.sub(We),y.direction.transformDirection(d),y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Xe.directionalShadowMap[f]=c,Xe.directionalShadowMatrix[f]=r.shadow.matrix,Xe.directional[f++]=y}else if(r.isSpotLight){var y=pt.get(r);y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(d),y.color.copy(a).multiplyScalar(o),y.distance=s,y.direction.setFromMatrixPosition(r.matrixWorld),We.setFromMatrixPosition(r.target.matrixWorld),y.direction.sub(We),y.direction.transformDirection(d),y.coneCos=Math.cos(r.angle),y.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),y.decay=0===r.distance?0:r.decay,y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Xe.spotShadowMap[v]=c,Xe.spotShadowMatrix[v]=r.shadow.matrix,Xe.spot[v++]=y}else if(r.isPointLight){var y=pt.get(r);y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(d),y.color.copy(r.color).multiplyScalar(r.intensity),y.distance=r.distance,y.decay=0===r.distance?0:r.decay,y.shadow=r.castShadow,r.castShadow&&(y.shadowBias=r.shadow.bias,y.shadowRadius=r.shadow.radius,y.shadowMapSize=r.shadow.mapSize),Xe.pointShadowMap[m]=c,void 0===Xe.pointShadowMatrix[m]&&(Xe.pointShadowMatrix[m]=new h),We.setFromMatrixPosition(r.matrixWorld).negate(),Xe.pointShadowMatrix[m].identity().setPosition(We),Xe.point[m++]=y}else if(r.isHemisphereLight){var y=pt.get(r);y.direction.setFromMatrixPosition(r.matrixWorld),y.direction.transformDirection(d),y.direction.normalize(),y.skyColor.copy(r.color).multiplyScalar(o),y.groundColor.copy(r.groundColor).multiplyScalar(o),Xe.hemi[g++]=y}Xe.ambient[0]=l,Xe.ambient[1]=u,Xe.ambient[2]=p,Xe.directional.length=f,Xe.spot.length=v,Xe.point.length=m,Xe.hemi.length=g,Xe.hash=f+","+m+","+v+","+g+","+Xe.shadows.length}function z(){var e=we;return e>=Ke.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+Ke.maxTextures),we+=1,e}function B(e){var t;if(e===wa)return qe.REPEAT;if(e===_a)return qe.CLAMP_TO_EDGE;if(e===Ea)return qe.MIRRORED_REPEAT;if(e===Ta)return qe.NEAREST;if(e===Sa)return qe.NEAREST_MIPMAP_NEAREST;if(e===Ra)return qe.NEAREST_MIPMAP_LINEAR;if(e===Aa)return qe.LINEAR;if(e===La)return qe.LINEAR_MIPMAP_NEAREST;if(e===Ca)return qe.LINEAR_MIPMAP_LINEAR;if(e===Ua)return qe.UNSIGNED_BYTE;if(e===Ha)return qe.UNSIGNED_SHORT_4_4_4_4;if(e===Ga)return qe.UNSIGNED_SHORT_5_5_5_1;if(e===Va)return qe.UNSIGNED_SHORT_5_6_5;if(e===Ia)return qe.BYTE;if(e===Oa)return qe.SHORT;if(e===Da)return qe.UNSIGNED_SHORT;if(e===Na)return qe.INT;if(e===Fa)return qe.UNSIGNED_INT;if(e===za)return qe.FLOAT;if(t=Qe.get("OES_texture_half_float"),null!==t&&e===Ba)return t.HALF_FLOAT_OES;if(e===ja)return qe.ALPHA;if(e===Wa)return qe.RGB;if(e===Xa)return qe.RGBA;if(e===Ya)return qe.LUMINANCE;if(e===qa)return qe.LUMINANCE_ALPHA;if(e===Ja)return qe.DEPTH_COMPONENT;if(e===Qa)return qe.DEPTH_STENCIL;if(e===Or)return qe.FUNC_ADD;if(e===Dr)return qe.FUNC_SUBTRACT;if(e===Nr)return qe.FUNC_REVERSE_SUBTRACT;if(e===Br)return qe.ZERO;if(e===Hr)return qe.ONE;if(e===Gr)return qe.SRC_COLOR;if(e===Vr)return qe.ONE_MINUS_SRC_COLOR;if(e===kr)return qe.SRC_ALPHA;if(e===jr)return qe.ONE_MINUS_SRC_ALPHA;if(e===Wr)return qe.DST_ALPHA;if(e===Xr)return qe.ONE_MINUS_DST_ALPHA;if(e===Yr)return qe.DST_COLOR;if(e===qr)return qe.ONE_MINUS_DST_COLOR;if(e===Zr)return qe.SRC_ALPHA_SATURATE;if(t=Qe.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===Ka)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===$a)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===eo)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===to)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=Qe.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===io)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===no)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===ro)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===ao)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=Qe.get("WEBGL_compressed_texture_etc1"),null!==t&&e===oo)return t.COMPRESSED_RGB_ETC1_WEBGL;if(t=Qe.get("EXT_blend_minmax"),null!==t){if(e===Fr)return t.MIN_EXT;if(e===zr)return t.MAX_EXT}return t=Qe.get("WEBGL_depth_texture"),null!==t&&e===ka?t.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",cr),t=t||{};var H=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),G=void 0!==t.context?t.context:null,V=void 0!==t.alpha?t.alpha:!1,k=void 0!==t.depth?t.depth:!0,j=void 0!==t.stencil?t.stencil:!0,Y=void 0!==t.antialias?t.antialias:!1,J=void 0!==t.premultipliedAlpha?t.premultipliedAlpha:!0,Q=void 0!==t.preserveDrawingBuffer?t.preserveDrawingBuffer:!1,$=[],ee=[],ie=-1,ne=[],oe=-1,se=new Float32Array(8),ce=[],le=[];this.domElement=H,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=ca,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var he=this,ue=null,pe=null,de=null,me=-1,ve="",ge=null,ye=new a,xe=null,be=new a,we=0,_e=new X(0),Ee=0,Me=H.width,Te=H.height,Se=1,Re=new a(0,0,Me,Te),Ae=!1,Ie=new a(0,0,Me,Te),Be=new re,He=new st,Ge=!1,Ve=!1,ke=new te,je=new h,We=new l,Xe={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ye={calls:0,vertices:0,faces:0,points:0};this.info={render:Ye,memory:{geometries:0,textures:0},programs:null};var qe;try{var Ze={alpha:V,depth:k,stencil:j,antialias:Y,premultipliedAlpha:J,preserveDrawingBuffer:Q};if(qe=G||H.getContext("webgl",Ze)||H.getContext("experimental-webgl",Ze),null===qe)throw null!==H.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===qe.getShaderPrecisionFormat&&(qe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),H.addEventListener("webglcontextlost",s,!1)}catch(Je){console.error("THREE.WebGLRenderer: "+Je)}var Qe=new ot(qe);Qe.get("WEBGL_depth_texture"),Qe.get("OES_texture_float"),Qe.get("OES_texture_float_linear"),Qe.get("OES_texture_half_float"),Qe.get("OES_texture_half_float_linear"),Qe.get("OES_standard_derivatives"),Qe.get("ANGLE_instanced_arrays"),Qe.get("OES_element_index_uint")&&(Le.MaxIndex=4294967296);var Ke=new at(qe,Qe,t),et=new rt(qe,Qe,B),ct=new nt,lt=new it(qe,Qe,et,ct,Ke,B,this.info),ht=new tt(qe,ct,this.info),ut=new $e(this,Ke),pt=new ze;this.info.programs=ut.programs;var dt=new Fe(qe,Qe,Ye),ft=new Ne(qe,Qe,Ye),mt=new De(-1,1,1,-1,0,1),vt=new Oe,gt=new Ce(new Ue(2,2),new fe({depthTest:!1,depthWrite:!1,fog:!1})),yt=Dc.cube,xt=new Ce(new Pe(5,5,5),new K({uniforms:yt.uniforms,vertexShader:yt.vertexShader,fragmentShader:yt.fragmentShader,side:br,depthTest:!1,depthWrite:!1,fog:!1}));r(),this.context=qe,this.capabilities=Ke,this.extensions=Qe,this.properties=ct,this.state=et;var bt=new ae(this,Xe,ht,Ke);this.shadowMap=bt;var wt=new Z(this,ce),_t=new q(this,le);this.getContext=function(){return qe},this.getContextAttributes=function(){return qe.getContextAttributes()},this.forceContextLoss=function(){Qe.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Ke.getMaxAnisotropy()},this.getPrecision=function(){return Ke.precision},this.getPixelRatio=function(){return Se},this.setPixelRatio=function(e){void 0!==e&&(Se=e,this.setSize(Ie.z,Ie.w,!1))},this.getSize=function(){return{width:Me,height:Te}},this.setSize=function(e,t,i){Me=e,Te=t,H.width=e*Se,H.height=t*Se,i!==!1&&(H.style.width=e+"px",H.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,i,n){et.viewport(Ie.set(e,t,i,n))},this.setScissor=function(e,t,i,n){et.scissor(Re.set(e,t,i,n))},this.setScissorTest=function(e){et.setScissorTest(Ae=e)},this.getClearColor=function(){return _e},this.setClearColor=function(e,t){_e.set(e),Ee=void 0!==t?t:1,n(_e.r,_e.g,_e.b,Ee)},this.getClearAlpha=function(){return Ee},this.setClearAlpha=function(e){Ee=e,n(_e.r,_e.g,_e.b,Ee)},this.clear=function(e,t,i){var n=0;(void 0===e||e)&&(n|=qe.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=qe.DEPTH_BUFFER_BIT),(void 0===i||i)&&(n|=qe.STENCIL_BUFFER_BIT),qe.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(e,t,i,n){this.setRenderTarget(e),this.clear(t,i,n)},this.resetGLState=o,this.dispose=function(){ne=[],oe=-1,ee=[],ie=-1,H.removeEventListener("webglcontextlost",s,!1)},this.renderBufferImmediate=function(e,t,i){et.initAttributes();var n=ct.get(e);e.hasPositions&&!n.position&&(n.position=qe.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=qe.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=qe.createBuffer()),e.hasColors&&!n.color&&(n.color=qe.createBuffer());var r=t.getAttributes();if(e.hasPositions&&(qe.bindBuffer(qe.ARRAY_BUFFER,n.position),qe.bufferData(qe.ARRAY_BUFFER,e.positionArray,qe.DYNAMIC_DRAW),et.enableAttribute(r.position),qe.vertexAttribPointer(r.position,3,qe.FLOAT,!1,0,0)),e.hasNormals){if(qe.bindBuffer(qe.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&i.shading===_r)for(var a=0,o=3*e.count;o>a;a+=9){var s=e.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,l=(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]=l,s[a+2]=h,s[a+3]=c,s[a+4]=l,s[a+5]=h,s[a+6]=c,s[a+7]=l,s[a+8]=h}qe.bufferData(qe.ARRAY_BUFFER,e.normalArray,qe.DYNAMIC_DRAW),et.enableAttribute(r.normal),qe.vertexAttribPointer(r.normal,3,qe.FLOAT,!1,0,0)}e.hasUvs&&i.map&&(qe.bindBuffer(qe.ARRAY_BUFFER,n.uv),qe.bufferData(qe.ARRAY_BUFFER,e.uvArray,qe.DYNAMIC_DRAW),et.enableAttribute(r.uv),qe.vertexAttribPointer(r.uv,2,qe.FLOAT,!1,0,0)),e.hasColors&&i.vertexColors!==Mr&&(qe.bindBuffer(qe.ARRAY_BUFFER,n.color),qe.bufferData(qe.ARRAY_BUFFER,e.colorArray,qe.DYNAMIC_DRAW),et.enableAttribute(r.color),qe.vertexAttribPointer(r.color,3,qe.FLOAT,!1,0,0)),et.disableUnusedAttributes(),qe.drawArrays(qe.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,a,o){M(r);var s=T(e,t,r,a),c=!1,l=n.id+"_"+s.id+"_"+r.wireframe;l!==ve&&(ve=l,c=!0);var h=a.morphTargetInfluences;if(void 0!==h){for(var u=[],p=0,m=h.length;m>p;p++){var v=h[p];u.push([v,p])}u.sort(f),u.length>8&&(u.length=8);for(var g=n.morphAttributes,p=0,m=u.length;m>p;p++){var v=u[p];if(se[p]=v[0],0!==v[0]){var y=v[1];r.morphTargets===!0&&g.position&&n.addAttribute("morphTarget"+p,g.position[y]),r.morphNormals===!0&&g.normal&&n.addAttribute("morphNormal"+p,g.normal[y])}else r.morphTargets===!0&&n.removeAttribute("morphTarget"+p),r.morphNormals===!0&&n.removeAttribute("morphNormal"+p)}for(var p=u.length,x=se.length;x>p;p++)se[p]=0;s.getUniforms().setValue(qe,"morphTargetInfluences",se),c=!0}var y=n.index,b=n.attributes.position,w=1;r.wireframe===!0&&(y=ht.getWireframeAttribute(n),w=2);var _;null!==y?(_=ft,_.setIndex(y)):_=dt,c&&(d(r,s,n),null!==y&&qe.bindBuffer(qe.ELEMENT_ARRAY_BUFFER,ht.getAttributeBuffer(y)));var E=0;null!==y?E=y.count:void 0!==b&&(E=b.count);var S=n.drawRange.start*w,R=n.drawRange.count*w,A=null!==o?o.start*w:0,L=null!==o?o.count*w:1/0,C=Math.max(S,A),P=Math.min(E,S+R,A+L)-1,U=Math.max(0,P-C+1);if(0!==U){if(a.isMesh)if(r.wireframe===!0)et.setLineWidth(r.wireframeLinewidth*i()),_.setMode(qe.LINES);else switch(a.drawMode){case go:_.setMode(qe.TRIANGLES);break;case yo:_.setMode(qe.TRIANGLE_STRIP);break;case xo:_.setMode(qe.TRIANGLE_FAN)}else if(a.isLine){var I=r.linewidth;void 0===I&&(I=1),et.setLineWidth(I*i()),a.isLineSegments?_.setMode(qe.LINES):_.setMode(qe.LINE_STRIP)}else a.isPoints&&_.setMode(qe.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&_.renderInstances(n,C,U):_.render(C,U)}},this.render=function(e,t,i,r){if(void 0!==t&&t.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var a=e.fog;ve="",me=-1,ge=null,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),je.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Be.setFromMatrix(je),$.length=0,ie=-1,oe=-1,ce.length=0,le.length=0,Ve=this.localClippingEnabled,Ge=He.init(this.clippingPlanes,Ve,t),w(e,t),ee.length=ie+1,ne.length=oe+1,he.sortObjects===!0&&(ee.sort(m),ne.sort(v)),Ge&&He.beginShadows(),N($),bt.render(e,t),F($,t),Ge&&He.endShadows(),Ye.calls=0,Ye.vertices=0,Ye.faces=0,Ye.points=0,void 0===i&&(i=null),this.setRenderTarget(i);var o=e.background;if(null===o?n(_e.r,_e.g,_e.b,Ee):o&&o.isColor&&(n(o.r,o.g,o.b,1),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),o&&o.isCubeTexture?(vt.projectionMatrix.copy(t.projectionMatrix),vt.matrixWorld.extractRotation(t.matrixWorld),vt.matrixWorldInverse.getInverse(vt.matrixWorld),xt.material.uniforms.tCube.value=o,xt.modelViewMatrix.multiplyMatrices(vt.matrixWorldInverse,xt.matrixWorld),ht.update(xt),he.renderBufferDirect(vt,null,xt.geometry,xt.material,xt,null)):o&&o.isTexture&&(gt.material.map=o,ht.update(gt),he.renderBufferDirect(mt,null,gt.geometry,gt.material,gt,null)),e.overrideMaterial){var s=e.overrideMaterial;_(ee,t,a,s),_(ne,t,a,s)}else et.setBlending(Rr),_(ee,t,a),_(ne,t,a);wt.render(e,t),_t.render(e,t,be),i&&lt.updateRenderTargetMipmap(i),et.setDepthTest(!0),et.setDepthWrite(!0),et.setColorWrite(!0)},this.setFaceCulling=function(e,t){et.setCullFace(e),et.setFlipSided(t===fr)},this.allocTextureUnit=z,this.setTexture2D=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),lt.setTexture2D(t,i)}}(),this.setTexture=function(){var e=!1;return function(t,i){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),lt.setTexture2D(t,i)}}(),this.setTextureCube=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?lt.setTextureCube(t,i):lt.setTextureCubeDynamic(t,i)}}(),this.getCurrentRenderTarget=function(){return pe},this.setRenderTarget=function(e){pe=e,e&&void 0===ct.get(e).__webglFramebuffer&&lt.setupRenderTarget(e);var t,i=e&&e.isWebGLRenderTargetCube;if(e){var n=ct.get(e);t=i?n.__webglFramebuffer[e.activeCubeFace]:n.__webglFramebuffer,ye.copy(e.scissor),xe=e.scissorTest,be.copy(e.viewport)}else t=null,ye.copy(Re).multiplyScalar(Se),xe=Ae,be.copy(Ie).multiplyScalar(Se);if(de!==t&&(qe.bindFramebuffer(qe.FRAMEBUFFER,t),de=t),et.scissor(ye),et.setScissorTest(xe),et.viewport(be),i){var r=ct.get(e.texture);qe.framebufferTexture2D(qe.FRAMEBUFFER,qe.COLOR_ATTACHMENT0,qe.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel);
}},this.readRenderTargetPixels=function(e,t,i,n,r,a){if((e&&e.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var o=ct.get(e).__webglFramebuffer;if(o){var s=!1;o!==de&&(qe.bindFramebuffer(qe.FRAMEBUFFER,o),s=!0);try{var c=e.texture,l=c.format,h=c.type;if(l!==Xa&&B(l)!==qe.getParameter(qe.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ua||B(h)===qe.getParameter(qe.IMPLEMENTATION_COLOR_READ_TYPE)||h===za&&(Qe.get("OES_texture_float")||Qe.get("WEBGL_color_buffer_float"))||h===Ba&&Qe.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");qe.checkFramebufferStatus(qe.FRAMEBUFFER)===qe.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-n&&i>=0&&i<=e.height-r&&qe.readPixels(t,i,n,r,B(l),B(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&qe.bindFramebuffer(qe.FRAMEBUFFER,de)}}}}function lt(e,t){this.name="",this.color=new X(e),this.density=void 0!==t?t:25e-5}function ht(e,t,i){this.name="",this.color=new X(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function ut(){le.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function pt(e,t,i,n,r){le.call(this),this.lensFlares=[],this.positionScreen=new l,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,n,r)}function dt(e){J.call(this),this.type="SpriteMaterial",this.color=new X(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function ft(e){le.call(this),this.type="Sprite",this.material=void 0!==e?e:new dt}function mt(){le.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function vt(e,t,i,r,a,o,s,c,l,h,u,p){n.call(this,null,o,s,c,l,h,r,a,u,p),this.image={data:e,width:t,height:i},this.magFilter=void 0!==l?l:Ta,this.minFilter=void 0!==h?h:Ta,this.flipY=!1,this.generateMipmaps=!1}function gt(t,i,n){if(this.useVertexTexture=void 0!==n?n:!0,this.identityMatrix=new h,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var r=Math.sqrt(4*this.bones.length);r=e.Math.nextPowerOfTwo(Math.ceil(r)),r=Math.max(r,4),this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new vt(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Xa,za)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===i)this.calculateInverses();else if(this.bones.length===i.length)this.boneInverses=i.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var a=0,o=this.bones.length;o>a;a++)this.boneInverses.push(new h)}}function yt(e){le.call(this),this.type="Bone",this.skin=e}function xt(e,t,i){Ce.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var r,a,o=0,s=this.geometry.bones.length;s>o;++o)a=this.geometry.bones[o],r=new yt(this),n.push(r),r.name=a.name,r.position.fromArray(a.pos),r.quaternion.fromArray(a.rotq),void 0!==a.scl&&r.scale.fromArray(a.scl);for(var o=0,s=this.geometry.bones.length;s>o;++o)a=this.geometry.bones[o],-1!==a.parent&&null!==a.parent&&void 0!==n[a.parent]?n[a.parent].add(n[o]):this.add(n[o])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new gt(n,void 0,i),this.matrixWorld)}function bt(e){J.call(this),this.type="LineBasicMaterial",this.color=new X(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function wt(e,t,i){return 1===i?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new _t(e,t)):(le.call(this),this.type="Line",this.geometry=void 0!==e?e:new Le,void(this.material=void 0!==t?t:new bt({color:16777215*Math.random()})))}function _t(e,t){wt.call(this,e,t),this.type="LineSegments"}function Et(e){J.call(this),this.type="PointsMaterial",this.color=new X(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(e)}function Mt(e,t){le.call(this),this.type="Points",this.geometry=void 0!==e?e:new Le,this.material=void 0!==t?t:new Et({color:16777215*Math.random()})}function Tt(){le.call(this),this.type="Group"}function St(e,t,i,r,a,o,s,c,l){function h(){requestAnimationFrame(h),e.readyState>=e.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}n.call(this,e,t,i,r,a,o,s,c,l),this.generateMipmaps=!1;var u=this;h()}function Rt(e,t,i,r,a,o,s,c,l,h,u,p){n.call(this,null,o,s,c,l,h,r,a,u,p),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function At(e,t,i,r,a,o,s,c,l){n.call(this,e,t,i,r,a,o,s,c,l),this.needsUpdate=!0}function Lt(e,t,i,r,a,o,s,c,l,h){if(h=void 0!==h?h:Ja,h!==Ja&&h!==Qa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n.call(this,null,r,a,o,s,c,h,i,l),this.image={width:e,height:t},this.type=void 0!==i?i:Da,this.magFilter=void 0!==s?s:Ta,this.minFilter=void 0!==c?c:Ta,this.flipY=!1,this.generateMipmaps=!1}function Ct(e){function t(e,t){return e-t}Le.call(this);var i=[0,0],n={},r=["a","b","c"];if(e&&e.isGeometry){for(var a=e.vertices,o=e.faces,s=0,c=new Uint32Array(6*o.length),l=0,h=o.length;h>l;l++)for(var u=o[l],p=0;3>p;p++){i[0]=u[r[p]],i[1]=u[r[(p+1)%3]],i.sort(t);var d=i.toString();void 0===n[d]&&(c[2*s]=i[0],c[2*s+1]=i[1],n[d]=!0,s++)}for(var f=new Float32Array(2*s*3),l=0,h=s;h>l;l++)for(var p=0;2>p;p++){var m=a[c[2*l+p]],v=6*l+3*p;f[v+0]=m.x,f[v+1]=m.y,f[v+2]=m.z}this.addAttribute("position",new me(f,3))}else if(e&&e.isBufferGeometry)if(null!==e.index){var g=e.index.array,a=e.attributes.position,y=e.groups,s=0;0===y.length&&e.addGroup(0,g.length);for(var c=new Uint32Array(2*g.length),x=0,b=y.length;b>x;++x)for(var w=y[x],_=w.start,E=w.count,l=_,M=_+E;M>l;l+=3)for(var p=0;3>p;p++){i[0]=g[l+p],i[1]=g[l+(p+1)%3],i.sort(t);var d=i.toString();void 0===n[d]&&(c[2*s]=i[0],c[2*s+1]=i[1],n[d]=!0,s++)}for(var f=new Float32Array(2*s*3),l=0,h=s;h>l;l++)for(var p=0;2>p;p++){var v=6*l+3*p,T=c[2*l+p];f[v+0]=a.getX(T),f[v+1]=a.getY(T),f[v+2]=a.getZ(T)}this.addAttribute("position",new me(f,3))}else{for(var a=e.attributes.position.array,s=a.length/3,S=s/3,f=new Float32Array(2*s*3),l=0,h=S;h>l;l++)for(var p=0;3>p;p++){var v=18*l+6*p,R=9*l+3*p;f[v+0]=a[R],f[v+1]=a[R+1],f[v+2]=a[R+2];var T=9*l+3*((p+1)%3);f[v+3]=a[T],f[v+4]=a[T+1],f[v+5]=a[T+2]}this.addAttribute("position",new me(f,3))}}function Pt(e,t,n){Se.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n};var r,a,o,s,c,l=this.vertices,h=this.faces,u=this.faceVertexUvs[0],p=t+1;for(r=0;n>=r;r++)for(c=r/n,a=0;t>=a;a++)s=a/t,o=e(s,c),l.push(o);var d,f,m,v,g,y,x,b;for(r=0;n>r;r++)for(a=0;t>a;a++)d=r*p+a,f=r*p+a+1,m=(r+1)*p+a+1,v=(r+1)*p+a,g=new i(a/t,r/n),y=new i((a+1)/t,r/n),x=new i((a+1)/t,(r+1)/n),b=new i(a/t,(r+1)/n),h.push(new de(d,f,v)),u.push([g,y,b]),h.push(new de(f,m,v)),u.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()}function Ut(e,t,n,r){function a(e){var t=e.normalize().clone();t.index=p.vertices.push(t)-1;var n=c(e)/2/Math.PI+.5,r=h(e)/Math.PI+.5;return t.uv=new i(n,1-r),t}function o(e,t,i){var n=new de(e.index,t.index,i.index,[e.clone(),t.clone(),i.clone()]);p.faces.push(n),w.copy(e).add(t).add(i).divideScalar(3);var r=c(w);p.faceVertexUvs[0].push([u(e.uv,e,r),u(t.uv,t,r),u(i.uv,i,r)])}function s(e,t){for(var i=Math.pow(2,t),n=a(p.vertices[e.a]),r=a(p.vertices[e.b]),s=a(p.vertices[e.c]),c=[],l=0;i>=l;l++){c[l]=[];for(var h=a(n.clone().lerp(s,l/i)),u=a(r.clone().lerp(s,l/i)),d=i-l,f=0;d>=f;f++)0===f&&l===i?c[l][f]=h:c[l][f]=a(h.clone().lerp(u,f/d))}for(var l=0;i>l;l++)for(var f=0;2*(i-l)-1>f;f++){var m=Math.floor(f/2);f%2===0?o(c[l][m+1],c[l+1][m],c[l][m]):o(c[l][m+1],c[l+1][m+1],c[l+1][m])}}function c(e){return Math.atan2(e.z,-e.x)}function h(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function u(e,t,n){return 0>n&&1===e.x&&(e=new i(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new i(n/2/Math.PI+.5,e.y)),e.clone()}Se.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;for(var p=this,d=0,f=e.length;f>d;d+=3)a(new l(e[d],e[d+1],e[d+2]));for(var m=this.vertices,v=[],d=0,g=0,f=t.length;f>d;d+=3,g++){var y=m[t[d]],x=m[t[d+1]],b=m[t[d+2]];v[g]=new de(y.index,x.index,b.index,[y.clone(),x.clone(),b.clone()])}for(var w=new l,d=0,f=v.length;f>d;d++)s(v[d],r);for(var d=0,f=this.faceVertexUvs[0].length;f>d;d++){var _=this.faceVertexUvs[0][d],E=_[0].x,M=_[1].x,T=_[2].x,S=Math.max(E,M,T),R=Math.min(E,M,T);S>.9&&.1>R&&(.2>E&&(_[0].x+=1),.2>M&&(_[1].x+=1),.2>T&&(_[2].x+=1))}for(var d=0,f=this.vertices.length;f>d;d++)this.vertices[d].multiplyScalar(n);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new te(new l,n)}function It(e,t){var i=[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];Ut.call(this,i,n,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}function Ot(e,t){var i=[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];Ut.call(this,i,n,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}function Dt(e,t){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],r=[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];Ut.call(this,n,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}function Nt(e,t){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-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,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,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];Ut.call(this,r,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}function Ft(e,t,n,r,a,o){function s(e,t,i){return P.vertices.push(new l(e,t,i))-1}Se.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:n,radialSegments:r,closed:a,taper:o},t=t||64,n=n||1,r=r||8,a=a||!1,o=o||Ft.NoTaper;var c,h,u,p,d,f,m,v,g,y,x,b,w,_,E,M,T,S,R,A,L,C=[],P=this,U=t+1,I=new l,O=new Ft.FrenetFrames(e,t,a),D=O.tangents,N=O.normals,F=O.binormals;for(this.tangents=D,this.normals=N,this.binormals=F,y=0;U>y;y++)for(C[y]=[],p=y/(U-1),g=e.getPointAt(p),c=D[y],h=N[y],u=F[y],f=n*o(p),x=0;r>x;x++)d=x/r*2*Math.PI,m=-f*Math.cos(d),v=f*Math.sin(d),I.copy(g),I.x+=m*h.x+v*u.x,I.y+=m*h.y+v*u.y,I.z+=m*h.z+v*u.z,C[y][x]=s(I.x,I.y,I.z);for(y=0;t>y;y++)for(x=0;r>x;x++)b=a?(y+1)%t:y+1,w=(x+1)%r,_=C[y][x],E=C[b][x],M=C[b][w],T=C[y][w],S=new i(y/t,x/r),R=new i((y+1)/t,x/r),A=new i((y+1)/t,(x+1)/r),L=new i(y/t,(x+1)/r),this.faces.push(new de(_,E,T)),this.faceVertexUvs[0].push([S,R,L]),this.faces.push(new de(E,M,T)),this.faceVertexUvs[0].push([R.clone(),A,L.clone()]);this.computeFaceNormals(),this.computeVertexNormals()}function zt(e,t,n,r,a,o){function s(e,t,i,n,r){var a=Math.cos(e),o=Math.sin(e),s=i/t*e,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}Le.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:a,q:o},e=e||100,t=t||40,n=Math.floor(n)||64,r=Math.floor(r)||8,a=a||2,o=o||3;var c,h,u=(r+1)*(n+1),p=r*n*2*3,d=new me(new(p>65535?Uint32Array:Uint16Array)(p),1),f=new me(new Float32Array(3*u),3),m=new me(new Float32Array(3*u),3),v=new me(new Float32Array(2*u),2),g=0,y=0,x=new l,b=new l,w=new i,_=new l,E=new l,M=new l,T=new l,S=new l;for(c=0;n>=c;++c){var R=c/n*a*Math.PI*2;for(s(R,a,o,e,_),s(R+.01,a,o,e,E),T.subVectors(E,_),S.addVectors(E,_),M.crossVectors(T,S),S.crossVectors(M,T),M.normalize(),S.normalize(),h=0;r>=h;++h){var A=h/r*Math.PI*2,L=-t*Math.cos(A),C=t*Math.sin(A);x.x=_.x+(L*S.x+C*M.x),x.y=_.y+(L*S.y+C*M.y),x.z=_.z+(L*S.z+C*M.z),f.setXYZ(g,x.x,x.y,x.z),b.subVectors(x,_).normalize(),m.setXYZ(g,b.x,b.y,b.z),w.x=c/n,w.y=h/r,v.setXY(g,w.x,w.y),g++}}for(h=1;n>=h;h++)for(c=1;r>=c;c++){var P=(r+1)*(h-1)+(c-1),U=(r+1)*h+(c-1),I=(r+1)*h+c,O=(r+1)*(h-1)+c;d.setX(y,P),y++,d.setX(y,U),y++,d.setX(y,O),y++,d.setX(y,U),y++,d.setX(y,I),y++,d.setX(y,O),y++}this.setIndex(d),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",v)}function Bt(e,t,i,n,r,a,o){Se.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new zt(e,t,i,n,r,a)),this.mergeVertices()}function Ht(e,t,i,n,r){Le.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},e=e||100,t=t||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;var a,o,s=(i+1)*(n+1),c=i*n*2*3,h=new(c>65535?Uint32Array:Uint16Array)(c),u=new Float32Array(3*s),p=new Float32Array(3*s),d=new Float32Array(2*s),f=0,m=0,v=0,g=new l,y=new l,x=new l;for(a=0;i>=a;a++)for(o=0;n>=o;o++){var b=o/n*r,w=a/i*Math.PI*2;y.x=(e+t*Math.cos(w))*Math.cos(b),y.y=(e+t*Math.cos(w))*Math.sin(b),y.z=t*Math.sin(w),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,g.x=e*Math.cos(b),g.y=e*Math.sin(b),x.subVectors(y,g).normalize(),p[f]=x.x,p[f+1]=x.y,p[f+2]=x.z,d[m]=o/n,d[m+1]=a/i,f+=3,m+=2}for(a=1;i>=a;a++)for(o=1;n>=o;o++){var _=(n+1)*a+o-1,E=(n+1)*(a-1)+o-1,M=(n+1)*(a-1)+o,T=(n+1)*a+o;h[v]=_,h[v+1]=E,h[v+2]=T,h[v+3]=E,h[v+4]=M,h[v+5]=T,v+=6}this.setIndex(new me(h,1)),this.addAttribute("position",new me(u,3)),this.addAttribute("normal",new me(p,3)),this.addAttribute("uv",new me(d,2))}function Gt(e,t,i,n,r){Se.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new Ht(e,t,i,n,r))}function Vt(e,t){return"undefined"==typeof e?void(e=[]):(Se.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())}function kt(e,t){t=t||{};var i=t.font;if((i&&i.isFont)===!1)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Se;var n=i.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Vt.call(this,n,t),this.type="TextGeometry"}function jt(e,t,i,n,r,a,o){Le.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},e=e||50,t=Math.max(3,Math.floor(t)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;for(var s=a+o,c=(t+1)*(i+1),h=new me(new Float32Array(3*c),3),u=new me(new Float32Array(3*c),3),p=new me(new Float32Array(2*c),2),d=0,f=[],m=new l,v=0;i>=v;v++){for(var g=[],y=v/i,x=0;t>=x;x++){var b=x/t,w=-e*Math.cos(n+b*r)*Math.sin(a+y*o),_=e*Math.cos(a+y*o),E=e*Math.sin(n+b*r)*Math.sin(a+y*o);m.set(w,_,E).normalize(),h.setXYZ(d,w,_,E),u.setXYZ(d,m.x,m.y,m.z),p.setXY(d,b,1-y),g.push(d),d++}f.push(g)}for(var M=[],v=0;i>v;v++)for(var x=0;t>x;x++){var T=f[v][x+1],S=f[v][x],R=f[v+1][x],A=f[v+1][x+1];(0!==v||a>0)&&M.push(T,S,A),(v!==i-1||s<Math.PI)&&M.push(S,R,A)}this.setIndex(new(h.count>65535?_e:be)(M,1)),this.addAttribute("position",h),this.addAttribute("normal",u),this.addAttribute("uv",p),this.boundingSphere=new te(new l,e)}function Wt(e,t,i,n,r,a,o){Se.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new jt(e,t,i,n,r,a,o))}function Xt(e,t,n,r,a,o){Le.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:a,thetaLength:o},e=e||20,t=t||50,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,c,h,u=(n+1)*(r+1),p=n*r*2*3,d=new me(new(p>65535?Uint32Array:Uint16Array)(p),1),f=new me(new Float32Array(3*u),3),m=new me(new Float32Array(3*u),3),v=new me(new Float32Array(2*u),2),g=0,y=0,x=e,b=(t-e)/r,w=new l,_=new i;for(c=0;r>=c;c++){for(h=0;n>=h;h++)s=a+h/n*o,w.x=x*Math.cos(s),w.y=x*Math.sin(s),f.setXYZ(g,w.x,w.y,w.z),m.setXYZ(g,0,0,1),_.x=(w.x/t+1)/2,_.y=(w.y/t+1)/2,v.setXY(g,_.x,_.y),g++;x+=b}for(c=0;r>c;c++){var E=c*(n+1);for(h=0;n>h;h++){s=h+E;var M=s,T=s+n+1,S=s+n+2,R=s+1;d.setX(y,M),y++,d.setX(y,T),y++,d.setX(y,S),y++,d.setX(y,M),y++,d.setX(y,S),y++,d.setX(y,R),y++}}this.setIndex(d),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",v)}function Yt(e,t,i,n,r,a){Se.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new Xt(e,t,i,n,r,a))}function qt(e,t,i,n){Se.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Ue(e,t,i,n))}function Zt(t,n,r,a){Le.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:n,phiStart:r,phiLength:a},n=Math.floor(n)||12,r=r||0,a=a||2*Math.PI,a=e.Math.clamp(a,0,2*Math.PI);var o,s,c,h=(n+1)*t.length,u=n*t.length*2*3,p=new me(new(u>65535?Uint32Array:Uint16Array)(u),1),d=new me(new Float32Array(3*h),3),f=new me(new Float32Array(2*h),2),m=0,v=0,g=1/n,y=new l,x=new i;for(s=0;n>=s;s++){var b=r+s*g*a,w=Math.sin(b),_=Math.cos(b);for(c=0;c<=t.length-1;c++)y.x=t[c].x*w,y.y=t[c].y,y.z=t[c].x*_,d.setXYZ(m,y.x,y.y,y.z),x.x=s/n,x.y=c/(t.length-1),f.setXY(m,x.x,x.y),m++}for(s=0;n>s;s++)for(c=0;c<t.length-1;c++){o=c+s*t.length;var E=o,M=o+t.length,T=o+t.length+1,S=o+1;p.setX(v,E),v++,p.setX(v,M),v++,p.setX(v,S),v++,p.setX(v,M),v++,p.setX(v,T),v++,p.setX(v,S),v++}if(this.setIndex(p),this.addAttribute("position",d),this.addAttribute("uv",f),this.computeVertexNormals(),a===2*Math.PI){var R=this.attributes.normal.array,A=new l,L=new l,C=new l;for(o=n*t.length*3,s=0,c=0;s<t.length;s++,c+=3)A.x=R[c+0],A.y=R[c+1],A.z=R[c+2],L.x=R[o+c+0],L.y=R[o+c+1],L.z=R[o+c+2],C.addVectors(A,L).normalize(),R[c+0]=R[o+c+0]=C.x,R[c+1]=R[o+c+1]=C.y,R[c+2]=R[o+c+2]=C.z}}function Jt(e,t,i,n){Se.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},this.fromBufferGeometry(new Zt(e,t,i,n)),this.mergeVertices()}function Qt(e,t){Se.call(this),this.type="ShapeGeometry",Array.isArray(e)===!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()}function Kt(t,i){function n(e,t){return e-t}Le.call(this),i=void 0!==i?i:1;var r,a=Math.cos(e.Math.DEG2RAD*i),o=[0,0],s={},c=["a","b","c"];t&&t.isBufferGeometry?(r=new Se,r.fromBufferGeometry(t)):r=t.clone(),r.mergeVertices(),r.computeFaceNormals();for(var l=r.vertices,h=r.faces,u=0,p=h.length;p>u;u++)for(var d=h[u],f=0;3>f;f++){o[0]=d[c[f]],o[1]=d[c[(f+1)%3]],o.sort(n);var m=o.toString();void 0===s[m]?s[m]={vert1:o[0],vert2:o[1],face1:u,face2:void 0}:s[m].face2=u}var v=[];for(var m in s){var g=s[m];if(void 0===g.face2||h[g.face1].normal.dot(h[g.face2].normal)<=a){var y=l[g.vert1];v.push(y.x),v.push(y.y),v.push(y.z),y=l[g.vert2],v.push(y.x),v.push(y.y),v.push(y.z)}}this.addAttribute("position",new me(new Float32Array(v),3))}function $t(e,t,n,r,a,o,s,c){function h(){var e=(r+1)*(a+1);return o===!1&&(e+=(r+1)*m+r*m),e}function u(){var e=r*a*2*3;return o===!1&&(e+=r*m*3),e}function p(){var i,o,h=new l,u=new l,p=0,d=(t-e)/n;for(o=0;a>=o;o++){var m=[],v=o/a,g=v*(t-e)+e;for(i=0;r>=i;i++){var R=i/r,A=R*c+s,L=Math.sin(A),C=Math.cos(A);u.x=g*L,u.y=-v*n+T,u.z=g*C,x.setXYZ(_,u.x,u.y,u.z),h.set(L,d,C).normalize(),b.setXYZ(_,h.x,h.y,h.z),w.setXY(_,R,1-v),m.push(_),_++}M.push(m)}for(i=0;r>i;i++)for(o=0;a>o;o++){var P=M[o][i],U=M[o+1][i],I=M[o+1][i+1],O=M[o][i+1];y.setX(E,P),E++,y.setX(E,U),E++,y.setX(E,O),E++,y.setX(E,U),E++,y.setX(E,I),E++,y.setX(E,O),E++,p+=6}f.addGroup(S,p,0),S+=p}function d(n){var a,o,h,u=new i,p=new l,d=0,m=n===!0?e:t,v=n===!0?1:-1;for(o=_,a=1;r>=a;a++)x.setXYZ(_,0,T*v,0),b.setXYZ(_,0,v,0),u.x=.5,u.y=.5,w.setXY(_,u.x,u.y),_++;for(h=_,a=0;r>=a;a++){var g=a/r,M=g*c+s,R=Math.cos(M),A=Math.sin(M);p.x=m*A,p.y=T*v,p.z=m*R,x.setXYZ(_,p.x,p.y,p.z),b.setXYZ(_,0,v,0),u.x=.5*R+.5,u.y=.5*A*v+.5,w.setXY(_,u.x,u.y),_++}for(a=0;r>a;a++){var L=o+a,C=h+a;n===!0?(y.setX(E,C),E++,y.setX(E,C+1),E++,y.setX(E,L),E++):(y.setX(E,C+1),E++,y.setX(E,C),E++,y.setX(E,L),E++),d+=3}f.addGroup(S,d,n===!0?1:2),S+=d}Le.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:c};var f=this;e=void 0!==e?e:20,t=void 0!==t?t:20,n=void 0!==n?n:100,r=Math.floor(r)||8,a=Math.floor(a)||1,o=void 0!==o?o:!1,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var m=0;o===!1&&(e>0&&m++,t>0&&m++);var v=h(),g=u(),y=new me(new(g>65535?Uint32Array:Uint16Array)(g),1),x=new me(new Float32Array(3*v),3),b=new me(new Float32Array(3*v),3),w=new me(new Float32Array(2*v),2),_=0,E=0,M=[],T=n/2,S=0;p(),o===!1&&(e>0&&d(!0),t>0&&d(!1)),this.setIndex(y),this.addAttribute("position",x),this.addAttribute("normal",b),this.addAttribute("uv",w)}function ei(e,t,i,n,r,a,o,s){Se.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new $t(e,t,i,n,r,a,o,s)),this.mergeVertices()}function ti(e,t,i,n,r,a,o){ei.call(this,0,e,t,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function ii(e,t,i,n,r,a,o){$t.call(this,0,e,t,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,thetaStart:a,thetaLength:o}}function ni(e,t,i,n){Le.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},e=e||50,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r=t+2,a=new Float32Array(3*r),o=new Float32Array(3*r),s=new Float32Array(2*r);o[2]=1,s[0]=.5,s[1]=.5;for(var c=0,h=3,u=2;t>=c;c++,h+=3,u+=2){var p=i+c/t*n;a[h]=e*Math.cos(p),a[h+1]=e*Math.sin(p),o[h+2]=1,s[u]=(a[h]/e+1)/2,s[u+1]=(a[h+1]/e+1)/2}for(var d=[],h=1;t>=h;h++)d.push(h,h+1,0);this.setIndex(new me(new Uint16Array(d),1)),this.addAttribute("position",new me(a,3)),this.addAttribute("normal",new me(o,3)),this.addAttribute("uv",new me(s,2)),this.boundingSphere=new te(new l,e)}function ri(e,t,i,n){Se.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new ni(e,t,i,n))}function ai(e,t,i,n,r,a){Se.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Pe(e,t,i,n,r,a)),this.mergeVertices()}function oi(){K.call(this,{uniforms:e.UniformsUtils.merge([Oc.lights,{opacity:{value:1}}]),vertexShader:Ic.shadow_vert,fragmentShader:Ic.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}}})}function si(e){K.call(this,e),this.type="RawShaderMaterial"}function ci(t){this.uuid=e.Math.generateUUID(),this.type="MultiMaterial",this.materials=t instanceof Array?t:[],this.visible=!0}function li(e){J.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new X(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 X(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(e)}function hi(e){li.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function ui(e){J.call(this),this.type="MeshPhongMaterial",this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(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=ra,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(e)}function pi(e){J.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.morphTargets=!1,this.setValues(e)}function di(e){J.call(this),this.type="MeshLambertMaterial",this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ra,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(e)}function fi(e){J.call(this),this.type="LineDashedMaterial",this.color=new X(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(e)}function mi(e,t,i){var n=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,r===!1&&void 0!==n.onStart&&n.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==n.onProgress&&n.onProgress(e,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)}}function vi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function gi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager,this._parser=null}function yi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager,this._parser=null}function xi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function bi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function wi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function _i(e,t){le.call(this),this.type="Light",this.color=new X(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Ei(e,t,i){_i.call(this,e,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(le.DefaultUp),this.updateMatrix(),this.groundColor=new X(t)}function Mi(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Ti(){Mi.call(this,new Oe(50,1,.5,500))}function Si(e,t,i,n,r,a){_i.call(this,e,t),this.type="SpotLight",this.position.copy(le.DefaultUp),this.updateMatrix(),this.target=new le,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Ti}function Ri(e,t,i,n){_i.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Mi(new Oe(90,1,.5,500))}function Ai(e){Mi.call(this,new De(-5,5,5,-5,.5,500))}function Li(e,t){_i.call(this,e,t),this.type="DirectionalLight",this.position.copy(le.DefaultUp),this.updateMatrix(),this.target=new le,this.shadow=new Ai}function Ci(e,t){_i.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Pi(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i}function Ui(e,t,i,n){Pi.call(this,e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ii(e,t,i,n){Pi.call(this,e,t,i,n)}function Oi(e,t,i,n){Pi.call(this,e,t,i,n)}function Di(t,i,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===i||0===i.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=e.AnimationUtils.convertArray(i,this.TimeBufferType),this.values=e.AnimationUtils.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function Ni(e,t,i,n){Di.call(this,e,t,i,n)}function Fi(e,t,i,n){Pi.call(this,e,t,i,n)}function zi(e,t,i,n){Di.call(this,e,t,i,n)}function Bi(e,t,i,n){Di.call(this,e,t,i,n)}function Hi(e,t,i,n){Di.call(this,e,t,i,n)}function Gi(e,t,i){Di.call(this,e,t,i)}function Vi(e,t,i,n){Di.call(this,e,t,i,n)}function ki(e,t,i,n){Di.apply(this,arguments)}function ji(t,i,n){this.name=t,this.tracks=n,this.duration=void 0!==i?i:-1,this.uuid=e.Math.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Wi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager,this.textures={}}function Xi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function Yi(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function qi(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:e.DefaultLoadingManager,this.withCredentials=!1}function Zi(t){this.manager=void 0!==t?t:e.DefaultLoadingManager,this.texturePath=""}function Ji(){}function Qi(e,t){this.v1=e,this.v2=t}function Ki(){this.curves=[],this.autoClose=!1}function $i(e,t,i,n,r,a,o,s){this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function en(e){this.points=void 0===e?[]:e}function tn(e,t,i,n){this.v0=e,this.v1=t,this.v2=i,this.v3=n}function nn(e,t,i){this.v0=e,this.v1=t,this.v2=i}function rn(){an.apply(this,arguments),this.holes=[]}function an(e){Ki.call(this),this.currentPoint=new i,e&&this.fromPoints(e)}function on(){this.subPaths=[],this.currentPath=null}function sn(e){this.data=e}function cn(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function ln(){return void 0===Wc&&(Wc=new(window.AudioContext||window.webkitAudioContext)),Wc}function hn(t){this.manager=void 0!==t?t:e.DefaultLoadingManager}function un(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Oe,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Oe,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function pn(e,t,i){le.call(this),this.type="CubeCamera";var n=90,r=1,a=new Oe(n,r,e,t);a.up.set(0,-1,0),a.lookAt(new l(1,0,0)),this.add(a);var o=new Oe(n,r,e,t);o.up.set(0,-1,0),o.lookAt(new l(-1,0,0)),this.add(o);var c=new Oe(n,r,e,t);
c.up.set(0,0,1),c.lookAt(new l(0,1,0)),this.add(c);var h=new Oe(n,r,e,t);h.up.set(0,0,-1),h.lookAt(new l(0,-1,0)),this.add(h);var u=new Oe(n,r,e,t);u.up.set(0,-1,0),u.lookAt(new l(0,0,1)),this.add(u);var p=new Oe(n,r,e,t);p.up.set(0,-1,0),p.lookAt(new l(0,0,-1)),this.add(p);var d={format:Wa,magFilter:Aa,minFilter:Aa};this.renderTarget=new s(i,i,d),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,n=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,e.render(t,a,i),i.activeCubeFace=1,e.render(t,o,i),i.activeCubeFace=2,e.render(t,c,i),i.activeCubeFace=3,e.render(t,h,i),i.activeCubeFace=4,e.render(t,u,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,e.render(t,p,i),e.setRenderTarget(null)}}function dn(){le.call(this),this.type="AudioListener",this.context=ln(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function fn(e){le.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function mn(e){fn.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function vn(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function gn(e,t,i){this.binding=e,this.valueSize=i;var n,r=Float64Array;switch(t){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function yn(e,t,i){this.path=t,this.parsedPath=i||yn.parseTrackName(t),this.node=yn.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function xn(t){this.uuid=e.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var i={};this._indicesByUUID=i;for(var n=0,r=arguments.length;n!==r;++n)i[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var a=this;this.stats={objects:{get total(){return a._objects.length},get inUse(){return this.total-a.nCachedObjects_}},get bindingsPerObject(){return a._bindings.length}}}function bn(e,t,i){this._mixer=e,this._clip=t,this._localRoot=i||null;for(var n=t.tracks,r=n.length,a=new Array(r),o={endingStart:fo,endingEnd:fo},s=0;s!==r;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=co,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 wn(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function _n(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e,this.dynamic=!1}function En(){Le.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Mn(t,i,n,r){this.uuid=e.Math.generateUUID(),this.data=t,this.itemSize=i,this.offset=n,this.normalized=r===!0}function Tn(t,i){this.uuid=e.Math.generateUUID(),this.array=t,this.stride=i,this.count=void 0!==t?t.length/i:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Sn(e,t,i){Tn.call(this,e,t),this.meshPerAttribute=i||1}function Rn(e,t,i){me.call(this,e,t),this.meshPerAttribute=i||1}function An(e,t,i,n){this.ray=new oe(e,t),this.near=i||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 Ln(e,t){return e.distance-t.distance}function Cn(e,t,i,n){if(e.visible!==!1&&(e.raycast(t,i),n===!0))for(var r=e.children,a=0,o=r.length;o>a;a++)Cn(r[a],t,i,!0)}function Pn(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Un(e){function t(e,t,i,n,r,a,o){var s=.5*(i-e),c=.5*(n-t);return(2*(t-i)+s+c)*o+(-3*(t-i)-2*s-c)*a+s*r+t}this.points=e;var i,n,r,a,o,s,c,h,u,p=[],d={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return i=(this.points.length-1)*e,n=Math.floor(i),r=i-n,p[0]=0===n?n:n-1,p[1]=n,p[2]=n>this.points.length-2?this.points.length-1:n+1,p[3]=n>this.points.length-3?this.points.length-1:n+2,s=this.points[p[0]],c=this.points[p[1]],h=this.points[p[2]],u=this.points[p[3]],a=r*r,o=r*a,d.x=t(s.x,c.x,h.x,u.x,r,a,o),d.y=t(s.y,c.y,h.y,u.y,r,a,o),d.z=t(s.z,c.z,h.z,u.z,r,a,o),d},this.getControlPointsArray=function(){var e,t,i=this.points.length,n=[];for(e=0;i>e;e++)t=this.points[e],n[e]=[t.x,t.y,t.z];return n},this.getLength=function(e){var t,i,n,r,a=0,o=0,s=0,c=new l,h=new l,u=[],p=0;for(u[0]=0,e||(e=100),n=this.points.length*e,c.copy(this.points[0]),t=1;n>t;t++)i=t/n,r=this.getPoint(i),h.copy(r),p+=h.distanceTo(c),c.copy(r),a=(this.points.length-1)*i,o=Math.floor(a),o!==s&&(u[o]=p,s=o);return u[u.length]=p,{chunks:u,total:p}},this.reparametrizeByArcLength=function(e){var t,i,n,r,a,o,s,c,h=[],u=new l,p=this.getLength();for(h.push(u.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(o=p.chunks[t]-p.chunks[t-1],s=Math.ceil(e*o/p.total),r=(t-1)/(this.points.length-1),a=t/(this.points.length-1),i=1;s-1>i;i++)n=r+i*(1/s)*(a-r),c=this.getPoint(n),h.push(u.copy(c).clone());h.push(u.copy(this.points[t]).clone())}this.points=h}}function In(e,t,i){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==i?i:0,this}function On(e,t){Ce.call(this,e,t),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n="__default",r=0,a=i-1,o=i/1;this.createAnimation(n,r,a,o),this.setAnimationWeight(n,1)}function Dn(e){le.call(this),this.material=e,this.render=function(e){}}function Nn(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==i?i: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 Le,l=new Ee(2*o*3,3);c.addAttribute("position",l),_t.call(this,c,new bt({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Fn(e){le.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;for(var t=new Le,i=[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,r=1,a=32;a>n;n++,r++){var o=n/a*Math.PI*2,s=r/a*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}t.addAttribute("position",new Ee(i,3));var c=new bt({fog:!1});this.cone=new _t(t,c),this.add(this.cone),this.update()}function zn(e){this.bones=this.getBoneList(e);for(var t=new Se,i=0;i<this.bones.length;i++){var n=this.bones[i];n.parent&&n.parent.isBone&&(t.vertices.push(new l),t.vertices.push(new l),t.colors.push(new X(0,0,1)),t.colors.push(new X(0,1,0)))}t.dynamic=!0;var r=new bt({vertexColors:Sr,depthTest:!1,depthWrite:!1,transparent:!0});_t.call(this,t,r),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Bn(e,t){this.light=e,this.light.updateMatrixWorld();var i=new jt(t,4,2),n=new fe({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),Ce.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function Hn(e,t){le.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new X,new X];var i=new Wt(t,4,2);i.rotateX(-Math.PI/2);for(var n=0,r=8;r>n;n++)i.faces[n].color=this.colors[4>n?0:1];var a=new fe({vertexColors:Tr,wireframe:!0});this.lightSphere=new Ce(i,a),this.add(this.lightSphere),this.update()}function Gn(e,t,i,n){t=t||1,i=new X(void 0!==i?i:4473924),n=new X(void 0!==n?n:8947848);for(var r=t/2,a=2*e/t,o=[],s=[],c=0,l=0,h=-e;t>=c;c++,h+=a){o.push(-e,0,h,e,0,h),o.push(h,0,-e,h,0,e);var u=c===r?i:n;u.toArray(s,l),l+=3,u.toArray(s,l),l+=3,u.toArray(s,l),l+=3,u.toArray(s,l),l+=3}var p=new Le;p.addAttribute("position",new Ee(o,3)),p.addAttribute("color",new Ee(s,3));var d=new bt({vertexColors:Sr});_t.call(this,p,d)}function Vn(e,t,i,n){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==i?i: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 Le,l=new Ee(2*o*3,3);c.addAttribute("position",l),_t.call(this,c,new bt({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function kn(e,t){le.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,void 0===t&&(t=1);var i=new Le;i.addAttribute("position",new Ee([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var n=new bt({fog:!1});this.add(new wt(i,n)),i=new Le,i.addAttribute("position",new Ee([0,0,0,0,0,1],3)),this.add(new wt(i,n)),this.update()}function jn(e){function t(e,t,n){i(e,n),i(t,n)}function i(e,t){n.vertices.push(new l),n.colors.push(new X(t)),void 0===a[e]&&(a[e]=[]),a[e].push(n.vertices.length-1)}var n=new Se,r=new bt({color:16777215,vertexColors:Tr}),a={},o=16755200,s=16711680,c=43775,h=16777215,u=3355443;t("n1","n2",o),t("n2","n4",o),t("n4","n3",o),t("n3","n1",o),t("f1","f2",o),t("f2","f4",o),t("f4","f3",o),t("f3","f1",o),t("n1","f1",o),t("n2","f2",o),t("n3","f3",o),t("n4","f4",o),t("p","n1",s),t("p","n2",s),t("p","n3",s),t("p","n4",s),t("u1","u2",c),t("u2","u3",c),t("u3","u1",c),t("c","t",h),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),_t.call(this,n,r),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Wn(e,t){var i=void 0!==t?t:8947848;this.object=e,this.box=new ee,Ce.call(this,new ai(1,1,1),new fe({color:i,wireframe:!0}))}function Xn(e,t){void 0===t&&(t=16776960);var i=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),r=new Le;r.setIndex(new me(i,1)),r.addAttribute("position",new me(n,3)),_t.call(this,r,new bt({color:t})),void 0!==e&&this.update(e)}function Yn(e,t,i,n,r,a){le.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),this.position.copy(t),this.line=new wt(Xc,new bt({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ce(Yc,new fe({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,r,a)}function qn(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),i=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new Le;n.addAttribute("position",new me(t,3)),n.addAttribute("color",new me(i,3));var r=new bt({vertexColors:Sr});_t.call(this,n,r)}function Zn(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),e.CatmullRomCurve3.call(this,t),this.type="catmullrom",this.closed=!0}function Jn(e,t,i,n,r,a){$i.call(this,e,t,i,i,n,r,a)}function Qn(e,t,i,n,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new de(e,t,i,r,a,o)}function Kn(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Mt(e,t)}function $n(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Mt(e,t)}function er(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Et(e)}function tr(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Et(e)}function ir(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Et(e)}function nr(e,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new l(e,t,i)}function rr(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new _t(new Kt(e.geometry),new bt({color:void 0!==t?t:16777215}))}function ar(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new _t(new Ct(e.geometry),new bt({color:void 0!==t?t:16777215}))}function or(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function sr(){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(){}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(void 0!==n&&null!==n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}}(),Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var i=this._listeners,n=i[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,i=t[e.type];if(void 0!==i){e.target=this;var n=[],r=0,a=i.length;for(r=0;a>r;r++)n[r]=i[r];for(r=0;a>r;r++)n[r].call(this,e)}}}});var cr="81",lr={LEFT:0,MIDDLE:1,RIGHT:2},hr=0,ur=1,pr=2,dr=3,fr=0,mr=1,vr=0,gr=1,yr=2,xr=0,br=1,wr=2,_r=1,Er=2,Mr=0,Tr=1,Sr=2,Rr=0,Ar=1,Lr=2,Cr=3,Pr=4,Ur=5,Ir={NoBlending:Rr,NormalBlending:Ar,AdditiveBlending:Lr,SubtractiveBlending:Cr,MultiplyBlending:Pr,CustomBlending:Ur},Or=100,Dr=101,Nr=102,Fr=103,zr=104,Br=200,Hr=201,Gr=202,Vr=203,kr=204,jr=205,Wr=206,Xr=207,Yr=208,qr=209,Zr=210,Jr=0,Qr=1,Kr=2,$r=3,ea=4,ta=5,ia=6,na=7,ra=0,aa=1,oa=2,sa=0,ca=1,la=2,ha=3,ua=4,pa=300,da=301,fa=302,ma=303,va=304,ga=305,ya=306,xa=307,ba={UVMapping:pa,CubeReflectionMapping:da,CubeRefractionMapping:fa,EquirectangularReflectionMapping:ma,EquirectangularRefractionMapping:va,SphericalReflectionMapping:ga,CubeUVReflectionMapping:ya,CubeUVRefractionMapping:xa},wa=1e3,_a=1001,Ea=1002,Ma={RepeatWrapping:wa,ClampToEdgeWrapping:_a,MirroredRepeatWrapping:Ea},Ta=1003,Sa=1004,Ra=1005,Aa=1006,La=1007,Ca=1008,Pa={NearestFilter:Ta,NearestMipMapNearestFilter:Sa,NearestMipMapLinearFilter:Ra,LinearFilter:Aa,LinearMipMapNearestFilter:La,LinearMipMapLinearFilter:Ca},Ua=1009,Ia=1010,Oa=1011,Da=1012,Na=1013,Fa=1014,za=1015,Ba=1016,Ha=1017,Ga=1018,Va=1019,ka=1020,ja=1021,Wa=1022,Xa=1023,Ya=1024,qa=1025,Za=Xa,Ja=1026,Qa=1027,Ka=2001,$a=2002,eo=2003,to=2004,io=2100,no=2101,ro=2102,ao=2103,oo=2151,so=2200,co=2201,lo=2202,ho=2300,uo=2301,po=2302,fo=2400,mo=2401,vo=2402,go=0,yo=1,xo=2,bo=3e3,wo=3001,_o=3007,Eo=3002,Mo=3003,To=3004,So=3005,Ro=3006,Ao=3200,Lo=3201;e.Math={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=new Array(36),n=0;return function(){for(var r=0;36>r;r++)8===r||13===r||18===r||23===r?i[r]="-":14===r?i[r]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,i[r]=t[19===r?3&e|8:e]);return i.join("")}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,n,r){return n+(e-t)*(r-n)/(i-t)},smoothstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))},smootherstep:function(e,t,i){return t>=e?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(t){return t*e.Math.DEG2RAD},radToDeg:function(t){return t*e.Math.RAD2DEG},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},i.prototype={constructor:i,isVector2:!0,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(n,r){return void 0===e&&(e=new i,t=new i),e.set(n,n),t.set(r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},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(e){return this.x*e.x+this.y*e.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 e=Math.atan2(this.y,this.x);return 0>e&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}},n.DEFAULT_IMAGE=void 0,n.DEFAULT_MAPPING=pa,n.prototype={constructor:n,isTexture:!0,set needsUpdate(e){e===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(t){function i(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.4,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=e.Math.generateUUID()),void 0===t.images[r.uuid]&&(t.images[r.uuid]={uuid:r.uuid,url:i(r)}),n.image=r.uuid}return t.textures[this.uuid]=n,n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===pa){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case wa:e.x=e.x-Math.floor(e.x);break;case _a:e.x=e.x<0?0:1;break;case Ea:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case wa:e.y=e.y-Math.floor(e.y);break;case _a:e.y=e.y<0?0:1;break;case Ea:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},Object.assign(n.prototype,t.prototype);var Co=0;a.prototype={constructor:a,isVector4:!0,set:function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,n,r,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],h=s[8],u=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(l-u)<a&&Math.abs(h-f)<a&&Math.abs(d-m)<a){if(Math.abs(l+u)<o&&Math.abs(h+f)<o&&Math.abs(d+m)<o&&Math.abs(c+p+v-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(c+1)/2,y=(p+1)/2,x=(v+1)/2,b=(l+u)/4,w=(h+f)/4,_=(d+m)/4;return g>y&&g>x?a>g?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(g),n=b/i,r=w/i):y>x?a>y?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(y),i=b/n,r=_/n):a>x?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(x),i=w/r,n=_/r),this.set(i,n,r,t),this}var E=Math.sqrt((m-d)*(m-d)+(h-f)*(h-f)+(u-l)*(u-l));return Math.abs(E)<.001&&(E=1),this.x=(m-d)/E,this.y=(h-f)/E,this.z=(u-l)/E,this.w=Math.acos((c+p+v-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(i,n){return void 0===e&&(e=new a,t=new a),e.set(i,i,i,i),t.set(n,n,n,n),this.clamp(e,t)}}(),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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},Object.assign(o.prototype,t.prototype,{isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.isWebGLRenderTargetCube=!0,c.prototype={constructor:c,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if((e&&e.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var i=Math.cos(e._x/2),n=Math.cos(e._y/2),r=Math.cos(e._z/2),a=Math.sin(e._x/2),o=Math.sin(e._y/2),s=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r-a*o*s):"YXZ"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r+a*o*s):"ZXY"===c?(this._x=a*n*r-i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r-a*o*s):"ZYX"===c?(this._x=a*n*r-i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r+a*o*s):"YZX"===c?(this._x=a*n*r+i*o*s,this._y=i*o*r+a*n*s,this._z=i*n*s-a*o*r,this._w=i*n*r-a*o*s):"XZY"===c&&(this._x=a*n*r-i*o*s,this._y=i*o*r-a*n*s,this._z=i*n*s+a*o*r,this._w=i*n*r+a*o*s),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],l=i[2],h=i[6],u=i[10],p=n+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-c)*t,this._y=(a-l)*t,this._z=(o-r)*t):n>s&&n>u?(t=2*Math.sqrt(1+n-s-u),
this._w=(h-c)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+l)/t):s>u?(t=2*Math.sqrt(1+s-n-u),this._w=(a-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-n-s),this._w=(o-r)/t,this._x=(a+l)/t,this._y=(c+h)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,i=1e-6;return function(n,r){return void 0===e&&(e=new l),t=n.dot(r)+1,i>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,n=e._y,r=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=i*l+a*o+n*c-r*s,this._y=n*l+a*s+r*o-i*c,this._z=r*l+a*c+i*s-n*o,this._w=a*l-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*e._w+i*e._x+n*e._y+r*e._z;if(0>o?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),l=Math.sin((1-t)*c)/s,h=Math.sin(t*c)/s;return this._w=a*l+this._w*h,this._x=i*l+this._x*h,this._y=n*l+this._y*h,this._z=r*l+this._z*h,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(c,{slerp:function(e,t,i,n){return i.copy(e).slerp(t,n)},slerpFlat:function(e,t,i,n,r,a,o){var s=i[n+0],c=i[n+1],l=i[n+2],h=i[n+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(h!==f||s!==u||c!==p||l!==d){var m=1-o,v=s*u+c*p+l*d+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 w=o*g;if(s=s*m+u*w,c=c*m+p*w,l=l*m+d*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=_,c*=_,l*=_,h*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),l.prototype={constructor:l,isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return(t&&t.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new c),this.applyQuaternion(e.setFromEuler(t))}}(),applyAxisAngle:function(){var e;return function(t,i){return void 0===e&&(e=new c),this.applyQuaternion(e.setFromAxisAngle(t,i))}}(),applyMatrix3:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this},applyMatrix4:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n+r[12],this.y=r[1]*t+r[5]*i+r[9]*n+r[13],this.z=r[2]*t+r[6]*i+r[10]*n+r[14],this},applyProjection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(e){var t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*n-o*i,l=s*i+o*t-r*n,h=s*n+r*i-a*t,u=-r*t-a*i-o*n;return this.x=c*s+u*-r+l*-o-h*-a,this.y=l*s+u*-a+h*-r-c*-o,this.z=h*s+u*-o+c*-a-l*-r,this},project:function(){var e;return function(t){return void 0===e&&(e=new h),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new h),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(i,n){return void 0===e&&(e=new l,t=new l),e.set(i,i,i),t.set(n,n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,i))/i)},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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var i=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-i*e.z,this.z=i*e.y-n*e.x,this},crossVectors:function(e,t){var i=e.x,n=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new l),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new l),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(t){var i=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(e.Math.clamp(i,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n},distanceToManhattan:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromMatrixPosition:function(e){return this.setFromMatrixColumn(e,3)},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this},setFromMatrixColumn:function(e,t){if("number"==typeof e){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var i=e;e=t,t=i}return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,i){return void 0===i&&(i=0),t=t*e.itemSize+i,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},h.prototype={constructor:h,isMatrix4:!0,set:function(e,t,i,n,r,a,o,s,c,l,h,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=n,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=h,v[14]=u,v[3]=p,v[7]=d,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 h).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new l);var i=this.elements,n=t.elements,r=1/e.setFromMatrixColumn(t,0).length(),a=1/e.setFromMatrixColumn(t,1).length(),o=1/e.setFromMatrixColumn(t,2).length();return i[0]=n[0]*r,i[1]=n[1]*r,i[2]=n[2]*r,i[4]=n[4]*a,i[5]=n[5]*a,i[6]=n[6]*a,i[8]=n[8]*o,i[9]=n[9]*o,i[10]=n[10]*o,this}}(),makeRotationFromEuler:function(e){(e&&e.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),c=Math.sin(n),l=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-o*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*c,t[1]=a*h,t[5]=a*l,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m-y*o,t[4]=-a*h,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+_,t[5]=a*l,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*l,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z,a=e.w,o=i+i,s=n+n,c=r+r,l=i*o,h=i*s,u=i*c,p=n*s,d=n*c,f=r*c,m=a*o,v=a*s,g=a*c;return t[0]=1-(p+f),t[4]=h-g,t[8]=u+v,t[1]=h+g,t[5]=1-(l+f),t[9]=d-m,t[2]=u-v,t[6]=d+m,t[10]=1-(l+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,i;return function(n,r,a){void 0===e&&(e=new l,t=new l,i=new l);var o=this.elements;return i.subVectors(n,r).normalize(),0===i.lengthSq()&&(i.z=1),e.crossVectors(a,i).normalize(),0===e.lengthSq()&&(i.z+=1e-4,e.crossVectors(a,i).normalize()),t.crossVectors(i,e),o[0]=e.x,o[4]=t.x,o[8]=i.x,o[1]=e.y,o[5]=t.y,o[9]=i.y,o[2]=e.z,o[6]=t.z,o[10]=i.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,n=t.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],l=i[1],h=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],w=n[0],_=n[4],E=n[8],M=n[12],T=n[1],S=n[5],R=n[9],A=n[13],L=n[2],C=n[6],P=n[10],U=n[14],I=n[3],O=n[7],D=n[11],N=n[15];return r[0]=a*w+o*T+s*L+c*I,r[4]=a*_+o*S+s*C+c*O,r[8]=a*E+o*R+s*P+c*D,r[12]=a*M+o*A+s*U+c*N,r[1]=l*w+h*T+u*L+p*I,r[5]=l*_+h*S+u*C+p*O,r[9]=l*E+h*R+u*P+p*D,r[13]=l*M+h*A+u*U+p*N,r[2]=d*w+f*T+m*L+v*I,r[6]=d*_+f*S+m*C+v*O,r[10]=d*E+f*R+m*P+v*D,r[14]=d*M+f*A+m*U+v*N,r[3]=g*w+y*T+x*L+b*I,r[7]=g*_+y*S+x*C+b*O,r[11]=g*E+y*R+x*P+b*D,r[15]=g*M+y*A+x*U+b*N,this},multiplyToArray:function(e,t,i){var n=this.elements;return this.multiplyMatrices(e,t),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i[4]=n[4],i[5]=n[5],i[6]=n[6],i[7]=n[7],i[8]=n[8],i[9]=n[9],i[10]=n[10],i[11]=n[11],i[12]=n[12],i[13]=n[13],i[14]=n[14],i[15]=n[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToVector3Array:function(){var e;return function(t,i,n){void 0===e&&(e=new l),void 0===i&&(i=0),void 0===n&&(n=t.length);for(var r=0,a=i;n>r;r+=3,a+=3)e.fromArray(t,a),e.applyMatrix4(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,i,n){void 0===e&&(e=new l),void 0===i&&(i=0),void 0===n&&(n=t.length/t.itemSize);for(var r=0,a=i;n>r;r++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],p=e[14],d=e[3],f=e[7],m=e[11],v=e[15];return d*(+r*s*h-n*c*h-r*o*u+i*c*u+n*o*p-i*s*p)+f*(+t*s*p-t*c*u+r*a*u-n*a*p+n*c*l-r*s*l)+m*(+t*c*h-t*o*p-r*a*h+i*a*p+r*o*l-i*c*l)+v*(-n*o*l-t*s*h+t*o*u+n*a*h-i*a*u+i*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return void 0===e&&(e=new l),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var i=this.elements,n=e.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],h=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],b=d*y*u-g*f*u+g*h*m-l*y*m-d*h*x+l*f*x,w=v*f*u-p*y*u-v*h*m+c*y*m+p*h*x-c*f*x,_=p*g*u-v*d*u+v*l*m-c*g*m-p*l*x+c*d*x,E=v*d*h-p*g*h-v*l*f+c*g*f+p*l*y-c*d*y,M=r*b+a*w+o*_+s*E;if(0===M){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t===!0)throw new Error(T);return console.warn(T),this.identity()}var S=1/M;return i[0]=b*S,i[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*S,i[2]=(l*y*s-g*h*s+g*o*u-a*y*u-l*o*x+a*h*x)*S,i[3]=(d*h*s-l*f*s-d*o*u+a*f*u+l*o*m-a*h*m)*S,i[4]=w*S,i[5]=(p*y*s-v*f*s+v*o*m-r*y*m-p*o*x+r*f*x)*S,i[6]=(v*h*s-c*y*s-v*o*u+r*y*u+c*o*x-r*h*x)*S,i[7]=(c*f*s-p*h*s+p*o*u-r*f*u-c*o*m+r*h*m)*S,i[8]=_*S,i[9]=(v*d*s-p*g*s-v*a*m+r*g*m+p*a*x-r*d*x)*S,i[10]=(c*g*s-v*l*s+v*a*u-r*g*u-c*a*x+r*l*x)*S,i[11]=(p*l*s-c*d*s-p*a*u+r*d*u+c*a*m-r*l*m)*S,i[12]=E*S,i[13]=(p*g*o-v*d*o+v*a*f-r*g*f-p*a*y+r*d*y)*S,i[14]=(v*l*o-c*g*o-v*a*h+r*g*h+c*a*y-r*l*y)*S,i[15]=(c*d*o-p*l*o+p*a*h-r*d*h-c*a*f+r*l*f)*S,this},scale:function(e){var t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))},makeTranslation:function(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,o=e.y,s=e.z,c=r*a,l=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,l*o+i,l*s-n*a,0,c*s-n*o,l*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this},compose:function(e,t,i){return this.makeRotationFromQuaternion(t),this.scale(i),this.setPosition(e),this},decompose:function(){var e,t;return function(i,n,r){void 0===e&&(e=new l,t=new h);var a=this.elements,o=e.set(a[0],a[1],a[2]).length(),s=e.set(a[4],a[5],a[6]).length(),c=e.set(a[8],a[9],a[10]).length(),u=this.determinant();0>u&&(o=-o),i.x=a[12],i.y=a[13],i.z=a[14],t.elements.set(this.elements);var p=1/o,d=1/s,f=1/c;return t.elements[0]*=p,t.elements[1]*=p,t.elements[2]*=p,t.elements[4]*=d,t.elements[5]*=d,t.elements[6]*=d,t.elements[8]*=f,t.elements[9]*=f,t.elements[10]*=f,n.setFromRotationMatrix(t),r.x=o,r.y=s,r.z=c,this}}(),makeFrustum:function(e,t,i,n,r,a){var o=this.elements,s=2*r/(t-e),c=2*r/(n-i),l=(t+e)/(t-e),h=(n+i)/(n-i),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(t,i,n,r){var a=n*Math.tan(e.Math.DEG2RAD*t*.5),o=-a,s=o*i,c=a*i;return this.makeFrustum(s,c,o,a,n,r)},makeOrthographic:function(e,t,i,n,r,a){var o=this.elements,s=1/(t-e),c=1/(i-n),l=1/(a-r),h=(t+e)*s,u=(i+n)*c,p=(a+r)*l;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]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,i=e.elements,n=0;16>n;n++)if(t[n]!==i[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;16>i;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},u.prototype=Object.create(n.prototype),u.prototype.constructor=u,u.prototype.isCubeTexture=!0,Object.defineProperty(u.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var Po=new n,Uo=new u,Io=[],Oo=[];V.prototype.setValue=function(e,t){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var a=i[n];a.setValue(e,t[a.id])}};var Do=/([\w\d_]+)(\])?(\[|\.)?/g;W.prototype.setValue=function(e,t,i){var n=this.map[t];void 0!==n&&n.setValue(e,i,this.renderer)},W.prototype.set=function(e,t,i){var n=this.map[i];void 0!==n&&n.setValue(e,t[i],this.renderer)},W.prototype.setOptional=function(e,t,i){var n=t[i];void 0!==n&&this.setValue(e,i,n)},W.upload=function(e,t,i,n){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=i[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,n)}},W.seqWithValue=function(e,t){for(var i=[],n=0,r=e.length;n!==r;++n){var a=e[n];a.id in t&&i.push(a)}return i},W.splitDynamic=function(e,t){for(var i=null,n=e.length,r=0,a=0;a!==n;++a){var o=e[a],s=t[o.id];s&&s.dynamic===!0?(null===i&&(i=[]),i.push(o)):(a>r&&(e[r]=o),++r)}return n>r&&(e.length=r),i},W.evalDynamic=function(e,t,i,n,r){for(var a=0,o=e.length;a!==o;++a){var s=t[e[a].id],c=s.onUpdateCallback;void 0!==c&&c.call(s,i,n,r)}},e.UniformsUtils={merge:function(e){for(var t={},i=0;i<e.length;i++){var n=this.clone(e[i]);for(var r in n)t[r]=n[r]}return t},clone:function(e){var t={};for(var i in e){t[i]={};for(var n in e[i]){var r=e[i][n];r&&r.isColor||r&&r.isVector2||r&&r.isVector3||r&&r.isVector4||r&&r.isMatrix3||r&&r.isMatrix4||r&&r.isTexture?t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}}return t}};var No="#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",Fo="#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif\n",zo="#ifdef ALPHATEST\n	if ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",Bo="#ifdef USE_AOMAP\n	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n	reflectedLight.indirectDiffuse *= ambientOcclusion;\n	#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n	#endif\n#endif\n",Ho="#ifdef USE_AOMAP\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n#endif",Go="\nvec3 transformed = vec3( position );\n",Vo="\nvec3 objectNormal = vec3( normal );\n",ko="bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n	return any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n		if( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n			float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n			float maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n			return distanceFalloff * maxDistanceCutoffFactor;\n#else\n			return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n		}\n		return 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n	return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n	float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n	return ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	return 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n	float a2 = pow2( alpha );\n	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n	return 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	float alpha = pow2( roughness );\n	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n	float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n	float dotNH = saturate( dot( geometry.normal, halfDir ) );\n	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n	vec3 F = F_Schlick( specularColor, dotLH );\n	float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n	float D = D_GGX( alpha, dotNH );\n	return F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n	vec4 r = roughness * c0 + c1;\n	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n	vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n	return specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n	return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n	return 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	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n	float dotNH = saturate( dot( geometry.normal, halfDir ) );\n	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n	vec3 F = F_Schlick( specularColor, dotLH );\n	float G = G_BlinnPhong_Implicit( );\n	float D = D_BlinnPhong( shininess, dotNH );\n	return F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n	return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n	return sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",jo="#ifdef USE_BUMPMAP\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n	vec2 dHdxy_fwd() {\n		vec2 dSTdx = dFdx( vUv );\n		vec2 dSTdy = dFdy( vUv );\n		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n		return vec2( dBx, dBy );\n	}\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n		vec3 vSigmaX = dFdx( surf_pos );\n		vec3 vSigmaY = dFdy( surf_pos );\n		vec3 vN = surf_norm;\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n		float fDet = dot( vSigmaX, R1 );\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n	}\n#endif\n",Wo="#if NUM_CLIPPING_PLANES > 0\n	for ( int i = 0; i < NUM_CLIPPING_PLANES; ++ i ) {\n		vec4 plane = clippingPlanes[ i ];\n		if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n	}\n#endif\n",Xo="#if NUM_CLIPPING_PLANES > 0\n	#if ! defined( PHYSICAL ) && ! defined( PHONG )\n		varying vec3 vViewPosition;\n	#endif\n	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",Yo="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n	varying vec3 vViewPosition;\n#endif\n",qo="#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n	vViewPosition = - mvPosition.xyz;\n#endif\n",Zo="#ifdef USE_COLOR\n	diffuseColor.rgb *= vColor;\n#endif",Jo="#ifdef USE_COLOR\n	varying vec3 vColor;\n#endif\n",Qo="#ifdef USE_COLOR\n	varying vec3 vColor;\n#endif",Ko="#ifdef USE_COLOR\n	vColor.xyz = color.xyz;\n#endif",$o="#define PI 3.14159265359\n#define PI2 6.28318530718\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	const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n	return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n	bool visible;\n};\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\nstruct GeometricContext {\n	vec3 position;\n	vec3 normal;\n	vec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	float distance = dot( planeNormal, point - pointOnPlane );\n	return - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n	return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",es="#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n	vec3 absDirection = abs(direction);\n	int face = -1;\n	if( absDirection.x > absDirection.z ) {\n		if(absDirection.x > absDirection.y )\n			face = direction.x > 0.0 ? 0 : 3;\n		else\n			face = direction.y > 0.0 ? 1 : 4;\n	}\n	else {\n		if(absDirection.z > absDirection.y )\n			face = direction.z > 0.0 ? 2 : 5;\n		else\n			face = direction.y > 0.0 ? 1 : 4;\n	}\n	return 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	float scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n	float dxRoughness = dFdx(roughness);\n	float dyRoughness = dFdy(roughness);\n	vec3 dx = dFdx( vec * scale * dxRoughness );\n	vec3 dy = dFdy( vec * scale * dyRoughness );\n	float d = max( dot( dx, dx ), dot( dy, dy ) );\n	d = clamp(d, 1.0, cubeUV_rangeClamp);\n	float mipLevel = 0.5 * log2(d);\n	return 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	mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n	float a = 16.0 * cubeUV_rcpTextureSize;\n	vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n	vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n	float powScale = exp2_packed.x * exp2_packed.y;\n	float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n	float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n	bool bRes = mipLevel == 0.0;\n	scale =  bRes && (scale < a) ? a : scale;\n	vec3 r;\n	vec2 offset;\n	int face = getFaceFromDirection(direction);\n	float rcpPowScale = 1.0 / powScale;\n	if( face == 0) {\n		r = vec3(direction.x, -direction.z, direction.y);\n		offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n		offset.y = bRes && (offset.y < 2.0*a) ?  a : offset.y;\n	}\n	else if( face == 1) {\n		r = vec3(direction.y, direction.x, direction.z);\n		offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n		offset.y = bRes && (offset.y < 2.0*a) ?  a : offset.y;\n	}\n	else if( face == 2) {\n		r = vec3(direction.z, direction.x, direction.y);\n		offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n		offset.y = bRes && (offset.y < 2.0*a) ?  a : offset.y;\n	}\n	else if( face == 3) {\n		r = vec3(direction.x, direction.z, direction.y);\n		offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n		offset.y = bRes && (offset.y < 2.0*a) ?  0.0 : offset.y;\n	}\n	else if( face == 4) {\n		r = vec3(direction.y, direction.x, -direction.z);\n		offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n		offset.y = bRes && (offset.y < 2.0*a) ?  0.0 : offset.y;\n	}\n	else {\n		r = vec3(direction.z, -direction.x, direction.y);\n		offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n		offset.y = bRes && (offset.y < 2.0*a) ?  0.0 : offset.y;\n	}\n	r = normalize(r);\n	float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n	vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n	vec2 base = offset + vec2( texelOffset );\n	return 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	float roughnessVal = roughness* cubeUV_maxLods3;\n	float r1 = floor(roughnessVal);\n	float r2 = r1 + 1.0;\n	float t = fract(roughnessVal);\n	vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n	float s = mipInfo.y;\n	float level0 = mipInfo.x;\n	float level1 = level0 + 1.0;\n	level1 = level1 > 5.0 ? 5.0 : level1;\n	level0 += min( floor( s + 0.5 ), 5.0 );\n	vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n	vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n	vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n	vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n	vec4 result = mix(color10, color20, t);\n	return vec4(result.rgb, 1.0);\n}\n#endif\n",ts="#ifdef FLIP_SIDED\n	objectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",is="#ifdef USE_DISPLACEMENTMAP\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n#endif\n",ns="#ifdef USE_DISPLACEMENTMAP\n	transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",rs="#ifdef USE_EMISSIVEMAP\n	vec4 emissiveColor = texture2D( emissiveMap, vUv );\n	emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n	totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",as="#ifdef USE_EMISSIVEMAP\n	uniform sampler2D emissiveMap;\n#endif\n",os="  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",ss="\nvec4 LinearToLinear( in vec4 value ) {\n  return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n  return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n  return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n  return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n  return 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  return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n  float maxComponent = max( max( value.r, value.g ), value.b );\n  float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n  return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n  return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n  float maxRGB = max( value.x, max( value.g, value.b ) );\n  float M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n  M            = ceil( M * 255.0 ) / 255.0;\n  return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n    return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n    float maxRGB = max( value.x, max( value.g, value.b ) );\n    float D      = max( maxRange / maxRGB, 1.0 );\n    D            = min( floor( D ) / 255.0, 1.0 );\n    return 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  vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n  Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n  vec4 vResult;\n  vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n  float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n  vResult.w = fract(Le);\n  vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n  return 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  float Le = value.z * 255.0 + value.w;\n  vec3 Xp_Y_XYZp;\n  Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n  Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n  Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n  vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n  return vec4( max(vRGB, 0.0), 1.0 );\n}\n",cs="#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n		#else\n			vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#else\n		vec3 reflectVec = vReflect;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n	#elif defined( ENVMAP_TYPE_EQUIREC )\n		vec2 sampleUV;\n		sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n		sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n		vec4 envColor = texture2D( envMap, sampleUV );\n	#elif defined( ENVMAP_TYPE_SPHERE )\n		vec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n		vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n	#else\n		vec4 envColor = vec4( 0.0 );\n	#endif\n	envColor = envMapTexelToLinear( envColor );\n	#ifdef ENVMAP_BLENDING_MULTIPLY\n		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_MIX )\n		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n	#elif defined( ENVMAP_BLENDING_ADD )\n		outgoingLight += envColor.xyz * specularStrength * reflectivity;\n	#endif\n#endif\n",ls="#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n	uniform float reflectivity;\n	uniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n	#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n		varying vec3 vWorldPosition;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n	uniform float flipEnvMap;\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n		uniform float refractionRatio;\n	#else\n		varying vec3 vReflect;\n	#endif\n#endif\n",hs="#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n		varying vec3 vWorldPosition;\n	#else\n		varying vec3 vReflect;\n		uniform float refractionRatio;\n	#endif\n#endif\n",us="#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n		vWorldPosition = worldPosition.xyz;\n	#else\n		vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vReflect = reflect( cameraToVertex, worldNormal );\n		#else\n			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#endif\n#endif\n",ps="#ifdef USE_FOG\n	#ifdef USE_LOGDEPTHBUF_EXT\n		float depth = gl_FragDepthEXT / gl_FragCoord.w;\n	#else\n		float depth = gl_FragCoord.z / gl_FragCoord.w;\n	#endif\n	#ifdef FOG_EXP2\n		float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n	#else\n		float fogFactor = smoothstep( fogNear, fogFar, depth );\n	#endif\n	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",ds="#ifdef USE_FOG\n	uniform vec3 fogColor;\n	#ifdef FOG_EXP2\n		uniform float fogDensity;\n	#else\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n#endif",fs="#ifdef USE_LIGHTMAP\n	reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",ms="#ifdef USE_LIGHTMAP\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n#endif",vs="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	vLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = PI * directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = PI * directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n#endif\n#if NUM_DIR_LIGHTS > 0\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n		dotNL = dot( geometry.normal, directLight.direction );\n		directLightColor_Diffuse = PI * directLight.color;\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n		#ifdef DOUBLE_SIDED\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n		#endif\n	}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n		vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n		#ifdef DOUBLE_SIDED\n			vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n		#endif\n	}\n#endif\n",gs="uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n	vec3 irradiance = ambientLightColor;\n	#ifndef PHYSICALLY_CORRECT_LIGHTS\n		irradiance *= PI;\n	#endif\n	return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n	struct DirectionalLight {\n		vec3 direction;\n		vec3 color;\n		int shadow;\n		float shadowBias;\n		float shadowRadius;\n		vec2 shadowMapSize;\n	};\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n	void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n		directLight.color = directionalLight.color;\n		directLight.direction = directionalLight.direction;\n		directLight.visible = true;\n	}\n#endif\n#if NUM_POINT_LIGHTS > 0\n	struct PointLight {\n		vec3 position;\n		vec3 color;\n		float distance;\n		float decay;\n		int shadow;\n		float shadowBias;\n		float shadowRadius;\n		vec2 shadowMapSize;\n	};\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n	void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n		vec3 lVector = pointLight.position - geometry.position;\n		directLight.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		if ( testLightInRange( lightDistance, pointLight.distance ) ) {\n			directLight.color = pointLight.color;\n			directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n			directLight.visible = true;\n		} else {\n			directLight.color = vec3( 0.0 );\n			directLight.visible = false;\n		}\n	}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	struct SpotLight {\n		vec3 position;\n		vec3 direction;\n		vec3 color;\n		float distance;\n		float decay;\n		float coneCos;\n		float penumbraCos;\n		int shadow;\n		float shadowBias;\n		float shadowRadius;\n		vec2 shadowMapSize;\n	};\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n	void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n		vec3 lVector = spotLight.position - geometry.position;\n		directLight.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		float angleCos = dot( directLight.direction, spotLight.direction );\n		if ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n			float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n			directLight.color = spotLight.color;\n			directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n			directLight.visible = true;\n		} else {\n			directLight.color = vec3( 0.0 );\n			directLight.visible = false;\n		}\n	}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	struct HemisphereLight {\n		vec3 direction;\n		vec3 skyColor;\n		vec3 groundColor;\n	};\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n		float dotNL = dot( geometry.normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n		#ifndef PHYSICALLY_CORRECT_LIGHTS\n			irradiance *= PI;\n		#endif\n		return irradiance;\n	}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n	vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n		#include <normal_flip>\n		vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n		#ifdef ENVMAP_TYPE_CUBE\n			vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n			#else\n				vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n			#endif\n			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n		#elif defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n			vec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n		#else\n			vec4 envMapColor = vec4( 0.0 );\n		#endif\n		return PI * envMapColor.rgb * envMapIntensity;\n	}\n	float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n		float maxMIPLevelScalar = float( maxMIPLevel );\n		float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n		return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n	}\n	vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n		#else\n			vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n		#endif\n		#include <normal_flip>\n		reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n		float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n		#ifdef ENVMAP_TYPE_CUBE\n			vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n			#else\n				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n			#endif\n			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n		#elif defined( ENVMAP_TYPE_CUBE_UV )\n			vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n			vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n		#elif defined( ENVMAP_TYPE_EQUIREC )\n			vec2 sampleUV;\n			sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n			sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n			#else\n				vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n			#endif\n			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n		#elif defined( ENVMAP_TYPE_SPHERE )\n			vec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n			#ifdef TEXTURE_LOD_EXT\n				vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n			#else\n				vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n			#endif\n			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n		#endif\n		return envMapColor.rgb * envMapIntensity;\n	}\n#endif\n",ys="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",xs="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n	vec3	diffuseColor;\n	vec3	specularColor;\n	float	specularShininess;\n	float	specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifndef PHYSICALLY_CORRECT_LIGHTS\n		irradiance *= PI;\n	#endif\n	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n	reflectedLight.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	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )	(0)\n",bs="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n	material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n	material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n	material.clearCoat = saturate( clearCoat );	material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",ws="struct PhysicalMaterial {\n	vec3	diffuseColor;\n	float	specularRoughness;\n	vec3	specularColor;\n	#ifndef STANDARD\n		float clearCoat;\n		float clearCoatRoughness;\n	#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	return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifndef PHYSICALLY_CORRECT_LIGHTS\n		irradiance *= PI;\n	#endif\n	#ifndef STANDARD\n		float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n	#else\n		float clearCoatDHR = 0.0;\n	#endif\n	reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n	reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n	#ifndef STANDARD\n		reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n	#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.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	#ifndef STANDARD\n		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n		float dotNL = dotNV;\n		float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n	#else\n		float clearCoatDHR = 0.0;\n	#endif\n	reflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n	#ifndef STANDARD\n		reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n	#endif\n}\n#define RE_Direct				RE_Direct_Physical\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular		RE_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	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",_s="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n	PointLight pointLight;\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		getPointDirectLightIrradiance( pointLight, geometry, directLight );\n		#ifdef USE_SHADOWMAP\n		directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n	SpotLight spotLight;\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n		#ifdef USE_SHADOWMAP\n		directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n	DirectionalLight directionalLight;\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n		#ifdef USE_SHADOWMAP\n		directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometry, material, reflectedLight );\n	}\n#endif\n#if defined( RE_IndirectDiffuse )\n	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n	#ifdef USE_LIGHTMAP\n		vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n		#ifndef PHYSICALLY_CORRECT_LIGHTS\n			lightMapIrradiance *= PI;\n		#endif\n		irradiance += lightMapIrradiance;\n	#endif\n	#if ( NUM_HEMI_LIGHTS > 0 )\n		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n		}\n	#endif\n	#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n	 	irradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n	#endif\n	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n	vec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n	#ifndef STANDARD\n		vec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n	#else\n		vec3 clearCoatRadiance = vec3( 0.0 );\n	#endif\n		\n	RE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",Es="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n	gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",Ms="#ifdef USE_LOGDEPTHBUF\n	uniform float logDepthBufFC;\n	#ifdef USE_LOGDEPTHBUF_EXT\n		varying float vFragDepth;\n	#endif\n#endif\n",Ts="#ifdef USE_LOGDEPTHBUF\n	#ifdef USE_LOGDEPTHBUF_EXT\n		varying float vFragDepth;\n	#endif\n	uniform float logDepthBufFC;\n#endif",Ss="#ifdef USE_LOGDEPTHBUF\n	gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n	#ifdef USE_LOGDEPTHBUF_EXT\n		vFragDepth = 1.0 + gl_Position.w;\n	#else\n		gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n	#endif\n#endif\n",Rs="#ifdef USE_MAP\n	vec4 texelColor = texture2D( map, vUv );\n	texelColor = mapTexelToLinear( texelColor );\n	diffuseColor *= texelColor;\n#endif\n",As="#ifdef USE_MAP\n	uniform sampler2D map;\n#endif\n",Ls="#ifdef USE_MAP\n	vec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n	diffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",Cs="#ifdef USE_MAP\n	uniform vec4 offsetRepeat;\n	uniform sampler2D map;\n#endif\n",Ps="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n	vec4 texelMetalness = texture2D( metalnessMap, vUv );\n	metalnessFactor *= texelMetalness.r;\n#endif\n",Us="#ifdef USE_METALNESSMAP\n	uniform sampler2D metalnessMap;\n#endif",Is="#ifdef USE_MORPHNORMALS\n	objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n	objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n	objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n	objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",Os="#ifdef USE_MORPHTARGETS\n	#ifndef USE_MORPHNORMALS\n	uniform float morphTargetInfluences[ 8 ];\n	#else\n	uniform float morphTargetInfluences[ 4 ];\n	#endif\n#endif",Ds="#ifdef USE_MORPHTARGETS\n	transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n	transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n	transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n	transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n	#ifndef USE_MORPHNORMALS\n	transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n	transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n	transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n	transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n	#endif\n#endif\n",Ns="#ifdef DOUBLE_SIDED\n	float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n	float flipNormal = 1.0;\n#endif\n",Fs="#ifdef FLAT_SHADED\n	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n	vec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n	normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",zs="#ifdef USE_NORMALMAP\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( vUv.st );\n		vec2 st1 = dFdy( vUv.st );\n		vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n		vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n		vec3 N = normalize( surf_norm );\n		vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n		mapN.xy = normalScale * mapN.xy;\n		mat3 tsn = mat3( S, T, N );\n		return normalize( tsn * mapN );\n	}\n#endif\n",Bs="vec3 packNormalToRGB( const in vec3 normal ) {\n  return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n  return 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	vec4 r = vec4( fract( v * PackFactors ), v );\n	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n	return dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n  return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n  return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n  return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n  return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",Hs="#ifdef PREMULTIPLIED_ALPHA\n	gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",Gs="#ifdef USE_SKINNING\n	vec4 mvPosition = modelViewMatrix * skinned;\n#else\n	vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",Vs="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n	vec4 texelRoughness = texture2D( roughnessMap, vUv );\n	roughnessFactor *= texelRoughness.r;\n#endif\n",ks="#ifdef USE_ROUGHNESSMAP\n	uniform sampler2D roughnessMap;\n#endif",js="#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n	#endif\n	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n	}\n	float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n		const vec2 offset = vec2( 0.0, 1.0 );\n		vec2 texelSize = vec2( 1.0 ) / size;\n		vec2 centroidUV = floor( uv * size + 0.5 ) / size;\n		float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n		float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n		float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n		float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n		vec2 f = fract( uv * size + 0.5 );\n		float a = mix( lb, lt, f.y );\n		float b = mix( rb, rt, f.y );\n		float c = mix( a, b, f.x );\n		return c;\n	}\n	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n		shadowCoord.xyz /= shadowCoord.w;\n		shadowCoord.z += shadowBias;\n		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n		bool inFrustum = all( inFrustumVec );\n		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n		bool frustumTest = all( frustumTestVec );\n		if ( frustumTest ) {\n		#if defined( SHADOWMAP_TYPE_PCF )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx0 = - texelSize.x * shadowRadius;\n			float dy0 = - texelSize.y * shadowRadius;\n			float dx1 = + texelSize.x * shadowRadius;\n			float dy1 = + texelSize.y * shadowRadius;\n			return (\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n			) * ( 1.0 / 9.0 );\n		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n			float dx0 = - texelSize.x * shadowRadius;\n			float dy0 = - texelSize.y * shadowRadius;\n			float dx1 = + texelSize.x * shadowRadius;\n			float dy1 = + texelSize.y * shadowRadius;\n			return (\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n			) * ( 1.0 / 9.0 );\n		#else\n			return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n		#endif\n		}\n		return 1.0;\n	}\n	vec2 cubeToUV( vec3 v, float texelSizeY ) {\n		vec3 absV = abs( v );\n		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n		absV *= scaleToCube;\n		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n		vec2 planar = v.xy;\n		float almostATexel = 1.5 * texelSizeY;\n		float almostOne = 1.0 - almostATexel;\n		if ( absV.z >= almostOne ) {\n			if ( v.z > 0.0 )\n				planar.x = 4.0 - v.x;\n		} else if ( absV.x >= almostOne ) {\n			float signX = sign( v.x );\n			planar.x = v.z * signX + 2.0 * signX;\n		} else if ( absV.y >= almostOne ) {\n			float signY = sign( v.y );\n			planar.x = v.x + 2.0 * signY + 2.0;\n			planar.y = v.z * signY - 2.0;\n		}\n		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n	}\n	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n		vec3 lightToPosition = shadowCoord.xyz;\n		vec3 bd3D = normalize( lightToPosition );\n		float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n			return (\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n			) * ( 1.0 / 9.0 );\n		#else\n			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n		#endif\n	}\n#endif\n",Ws="#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n	#endif\n#endif\n",Xs="#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n	}\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n	}\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n	}\n	#endif\n#endif\n",Ys="float getShadowMask() {\n	float shadow = 1.0;\n	#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHTS > 0\n	DirectionalLight directionalLight;\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n	}\n	#endif\n	#if NUM_SPOT_LIGHTS > 0\n	SpotLight spotLight;\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n	}\n	#endif\n	#if NUM_POINT_LIGHTS > 0\n	PointLight pointLight;\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n	}\n	#endif\n	#endif\n	return shadow;\n}\n",qs="#ifdef USE_SKINNING\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",Zs="#ifdef USE_SKINNING\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n	#ifdef BONE_TEXTURE\n		uniform sampler2D boneTexture;\n		uniform int boneTextureWidth;\n		uniform int boneTextureHeight;\n		mat4 getBoneMatrix( const in float i ) {\n			float j = i * 4.0;\n			float x = mod( j, float( boneTextureWidth ) );\n			float y = floor( j / float( boneTextureWidth ) );\n			float dx = 1.0 / float( boneTextureWidth );\n			float dy = 1.0 / float( boneTextureHeight );\n			y = dy * ( y + 0.5 );\n			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n			mat4 bone = mat4( v1, v2, v3, v4 );\n			return bone;\n		}\n	#else\n		uniform mat4 boneMatrices[ MAX_BONES ];\n		mat4 getBoneMatrix( const in float i ) {\n			mat4 bone = boneMatrices[ int(i) ];\n			return bone;\n		}\n	#endif\n#endif\n",Js="#ifdef USE_SKINNING\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	skinned  = bindMatrixInverse * skinned;\n#endif\n",Qs="#ifdef USE_SKINNING\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",Ks="float specularStrength;\n#ifdef USE_SPECULARMAP\n	vec4 texelSpecular = texture2D( specularMap, vUv );\n	specularStrength = texelSpecular.r;\n#else\n	specularStrength = 1.0;\n#endif",$s="#ifdef USE_SPECULARMAP\n	uniform sampler2D specularMap;\n#endif",ec="#if defined( TONE_MAPPING )\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tc="#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n  return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  return 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  color *= toneMappingExposure;\n  return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n  color *= toneMappingExposure;\n  color = max( vec3( 0.0 ), color - 0.004 );\n  return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",ic="#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	varying vec2 vUv;\n#endif",nc="#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	varying vec2 vUv;\n	uniform vec4 offsetRepeat;\n#endif\n",rc="#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	vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",ac="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	varying vec2 vUv2;\n#endif",oc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	attribute vec2 uv2;\n	varying vec2 vUv2;\n#endif",sc="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n	vUv2 = uv2;\n#endif",cc="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n	#ifdef USE_SKINNING\n		vec4 worldPosition = modelMatrix * skinned;\n	#else\n		vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n	#endif\n#endif\n",lc="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n	gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n	gl_FragColor.a *= opacity;\n}\n",hc="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n	vWorldPosition = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n}\n",uc="#if DEPTH_PACKING == 3200\n	uniform 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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( 1.0 );\n	#if DEPTH_PACKING == 3200\n		diffuseColor.a = opacity;\n	#endif\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <logdepthbuf_fragment>\n	#if DEPTH_PACKING == 3200\n		gl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n	#elif DEPTH_PACKING == 3201\n		gl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n	#endif\n}\n",pc="#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	#include <uv_vertex>\n	#include <skinbase_vertex>\n	#include <begin_vertex>\n	#include <displacementmap_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n}\n",dc="uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n	#include <clipping_planes_fragment>\n	gl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",fc="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	#include <skinbase_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <clipping_planes_vertex>\n	vWorldPosition = worldPosition;\n}\n",mc="uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n	vec3 direction = normalize( vWorldPosition );\n	vec2 sampleUV;\n	sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n	sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n	gl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",vc="varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n	vWorldPosition = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n}\n",gc="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	#include <clipping_planes_fragment>\n	if ( mod( vLineDistance, totalSize ) > dashSize ) {\n		discard;\n	}\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <color_fragment>\n	outgoingLight = diffuseColor.rgb;\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",yc="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <color_vertex>\n	vLineDistance = scale * lineDistance;\n	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n	gl_Position = projectionMatrix * mvPosition;\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n}\n",xc="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n	varying 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 <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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	ReflectedLight reflectedLight;\n	reflectedLight.directDiffuse = vec3( 0.0 );\n	reflectedLight.directSpecular = vec3( 0.0 );\n	reflectedLight.indirectDiffuse = diffuseColor.rgb;\n	reflectedLight.indirectSpecular = vec3( 0.0 );\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.indirectDiffuse;\n	#include <normal_flip>\n	#include <envmap_fragment>\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",bc="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_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	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <skinbase_vertex>\n	#ifdef USE_ENVMAP\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <clipping_planes_vertex>\n	#include <envmap_vertex>\n}\n",wc="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n	varying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <emissivemap_fragment>\n	reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n	#include <lightmap_fragment>\n	reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n	#ifdef DOUBLE_SIDED\n		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n	#else\n		reflectedLight.directDiffuse = vLightFront;\n	#endif\n	reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <normal_flip>\n	#include <envmap_fragment>\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",_c="#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n	varying 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 <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	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <lights_lambert_vertex>\n	#include <shadowmap_vertex>\n}\n",Ec="#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 <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 <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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <normal_flip>\n	#include <normal_fragment>\n	#include <emissivemap_fragment>\n	#include <lights_phong_fragment>\n	#include <lights_template>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",Mc="#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying 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 <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	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n#endif\n	#include <begin_vertex>\n	#include <displacementmap_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n}\n",Tc="#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n	uniform float clearCoat;\n	uniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\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	#include <clipping_planes_fragment>\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <specularmap_fragment>\n	#include <roughnessmap_fragment>\n	#include <metalnessmap_fragment>\n	#include <normal_flip>\n	#include <normal_fragment>\n	#include <emissivemap_fragment>\n	#include <lights_physical_fragment>\n	#include <lights_template>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",Sc="#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n	varying 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 <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	#include <uv_vertex>\n	#include <uv2_vertex>\n	#include <color_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n#endif\n	#include <begin_vertex>\n	#include <displacementmap_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n}\n",Rc="uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	#include <clipping_planes_fragment>\n	gl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n	#include <logdepthbuf_fragment>\n}\n",Ac="varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	vNormal = normalize( normalMatrix * normal );\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n}\n",Lc="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	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <logdepthbuf_fragment>\n	#include <map_particle_fragment>\n	#include <color_fragment>\n	#include <alphatest_fragment>\n	outgoingLight = diffuseColor.rgb;\n	gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n	#include <premultiplied_alpha_fragment>\n	#include <tonemapping_fragment>\n	#include <encodings_fragment>\n	#include <fog_fragment>\n}\n",Cc="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <color_vertex>\n	#include <begin_vertex>\n	#include <project_vertex>\n	#ifdef USE_SIZEATTENUATION\n		gl_PointSize = size * ( scale / - mvPosition.z );\n	#else\n		gl_PointSize = size;\n	#endif\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n}\n",Pc="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	gl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0  - getShadowMask() ) );\n}\n",Uc="#include <shadowmap_pars_vertex>\nvoid main() {\n	#include <begin_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n}\n",Ic={
alphamap_fragment:No,alphamap_pars_fragment:Fo,alphatest_fragment:zo,aomap_fragment:Bo,aomap_pars_fragment:Ho,begin_vertex:Go,beginnormal_vertex:Vo,bsdfs:ko,bumpmap_pars_fragment:jo,clipping_planes_fragment:Wo,clipping_planes_pars_fragment:Xo,clipping_planes_pars_vertex:Yo,clipping_planes_vertex:qo,color_fragment:Zo,color_pars_fragment:Jo,color_pars_vertex:Qo,color_vertex:Ko,common:$o,cube_uv_reflection_fragment:es,defaultnormal_vertex:ts,displacementmap_pars_vertex:is,displacementmap_vertex:ns,emissivemap_fragment:rs,emissivemap_pars_fragment:as,encodings_fragment:os,encodings_pars_fragment:ss,envmap_fragment:cs,envmap_pars_fragment:ls,envmap_pars_vertex:hs,envmap_vertex:us,fog_fragment:ps,fog_pars_fragment:ds,lightmap_fragment:fs,lightmap_pars_fragment:ms,lights_lambert_vertex:vs,lights_pars:gs,lights_phong_fragment:ys,lights_phong_pars_fragment:xs,lights_physical_fragment:bs,lights_physical_pars_fragment:ws,lights_template:_s,logdepthbuf_fragment:Es,logdepthbuf_pars_fragment:Ms,logdepthbuf_pars_vertex:Ts,logdepthbuf_vertex:Ss,map_fragment:Rs,map_pars_fragment:As,map_particle_fragment:Ls,map_particle_pars_fragment:Cs,metalnessmap_fragment:Ps,metalnessmap_pars_fragment:Us,morphnormal_vertex:Is,morphtarget_pars_vertex:Os,morphtarget_vertex:Ds,normal_flip:Ns,normal_fragment:Fs,normalmap_pars_fragment:zs,packing:Bs,premultiplied_alpha_fragment:Hs,project_vertex:Gs,roughnessmap_fragment:Vs,roughnessmap_pars_fragment:ks,shadowmap_pars_fragment:js,shadowmap_pars_vertex:Ws,shadowmap_vertex:Xs,shadowmask_pars_fragment:Ys,skinbase_vertex:qs,skinning_pars_vertex:Zs,skinning_vertex:Js,skinnormal_vertex:Qs,specularmap_fragment:Ks,specularmap_pars_fragment:$s,tonemapping_fragment:ec,tonemapping_pars_fragment:tc,uv_pars_fragment:ic,uv_pars_vertex:nc,uv_vertex:rc,uv2_pars_fragment:ac,uv2_pars_vertex:oc,uv2_vertex:sc,worldpos_vertex:cc,cube_frag:lc,cube_vert:hc,depth_frag:uc,depth_vert:pc,distanceRGBA_frag:dc,distanceRGBA_vert:fc,equirect_frag:mc,equirect_vert:vc,linedashed_frag:gc,linedashed_vert:yc,meshbasic_frag:xc,meshbasic_vert:bc,meshlambert_frag:wc,meshlambert_vert:_c,meshphong_frag:Ec,meshphong_vert:Mc,meshphysical_frag:Tc,meshphysical_vert:Sc,normal_frag:Rc,normal_vert:Ac,points_frag:Lc,points_vert:Cc,shadow_frag:Pc,shadow_vert:Uc};X.prototype={constructor:X,isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.r=e,this.g=e,this.b=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(){function t(e,t,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?e+6*(t-e)*i:.5>i?t:2/3>i?e+6*(t-e)*(2/3-i):e}return function(i,n,r){if(i=e.Math.euclideanModulo(i,1),n=e.Math.clamp(n,0,1),r=e.Math.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var a=.5>=r?r*(1+n):r+n-r*n,o=2*r-a;this.r=t(o,a,i+1/3),this.g=t(o,a,i),this.b=t(o,a,i-1/3)}return this}}(),setStyle:function(t){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,i(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,i(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return i(r[5]),this.setHSL(s,c,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h=n[1],u=h.length;if(3===u)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}if(t&&t.length>0){var h=e.ColorKeywords[t];void 0!==h?this.setHex(h):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,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(e){var t,i,n=e||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),c=Math.min(r,a,o),l=(c+s)/2;if(c===s)t=0,i=0;else{var h=s-c;switch(i=.5>=l?h/(s+c):h/(2-s-c),s){case r:t=(a-o)/h+(o>a?6:0);break;case a:t=(o-r)/h+2;break;case o:t=(r-a)/h+4}t/=6}return n.h=t,n.s=i,n.l=l,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,i){var n=this.getHSL();return n.h+=e,n.s+=t,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}},e.ColorKeywords={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};var Oc={common:{diffuse:{value:new X(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a(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}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(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:{}}}},points:{diffuse:{value:new X(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)}}},Dc={basic:{uniforms:e.UniformsUtils.merge([Oc.common,Oc.aomap,Oc.fog]),vertexShader:Ic.meshbasic_vert,fragmentShader:Ic.meshbasic_frag},lambert:{uniforms:e.UniformsUtils.merge([Oc.common,Oc.aomap,Oc.lightmap,Oc.emissivemap,Oc.fog,Oc.lights,{emissive:{value:new X(0)}}]),vertexShader:Ic.meshlambert_vert,fragmentShader:Ic.meshlambert_frag},phong:{uniforms:e.UniformsUtils.merge([Oc.common,Oc.aomap,Oc.lightmap,Oc.emissivemap,Oc.bumpmap,Oc.normalmap,Oc.displacementmap,Oc.fog,Oc.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:Ic.meshphong_vert,fragmentShader:Ic.meshphong_frag},standard:{uniforms:e.UniformsUtils.merge([Oc.common,Oc.aomap,Oc.lightmap,Oc.emissivemap,Oc.bumpmap,Oc.normalmap,Oc.displacementmap,Oc.roughnessmap,Oc.metalnessmap,Oc.fog,Oc.lights,{emissive:{value:new X(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ic.meshphysical_vert,fragmentShader:Ic.meshphysical_frag},points:{uniforms:e.UniformsUtils.merge([Oc.points,Oc.fog]),vertexShader:Ic.points_vert,fragmentShader:Ic.points_frag},dashed:{uniforms:e.UniformsUtils.merge([Oc.common,Oc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ic.linedashed_vert,fragmentShader:Ic.linedashed_frag},depth:{uniforms:e.UniformsUtils.merge([Oc.common,Oc.displacementmap]),vertexShader:Ic.depth_vert,fragmentShader:Ic.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:Ic.normal_vert,fragmentShader:Ic.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ic.cube_vert,fragmentShader:Ic.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Ic.equirect_vert,fragmentShader:Ic.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new l}},vertexShader:Ic.distanceRGBA_vert,fragmentShader:Ic.distanceRGBA_frag}};Dc.physical={uniforms:e.UniformsUtils.merge([Dc.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Ic.meshphysical_vert,fragmentShader:Ic.meshphysical_frag},Y.prototype={constructor:Y,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;i>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i;return function(t,i){var n=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){var t=e||new i;return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new i;return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){var n=t||new i;return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){var n=t||new i;return n.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},J.prototype={constructor:J,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var i=e[t];if(void 0!==i){var n=this[t];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):"overdraw"===t?this[t]=Number(i):this[t]=i:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var i in e){var n=e[i];delete n.metadata,t.push(n)}return t}var i=void 0===e;i&&(e={textures:{},images:{}});var n={metadata:{version:4.4,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),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ar&&(n.blending=this.blending),this.shading!==Er&&(n.shading=this.shading),this.side!==xr&&(n.side=this.side),this.vertexColors!==Mr&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(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,i){var r=t(e.textures),a=t(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.shading=e.shading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.clipShadows=e.clipShadows;var t=e.clippingPlanes,i=null;if(null!==t){var n=t.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(J.prototype,t.prototype);var Nc=0;K.prototype=Object.create(J.prototype),K.prototype.constructor=K,K.prototype.isShaderMaterial=!0,K.prototype.copy=function(t){return J.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=e.UniformsUtils.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},K.prototype.toJSON=function(e){var t=J.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},$.prototype=Object.create(J.prototype),$.prototype.constructor=$,$.prototype.isMeshDepthMaterial=!0,$.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},ee.prototype={constructor:ee,isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=+(1/0),i=+(1/0),n=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,c=e.length;c>s;s+=3){var l=e[s],h=e[s+1],u=e[s+2];t>l&&(t=l),i>h&&(i=h),n>u&&(n=u),l>r&&(r=l),h>a&&(a=h),u>o&&(o=u)}this.min.set(t,i,n),this.max.set(r,a,o)},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;i>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new l;return function(t,i){var n=e.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(){var e=new l;return function(t){var i=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var n=t.geometry;if(void 0!==n)if(n&&n.isGeometry)for(var r=n.vertices,a=0,o=r.length;o>a;a++)e.copy(r[a]),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e);else if(n&&n.isBufferGeometry){var s=n.attributes.position;if(void 0!==s){var c,l,h;s&&s.isInterleavedBufferAttribute?(c=s.data.array,l=s.offset,h=s.data.stride):(c=s.array,l=0,h=3);for(var a=l,o=c.length;o>a;a+=h)e.fromArray(c,a),e.applyMatrix4(t.matrixWorld),i.expandByPoint(e)}}}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.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(e){var t=e||new l;return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new l;return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){var i=t||new l;return i.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new l),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){var i=t||new l;return i.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new l;return function(t){var i=e.copy(t).clamp(this.min,this.max);return i.sub(t).length()}}(),getBoundingSphere:function(){var e=new l;return function(t){var i=t||new te;return this.getCenter(i.center),i.radius=.5*this.size(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new l,new l,new l,new l,new l,new l,new l,new l];return function(t){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},te.prototype={constructor:te,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new ee;return function(t,i){var n=this.center;void 0!==i?n.copy(i):e.setFromPoints(t).getCenter(n);for(var r=0,a=0,o=t.length;o>a;a++)r=Math.max(r,n.distanceToSquared(t[a]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var i=this.center.distanceToSquared(e),n=t||new l;return n.copy(e),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){var t=e||new ee;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},ie.prototype={constructor:ie,isMatrix3:!0,set:function(e,t,i,n,r,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=n,l[2]=o,l[3]=t,l[4]=r,l[5]=s,l[6]=i,l[7]=a,l[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(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToVector3Array:function(){var e;return function(t,i,n){void 0===e&&(e=new l),void 0===i&&(i=0),void 0===n&&(n=t.length);for(var r=0,a=i;n>r;r+=3,a+=3)e.fromArray(t,a),e.applyMatrix3(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,i,n){void 0===e&&(e=new l),void 0===i&&(i=0),void 0===n&&(n=t.length/t.itemSize);for(var r=0,a=i;n>r;r++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-i*r*l+i*o*s+n*r*c-n*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=e.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],p=i[8],d=p*c-l*u,f=l*h-p*s,m=u*s-c*h,v=r*d+a*f+o*m;if(0===v){var g="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t===!0)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return n[0]=d*y,n[1]=(o*u-p*a)*y,n[2]=(l*a-o*c)*y,n[3]=f*y,n[4]=(p*r-o*h)*y,n[5]=(o*s-l*r)*y,n[6]=m*y,n[7]=(a*h-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(e,t)},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e,t){void 0===t&&(t=0);for(var i=0;9>i;i++)this.elements[i]=e[i+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}},ne.prototype={constructor:ne,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new l,t=new l;return function(i,n,r){var a=e.subVectors(r,n).cross(t.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var i=this.distanceToPoint(e),n=t||new l;return n.copy(this.normal).multiplyScalar(i)},intersectLine:function(){var e=new l;return function(t,i){var n=i||new l,r=t.delta(e),a=this.normal.dot(r);if(0!==a){var o=-(t.start.dot(this.normal)+this.constant)/a;if(!(0>o||o>1))return n.copy(r).multiplyScalar(o).add(t.start)}else if(0===this.distanceToPoint(t.start))return n.copy(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return 0>t&&i>0||0>i&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new l;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new l,t=new ie;return function(i,n){var r=this.coplanarPoint(e).applyMatrix4(i),a=n||t.getNormalMatrix(i),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},re.prototype={constructor:re,set:function(e,t,i,n,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this);
},copy:function(e){for(var t=this.planes,i=0;6>i;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],l=i[6],h=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return t[0].setComponents(o-n,h-s,f-u,y-m).normalize(),t[1].setComponents(o+n,h+s,f+u,y+m).normalize(),t[2].setComponents(o+r,h+c,f+p,y+v).normalize(),t[3].setComponents(o-r,h-c,f-p,y-v).normalize(),t[4].setComponents(o-a,h-l,f-d,y-g).normalize(),t[5].setComponents(o+a,h+l,f+d,y+g).normalize(),this},intersectsObject:function(){var e=new te;return function(t){var i=t.geometry;return null===i.boundingSphere&&i.computeBoundingSphere(),e.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new te;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,n=-e.radius,r=0;6>r;r++){var a=t[r].distanceToPoint(i);if(n>a)return!1}return!0},intersectsBox:function(){var e=new l,t=new l;return function(i){for(var n=this.planes,r=0;6>r;r++){var a=n[r];e.x=a.normal.x>0?i.min.x:i.max.x,t.x=a.normal.x>0?i.max.x:i.min.x,e.y=a.normal.y>0?i.min.y:i.max.y,t.y=a.normal.y>0?i.max.y:i.min.y,e.z=a.normal.z>0?i.min.z:i.max.z,t.z=a.normal.z>0?i.max.z:i.min.z;var o=a.distanceToPoint(e),s=a.distanceToPoint(t);if(0>o&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,i=0;6>i;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}},oe.prototype={constructor:oe,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var i=t||new l;return i.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new l;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var i=t||new l;i.subVectors(e,this.origin);var n=i.dot(this.direction);return 0>n?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new l;return function(t){var i=e.subVectors(t,this.origin).dot(this.direction);return 0>i?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new l,t=new l,i=new l;return function(n,r,a,o){e.copy(n).add(r).multiplyScalar(.5),t.copy(r).sub(n).normalize(),i.copy(this.origin).sub(e);var s,c,l,h,u=.5*n.distanceTo(r),p=-this.direction.dot(t),d=i.dot(this.direction),f=-i.dot(t),m=i.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*f-d,c=p*d-f,h=u*v,s>=0)if(c>=-h)if(h>=c){var g=1/v;s*=g,c*=g,l=s*(s+p*c+2*d)+c*(p*s+c+2*f)+m}else c=u,s=Math.max(0,-(p*c+d)),l=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(p*c+d)),l=-s*s+c*(c+2*f)+m;else-h>=c?(s=Math.max(0,-(-p*u+d)),c=s>0?-u:Math.min(Math.max(-u,-f),u),l=-s*s+c*(c+2*f)+m):h>=c?(s=0,c=Math.min(Math.max(-u,-f),u),l=c*(c+2*f)+m):(s=Math.max(0,-(p*u+d)),c=s>0?u:Math.min(Math.max(-u,-f),u),l=-s*s+c*(c+2*f)+m);else c=p>0?-u:u,s=Math.max(0,-(p*c+d)),l=-s*s+c*(c+2*f)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(t).multiplyScalar(c).add(e),l}}(),intersectSphere:function(){var e=new l;return function(t,i){e.subVectors(t.center,this.origin);var n=e.dot(this.direction),r=e.dot(e)-n*n,a=t.radius*t.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,c=n+o;return 0>s&&0>c?null:0>s?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var i=e.normal.dot(this.direction);return 0>i*t},intersectBox:function(e,t){var i,n,r,a,o,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,n=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,n=(e.min.x-u.x)*c),l>=0?(r=(e.min.y-u.y)*l,a=(e.max.y-u.y)*l):(r=(e.max.y-u.y)*l,a=(e.min.y-u.y)*l),i>a||r>n?null:((r>i||i!==i)&&(i=r),(n>a||n!==n)&&(n=a),h>=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),i>s||o>n?null:((o>i||i!==i)&&(i=o),(n>s||n!==n)&&(n=s),0>n?null:this.at(i>=0?i:n,t)))},intersectsBox:function(){var e=new l;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new l,t=new l,i=new l,n=new l;return function(r,a,o,s,c){t.subVectors(a,r),i.subVectors(o,r),n.crossVectors(t,i);var l,h=this.direction.dot(n);if(h>0){if(s)return null;l=1}else{if(!(0>h))return null;l=-1,h=-h}e.subVectors(this.origin,r);var u=l*this.direction.dot(i.crossVectors(e,i));if(0>u)return null;var p=l*this.direction.dot(t.cross(e));if(0>p)return null;if(u+p>h)return null;var d=-l*e.dot(n);return 0>d?null:this.at(d/h,c)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},se.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],se.DefaultOrder="XYZ",se.prototype={constructor:se,isEuler:!0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,i,n){var r=e.Math.clamp,a=t.elements,o=a[0],s=a[4],c=a[8],l=a[1],h=a[5],u=a[9],p=a[2],d=a[6],f=a[10];return i=i||this._order,"XYZ"===i?(this._y=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(d,h),this._z=0)):"YXZ"===i?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(c,f),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-p,o),this._z=0)):"ZXY"===i?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-s,h)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===i?(this._y=Math.asin(-r(p,-1,1)),Math.abs(p)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,h))):"YZX"===i?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-p,o)):(this._x=0,this._y=Math.atan2(c,f))):"XZY"===i?(this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,h),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+i),this._order=i,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,n)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new c;return function(t){return e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new l(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},ce.prototype={constructor:ce,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},le.DefaultUp=new l(0,1,0),le.DefaultMatrixAutoUpdate=!0,Object.assign(le.prototype,t.prototype,{isObject3D:!0,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new c;return function(t,i){return e.setFromAxisAngle(t,i),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new l(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new l(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new l(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new l;return function(t,i){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(i)),this}}(),translateX:function(){var e=new l(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new l(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new l(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new h;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new h;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var i=this.children.indexOf(e);-1!==i&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(i,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var i=0,n=this.children.length;n>i;i++){var r=this.children[i],a=r.getObjectByProperty(e,t);if(void 0!==a)return a}},getWorldPosition:function(e){var t=e||new l;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new l,t=new l;return function(i){var n=i||new c;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new c;return function(t){var i=t||new se;return this.getWorldQuaternion(e),i.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new l,t=new c;return function(i){var n=i||new l;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new c;return function(t){var i=t||new l;return this.getWorldQuaternion(e),i.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,i=0,n=t.length;n>i;i++)t[i].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,i=0,n=t.length;n>i;i++)t[i].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),this.matrixWorldNeedsUpdate!==!0&&e!==!0||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,i=0,n=t.length;n>i;i++)t[i].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var i in e){var n=e[i];delete n.metadata,t.push(n)}return t}var i=void 0===e||""===e,n={};i&&(e={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),r.material=this.material.uuid),this.children.length>0){r.children=[];for(var a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(i){var o=t(e.geometries),s=t(e.materials),c=t(e.textures),l=t(e.images);o.length>0&&(n.geometries=o),s.length>0&&(n.materials=s),c.length>0&&(n.textures=c),l.length>0&&(n.images=l)}return n.object=r,n},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var i=0;i<e.children.length;i++){var n=e.children[i];this.add(n.clone())}return this}});var Fc=0;ue.prototype={constructor:ue,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){var t=e||new l;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new l;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new l;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var t=new l,i=new l;return function(n,r){t.subVectors(n,this.start),i.subVectors(this.end,this.start);var a=i.dot(i),o=i.dot(t),s=o/a;return r&&(s=e.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,i){var n=this.closestPointToPointParameter(e,t),r=i||new l;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},pe.normal=function(){var e=new l;return function(t,i,n,r){var a=r||new l;a.subVectors(n,i),e.subVectors(t,i),a.cross(e);var o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),pe.barycoordFromPoint=function(){var e=new l,t=new l,i=new l;return function(n,r,a,o,s){e.subVectors(o,r),t.subVectors(a,r),i.subVectors(n,r);var c=e.dot(e),h=e.dot(t),u=e.dot(i),p=t.dot(t),d=t.dot(i),f=c*p-h*h,m=s||new l;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(p*u-h*d)*v,y=(c*d-h*u)*v;return m.set(1-g-y,y,g)}}(),pe.containsPoint=function(){var e=new l;return function(t,i,n,r){var a=pe.barycoordFromPoint(t,i,n,r,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),pe.prototype={constructor:pe,set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new l,t=new l;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new l;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return pe.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new ne;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return pe.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return pe.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e,t,i,n;return function(r,a){void 0===e&&(e=new ne,t=[new ue,new ue,new ue],i=new l,n=new l);var o=a||new l,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(r,i),this.containsPoint(i)===!0)o.copy(i);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;c<t.length;c++){t[c].closestPointToPoint(i,!0,n);var h=i.distanceToSquared(n);s>h&&(s=h,o.copy(n))}}return o}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},de.prototype={constructor:de,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,i=e.vertexNormals.length;i>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,i=e.vertexColors.length;i>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},fe.prototype=Object.create(J.prototype),fe.prototype.constructor=fe,fe.prototype.isMeshBasicMaterial=!0,fe.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},me.prototype={constructor:me,isBufferAttribute:!0,set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.itemSize,i*=t.itemSize;for(var n=0,r=this.itemSize;r>n;n++)this.array[e+n]=t.array[i+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new X),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var a=e[n];t[i++]=a.a,t[i++]=a.b,t[i++]=a.c}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,a=e.length;a>r;r++){var o=e[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new i),t[n++]=o.x,t[n++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new l),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,i=0,n=0,r=e.length;r>n;n++){var o=e[n];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),o=new a),t[i++]=o.x,t[i++]=o.y,t[i++]=o.z,t[i++]=o.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this},clone:function(){return(new this.constructor).copy(this)}},Object.assign(Se.prototype,t.prototype,{isGeometry:!0,applyMatrix:function(e){for(var t=(new ie).getNormalMatrix(e),i=0,n=this.vertices.length;n>i;i++){var r=this.vertices[i];r.applyMatrix4(e)}for(var i=0,n=this.faces.length;n>i;i++){var a=this.faces[i];a.normal.applyMatrix3(t).normalize();for(var o=0,s=a.vertexNormals.length;s>o;o++)a.vertexNormals[o].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeTranslation(t,i,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeScale(t,i,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new le),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,i,r){var a=void 0!==s?[p[e].clone(),p[t].clone(),p[i].clone()]:[],o=void 0!==c?[n.colors[e].clone(),n.colors[t].clone(),n.colors[i].clone()]:[],l=new de(e,t,i,a,o,r);n.faces.push(l),void 0!==h&&n.faceVertexUvs[0].push([d[e].clone(),d[t].clone(),d[i].clone()]),void 0!==u&&n.faceVertexUvs[1].push([f[e].clone(),f[t].clone(),f[i].clone()])}var n=this,r=null!==e.index?e.index.array:void 0,a=e.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,h=void 0!==a.uv?a.uv.array:void 0,u=void 0!==a.uv2?a.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var p=[],d=[],f=[],m=0,v=0;m<o.length;m+=3,v+=2)n.vertices.push(new l(o[m],o[m+1],o[m+2])),void 0!==s&&p.push(new l(s[m],s[m+1],s[m+2])),void 0!==c&&n.colors.push(new X(c[m],c[m+1],c[m+2])),void 0!==h&&d.push(new i(h[v],h[v+1])),void 0!==u&&f.push(new i(u[v],u[v+1]));if(void 0!==r){var g=e.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,w=x+b;w>v;v+=3)t(r[v],r[v+1],r[v+2],y.materialIndex);else for(var m=0;m<r.length;m+=3)t(r[m],r[m+1],r[m+2])}else for(var m=0;m<o.length/3;m+=3)t(m,m+1,m+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,n=new h;return n.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new l,t=new l,i=0,n=this.faces.length;n>i;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);var t,i,n,r,a,o;for(o=new Array(this.vertices.length),t=0,i=this.vertices.length;i>t;t++)o[t]=new l;if(e){var s,c,h,u=new l,p=new l;for(n=0,r=this.faces.length;r>n;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],h=this.vertices[a.c],u.subVectors(h,c),p.subVectors(s,c),u.cross(p),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(n=0,r=this.faces.length;r>n;n++)a=this.faces[n],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,i=this.vertices.length;i>t;t++)o[t].normalize();for(n=0,r=this.faces.length;r>n;n++){a=this.faces[n];var d=a.vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,n,r;for(i=0,n=this.faces.length;n>i;i++)for(r=this.faces[i],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;t>e;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new Se;for(a.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o,s,c=this.morphNormals[e].faceNormals,h=this.morphNormals[e].vertexNormals;for(i=0,n=this.faces.length;n>i;i++)o=new l,s={a:new l,b:new l,c:new l},c.push(o),h.push(s)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var o,s;for(i=0,n=this.faces.length;n>i;i++)r=this.faces[i],o=u.faceNormals[i],s=u.vertexNormals[i],o.copy(r.normal),s.a.copy(r.vertexNormals[0]),s.b.copy(r.vertexNormals[1]),s.c.copy(r.vertexNormals[2])}for(i=0,n=this.faces.length;n>i;i++)r=this.faces[i],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,i=0,n=t.length;n>i;i++)i>0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ee),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new te),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if((e&&e.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var n,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.faceVertexUvs[0],h=e.faceVertexUvs[0],u=this.colors,p=e.colors;void 0===i&&(i=0),void 0!==t&&(n=(new ie).getNormalMatrix(t));for(var d=0,f=o.length;f>d;d++){var m=o[d],v=m.clone();void 0!==t&&v.applyMatrix4(t),a.push(v)}for(var d=0,f=p.length;f>d;d++)u.push(p[d].clone());for(d=0,f=c.length;f>d;d++){var g,y,x,b=c[d],w=b.vertexNormals,_=b.vertexColors;g=new de(b.a+r,b.b+r,b.c+r),g.normal.copy(b.normal),void 0!==n&&g.normal.applyMatrix3(n).normalize();for(var E=0,M=w.length;M>E;E++)y=w[E].clone(),void 0!==n&&y.applyMatrix3(n).normalize(),g.vertexNormals.push(y);g.color.copy(b.color);for(var E=0,M=_.length;M>E;E++)x=_[E],g.vertexColors.push(x.clone());g.materialIndex=b.materialIndex+i,s.push(g)}for(d=0,f=h.length;f>d;d++){var T=h[d],S=[];if(void 0!==T){for(var E=0,M=T.length;M>E;E++)S.push(T[E].clone());l.push(S)}}},mergeMesh:function(e){return(e&&e.isMesh)===!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,i,n,r,a,o,s,c={},l=[],h=[],u=4,p=Math.pow(10,u);for(i=0,n=this.vertices.length;n>i;i++)e=this.vertices[i],t=Math.round(e.x*p)+"_"+Math.round(e.y*p)+"_"+Math.round(e.z*p),void 0===c[t]?(c[t]=i,l.push(this.vertices[i]),h[i]=l.length-1):h[i]=h[c[t]];var d=[];for(i=0,n=this.faces.length;n>i;i++){r=this.faces[i],r.a=h[r.a],r.b=h[r.b],r.c=h[r.c],a=[r.a,r.b,r.c];for(var f=-1,m=0;3>m;m++)if(a[m]===a[(m+1)%3]){f=m,d.push(i);break}}for(i=d.length-1;i>=0;i--){var v=d[i];for(this.faces.splice(v,1),o=0,s=this.faceVertexUvs.length;s>o;o++)this.faceVertexUvs[o].splice(v,1)}var g=this.vertices.length-l.length;return this.vertices=l,g},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,i=t.length,n=0;i>n;n++)t[n]._id=n;t.sort(e);var r,a,o=this.faceVertexUvs[0],s=this.faceVertexUvs[1];o&&o.length===i&&(r=[]),s&&s.length===i&&(a=[]);for(var n=0;i>n;n++){var c=t[n]._id;r&&r.push(o[c]),a&&a.push(s[c])}r&&(this.faceVertexUvs[0]=r),a&&(this.faceVertexUvs[1]=a)},toJSON:function(){function e(e,t,i){return i?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==p[t]?p[t]:(p[t]=u.length/3,u.push(e.x,e.y,e.z),p[t])}function i(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==f[t]?f[t]:(f[t]=d.length,d.push(e.getHex()),f[t])}function n(e){var t=e.x.toString()+e.y.toString();return void 0!==v[t]?v[t]:(v[t]=m.length/2,m.push(e.x,e.y),v[t])}var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var o in a)void 0!==a[o]&&(r[o]=a[o]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var l=this.vertices[c];s.push(l.x,l.y,l.z)}for(var h=[],u=[],p={},d=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=!0,x=!1,b=void 0!==this.faceVertexUvs[0][c],w=g.normal.length()>0,_=g.vertexNormals.length>0,E=1!==g.color.r||1!==g.color.g||1!==g.color.b,M=g.vertexColors.length>0,T=0;if(T=e(T,0,0),T=e(T,1,y),T=e(T,2,x),T=e(T,3,b),T=e(T,4,w),T=e(T,5,_),T=e(T,6,E),T=e(T,7,M),h.push(T),h.push(g.a,g.b,g.c),h.push(g.materialIndex),b){var S=this.faceVertexUvs[0][c];h.push(n(S[0]),n(S[1]),n(S[2]))}if(w&&h.push(t(g.normal)),_){var R=g.vertexNormals;h.push(t(R[0]),t(R[1]),t(R[2]))}if(E&&h.push(i(g.color)),M){var A=g.vertexColors;h.push(i(A[0]),i(A[1]),i(A[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,d.length>0&&(r.data.colors=d),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new Se).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var t=e.vertices,i=0,n=t.length;n>i;i++)this.vertices.push(t[i].clone());for(var r=e.colors,i=0,n=r.length;n>i;i++)this.colors.push(r[i].clone());for(var a=e.faces,i=0,n=a.length;n>i;i++)this.faces.push(a[i].clone());for(var i=0,n=e.faceVertexUvs.length;n>i;i++){var o=e.faceVertexUvs[i];void 0===this.faceVertexUvs[i]&&(this.faceVertexUvs[i]=[]);for(var s=0,c=o.length;c>s;s++){for(var l=o[s],h=[],u=0,p=l.length;p>u;u++){var d=l[u];h.push(d.clone())}this.faceVertexUvs[i].push(h)}}return this},dispose:function(){this.dispatchEvent({
type:"dispose"})}});var zc=0;Object.assign(Ae.prototype,t.prototype,{computeBoundingBox:Se.prototype.computeBoundingBox,computeBoundingSphere:Se.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){for(var t,i,n=[],r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,a=e.faceVertexUvs,o=a[0]&&a[0].length>0,s=a[1]&&a[1].length>0,c=e.morphTargets,l=c.length;if(l>0){t=[];for(var h=0;l>h;h++)t[h]=[];this.morphTargets.position=t}var u,p=e.morphNormals,d=p.length;if(d>0){u=[];for(var h=0;d>h;h++)u[h]=[];this.morphTargets.normal=u}for(var f=e.skinIndices,m=e.skinWeights,v=f.length===r.length,g=m.length===r.length,h=0;h<n.length;h++){var y=n[h];this.vertices.push(r[y.a],r[y.b],r[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 w=y.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=y.color;this.colors.push(_,_,_)}if(o===!0){var E=a[0][h];void 0!==E?this.uvs.push(E[0],E[1],E[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new i,new i,new i))}if(s===!0){var E=a[1][h];void 0!==E?this.uvs2.push(E[0],E[1],E[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new i,new i,new i))}for(var M=0;l>M;M++){var T=c[M].vertices;t[M].push(T[y.a],T[y.b],T[y.c])}for(var M=0;d>M;M++){var S=p[M].vertexNormals[h];u[M].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(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.assign(Le.prototype,t.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t){return(t&&t.isBufferAttribute)===!1&&(t&&t.isInterleavedBufferAttribute)===!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new me(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var i=this.attributes.normal;if(void 0!==i){var n=(new ie).getNormalMatrix(e);n.applyToVector3Array(i.array),i.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new h),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeTranslation(t,i,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,i,n){return void 0===e&&(e=new h),e.makeScale(t,i,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new le),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e&&e.isPoints||e&&e.isLine){var i=new Ee(3*t.vertices.length,3),n=new Ee(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Ee(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e&&e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e&&e.isMesh){var i=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(i=void 0,t.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(t);i.verticesNeedUpdate=t.verticesNeedUpdate,i.normalsNeedUpdate=t.normalsNeedUpdate,i.colorsNeedUpdate=t.colorsNeedUpdate,i.uvsNeedUpdate=t.uvsNeedUpdate,i.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=i}var n;return t.verticesNeedUpdate===!0&&(n=this.attributes.position,void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(n=this.attributes.normal,void 0!==n&&(n.copyVector3sArray(t.normals),n.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(n=this.attributes.color,void 0!==n&&(n.copyColorsArray(t.colors),n.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(n=this.attributes.uv,void 0!==n&&(n.copyVector2sArray(t.uvs),n.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(n=this.attributes.lineDistance,void 0!==n&&(n.copyArray(t.lineDistances),n.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ae).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new me(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new me(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.addAttribute("color",new me(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new me(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new me(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var o=e.vertices.length>65535?Uint32Array:Uint16Array,s=new o(3*e.indices.length);this.setIndex(new me(s,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var c in e.morphTargets){for(var l=[],h=e.morphTargets[c],u=0,p=h.length;p>u;u++){var d=h[u],f=new Ee(3*d.length,3);l.push(f.copyVector3sArray(d))}this.morphAttributes[c]=l}if(e.skinIndices.length>0){var m=new Ee(4*e.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var v=new Ee(4*e.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ee);var e=this.attributes.position.array;void 0!==e?this.boundingBox.setFromArray(e):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 e=new ee,t=new l;return function(){null===this.boundingSphere&&(this.boundingSphere=new te);var i=this.attributes.position;if(i){var n=i.array,r=this.boundingSphere.center;e.setFromArray(n),e.getCenter(r);for(var a=0,o=0,s=n.length;s>o;o+=3)t.fromArray(n,o),a=Math.max(a,r.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(a),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 e=this.index,t=this.attributes,i=this.groups;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new me(new Float32Array(n.length),3));else for(var r=t.normal.array,a=0,o=r.length;o>a;a++)r[a]=0;var s,c,h,u=t.normal.array,p=new l,d=new l,f=new l,m=new l,v=new l;if(e){var g=e.array;0===i.length&&this.addGroup(0,g.length);for(var y=0,x=i.length;x>y;++y)for(var b=i[y],w=b.start,_=b.count,a=w,o=w+_;o>a;a+=3)s=3*g[a+0],c=3*g[a+1],h=3*g[a+2],p.fromArray(n,s),d.fromArray(n,c),f.fromArray(n,h),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[s]+=m.x,u[s+1]+=m.y,u[s+2]+=m.z,u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z}else for(var a=0,o=n.length;o>a;a+=9)p.fromArray(n,a),d.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,d),v.subVectors(p,d),m.cross(v),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if((e&&e.isBufferGeometry)===!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var i=this.attributes;for(var n in i)if(void 0!==e.attributes[n])for(var r=i[n],a=r.array,o=e.attributes[n],s=o.array,c=o.itemSize,l=0,h=c*t;l<s.length;l++,h++)a[h]=s[l];return this},normalizeNormals:function(){for(var e,t,i,n,r=this.attributes.normal.array,a=0,o=r.length;o>a;a+=3)e=r[a],t=r[a+1],i=r[a+2],n=1/Math.sqrt(e*e+t*t+i*i),r[a]*=n,r[a+1]*=n,r[a+2]*=n},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Le,t=this.index.array,i=this.attributes;for(var n in i){for(var r=i[n],a=r.array,o=r.itemSize,s=new a.constructor(t.length*o),c=0,l=0,h=0,u=t.length;u>h;h++){c=t[h]*o;for(var p=0;o>p;p++)s[l++]=a[c++]}e.addAttribute(n,new me(s,o))}return e},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};var n=this.index;if(null!==n){var r=Array.prototype.slice.call(n.array);e.data.index={type:n.array.constructor.name,array:r}}var a=this.attributes;for(var i in a){var o=a[i],r=Array.prototype.slice.call(o.array);e.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new Le).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=e.groups,o=0,s=a.length;s>o;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Le.MaxIndex=65535,Ce.prototype=Object.assign(Object.create(le.prototype),{constructor:Ce,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return le.prototype.copy.call(this,e),this.drawMode=e.drawMode,this},updateMorphTargets:function(){var e=this.geometry.morphTargets;if(void 0!==e&&e.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,i=e.length;i>t;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[e[t].name]=t}},raycast:function(){function e(e,t,i,n,r,a,o){return pe.barycoordFromPoint(e,t,i,n,y),r.multiplyScalar(y.x),a.multiplyScalar(y.y),o.multiplyScalar(y.z),r.add(a).add(o),r.clone()}function t(e,t,i,n,r,a,o){var s,c=e.material;if(s=c.side===br?i.intersectTriangle(a,r,n,!0,o):i.intersectTriangle(n,r,a,c.side!==wr,o),null===s)return null;b.copy(o),b.applyMatrix4(e.matrixWorld);var l=t.ray.origin.distanceTo(b);return l<t.near||l>t.far?null:{distance:l,point:b.clone(),object:e}}function n(i,n,r,a,o,l,h,p){s.fromArray(a,3*l),c.fromArray(a,3*h),u.fromArray(a,3*p);var d=t(i,n,r,s,c,u,x);return d&&(o&&(m.fromArray(o,2*l),v.fromArray(o,2*h),g.fromArray(o,2*p),d.uv=e(x,s,c,u,m,v,g)),d.face=new de(l,h,p,pe.normal(s,c,u)),d.faceIndex=l),d}var r=new h,a=new oe,o=new te,s=new l,c=new l,u=new l,p=new l,d=new l,f=new l,m=new i,v=new i,g=new i,y=new l,x=new l,b=new l;return function(i,l){var h=this.geometry,y=this.material,b=this.matrixWorld;if(void 0!==y&&(null===h.boundingSphere&&h.computeBoundingSphere(),o.copy(h.boundingSphere),o.applyMatrix4(b),i.ray.intersectsSphere(o)!==!1&&(r.getInverse(b),a.copy(i.ray).applyMatrix4(r),null===h.boundingBox||a.intersectsBox(h.boundingBox)!==!1))){var w,_;if(h&&h.isBufferGeometry){var E,M,T,S=h.index,R=h.attributes,A=R.position.array;if(void 0!==R.uv&&(w=R.uv.array),null!==S)for(var L=S.array,C=0,P=L.length;P>C;C+=3)E=L[C],M=L[C+1],T=L[C+2],_=n(this,i,a,A,w,E,M,T),_&&(_.faceIndex=Math.floor(C/3),l.push(_));else for(var C=0,P=A.length;P>C;C+=9)E=C/3,M=E+1,T=E+2,_=n(this,i,a,A,w,E,M,T),_&&(_.index=E,l.push(_))}else if(h&&h.isGeometry){var U,I,O,D=y&&y.isMultiMaterial,N=D===!0?y.materials:null,F=h.vertices,z=h.faces,B=h.faceVertexUvs[0];B.length>0&&(w=B);for(var H=0,G=z.length;G>H;H++){var V=z[H],k=D===!0?N[V.materialIndex]:y;if(void 0!==k){if(U=F[V.a],I=F[V.b],O=F[V.c],k.morphTargets===!0){var j=h.morphTargets,W=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(var X=0,Y=j.length;Y>X;X++){var q=W[X];if(0!==q){var Z=j[X].vertices;s.addScaledVector(p.subVectors(Z[V.a],U),q),c.addScaledVector(d.subVectors(Z[V.b],I),q),u.addScaledVector(f.subVectors(Z[V.c],O),q)}}s.add(U),c.add(I),u.add(O),U=s,I=c,O=u}if(_=t(this,i,a,U,I,O,x)){if(w){var J=w[H];m.copy(J[0]),v.copy(J[1]),g.copy(J[2]),_.uv=e(x,U,I,O,m,v,g)}_.face=V,_.faceIndex=H,l.push(_)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Pe.prototype=Object.create(Le.prototype),Pe.prototype.constructor=Pe,Ue.prototype=Object.create(Le.prototype),Ue.prototype.constructor=Ue,Ie.prototype=Object.create(le.prototype),Ie.prototype.constructor=Ie,Ie.prototype.isCamera=!0,Ie.prototype.getWorldDirection=function(){var e=new c;return function(t){var i=t||new l;return this.getWorldQuaternion(e),i.set(0,0,-1).applyQuaternion(e)}}(),Ie.prototype.lookAt=function(){var e=new h;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),Ie.prototype.clone=function(){return(new this.constructor).copy(this)},Ie.prototype.copy=function(e){return le.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},Oe.prototype=Object.assign(Object.create(Ie.prototype),{constructor:Oe,isPerspectiveCamera:!0,copy:function(e){return Ie.prototype.copy.call(this,e),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(t){var i=.5*this.getFilmHeight()/t;this.fov=2*e.Math.RAD2DEG*Math.atan(i),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*e.Math.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*e.Math.RAD2DEG*Math.atan(Math.tan(.5*e.Math.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(e,t,i,n,r,a){this.aspect=e/t,this.view={fullWidth:e,fullHeight:t,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,i=t*Math.tan(.5*e.Math.DEG2RAD*this.fov)/this.zoom,n=2*i,r=this.aspect*n,a=-.5*r,o=this.view;if(null!==o){var s=o.fullWidth,c=o.fullHeight;a+=o.offsetX*r/s,i-=o.offsetY*n/c,r*=o.width/s,n*=o.height/c}var l=this.filmOffset;0!==l&&(a+=t*l/this.getFilmWidth()),this.projectionMatrix.makeFrustum(a,a+r,i-n,i,t,this.far)},toJSON:function(e){var t=le.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),De.prototype=Object.assign(Object.create(Ie.prototype),{constructor:De,isOrthographicCamera:!0,copy:function(e){return Ie.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,i,n,r,a){this.view={fullWidth:e,fullHeight:t,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,o=n+t,s=n-t;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;r+=h*(this.view.offsetX/c),a=r+h*(this.view.width/c),o-=u*(this.view.offsetY/l),s=o-u*(this.view.height/l)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(e){var t=le.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}});var Bc=0;lt.prototype.isFogExp2=!0,lt.prototype.clone=function(){return new lt(this.color.getHex(),this.density)},lt.prototype.toJSON=function(e){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},ht.prototype.isFog=!0,ht.prototype.clone=function(){return new ht(this.color.getHex(),this.near,this.far)},ht.prototype.toJSON=function(e){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ut.prototype=Object.create(le.prototype),ut.prototype.constructor=ut,ut.prototype.copy=function(e,t){return le.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},ut.prototype.toJSON=function(e){var t=le.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},pt.prototype=Object.assign(Object.create(le.prototype),{constructor:pt,isLensFlare:!0,copy:function(e){le.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,i=e.lensFlares.length;i>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},add:function(e,t,i,n,r,a){void 0===t&&(t=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===r&&(r=new X(16777215)),void 0===n&&(n=Ar),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:e,size:t,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:n})},updateLensFlares:function(){var e,t,i=this.lensFlares.length,n=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(e=0;i>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+n*t.distance,t.y=this.positionScreen.y+r*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)}}),dt.prototype=Object.create(J.prototype),dt.prototype.constructor=dt,dt.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this},ft.prototype=Object.assign(Object.create(le.prototype),{constructor:ft,isSprite:!0,raycast:function(){var e=new l;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceSqToPoint(e),r=this.scale.x*this.scale.y/4;n>r||i.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),mt.prototype=Object.assign(Object.create(le.prototype),{constructor:mt,copy:function(e){le.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,n=t.length;n>i;i++){var r=t[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var i=this.levels,n=0;n<i.length&&!(t<i[n].distance);n++);i.splice(n,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,i=1,n=t.length;n>i&&!(e<t[i].distance);i++);return t[i-1].object},raycast:function(){var e=new l;return function(t,i){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(e);this.getObjectForDistance(n).raycast(t,i)}}(),update:function(){var e=new l,t=new l;return function(i){var n=this.levels;if(n.length>1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);n[0].object.visible=!0;for(var a=1,o=n.length;o>a&&r>=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;o>a;a++)n[a].object.visible=!1}}}(),toJSON:function(e){var t=le.prototype.toJSON.call(this,e);t.object.levels=[];for(var i=this.levels,n=0,r=i.length;r>n;n++){var a=i[n];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),vt.prototype=Object.create(n.prototype),vt.prototype.constructor=vt,vt.prototype.isDataTexture=!0,Object.assign(gt.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var i=new h;this.bones[e]&&i.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(i)}},pose:function(){for(var e,t=0,i=this.bones.length;i>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,i=this.bones.length;i>t;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){var e=new h;return function(){for(var t=0,i=this.bones.length;i>t;t++){var n=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(n,this.boneInverses[t]),e.toArray(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new gt(this.bones,this.boneInverses,this.useVertexTexture)}}),yt.prototype=Object.assign(Object.create(le.prototype),{constructor:yt,isBone:!0,copy:function(e){return le.prototype.copy.call(this,e),this.skin=e.skin,this}}),xt.prototype=Object.assign(Object.create(Ce.prototype),{constructor:xt,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],i=1/t.lengthManhattan();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var n=new a,r=this.geometry.attributes.skinWeight,e=0;e<r.count;e++){n.x=r.getX(e),n.y=r.getY(e),n.z=r.getZ(e),n.w=r.getW(e);var i=1/n.lengthManhattan();i!==1/0?n.multiplyScalar(i):n.set(1,0,0,0),r.setXYZW(e,n.x,n.y,n.z,n.w)}},updateMatrixWorld:function(e){Ce.prototype.updateMatrixWorld.call(this,!0),"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,this.skeleton.useVertexTexture).copy(this)}}),bt.prototype=Object.create(J.prototype),bt.prototype.constructor=bt,bt.prototype.isLineBasicMaterial=!0,bt.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},wt.prototype=Object.assign(Object.create(le.prototype),{constructor:wt,isLine:!0,raycast:function(){var e=new h,t=new oe,i=new te;return function(n,r){var a=n.linePrecision,o=a*a,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){e.getInverse(c),t.copy(n.ray).applyMatrix4(e);var h=new l,u=new l,p=new l,d=new l,f=this&&this.isLineSegments?2:1;if(s&&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;b>x;x+=f){var w=y[x],_=y[x+1];h.fromArray(g,3*w),u.fromArray(g,3*_);var E=t.distanceSqToSegment(h,u,d,p);if(!(E>o)){d.applyMatrix4(this.matrixWorld);var M=n.ray.origin.distanceTo(d);M<n.near||M>n.far||r.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=g.length/3-1;b>x;x+=f){h.fromArray(g,3*x),u.fromArray(g,3*x+3);var E=t.distanceSqToSegment(h,u,d,p);if(!(E>o)){d.applyMatrix4(this.matrixWorld);var M=n.ray.origin.distanceTo(d);M<n.near||M>n.far||r.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(s&&s.isGeometry)for(var T=s.vertices,S=T.length,x=0;S-1>x;x+=f){var E=t.distanceSqToSegment(T[x],T[x+1],d,p);if(!(E>o)){d.applyMatrix4(this.matrixWorld);var M=n.ray.origin.distanceTo(d);M<n.near||M>n.far||r.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),_t.prototype=Object.assign(Object.create(wt.prototype),{constructor:_t,isLineSegments:!0}),Et.prototype=Object.create(J.prototype),Et.prototype.constructor=Et,Et.prototype.isPointsMaterial=!0,Et.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},Mt.prototype=Object.assign(Object.create(le.prototype),{constructor:Mt,isPoints:!0,raycast:function(){var e=new h,t=new oe,i=new te;return function(n,r){function a(e,i){var a=t.distanceSqToPoint(e);if(p>a){var s=t.closestPointToPoint(e);s.applyMatrix4(c);var l=n.ray.origin.distanceTo(s);if(l<n.near||l>n.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:s.clone(),index:i,face:null,object:o})}}var o=this,s=this.geometry,c=this.matrixWorld,h=n.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(c),n.ray.intersectsSphere(i)!==!1){e.getInverse(c),t.copy(n.ray).applyMatrix4(e);var u=h/((this.scale.x+this.scale.y+this.scale.z)/3),p=u*u,d=new l;if(s&&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;x>y;y++){var b=g[y];d.fromArray(v,3*b),a(d,b)}else for(var y=0,w=v.length/3;w>y;y++)d.fromArray(v,3*y),a(d,y)}else for(var _=s.vertices,y=0,w=_.length;w>y;y++)a(_[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Tt.prototype=Object.assign(Object.create(le.prototype),{constructor:Tt}),St.prototype=Object.create(n.prototype),St.prototype.constructor=St,Rt.prototype=Object.create(n.prototype),Rt.prototype.constructor=Rt,Rt.prototype.isCompressedTexture=!0,At.prototype=Object.create(n.prototype),At.prototype.constructor=At,Lt.prototype=Object.create(n.prototype),Lt.prototype.constructor=Lt,Lt.prototype.isDepthTexture=!0,Ct.prototype=Object.create(Le.prototype),Ct.prototype.constructor=Ct,Pt.prototype=Object.create(Se.prototype),Pt.prototype.constructor=Pt,Ut.prototype=Object.create(Se.prototype),Ut.prototype.constructor=Ut,It.prototype=Object.create(Ut.prototype),It.prototype.constructor=It,Ot.prototype=Object.create(Ut.prototype),Ot.prototype.constructor=Ot,Dt.prototype=Object.create(Ut.prototype),Dt.prototype.constructor=Dt,Nt.prototype=Object.create(Ut.prototype),Nt.prototype.constructor=Nt,Ft.prototype=Object.create(Se.prototype),Ft.prototype.constructor=Ft,Ft.NoTaper=function(e){return 1},Ft.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},Ft.FrenetFrames=function(t,i,n){function r(){v[0]=new l,g[0]=new l,o=Number.MAX_VALUE,s=Math.abs(m[0].x),c=Math.abs(m[0].y),u=Math.abs(m[0].z),o>=s&&(o=s,f.set(1,0,0)),o>=c&&(o=c,f.set(0,1,0)),o>=u&&f.set(0,0,1),y.crossVectors(m[0],f).normalize(),v[0].crossVectors(m[0],y),g[0].crossVectors(m[0],v[0])}var a,o,s,c,u,p,d,f=new l,m=[],v=[],g=[],y=new l,x=new h,b=i+1;for(this.tangents=m,this.normals=v,this.binormals=g,p=0;b>p;p++)d=p/(b-1),m[p]=t.getTangentAt(d),m[p].normalize();for(r(),p=1;b>p;p++)v[p]=v[p-1].clone(),g[p]=g[p-1].clone(),y.crossVectors(m[p-1],m[p]),y.length()>Number.EPSILON&&(y.normalize(),a=Math.acos(e.Math.clamp(m[p-1].dot(m[p]),-1,1)),v[p].applyMatrix4(x.makeRotationAxis(y,a))),g[p].crossVectors(m[p],v[p]);if(n)for(a=Math.acos(e.Math.clamp(v[0].dot(v[b-1]),-1,1)),a/=b-1,m[0].dot(y.crossVectors(v[0],v[b-1]))>0&&(a=-a),p=1;b>p;p++)v[p].applyMatrix4(x.makeRotationAxis(m[p],a*p)),g[p].crossVectors(m[p],v[p])},zt.prototype=Object.create(Le.prototype),zt.prototype.constructor=zt,Bt.prototype=Object.create(Se.prototype),Bt.prototype.constructor=Bt,Ht.prototype=Object.create(Le.prototype),Ht.prototype.constructor=Ht,Gt.prototype=Object.create(Se.prototype),Gt.prototype.constructor=Gt,e.ShapeUtils={area:function(e){for(var t=e.length,i=0,n=t-1,r=0;t>r;n=r++)i+=e[n].x*e[r].y-e[r].x*e[n].y;return.5*i},triangulate:function(){function t(e,t,i,n,r,a){var o,s,c,l,h,u,p,d,f;if(s=e[a[t]].x,c=e[a[t]].y,l=e[a[i]].x,h=e[a[i]].y,u=e[a[n]].x,p=e[a[n]].y,Number.EPSILON>(l-s)*(p-c)-(h-c)*(u-s))return!1;var m,v,g,y,x,b,w,_,E,M,T,S,R,A,L;for(m=u-l,v=p-h,g=s-u,y=c-p,x=l-s,b=h-c,o=0;r>o;o++)if(d=e[a[o]].x,f=e[a[o]].y,!(d===s&&f===c||d===l&&f===h||d===u&&f===p)&&(w=d-s,_=f-c,E=d-l,M=f-h,T=d-u,S=f-p,L=m*M-v*E,R=x*_-b*w,A=g*S-y*T,L>=-Number.EPSILON&&A>=-Number.EPSILON&&R>=-Number.EPSILON))return!1;return!0}return function(i,n){var r=i.length;if(3>r)return null;var a,o,s,c=[],l=[],h=[];if(e.ShapeUtils.area(i)>0)for(o=0;r>o;o++)l[o]=o;else for(o=0;r>o;o++)l[o]=r-1-o;var u=r,p=2*u;for(o=u-1;u>2;){if(p--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?h:c;if(a=o,a>=u&&(a=0),o=a+1,o>=u&&(o=0),s=o+1,s>=u&&(s=0),t(i,a,o,s,u,l)){var d,f,m,v,g;for(d=l[a],f=l[o],m=l[s],c.push([i[d],i[f],i[m]]),h.push([l[a],l[o],l[s]]),v=o,g=o+1;u>g;v++,g++)l[v]=l[g];u--,p=2*u}}return n?h:c}}(),triangulateShape:function(t,i){function n(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop();
}function r(e,t,i){return e.x!==t.x?e.x<t.x?e.x<=i.x&&i.x<=t.x:t.x<=i.x&&i.x<=e.x:e.y<t.y?e.y<=i.y&&i.y<=t.y:t.y<=i.y&&i.y<=e.y}function a(e,t,i,n,a){var o=t.x-e.x,s=t.y-e.y,c=n.x-i.x,l=n.y-i.y,h=e.x-i.x,u=e.y-i.y,p=s*c-o*l,d=s*h-o*u;if(Math.abs(p)>Number.EPSILON){var f;if(p>0){if(0>d||d>p)return[];if(f=l*h-c*u,0>f||f>p)return[]}else{if(d>0||p>d)return[];if(f=l*h-c*u,f>0||p>f)return[]}if(0===f)return!a||0!==d&&d!==p?[e]:[];if(f===p)return!a||0!==d&&d!==p?[t]:[];if(0===d)return[i];if(d===p)return[n];var m=f/p;return[{x:e.x+m*o,y:e.y+m*s}]}if(0!==d||l*h!==c*u)return[];var v=0===o&&0===s,g=0===c&&0===l;if(v&&g)return e.x!==i.x||e.y!==i.y?[]:[e];if(v)return r(i,n,e)?[e]:[];if(g)return r(e,t,i)?[i]:[];var y,x,b,w,_,E,M,T;return 0!==o?(e.x<t.x?(y=e,b=e.x,x=t,w=t.x):(y=t,b=t.x,x=e,w=e.x),i.x<n.x?(_=i,M=i.x,E=n,T=n.x):(_=n,M=n.x,E=i,T=i.x)):(e.y<t.y?(y=e,b=e.y,x=t,w=t.y):(y=t,b=t.y,x=e,w=e.y),i.y<n.y?(_=i,M=i.y,E=n,T=n.y):(_=n,M=n.y,E=i,T=i.y)),M>=b?M>w?[]:w===M?a?[]:[_]:T>=w?[_,x]:[_,E]:b>T?[]:b===T?a?[]:[y]:T>=w?[y,x]:[y,E]}function o(e,t,i,n){var r=t.x-e.x,a=t.y-e.y,o=i.x-e.x,s=i.y-e.y,c=n.x-e.x,l=n.y-e.y,h=r*s-a*o,u=r*l-a*c;if(Math.abs(h)>Number.EPSILON){var p=c*s-l*o;return h>0?u>=0&&p>=0:u>=0||p>=0}return u>0}function s(e,t){function i(e,t){var i=y.length-1,n=e-1;0>n&&(n=i);var r=e+1;r>i&&(r=0);var a=o(y[e],y[n],y[r],s[t]);if(!a)return!1;var c=s.length-1,l=t-1;0>l&&(l=c);var h=t+1;return h>c&&(h=0),a=o(s[t],s[l],s[h],y[e]),!!a}function n(e,t){var i,n,r;for(i=0;i<y.length;i++)if(n=i+1,n%=y.length,r=a(e,t,y[i],y[n],!0),r.length>0)return!0;return!1}function r(e,i){var n,r,o,s,c;for(n=0;n<x.length;n++)for(r=t[x[n]],o=0;o<r.length;o++)if(s=o+1,s%=r.length,c=a(e,i,r[o],r[s],!0),c.length>0)return!0;return!1}for(var s,c,l,h,u,p,d,f,m,v,g,y=e.concat(),x=[],b=[],w=0,_=t.length;_>w;w++)x.push(w);for(var E=0,M=2*x.length;x.length>0;){if(M--,0>M){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(l=E;l<y.length;l++){h=y[l],c=-1;for(var w=0;w<x.length;w++)if(p=x[w],d=h.x+":"+h.y+":"+p,void 0===b[d]){s=t[p];for(var T=0;T<s.length;T++)if(u=s[T],i(l,T)&&!n(h,u)&&!r(h,u)){c=T,x.splice(w,1),f=y.slice(0,l+1),m=y.slice(l),v=s.slice(c),g=s.slice(0,c+1),y=f.concat(v).concat(g).concat(m),E=l;break}if(c>=0)break;b[d]=!0}if(c>=0)break}}return y}n(t),i.forEach(n);for(var c,l,h,u,p,d,f={},m=t.concat(),v=0,g=i.length;g>v;v++)Array.prototype.push.apply(m,i[v]);for(c=0,l=m.length;l>c;c++)p=m[c].x+":"+m[c].y,void 0!==f[p]&&console.warn("THREE.ShapeUtils: Duplicate point",p,c),f[p]=c;var y=s(t,i),x=e.ShapeUtils.triangulate(y,!1);for(c=0,l=x.length;l>c;c++)for(u=x[c],h=0;3>h;h++)p=u[h].x+":"+u[h].y,d=f[p],void 0!==d&&(u[h]=d);return x.concat()},isClockWise:function(t){return e.ShapeUtils.area(t)<0},b2:function(){function e(e,t){var i=1-e;return i*i*t}function t(e,t){return 2*(1-e)*e*t}function i(e,t){return e*e*t}return function(n,r,a,o){return e(n,r)+t(n,a)+i(n,o)}}(),b3:function(){function e(e,t){var i=1-e;return i*i*i*t}function t(e,t){var i=1-e;return 3*i*i*e*t}function i(e,t){var i=1-e;return 3*i*e*e*t}function n(e,t){return e*e*e*t}return function(r,a,o,s,c){return e(r,a)+t(r,o)+i(r,s)+n(r,c)}}()},Vt.prototype=Object.create(Se.prototype),Vt.prototype.constructor=Vt,Vt.prototype.addShapeList=function(e,t){for(var i=e.length,n=0;i>n;n++){var r=e[n];this.addShape(r,t)}},Vt.prototype.addShape=function(t,n){function r(e,t,i){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(i).add(e)}function a(e,t,n){var r,a,o=1,s=e.x-t.x,c=e.y-t.y,l=n.x-e.x,h=n.y-e.y,u=s*s+c*c,p=s*h-c*l;if(Math.abs(p)>Number.EPSILON){var d=Math.sqrt(u),f=Math.sqrt(l*l+h*h),m=t.x-c/d,v=t.y+s/d,g=n.x-h/f,y=n.y+l/f,x=((g-m)*h-(y-v)*l)/(s*h-c*l);r=m+s*x-e.x,a=v+c*x-e.y;var b=r*r+a*a;if(2>=b)return new i(r,a);o=Math.sqrt(b/2)}else{var w=!1;s>Number.EPSILON?l>Number.EPSILON&&(w=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(w=!0):Math.sign(c)===Math.sign(h)&&(w=!0),w?(r=-c,a=s,o=Math.sqrt(u)):(r=s,a=c,o=Math.sqrt(u/2))}return new i(r/o,a/o)}function o(){if(_){var e=0,t=W*e;for(q=0;X>q;q++)j=F[q],u(j[2]+t,j[1]+t,j[0]+t);for(e=M+2*w,t=W*e,q=0;X>q;q++)j=F[q],u(j[0]+t,j[1]+t,j[2]+t)}else{for(q=0;X>q;q++)j=F[q],u(j[2],j[1],j[0]);for(q=0;X>q;q++)j=F[q],u(j[0]+W*M,j[1]+W*M,j[2]+W*M)}}function s(){var e=0;for(c(z,e),e+=z.length,L=0,C=D.length;C>L;L++)A=D[L],c(A,e),e+=A.length}function c(e,t){var i,n;for(q=e.length;--q>=0;){i=q,n=q-1,0>n&&(n=e.length-1);var r=0,a=M+2*w;for(r=0;a>r;r++){var o=W*r,s=W*(r+1),c=t+i+o,l=t+n+o,h=t+n+s,u=t+i+s;p(c,l,h,u,e,r,a,i,n)}}}function h(e,t,i){P.vertices.push(new l(e,t,i))}function u(e,t,i){e+=U,t+=U,i+=U,P.faces.push(new de(e,t,i,null,null,0));var n=R.generateTopUV(P,e,t,i);P.faceVertexUvs[0].push(n)}function p(e,t,i,n,r,a,o,s,c){e+=U,t+=U,i+=U,n+=U,P.faces.push(new de(e,t,n,null,null,1)),P.faces.push(new de(t,i,n,null,null,1));var l=R.generateSideWallUV(P,e,t,i,n);P.faceVertexUvs[0].push([l[0],l[1],l[3]]),P.faceVertexUvs[0].push([l[1],l[2],l[3]])}var d,f,m,v,g,y=void 0!==n.amount?n.amount:100,x=void 0!==n.bevelThickness?n.bevelThickness:6,b=void 0!==n.bevelSize?n.bevelSize:x-2,w=void 0!==n.bevelSegments?n.bevelSegments:3,_=void 0!==n.bevelEnabled?n.bevelEnabled:!0,E=void 0!==n.curveSegments?n.curveSegments:12,M=void 0!==n.steps?n.steps:1,T=n.extrudePath,S=!1,R=void 0!==n.UVGenerator?n.UVGenerator:Vt.WorldUVGenerator;T&&(d=T.getSpacedPoints(M),S=!0,_=!1,f=void 0!==n.frames?n.frames:new Ft.FrenetFrames(T,M,!1),m=new l,v=new l,g=new l),_||(w=0,x=0,b=0);var A,L,C,P=this,U=this.vertices.length,I=t.extractPoints(E),O=I.shape,D=I.holes,N=!e.ShapeUtils.isClockWise(O);if(N){for(O=O.reverse(),L=0,C=D.length;C>L;L++)A=D[L],e.ShapeUtils.isClockWise(A)&&(D[L]=A.reverse());N=!1}var F=e.ShapeUtils.triangulateShape(O,D),z=O;for(L=0,C=D.length;C>L;L++)A=D[L],O=O.concat(A);for(var B,H,G,V,k,j,W=O.length,X=F.length,Y=[],q=0,Z=z.length,J=Z-1,Q=q+1;Z>q;q++,J++,Q++)J===Z&&(J=0),Q===Z&&(Q=0),Y[q]=a(z[q],z[J],z[Q]);var K,$=[],ee=Y.concat();for(L=0,C=D.length;C>L;L++){for(A=D[L],K=[],q=0,Z=A.length,J=Z-1,Q=q+1;Z>q;q++,J++,Q++)J===Z&&(J=0),Q===Z&&(Q=0),K[q]=a(A[q],A[J],A[Q]);$.push(K),ee=ee.concat(K)}for(B=0;w>B;B++){for(G=B/w,V=x*Math.cos(G*Math.PI/2),H=b*Math.sin(G*Math.PI/2),q=0,Z=z.length;Z>q;q++)k=r(z[q],Y[q],H),h(k.x,k.y,-V);for(L=0,C=D.length;C>L;L++)for(A=D[L],K=$[L],q=0,Z=A.length;Z>q;q++)k=r(A[q],K[q],H),h(k.x,k.y,-V)}for(H=b,q=0;W>q;q++)k=_?r(O[q],ee[q],H):O[q],S?(v.copy(f.normals[0]).multiplyScalar(k.x),m.copy(f.binormals[0]).multiplyScalar(k.y),g.copy(d[0]).add(v).add(m),h(g.x,g.y,g.z)):h(k.x,k.y,0);var te;for(te=1;M>=te;te++)for(q=0;W>q;q++)k=_?r(O[q],ee[q],H):O[q],S?(v.copy(f.normals[te]).multiplyScalar(k.x),m.copy(f.binormals[te]).multiplyScalar(k.y),g.copy(d[te]).add(v).add(m),h(g.x,g.y,g.z)):h(k.x,k.y,y/M*te);for(B=w-1;B>=0;B--){for(G=B/w,V=x*Math.cos(G*Math.PI/2),H=b*Math.sin(G*Math.PI/2),q=0,Z=z.length;Z>q;q++)k=r(z[q],Y[q],H),h(k.x,k.y,y+V);for(L=0,C=D.length;C>L;L++)for(A=D[L],K=$[L],q=0,Z=A.length;Z>q;q++)k=r(A[q],K[q],H),S?h(k.x,k.y+d[M-1].y,d[M-1].x+V):h(k.x,k.y,y+V)}o(),s()},Vt.WorldUVGenerator={generateTopUV:function(e,t,n,r){var a=e.vertices,o=a[t],s=a[n],c=a[r];return[new i(o.x,o.y),new i(s.x,s.y),new i(c.x,c.y)]},generateSideWallUV:function(e,t,n,r,a){var o=e.vertices,s=o[t],c=o[n],l=o[r],h=o[a];return Math.abs(s.y-c.y)<.01?[new i(s.x,1-s.z),new i(c.x,1-c.z),new i(l.x,1-l.z),new i(h.x,1-h.z)]:[new i(s.y,1-s.z),new i(c.y,1-c.z),new i(l.y,1-l.z),new i(h.y,1-h.z)]}},kt.prototype=Object.create(Vt.prototype),kt.prototype.constructor=kt,jt.prototype=Object.create(Le.prototype),jt.prototype.constructor=jt,Wt.prototype=Object.create(Se.prototype),Wt.prototype.constructor=Wt,Xt.prototype=Object.create(Le.prototype),Xt.prototype.constructor=Xt,Yt.prototype=Object.create(Se.prototype),Yt.prototype.constructor=Yt,qt.prototype=Object.create(Se.prototype),qt.prototype.constructor=qt,Zt.prototype=Object.create(Le.prototype),Zt.prototype.constructor=Zt,Jt.prototype=Object.create(Se.prototype),Jt.prototype.constructor=Jt,Qt.prototype=Object.create(Se.prototype),Qt.prototype.constructor=Qt,Qt.prototype.addShapeList=function(e,t){for(var i=0,n=e.length;n>i;i++)this.addShape(e[i],t);return this},Qt.prototype.addShape=function(t,i){void 0===i&&(i={});var n,r,a,o=void 0!==i.curveSegments?i.curveSegments:12,s=i.material,c=void 0===i.UVGenerator?Vt.WorldUVGenerator:i.UVGenerator,h=this.vertices.length,u=t.extractPoints(o),p=u.shape,d=u.holes,f=!e.ShapeUtils.isClockWise(p);if(f){for(p=p.reverse(),n=0,r=d.length;r>n;n++)a=d[n],e.ShapeUtils.isClockWise(a)&&(d[n]=a.reverse());f=!1}var m=e.ShapeUtils.triangulateShape(p,d);for(n=0,r=d.length;r>n;n++)a=d[n],p=p.concat(a);var v,g,y=p.length,x=m.length;for(n=0;y>n;n++)v=p[n],this.vertices.push(new l(v.x,v.y,0));for(n=0;x>n;n++){g=m[n];var b=g[0]+h,w=g[1]+h,_=g[2]+h;this.faces.push(new de(b,w,_,null,null,s)),this.faceVertexUvs[0].push(c.generateTopUV(this,b,w,_))}},Kt.prototype=Object.create(Le.prototype),Kt.prototype.constructor=Kt,$t.prototype=Object.create(Le.prototype),$t.prototype.constructor=$t,ei.prototype=Object.create(Se.prototype),ei.prototype.constructor=ei,ti.prototype=Object.create(ei.prototype),ti.prototype.constructor=ti,ii.prototype=Object.create(Le.prototype),ii.prototype.constructor=ii,ni.prototype=Object.create(Le.prototype),ni.prototype.constructor=ni,ri.prototype=Object.create(Se.prototype),ri.prototype.constructor=ri,ai.prototype=Object.create(Se.prototype),ai.prototype.constructor=ai;var Hc=Object.freeze({WireframeGeometry:Ct,ParametricGeometry:Pt,TetrahedronGeometry:It,OctahedronGeometry:Ot,IcosahedronGeometry:Dt,DodecahedronGeometry:Nt,PolyhedronGeometry:Ut,TubeGeometry:Ft,TorusKnotGeometry:Bt,TorusKnotBufferGeometry:zt,TorusGeometry:Gt,TorusBufferGeometry:Ht,TextGeometry:kt,SphereBufferGeometry:jt,SphereGeometry:Wt,RingGeometry:Yt,RingBufferGeometry:Xt,PlaneBufferGeometry:Ue,PlaneGeometry:qt,LatheGeometry:Jt,LatheBufferGeometry:Zt,ShapeGeometry:Qt,ExtrudeGeometry:Vt,EdgesGeometry:Kt,ConeGeometry:ti,ConeBufferGeometry:ii,CylinderGeometry:ei,CylinderBufferGeometry:$t,CircleBufferGeometry:ni,CircleGeometry:ri,BoxBufferGeometry:Pe,BoxGeometry:ai});oi.prototype=Object.create(K.prototype),oi.prototype.constructor=oi,oi.prototype.isShadowMaterial=!0,si.prototype=Object.create(K.prototype),si.prototype.constructor=si,si.prototype.isRawShaderMaterial=!0,ci.prototype={constructor:ci,isMultiMaterial:!0,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},i=this.materials,n=0,r=i.length;r>n;n++){var a=i[n].toJSON(e);delete a.metadata,t.materials.push(a)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},li.prototype=Object.create(J.prototype),li.prototype.constructor=li,li.prototype.isMeshStandardMaterial=!0,li.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},hi.prototype=Object.create(li.prototype),hi.prototype.constructor=hi,hi.prototype.isMeshPhysicalMaterial=!0,hi.prototype.copy=function(e){return li.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},ui.prototype=Object.create(J.prototype),ui.prototype.constructor=ui,ui.prototype.isMeshPhongMaterial=!0,ui.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},pi.prototype=Object.create(J.prototype),pi.prototype.constructor=pi,pi.prototype.isMeshNormalMaterial=!0,pi.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},di.prototype=Object.create(J.prototype),di.prototype.constructor=di,di.prototype.isMeshLambertMaterial=!0,di.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},fi.prototype=Object.create(J.prototype),fi.prototype.constructor=fi,fi.prototype.isLineDashedMaterial=!0,fi.prototype.copy=function(e){return J.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Gc=Object.freeze({ShadowMaterial:oi,SpriteMaterial:dt,RawShaderMaterial:si,ShaderMaterial:K,PointsMaterial:Et,MultiMaterial:ci,MeshPhysicalMaterial:hi,MeshStandardMaterial:li,MeshPhongMaterial:ui,MeshNormalMaterial:pi,MeshLambertMaterial:di,MeshDepthMaterial:$,MeshBasicMaterial:fe,LineDashedMaterial:fi,LineBasicMaterial:bt,Material:J});e.Cache={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){return this.enabled!==!1?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},e.DefaultLoadingManager=new mi,Object.assign(vi.prototype,{load:function(t,i,n,r){void 0!==this.path&&(t=this.path+t);var a=this,o=e.Cache.get(t);if(void 0!==o)return a.manager.itemStart(t),setTimeout(function(){i&&i(o),a.manager.itemEnd(t)},0),o;var s=new XMLHttpRequest;return s.open("GET",t,!0),s.addEventListener("load",function(n){var o=n.target.response;e.Cache.add(t,o),200===this.status?(i&&i(o),a.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),i&&i(o),a.manager.itemEnd(t)):(r&&r(n),a.manager.itemError(t))},!1),void 0!==n&&s.addEventListener("progress",function(e){n(e)},!1),s.addEventListener("error",function(e){r&&r(e),a.manager.itemError(t)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType("text/plain"),s.send(null),a.manager.itemStart(t),s},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this}}),Object.assign(gi.prototype,{load:function(e,t,i,n){function r(r){c.load(e[r],function(e){var i=a._parser(e,!0);o[r]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(s.minFilter=Aa),s.format=i.format,s.needsUpdate=!0,t&&t(s))},i,n)}var a=this,o=[],s=new Rt;s.image=o;var c=new vi(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,h=0,u=e.length;u>h;++h)r(h);else c.load(e,function(e){var i=a._parser(e,!0);if(i.isCubemap)for(var n=i.mipmaps.length/i.mipmapCount,r=0;n>r;r++){o[r]={mipmaps:[]};for(var c=0;c<i.mipmapCount;c++)o[r].mipmaps.push(i.mipmaps[r*i.mipmapCount+c]),o[r].format=i.format,o[r].width=i.width,o[r].height=i.height}else s.image.width=i.width,s.image.height=i.height,s.mipmaps=i.mipmaps;1===i.mipmapCount&&(s.minFilter=Aa),s.format=i.format,s.needsUpdate=!0,t&&t(s)},i,n);return s},setPath:function(e){return this.path=e,this}});var Vc=yi;Object.assign(yi.prototype,{load:function(e,t,i,n){var r=this,a=new vt,o=new vi(this.manager);return o.setResponseType("arraybuffer"),o.load(e,function(e){var i=r._parser(e);i&&(void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:_a,a.wrapT=void 0!==i.wrapT?i.wrapT:_a,a.magFilter=void 0!==i.magFilter?i.magFilter:Aa,a.minFilter=void 0!==i.minFilter?i.minFilter:Ca,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps),1===i.mipmapCount&&(a.minFilter=Aa),a.needsUpdate=!0,t&&t(a,i))},i,n),a}}),Object.assign(xi.prototype,{load:function(e,t,i,n){var r=this,a=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(a.onload=function(){a.onload=null,URL.revokeObjectURL(a.src),t&&t(a),r.manager.itemEnd(e)},0===e.indexOf("data:"))a.src=e;else{var o=new vi;o.setPath(this.path),o.setResponseType("blob"),o.setWithCredentials(this.withCredentials),o.load(e,function(e){a.src=URL.createObjectURL(e)},i,n)}return r.manager.itemStart(e),a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(bi.prototype,{load:function(e,t,i,n){function r(i){o.load(e[i],function(e){a.images[i]=e,s++,6===s&&(a.needsUpdate=!0,t&&t(a))},void 0,n)}var a=new u,o=new xi(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);for(var s=0,c=0;c<e.length;++c)r(c);return a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(wi.prototype,{load:function(e,t,i,r){var a=new n,o=new xi(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setWithCredentials(this.withCredentials),o.setPath(this.path),o.load(e,function(i){var n=e.search(/\.(jpg|jpeg)$/)>0||0===e.search(/^data\:image\/jpeg/);a.format=n?Wa:Xa,a.image=i,a.needsUpdate=!0,void 0!==t&&t(a)},i,r),a},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this}}),_i.prototype=Object.assign(Object.create(le.prototype),{constructor:_i,isLight:!0,copy:function(e){return le.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=le.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Ei.prototype=Object.assign(Object.create(_i.prototype),{constructor:Ei,isHemisphereLight:!0,copy:function(e){return _i.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Mi.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Ti.prototype=Object.assign(Object.create(Mi.prototype),{constructor:Ti,isSpotLightShadow:!0,update:function(t){var i=2*e.Math.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||500,a=this.camera;i===a.fov&&n===a.aspect&&r===a.far||(a.fov=i,a.aspect=n,a.far=r,a.updateProjectionMatrix())}}),Si.prototype=Object.assign(Object.create(_i.prototype),{constructor:Si,isSpotLight:!0,copy:function(e){return _i.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ri.prototype=Object.assign(Object.create(_i.prototype),{constructor:Ri,isPointLight:!0,copy:function(e){return _i.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Ai.prototype=Object.assign(Object.create(Mi.prototype),{constructor:Ai}),Li.prototype=Object.assign(Object.create(_i.prototype),{constructor:Li,isDirectionalLight:!0,copy:function(e){return _i.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ci.prototype=Object.assign(Object.create(_i.prototype),{constructor:Ci,isAmbientLight:!0}),e.AnimationUtils={arraySlice:function(t,i,n){return e.AnimationUtils.isTypedArray(t)?new t.constructor(t.subarray(i,n)):t.slice(i,n)},convertArray:function(e,t,i){return!e||!i&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,i){return e[t]-e[i]}for(var i=e.length,n=new Array(i),r=0;r!==i;++r)n[r]=r;return n.sort(t),n},sortedArray:function(e,t,i){for(var n=e.length,r=new e.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*t,c=0;c!==t;++c)r[o++]=e[s+c];return r},flattenJSON:function(e,t,i,n){for(var r=1,a=e[0];void 0!==a&&void 0===a[n];)a=e[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o)){do o=a[n],void 0!==o&&(t.push(a.time),i.push.apply(i,o)),a=e[r++];while(void 0!==a)}else if(void 0!==o.toArray){do o=a[n],void 0!==o&&(t.push(a.time),o.toArray(i,i.length)),a=e[r++];while(void 0!==a)}else do o=a[n],void 0!==o&&(t.push(a.time),i.push(o)),a=e[r++];while(void 0!==a)}}},Pi.prototype={constructor:Pi,evaluate:function(e){var t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{var a;i:{n:if(!(n>e)){for(var o=i+2;;){if(void 0===n){if(r>e)break n;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,r)}if(i===o)break;if(r=n,n=t[++i],n>e)break t}a=t.length;break i}{if(e>=r)break e;var s=t[1];s>e&&(i=2,r=s);for(var o=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(i===o)break;if(n=r,r=t[--i-1],e>=r)break t}a=i,i=0}}for(;a>i;){var c=i+a>>>1;e<t[c]?a=c:i=c+1}if(n=t[i],r=t[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,r,e)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n,a=0;a!==n;++a)t[a]=i[r+a];return t},interpolate_:function(e,t,i,n){throw new Error("call to abstract method")},intervalChanged_:function(e,t,i){}},Object.assign(Pi.prototype,{beforeStart_:Pi.prototype.copySampleValue_,afterEnd_:Pi.prototype.copySampleValue_}),Ui.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ui,DefaultSettings_:{endingStart:fo,endingEnd:fo},intervalChanged_:function(e,t,i){var n=this.parameterPositions,r=e-2,a=e+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case mo:r=e,o=2*t-i;break;case vo:r=n.length-2,o=t+n[r]-n[r+1];break;default:r=e,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case mo:a=e,s=2*i-t;break;case vo:a=1,s=i+n[1]-n[0];break;default:a=e-1,s=t}var c=.5*(i-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-i),this._offsetPrev=r*l,this._offsetNext=a*l},interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(i-t)/(n-t),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)r[b]=v*a[l+b]+g*a[c+b]+y*a[s+b]+x*a[h+b];return r}}),Ii.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Ii,interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(i-t)/(n-t),h=1-l,u=0;u!==o;++u)r[u]=a[c+u]*h+a[s+u]*l;return r}}),Oi.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Oi,interpolate_:function(e,t,i,n){return this.copySampleValue_(e-1)}});var kc;kc={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:uo,InterpolantFactoryMethodDiscrete:function(e){return new Oi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Ii(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Ui(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case ho:t=this.InterpolantFactoryMethodDiscrete;break;case uo:t=this.InterpolantFactoryMethodLinear;break;case po:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(i)}this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ho;case this.InterpolantFactoryMethodLinear:return uo;case this.InterpolantFactoryMethodSmooth:return po}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,i=0,n=t.length;i!==n;++i)t[i]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,i=0,n=t.length;i!==n;++i)t[i]*=e;return this},trim:function(t,i){for(var n=this.times,r=n.length,a=0,o=r-1;a!==r&&n[a]<t;)++a;for(;-1!==o&&n[o]>i;)--o;if(++o,0!==a||o!==r){a>=o&&(o=Math.max(o,1),a=o-1);var s=this.getValueSize();this.times=e.AnimationUtils.arraySlice(n,a,o),this.values=e.AnimationUtils.arraySlice(this.values,a*s,o*s)}return this},validate:function(){var t=!0,i=this.getValueSize();i-Math.floor(i)!==0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,r=this.values,a=n.length;0===a&&(console.error("track is empty",this),t=!1);for(var o=null,s=0;s!==a;s++){var c=n[s];if("number"==typeof c&&isNaN(c)){console.error("time is not a valid number",this,s,c),t=!1;break}if(null!==o&&o>c){console.error("out of order keys",this,s,c,o),t=!1;break}o=c}if(void 0!==r&&e.AnimationUtils.isTypedArray(r))for(var s=0,l=r.length;s!==l;++s){var h=r[s];if(isNaN(h)){console.error("value is not a valid number",this,s,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,i=this.values,n=this.getValueSize(),r=this.getInterpolation()===po,a=1,o=t.length-1,s=1;o>s;++s){var c=!1,l=t[s],h=t[s+1];if(l!==h&&(1!==s||l!==l[0]))if(r)c=!0;else for(var u=s*n,p=u-n,d=u+n,f=0;f!==n;++f){var m=i[u+f];if(m!==i[p+f]||m!==i[d+f]){c=!0;break}}if(c){if(s!==a){t[a]=t[s];for(var v=s*n,g=a*n,f=0;f!==n;++f)i[g+f]=i[v+f]}++a}}if(o>0){t[a]=t[o];for(var v=o*n,g=a*n,f=0;f!==n;++f)i[g+f]=i[v+f];++a}return a!==t.length&&(this.times=e.AnimationUtils.arraySlice(t,0,a),this.values=e.AnimationUtils.arraySlice(i,0,a*n)),this}},Ni.prototype=Object.assign(Object.create(kc),{constructor:Ni,ValueTypeName:"vector"}),Fi.prototype=Object.assign(Object.create(Pi.prototype),{constructor:Fi,interpolate_:function(e,t,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(i-t)/(n-t),h=s+o;s!==h;s+=4)c.slerpFlat(r,0,a,s-o,a,s,l);return r}}),zi.prototype=Object.assign(Object.create(kc),{constructor:zi,ValueTypeName:"quaternion",DefaultInterpolation:uo,InterpolantFactoryMethodLinear:function(e){return new Fi(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Bi.prototype=Object.assign(Object.create(kc),{constructor:Bi,ValueTypeName:"number"}),Hi.prototype=Object.assign(Object.create(kc),{constructor:Hi,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ho,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Gi.prototype=Object.assign(Object.create(kc),{constructor:Gi,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ho,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Vi.prototype=Object.assign(Object.create(kc),{constructor:Vi,ValueTypeName:"color"}),ki.prototype=kc,kc.constructor=ki,Object.assign(ki,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var i=ki._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],r=[];e.AnimationUtils.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==i.parse?i.parse(t):new i(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var i,n=t.constructor;if(void 0!==n.toJSON)i=n.toJSON(t);else{i={name:t.name,times:e.AnimationUtils.convertArray(t.times,Array),values:e.AnimationUtils.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(i.interpolation=r)}return i.type=t.ValueTypeName,i},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Bi;case"vector":case"vector2":case"vector3":case"vector4":return Ni;case"color":return Vi;case"quaternion":return zi;case"bool":case"boolean":return Gi;case"string":return Hi}throw new Error("Unsupported typeName: "+e)}}),ji.prototype={constructor:ji,resetDuration:function(){for(var e=this.tracks,t=0,i=0,n=e.length;i!==n;++i){var r=this.tracks[i];t=Math.max(t,r.times[r.times.length-1])}this.duration=t},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(ji,{parse:function(e){for(var t=[],i=e.tracks,n=1/(e.fps||1),r=0,a=i.length;r!==a;++r)t.push(ki.parse(i[r]).scale(n));return new ji(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t},r=0,a=i.length;r!==a;++r)t.push(ki.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,i,n,r){for(var a=i.length,o=[],s=0;a>s;s++){var c=[],l=[];c.push((s+a-1)%a,s,(s+1)%a),l.push(0,1,0);var h=e.AnimationUtils.getKeyframeOrder(c);c=e.AnimationUtils.sortedArray(c,1,h),l=e.AnimationUtils.sortedArray(l,1,h),
r||0!==c[0]||(c.push(a),l.push(l[0])),o.push(new Bi(".morphTargetInfluences["+i[s].name+"]",c,l).scale(1/n))}return new ji(t,-1,o)},findByName:function(e,t){var i=e;if(!Array.isArray(e)){var n=e;i=n.geometry&&n.geometry.animations||n.animations}for(var r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;o>a;a++){var s=e[a],c=s.name.match(r);if(c&&c.length>1){var l=c[1],h=n[l];h||(n[l]=h=[]),h.push(s)}}var u=[];for(var l in n)u.push(ji.CreateFromMorphTargetSequence(l,n[l],t,i));return u},parseAnimation:function(t,i){if(!t)return console.error("  no animation in JSONLoader data"),null;for(var n=function(t,i,n,r,a){if(0!==n.length){var o=[],s=[];e.AnimationUtils.flattenJSON(n,o,s,r),0!==o.length&&a.push(new t(i,o,s))}},r=[],a=t.name||"default",o=t.length||-1,s=t.fps||30,c=t.hierarchy||[],l=0;l<c.length;l++){var h=c[l].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},p=0;p<h.length;p++)if(h[p].morphTargets)for(var d=0;d<h[p].morphTargets.length;d++)u[h[p].morphTargets[d]]=-1;for(var f in u){for(var m=[],v=[],d=0;d!==h[p].morphTargets.length;++d){var g=h[p];m.push(g.time),v.push(g.morphTarget===f?1:0)}r.push(new Bi(".morphTargetInfluence["+f+"]",m,v))}o=u.length*(s||1)}else{var y=".bones["+i[l].name+"]";n(Ni,y+".position",h,"pos",r),n(zi,y+".quaternion",h,"rot",r),n(Ni,y+".scale",h,"scl",r)}}if(0===r.length)return null;var x=new ji(a,o,r);return x}}),Object.assign(Wi.prototype,{load:function(e,t,i,n){var r=this,a=new vi(r.manager);a.load(e,function(e){t(r.parse(JSON.parse(e)))},i,n)},setTextures:function(e){this.textures=e},parse:function(e){function t(e){return void 0===n[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),n[e]}var n=this.textures,r=new Gc[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.uniforms&&(r.uniforms=e.uniforms),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.shading&&(r.shading=e.shading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=t(e.map)),void 0!==e.alphaMap&&(r.alphaMap=t(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=t(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=t(e.normalMap)),void 0!==e.normalScale){var a=e.normalScale;Array.isArray(a)===!1&&(a=[a,a]),r.normalScale=(new i).fromArray(a)}if(void 0!==e.displacementMap&&(r.displacementMap=t(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=t(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=t(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=t(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=t(e.specularMap)),void 0!==e.envMap&&(r.envMap=t(e.envMap)),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=t(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=t(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var o=0,s=e.materials.length;s>o;o++)r.materials.push(this.parse(e.materials[o]));return r}}),Object.assign(Xi.prototype,{load:function(e,t,i,n){var r=this,a=new vi(r.manager);a.load(e,function(e){t(r.parse(JSON.parse(e)))},i,n)},parse:function(e){var t=new Le,i=e.data.index,n={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==i){var r=new n[i.type](i.array);t.setIndex(new me(r,1))}var a=e.data.attributes;for(var o in a){var s=a[o],r=new n[s.type](s.array);t.addAttribute(o,new me(r,s.itemSize,s.normalized))}var c=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==c)for(var h=0,u=c.length;h!==u;++h){var p=c[h];t.addGroup(p.start,p.count,p.materialIndex)}var d=e.data.boundingSphere;if(void 0!==d){var f=new l;void 0!==d.center&&f.fromArray(d.center),t.boundingSphere=new te(f,d.radius)}return t}}),Yi.prototype={constructor:Yi,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,i){for(var n=[],r=0;r<e.length;++r)n[r]=this.createMaterial(e[r],t,i);return n},createMaterial:function(){var t,i,n;return function(r,a,o){function s(t,n,r,s,l){var h,u=a+t,p=Yi.Handlers.get(u);null!==p?h=p.load(u):(i.setCrossOrigin(o),h=i.load(u)),void 0!==n&&(h.repeat.fromArray(n),1!==n[0]&&(h.wrapS=wa),1!==n[1]&&(h.wrapT=wa)),void 0!==r&&h.offset.fromArray(r),void 0!==s&&("repeat"===s[0]&&(h.wrapS=wa),"mirror"===s[0]&&(h.wrapS=Ea),"repeat"===s[1]&&(h.wrapT=wa),"mirror"===s[1]&&(h.wrapT=Ea)),void 0!==l&&(h.anisotropy=l);var d=e.Math.generateUUID();return c[d]=h,d}void 0===t&&(t=new X),void 0===i&&(i=new wi),void 0===n&&(n=new Wi);var c={},l={uuid:e.Math.generateUUID(),type:"MeshLambertMaterial"};for(var h in r){var u=r[h];switch(h){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":l.name=u;break;case"blending":l.blending=Ir[u];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",h,"is no longer supported.");break;case"colorDiffuse":l.color=t.fromArray(u).getHex();break;case"colorSpecular":l.specular=t.fromArray(u).getHex();break;case"colorEmissive":l.emissive=t.fromArray(u).getHex();break;case"specularCoef":l.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(l.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(l.type="MeshPhongMaterial"),"standard"===u.toLowerCase()&&(l.type="MeshStandardMaterial");break;case"mapDiffuse":l.map=s(u,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":l.emissiveMap=s(u,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":l.lightMap=s(u,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":l.aoMap=s(u,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":l.bumpMap=s(u,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":l.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":l.normalMap=s(u,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":l.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":l.specularMap=s(u,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":l.metalnessMap=s(u,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":l.roughnessMap=s(u,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":l.alphaMap=s(u,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":l.side=br;break;case"doubleSided":l.side=wr;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),l.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":l[h]=u;break;case"vertexColors":u===!0&&(l.vertexColors=Sr),"face"===u&&(l.vertexColors=Tr);break;default:console.error("THREE.Loader.createMaterial: Unsupported",h,u)}}return"MeshBasicMaterial"===l.type&&delete l.emissive,"MeshPhongMaterial"!==l.type&&delete l.specular,l.opacity<1&&(l.transparent=!0),n.setTextures(c),n.parse(l)}}()},Yi.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,i=0,n=t.length;n>i;i+=2){var r=t[i],a=t[i+1];if(r.test(e))return a}return null}},Object.assign(qi.prototype,{load:function(e,t,i,n){var r=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Yi.prototype.extractUrlBase(e),o=new vi(this.manager);o.setWithCredentials(this.withCredentials),o.load(e,function(i){var n=JSON.parse(i),o=n.metadata;if(void 0!==o){var s=o.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}}var c=r.parse(n,a);t(c.geometry,c.materials)},i,n)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function n(t){function n(e,t){return e&1<<t}var r,a,o,s,h,u,p,d,f,m,v,g,y,x,b,w,_,E,M,T,S,R,A,L,C,P,U,I=e.faces,O=e.vertices,D=e.normals,N=e.colors,F=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&F++;for(r=0;F>r;r++)c.faceVertexUvs[r]=[]}for(s=0,h=O.length;h>s;)E=new l,E.x=O[s++]*t,E.y=O[s++]*t,E.z=O[s++]*t,c.vertices.push(E);for(s=0,h=I.length;h>s;)if(m=I[s++],v=n(m,0),g=n(m,1),y=n(m,3),x=n(m,4),b=n(m,5),w=n(m,6),_=n(m,7),v){if(T=new de,T.a=I[s],T.b=I[s+1],T.c=I[s+3],S=new de,S.a=I[s+1],S.b=I[s+2],S.c=I[s+3],s+=4,g&&(f=I[s++],T.materialIndex=f,S.materialIndex=f),o=c.faces.length,y)for(r=0;F>r;r++)for(L=e.uvs[r],c.faceVertexUvs[r][o]=[],c.faceVertexUvs[r][o+1]=[],a=0;4>a;a++)d=I[s++],P=L[2*d],U=L[2*d+1],C=new i(P,U),2!==a&&c.faceVertexUvs[r][o].push(C),0!==a&&c.faceVertexUvs[r][o+1].push(C);if(x&&(p=3*I[s++],T.normal.set(D[p++],D[p++],D[p]),S.normal.copy(T.normal)),b)for(r=0;4>r;r++)p=3*I[s++],A=new l(D[p++],D[p++],D[p]),2!==r&&T.vertexNormals.push(A),0!==r&&S.vertexNormals.push(A);if(w&&(u=I[s++],R=N[u],T.color.setHex(R),S.color.setHex(R)),_)for(r=0;4>r;r++)u=I[s++],R=N[u],2!==r&&T.vertexColors.push(new X(R)),0!==r&&S.vertexColors.push(new X(R));c.faces.push(T),c.faces.push(S)}else{if(M=new de,M.a=I[s++],M.b=I[s++],M.c=I[s++],g&&(f=I[s++],M.materialIndex=f),o=c.faces.length,y)for(r=0;F>r;r++)for(L=e.uvs[r],c.faceVertexUvs[r][o]=[],a=0;3>a;a++)d=I[s++],P=L[2*d],U=L[2*d+1],C=new i(P,U),c.faceVertexUvs[r][o].push(C);if(x&&(p=3*I[s++],M.normal.set(D[p++],D[p++],D[p])),b)for(r=0;3>r;r++)p=3*I[s++],A=new l(D[p++],D[p++],D[p]),M.vertexNormals.push(A);if(w&&(u=I[s++],M.color.setHex(N[u])),_)for(r=0;3>r;r++)u=I[s++],M.vertexColors.push(new X(N[u]));c.faces.push(M)}}function r(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;n>i;i+=t){var r=e.skinWeights[i],o=t>1?e.skinWeights[i+1]:0,s=t>2?e.skinWeights[i+2]:0,l=t>3?e.skinWeights[i+3]:0;c.skinWeights.push(new a(r,o,s,l))}if(e.skinIndices)for(var i=0,n=e.skinIndices.length;n>i;i+=t){var h=e.skinIndices[i],u=t>1?e.skinIndices[i+1]:0,p=t>2?e.skinIndices[i+2]:0,d=t>3?e.skinIndices[i+3]:0;c.skinIndices.push(new a(h,u,p,d))}c.bones=e.bones,c.bones&&c.bones.length>0&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&console.warn("When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.")}function o(t){if(void 0!==e.morphTargets)for(var i=0,n=e.morphTargets.length;n>i;i++){c.morphTargets[i]={},c.morphTargets[i].name=e.morphTargets[i].name,c.morphTargets[i].vertices=[];for(var r=c.morphTargets[i].vertices,a=e.morphTargets[i].vertices,o=0,s=a.length;s>o;o+=3){var h=new l;h.x=a[o]*t,h.y=a[o+1]*t,h.z=a[o+2]*t,r.push(h)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=c.faces,p=e.morphColors[0].colors,i=0,n=u.length;n>i;i++)u[i].color.fromArray(p,3*i)}}function s(){var t=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var n=0;n<i.length;n++){var r=ji.parseAnimation(i[n],c.bones);r&&t.push(r)}if(c.morphTargets){var a=ji.CreateClipsFromMorphTargetSequences(c.morphTargets,10);t=t.concat(a)}t.length>0&&(c.animations=t)}var c=new Se,h=void 0!==e.scale?1/e.scale:1;if(n(h),r(),o(h),s(),c.computeFaceNormals(),c.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:c};var u=Yi.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:c,materials:u}}}),Object.assign(Zi.prototype,{load:function(e,t,i,n){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this,a=new vi(r.manager);a.load(e,function(e){r.parse(JSON.parse(e),t)},i,n)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseGeometries(e.geometries),n=this.parseImages(e.images,function(){void 0!==t&&t(o)}),r=this.parseTextures(e.textures,n),a=this.parseMaterials(e.materials,r),o=this.parseObject(e.object,i,a);return e.animations&&(o.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(o),o},parseGeometries:function(e){var t={};if(void 0!==e)for(var i=new qi,n=new Xi,r=0,a=e.length;a>r;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Hc[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Hc[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Hc[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Hc[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 Hc[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Hc[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 Hc[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Hc[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Hc[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Hc[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Hc[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":o=i.parse(s.data,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),t[s.uuid]=o}return t},parseMaterials:function(e,t){var i={};if(void 0!==e){var n=new Wi;n.setTextures(t);for(var r=0,a=e.length;a>r;r++){var o=n.parse(e[r]);i[o.uuid]=o}}return i},parseAnimations:function(e){for(var t=[],i=0;i<e.length;i++){var n=ji.parse(e[i]);t.push(n)}return t},parseImages:function(e,t){function i(e){return n.manager.itemStart(e),o.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e)})}var n=this,r={};if(void 0!==e&&e.length>0){var a=new mi(t),o=new xi(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;c>s;s++){var l=e[s],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.texturePath+l.url;r[l.uuid]=i(h)}}return r},parseTextures:function(e,t){function i(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var a=0,o=e.length;o>a;a++){var s=e[a];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new n(t[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=i(s.mapping,ba)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=i(s.wrap[0],Ma),c.wrapT=i(s.wrap[1],Ma)),void 0!==s.minFilter&&(c.minFilter=i(s.minFilter,Pa)),void 0!==s.magFilter&&(c.magFilter=i(s.magFilter,Pa)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),r[s.uuid]=c}return r},parseObject:function(){var e=new h;return function(t,i,n){function r(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),i[e]}function a(e){return void 0!==e?(void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]):void 0}var o;switch(t.type){case"Scene":o=new ut,void 0!==t.background&&Number.isInteger(t.background)&&(o.background=new X(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?o.fog=new ht(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(o.fog=new lt(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":o=new Oe(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(o.focus=t.focus),void 0!==t.zoom&&(o.zoom=t.zoom),void 0!==t.filmGauge&&(o.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(o.filmOffset=t.filmOffset),void 0!==t.view&&(o.view=Object.assign({},t.view));break;case"OrthographicCamera":o=new De(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":o=new Ci(t.color,t.intensity);break;case"DirectionalLight":o=new Li(t.color,t.intensity);break;case"PointLight":o=new Ri(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":o=new Si(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":o=new Ei(t.color,t.groundColor,t.intensity);break;case"Mesh":var s=r(t.geometry),c=a(t.material);o=s.bones&&s.bones.length>0?new xt(s,c):new Ce(s,c);break;case"LOD":o=new mt;break;case"Line":o=new wt(r(t.geometry),a(t.material),t.mode);break;case"LineSegments":o=new _t(r(t.geometry),a(t.material));break;case"PointCloud":case"Points":o=new Mt(r(t.geometry),a(t.material));break;case"Sprite":o=new ft(a(t.material));break;case"Group":o=new Tt;break;default:o=new le}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.quaternion&&o.quaternion.fromArray(t.quaternion),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.castShadow&&(o.castShadow=t.castShadow),void 0!==t.receiveShadow&&(o.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(o.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(o.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&o.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(o.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children)for(var l in t.children)o.add(this.parseObject(t.children[l],i,n));if("LOD"===t.type)for(var h=t.levels,u=0;u<h.length;u++){var p=h[u],l=o.getObjectByProperty("uuid",p.object);void 0!==l&&o.addLevel(l,p.distance)}return o}}()}),Ji.prototype={constructor:Ji,getPoint:function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},getPoints:function(e){e||(e=5);for(var t=[],i=0;e>=i;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){e||(e=5);for(var t=[],i=0;e>=i;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;e>=i;i++)t=this.getPoint(i/e),a+=t.distanceTo(r),n.push(a),r=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,n=this.getLengths(),r=0,a=n.length;i=t?t:e*n[a-1];for(var o,s=0,c=a-1;c>=s;)if(r=Math.floor(s+(c-s)/2),o=n[r]-i,0>o)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(r=c,n[r]===i){var l=r/(a-1);return l}var h=n[r],u=n[r+1],p=u-h,d=(i-h)/p,l=(r+d)/(a-1);return l},getTangent:function(e){var t=1e-4,i=e-t,n=e+t;0>i&&(i=0),n>1&&(n=1);var r=this.getPoint(i),a=this.getPoint(n),o=a.clone().sub(r);return o.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)}},Ji.create=function(e,t){return e.prototype=Object.create(Ji.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Qi.prototype=Object.create(Ji.prototype),Qi.prototype.constructor=Qi,Qi.prototype.isLineCurve=!0,Qi.prototype.getPoint=function(e){if(1===e)return this.v2.clone();var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},Qi.prototype.getPointAt=function(e){return this.getPoint(e)},Qi.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},Ki.prototype=Object.assign(Object.create(Ji.prototype),{constructor:Ki,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Qi(t,e))},getPoint:function(e){for(var t=e*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=t){var r=i[n]-t,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,n=this.curves.length;n>i;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e||(e=40);for(var t=[],i=0;e>=i;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*e:a&&a.isLineCurve?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(i.push(l),t=l)}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(e){var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){for(var t=new Se,i=0,n=e.length;n>i;i++){var r=e[i];t.vertices.push(new l(r.x,r.y,r.z||0))}return t}}),$i.prototype=Object.create(Ji.prototype),$i.prototype.constructor=$i,$i.prototype.isEllipseCurve=!0,$i.prototype.getPoint=function(e){for(var t=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;0>n;)n+=t;for(;n>t;)n-=t;n<Number.EPSILON&&(n=r?0:t),this.aClockwise!==!0||r||(n===t?n=-t:n-=t);var a=this.aStartAngle+e*n,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),l=Math.sin(this.aRotation),h=o-this.aX,u=s-this.aY;o=h*c-u*l+this.aX,s=h*l+u*c+this.aY}return new i(o,s)},e.CurveUtils={tangentQuadraticBezier:function(e,t,i,n){return 2*(1-e)*(i-t)+2*e*(n-i)},tangentCubicBezier:function(e,t,i,n,r){return-3*t*(1-e)*(1-e)+3*i*(1-e)*(1-e)-6*e*i*(1-e)+6*e*n*(1-e)-3*e*e*n+3*e*e*r},tangentSpline:function(e,t,i,n,r){var a=6*e*e-6*e,o=3*e*e-4*e+1,s=-6*e*e+6*e,c=3*e*e-2*e;return a+o+s+c},interpolate:function(e,t,i,n,r){var a=.5*(i-e),o=.5*(n-t),s=r*r,c=r*s;return(2*t-2*i+a+o)*c+(-3*t+3*i-2*a-o)*s+a*r+t}},en.prototype=Object.create(Ji.prototype),en.prototype.constructor=en,en.prototype.isSplineCurve=!0,en.prototype.getPoint=function(t){var n=this.points,r=(n.length-1)*t,a=Math.floor(r),o=r-a,s=n[0===a?a:a-1],c=n[a],l=n[a>n.length-2?n.length-1:a+1],h=n[a>n.length-3?n.length-1:a+2],u=e.CurveUtils.interpolate;return new i(u(s.x,c.x,l.x,h.x,o),u(s.y,c.y,l.y,h.y,o))},tn.prototype=Object.create(Ji.prototype),tn.prototype.constructor=tn,tn.prototype.getPoint=function(t){var n=e.ShapeUtils.b3;return new i(n(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},tn.prototype.getTangent=function(t){var n=e.CurveUtils.tangentCubicBezier;return new i(n(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},nn.prototype=Object.create(Ji.prototype),nn.prototype.constructor=nn,nn.prototype.getPoint=function(t){var n=e.ShapeUtils.b2;return new i(n(t,this.v0.x,this.v1.x,this.v2.x),n(t,this.v0.y,this.v1.y,this.v2.y))},nn.prototype.getTangent=function(t){var n=e.CurveUtils.tangentQuadraticBezier;return new i(n(t,this.v0.x,this.v1.x,this.v2.x),n(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var jc=Object.assign(Object.create(Ki.prototype),{fromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,i=e.length;i>t;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new Qi(this.currentPoint.clone(),new i(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,r){var a=new nn(this.currentPoint.clone(),new i(e,t),new i(n,r));this.curves.push(a),this.currentPoint.set(n,r)},bezierCurveTo:function(e,t,n,r,a,o){var s=new tn(this.currentPoint.clone(),new i(e,t),new i(n,r),new i(a,o));this.curves.push(s),this.currentPoint.set(a,o)},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e),i=new en(t);this.curves.push(i),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,i,n,r,a)},absarc:function(e,t,i,n,r,a){this.absellipse(e,t,i,i,n,r,a)},ellipse:function(e,t,i,n,r,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(e+c,t+l,i,n,r,a,o,s)},absellipse:function(e,t,i,n,r,a,o,s){var c=new $i(e,t,i,n,r,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});rn.prototype=Object.assign(Object.create(jc),{constructor:rn,getPointsHoles:function(e){for(var t=[],i=0,n=this.holes.length;n>i;i++)t[i]=this.holes[i].getPoints(e);return t},extractAllPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},extractPoints:function(e){return this.extractAllPoints(e)}}),an.prototype=jc,jc.constructor=an,on.prototype={moveTo:function(e,t){this.currentPath=new an,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,i,n){this.currentPath.quadraticCurveTo(e,t,i,n)},bezierCurveTo:function(e,t,i,n,r,a){this.currentPath.bezierCurveTo(e,t,i,n,r,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(t,i){function n(e){for(var t=[],i=0,n=e.length;n>i;i++){var r=e[i],a=new rn;a.curves=r.curves,t.push(a)}return t}function r(e,t){for(var i=t.length,n=!1,r=i-1,a=0;i>a;r=a++){var o=t[r],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(0>l&&(o=t[a],c=-c,s=t[r],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=l*(e.x-o.x)-c*(e.y-o.y);if(0===h)return!0;if(0>h)continue;n=!n}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return n}var a=e.ShapeUtils.isClockWise,o=this.subPaths;if(0===o.length)return[];if(i===!0)return n(o);var s,c,l,h=[];if(1===o.length)return c=o[0],l=new rn,l.curves=c.curves,h.push(l),h;var u=!a(o[0].getPoints());u=t?!u:u;var p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;y>g;g++)c=o[g],p=c.getPoints(),s=a(p),s=t?!s:s,s?(!u&&f[v]&&v++,f[v]={s:new rn,p:p},f[v].s.curves=c.curves,u&&v++,m[v]=[]):m[v].push({h:c,p:p[0]});if(!f[0])return n(o);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;_>w;w++)d[w]=[];for(var w=0,_=f.length;_>w;w++)for(var E=m[w],M=0;M<E.length;M++){for(var T=E[M],S=!0,R=0;R<f.length;R++)r(T.p,f[R].p)&&(w!==R&&b.push({froms:w,tos:R,hole:M}),S?(S=!1,d[R].push(T)):x=!0);S&&d[w].push(T)}b.length>0&&(x||(m=d))}for(var A,g=0,L=f.length;L>g;g++){l=f[g].s,h.push(l),A=m[g];for(var C=0,P=A.length;P>C;C++)l.holes.push(A[C].h)}return h}},Object.assign(sn.prototype,{isFont:!0,generateShapes:function(t,i,n){function r(e){for(var t=String(e).split(""),n=i/o.resolution,r=0,s=[],c=0;c<t.length;c++){var l=a(t[c],n,r);r+=l.offset,s.push(l.path)}return s}function a(t,i,r){var a=o.glyphs[t]||o.glyphs["?"];if(a){var s,c,l,h,u,p,d,f,m,v,g,y=new on,x=[],b=e.ShapeUtils.b2,w=e.ShapeUtils.b3;if(a.o)for(var _=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),E=0,M=_.length;M>E;){var T=_[E++];switch(T){case"m":s=_[E++]*i+r,c=_[E++]*i,y.moveTo(s,c);break;case"l":s=_[E++]*i+r,c=_[E++]*i,y.lineTo(s,c);break;case"q":if(l=_[E++]*i+r,h=_[E++]*i,d=_[E++]*i+r,f=_[E++]*i,y.quadraticCurveTo(d,f,l,h),g=x[x.length-1]){u=g.x,p=g.y;for(var S=1;n>=S;S++){var R=S/n;b(R,u,d,l),b(R,p,f,h)}}break;case"b":if(l=_[E++]*i+r,h=_[E++]*i,d=_[E++]*i+r,f=_[E++]*i,m=_[E++]*i+r,v=_[E++]*i,y.bezierCurveTo(d,f,m,v,l,h),g=x[x.length-1]){u=g.x,p=g.y;for(var S=1;n>=S;S++){var R=S/n;w(R,u,d,m,l),w(R,p,f,v,h)}}}}return{offset:a.ha*i,path:y}}}void 0===i&&(i=100),void 0===n&&(n=4);for(var o=this.data,s=r(t),c=[],l=0,h=s.length;h>l;l++)Array.prototype.push.apply(c,s[l].toShapes());return c}}),Object.assign(cn.prototype,{load:function(e,t,i,n){var r=this,a=new vi(this.manager);a.load(e,function(e){var i;try{i=JSON.parse(e)}catch(n){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),
i=JSON.parse(e.substring(65,e.length-2))}var a=r.parse(i);t&&t(a)},i,n)},parse:function(e){return new sn(e)}});var Wc;Object.assign(hn.prototype,{load:function(e,t,i,n){var r=new vi(this.manager);r.setResponseType("arraybuffer"),r.load(e,function(e){var i=ln();i.decodeAudioData(e,function(e){t(e)})},i,n)}}),Object.assign(un.prototype,{update:function(){var t,i,n,r,a,o,s,c=new h,l=new h;return function(h){var u=t!==this||i!==h.focus||n!==h.fov||r!==h.aspect*this.aspect||a!==h.near||o!==h.far||s!==h.zoom;if(u){t=this,i=h.focus,n=h.fov,r=h.aspect*this.aspect,a=h.near,o=h.far,s=h.zoom;var p,d,f=h.projectionMatrix.clone(),m=this.eyeSep/2,v=m*a/i,g=a*Math.tan(e.Math.DEG2RAD*n*.5)/s;l.elements[12]=-m,c.elements[12]=m,p=-g*r+v,d=g*r+v,f.elements[0]=2*a/(d-p),f.elements[8]=(d+p)/(d-p),this.cameraL.projectionMatrix.copy(f),p=-g*r-v,d=g*r-v,f.elements[0]=2*a/(d-p),f.elements[8]=(d+p)/(d-p),this.cameraR.projectionMatrix.copy(f)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(l),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(c)}}()}),pn.prototype=Object.create(le.prototype),pn.prototype.constructor=pn,dn.prototype=Object.assign(Object.create(le.prototype),{constructor:dn,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(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.value=e},updateMatrixWorld:function(){var e=new l,t=new c,i=new l,n=new l;return function(r){le.prototype.updateMatrixWorld.call(this,r);var a=this.context.listener,o=this.up;this.matrixWorld.decompose(e,t,i),n.set(0,0,-1).applyQuaternion(t),a.setPosition(e.x,e.y,e.z),a.setOrientation(n.x,n.y,n.z,o.x,o.y,o.z)}}()}),fn.prototype=Object.assign(Object.create(le.prototype),{constructor:fn,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setBuffer:function(e){return this.source.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");var e=this.context.createBufferSource();return e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()},pause:function(){return this.hasPlaybackControl===!1?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 this.hasPlaybackControl===!1?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 e=1,t=this.filters.length;t>e;e++)this.filters[e-1].connect(this.filters[e]);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 e=1,t=this.filters.length;t>e;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},setLoop:function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=e)},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.value=e,this}}),mn.prototype=Object.assign(Object.create(fn.prototype),{constructor:mn,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){this.panner.refDistance=e},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e},updateMatrixWorld:function(){var e=new l;return function(t){le.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}()}),Object.assign(vn.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),i=0;i<t.length;i++)e+=t[i];return e/t.length}}),gn.prototype={constructor:gn,accumulate:function(e,t){var i=this.buffer,n=this.valueSize,r=e*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,i=this.buffer,n=e*t+t,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,1>r){var o=3*t;this._mixBufferRegion(i,n,o,1-r,t)}for(var s=t,c=t+t;s!==c;++s)if(i[s]!==i[s+t]){a.setValue(i,n);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,i=this.valueSize,n=3*i;e.getValue(t,n);for(var r=i,a=n;r!==a;++r)t[r]=t[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,i,n,r){if(n>=.5)for(var a=0;a!==r;++a)e[t+a]=e[i+a]},_slerp:function(e,t,i,n,r){c.slerpFlat(e,t,e,t,e,i,n)},_lerp:function(e,t,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[i+o]*n}}},yn.prototype={constructor:yn,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=yn.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("  trying to update node for track: "+this.path+" but it wasn't found.");if(i){var a=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("  can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[i])return void console.error("  can not bind to objectName of node, undefined",this);e=e[i]}if(void 0!==a){if(void 0===e[a])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[a]}}var s=e[n];if(void 0===s){var c=t.nodeName;return void console.error("  trying to update property for track: "+c+"."+n+" but it wasn't found.",e)}var l=this.Versioning.None;void 0!==e.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var h=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.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(e.geometry.morphTargets[o].name===r){r=o;break}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):void 0!==s.length?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(yn.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:yn.prototype.getValue,_setValue_unbound:yn.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)e[t++]=i[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++]},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),yn.Composite=function(e,t,i){var n=i||yn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)},yn.Composite.prototype={constructor:yn.Composite,getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},yn.create=function(e,t,i){return e&&e.isAnimationObjectGroup?new yn.Composite(e,t,i):new yn(e,t,i)},yn.parseTrackName=function(e){var t=/^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/,i=t.exec(e);if(!i)throw new Error("cannot parse trackName at all: "+e);var n={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]};if(null===n.propertyName||0===n.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return n},yn.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=function(e){for(var i=0;i<e.bones.length;i++){var n=e.bones[i];if(n.name===t)return n}return null},n=i(e.skeleton);if(n)return n}if(e.children){var r=function(e){for(var i=0;i<e.length;i++){var n=e[i];if(n.name===t||n.uuid===t)return n;var a=r(n.children);if(a)return a}return null},a=r(e.children);if(a)return a}return null},xn.prototype={constructor:xn,isAnimationObjectGroup:!0,add:function(e){for(var t=this._objects,i=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,l=0,h=arguments.length;l!==h;++l){var u=arguments[l],p=u.uuid,d=r[p];if(void 0===d){d=i++,r[p]=d,t.push(u);for(var f=0,m=c;f!==m;++f)s[f].push(new yn(u,a[f],o[f]))}else if(n>d){var v=t[d],g=--n,y=t[g];r[y.uuid]=d,t[d]=y,r[p]=g,t[g]=u;for(var f=0,m=c;f!==m;++f){var x=s[f],b=x[g],w=x[d];x[d]=b,void 0===w&&(w=new yn(u,a[f],o[f])),x[g]=w}}else t[d]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=n},remove:function(e){for(var t=this._objects,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,h=n[l];if(void 0!==h&&h>=i){var u=i++,p=t[u];n[p.uuid]=h,t[h]=p,n[l]=u,t[u]=c;for(var d=0,f=a;d!==f;++d){var m=r[d],v=m[u],g=m[h];m[h]=v,m[u]=g}}}this.nCachedObjects_=i},uncache:function(e){for(var t=this._objects,i=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var l=arguments[s],h=l.uuid,u=r[h];if(void 0!==u)if(delete r[h],n>u){var p=--n,d=t[p],f=--i,m=t[f];r[d.uuid]=u,t[u]=d,r[m.uuid]=p,t[p]=m,t.pop();for(var v=0,g=o;v!==g;++v){var y=a[v],x=y[p],b=y[f];y[u]=x,y[p]=b,y.pop()}}else{var f=--i,m=t[f];r[m.uuid]=u,t[u]=m,t.pop();for(var v=0,g=o;v!==g;++v){var y=a[v];y[u]=y[f],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var i=this._bindingsIndicesByPath,n=i[e],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);n=r.length,i[e]=n,a.push(e),o.push(t),r.push(h);for(var u=l,p=s.length;u!==p;++u){var d=s[u];h[u]=new yn(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,i=t[e];if(void 0!==i){var n=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=i,a[i]=s,a.pop(),r[i]=r[o],r.pop(),n[i]=n[o],n.pop()}}},bn.prototype={constructor:bn,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(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){var n=this._clip.duration,r=e._clip.duration,a=r/n,o=n/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,i){return e.crossFadeFrom(this,t,i)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,i){var n=this._mixer,r=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]=r,s[1]=r+i,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,i,n){var r=this._startTime;if(null!==r){var a=(e-r)*i;if(0>a||0===i)return;this._startTime=null,t=i*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(n,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i){var n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(n===so){-1===r&&(this.loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(0>t))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1})}}else{var a=n===lo;if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=i||0>t){var o=Math.floor(t/i);t-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(0>s)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=0>e;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1===(1&r))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var n=this._interpolantSettings;i?(n.endingStart=mo,n.endingEnd=mo):(e?n.endingStart=this.zeroSlopeAtStart?mo:fo:n.endingStart=vo,t?n.endingEnd=this.zeroSlopeAtEnd?mo:fo:n.endingEnd=vo)},_scheduleFading:function(e,t,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=i,this}},Object.assign(wn.prototype,t.prototype,{clipAction:function(e,t){var i=t||this._root,n=i.uuid,r="string"==typeof e?ji.findByName(i,e):e,a=null!==r?r.uuid:e,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===r&&(r=s._clip)}if(null===r)return null;var l=new bn(this,r,t);return this._bindAction(l,s),this._addInactiveAction(l,a,n),l},existingAction:function(e,t){var i=t||this._root,n=i.uuid,r="string"==typeof e?ji.findByName(i,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o?o.actionByRoot[n]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(var r=0;r!==n;++r)i[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,i=this._nActiveActions,n=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==i;++o){var s=t[o];s.enabled&&s._update(n,e,r,a)}for(var c=this._bindings,l=this._nActiveBindings,o=0;o!==l;++o)c[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,i=e.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=l,t[l]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(e){var t=e.uuid,i=this._actionsByClip;for(var n in i){var r=i[n].actionByRoot,a=r[t];void 0!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[t];if(void 0!==s)for(var c in s){var l=s[c];l.restoreOriginalState(),this._removeInactiveBinding(l)}},uncacheAction:function(e,t){var i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),Object.assign(wn.prototype,{_bindAction:function(e,t){var i=e._localRoot||this._root,n=e._clip.tracks,r=n.length,a=e._propertyBindings,o=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==r;++h){var u=n[h],p=u.name,d=l[p];if(void 0!==d)a[h]=d;else{if(d=a[h],void 0!==d){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;d=new gn(yn.create(i,p,f),u.ValueTypeName,u.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,n=this._actionsByClip[i];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,i,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,n=t.length;i!==n;++i){var r=t[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,i){var n=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=n.length,n.push(e),a.actionByRoot[i]=e},_removeInactiveAction:function(e){var t=this._actions,i=t[t.length-1],n=e._cacheIndex;i._cacheIndex=n,t[n]=i,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var h=o.actionByRoot,u=(t._localRoot||this._root).uuid;delete h[u],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,i=0,n=t.length;i!==n;++i){var r=t[i];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_takeBackAction:function(e){var t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_addInactiveBinding:function(e,t,i){var n=this._bindingsByRootAndName,r=n[t],a=this._bindings;void 0===r&&(r={},n[t]=r),r[i]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,i=e.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[r];e:{for(var l in o)break e;delete a[n]}},_lendBinding:function(e){var t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_takeBackBinding:function(e){var t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&(i=new Ii(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=t,e[t]=i),i},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,i=e.__cacheIndex,n=--this._nActiveControlInterpolants,r=t[n];e.__cacheIndex=n,t[n]=e,r.__cacheIndex=i,t[i]=r},_controlInterpolantsResultBuffer:new Float32Array(1)}),_n.prototype={constructor:_n,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},En.prototype=Object.create(Le.prototype),En.prototype.constructor=En,En.prototype.isInstancedBufferGeometry=!0,En.prototype.addGroup=function(e,t,i){this.groups.push({start:e,count:t,instances:i})},En.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var i=e.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}for(var a=e.groups,o=0,s=a.length;s>o;o++){var c=a[o];this.addGroup(c.start,c.count,c.instances)}return this},Mn.prototype={constructor:Mn,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this},setXYZ:function(e,t,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this},setXYZW:function(e,t,i,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this.data.array[e+3]=r,this}},Tn.prototype={constructor:Tn,isInterleavedBuffer:!0,set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,i){e*=this.stride,i*=t.stride;for(var n=0,r=this.stride;r>n;n++)this.array[e+n]=t.array[i+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},Sn.prototype=Object.create(Tn.prototype),Sn.prototype.constructor=Sn,Sn.prototype.isInstancedInterleavedBuffer=!0,Sn.prototype.copy=function(e){return Tn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},Rn.prototype=Object.create(me.prototype),Rn.prototype.constructor=Rn,Rn.prototype.isInstancedBufferAttribute=!0,Rn.prototype.copy=function(e){return me.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},An.prototype={constructor:An,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t){var i=[];return Cn(e,this,i,t),i.sort(Ln),i},intersectObjects:function(e,t){var i=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var n=0,r=e.length;r>n;n++)Cn(e[n],this,i,t);return i.sort(Ln),i}},Pn.prototype={constructor:Pn,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=(performance||Date).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}},In.prototype={constructor:In,set:function(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius.copy(e.radius),this.phi.copy(e.phi),this.theta.copy(e.theta),this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,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(e.Math.clamp(t.y/this.radius,-1,1))),this}},On.prototype=Object.create(Ce.prototype),On.prototype.constructor=On,On.prototype.createAnimation=function(e,t,i,n){var r={start:t,end:i,length:i-t+1,fps:n,duration:(i-t)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=r,this.animationsList.push(r)},On.prototype.autoCreateAnimations=function(e){for(var t,i=/([a-z]+)_?(\d+)/i,n={},r=this.geometry,a=0,o=r.morphTargets.length;o>a;a++){var s=r.morphTargets[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1];n[l]||(n[l]={start:1/0,end:-(1/0)});var h=n[l];a<h.start&&(h.start=a),a>h.end&&(h.end=a),t||(t=l)}}for(var l in n){var h=n[l];this.createAnimation(l,h.start,h.end,e)}this.firstAnimation=t},On.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},On.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},On.prototype.setAnimationFPS=function(e,t){var i=this.animationsMap[e];i&&(i.fps=t,i.duration=(i.end-i.start)/i.fps)},On.prototype.setAnimationDuration=function(e,t){var i=this.animationsMap[e];i&&(i.duration=t,i.fps=(i.end-i.start)/i.duration)},On.prototype.setAnimationWeight=function(e,t){var i=this.animationsMap[e];i&&(i.weight=t)},On.prototype.setAnimationTime=function(e,t){var i=this.animationsMap[e];i&&(i.time=t)},On.prototype.getAnimationTime=function(e){var t=0,i=this.animationsMap[e];return i&&(t=i.time),t},On.prototype.getAnimationDuration=function(e){var t=-1,i=this.animationsMap[e];return i&&(t=i.duration),t},On.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},On.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},On.prototype.update=function(t){for(var i=0,n=this.animationsList.length;n>i;i++){
var r=this.animationsList[i];if(r.active){var a=r.duration/r.length;r.time+=r.direction*t,r.mirroredLoop?(r.time>r.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var o=r.start+e.Math.clamp(Math.floor(r.time/a),0,r.length-1),s=r.weight;o!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[o]=0,r.lastFrame=r.currentFrame,r.currentFrame=o);var c=r.time%a/a;r.directionBackwards&&(c=1-c),r.currentFrame!==r.lastFrame?(this.morphTargetInfluences[r.currentFrame]=c*s,this.morphTargetInfluences[r.lastFrame]=(1-c)*s):this.morphTargetInfluences[r.currentFrame]=s}}},Dn.prototype=Object.create(le.prototype),Dn.prototype.constructor=Dn,Dn.prototype.isImmediateRenderObject=!0,Nn.prototype=Object.create(_t.prototype),Nn.prototype.constructor=Nn,Nn.prototype.update=function(){var e=new l,t=new l,i=new ie;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,l=0,h=0,u=c.length;u>h;h++)for(var p=c[h],d=0,f=p.vertexNormals.length;f>d;d++){var m=s[p[n[d]]],v=p.vertexNormals[d];e.copy(m).applyMatrix4(r),t.copy(v).applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1}else if(o&&o.isBufferGeometry)for(var g=o.attributes.position,y=o.attributes.normal,l=0,d=0,f=g.count;f>d;d++)e.set(g.getX(d),g.getY(d),g.getZ(d)).applyMatrix4(r),t.set(y.getX(d),y.getY(d),y.getZ(d)),t.applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1;return a.needsUpdate=!0,this}}(),Fn.prototype=Object.create(le.prototype),Fn.prototype.constructor=Fn,Fn.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Fn.prototype.update=function(){var e=new l,t=new l;return function(){var i=this.light.distance?this.light.distance:1e3,n=i*Math.tan(this.light.angle);this.cone.scale.set(n,n,i),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),zn.prototype=Object.create(_t.prototype),zn.prototype.constructor=zn,zn.prototype.getBoneList=function(e){var t=[];e&&e.isBone&&t.push(e);for(var i=0;i<e.children.length;i++)t.push.apply(t,this.getBoneList(e.children[i]));return t},zn.prototype.update=function(){for(var e=this.geometry,t=(new h).getInverse(this.root.matrixWorld),i=new h,n=0,r=0;r<this.bones.length;r++){var a=this.bones[r];a.parent&&a.parent.isBone&&(i.multiplyMatrices(t,a.matrixWorld),e.vertices[n].setFromMatrixPosition(i),i.multiplyMatrices(t,a.parent.matrixWorld),e.vertices[n+1].setFromMatrixPosition(i),n+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},Bn.prototype=Object.create(Ce.prototype),Bn.prototype.constructor=Bn,Bn.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Bn.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},Hn.prototype=Object.create(le.prototype),Hn.prototype.constructor=Hn,Hn.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},Hn.prototype.update=function(){var e=new l;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),Gn.prototype=Object.create(_t.prototype),Gn.prototype.constructor=Gn,Gn.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Vn.prototype=Object.create(_t.prototype),Vn.prototype.constructor=Vn,Vn.prototype.update=function(){var e=new l,t=new l,i=new ie;return function(){this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,l=0,h=s.length;h>l;l++){var u=s[l],p=u.normal;e.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(n),t.copy(p).applyMatrix3(i).normalize().multiplyScalar(this.size).add(e),r.setXYZ(c,e.x,e.y,e.z),c+=1,r.setXYZ(c,t.x,t.y,t.z),c+=1}return r.needsUpdate=!0,this}}(),kn.prototype=Object.create(le.prototype),kn.prototype.constructor=kn,kn.prototype.dispose=function(){var e=this.children[0],t=this.children[1];e.geometry.dispose(),e.material.dispose(),t.geometry.dispose(),t.material.dispose()},kn.prototype.update=function(){var e=new l,t=new l,i=new l;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),i.subVectors(t,e);var n=this.children[0],r=this.children[1];n.lookAt(i),n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.lookAt(i),r.scale.z=i.length()}}(),jn.prototype=Object.create(_t.prototype),jn.prototype.constructor=jn,jn.prototype.update=function(){function e(e,a,o,s){n.set(a,o,s).unproject(r);var c=i[e];if(void 0!==c)for(var l=0,h=c.length;h>l;l++)t.vertices[c[l]].copy(n)}var t,i,n=new l,r=new Ie;return function(){t=this.geometry,i=this.pointMap;var n=1,a=1;r.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-n,-a,-1),e("n2",n,-a,-1),e("n3",-n,a,-1),e("n4",n,a,-1),e("f1",-n,-a,1),e("f2",n,-a,1),e("f3",-n,a,1),e("f4",n,a,1),e("u1",.7*n,1.1*a,-1),e("u2",.7*-n,1.1*a,-1),e("u3",0,2*a,-1),e("cf1",-n,0,1),e("cf2",n,0,1),e("cf3",0,-a,1),e("cf4",0,a,1),e("cn1",-n,0,-1),e("cn2",n,0,-1),e("cn3",0,-a,-1),e("cn4",0,a,-1),t.verticesNeedUpdate=!0}}(),Wn.prototype=Object.create(Ce.prototype),Wn.prototype.constructor=Wn,Wn.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.getCenter(this.position)},Xn.prototype=Object.create(_t.prototype),Xn.prototype.constructor=Xn,Xn.prototype.update=function(){var e=new ee;return function(t){if(t&&t.isBox3?e.copy(t):e.setFromObject(t),!e.isEmpty()){var i=e.min,n=e.max,r=this.geometry.attributes.position,a=r.array;a[0]=n.x,a[1]=n.y,a[2]=n.z,a[3]=i.x,a[4]=n.y,a[5]=n.z,a[6]=i.x,a[7]=i.y,a[8]=n.z,a[9]=n.x,a[10]=i.y,a[11]=n.z,a[12]=n.x,a[13]=n.y,a[14]=i.z,a[15]=i.x,a[16]=n.y,a[17]=i.z,a[18]=i.x,a[19]=i.y,a[20]=i.z,a[21]=n.x,a[22]=i.y,a[23]=i.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();var Xc=new Le;Xc.addAttribute("position",new Ee([0,0,0,0,1,0],3));var Yc=new $t(0,.5,1,5,1);Yc.translate(0,-.5,0),Yn.prototype=Object.create(le.prototype),Yn.prototype.constructor=Yn,Yn.prototype.setDirection=function(){var e,t=new l;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(i.z,0,-i.x).normalize(),e=Math.acos(i.y),this.quaternion.setFromAxisAngle(t,e))}}(),Yn.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},Yn.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},qn.prototype=Object.create(_t.prototype),qn.prototype.constructor=qn,e.CatmullRomCurve3=function(){function e(){}var t=new l,i=new e,n=new e,r=new e;return e.prototype.init=function(e,t,i,n){this.c0=e,this.c1=i,this.c2=-3*e+3*t-2*i-n,this.c3=2*e-2*t+i+n},e.prototype.initNonuniformCatmullRom=function(e,t,i,n,r,a,o){var s=(t-e)/r-(i-e)/(r+a)+(i-t)/a,c=(i-t)/a-(n-t)/(a+o)+(n-i)/o;s*=a,c*=a,this.init(t,i,s,c)},e.prototype.initCatmullRom=function(e,t,i,n,r){this.init(t,i,r*(i-e),r*(n-t))},e.prototype.calc=function(e){var t=e*e,i=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*i},Ji.create(function(e){this.points=e||[],this.closed=!1},function(e){var a,o,s,c,h=this.points;c=h.length,2>c&&console.log("duh, you need at least 2 points"),a=(c-(this.closed?0:1))*e,o=Math.floor(a),s=a-o,this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/h.length)+1)*h.length:0===s&&o===c-1&&(o=c-2,s=1);var u,p,d,f;if(this.closed||o>0?u=h[(o-1)%c]:(t.subVectors(h[0],h[1]).add(h[0]),u=t),p=h[o%c],d=h[(o+1)%c],this.closed||c>o+2?f=h[(o+2)%c]:(t.subVectors(h[c-1],h[c-2]).add(h[c-1]),f=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(u.distanceToSquared(p),m),g=Math.pow(p.distanceToSquared(d),m),y=Math.pow(d.distanceToSquared(f),m);1e-4>g&&(g=1),1e-4>v&&(v=g),1e-4>y&&(y=g),i.initNonuniformCatmullRom(u.x,p.x,d.x,f.x,v,g,y),n.initNonuniformCatmullRom(u.y,p.y,d.y,f.y,v,g,y),r.initNonuniformCatmullRom(u.z,p.z,d.z,f.z,v,g,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;i.initCatmullRom(u.x,p.x,d.x,f.x,x),n.initCatmullRom(u.y,p.y,d.y,f.y,x),r.initCatmullRom(u.z,p.z,d.z,f.z,x)}var b=new l(i.calc(s),n.calc(s),r.calc(s));return b})}(),Zn.prototype=Object.create(e.CatmullRomCurve3.prototype);var qc=Ji.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0===e?[]:e},function(t){var i=this.points,n=(i.length-1)*t,r=Math.floor(n),a=n-r,o=i[0==r?r:r-1],s=i[r],c=i[r>i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2],u=e.CurveUtils.interpolate;return new l(u(o.x,s.x,c.x,h.x,a),u(o.y,s.y,c.y,h.y,a),u(o.z,s.z,c.z,h.z,a))});e.CubicBezierCurve3=Ji.create(function(e,t,i,n){this.v0=e,this.v1=t,this.v2=i,this.v3=n},function(t){var i=e.ShapeUtils.b3;return new l(i(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),i(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),i(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),e.QuadraticBezierCurve3=Ji.create(function(e,t,i){this.v0=e,this.v1=t,this.v2=i},function(t){var i=e.ShapeUtils.b2;return new l(i(t,this.v0.x,this.v1.x,this.v2.x),i(t,this.v0.y,this.v1.y,this.v2.y),i(t,this.v0.z,this.v1.z,this.v2.z))}),e.LineCurve3=Ji.create(function(e,t){this.v1=e,this.v2=t},function(e){if(1===e)return this.v2.clone();var t=new l;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),Jn.prototype=Object.create($i.prototype),Jn.prototype.constructor=Jn,e.SceneUtils={createMultiMaterialObject:function(e,t){for(var i=new Tt,n=0,r=t.length;r>n;n++)i.add(new Ce(e,t[n]));return i},detach:function(e,t,i){e.applyMatrix(t.matrixWorld),t.remove(e),i.add(e)},attach:function(e,t,i){var n=new h;n.getInverse(i.matrixWorld),e.applyMatrix(n),t.remove(e),i.add(e)}};var Zc=0,Jc=1;Object.assign(Y.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(ee.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(ue.prototype,{center:function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)}}),Object.assign(ie.prototype,{multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}),Object.assign(h.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(e){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}),Object.assign(ne.prototype,{isIntersectionLine:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}),Object.assign(c.prototype,{multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}),Object.assign(oe.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(rn.prototype,{extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Vt(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Qt(this,e)}}),Object.assign(l.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(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)}}),Object.assign(le.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}}),Object.defineProperties(le.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(mt.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Oe.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(_i.prototype,{onlyShadow:{set:function(e){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(e){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(e){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(me.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.assign(Le.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},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(Le.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(J.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(e){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new X}}}),Object.defineProperties(ui.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(e){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(K.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),t.prototype=Object.assign(Object.create({constructor:t,apply:function(e){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(e,this)}}),t.prototype),Object.assign(ct.prototype,{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 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(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},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(ct.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}}}),Object.defineProperties(ae.prototype,{cullFace:{get:function(){return this.renderReverseSided?pr:ur},set:function(e){var t=e!==ur;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(o.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.assign(fn.prototype,{load:function(e){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var t=this,i=new hn;return i.load(e,function(e){t.setBuffer(e)}),this}}),Object.assign(vn.prototype,{getData:function(e){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()}});var Qc={merge:function(e,t,i){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,i)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},Kc={crossOrigin:void 0,loadTexture:function(e,t,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new wi;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,i,void 0,n);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new bi;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,i,void 0,n);return t&&(a.mapping=t),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.")}};Object.defineProperty(e,"AudioContext",{get:function(){return e.getAudioContext()}}),e.WebGLRenderTargetCube=s,e.WebGLRenderTarget=o,e.WebGLRenderer=ct,e.ShaderLib=Dc,e.UniformsLib=Oc,e.ShaderChunk=Ic,e.FogExp2=lt,e.Fog=ht,e.Scene=ut,e.LensFlare=pt,e.Sprite=ft,e.LOD=mt,e.SkinnedMesh=xt,e.Skeleton=gt,e.Bone=yt,e.Mesh=Ce,e.LineSegments=_t,e.Line=wt,e.Points=Mt,e.Group=Tt,e.VideoTexture=St,e.DataTexture=vt,e.CompressedTexture=Rt,e.CubeTexture=u,e.CanvasTexture=At,e.DepthTexture=Lt,e.TextureIdCount=r,e.Texture=n,e.MaterialIdCount=Q,e.CompressedTextureLoader=gi,e.BinaryTextureLoader=yi,e.DataTextureLoader=Vc,e.CubeTextureLoader=bi,e.TextureLoader=wi,e.ObjectLoader=Zi,e.MaterialLoader=Wi,e.BufferGeometryLoader=Xi,e.LoadingManager=mi,e.JSONLoader=qi,e.ImageLoader=xi,e.FontLoader=cn,e.XHRLoader=vi,e.Loader=Yi,e.AudioLoader=hn,e.SpotLightShadow=Ti,e.SpotLight=Si,e.PointLight=Ri,e.HemisphereLight=Ei,e.DirectionalLightShadow=Ai,e.DirectionalLight=Li,e.AmbientLight=Ci,e.LightShadow=Mi,e.Light=_i,e.StereoCamera=un,e.PerspectiveCamera=Oe,e.OrthographicCamera=De,e.CubeCamera=pn,e.Camera=Ie,e.AudioListener=dn,e.PositionalAudio=mn,e.getAudioContext=ln,e.AudioAnalyser=vn,e.Audio=fn,e.VectorKeyframeTrack=Ni,e.StringKeyframeTrack=Hi,e.QuaternionKeyframeTrack=zi,e.NumberKeyframeTrack=Bi,e.ColorKeyframeTrack=Vi,e.BooleanKeyframeTrack=Gi,e.PropertyMixer=gn,e.PropertyBinding=yn,e.KeyframeTrack=ki,e.AnimationObjectGroup=xn,e.AnimationMixer=wn,e.AnimationClip=ji,e.Uniform=_n,e.InstancedBufferGeometry=En,e.BufferGeometry=Le,e.GeometryIdCount=Re,e.Geometry=Se,e.InterleavedBufferAttribute=Mn,e.InstancedInterleavedBuffer=Sn,e.InterleavedBuffer=Tn,e.InstancedBufferAttribute=Rn,e.DynamicBufferAttribute=Te,e.Float64Attribute=Me,e.Float32Attribute=Ee,e.Uint32Attribute=_e,e.Int32Attribute=we,e.Uint16Attribute=be,e.Int16Attribute=xe,e.Uint8ClampedAttribute=ye,e.Uint8Attribute=ge,e.Int8Attribute=ve,e.BufferAttribute=me,e.Face3=de,e.Object3DIdCount=he,e.Object3D=le,e.Raycaster=An,e.Layers=ce,e.EventDispatcher=t,e.Clock=Pn,e.QuaternionLinearInterpolant=Fi,e.LinearInterpolant=Ii,e.DiscreteInterpolant=Oi,e.CubicInterpolant=Ui,e.Interpolant=Pi,e.Triangle=pe,e.Spline=Un,e.Spherical=In,e.Plane=ne,e.Frustum=re,e.Sphere=te,e.Ray=oe,e.Matrix4=h,e.Matrix3=ie,e.Box3=ee,e.Box2=Y,e.Line3=ue,e.Euler=se,e.Vector4=a,e.Vector3=l,e.Vector2=i,e.Quaternion=c,e.Color=X,e.MorphBlendMesh=On,e.ImmediateRenderObject=Dn,e.VertexNormalsHelper=Nn,e.SpotLightHelper=Fn,e.SkeletonHelper=zn,e.PointLightHelper=Bn,e.HemisphereLightHelper=Hn,e.GridHelper=Gn,e.FaceNormalsHelper=Vn,e.DirectionalLightHelper=kn,e.CameraHelper=jn,e.BoundingBoxHelper=Wn,e.BoxHelper=Xn,e.ArrowHelper=Yn,e.AxisHelper=qn,e.ClosedSplineCurve3=Zn,e.SplineCurve3=qc,e.ArcCurve=Jn,e.EllipseCurve=$i,e.SplineCurve=en,e.CubicBezierCurve=tn,e.QuadraticBezierCurve=nn,e.LineCurve=Qi,e.Shape=rn,e.ShapePath=on,e.Path=an,e.Font=sn,e.CurvePath=Ki,e.Curve=Ji,e.WireframeGeometry=Ct,e.ParametricGeometry=Pt,e.TetrahedronGeometry=It,e.OctahedronGeometry=Ot,e.IcosahedronGeometry=Dt,e.DodecahedronGeometry=Nt,e.PolyhedronGeometry=Ut,e.TubeGeometry=Ft,e.TorusKnotGeometry=Bt,e.TorusKnotBufferGeometry=zt,e.TorusGeometry=Gt,e.TorusBufferGeometry=Ht,e.TextGeometry=kt,e.SphereBufferGeometry=jt,e.SphereGeometry=Wt,
e.RingGeometry=Yt,e.RingBufferGeometry=Xt,e.PlaneBufferGeometry=Ue,e.PlaneGeometry=qt,e.LatheGeometry=Jt,e.LatheBufferGeometry=Zt,e.ShapeGeometry=Qt,e.ExtrudeGeometry=Vt,e.EdgesGeometry=Kt,e.ConeGeometry=ti,e.ConeBufferGeometry=ii,e.CylinderGeometry=ei,e.CylinderBufferGeometry=$t,e.CircleBufferGeometry=ni,e.CircleGeometry=ri,e.BoxBufferGeometry=Pe,e.BoxGeometry=ai,e.ShadowMaterial=oi,e.SpriteMaterial=dt,e.RawShaderMaterial=si,e.ShaderMaterial=K,e.PointsMaterial=Et,e.MultiMaterial=ci,e.MeshPhysicalMaterial=hi,e.MeshStandardMaterial=li,e.MeshPhongMaterial=ui,e.MeshNormalMaterial=pi,e.MeshLambertMaterial=di,e.MeshDepthMaterial=$,e.MeshBasicMaterial=fe,e.LineDashedMaterial=fi,e.LineBasicMaterial=bt,e.Material=J,e.REVISION=cr,e.MOUSE=lr,e.CullFaceNone=hr,e.CullFaceBack=ur,e.CullFaceFront=pr,e.CullFaceFrontBack=dr,e.FrontFaceDirectionCW=fr,e.FrontFaceDirectionCCW=mr,e.BasicShadowMap=vr,e.PCFShadowMap=gr,e.PCFSoftShadowMap=yr,e.FrontSide=xr,e.BackSide=br,e.DoubleSide=wr,e.FlatShading=_r,e.SmoothShading=Er,e.NoColors=Mr,e.FaceColors=Tr,e.VertexColors=Sr,e.NoBlending=Rr,e.NormalBlending=Ar,e.AdditiveBlending=Lr,e.SubtractiveBlending=Cr,e.MultiplyBlending=Pr,e.CustomBlending=Ur,e.BlendingMode=Ir,e.AddEquation=Or,e.SubtractEquation=Dr,e.ReverseSubtractEquation=Nr,e.MinEquation=Fr,e.MaxEquation=zr,e.ZeroFactor=Br,e.OneFactor=Hr,e.SrcColorFactor=Gr,e.OneMinusSrcColorFactor=Vr,e.SrcAlphaFactor=kr,e.OneMinusSrcAlphaFactor=jr,e.DstAlphaFactor=Wr,e.OneMinusDstAlphaFactor=Xr,e.DstColorFactor=Yr,e.OneMinusDstColorFactor=qr,e.SrcAlphaSaturateFactor=Zr,e.NeverDepth=Jr,e.AlwaysDepth=Qr,e.LessDepth=Kr,e.LessEqualDepth=$r,e.EqualDepth=ea,e.GreaterEqualDepth=ta,e.GreaterDepth=ia,e.NotEqualDepth=na,e.MultiplyOperation=ra,e.MixOperation=aa,e.AddOperation=oa,e.NoToneMapping=sa,e.LinearToneMapping=ca,e.ReinhardToneMapping=la,e.Uncharted2ToneMapping=ha,e.CineonToneMapping=ua,e.UVMapping=pa,e.CubeReflectionMapping=da,e.CubeRefractionMapping=fa,e.EquirectangularReflectionMapping=ma,e.EquirectangularRefractionMapping=va,e.SphericalReflectionMapping=ga,e.CubeUVReflectionMapping=ya,e.CubeUVRefractionMapping=xa,e.TextureMapping=ba,e.RepeatWrapping=wa,e.ClampToEdgeWrapping=_a,e.MirroredRepeatWrapping=Ea,e.TextureWrapping=Ma,e.NearestFilter=Ta,e.NearestMipMapNearestFilter=Sa,e.NearestMipMapLinearFilter=Ra,e.LinearFilter=Aa,e.LinearMipMapNearestFilter=La,e.LinearMipMapLinearFilter=Ca,e.TextureFilter=Pa,e.UnsignedByteType=Ua,e.ByteType=Ia,e.ShortType=Oa,e.UnsignedShortType=Da,e.IntType=Na,e.UnsignedIntType=Fa,e.FloatType=za,e.HalfFloatType=Ba,e.UnsignedShort4444Type=Ha,e.UnsignedShort5551Type=Ga,e.UnsignedShort565Type=Va,e.UnsignedInt248Type=ka,e.AlphaFormat=ja,e.RGBFormat=Wa,e.RGBAFormat=Xa,e.LuminanceFormat=Ya,e.LuminanceAlphaFormat=qa,e.RGBEFormat=Za,e.DepthFormat=Ja,e.DepthStencilFormat=Qa,e.RGB_S3TC_DXT1_Format=Ka,e.RGBA_S3TC_DXT1_Format=$a,e.RGBA_S3TC_DXT3_Format=eo,e.RGBA_S3TC_DXT5_Format=to,e.RGB_PVRTC_4BPPV1_Format=io,e.RGB_PVRTC_2BPPV1_Format=no,e.RGBA_PVRTC_4BPPV1_Format=ro,e.RGBA_PVRTC_2BPPV1_Format=ao,e.RGB_ETC1_Format=oo,e.LoopOnce=so,e.LoopRepeat=co,e.LoopPingPong=lo,e.InterpolateDiscrete=ho,e.InterpolateLinear=uo,e.InterpolateSmooth=po,e.ZeroCurvatureEnding=fo,e.ZeroSlopeEnding=mo,e.WrapAroundEnding=vo,e.TrianglesDrawMode=go,e.TriangleStripDrawMode=yo,e.TriangleFanDrawMode=xo,e.LinearEncoding=bo,e.sRGBEncoding=wo,e.GammaEncoding=_o,e.RGBEEncoding=Eo,e.LogLuvEncoding=Mo,e.RGBM7Encoding=To,e.RGBM16Encoding=So,e.RGBDEncoding=Ro,e.BasicDepthPacking=Ao,e.RGBADepthPacking=Lo,e.CubeGeometry=ai,e.Face4=Qn,e.LineStrip=Zc,e.LinePieces=Jc,e.MeshFaceMaterial=ci,e.PointCloud=Kn,e.Particle=ft,e.ParticleSystem=$n,e.PointCloudMaterial=er,e.ParticleBasicMaterial=tr,e.ParticleSystemMaterial=ir,e.Vertex=nr,e.EdgesHelper=rr,e.WireframeHelper=ar,e.GeometryUtils=Qc,e.ImageUtils=Kc,e.Projector=or,e.CanvasRenderer=sr,Object.defineProperty(e,"__esModule",{value:!0})});var Detector={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(t){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n")),e},addGetWebGLMessage:function(e){var t,i,n;e=e||{},t=void 0!==e.parent?e.parent:document.body,i=void 0!==e.id?e.id:"oldie",n=Detector.getWebGLErrorMessage(),n.id=i,t.appendChild(n)}};"object"==typeof module&&(module.exports=Detector),THREE.SpriteCanvasMaterial=function(e){THREE.Material.call(this),this.type="SpriteCanvasMaterial",this.color=new THREE.Color(16777215),this.program=function(e,t){},this.setValues(e)},THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteCanvasMaterial.prototype.constructor=THREE.SpriteCanvasMaterial,THREE.SpriteCanvasMaterial.prototype.clone=function(){var e=new THREE.SpriteCanvasMaterial;return e.copy(this),e.color.copy(this.color),e.program=this.program,e},THREE.CanvasRenderer=function(e){function t(){ge.setRGB(0,0,0),ye.setRGB(0,0,0),xe.setRGB(0,0,0);for(var e=0,t=_.length;t>e;e++){var i=_[e],n=i.color;i instanceof THREE.AmbientLight?ge.add(n):i instanceof THREE.DirectionalLight?ye.add(n):i instanceof THREE.PointLight&&xe.add(n)}}function i(e,t,i){for(var n=0,r=_.length;r>n;n++){var a=_[n];if(pe.copy(a.color),a instanceof THREE.DirectionalLight){var o=be.setFromMatrixPosition(a.matrixWorld).normalize(),s=t.dot(o);if(0>=s)continue;s*=a.intensity,i.add(pe.multiplyScalar(s))}else if(a instanceof THREE.PointLight){var o=be.setFromMatrixPosition(a.matrixWorld),s=t.dot(be.subVectors(o,e).normalize());if(0>=s)continue;if(s*=0==a.distance?1:1-Math.min(e.distanceTo(o)/a.distance,1),0==s)continue;s*=a.intensity,i.add(pe.multiplyScalar(s))}}}function n(e,t,i){p(i.opacity),d(i.blending);var n=t.scale.x*W,r=t.scale.y*X,a=.5*Math.sqrt(n*n+r*r);if(ve.min.set(e.x-a,e.y-a),ve.max.set(e.x+a,e.y+a),i instanceof THREE.SpriteMaterial){var o=i.map;if(null!==o){var s=de[o.id];if(void 0!==s&&s.version===o.version||(s=l(o),de[o.id]=s),void 0!==s.canvas){y(s.canvas);var c=o.image,h=c.width*o.offset.x,u=c.height*o.offset.y,f=c.width*o.repeat.x,m=c.height*o.repeat.y,v=n/f,x=r/m;K.save(),K.translate(e.x,e.y),0!==i.rotation&&K.rotate(i.rotation),K.translate(-n/2,-r/2),K.scale(v,x),K.translate(-h,-u),K.fillRect(h,u,f,m),K.restore()}}else y(i.color.getStyle()),K.save(),K.translate(e.x,e.y),0!==i.rotation&&K.rotate(i.rotation),K.scale(n,-r),K.fillRect(-.5,-.5,1,1),K.restore()}else i instanceof THREE.SpriteCanvasMaterial&&(g(i.color.getStyle()),y(i.color.getStyle()),K.save(),K.translate(e.x,e.y),0!==i.rotation&&K.rotate(i.rotation),K.scale(n,r),i.program(K),K.restore())}function r(e,t,i,n){if(p(n.opacity),d(n.blending),K.beginPath(),K.moveTo(e.positionScreen.x,e.positionScreen.y),K.lineTo(t.positionScreen.x,t.positionScreen.y),n instanceof THREE.LineBasicMaterial){if(f(n.linewidth),m(n.linecap),v(n.linejoin),n.vertexColors!==THREE.VertexColors)g(n.color.getStyle());else{var r=i.vertexColors[0].getStyle(),a=i.vertexColors[1].getStyle();if(r===a)g(r);else{try{var o=K.createLinearGradient(e.positionScreen.x,e.positionScreen.y,t.positionScreen.x,t.positionScreen.y);o.addColorStop(0,r),o.addColorStop(1,a)}catch(s){o=r}g(o)}}K.stroke(),ve.expandByScalar(2*n.linewidth)}else n instanceof THREE.LineDashedMaterial&&(f(n.linewidth),m(n.linecap),v(n.linejoin),g(n.color.getStyle()),x([n.dashSize,n.gapSize]),K.stroke(),ve.expandByScalar(2*n.linewidth),x([]))}function a(e,t,n,r,a,l,u,f){if(H.info.render.vertices+=3,H.info.render.faces++,p(f.opacity),d(f.blending),R=e.positionScreen.x,A=e.positionScreen.y,L=t.positionScreen.x,C=t.positionScreen.y,P=n.positionScreen.x,U=n.positionScreen.y,o(R,A,L,C,P,U),(f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)&&null===f.map)he.copy(f.color),ue.copy(f.emissive),f.vertexColors===THREE.FaceColors&&he.multiply(u.color),le.copy(ge),we.copy(e.positionWorld).add(t.positionWorld).add(n.positionWorld).divideScalar(3),i(we,u.normalModel,le),le.multiply(he).add(ue),f.wireframe===!0?s(le,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):c(le);else if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)if(null!==f.map){var m=f.map.mapping;m===THREE.UVMapping&&(I=u.uvs,h(R,A,L,C,P,U,I[r].x,I[r].y,I[a].x,I[a].y,I[l].x,I[l].y,f.map))}else null!==f.envMap?f.envMap.mapping===THREE.SphericalReflectionMapping&&(_e.copy(u.vertexNormalsModel[r]).applyMatrix3(Ee),O=.5*_e.x+.5,D=.5*_e.y+.5,_e.copy(u.vertexNormalsModel[a]).applyMatrix3(Ee),N=.5*_e.x+.5,F=.5*_e.y+.5,_e.copy(u.vertexNormalsModel[l]).applyMatrix3(Ee),z=.5*_e.x+.5,B=.5*_e.y+.5,h(R,A,L,C,P,U,O,D,N,F,z,B,f.envMap)):(le.copy(f.color),f.vertexColors===THREE.FaceColors&&le.multiply(u.color),f.wireframe===!0?s(le,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):c(le));else f instanceof THREE.MeshNormalMaterial?(_e.copy(u.normalModel).applyMatrix3(Ee),le.setRGB(_e.x,_e.y,_e.z).multiplyScalar(.5).addScalar(.5),f.wireframe===!0?s(le,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):c(le)):(le.setRGB(1,1,1),f.wireframe===!0?s(le,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):c(le))}function o(e,t,i,n,r,a){K.beginPath(),K.moveTo(e,t),K.lineTo(i,n),K.lineTo(r,a),K.closePath()}function s(e,t,i,n){f(t),m(i),v(n),g(e.getStyle()),K.stroke(),ve.expandByScalar(2*t)}function c(e){y(e.getStyle()),K.fill()}function l(e){if(0===e.version||e instanceof THREE.CompressedTexture||e instanceof THREE.DataTexture)return{canvas:void 0,version:e.version};var t=e.image;if(t.complete===!1)return{canvas:void 0,version:0};var i=document.createElement("canvas");i.width=t.width,i.height=t.height;var n=i.getContext("2d");n.setTransform(1,0,0,-1,0,t.height),n.drawImage(t,0,0);var r=e.wrapS===THREE.RepeatWrapping,a=e.wrapT===THREE.RepeatWrapping,o="no-repeat";r===!0&&a===!0?o="repeat":r===!0?o="repeat-x":a===!0&&(o="repeat-y");var s=K.createPattern(i,o);return e.onUpdate&&e.onUpdate(e),{canvas:s,version:e.version}}function h(e,t,i,n,r,a,o,s,c,h,u,p,d){var f=de[d.id];if(void 0!==f&&f.version===d.version||(f=l(d),de[d.id]=f),void 0===f.canvas)return y("rgba( 0, 0, 0, 1)"),void K.fill();y(f.canvas);var m,v,g,x,b,w,_,E,M=d.offset.x/d.repeat.x,T=d.offset.y/d.repeat.y,S=d.image.width*d.repeat.x,R=d.image.height*d.repeat.y;o=(o+M)*S,s=(s+T)*R,c=(c+M)*S,h=(h+T)*R,u=(u+M)*S,p=(p+T)*R,i-=e,n-=t,r-=e,a-=t,c-=o,h-=s,u-=o,p-=s,_=c*p-u*h,0!==_&&(E=1/_,m=(p*i-h*r)*E,v=(p*n-h*a)*E,g=(c*r-u*i)*E,x=(c*a-u*n)*E,b=e-m*o-g*s,w=t-v*o-x*s,K.save(),K.transform(m,v,g,x,b,w),K.fill(),K.restore())}function u(e,t,i){var n,r=t.x-e.x,a=t.y-e.y,o=r*r+a*a;0!==o&&(n=i/Math.sqrt(o),r*=n,a*=n,t.x+=r,t.y+=a,e.x-=r,e.y-=a)}function p(e){te!==e&&(K.globalAlpha=e,te=e)}function d(e){ie!==e&&(e===THREE.NormalBlending?K.globalCompositeOperation="source-over":e===THREE.AdditiveBlending?K.globalCompositeOperation="lighter":e===THREE.SubtractiveBlending?K.globalCompositeOperation="darker":e===THREE.MultiplyBlending&&(K.globalCompositeOperation="multiply"),ie=e)}function f(e){ae!==e&&(K.lineWidth=e,ae=e)}function m(e){oe!==e&&(K.lineCap=e,oe=e)}function v(e){se!==e&&(K.lineJoin=e,se=e)}function g(e){ne!==e&&(K.strokeStyle=e,ne=e)}function y(e){re!==e&&(K.fillStyle=e,re=e)}function x(e){ce.length!==e.length&&(K.setLineDash(e),ce=e)}console.log("THREE.CanvasRenderer",THREE.REVISION),e=e||{};var b,w,_,E,M,T,S,R,A,L,C,P,U,I,O,D,N,F,z,B,H=this,G=new THREE.Projector,V=void 0!==e.canvas?e.canvas:document.createElement("canvas"),k=V.width,j=V.height,W=Math.floor(k/2),X=Math.floor(j/2),Y=0,q=0,Z=k,J=j,Q=1,K=V.getContext("2d",{alpha:e.alpha===!0}),$=new THREE.Color(0),ee=e.alpha===!0?0:1,te=1,ie=0,ne=null,re=null,ae=null,oe=null,se=null,ce=[],le=(new THREE.RenderableVertex,new THREE.RenderableVertex,new THREE.Color),he=(new THREE.Color,new THREE.Color,new THREE.Color,new THREE.Color,new THREE.Color),ue=new THREE.Color,pe=new THREE.Color,de={},fe=new THREE.Box2,me=new THREE.Box2,ve=new THREE.Box2,ge=new THREE.Color,ye=new THREE.Color,xe=new THREE.Color,be=new THREE.Vector3,we=new THREE.Vector3,_e=new THREE.Vector3,Ee=new THREE.Matrix3;void 0===K.setLineDash&&(K.setLineDash=function(){}),this.domElement=V,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.info={render:{vertices:0,faces:0}},this.supportsVertexTextures=function(){},this.setFaceCulling=function(){},this.getContext=function(){return K},this.getContextAttributes=function(){return K.getContextAttributes()},this.getPixelRatio=function(){return Q},this.setPixelRatio=function(e){void 0!==e&&(Q=e)},this.setSize=function(e,t,i){k=e*Q,j=t*Q,V.width=k,V.height=j,W=Math.floor(k/2),X=Math.floor(j/2),i!==!1&&(V.style.width=e+"px",V.style.height=t+"px"),fe.min.set(-W,-X),fe.max.set(W,X),me.min.set(-W,-X),me.max.set(W,X),te=1,ie=0,ne=null,re=null,ae=null,oe=null,se=null,this.setViewport(0,0,e,t)},this.setViewport=function(e,t,i,n){Y=e*Q,q=t*Q,Z=i*Q,J=n*Q},this.setScissor=function(){},this.setScissorTest=function(){},this.setClearColor=function(e,t){$.set(e),ee=void 0!==t?t:1,me.min.set(-W,-X),me.max.set(W,X)},this.setClearColorHex=function(e,t){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead."),this.setClearColor(e,t)},this.getClearColor=function(){return $},this.getClearAlpha=function(){return ee},this.getMaxAnisotropy=function(){return 0},this.clear=function(){me.isEmpty()===!1&&(me.intersect(fe),me.expandByScalar(2),me.min.x=me.min.x+W,me.min.y=-me.min.y+X,me.max.x=me.max.x+W,me.max.y=-me.max.y+X,1>ee&&K.clearRect(0|me.min.x,0|me.max.y,me.max.x-me.min.x|0,me.min.y-me.max.y|0),ee>0&&(d(THREE.NormalBlending),p(1),y("rgba("+Math.floor(255*$.r)+","+Math.floor(255*$.g)+","+Math.floor(255*$.b)+","+ee+")"),K.fillRect(0|me.min.x,0|me.max.y,me.max.x-me.min.x|0,me.min.y-me.max.y|0)),me.makeEmpty())},this.clearColor=function(){},this.clearDepth=function(){},this.clearStencil=function(){},this.render=function(e,i){if(i instanceof THREE.Camera==!1)return void console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");this.autoClear===!0&&this.clear(),H.info.render.vertices=0,H.info.render.faces=0,K.setTransform(Z/k,0,0,-J/j,Y,j-q),K.translate(W,X),b=G.projectScene(e,i,this.sortObjects,this.sortElements),w=b.elements,_=b.lights,E=i,Ee.getNormalMatrix(i.matrixWorldInverse),t();for(var o=0,s=w.length;s>o;o++){var c=w[o],l=c.material;if(void 0!==l&&0!==l.opacity){if(ve.makeEmpty(),c instanceof THREE.RenderableSprite)M=c,M.x*=W,M.y*=X,n(M,c,l);else if(c instanceof THREE.RenderableLine)M=c.v1,T=c.v2,M.positionScreen.x*=W,M.positionScreen.y*=X,T.positionScreen.x*=W,T.positionScreen.y*=X,ve.setFromPoints([M.positionScreen,T.positionScreen]),fe.intersectsBox(ve)===!0&&r(M,T,c,l);else if(c instanceof THREE.RenderableFace){if(M=c.v1,T=c.v2,S=c.v3,M.positionScreen.z<-1||M.positionScreen.z>1)continue;if(T.positionScreen.z<-1||T.positionScreen.z>1)continue;if(S.positionScreen.z<-1||S.positionScreen.z>1)continue;M.positionScreen.x*=W,M.positionScreen.y*=X,T.positionScreen.x*=W,T.positionScreen.y*=X,S.positionScreen.x*=W,S.positionScreen.y*=X,l.overdraw>0&&(u(M.positionScreen,T.positionScreen,l.overdraw),u(T.positionScreen,S.positionScreen,l.overdraw),u(S.positionScreen,M.positionScreen,l.overdraw)),ve.setFromPoints([M.positionScreen,T.positionScreen,S.positionScreen]),fe.intersectsBox(ve)===!0&&a(M,T,S,0,1,2,c,l)}me.union(ve)}}K.setTransform(1,0,0,1,0,0)}},THREE.RenderableObject=function(){this.id=0,this.object=null,this.z=0,this.renderOrder=0},THREE.RenderableFace=function(){this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.v3=new THREE.RenderableVertex,this.normalModel=new THREE.Vector3,this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this.vertexNormalsLength=0,this.color=new THREE.Color,this.material=null,this.uvs=[new THREE.Vector2,new THREE.Vector2,new THREE.Vector2],this.z=0,this.renderOrder=0},THREE.RenderableVertex=function(){this.position=new THREE.Vector3,this.positionWorld=new THREE.Vector3,this.positionScreen=new THREE.Vector4,this.visible=!0},THREE.RenderableVertex.prototype.copy=function(e){this.positionWorld.copy(e.positionWorld),this.positionScreen.copy(e.positionScreen)},THREE.RenderableLine=function(){this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.vertexColors=[new THREE.Color,new THREE.Color],this.material=null,this.z=0,this.renderOrder=0},THREE.RenderableSprite=function(){this.id=0,this.object=null,this.x=0,this.y=0,this.z=0,this.rotation=0,this.scale=new THREE.Vector2,this.material=null,this.renderOrder=0},THREE.Projector=function(){function e(){if(c===x){var e=new THREE.RenderableObject;return y.push(e),x++,c++,e}return y[c++]}function t(){if(h===w){var e=new THREE.RenderableVertex;return b.push(e),w++,h++,e}return b[h++]}function i(){if(p===E){var e=new THREE.RenderableFace;return _.push(e),E++,p++,e}return _[p++]}function n(){if(f===T){var e=new THREE.RenderableLine;return M.push(e),T++,f++,e}return M[f++]}function r(){if(v===R){var e=new THREE.RenderableSprite;return S.push(e),R++,v++,e}return S[v++]}function a(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id!==t.id?e.id-t.id:0}function o(e,t){var i=0,n=1,r=e.z+e.w,a=t.z+t.w,o=-e.z+e.w,s=-t.z+t.w;return r>=0&&a>=0&&o>=0&&s>=0?!0:0>r&&0>a||0>o&&0>s?!1:(0>r?i=Math.max(i,r/(r-a)):0>a&&(n=Math.min(n,r/(r-a))),0>o?i=Math.max(i,o/(o-s)):0>s&&(n=Math.min(n,o/(o-s))),i>n?!1:(e.lerp(t,i),t.lerp(e,1-n),!0))}var s,c,l,h,u,p,d,f,m,v,g,y=[],x=0,b=[],w=0,_=[],E=0,M=[],T=0,S=[],R=0,A={objects:[],lights:[],elements:[]},L=new THREE.Vector3,C=new THREE.Vector4,P=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),U=new THREE.Box3,I=new Array(3),O=(new Array(4),new THREE.Matrix4),D=new THREE.Matrix4,N=new THREE.Matrix4,F=new THREE.Matrix3,z=new THREE.Frustum,B=new THREE.Vector4,H=new THREE.Vector4;this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};var G=function(){function e(e){y=e,x=y.material,w.getNormalMatrix(y.matrixWorld),m.length=0,v.length=0}function r(e){var t=e.position,i=e.positionWorld,n=e.positionScreen;i.copy(t).applyMatrix4(g),n.copy(i).applyMatrix4(D);var r=1/n.w;n.x*=r,n.y*=r,n.z*=r,e.visible=n.x>=-1&&n.x<=1&&n.y>=-1&&n.y<=1&&n.z>=-1&&n.z<=1}function a(e,i,n){l=t(),l.position.set(e,i,n),r(l)}function o(e,t,i){m.push(e,t,i)}function s(e,t){v.push(e,t)}function c(e,t,i){return e.visible===!0||t.visible===!0||i.visible===!0?!0:(I[0]=e.positionScreen,I[1]=t.positionScreen,I[2]=i.positionScreen,P.intersectsBox(U.setFromPoints(I)))}function h(e,t,i){return(i.positionScreen.x-e.positionScreen.x)*(t.positionScreen.y-e.positionScreen.y)-(i.positionScreen.y-e.positionScreen.y)*(t.positionScreen.x-e.positionScreen.x)<0}function p(e,t){var i=b[e],r=b[t];d=n(),d.id=y.id,d.v1.copy(i),d.v2.copy(r),d.z=(i.positionScreen.z+r.positionScreen.z)/2,d.renderOrder=y.renderOrder,d.material=y.material,A.elements.push(d)}function f(e,t,n){var r=b[e],a=b[t],o=b[n];if(c(r,a,o)!==!1&&(x.side===THREE.DoubleSide||h(r,a,o)===!0)){u=i(),u.id=y.id,u.v1.copy(r),u.v2.copy(a),u.v3.copy(o),u.z=(r.positionScreen.z+a.positionScreen.z+o.positionScreen.z)/3,u.renderOrder=y.renderOrder,u.normalModel.fromArray(m,3*e),u.normalModel.applyMatrix3(w).normalize();for(var s=0;3>s;s++){var l=u.vertexNormalsModel[s];l.fromArray(m,3*arguments[s]),l.applyMatrix3(w).normalize();var p=u.uvs[s];p.fromArray(v,2*arguments[s])}u.vertexNormalsLength=3,u.material=y.material,A.elements.push(u)}}var m=[],v=[],y=null,x=null,w=new THREE.Matrix3;return{setObject:e,projectVertex:r,checkTriangleVisibility:c,checkBackfaceCulling:h,pushVertex:a,pushNormal:o,pushUv:s,pushLine:p,pushTriangle:f}},V=new G;this.projectScene=function(l,y,x,w){function _(t){s=e(),s.id=t.id,s.object=t,L.setFromMatrixPosition(t.matrixWorld),L.applyProjection(D),s.z=L.z,s.renderOrder=t.renderOrder,A.objects.push(s)}p=0,f=0,v=0,A.elements.length=0,l.autoUpdate===!0&&l.updateMatrixWorld(),null===y.parent&&y.updateMatrixWorld(),O.copy(y.matrixWorldInverse.getInverse(y.matrixWorld)),D.multiplyMatrices(y.projectionMatrix,O),z.setFromMatrix(D),c=0,A.objects.length=0,A.lights.length=0,l.traverseVisible(function(e){if(e instanceof THREE.Light)A.lights.push(e);else if(e instanceof THREE.Mesh||e instanceof THREE.Line){if(e.material.visible===!1)return;if(e.frustumCulled===!0&&z.intersectsObject(e)===!1)return;_(e)}else if(e instanceof THREE.Sprite){if(e.material.visible===!1)return;if(e.frustumCulled===!0&&z.intersectsSprite(e)===!1)return;_(e)}}),x===!0&&A.objects.sort(a);for(var E=0,M=A.objects.length;M>E;E++){var T=A.objects[E].object,S=T.geometry;if(V.setObject(T),g=T.matrixWorld,h=0,T instanceof THREE.Mesh){if(S instanceof THREE.BufferGeometry){var R=S.attributes,P=S.groups;if(void 0===R.position)continue;for(var U=R.position.array,I=0,G=U.length;G>I;I+=3)V.pushVertex(U[I],U[I+1],U[I+2]);if(void 0!==R.normal)for(var k=R.normal.array,I=0,G=k.length;G>I;I+=3)V.pushNormal(k[I],k[I+1],k[I+2]);if(void 0!==R.uv)for(var j=R.uv.array,I=0,G=j.length;G>I;I+=2)V.pushUv(j[I],j[I+1]);if(null!==S.index){var W=S.index.array;if(P.length>0)for(var E=0;E<P.length;E++)for(var X=P[E],I=X.start,G=X.start+X.count;G>I;I+=3)V.pushTriangle(W[I],W[I+1],W[I+2]);else for(var I=0,G=W.length;G>I;I+=3)V.pushTriangle(W[I],W[I+1],W[I+2])}else for(var I=0,G=U.length/3;G>I;I+=3)V.pushTriangle(I,I+1,I+2)}else if(S instanceof THREE.Geometry){var Y=S.vertices,q=S.faces,Z=S.faceVertexUvs[0];F.getNormalMatrix(g);for(var J=T.material,Q=J instanceof THREE.MultiMaterial,K=Q===!0?T.material:null,$=0,ee=Y.length;ee>$;$++){var te=Y[$];if(L.copy(te),J.morphTargets===!0)for(var ie=S.morphTargets,ne=T.morphTargetInfluences,re=0,ae=ie.length;ae>re;re++){var oe=ne[re];if(0!==oe){var se=ie[re],ce=se.vertices[$];L.x+=(ce.x-te.x)*oe,L.y+=(ce.y-te.y)*oe,L.z+=(ce.z-te.z)*oe}}V.pushVertex(L.x,L.y,L.z)}for(var le=0,he=q.length;he>le;le++){var ue=q[le];if(J=Q===!0?K.materials[ue.materialIndex]:T.material,void 0!==J){var pe=J.side,de=b[ue.a],fe=b[ue.b],me=b[ue.c];if(V.checkTriangleVisibility(de,fe,me)!==!1){var ve=V.checkBackfaceCulling(de,fe,me);if(pe!==THREE.DoubleSide){if(pe===THREE.FrontSide&&ve===!1)continue;if(pe===THREE.BackSide&&ve===!0)continue}u=i(),u.id=T.id,u.v1.copy(de),u.v2.copy(fe),u.v3.copy(me),u.normalModel.copy(ue.normal),ve!==!1||pe!==THREE.BackSide&&pe!==THREE.DoubleSide||u.normalModel.negate(),u.normalModel.applyMatrix3(F).normalize();for(var ge=ue.vertexNormals,ye=0,xe=Math.min(ge.length,3);xe>ye;ye++){var be=u.vertexNormalsModel[ye];be.copy(ge[ye]),ve!==!1||pe!==THREE.BackSide&&pe!==THREE.DoubleSide||be.negate(),be.applyMatrix3(F).normalize()}u.vertexNormalsLength=ge.length;var we=Z[le];if(void 0!==we)for(var _e=0;3>_e;_e++)u.uvs[_e].copy(we[_e]);u.color=ue.color,u.material=J,u.z=(de.positionScreen.z+fe.positionScreen.z+me.positionScreen.z)/3,u.renderOrder=T.renderOrder,A.elements.push(u)}}}}}else if(T instanceof THREE.Line){if(S instanceof THREE.BufferGeometry){var R=S.attributes;if(void 0!==R.position){for(var U=R.position.array,I=0,G=U.length;G>I;I+=3)V.pushVertex(U[I],U[I+1],U[I+2]);if(null!==S.index)for(var W=S.index.array,I=0,G=W.length;G>I;I+=2)V.pushLine(W[I],W[I+1]);else for(var Ee=T instanceof THREE.LineSegments?2:1,I=0,G=U.length/3-1;G>I;I+=Ee)V.pushLine(I,I+1)}}else if(S instanceof THREE.Geometry){N.multiplyMatrices(D,g);var Y=T.geometry.vertices;if(0===Y.length)continue;de=t(),de.positionScreen.copy(Y[0]).applyMatrix4(N);for(var Ee=T instanceof THREE.LineSegments?2:1,$=1,ee=Y.length;ee>$;$++)de=t(),de.positionScreen.copy(Y[$]).applyMatrix4(N),($+1)%Ee>0||(fe=b[h-2],B.copy(de.positionScreen),H.copy(fe.positionScreen),o(B,H)===!0&&(B.multiplyScalar(1/B.w),H.multiplyScalar(1/H.w),d=n(),d.id=T.id,d.v1.positionScreen.copy(B),d.v2.positionScreen.copy(H),d.z=Math.max(B.z,H.z),d.renderOrder=T.renderOrder,d.material=T.material,T.material.vertexColors===THREE.VertexColors&&(d.vertexColors[0].copy(T.geometry.colors[$]),d.vertexColors[1].copy(T.geometry.colors[$-1])),A.elements.push(d)))}}else if(T instanceof THREE.Sprite){C.set(g.elements[12],g.elements[13],g.elements[14],1),C.applyMatrix4(D);var Me=1/C.w;C.z*=Me,C.z>=-1&&C.z<=1&&(m=r(),m.id=T.id,m.x=C.x*Me,m.y=C.y*Me,m.z=C.z,m.renderOrder=T.renderOrder,m.object=T,m.rotation=T.rotation,m.scale.x=T.scale.x*Math.abs(m.x-(C.x+y.projectionMatrix.elements[0])/(C.w+y.projectionMatrix.elements[12])),m.scale.y=T.scale.y*Math.abs(m.y-(C.y+y.projectionMatrix.elements[5])/(C.w+y.projectionMatrix.elements[13])),m.material=T.material,A.elements.push(m))}}return w===!0&&A.elements.sort(a),A}},THREE.SVGObject=function(e){THREE.Object3D.call(this),this.node=e},THREE.SVGObject.prototype=Object.create(THREE.Object3D.prototype),THREE.SVGObject.prototype.constructor=THREE.SVGObject,THREE.SVGRenderer=function(){function e(e){S.setRGB(0,0,0),R.setRGB(0,0,0),A.setRGB(0,0,0);for(var t=0,i=e.length;i>t;t++){var n=e[t],r=n.color;n instanceof THREE.AmbientLight?(S.r+=r.r,S.g+=r.g,S.b+=r.b):n instanceof THREE.DirectionalLight?(R.r+=r.r,R.g+=r.g,R.b+=r.b):n instanceof THREE.PointLight&&(A.r+=r.r,A.g+=r.g,A.b+=r.b)}}function t(e,t,i,n){for(var r=0,a=e.length;a>r;r++){var o=e[r],s=o.color;if(o instanceof THREE.DirectionalLight){var c=P.setFromMatrixPosition(o.matrixWorld).normalize(),l=i.dot(c);if(0>=l)continue;l*=o.intensity,n.r+=s.r*l,n.g+=s.g*l,n.b+=s.b*l}else if(o instanceof THREE.PointLight){var c=P.setFromMatrixPosition(o.matrixWorld),l=i.dot(P.subVectors(c,t).normalize());if(0>=l)continue;if(l*=0==o.distance?1:1-Math.min(t.distanceTo(c)/o.distance,1),0==l)continue;l*=o.intensity,n.r+=s.r*l,n.g+=s.g*l,n.b+=s.b*l}}}function i(e,t,i){var n=t.scale.x*d,r=t.scale.y*f;y=s(V++),y.setAttribute("x",e.x-.5*n),y.setAttribute("y",e.y-.5*r),y.setAttribute("width",n),y.setAttribute("height",r),i instanceof THREE.SpriteMaterial&&y.setAttribute("style","fill: "+i.color.getStyle()),w.appendChild(y)}function n(e,t,i,n){y=a(G++),y.setAttribute("x1",e.positionScreen.x),y.setAttribute("y1",e.positionScreen.y),y.setAttribute("x2",t.positionScreen.x),y.setAttribute("y2",t.positionScreen.y),n instanceof THREE.LineBasicMaterial&&(y.setAttribute("style","fill: none; stroke: "+n.color.getStyle()+"; stroke-width: "+n.linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.linecap+"; stroke-linejoin: "+n.linejoin),w.appendChild(y))}function r(e,i,n,r,a){x.info.render.vertices+=3,x.info.render.faces++,y=o(H++),y.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+i.positionScreen.x+" "+i.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z"),a instanceof THREE.MeshBasicMaterial?(M.copy(a.color),a.vertexColors===THREE.FaceColors&&M.multiply(r.color)):a instanceof THREE.MeshLambertMaterial||a instanceof THREE.MeshPhongMaterial?(T.copy(a.color),a.vertexColors===THREE.FaceColors&&T.multiply(r.color),M.copy(S),U.copy(e.positionWorld).add(i.positionWorld).add(n.positionWorld).divideScalar(3),t(h,U,r.normalModel,M),M.multiply(T).add(a.emissive)):a instanceof THREE.MeshNormalMaterial&&(I.copy(r.normalModel).applyMatrix3(O),M.setRGB(I.x,I.y,I.z).multiplyScalar(.5).addScalar(.5)),a.wireframe?y.setAttribute("style","fill: none; stroke: "+M.getStyle()+"; stroke-width: "+a.wireframeLinewidth+"; stroke-opacity: "+a.opacity+"; stroke-linecap: "+a.wireframeLinecap+"; stroke-linejoin: "+a.wireframeLinejoin):y.setAttribute("style","fill: "+M.getStyle()+"; fill-opacity: "+a.opacity),w.appendChild(y)}function a(e){return null==z[e]?(z[e]=document.createElementNS("http://www.w3.org/2000/svg","line"),0==k&&z[e].setAttribute("shape-rendering","crispEdges"),z[e]):z[e]}function o(e){return null==F[e]?(F[e]=document.createElementNS("http://www.w3.org/2000/svg","path"),0==k&&F[e].setAttribute("shape-rendering","crispEdges"),F[e]):F[e]}function s(e){return null==B[e]?(B[e]=document.createElementNS("http://www.w3.org/2000/svg","rect"),0==k&&B[e].setAttribute("shape-rendering","crispEdges"),B[e]):B[e]}console.log("THREE.SVGRenderer",THREE.REVISION);var c,l,h,u,p,d,f,m,v,g,y,x=this,b=new THREE.Projector,w=document.createElementNS("http://www.w3.org/2000/svg","svg"),_=new THREE.Box2,E=new THREE.Box2,M=new THREE.Color,T=new THREE.Color,S=new THREE.Color,R=new THREE.Color,A=new THREE.Color,L=new THREE.Color,C=1,P=new THREE.Vector3,U=new THREE.Vector3,I=new THREE.Vector3,O=new THREE.Matrix3,D=new THREE.Matrix4,N=new THREE.Matrix4,F=[],z=[],B=[],H=0,G=0,V=0,k=1;this.domElement=w,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.info={render:{vertices:0,faces:0}},this.setQuality=function(e){switch(e){case"high":k=1;break;case"low":k=0}},this.supportsVertexTextures=function(){},this.setFaceCulling=function(){},this.setClearColor=function(e,t){L.set(e),C=void 0!==t?t:1},this.setPixelRatio=function(){},this.setSize=function(e,t){u=e,p=t,d=u/2,f=p/2,w.setAttribute("viewBox",-d+" "+-f+" "+u+" "+p),w.setAttribute("width",u),w.setAttribute("height",p),_.min.set(-d,-f),_.max.set(d,f)},this.clear=function(){for(H=0,G=0,V=0;w.childNodes.length>0;)w.removeChild(w.childNodes[0]);w.style.backgroundColor="rgba("+(255*L.r|0)+","+(255*L.g|0)+","+(255*L.b|0)+","+C+")"},this.render=function(t,a){if(a instanceof THREE.Camera==!1)return void console.error("THREE.SVGRenderer.render: camera is not an instance of THREE.Camera.");this.autoClear===!0&&this.clear(),x.info.render.vertices=0,x.info.render.faces=0,D.copy(a.matrixWorldInverse.getInverse(a.matrixWorld)),N.multiplyMatrices(a.projectionMatrix,D),c=b.projectScene(t,a,this.sortObjects,this.sortElements),l=c.elements,h=c.lights,O.getNormalMatrix(a.matrixWorldInverse),e(h);for(var o=0,s=l.length;s>o;o++){var u=l[o],p=u.material;if(void 0!==p&&0!==p.opacity)if(E.makeEmpty(),u instanceof THREE.RenderableSprite)m=u,m.x*=d,m.y*=-f,i(m,u,p);else if(u instanceof THREE.RenderableLine)m=u.v1,v=u.v2,m.positionScreen.x*=d,m.positionScreen.y*=-f,v.positionScreen.x*=d,v.positionScreen.y*=-f,E.setFromPoints([m.positionScreen,v.positionScreen]),_.intersectsBox(E)===!0&&n(m,v,u,p);else if(u instanceof THREE.RenderableFace){if(m=u.v1,v=u.v2,g=u.v3,m.positionScreen.z<-1||m.positionScreen.z>1)continue;if(v.positionScreen.z<-1||v.positionScreen.z>1)continue;if(g.positionScreen.z<-1||g.positionScreen.z>1)continue;m.positionScreen.x*=d,m.positionScreen.y*=-f,v.positionScreen.x*=d,v.positionScreen.y*=-f,g.positionScreen.x*=d,g.positionScreen.y*=-f,E.setFromPoints([m.positionScreen,v.positionScreen,g.positionScreen]),_.intersectsBox(E)===!0&&r(m,v,g,u,p)}}t.traverseVisible(function(e){if(e instanceof THREE.SVGObject){P.setFromMatrixPosition(e.matrixWorld),P.applyProjection(N);var t=P.x*d,i=-P.y*f,n=e.node;n.setAttribute("transform","translate("+t+","+i+")"),w.appendChild(n)}})}},THREE.TrackballControls=function(e,t){function i(e){p.enabled!==!1&&(window.removeEventListener("keydown",i),
g=v,v===d.NONE&&(e.keyCode!==p.keys[d.ROTATE]||p.noRotate?e.keyCode!==p.keys[d.ZOOM]||p.noZoom?e.keyCode!==p.keys[d.PAN]||p.noPan||(v=d.PAN):v=d.ZOOM:v=d.ROTATE))}function n(e){p.enabled!==!1&&(v=g,window.addEventListener("keydown",i,!1))}function r(e){p.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),v===d.NONE&&(v=e.button),v!==d.ROTATE||p.noRotate?v!==d.ZOOM||p.noZoom?v!==d.PAN||p.noPan||(R.copy(U(e.pageX,e.pageY)),A.copy(R)):(E.copy(U(e.pageX,e.pageY)),M.copy(E)):(b.copy(I(e.pageX,e.pageY)),x.copy(b)),document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",o,!1),p.dispatchEvent(C))}function a(e){p.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),v!==d.ROTATE||p.noRotate?v!==d.ZOOM||p.noZoom?v!==d.PAN||p.noPan||A.copy(U(e.pageX,e.pageY)):M.copy(U(e.pageX,e.pageY)):(x.copy(b),b.copy(I(e.pageX,e.pageY))))}function o(e){p.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),v=d.NONE,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o),p.dispatchEvent(P))}function s(e){p.enabled!==!1&&(e.preventDefault(),e.stopPropagation(),E.y-=.01*e.deltaY,p.dispatchEvent(C),p.dispatchEvent(P))}function c(e){if(p.enabled!==!1){switch(e.touches.length){case 1:v=d.TOUCH_ROTATE,b.copy(I(e.touches[0].pageX,e.touches[0].pageY)),x.copy(b);break;default:v=d.TOUCH_ZOOM_PAN;var t=e.touches[0].pageX-e.touches[1].pageX,i=e.touches[0].pageY-e.touches[1].pageY;S=T=Math.sqrt(t*t+i*i);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,r=(e.touches[0].pageY+e.touches[1].pageY)/2;R.copy(U(n,r)),A.copy(R)}p.dispatchEvent(C)}}function l(e){if(p.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:x.copy(b),b.copy(I(e.touches[0].pageX,e.touches[0].pageY));break;default:var t=e.touches[0].pageX-e.touches[1].pageX,i=e.touches[0].pageY-e.touches[1].pageY;S=Math.sqrt(t*t+i*i);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,r=(e.touches[0].pageY+e.touches[1].pageY)/2;A.copy(U(n,r))}}function h(e){if(p.enabled!==!1){switch(e.touches.length){case 0:v=d.NONE;break;case 1:v=d.TOUCH_ROTATE,b.copy(I(e.touches[0].pageX,e.touches[0].pageY)),x.copy(b)}p.dispatchEvent(P)}}function u(e){e.preventDefault()}var p=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new THREE.Vector3;var f=1e-6,m=new THREE.Vector3,v=d.NONE,g=d.NONE,y=new THREE.Vector3,x=new THREE.Vector2,b=new THREE.Vector2,w=new THREE.Vector3,_=0,E=new THREE.Vector2,M=new THREE.Vector2,T=0,S=0,R=new THREE.Vector2,A=new THREE.Vector2;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var L={type:"change"},C={type:"start"},P={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var U=function(){var e=new THREE.Vector2;return function(t,i){return e.set((t-p.screen.left)/p.screen.width,(i-p.screen.top)/p.screen.height),e}}(),I=function(){var e=new THREE.Vector2;return function(t,i){return e.set((t-.5*p.screen.width-p.screen.left)/(.5*p.screen.width),(p.screen.height+2*(p.screen.top-i))/p.screen.width),e}}();this.rotateCamera=function(){var e,t=new THREE.Vector3,i=new THREE.Quaternion,n=new THREE.Vector3,r=new THREE.Vector3,a=new THREE.Vector3,o=new THREE.Vector3;return function(){o.set(b.x-x.x,b.y-x.y,0),e=o.length(),e?(y.copy(p.object.position).sub(p.target),n.copy(y).normalize(),r.copy(p.object.up).normalize(),a.crossVectors(r,n).normalize(),r.setLength(b.y-x.y),a.setLength(b.x-x.x),o.copy(r.add(a)),t.crossVectors(o,y).normalize(),e*=p.rotateSpeed,i.setFromAxisAngle(t,e),y.applyQuaternion(i),p.object.up.applyQuaternion(i),w.copy(t),_=e):!p.staticMoving&&_&&(_*=Math.sqrt(1-p.dynamicDampingFactor),y.copy(p.object.position).sub(p.target),i.setFromAxisAngle(w,_),y.applyQuaternion(i),p.object.up.applyQuaternion(i)),x.copy(b)}}(),this.zoomCamera=function(){var e;v===d.TOUCH_ZOOM_PAN?(e=T/S,T=S,y.multiplyScalar(e)):(e=1+(M.y-E.y)*p.zoomSpeed,1!==e&&e>0&&(y.multiplyScalar(e),p.staticMoving?E.copy(M):E.y+=(M.y-E.y)*this.dynamicDampingFactor))},this.panCamera=function(){var e=new THREE.Vector2,t=new THREE.Vector3,i=new THREE.Vector3;return function(){e.copy(A).sub(R),e.lengthSq()&&(e.multiplyScalar(y.length()*p.panSpeed),i.copy(y).cross(p.object.up).setLength(e.x),i.add(t.copy(p.object.up).setLength(e.y)),p.object.position.add(i),p.target.add(i),p.staticMoving?R.copy(A):R.add(e.subVectors(A,R).multiplyScalar(p.dynamicDampingFactor)))}}(),this.checkDistances=function(){p.noZoom&&p.noPan||(y.lengthSq()>p.maxDistance*p.maxDistance&&(p.object.position.addVectors(p.target,y.setLength(p.maxDistance)),E.copy(M)),y.lengthSq()<p.minDistance*p.minDistance&&(p.object.position.addVectors(p.target,y.setLength(p.minDistance)),E.copy(M)))},this.update=function(){y.subVectors(p.object.position,p.target),p.noRotate||p.rotateCamera(),p.noZoom||p.zoomCamera(),p.noPan||p.panCamera(),p.object.position.addVectors(p.target,y),p.checkDistances(),p.object.lookAt(p.target),m.distanceToSquared(p.object.position)>f&&(p.dispatchEvent(L),m.copy(p.object.position))},this.reset=function(){v=d.NONE,g=d.NONE,p.target.copy(p.target0),p.object.position.copy(p.position0),p.object.up.copy(p.up0),y.subVectors(p.object.position,p.target),p.object.lookAt(p.target),p.dispatchEvent(L),m.copy(p.object.position)},this.dispose=function(){this.domElement.removeEventListener("contextmenu",u,!1),this.domElement.removeEventListener("mousedown",r,!1),this.domElement.removeEventListener("wheel",s,!1),this.domElement.removeEventListener("touchstart",c,!1),this.domElement.removeEventListener("touchend",h,!1),this.domElement.removeEventListener("touchmove",l,!1),document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",o,!1),window.removeEventListener("keydown",i,!1),window.removeEventListener("keyup",n,!1)},this.domElement.addEventListener("contextmenu",u,!1),this.domElement.addEventListener("mousedown",r,!1),this.domElement.addEventListener("wheel",s,!1),this.domElement.addEventListener("touchstart",c,!1),this.domElement.addEventListener("touchend",h,!1),this.domElement.addEventListener("touchmove",l,!1),window.addEventListener("keydown",i,!1),window.addEventListener("keyup",n,!1),this.handleResize(),this.update()},THREE.TrackballControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.TrackballControls.prototype.constructor=THREE.TrackballControls;