!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=7)}([function(t,e,n){"use strict";t.exports=n(15)},function(t,e,n){"use strict";function r(t){var e=a.get(t);return void 0===e?"#959595":e}n.d(e,"a",function(){return o}),e.c=r;var i;!function(t){t[t.Invalid=0]="Invalid",t[t.Red=1]="Red",t[t.Green=2]="Green",t[t.Blue=3]="Blue",t[t.Cyan=4]="Cyan",t[t.Yellow=5]="Yellow",t[t.Magenta=6]="Magenta",t[t.Black=7]="Black",t[t.White=8]="White"}(i||(i={})),e.b=i;var o=[i.Red,i.Green,i.Blue,i.Cyan,i.Magenta,i.Yellow,i.Black,i.White],a=new Map([[i.Red,"#FF0000"],[i.Green,"#00FF00"],[i.Blue,"#0000FF"],[i.Cyan,"#00FFFF"],[i.Magenta,"#FF00FF"],[i.Yellow,"#FFFF00"],[i.Black,"#000000"],[i.White,"#FFFFFF"]])},function(t,e,n){"use strict";function r(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,s,l=r(t),c=1;c0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function a(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1}function s(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function l(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function c(t,e,n,r,o,a,s,u,h,p){Object.defineProperty(this,"id",{value:Va++}),this.uuid=Ga.generateUUID(),this.name="",this.image=void 0!==t?t:c.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:c.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Xo,this.wrapT=void 0!==r?r:Xo,this.magFilter=void 0!==o?o:Qo,this.minFilter=void 0!==a?a:$o,this.anisotropy=void 0!==h?h:1,this.format=void 0!==s?s:fa,this.type=void 0!==u?u:ta,this.offset=new i(0,0),this.repeat=new i(1,1),this.center=new i(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new l,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==p?p:Oa,this.version=0,this.onUpdate=null}function u(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1}function h(t,e,n){this.uuid=Ga.generateUUID(),this.width=t,this.height=e,this.scissor=new u(0,0,t,e),this.scissorTest=!1,this.viewport=new u(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=Qo),this.texture=new c(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function p(t,e,n){h.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function d(t,e,n,r,i,o,a,s,l,u,h,p){c.call(this,null,o,a,s,l,u,r,i,h,p),this.image={data:t,width:e,height:n},this.magFilter=void 0!==l?l:Yo,this.minFilter=void 0!==u?u:Yo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function f(t,e,n,r,i,o,a,s,l,u){t=void 0!==t?t:[],e=void 0!==e?e:ko,c.call(this,t,e,n,r,i,o,a,s,l,u),this.flipY=!1}function m(){this.seq=[],this.map={}}function g(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=Xa[i];if(void 0===o&&(o=new Float32Array(i),Xa[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function v(t,e){var n=qa[e];void 0===n&&(n=new Int32Array(e),qa[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function y(t,e){t.uniform1f(this.addr,e)}function x(t,e){t.uniform1i(this.addr,e)}function b(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function _(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function w(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function E(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function M(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Za.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Za))}function T(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Ya.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Ya))}function S(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||ja,r)}function A(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||Wa,r)}function C(t,e){t.uniform2iv(this.addr,e)}function P(t,e){t.uniform3iv(this.addr,e)}function R(t,e){t.uniform4iv(this.addr,e)}function L(t){switch(t){case 5126:return y;case 35664:return b;case 35665:return _;case 35666:return w;case 35674:return E;case 35675:return M;case 35676:return T;case 35678:case 36198:return S;case 35680:return A;case 5124:case 35670:return x;case 35667:case 35671:return C;case 35668:case 35672:return P;case 35669:case 35673:return R}}function I(t,e){t.uniform1fv(this.addr,e)}function O(t,e){t.uniform1iv(this.addr,e)}function N(t,e){t.uniform2fv(this.addr,g(e,this.size,2))}function D(t,e){t.uniform3fv(this.addr,g(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,g(e,this.size,4))}function F(t,e){t.uniformMatrix2fv(this.addr,!1,g(e,this.size,4))}function k(t,e){t.uniformMatrix3fv(this.addr,!1,g(e,this.size,9))}function z(t,e){t.uniformMatrix4fv(this.addr,!1,g(e,this.size,16))}function B(t,e,n){var r=e.length,i=v(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||ja,i[o])}function H(t,e,n){var r=e.length,i=v(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||Wa,i[o])}function G(t){switch(t){case 5126:return I;case 35664:return N;case 35665:return D;case 35666:return U;case 35674:return F;case 35675:return k;case 35676:return z;case 35678:return B;case 35680:return H;case 5124:case 35670:return O;case 35667:case 35671:return C;case 35668:case 35672:return P;case 35669:case 35673:return R}}function V(t,e,n){this.id=t,this.addr=n,this.setValue=L(e.type)}function j(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=G(e.type)}function W(t){this.id=t,m.call(this)}function X(t,e){t.seq.push(e),t.map[e.id]=e}function q(t,e,n){var r=t.name,i=r.length;for(Ka.lastIndex=0;;){var o=Ka.exec(r),a=Ka.lastIndex,s=o[1],l="]"===o[2],c=o[3];if(l&&(s|=0),void 0===c||"["===c&&a+2===i){X(n,void 0===c?new V(s,t,e):new j(s,t,e));break}var u=n.map,h=u[s];void 0===h&&(h=new W(s),X(n,h)),n=h}}function Y(t,e,n){m.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i.001&&L.scale>.001&&(E.x=L.x,E.y=L.y,E.z=L.z,_=L.size*L.scale/h.w,w.x=_*y,w.y=_,e.uniform3f(f.screenPosition,E.x,E.y,E.z),e.uniform2f(f.scale,w.x,w.y),e.uniform1f(f.rotation,L.rotation),e.uniform1f(f.opacity,L.opacity),e.uniform3f(f.color,L.color.r,L.color.g,L.color.b),n.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst),r.setTexture2D(L.texture,1),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}}}n.enable(e.CULL_FACE),n.enable(e.DEPTH_TEST),n.buffers.depth.setMask(!0),n.reset()}}}function J(t,e,n,r,i,o,a,s,l){c.call(this,t,e,n,r,i,o,a,s,l),this.needsUpdate=!0}function $(t,e,n,r,i){function o(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);u=e.createBuffer(),h=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h),e.bufferData(e.ELEMENT_ARRAY_BUFFER,n,e.STATIC_DRAW),p=l(),d={position:e.getAttribLocation(p,"position"),uv:e.getAttribLocation(p,"uv")},f={uvOffset:e.getUniformLocation(p,"uvOffset"),uvScale:e.getUniformLocation(p,"uvScale"),rotation:e.getUniformLocation(p,"rotation"),scale:e.getUniformLocation(p,"scale"),color:e.getUniformLocation(p,"color"),map:e.getUniformLocation(p,"map"),opacity:e.getUniformLocation(p,"opacity"),modelViewMatrix:e.getUniformLocation(p,"modelViewMatrix"),projectionMatrix:e.getUniformLocation(p,"projectionMatrix"),fogType:e.getUniformLocation(p,"fogType"),fogDensity:e.getUniformLocation(p,"fogDensity"),fogNear:e.getUniformLocation(p,"fogNear"),fogFar:e.getUniformLocation(p,"fogFar"),fogColor:e.getUniformLocation(p,"fogColor"),fogDepth:e.getUniformLocation(p,"fogDepth"),alphaTest:e.getUniformLocation(p,"alphaTest")};var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=8,r.height=8;var i=r.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),m=new J(r)}function l(){var t=e.createProgram(),n=e.createShader(e.VERTEX_SHADER),r=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(n,["precision "+i.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvUV = uvOffset + uv * uvScale;","\tvec2 alignedPosition = position * scale;","\tvec2 rotatedPosition;","\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","\tvec4 mvPosition;","\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","\tmvPosition.xy += rotatedPosition;","\tgl_Position = projectionMatrix * mvPosition;","\tfogDepth = - mvPosition.z;","}"].join("\n")),e.shaderSource(r,["precision "+i.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvec4 texture = texture2D( map, vUV );","\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","\tif ( gl_FragColor.a < alphaTest ) discard;","\tif ( fogType > 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),e.compileShader(n),e.compileShader(r),e.attachShader(t,n),e.attachShader(t,r),e.linkProgram(t),t}function c(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var u,h,p,d,f,m,g=new s,v=new a,y=new s;this.render=function(i,a,s){if(0!==i.length){void 0===p&&o(),n.useProgram(p),n.initAttributes(),n.enableAttribute(d.position),n.enableAttribute(d.uv),n.disableUnusedAttributes(),n.disable(e.CULL_FACE),n.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,u),e.vertexAttribPointer(d.position,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(d.uv,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,h),e.uniformMatrix4fv(f.projectionMatrix,!1,s.projectionMatrix.elements),n.activeTexture(e.TEXTURE0),e.uniform1i(f.map,0);var l=0,x=0,b=a.fog;b?(e.uniform3f(f.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(e.uniform1f(f.fogNear,b.near),e.uniform1f(f.fogFar,b.far),e.uniform1i(f.fogType,1),l=1,x=1):b.isFogExp2&&(e.uniform1f(f.fogDensity,b.density),e.uniform1i(f.fogType,2),l=2,x=2)):(e.uniform1i(f.fogType,0),l=0,x=0);for(var _=0,w=i.length;_0:s&&s.isGeometry&&(h=s.morphTargets&&s.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var p=e.isSkinnedMesh&&n.skinning,d=0;h&&(d|=g),p&&(d|=v),l=c[d]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var f=l.uuid,m=n.uuid,y=_[f];void 0===y&&(y={},_[f]=y);var w=y[m];void 0===w&&(w=l.clone(),y[m]=w),l=w}l.visible=n.visible,l.wireframe=n.wireframe;var E=n.side;return R.renderSingleSided&&E==Zi&&(E=qi),R.renderReverseSided&&(E===qi?E=Yi:E===Yi&&(E=qi)),l.side=E,l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,r&&l.isMeshDistanceMaterial&&(l.referencePosition.copy(i),l.nearDistance=o,l.farDistance=a),l}function a(n,i,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||l.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);var c=e.update(n),u=n.material;if(Array.isArray(u))for(var h=c.groups,p=0,d=h.length;pe&&(e=t[n]);return e}function Ct(){Object.defineProperty(this,"id",{value:os+=2}),this.uuid=Ga.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Pt(t,e,n,r,i,o){mt.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Rt(t,e,n,r,i,o)),this.mergeVertices()}function Rt(t,e,n,r,i,o){function a(t,e,n,r,i,o,a,m,g,v,y){var x,b,_=o/g,w=a/v,E=o/2,M=a/2,T=m/2,S=g+1,A=v+1,C=0,P=0,R=new s;for(b=0;b0?1:-1,h.push(R.x,R.y,R.z),p.push(x/g),p.push(1-b/v),C+=1}}for(b=0;b1&&o.sort(Bt),a.length>1&&a.sort(Ht)}var r=[],i=0,o=[],a=[];return{opaque:o,transparent:a,init:t,push:e,sort:n}}function Vt(){function t(t,e){var r=t.id+","+e.id,i=n[r];return void 0===i&&(i=new Gt,n[r]=i),i}function e(){n={}}var n={};return{get:t,dispose:e}}function jt(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Wt(t){function e(e,i,o,a){var s=e.morphTargetInfluences,l=s.length,c=n[i.id];if(void 0===c){c=[];for(var u=0;u65535?Et:_t)(i,1),e.update(r,t.ELEMENT_ARRAY_BUFFER),l[n.id]=r,r}var s={},l={};return{get:i,update:o,getWireframeAttribute:a}}function Zt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new s,color:new Z,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new s,direction:new s,color:new Z,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new s,color:new Z,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new s,skyColor:new Z,groundColor:new Z};break;case"RectAreaLight":n={color:new Z,position:new s,halfWidth:new s,halfHeight:new s}}return t[e.id]=n,n}}}function Kt(){function t(t,o,s){for(var l=0,c=0,u=0,h=0,p=0,d=0,f=0,m=0,g=s.matrixWorldInverse,v=0,y=t.length;v");return ce(n)}var n=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(n,e)}function ue(t){function e(t,e,n,r){for(var i="",o=parseInt(e);o0?t.gammaFactor:1,v=ie(r.extensions,o,e),y=oe(s),x=a.createProgram();r.isRawShaderMaterial?(f=[y].filter(se).join("\n"),f.length>0&&(f+="\n"),m=[v,y].filter(se).join("\n"),m.length>0&&(m+="\n")):(f=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+i.name,y,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+o.numClippingPlanes,o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+u:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(se).join("\n"),m=[v,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+i.name,y,o.alphaTest?"#define ALPHATEST "+o.alphaTest:"","#define GAMMA_FACTOR "+g,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+h:"",o.envMap?"#define "+p:"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+o.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(o.numClippingPlanes-o.numClipIntersection),o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+u:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&e.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&e.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==Oo?"#define TONE_MAPPING":"",o.toneMapping!==Oo?ts.tonemapping_pars_fragment:"",o.toneMapping!==Oo?re("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?ts.encodings_pars_fragment:"",o.mapEncoding?ee("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?ee("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?ee("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?ne("linearToOutputTexel",o.outputEncoding):"",o.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(se).join("\n")),l=ce(l),l=le(l,o),c=ce(c),c=le(c,o),r.isShaderMaterial||(l=ue(l),c=ue(c));var b=f+l,_=m+c,w=$t(a,a.VERTEX_SHADER,b),E=$t(a,a.FRAGMENT_SHADER,_);a.attachShader(x,w),a.attachShader(x,E),void 0!==r.index0AttributeName?a.bindAttribLocation(x,0,r.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(x,0,"position"),a.linkProgram(x);var M=a.getProgramInfoLog(x),T=a.getShaderInfoLog(w),S=a.getShaderInfoLog(E),A=!0,C=!0;!1===a.getProgramParameter(x,a.LINK_STATUS)?(A=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(x,a.VALIDATE_STATUS),"gl.getProgramInfoLog",M,T,S)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==T&&""!==S||(C=!1),C&&(this.diagnostics={runnable:A,material:r,programLog:M,vertexShader:{log:T,prefix:f},fragmentShader:{log:S,prefix:m}}),a.deleteShader(w),a.deleteShader(E);var P;this.getUniforms=function(){return void 0===P&&(P=new Y(a,x,t)),P};var R;return this.getAttributes=function(){return void 0===R&&(R=ae(a,x)),R},this.destroy=function(){a.deleteProgram(x),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=as++,this.code=n,this.usedTimes=1,this.program=x,this.vertexShader=w,this.fragmentShader=E,this}function pe(t,e,n){function r(t){var e=t.skeleton,r=e.bones;if(n.floatVertexTextures)return 1024;var i=n.maxVertexUniforms,o=Math.floor((i-20)/4),a=Math.min(o,r.length);return a0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numClippingPlanes:c,numClipIntersection:u,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&s.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===Zi,flipSided:e.side===Yi,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,n){var r=[];if(n.shaderID?r.push(n.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(var o=0;oe||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);return r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function l(t){return Ga.isPowerOfTwo(t.width)&&Ga.isPowerOfTwo(t.height)}function c(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageBitmap){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=Ga.floorPowerOfTwo(t.width),e.height=Ga.floorPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function u(t){return t.wrapS!==Xo||t.wrapT!==Xo||t.minFilter!==Yo&&t.minFilter!==Qo}function h(t,e){return t.generateMipmaps&&e&&t.minFilter!==Yo&&t.minFilter!==Qo}function p(e){return e===Yo||e===Zo||e===Ko?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),a.textures--}function f(t){var e=t.target;e.removeEventListener("dispose",f),g(e),a.textures--}function m(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.remove(e)}function g(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.remove(e.texture),r.remove(e)}}function v(e,i){var o=r.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void _(o,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,o.__webglTexture)}function y(e,c){var u=r.get(e);if(6===e.image.length)if(e.version>0&&u.__version!==e.version){u.__image__webglTextureCube||(e.addEventListener("dispose",d),u.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+c),n.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var p=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=p||f?f?e.image[g].image:e.image[g]:s(e.image[g],i.maxCubemapSize);var v=m[0],y=l(v),x=o.convert(e.format),_=o.convert(e.type);b(t.TEXTURE_CUBE_MAP,e,y);for(var g=0;g<6;g++)if(p)for(var w,E=m[g].mipmaps,M=0,T=E.length;M-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,x,_,w.data);else f?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,m[g].width,m[g].height,0,x,_,m[g].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,x,_,m[g]);h(e,y)&&t.generateMipmap(t.TEXTURE_CUBE_MAP),u.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+c),n.bindTexture(t.TEXTURE_CUBE_MAP,u.__image__webglTextureCube)}function x(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function b(n,a,s){var l;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o.convert(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o.convert(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o.convert(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o.convert(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===Xo&&a.wrapT===Xo||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,p(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,p(a.minFilter)),a.minFilter!==Yo&&a.minFilter!==Qo&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),l=e.get("EXT_texture_filter_anisotropic")){if(a.type===aa&&null===e.get("OES_texture_float_linear"))return;if(a.type===sa&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function _(e,r,p){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+p),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var f=s(r.image,i.maxTextureSize);u(r)&&!1===l(f)&&(f=c(f));var m=l(f),g=o.convert(r.format),v=o.convert(r.type);b(t.TEXTURE_2D,r,m);var y,x=r.mipmaps;if(r.isDepthTexture){var _=t.DEPTH_COMPONENT;if(r.type===aa){if(!C)throw new Error("Float Depth Texture only supported in WebGL2.0");_=t.DEPTH_COMPONENT32F}else C&&(_=t.DEPTH_COMPONENT16);r.format===va&&_===t.DEPTH_COMPONENT&&r.type!==ra&&r.type!==oa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=ra,v=o.convert(r.type)),r.format===ya&&(_=t.DEPTH_STENCIL,r.type!==ha&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ha,v=o.convert(r.type))),n.texImage2D(t.TEXTURE_2D,0,_,f.width,f.height,0,g,v,null)}else if(r.isDataTexture)if(x.length>0&&m){for(var w=0,E=x.length;w-1?n.compressedTexImage2D(t.TEXTURE_2D,w,g,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,w,g,y.width,y.height,0,g,v,y.data);else if(x.length>0&&m){for(var w=0,E=x.length;w=1,nt=null,rt={},it=new u,ot=new u,at={};return at[t.TEXTURE_2D]=a(t.TEXTURE_2D,t.TEXTURE_2D,1),at[t.TEXTURE_CUBE_MAP]=a(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),R.setClear(0,0,0,1),L.setClear(1),I.setClear(0),p(t.DEPTH_TEST),L.setFunc(To),y(!1),x(Gi),p(t.CULL_FACE),p(t.BLEND),g(to),{buffers:{color:R,depth:L,stencil:I},initAttributes:s,enableAttribute:l,enableAttributeAndDivisor:c,disableUnusedAttributes:h,enable:p,disable:d,getCompressedTextureFormats:f,useProgram:m,setBlending:g,setMaterial:v,setFlipSided:y,setCullFace:x,setLineWidth:b,setPolygonOffset:_,setScissorTest:w,activeTexture:E,bindTexture:M,compressedTexImage2D:T,texImage2D:S,scissor:A,viewport:C,reset:P}}function ge(t,e,n){function r(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var l=!0===n.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=u>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function ve(t,e,n,r){pt.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function ye(t){ve.call(this),this.cameras=t||[]}function xe(t){function e(){if(null!==r&&r.isPresenting){var e=r.getEyeParameters("left"),i=e.renderWidth,o=e.renderHeight;f=t.getPixelRatio(),d=t.getSize(),t.setDrawingBufferSize(2*i,o,1)}else n.enabled&&t.setDrawingBufferSize(d.width,d.height,f)}var n=this,r=null,i=null;"undefined"!==typeof window&&"VRFrameData"in window&&(i=new window.VRFrameData);var a=new o,s=new o,l=new o,c=new ve;c.bounds=new u(0,0,.5,1),c.layers.enable(1);var h=new ve;h.bounds=new u(.5,0,.5,1),h.layers.enable(2);var p=new ye([c,h]);p.layers.enable(1),p.layers.enable(2);var d,f;"undefined"!==typeof window&&window.addEventListener("vrdisplaypresentchange",e,!1),this.enabled=!1,this.standing=!1,this.getDevice=function(){return r},this.setDevice=function(t){void 0!==t&&(r=t)},this.getCamera=function(t){if(null===r)return t;r.depthNear=t.near,r.depthFar=t.far,r.getFrameData(i);var e=i.pose;null!==e.position?t.position.fromArray(e.position):t.position.set(0,0,0),null!==e.orientation&&t.quaternion.fromArray(e.orientation),t.updateMatrixWorld();var n=r.stageParameters;if(this.standing&&n&&(s.fromArray(n.sittingToStandingTransform),l.getInverse(s),t.matrixWorld.multiply(s),t.matrixWorldInverse.multiply(l)),!1===r.isPresenting)return t;c.near=t.near,h.near=t.near,c.far=t.far,h.far=t.far,p.matrixWorld.copy(t.matrixWorld),p.matrixWorldInverse.copy(t.matrixWorldInverse),c.matrixWorldInverse.fromArray(i.leftViewMatrix),h.matrixWorldInverse.fromArray(i.rightViewMatrix),this.standing&&n&&(c.matrixWorldInverse.multiply(l),h.matrixWorldInverse.multiply(l));var o=t.parent;null!==o&&(a.getInverse(o.matrixWorld),c.matrixWorldInverse.multiply(a),h.matrixWorldInverse.multiply(a)),c.matrixWorld.getInverse(c.matrixWorldInverse),h.matrixWorld.getInverse(h.matrixWorldInverse),c.projectionMatrix.fromArray(i.leftProjectionMatrix),h.projectionMatrix.fromArray(i.rightProjectionMatrix),p.projectionMatrix.copy(c.projectionMatrix);var u=r.getLayers();if(u.length){var d=u[0];null!==d.leftBounds&&4===d.leftBounds.length&&c.bounds.fromArray(d.leftBounds),null!==d.rightBounds&&4===d.rightBounds.length&&h.bounds.fromArray(d.rightBounds)}return p},this.getStandingMatrix=function(){return s},this.submitFrame=function(){r&&r.isPresenting&&r.submitFrame()},this.dispose=function(){"undefined"!==typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function be(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}function _e(){function t(){u.value!==r&&(u.value=r,u.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function e(t,e,r,i){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=u.value,!0!==i||null===a){var l=r+4*o,h=e.matrixWorldInverse;c.getNormalMatrix(h),(null===a||a.length=0){var c=i[s];if(void 0!==c){var u=c.normalized,h=c.itemSize,p=Nt.get(c);if(void 0===p)continue;var d=p.buffer,f=p.type,m=p.bytesPerElement;if(c.isInterleavedBufferAttribute){var g=c.data,v=g.stride,y=c.offset;g&&g.isInstancedInterleavedBuffer?(Lt.enableAttributeAndDivisor(l,g.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=g.meshPerAttribute*g.count)):Lt.enableAttribute(l),At.bindBuffer(At.ARRAY_BUFFER,d),At.vertexAttribPointer(l,h,f,u,v*m,(r*v+y)*m)}else c.isInstancedBufferAttribute?(Lt.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):Lt.enableAttribute(l),At.bindBuffer(At.ARRAY_BUFFER,d),At.vertexAttribPointer(l,h,f,u,0,r*h*m)}else if(void 0!==a){var x=a[s];if(void 0!==x)switch(x.length){case 2:At.vertexAttrib2fv(l,x);break;case 3:At.vertexAttrib3fv(l,x);break;case 4:At.vertexAttrib4fv(l,x);break;default:At.vertexAttrib1fv(l,x)}}}}Lt.disableUnusedAttributes()}function f(){if(!re){var t=ee.getDevice();t&&t.isPresenting?t.requestAnimationFrame(m):window.requestAnimationFrame(m),re=!0}}function m(t){null!==ie&&ie(t);var e=ee.getDevice();e&&e.isPresenting?e.requestAnimationFrame(m):window.requestAnimationFrame(m)}function g(t,e,n){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isLight)j.push(t),t.castShadow&&W.push(t);else if(t.isSprite)t.frustumCulled&&!xt.intersectsSprite(t)||q.push(t);else if(t.isLensFlare)Z.push(t);else if(t.isImmediateRenderObject)n&&Mt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Et),X.push(t,null,t.material,Mt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||xt.intersectsObject(t))){n&&Mt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Et);var r=Ut.update(t),i=t.material;if(Array.isArray(i))for(var o=r.groups,a=0,s=o.length;a=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var p=0;p=0&&t.numSupportedMorphNormals++}var d=r.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=bt.numPlanes,r.numIntersection=bt.numIntersection,d.clippingPlanes=bt.uniform),r.fog=e,r.lightsHash=Ft.state.hash,t.lights&&(d.ambientLightColor.value=Ft.state.ambient,d.directionalLights.value=Ft.state.directional,d.spotLights.value=Ft.state.spot,d.rectAreaLights.value=Ft.state.rectArea,d.pointLights.value=Ft.state.point,d.hemisphereLights.value=Ft.state.hemi,d.directionalShadowMap.value=Ft.state.directionalShadowMap,d.directionalShadowMatrix.value=Ft.state.directionalShadowMatrix,d.spotShadowMap.value=Ft.state.spotShadowMap,d.spotShadowMatrix.value=Ft.state.spotShadowMatrix,d.pointShadowMap.value=Ft.state.pointShadowMap,d.pointShadowMatrix.value=Ft.state.pointShadowMatrix);var f=r.program.getUniforms(),m=Y.seqWithValue(f.seq,d);r.uniformsList=m}function b(t,e,n,r){pt=0;var i=It.get(n);if(_t&&(wt||t!==it)){var o=t===it&&n.id===nt;bt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==Ft.state.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===bt.numPlanes&&i.numIntersection===bt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(x(n,e,r),n.needsUpdate=!1);var a=!1,s=!1,l=!1,c=i.program,u=c.getUniforms(),h=i.shader.uniforms;if(Lt.useProgram(c.program)&&(a=!0,s=!0,l=!0),n.id!==nt&&(nt=n.id,s=!0),a||t!==it){if(u.setValue(At,"projectionMatrix",t.projectionMatrix),Rt.logarithmicDepthBuffer&&u.setValue(At,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),it!==(ot||t)&&(it=ot||t,s=!0,l=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var p=u.map.cameraPosition;void 0!==p&&p.setValue(At,Mt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&u.setValue(At,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){u.setOptional(At,r,"bindMatrix"),u.setOptional(At,r,"bindMatrixInverse");var f=r.skeleton;if(f){var m=f.bones;if(Rt.floatVertexTextures){if(void 0===f.boneTexture){var g=Math.sqrt(4*m.length);g=Ga.ceilPowerOfTwo(g),g=Math.max(g,4);var v=new Float32Array(g*g*4);v.set(f.boneMatrices);var y=new d(v,g,g,fa,aa);f.boneMatrices=v,f.boneTexture=y,f.boneTextureSize=g}u.setValue(At,"boneTexture",f.boneTexture),u.setValue(At,"boneTextureSize",f.boneTextureSize)}else u.setOptional(At,f,"boneMatrices")}}return s&&(u.setValue(At,"toneMappingExposure",K.toneMappingExposure),u.setValue(At,"toneMappingWhitePoint",K.toneMappingWhitePoint),n.lights&&N(h,l),e&&n.fog&&T(h,e),n.isMeshBasicMaterial?_(h,n):n.isMeshLambertMaterial?(_(h,n),S(h,n)):n.isMeshPhongMaterial?(_(h,n),n.isMeshToonMaterial?C(h,n):A(h,n)):n.isMeshStandardMaterial?(_(h,n),n.isMeshPhysicalMaterial?R(h,n):P(h,n)):n.isMeshDepthMaterial?(_(h,n),L(h,n)):n.isMeshDistanceMaterial?(_(h,n),I(h,n)):n.isMeshNormalMaterial?(_(h,n),O(h,n)):n.isLineBasicMaterial?(w(h,n),n.isLineDashedMaterial&&E(h,n)):n.isPointsMaterial?M(h,n):n.isShadowMaterial&&(h.color.value=n.color,h.opacity.value=n.opacity),void 0!==h.ltcMat&&(h.ltcMat.value=Ja.LTC_MAT_TEXTURE),void 0!==h.ltcMag&&(h.ltcMag.value=Ja.LTC_MAG_TEXTURE),Y.upload(At,i.uniformsList,h,K)),u.setValue(At,"modelViewMatrix",r.modelViewMatrix),u.setValue(At,"normalMatrix",r.normalMatrix),u.setValue(At,"modelMatrix",r.matrixWorld),c}function _(t,e){t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){if(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate){var r=n.offset,i=n.repeat,o=n.rotation,a=n.center;n.matrix.setUvTransform(r.x,r.y,i.x,i.y,o,a.x,a.y)}t.uvTransform.value.copy(n.matrix)}}function w(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function E(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*mt,t.scale.value=.5*ft,t.map.value=e.map,null!==e.map){if(!0===e.map.matrixAutoUpdate){var n=e.map.offset,r=e.map.repeat,i=e.map.rotation,o=e.map.center;e.map.matrix.setUvTransform(n.x,n.y,r.x,r.y,i,o.x,o.y)}t.uvTransform.value.copy(e.map.matrix)}}function T(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function S(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function A(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function C(t,e){A(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function P(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function R(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,P(t,e)}function L(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function I(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}function O(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function N(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function D(){var t=pt;return t>=Rt.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+Rt.maxTextures),pt+=1,t}console.log("THREE.WebGLRenderer",Bi),t=t||{};var U=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),F=void 0!==t.context?t.context:null,k=void 0!==t.alpha&&t.alpha,z=void 0===t.depth||t.depth,B=void 0===t.stencil||t.stencil,H=void 0!==t.antialias&&t.antialias,G=void 0===t.premultipliedAlpha||t.premultipliedAlpha,V=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,j=[],W=[],X=null,q=[],Z=[];this.domElement=U,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=No,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var K=this,J=!1,tt=null,et=null,nt=-1,rt="",it=null,ot=null,ct=new u,ut=new u,ht=null,pt=0,dt=U.width,ft=U.height,mt=1,gt=new u(0,0,dt,ft),vt=new u(0,0,dt,ft),yt=!1,xt=new at,bt=new _e,_t=!1,wt=!1,Et=new o,Mt=new s,Tt={geometries:0,textures:0},St={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:St,memory:Tt,programs:null};var At;try{var Ct={alpha:k,depth:z,stencil:B,antialias:H,premultipliedAlpha:G,preserveDrawingBuffer:V};if(null===(At=F||U.getContext("webgl",Ct)||U.getContext("experimental-webgl",Ct)))throw null!==U.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===At.getShaderPrecisionFormat&&(At.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),U.addEventListener("webglcontextlost",r,!1),U.addEventListener("webglcontextrestored",i,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Pt,Rt,Lt,It,Ot,Nt,Dt,Ut,Ft,kt,Bt,Ht,Gt,jt,Zt,Jt,$t,te;n();var ee=new xe(K);this.vr=ee;var ne=new st(K,Ut,Rt.maxTextureSize);this.shadowMap=ne,this.getContext=function(){return At},this.getContextAttributes=function(){return At.getContextAttributes()},this.forceContextLoss=function(){var t=Pt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=Pt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return mt},this.setPixelRatio=function(t){void 0!==t&&(mt=t,this.setSize(dt,ft,!1))},this.getSize=function(){return{width:dt,height:ft}},this.setSize=function(t,e,n){var r=ee.getDevice();if(r&&r.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");dt=t,ft=e,U.width=t*mt,U.height=e*mt,!1!==n&&(U.style.width=t+"px",U.style.height=e+"px"),this.setViewport(0,0,t,e)},this.getDrawingBufferSize=function(){return{width:dt*mt,height:ft*mt}},this.setDrawingBufferSize=function(t,e,n){dt=t,ft=e,mt=n,U.width=t*n,U.height=e*n,this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){gt.set(t,ft-e-r,n,r),Lt.viewport(ct.copy(gt).multiplyScalar(mt))},this.setScissor=function(t,e,n,r){vt.set(t,ft-e-r,n,r),Lt.scissor(ut.copy(vt).multiplyScalar(mt))},this.setScissorTest=function(t){Lt.setScissorTest(yt=t)},this.getClearColor=function(){return Ht.getClearColor()},this.setClearColor=function(){Ht.setClearColor.apply(Ht,arguments)},this.getClearAlpha=function(){return Ht.getClearAlpha()},this.setClearAlpha=function(){Ht.setClearAlpha.apply(Ht,arguments)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=At.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=At.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=At.STENCIL_BUFFER_BIT),At.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.dispose=function(){U.removeEventListener("webglcontextlost",r,!1),U.removeEventListener("webglcontextrestored",i,!1),Bt.dispose(),ee.dispose()},this.renderBufferImmediate=function(t,e,n){Lt.initAttributes();var r=It.get(t);t.hasPositions&&!r.position&&(r.position=At.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=At.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=At.createBuffer()),t.hasColors&&!r.color&&(r.color=At.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(At.bindBuffer(At.ARRAY_BUFFER,r.position),At.bufferData(At.ARRAY_BUFFER,t.positionArray,At.DYNAMIC_DRAW),Lt.enableAttribute(i.position),At.vertexAttribPointer(i.position,3,At.FLOAT,!1,0,0)),t.hasNormals){if(At.bindBuffer(At.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&!0===n.flatShading)for(var o=0,a=3*t.count;o0&&m.renderInstances(r,w,M):m.render(w,M)}},this.compile=function(t,e){j.length=0,W.length=0,t.traverse(function(t){t.isLight&&(j.push(t),t.castShadow&&W.push(t))}),Ft.setup(j,W,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&At.readPixels(e,n,r,i,te.convert(c),te.convert(u),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&At.bindFramebuffer(At.FRAMEBUFFER,et)}}}}function Me(t,e){this.name="",this.color=new Z(t),this.density=void 0!==e?e:25e-5}function Te(t,e,n){this.name="",this.color=new Z(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Se(){ht.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Ae(t,e,n,r,i){ht.call(this),this.lensFlares=[],this.positionScreen=new s,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)}function Ce(t){tt.call(this),this.type="SpriteMaterial",this.color=new Z(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Pe(t){ht.call(this),this.type="Sprite",this.material=void 0!==t?t:new Ce}function Re(){ht.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Le(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0),requestAnimationFrame(u)}c.call(this,t,e,n,r,i,o,a,s,l),this.generateMipmaps=!1;var h=this;requestAnimationFrame(u)}function Ge(t,e,n,r,i,o,a,s,l,u,h,p){c.call(this,null,o,a,s,l,u,r,i,h,p),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ve(t,e,n,r,i,o,a,s,l,u){if((u=void 0!==u?u:va)!==va&&u!==ya)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===va&&(n=ra),void 0===n&&u===ya&&(n=ha),c.call(this,null,r,i,o,a,s,u,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:Yo,this.minFilter=void 0!==s?s:Yo,this.flipY=!1,this.generateMipmaps=!1}function je(t){Ct.call(this),this.type="WireframeGeometry";var e,n,r,i,o,a,l,c,u,h,p=[],d=[0,0],f={},m=["a","b","c"];if(t&&t.isGeometry){var g=t.faces;for(e=0,r=g.length;e=0?(p=t(v-1e-5,g,p),d.subVectors(h,p)):(p=t(v+1e-5,g,p),d.subVectors(p,h)),g-1e-5>=0?(p=t(v,g-1e-5,p),f.subVectors(h,p)):(p=t(v,g+1e-5,p),f.subVectors(p,h)),u.crossVectors(d,f).normalize(),l.push(u.x,u.y,u.z),c.push(v,g)}}for(r=0;r.9&&o<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),r<.2&&(m[t+4]+=1))}}function l(t){f.push(t.x,t.y,t.z)}function c(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function u(){for(var t=new s,e=new s,n=new s,r=new s,o=new i,a=new i,l=new i,c=0,u=0;c0)&&m.push(w,E,T),(c!==n-1||u0&&u(!0),e>0&&u(!1)),this.setIndex(p),this.addAttribute("position",new Mt(d,3)),this.addAttribute("normal",new Mt(f,3)),this.addAttribute("uv",new Mt(m,2))}function Tn(t,e,n,r,i,o,a){En.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function Sn(t,e,n,r,i,o,a){Mn.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function An(t,e,n,r){mt.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new Cn(t,e,n,r)),this.mergeVertices()}function Cn(t,e,n,r){Ct.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||1,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,l=[],c=[],u=[],h=[],p=new s,d=new i;for(c.push(0,0,0),u.push(0,0,1),h.push(.5,.5),a=0,o=3;a<=e;a++,o+=3){var f=n+a/e*r;p.x=t*Math.cos(f),p.y=t*Math.sin(f),c.push(p.x,p.y,p.z),u.push(0,0,1),d.x=(c[o]/t+1)/2,d.y=(c[o+1]/t+1)/2,h.push(d.x,d.y)}for(o=1;o<=e;o++)l.push(o,o+1,0);this.setIndex(l),this.addAttribute("position",new Mt(c,3)),this.addAttribute("normal",new Mt(u,3)),this.addAttribute("uv",new Mt(h,2))}function Pn(t){tt.call(this),this.type="ShadowMaterial",this.color=new Z(0),this.opacity=1,this.lights=!0,this.transparent=!0,this.setValues(t)}function Rn(t){Nt.call(this,t),this.type="RawShaderMaterial"}function Ln(t){tt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Z(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 Z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function In(t){Ln.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function On(t){tt.call(this),this.type="MeshPhongMaterial",this.color=new Z(16777215),this.specular=new Z(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Z(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=Ro,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Nn(t){On.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Dn(t){tt.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Un(t){tt.call(this),this.type="MeshLambertMaterial",this.color=new Z(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Z(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ro,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Fn(t){Ne.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function kn(t,e,n){var r=this,i=!1,o=0,a=0,s=void 0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===i&&void 0!==r.onStart&&r.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){s=t}}function zn(t){this.manager=void 0!==t?t:hs}function Bn(t){this.manager=void 0!==t?t:hs,this._parser=null}function Hn(t){this.manager=void 0!==t?t:hs,this._parser=null}function Gn(t){this.manager=void 0!==t?t:hs}function Vn(t){this.manager=void 0!==t?t:hs}function jn(t){this.manager=void 0!==t?t:hs}function Wn(t,e){ht.call(this),this.type="Light",this.color=new Z(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Xn(t,e,n){Wn.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ht.DefaultUp),this.updateMatrix(),this.groundColor=new Z(e)}function qn(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new o}function Yn(){qn.call(this,new ve(50,1,.5,500))}function Zn(t,e,n,r,i,o){Wn.call(this,t,e),this.type="SpotLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Yn}function Kn(t,e,n,r){Wn.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new qn(new ve(90,1,.5,500))}function Qn(){qn.call(this,new dt(-5,5,5,-5,.5,500))}function Jn(t,e){Wn.call(this,t,e),this.type="DirectionalLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.shadow=new Qn}function $n(t,e){Wn.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function tr(t,e,n,r){Wn.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function er(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function nr(t,e,n,r){er.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function rr(t,e,n,r){er.call(this,t,e,n,r)}function ir(t,e,n,r){er.call(this,t,e,n,r)}function or(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=ds.convertArray(e,this.TimeBufferType),this.values=ds.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function ar(t,e,n,r){or.call(this,t,e,n,r)}function sr(t,e,n,r){er.call(this,t,e,n,r)}function lr(t,e,n,r){or.call(this,t,e,n,r)}function cr(t,e,n,r){or.call(this,t,e,n,r)}function ur(t,e,n,r){or.call(this,t,e,n,r)}function hr(t,e,n){or.call(this,t,e,n)}function pr(t,e,n,r){or.call(this,t,e,n,r)}function dr(t,e,n,r){or.apply(this,t,e,n,r)}function fr(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=Ga.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function mr(t){this.manager=void 0!==t?t:hs,this.textures={}}function gr(t){this.manager=void 0!==t?t:hs}function vr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function yr(t){"boolean"===typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:hs,this.withCredentials=!1}function xr(t){this.manager=void 0!==t?t:hs,this.texturePath=""}function br(t,e,n,r,i){var o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function _r(t,e){var n=1-t;return n*n*e}function wr(t,e){return 2*(1-t)*t*e}function Er(t,e){return t*t*e}function Mr(t,e,n,r){return _r(t,e)+wr(t,n)+Er(t,r)}function Tr(t,e){var n=1-t;return n*n*n*e}function Sr(t,e){var n=1-t;return 3*n*n*t*e}function Ar(t,e){return 3*(1-t)*t*t*e}function Cr(t,e){return t*t*t*e}function Pr(t,e,n,r,i){return Tr(t,e)+Sr(t,n)+Ar(t,r)+Cr(t,i)}function Rr(){this.type="Curve",this.arcLengthDivisions=200}function Lr(t,e){Rr.call(this),this.type="LineCurve",this.v1=t||new i,this.v2=e||new i}function Ir(){Rr.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Or(t,e,n,r,i,o,a,s){Rr.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function Nr(t){Rr.call(this),this.type="SplineCurve",this.points=t||[]}function Dr(t,e,n,r){Rr.call(this),this.type="CubicBezierCurve",this.v0=t||new i,this.v1=e||new i,this.v2=n||new i,this.v3=r||new i}function Ur(t,e,n){Rr.call(this),this.type="QuadraticBezierCurve",this.v0=t||new i,this.v1=e||new i,this.v2=n||new i}function Fr(t){Ir.call(this),this.type="Path",this.currentPoint=new i,t&&this.setFromPoints(t)}function kr(t){Fr.call(this,t),this.type="Shape",this.holes=[]}function zr(){this.type="ShapePath",this.subPaths=[],this.currentPath=null}function Br(t){this.type="Font",this.data=t}function Hr(t){this.manager=void 0!==t?t:hs}function Gr(t){this.manager=void 0!==t?t:hs}function Vr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ve,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ve,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function jr(t,e,n){ht.call(this),this.type="CubeCamera";var r=new ve(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new s(1,0,0)),this.add(r);var i=new ve(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new s(-1,0,0)),this.add(i);var o=new ve(90,1,t,e);o.up.set(0,0,1),o.lookAt(new s(0,1,0)),this.add(o);var a=new ve(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new s(0,-1,0)),this.add(a);var l=new ve(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new s(0,0,1)),this.add(l);var c=new ve(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new s(0,0,-1)),this.add(c);var u={format:da,magFilter:Qo,minFilter:Qo};this.renderTarget=new p(n,n,u),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,s=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,r,n),n.activeCubeFace=1,t.render(e,i,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,l,n),n.texture.generateMipmaps=s,n.activeCubeFace=5,t.render(e,c,n),t.setRenderTarget(null)},this.clear=function(t,e,n,r){for(var i=this.renderTarget,o=0;o<6;o++)i.activeCubeFace=o,t.setRenderTarget(i),t.clear(e,n,r);t.setRenderTarget(null)}}function Wr(){ht.call(this),this.type="AudioListener",this.context=_s.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Xr(t){ht.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function qr(t){Xr.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Yr(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Zr(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Kr(t,e,n){var r=n||Qr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Qr(t,e,n){this.path=e,this.parsedPath=n||Qr.parseTrackName(e),this.node=Qr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Jr(){this.uuid=Ga.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $r(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:Pa,endingEnd:Pa},s=0;s!==i;++s){var l=r[s].createInterpolant(null);o[s]=l,l.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ca,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 ti(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function ei(t){"string"===typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function ni(){Ct.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function ri(t,e,n,r){this.uuid=Ga.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function ii(t,e){this.uuid=Ga.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function oi(t,e,n){ii.call(this,t,e),this.meshPerAttribute=n||1}function ai(t,e,n){gt.call(this,t,e),this.meshPerAttribute=n||1}function si(t,e,n,r){this.ray=new Dt(t,e),this.near=n||0,this.far=r||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 li(t,e){return t.distance-e.distance}function ci(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,o=0,a=i.length;o0?1:+t}),"name"in Function.prototype===!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n>=4,r+=e[19===i?3&t|8:t]);return r}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ga.DEG2RAD},radToDeg:function(t){return t*Ga.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};Object.defineProperties(i.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(i.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new i,e=new i;return function(n,r){return t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}}),Object.assign(o.prototype,{isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,l,c,u,h,p,d,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=p,g[7]=d,g[11]=f,g[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 o).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new s;return function(e){var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){var h=o*c,p=o*u,d=a*c,f=a*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=p+d*l,e[5]=h-f*l,e[9]=-a*s,e[2]=f-h*l,e[6]=d+p*l,e[10]=o*s}else if("YXZ"===t.order){var m=s*c,g=s*u,v=l*c,y=l*u;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*l,e[1]=o*u,e[5]=o*c,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*c,g=s*u,v=l*c,y=l*u;e[0]=m-y*a,e[4]=-o*u,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*c,e[9]=y-m*a,e[2]=-o*l,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var h=o*c,p=o*u,d=a*c,f=a*u;e[0]=s*c,e[4]=d*l-p,e[8]=h*l+f,e[1]=s*u,e[5]=f*l+h,e[9]=p*l-d,e[2]=-l,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var x=o*s,b=o*l,_=a*s,w=a*l;e[0]=s*c,e[4]=w-x*u,e[8]=_*u+b,e[1]=u,e[5]=o*c,e[9]=-a*c,e[2]=-l*c,e[6]=b*u+_,e[10]=x-w*u}else if("XZY"===t.order){var x=o*s,b=o*l,_=a*s,w=a*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=x*u+w,e[5]=o*c,e[9]=b*u-_,e[2]=_*u-b,e[6]=a*c,e[10]=w*u+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,r=t._y,i=t._z,o=t._w,a=n+n,s=r+r,l=i+i,c=n*a,u=n*s,h=n*l,p=r*s,d=r*l,f=i*l,m=o*a,g=o*s,v=o*l;return e[0]=1-(p+f),e[4]=u-v,e[8]=h+g,e[1]=u+v,e[5]=1-(c+f),e[9]=d-m,e[2]=h-g,e[6]=d+m,e[10]=1-(c+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new s,e=new s,n=new s;return function(r,i,o){var a=this.elements;return n.subVectors(r,i),0===n.lengthSq()&&(n.z=1),n.normalize(),t.crossVectors(o,n),0===t.lengthSq()&&(1===Math.abs(o.z)?n.x+=1e-4:n.z+=1e-4,n.normalize(),t.crossVectors(o,n)),t.normalize(),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=r[0],w=r[4],E=r[8],M=r[12],T=r[1],S=r[5],A=r[9],C=r[13],P=r[2],R=r[6],L=r[10],I=r[14],O=r[3],N=r[7],D=r[11],U=r[15];return i[0]=o*_+a*T+s*P+l*O,i[4]=o*w+a*S+s*R+l*N,i[8]=o*E+a*A+s*L+l*D,i[12]=o*M+a*C+s*I+l*U,i[1]=c*_+u*T+h*P+p*O,i[5]=c*w+u*S+h*R+p*N,i[9]=c*E+u*A+h*L+p*D,i[13]=c*M+u*C+h*I+p*U,i[2]=d*_+f*T+m*P+g*O,i[6]=d*w+f*S+m*R+g*N,i[10]=d*E+f*A+m*L+g*D,i[14]=d*M+f*C+m*I+g*U,i[3]=v*_+y*T+x*P+b*O,i[7]=v*w+y*S+x*R+b*N,i[11]=v*E+y*A+x*L+b*D,i[15]=v*M+y*C+x*I+b*U,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new s;return function(e){for(var n=0,r=e.count;n=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var _=a*v;if(s=s*m+h*_,l=l*m+p*_,c=c*m+d*_,u=u*m+f*_,m===1-a){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}}),Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(a.prototype,{set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,o=t.order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),h=s(n/2),p=s(r/2),d=s(i/2);return"XYZ"===o?(this._x=h*c*u+l*p*d,this._y=l*p*u-h*c*d,this._z=l*c*d+h*p*u,this._w=l*c*u-h*p*d):"YXZ"===o?(this._x=h*c*u+l*p*d,this._y=l*p*u-h*c*d,this._z=l*c*d-h*p*u,this._w=l*c*u+h*p*d):"ZXY"===o?(this._x=h*c*u-l*p*d,this._y=l*p*u+h*c*d,this._z=l*c*d+h*p*u,this._w=l*c*u-h*p*d):"ZYX"===o?(this._x=h*c*u-l*p*d,this._y=l*p*u+h*c*d,this._z=l*c*d-h*p*u,this._w=l*c*u+h*p*d):"YZX"===o?(this._x=h*c*u+l*p*d,this._y=l*p*u+h*c*d,this._z=l*c*d-h*p*u,this._w=l*c*u-h*p*d):"XZY"===o&&(this._x=h*c*u-l*p*d,this._y=l*p*u-h*c*d,this._z=l*c*d+h*p*u,this._w=l*c*u+h*p*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],p=r+s+h;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(u-l)*e,this._y=(o-c)*e,this._z=(a-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(u-l)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+c)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(o-c)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(l+u)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(a-i)/e,this._x=(o+c)/e,this._y=(l+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new s;return function(n,r){return void 0===e&&(e=new s),t=n.dot(r)+1,t<1e-6?(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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var l=Math.atan2(s,a),c=Math.sin((1-e)*l)/s,u=Math.sin(e*l)/s;return this._w=o*c+this._w*u,this._x=n*c+this._x*u,this._y=r*c+this._y*u,this._z=i*c+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(s.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new a;return function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new a;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,l=s*e+o*r-a*n,c=s*n+a*e-i*r,u=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=l*s+h*-i+c*-a-u*-o,this.y=c*s+h*-o+u*-i-l*-a,this.z=u*s+h*-a+l*-o-c*-i,this},project:function(){var t=new o;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new o;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new s,e=new s;return function(n,r){return t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new s;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new s;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ga.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(l.prototype,{isMatrix3:!0,set:function(t,e,n,r,i,o,a,s,l){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new s;return function(e){for(var n=0,r=e.count;n2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(r)}),n.image=r.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Wo:t.x=t.x-Math.floor(t.x);break;case Xo:t.x=t.x<0?0:1;break;case qo:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Wo:t.y=t.y-Math.floor(t.y);break;case Xo:t.y=t.y<0?0:1;break;case qo:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(u.prototype,{isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=t.elements,a=o[0],s=o[4],l=o[8],c=o[1],u=o[5],h=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(s-c)<.01&&Math.abs(l-p)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+p)<.1&&Math.abs(h+d)<.1&&Math.abs(a+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(u+1)/2,v=(f+1)/2,y=(s+c)/4,x=(l+p)/4,b=(h+d)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=x/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(g),n=y/r,i=b/r):v<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=x/i,r=b/i),this.set(n,r,i,e),this}var _=Math.sqrt((d-h)*(d-h)+(l-p)*(l-p)+(c-s)*(c-s));return Math.abs(_)<.001&&(_=1),this.x=(d-h)/_,this.y=(l-p)/_,this.z=(c-s)/_,this.w=Math.acos((a+u+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new u,e=new u),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength: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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(h.prototype,r.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),p.prototype=Object.create(h.prototype),p.prototype.constructor=p,p.prototype.isWebGLRenderTargetCube=!0,d.prototype=Object.create(c.prototype),d.prototype.constructor=d,d.prototype.isDataTexture=!0,f.prototype=Object.create(c.prototype),f.prototype.constructor=f,f.prototype.isCubeTexture=!0,Object.defineProperty(f.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var ja=new c,Wa=new f,Xa=[],qa=[],Ya=new Float32Array(16),Za=new Float32Array(9);W.prototype.setValue=function(t,e){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var o=n[r];o.setValue(t,e[o.id])}};var Ka=/([\w\d_]+)(\])?(\[|\.)?/g;Y.prototype.setValue=function(t,e,n){var r=this.map[e];void 0!==r&&r.setValue(t,n,this.renderer)},Y.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},Y.upload=function(t,e,n,r){for(var i=0,o=e.length;i!==o;++i){var a=e[i],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,r)}},Y.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var o=t[r];o.id in e&&n.push(o)}return n};var Qa={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,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(Z.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"===typeof t?this.setHex(t):"string"===typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=Ga.euclideanModulo(e,1),n=Ga.clamp(n,0,1),r=Ga.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){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,e(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,e(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 a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c=n[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}if(t&&t.length>0){var c=Qa[t];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),l=Math.min(i,o,a),c=(l+s)/2;if(l===s)e=0,n=0;else{var u=s-l;switch(n=c<=.5?u/(s+l):u/(2-s-l),s){case i:e=(o-a)/u+(o 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},es={basic:{uniforms:$a.merge([Ja.common,Ja.specularmap,Ja.envmap,Ja.aomap,Ja.lightmap,Ja.fog]),vertexShader:ts.meshbasic_vert,fragmentShader:ts.meshbasic_frag},lambert:{uniforms:$a.merge([Ja.common,Ja.specularmap,Ja.envmap,Ja.aomap,Ja.lightmap,Ja.emissivemap,Ja.fog,Ja.lights,{emissive:{value:new Z(0)}}]),vertexShader:ts.meshlambert_vert,fragmentShader:ts.meshlambert_frag},phong:{uniforms:$a.merge([Ja.common,Ja.specularmap,Ja.envmap,Ja.aomap,Ja.lightmap,Ja.emissivemap,Ja.bumpmap,Ja.normalmap,Ja.displacementmap,Ja.gradientmap,Ja.fog,Ja.lights,{emissive:{value:new Z(0)},specular:{value:new Z(1118481)},shininess:{value:30}}]),vertexShader:ts.meshphong_vert,fragmentShader:ts.meshphong_frag},standard:{uniforms:$a.merge([Ja.common,Ja.envmap,Ja.aomap,Ja.lightmap,Ja.emissivemap,Ja.bumpmap,Ja.normalmap,Ja.displacementmap,Ja.roughnessmap,Ja.metalnessmap,Ja.fog,Ja.lights,{emissive:{value:new Z(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:ts.meshphysical_vert,fragmentShader:ts.meshphysical_frag},points:{uniforms:$a.merge([Ja.points,Ja.fog]),vertexShader:ts.points_vert,fragmentShader:ts.points_frag},dashed:{uniforms:$a.merge([Ja.common,Ja.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ts.linedashed_vert,fragmentShader:ts.linedashed_frag},depth:{uniforms:$a.merge([Ja.common,Ja.displacementmap]),vertexShader:ts.depth_vert,fragmentShader:ts.depth_frag},normal:{uniforms:$a.merge([Ja.common,Ja.bumpmap,Ja.normalmap,Ja.displacementmap,{opacity:{value:1}}]),vertexShader:ts.normal_vert,fragmentShader:ts.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ts.cube_vert,fragmentShader:ts.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ts.equirect_vert,fragmentShader:ts.equirect_frag},distanceRGBA:{uniforms:$a.merge([Ja.common,Ja.displacementmap,{referencePosition:{value:new s},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ts.distanceRGBA_vert,fragmentShader:ts.distanceRGBA_frag},shadow:{uniforms:$a.merge([Ja.lights,Ja.fog,{color:{value:new Z(0)},opacity:{value:1}}]),vertexShader:ts.shadow_vert,fragmentShader:ts.shadow_frag}};es.physical={uniforms:$a.merge([es.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:ts.meshphysical_vert,fragmentShader:ts.meshphysical_frag},Object.assign(K.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),J.prototype=Object.create(c.prototype),J.prototype.constructor=J;var ns=0;Object.assign(tt.prototype,r.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t||"string"===typeof t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearCoat&&(r.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(r.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==to&&(r.blending=this.blending),!0===this.flatShading&&(r.flatShading=this.flatShading),this.side!==qi&&(r.side=this.side),this.vertexColors!==Ki&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,0!==this.rotation&&(r.rotation=this.rotation),1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(r.morphTargets=!0),!0===this.skinning&&(r.skinning=!0),!1===this.visible&&(r.visible=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),n){var i=e(t.textures),o=e(t.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),et.prototype=Object.create(tt.prototype),et.prototype.constructor=et,et.prototype.isMeshDepthMaterial=!0,et.prototype.copy=function(t){return tt.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},nt.prototype=Object.create(tt.prototype),nt.prototype.constructor=nt,nt.prototype.isMeshDistanceMaterial=!0,nt.prototype.copy=function(t){return tt.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Object.assign(rt.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=t.length;si&&(i=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=t.count;si&&(i=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new s).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t=new s;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new s).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new s;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new s;return function(e){var n=e||new it;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new s,new s,new s,new s,new s,new s,new s,new s];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(it.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new rt;return function(e,n){var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).getCenter(r);for(var i=0,o=0,a=e.length;othis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new rt;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(ot.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new s,e=new s;return function(n,r,i){var o=t.subVectors(i,r).cross(e.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return(e||new s).copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new s;return function(e,n){var r=n||new s,i=e.delta(t),o=this.normal.dot(i);if(0!==o){var a=-(e.start.dot(this.normal)+this.constant)/o;if(!(a<0||a>1))return r.copy(i).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return r.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new s).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new s,e=new l;return function(n,r){var i=r||e.getNormalMatrix(n),o=this.coplanarPoint(t).applyMatrix4(n),a=this.normal.applyMatrix3(i).normalize();return this.constant=-o.dot(a),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(at.prototype,{set:function(t,e,n,r,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-r,u-s,f-h,y-m).normalize(),e[1].setComponents(a+r,u+s,f+h,y+m).normalize(),e[2].setComponents(a+i,u+l,f+p,y+g).normalize(),e[3].setComponents(a-i,u-l,f-p,y-g).normalize(),e[4].setComponents(a-o,u-c,f-d,y-v).normalize(),e[5].setComponents(a+o,u+c,f+d,y+v).normalize(),this},intersectsObject:function(){var t=new it;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new it;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)0?n.min.x:n.max.x,e.x=o.normal.x>0?n.max.x:n.min.x,t.y=o.normal.y>0?n.min.y:n.max.y,e.y=o.normal.y>0?n.max.y:n.min.y,t.z=o.normal.z>0?n.min.z:n.max.z,e.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}),ct.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ct.DefaultOrder="XYZ",Object.defineProperties(ct.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ct.prototype,{isEuler:!0,set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=Ga.clamp,i=t.elements,o=i[0],a=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],p=i[6],d=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,o))):"ZYX"===e?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,c))):"YZX"===e?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new o;return function(e,n,r){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new a;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new s(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(ut.prototype,{set:function(t){this.mask=1<1){for(var e=0;e1){for(var e=0;e0){o.children=[];for(var s=0;s0&&(i.geometries=c),u.length>0&&(i.materials=u),h.length>0&&(i.textures=h),p.length>0&&(i.images=p)}return i.object=o,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n0)for(var m=0;m0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new rt),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new it),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!t||!t.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var r,i=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],h=t.faceVertexUvs[0],p=this.colors,d=t.colors;void 0===n&&(n=0),void 0!==e&&(r=(new l).getNormalMatrix(e));for(var f=0,m=a.length;f=0;n--){var f=p[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,b=v.vertexNormals.length>0,_=1!==v.color.r||1!==v.color.g||1!==v.color.b,w=v.vertexColors.length>0,E=0;if(E=t(E,0,0),E=t(E,1,!0),E=t(E,2,!1),E=t(E,3,y),E=t(E,4,x),E=t(E,5,b),E=t(E,6,_),E=t(E,7,w),u.push(E),u.push(v.a,v.b,v.c),u.push(v.materialIndex),y){var M=this.faceVertexUvs[0][l];u.push(r(M[0]),r(M[1]),r(M[2]))}if(x&&u.push(e(v.normal)),b){var T=v.vertexNormals;u.push(e(T[0]),e(T[1]),e(T[2]))}if(_&&u.push(n(v.color)),w){var S=v.vertexColors;u.push(n(S[0]),n(S[1]),n(S[2]))}}return i.data={},i.data.vertices=s,i.data.normals=h,d.length>0&&(i.data.colors=d),m.length>0&&(i.data.uvs=[m]),i.data.faces=u,i},clone:function(){return(new mt).copy(this)},copy:function(t){var e,n,r,i,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e0,s=o[1]&&o[1].length>0,l=t.morphTargets,c=l.length;if(c>0){e=[];for(var u=0;u0){h=[];for(var u=0;u65535?Et:_t)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new gt(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new l).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new o;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new o;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new o;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new o;return function(e,n,r){return t.makeTranslation(e,n,r),this.applyMatrix(t),this}}(),scale:function(){var t=new o;return function(e,n,r){return t.makeScale(e,n,r),this.applyMatrix(t),this}}(),lookAt:function(){var t=new ht;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Mt(3*e.vertices.length,3),r=new Mt(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new Mt(e.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],n=0,r=t.length;n0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new gt(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new gt(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new gt(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new gt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=At(t.indices)>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new gt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var l in t.morphTargets){for(var c=[],u=t.morphTargets[l],h=0,p=u.length;h0){var m=new Mt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new Mt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new rt);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new rt,e=new s;return function(){null===this.boundingSphere&&(this.boundingSphere=new it);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(r);for(var i=0,o=0,a=n.count;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(t.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),t},clone:function(){return(new Ct).copy(this)},copy:function(t){var e,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var l=[],c=s[e];for(n=0,r=c.length;n0)if(s=p*f-d,l=p*d-f,u=h*g,s>=0)if(l>=-u)if(l<=u){var v=1/g;s*=v,l*=v,c=s*(s+p*l+2*d)+l*(p*s+l+2*f)+m}else l=h,s=Math.max(0,-(p*l+d)),c=-s*s+l*(l+2*f)+m;else l=-h,s=Math.max(0,-(p*l+d)),c=-s*s+l*(l+2*f)+m;else l<=-u?(s=Math.max(0,-(-p*h+d)),l=s>0?-h:Math.min(Math.max(-h,-f),h),c=-s*s+l*(l+2*f)+m):l<=u?(s=0,l=Math.min(Math.max(-h,-f),h),c=l*(l+2*f)+m):(s=Math.max(0,-(p*h+d)),l=s>0?h:Math.min(Math.max(-h,-f),h),c=-s*s+l*(l+2*f)+m);else l=p>0?-h:h,s=Math.max(0,-(p*l+d)),c=-s*s+l*(l+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(l).add(t),c}}(),intersectSphere:function(){var t=new s;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,l=r+a;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,r,i,o,a,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,r=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,r=(t.min.x-h.x)*l),c>=0?(i=(t.min.y-h.y)*c,o=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,o=(t.min.y-h.y)*c),n>o||i>r?null:((i>n||n!==n)&&(n=i),(o=0?(a=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(a=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||a>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,e)))},intersectsBox:function(){var t=new s;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new s,e=new s,n=new s,r=new s;return function(i,o,a,s,l){e.subVectors(o,i),n.subVectors(a,i),r.crossVectors(e,n);var c,u=this.direction.dot(r);if(u>0){if(s)return null;c=1}else{if(!(u<0))return null;c=-1,u=-u}t.subVectors(this.origin,i);var h=c*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var p=c*this.direction.dot(e.cross(t));if(p<0)return null;if(h+p>u)return null;var d=-c*t.dot(r);return d<0?null:this.at(d/u,l)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(Ut.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new s).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new s).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var n=e||new s;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new s,e=new s;return function(n,r){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),o=e.dot(t),a=o/i;return r&&(a=Ga.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e),i=n||new s;return this.delta(i).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(Ft,{normal:function(){var t=new s;return function(e,n,r,i){var o=i||new s;o.subVectors(r,n),t.subVectors(e,n),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new s,e=new s,n=new s;return function(r,i,o,a,l){t.subVectors(a,i),e.subVectors(o,i),n.subVectors(r,i);var c=t.dot(t),u=t.dot(e),h=t.dot(n),p=e.dot(e),d=e.dot(n),f=c*p-u*u,m=l||new s;if(0===f)return m.set(-2,-1,-1);var g=1/f,v=(p*h-u*d)*g,y=(c*d-u*h)*g;return m.set(1-v-y,y,v)}}(),containsPoint:function(){var t=new s;return function(e,n,r,i){var o=Ft.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(Ft.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new s,e=new s;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new s).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return Ft.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new ot).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return Ft.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Ft.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new ot,e=[new Ut,new Ut,new Ut],n=new s,r=new s;return function(i,o){var a=o||new s,l=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(i,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c0){var a=i[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=a.length;t0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;tn.far?null:{distance:l,point:b.clone(),object:t}}function n(n,r,i,o,a,s,l,p){c.fromBufferAttribute(o,s),u.fromBufferAttribute(o,l),h.fromBufferAttribute(o,p);var d=e(n,n.material,r,i,c,u,h,x);return d&&(a&&(m.fromBufferAttribute(a,s),g.fromBufferAttribute(a,l),v.fromBufferAttribute(a,p),d.uv=t(x,c,u,h,m,g,v)),d.face=new ft(s,l,p,Ft.normal(c,u,h)),d.faceIndex=s),d}var r=new o,a=new Dt,l=new it,c=new s,u=new s,h=new s,p=new s,d=new s,f=new s,m=new i,g=new i,v=new i,y=new s,x=new s,b=new s;return function(i,o){var s=this.geometry,y=this.material,b=this.matrixWorld;if(void 0!==y&&(null===s.boundingSphere&&s.computeBoundingSphere(),l.copy(s.boundingSphere),l.applyMatrix4(b),!1!==i.ray.intersectsSphere(l)&&(r.getInverse(b),a.copy(i.ray).applyMatrix4(r),null===s.boundingBox||!1!==a.intersectsBox(s.boundingBox)))){var _;if(s.isBufferGeometry){var w,E,M,T,S,A=s.index,C=s.attributes.position,P=s.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(O=F);for(var k=0,z=U.length;ko)){var a=r.ray.origin.distanceTo(t);ar.far||i.push({distance:a,point:t.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),Re.prototype=Object.assign(Object.create(ht.prototype),{constructor:Re,copy:function(t){ht.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var i=t.distanceTo(e);r[0].object.visible=!0;for(var o=1,a=r.length;o=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;oa)){d.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(d);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else for(var x=0,b=v.length/3-1;xa)){d.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(d);Mr.far||i.push({distance:M,point:p.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}else if(l.isGeometry)for(var T=l.vertices,S=T.length,x=0;xa)){d.applyMatrix4(this.matrixWorld);var M=r.ray.origin.distanceTo(d);Mr.far||i.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)}}),Ue.prototype=Object.assign(Object.create(De.prototype),{constructor:Ue,isLineSegments:!0}),Fe.prototype=Object.assign(Object.create(De.prototype),{constructor:Fe,isLineLoop:!0}),ke.prototype=Object.create(tt.prototype),ke.prototype.constructor=ke,ke.prototype.isPointsMaterial=!0,ke.prototype.copy=function(t){return tt.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},ze.prototype=Object.assign(Object.create(ht.prototype),{constructor:ze,isPoints:!0,raycast:function(){var t=new o,e=new Dt,n=new it;return function(r,i){function o(t,n){var o=e.distanceSqToPoint(t);if(or.far)return;i.push({distance:l,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,l=this.geometry,c=this.matrixWorld,u=r.params.Points.threshold;if(null===l.boundingSphere&&l.computeBoundingSphere(),n.copy(l.boundingSphere),n.applyMatrix4(c),n.radius+=u,!1!==r.ray.intersectsSphere(n)){t.getInverse(c),e.copy(r.ray).applyMatrix4(t);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),p=h*h,d=new s;if(l.isBufferGeometry){var f=l.index,m=l.attributes,g=m.position.array;if(null!==f)for(var v=f.array,y=0,x=v.length;y=-Number.EPSILON&&C>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,n){var r=e.length;if(r<3)return null;var i,o,a,s=[],l=[],c=[];if(ss.area(e)>0)for(o=0;o2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?c:s;if(i=o,u<=i&&(i=0),o=i+1,u<=o&&(o=0),a=o+1,u<=a&&(a=0),t(e,i,o,a,u,l)){var p,d,f,m,g;for(p=l[i],d=l[o],f=l[a],s.push([e[p],e[d],e[f]]),c.push([l[i],l[o],l[a]]),m=o,g=o+1;g2&&t[e-1].equals(t[0])&&t.pop()}function r(t,e,n){return t.x!==e.x?t.xNumber.EPSILON){var f;if(p>0){if(d<0||d>p)return[];if((f=c*u-l*h)<0||f>p)return[]}else{if(d>0||d0||fT?[]:b===T?o?[]:[y]:_<=T?[y,x]:[y,E]}function o(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,l=r.x-t.x,c=r.y-t.y,u=i*s-o*a,h=i*c-o*l;if(Math.abs(u)>Number.EPSILON){var p=l*s-c*a;return u>0?h>=0&&p>=0:h>=0||p>=0}return h>0}n(t),e.forEach(n);for(var a,s,l,c,u,h,p={},d=t.concat(),f=0,m=e.length;f0;){if(--_<0){console.log('THREE.ShapeUtils: Infinite Loop! Holes left:" + indepHoles.length + ", Probably Hole outside Shape!');break}for(a=b;ar&&(a=0);var s=o(m[t],m[i],m[a],n[e]);if(!s)return!1;var l=n.length-1,c=e-1;c<0&&(c=l);var u=e+1;return u>l&&(u=0),!!(s=o(n[e],n[c],n[u],m[t]))}(a,w)&&!function(t,e){var n,r,o;for(n=0;n0)return!0;return!1}(s,l)&&!function(t,n){var r,o,a,s,l;for(r=0;r0)return!0;return!1}(s,l)){r=w,g.splice(y,1),h=m.slice(0,a+1),p=m.slice(a),d=n.slice(r),f=n.slice(0,r+1),m=h.concat(d).concat(f).concat(p),b=a;break}if(r>=0)break;v[u]=!0}if(r>=0)break}}return m}(t,e),v=ss.triangulate(g,!1);for(a=0,s=v.length;aNumber.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(c*c+u*u),m=e.x-l/d,g=e.y+s/d,v=n.x-u/f,y=n.y+c/f,x=((v-m)*u-(y-g)*c)/(s*u-l*c);r=m+s*x-t.x,o=g+l*x-t.y;var b=r*r+o*o;if(b<=2)return new i(r,o);a=Math.sqrt(b/2)}else{var _=!1;s>Number.EPSILON?c>Number.EPSILON&&(_=!0):s<-Number.EPSILON?c<-Number.EPSILON&&(_=!0):Math.sign(l)===Math.sign(u)&&(_=!0),_?(r=-l,o=s,a=Math.sqrt(h)):(r=s,o=l,a=Math.sqrt(h/2))}return new i(r/a,o/a)}function o(t,e){var n,r;for(K=t.length;--K>=0;){n=K,r=K-1,r<0&&(r=t.length-1);var i=0,o=C+2*T;for(i=0;i=0;H--){for(V=H/T,j=E*Math.cos(V*Math.PI/2),G=M*Math.sin(V*Math.PI/2),K=0,Q=B.length;K0||0===t.search(/^data\:image\/jpeg/);o.format=n?da:fa,o.needsUpdate=!0,void 0!==e&&e(o)},n,r),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Wn.prototype=Object.assign(Object.create(ht.prototype),{constructor:Wn,isLight:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Xn.prototype=Object.assign(Object.create(Wn.prototype),{constructor:Xn,isHemisphereLight:!0,copy:function(t){return Wn.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(qn.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Yn.prototype=Object.assign(Object.create(qn.prototype),{constructor:Yn,isSpotLightShadow:!0,update:function(t){var e=this.camera,n=2*Ga.RAD2DEG*t.angle,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix())}}),Zn.prototype=Object.assign(Object.create(Wn.prototype),{constructor:Zn,isSpotLight:!0,copy:function(t){return Wn.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Kn.prototype=Object.assign(Object.create(Wn.prototype),{constructor:Kn,isPointLight:!0,copy:function(t){return Wn.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Qn.prototype=Object.assign(Object.create(qn.prototype),{constructor:Qn}),Jn.prototype=Object.assign(Object.create(Wn.prototype),{constructor:Jn,isDirectionalLight:!0,copy:function(t){return Wn.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),$n.prototype=Object.assign(Object.create(Wn.prototype),{constructor:$n,isAmbientLight:!0}),tr.prototype=Object.assign(Object.create(Wn.prototype),{constructor:tr,isRectAreaLight:!0,copy:function(t){return Wn.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Wn.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var ds={arraySlice:function(t,e,n){return ds.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"===typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(e),r},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),o=0,a=0;a!==r;++o)for(var s=n[o]*e,l=0;l!==e;++l)i[a++]=t[s+l];return i},flattenJSON:function(t,e,n,r){for(var i=1,o=t[0];void 0!==o&&void 0===o[r];)o=t[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)}}};Object.assign(er.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var o;n:{r:if(!(t=i)break t;var s=e[1];t=i)break e}o=n,n=0}}for(;n>>1;te;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);var a=this.getValueSize();this.times=ds.arraySlice(n,i,o),this.values=ds.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),t=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"===typeof s&&isNaN(s)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,a,s,o),t=!1;break}o=s}if(void 0!==r&&ds.isTypedArray(r))for(var a=0,l=r.length;a!==l;++a){var c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,a,c),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=2302===this.getInterpolation(),i=1,o=t.length-1,a=1;a0){t[i]=t[o];for(var f=o*n,m=i*n,p=0;p!==n;++p)e[m+p]=e[f+p];++i}return i!==t.length&&(this.times=ds.arraySlice(t,0,i),this.values=ds.arraySlice(e,0,i*n)),this}},ar.prototype=Object.assign(Object.create(fs),{constructor:ar,ValueTypeName:"vector"}),sr.prototype=Object.assign(Object.create(er.prototype),{constructor:sr,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,l=t*s,c=(n-e)/(r-e),u=l+s;l!==u;l+=4)a.slerpFlat(i,0,o,l-s,o,l,c);return i}}),lr.prototype=Object.assign(Object.create(fs),{constructor:lr,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new sr(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),cr.prototype=Object.assign(Object.create(fs),{constructor:cr,ValueTypeName:"number"}),ur.prototype=Object.assign(Object.create(fs),{constructor:ur,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),hr.prototype=Object.assign(Object.create(fs),{constructor:hr,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),pr.prototype=Object.assign(Object.create(fs),{constructor:pr,ValueTypeName:"color"}),dr.prototype=fs,fs.constructor=dr,Object.assign(dr,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=dr._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],r=[];ds.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:ds.convertArray(t.times,Array),values:ds.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return cr;case"vector":case"vector2":case"vector3":case"vector4":return ar;case"color":return pr;case"quaternion":return lr;case"bool":case"boolean":return hr;case"string":return ur}throw new Error("Unsupported typeName: "+t)}}),Object.assign(fr,{parse:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,o=n.length;i!==o;++i)e.push(dr.parse(n[i]).scale(r));return new fr(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e},i=0,o=n.length;i!==o;++i)e.push(dr.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(t,e,n,r){for(var i=e.length,o=[],a=0;a1){var c=l[1],u=r[c];u||(r[c]=u=[]),u.push(s)}}var h=[];for(var c in r)h.push(fr.CreateFromMorphTargetSequence(c,r[c],e,n));return h},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var o=[],a=[];ds.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],l=0;l1?t.skinWeights[r+1]:0,s=n>2?t.skinWeights[r+2]:0,l=n>3?t.skinWeights[r+3]:0;e.skinWeights.push(new u(o,a,s,l))}if(t.skinIndices)for(var r=0,i=t.skinIndices.length;r1?t.skinIndices[r+1]:0,p=n>2?t.skinIndices[r+2]:0,d=n>3?t.skinIndices[r+3]:0;e.skinIndices.push(new u(c,h,p,d))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function n(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var r=0,i=t.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=e.faces,p=t.morphColors[0].colors,r=0,i=h.length;r0&&(e.animations=n)}return function(i,o){void 0!==i.data&&(i=i.data),void 0!==i.scale?i.scale=1/i.scale:i.scale=1;var a=new mt;return t(i,a),e(i,a),n(i,a),r(i,a),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===i.materials||0===i.materials.length?{geometry:a}:{geometry:a,materials:vr.prototype.initMaterials(i.materials,o,this.crossOrigin)}}}()}),Object.assign(xr.prototype,{load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this;new zn(i.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");i.parse(o,e)},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),r=this.parseImages(t.images,function(){void 0!==e&&e(a)}),i=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,i),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new yr,r=new gr,i=0,o=t.length;i0){var i=new kn(e),o=new Gn(i);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a0?new Oe(s,l):new kt(s,l);break;case"LOD":a=new Re;break;case"Line":a=new De(i(e.geometry),o(e.material),e.mode);break;case"LineLoop":a=new Fe(i(e.geometry),o(e.material));break;case"LineSegments":a=new Ue(i(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new ze(i(e.geometry),o(e.material));break;case"Sprite":a=new Pe(o(e.material));break;case"Group":a=new Be;break;default:a=new ht}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var c=e.children,u=0;u0)){l=i;break}l=i-1}if(i=l,r[i]===n)return i/(o-1);var c=r[i];return(i+(n-c)/(r[i+1]-c))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var r=this.getPoint(e);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,i,a=new s,l=[],c=[],u=[],h=new s,p=new o;for(n=0;n<=t;n++)r=n/t,l[n]=this.getTangentAt(r),l[n].normalize();c[0]=new s,u[0]=new s;var d=Number.MAX_VALUE,f=Math.abs(l[0].x),m=Math.abs(l[0].y),g=Math.abs(l[0].z);for(f<=d&&(d=f,a.set(1,0,0)),m<=d&&(d=m,a.set(0,1,0)),g<=d&&a.set(0,0,1),h.crossVectors(l[0],a).normalize(),c[0].crossVectors(l[0],h),u[0].crossVectors(l[0],c[0]),n=1;n<=t;n++)c[n]=c[n-1].clone(),u[n]=u[n-1].clone(),h.crossVectors(l[n-1],l[n]),h.length()>Number.EPSILON&&(h.normalize(),i=Math.acos(Ga.clamp(l[n-1].dot(l[n]),-1,1)),c[n].applyMatrix4(p.makeRotationAxis(h,i))),u[n].crossVectors(l[n],c[n]);if(!0===e)for(i=Math.acos(Ga.clamp(c[0].dot(c[t]),-1,1)),i/=t,l[0].dot(h.crossVectors(c[0],c[t]))>0&&(i=-i),n=1;n<=t;n++)c[n].applyMatrix4(p.makeRotationAxis(l[n],i*n)),u[n].crossVectors(l[n],c[n]);return{tangents:l,normals:c,binormals:u}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),Lr.prototype=Object.create(Rr.prototype),Lr.prototype.constructor=Lr,Lr.prototype.isLineCurve=!0,Lr.prototype.getPoint=function(t,e){var n=e||new i;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},Lr.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Lr.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Lr.prototype.copy=function(t){return Rr.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Ir.prototype=Object.assign(Object.create(Rr.prototype),{constructor:Ir,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Lr(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r=e){var i=n[r]-e,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){Rr.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;er;)o-=r;or.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return n.set(br(s,l.x,c.x,u.x,h.x),br(s,l.y,c.y,u.y,h.y)),n},Nr.prototype.copy=function(t){Rr.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);this.currentPoint.copy(u)},copy:function(t){return Ir.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this}});Fr.prototype=xs,xs.constructor=Fr,kr.prototype=Object.assign(Object.create(xs),{constructor:kr,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n1){for(var v=!1,y=[],x=0,b=p.length;xNumber.EPSILON){if(c<0&&(a=e[o],l=-l,s=e[i],c=-c),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var u=c*(t.x-a.x)-l*(t.y-a.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return r})(E.p,p[T].p)&&(x!==T&&y.push({froms:x,tos:T,hole:w}),M?(M=!1,h[T].push(E)):v=!0);M&&h[x].push(E)}y.length>0&&(v||(d=h))}for(var S,m=0,A=p.length;m0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var o=0;o!==i;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,r){a.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*r}}}),Object.assign(Kr.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Qr,{Composite:Kr,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Qr.Composite(t,e,n):new Qr(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:function(){var t=/((?:[\w-]+[\/:])*)/,e=/([\w-\.]+)?/,n=/(?:\.([\w-]+)(?:\[(.+)\])?)?/,r=/\.([\w-]+)(?:\[(.+)\])?/,i=new RegExp("^"+t.source+e.source+n.source+r.source+"$"),o=["material","materials","bones"];return function(t){var e=i.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var a=n.nodeName.substring(r+1);-1!==o.indexOf(a)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=a)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=function(t){for(var n=0;n=e){var u=e++,h=t[u];n[h.uuid]=c,t[c]=h,n[l]=u,t[u]=s;for(var p=0,d=i;p!==d;++p){var f=r[p],m=f[u],g=f[c];f[c]=m,f[u]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,o=i.length,a=0,s=arguments.length;a!==s;++a){var l=arguments[a],c=l.uuid,u=r[c];if(void 0!==u)if(delete r[c],u0)for(var l=this._interpolants,c=this._propertyBindings,u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulate(r,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,r=this.loop,i=this._loopCount;if(2200===r){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=2202===r;if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var l=t<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&i))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=t?this.zeroSlopeAtStart?2401:Pa:2402,r.endingEnd=e?this.zeroSlopeAtEnd?2401:Pa:2402)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}}),Object.assign(ti.prototype,r.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=r[u],p=h.name,d=c[p];if(void 0!==d)o[u]=d;else{if(void 0!==(d=o[u])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;d=new Zr(Qr.create(n,p,f),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,p),o[u]=d}a[u].resultBuffer=d.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),Pi.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},Pi.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},Ri.prototype=Object.create(Ue.prototype),Ri.prototype.constructor=Ri;var Ms=new s,Ts=new Li,Ss=new Li,As=new Li;Ii.prototype=Object.create(Rr.prototype),Ii.prototype.constructor=Ii,Ii.prototype.isCatmullRomCurve3=!0,Ii.prototype.getPoint=function(t,e){var n=e||new s,r=this.points,i=r.length,o=(i-(this.closed?0:1))*t,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r.length)+1)*r.length:0===l&&a===i-1&&(a=i-2,l=1);var c,u,h,p;if(this.closed||a>0?c=r[(a-1)%i]:(Ms.subVectors(r[0],r[1]).add(r[0]),c=Ms),u=r[a%i],h=r[(a+1)%i],this.closed||a+2c){for(var e=0,n=a.length-l;e-1?e:t}function d(t,e){e=e||{};var n=e.body;if(t instanceof d){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new i(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new i(e.headers)),this.method=p(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function f(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}}),e}function m(t){var e=new i;return t.split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}}),e}function g(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new i(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var v={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(v.arrayBuffer)var y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],x=function(t){return t&&DataView.prototype.isPrototypeOf(t)},b=ArrayBuffer.isView||function(t){return t&&y.indexOf(Object.prototype.toString.call(t))>-1};i.prototype.append=function(t,r){t=e(t),r=n(r);var i=this.map[t];this.map[t]=i?i+","+r:r},i.prototype.delete=function(t){delete this.map[e(t)]},i.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},i.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},i.prototype.set=function(t,r){this.map[e(t)]=n(r)},i.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},i.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),r(t)},i.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),r(t)},i.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),r(t)},v.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},h.call(d.prototype),h.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];g.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},t.Headers=i,t.Request=d,t.Response=g,t.fetch=function(t,e){return new Promise(function(n,r){var i=new d(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:m(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;n(new g(e,t))},o.onerror=function(){r(new TypeError("Network request failed"))},o.ontimeout=function(){r(new TypeError("Network request failed"))},o.open(i.method,i.url,!0),"include"===i.credentials&&(o.withCredentials=!0),"responseType"in o&&v.blob&&(o.responseType="blob"),i.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send("undefined"===typeof i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!==typeof self?self:this)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=(n.n(r),n(16)),o=(n.n(i),n(26));i.render(r.createElement(o.a,null),document.getElementById("root"))},function(t,e,n){"use strict";function r(t){for(var e=arguments.length-1,n="Minified React error #"+t+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+t,r=0;rI.length&&I.push(t)}function d(t,e,n,i){var o=typeof t;if("undefined"!==o&&"boolean"!==o||(t=null),null===t||"string"===o||"number"===o||"object"===o&&t.$$typeof===P||"object"===o&&t.$$typeof===R)return n(i,t,""===e?"."+f(t,0):e),1;var a=0;if(e=""===e?".":e+":",Array.isArray(t))for(var s=0;sthis.eventPool.length&&this.eventPool.push(t)}function G(t){t.eventPool=[],t.getPooled=B,t.release=H}function V(t,e,n,r){return z.call(this,t,e,n,r)}function j(t,e,n,r){return z.call(this,t,e,n,r)}function W(t,e){switch(t){case"topKeyUp":return-1!==pr.indexOf(e.keyCode);case"topKeyDown":return 229!==e.keyCode;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function X(t){return t=t.detail,"object"===typeof t&&"data"in t?t.data:null}function q(t,e){switch(t){case"topCompositionEnd":return X(e);case"topKeyPress":return 32!==e.which?null:(wr=!0,br);case"topTextInput":return t=e.data,t===br&&wr?null:t;default:return null}}function Y(t,e){if(Er)return"topCompositionEnd"===t||!dr&&W(t,e)?(t=F(),cr._root=null,cr._startText=null,cr._fallbackText=null,Er=!1,t):null;switch(t){case"topPaste":return null;case"topKeyPress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1Hr.length&&Hr.push(t)}}}function Ot(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n["ms"+t]="MS"+e,n["O"+t]="o"+e.toLowerCase(),n}function Nt(t){if(Xr[t])return Xr[t];if(!Wr[t])return t;var e,n=Wr[t];for(e in n)if(n.hasOwnProperty(e)&&e in qr)return Xr[t]=n[e];return""}function Dt(t){return Object.prototype.hasOwnProperty.call(t,Qr)||(t[Qr]=Kr++,Zr[t[Qr]]={}),Zr[t[Qr]]}function Ut(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ft(t,e){var n=Ut(t);t=0;for(var r;n;){if(3===n.nodeType){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=Ut(n)}}function kt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&"text"===t.type||"textarea"===e||"true"===t.contentEditable)}function zt(t,e){if(ri||null==ti||ti!==En())return null;var n=ti;return"selectionStart"in n&&kt(n)?n={start:n.selectionStart,end:n.selectionEnd}:window.getSelection?(n=window.getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}):n=void 0,ni&&Mn(ni,n)?null:(ni=n,t=z.getPooled($r.select,ei,t,e),t.type="select",t.target=ti,N(t),t)}function Bt(t,e,n,r){return z.call(this,t,e,n,r)}function Ht(t,e,n,r){return z.call(this,t,e,n,r)}function Gt(t,e,n,r){return z.call(this,t,e,n,r)}function Vt(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,32<=t||13===t?t:0}function jt(t,e,n,r){return z.call(this,t,e,n,r)}function Wt(t,e,n,r){return z.call(this,t,e,n,r)}function Xt(t,e,n,r){return z.call(this,t,e,n,r)}function qt(t,e,n,r){return z.call(this,t,e,n,r)}function Yt(t,e,n,r){return z.call(this,t,e,n,r)}function Zt(t){0>hi||(t.current=ui[hi],ui[hi]=null,hi--)}function Kt(t,e){hi++,ui[hi]=t.current,t.current=e}function Qt(t){return $t(t)?yi:gi.current}function Jt(t,e){var n=t.type.contextTypes;if(!n)return An;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function $t(t){return 2===t.tag&&null!=t.type.childContextTypes}function te(t){$t(t)&&(Zt(vi,t),Zt(gi,t))}function ee(t,e,n){null!=gi.cursor&&r("168"),Kt(gi,e,t),Kt(vi,n,t)}function ne(t,e){var n=t.stateNode,i=t.type.childContextTypes;if("function"!==typeof n.getChildContext)return e;n=n.getChildContext();for(var o in n)o in i||r("108",_t(t)||"Unknown",o);return bn({},e,n)}function re(t){if(!$t(t))return!1;var e=t.stateNode;return e=e&&e.__reactInternalMemoizedMergedChildContext||An,yi=gi.current,Kt(gi,e,t),Kt(vi,vi.current,t),!0}function ie(t,e){var n=t.stateNode;if(n||r("169"),e){var i=ne(t,yi);n.__reactInternalMemoizedMergedChildContext=i,Zt(vi,t),Zt(gi,t),Kt(gi,i,t)}else Zt(vi,t);Kt(vi,e,t)}function oe(t,e,n){this.tag=t,this.key=e,this.stateNode=this.type=null,this.sibling=this.child=this.return=null,this.index=0,this.memoizedState=this.updateQueue=this.memoizedProps=this.pendingProps=this.ref=null,this.internalContextTag=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.expirationTime=0,this.alternate=null}function ae(t,e,n){var r=t.alternate;return null===r?(r=new oe(t.tag,t.key,t.internalContextTag),r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.effectTag=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.expirationTime=n,r.pendingProps=e,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function se(t,e,n){var i=void 0,o=t.type,a=t.key;return"function"===typeof o?(i=o.prototype&&o.prototype.isReactComponent?new oe(2,a,e):new oe(0,a,e),i.type=o,i.pendingProps=t.props):"string"===typeof o?(i=new oe(5,a,e),i.type=o,i.pendingProps=t.props):"object"===typeof o&&null!==o&&"number"===typeof o.tag?(i=o,i.pendingProps=t.props):r("130",null==o?o:typeof o,""),i.expirationTime=n,i}function le(t,e,n,r){return e=new oe(10,r,e),e.pendingProps=t,e.expirationTime=n,e}function ce(t,e,n){return e=new oe(6,null,e),e.pendingProps=t,e.expirationTime=n,e}function ue(t,e,n){return e=new oe(7,t.key,e),e.type=t.handler,e.pendingProps=t,e.expirationTime=n,e}function he(t,e,n){return t=new oe(9,null,e),t.expirationTime=n,t}function pe(t,e,n){return e=new oe(4,t.key,e),e.pendingProps=t.children||[],e.expirationTime=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function de(t){return function(e){try{return t(e)}catch(t){}}}function fe(t){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var n=e.inject(t);xi=de(function(t){return e.onCommitFiberRoot(n,t)}),bi=de(function(t){return e.onCommitFiberUnmount(n,t)})}catch(t){}return!0}function me(t){"function"===typeof xi&&xi(t)}function ge(t){"function"===typeof bi&&bi(t)}function ve(t){return{baseState:t,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1}}function ye(t,e){null===t.last?t.first=t.last=e:(t.last.next=e,t.last=e),(0===t.expirationTime||t.expirationTime>e.expirationTime)&&(t.expirationTime=e.expirationTime)}function xe(t,e){var n=t.alternate,r=t.updateQueue;null===r&&(r=t.updateQueue=ve(null)),null!==n?null===(t=n.updateQueue)&&(t=n.updateQueue=ve(null)):t=null,t=t!==r?t:null,null===t?ye(r,e):null===r.last||null===t.last?(ye(r,e),ye(t,e)):(ye(r,e),t.last=e)}function be(t,e,n,r){return t=t.partialState,"function"===typeof t?t.call(e,n,r):t}function _e(t,e,n,r,i,o){null!==t&&t.updateQueue===n&&(n=e.updateQueue={baseState:n.baseState,expirationTime:n.expirationTime,first:n.first,last:n.last,isInitialized:n.isInitialized,callbackList:null,hasForceUpdate:!1}),n.expirationTime=0,n.isInitialized?t=n.baseState:(t=n.baseState=e.memoizedState,n.isInitialized=!0);for(var a=!0,s=n.first,l=!1;null!==s;){var c=s.expirationTime;if(c>o){var u=n.expirationTime;(0===u||u>c)&&(n.expirationTime=c),l||(l=!0,n.baseState=t)}else l||(n.first=s.next,null===n.first&&(n.last=null)),s.isReplace?(t=be(s,r,t,i),a=!0):(c=be(s,r,t,i))&&(t=a?bn({},t,c):bn(t,c),a=!1),s.isForced&&(n.hasForceUpdate=!0),null!==s.callback&&(c=n.callbackList,null===c&&(c=n.callbackList=[]),c.push(s));s=s.next}return null!==n.callbackList?e.effectTag|=32:null!==n.first||n.hasForceUpdate||(e.updateQueue=null),l||(n.baseState=t),t}function we(t,e){var n=t.callbackList;if(null!==n)for(t.callbackList=null,t=0;tp?(d=h,h=null):d=h.sibling;var f=g(t,h,a[p],l);if(null===f){null===h&&(h=d);break}e&&h&&null===f.alternate&&n(t,h),r=s(f,r,p),null===u?c=f:u.sibling=f,u=f,h=d}if(p===a.length)return i(t,h),c;if(null===h){for(;pd?(f=p,p=null):f=p.sibling;var x=g(t,p,y.value,c);if(null===x){p||(p=f);break}e&&p&&null===x.alternate&&n(t,p),a=s(x,a,d),null===h?u=x:h.sibling=x,h=x,p=f}if(y.done)return i(t,p),u;if(null===p){for(;!y.done;d++,y=l.next())null!==(y=m(t,y.value,c))&&(a=s(y,a,d),null===h?u=y:h.sibling=y,h=y);return u}for(p=o(t,p);!y.done;d++,y=l.next())null!==(y=v(p,t,d,y.value,c))&&(e&&null!==y.alternate&&p.delete(null===y.key?d:y.key),a=s(y,a,d),null===h?u=y:h.sibling=y,h=y);return e&&p.forEach(function(e){return n(t,e)}),u}return function(t,e,o,s){var c="object"===typeof o&&null!==o;if(c)switch(o.$$typeof){case pi:t:{var u=o.key;for(c=e;null!==c;){if(c.key===u){if(10===c.tag?o.type===mi:c.type===o.type){i(t,c.sibling),e=a(c,o.type===mi?o.props.children:o.props,s),e.ref=Se(c,o),e.return=t,t=e;break t}i(t,c);break}n(t,c),c=c.sibling}o.type===mi?(o=le(o.props.children,t.internalContextTag,s,o.key),o.return=t,t=o):(s=se(o,t.internalContextTag,s),s.ref=Se(e,o),s.return=t,t=s)}return l(t);case di:t:{for(c=o.key;null!==e;){if(e.key===c){if(7===e.tag){i(t,e.sibling),o=a(e,o,s),o.return=t,t=o;break t}i(t,e);break}n(t,e),e=e.sibling}o=ue(o,t.internalContextTag,s),o.return=t,t=o}return l(t);case fi:t:{if(null!==e){if(9===e.tag){i(t,e.sibling),e=a(e,null,s),e.type=o.value,e.return=t,t=e;break t}i(t,e)}e=he(o,t.internalContextTag,s),e.type=o.value,e.return=t,t=e}return l(t);case _i:t:{for(c=o.key;null!==e;){if(e.key===c){if(4===e.tag&&e.stateNode.containerInfo===o.containerInfo&&e.stateNode.implementation===o.implementation){i(t,e.sibling),o=a(e,o.children||[],s),o.return=t,t=o;break t}i(t,e);break}n(t,e),e=e.sibling}o=pe(o,t.internalContextTag,s),o.return=t,t=o}return l(t)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==e&&6===e.tag?(i(t,e.sibling),o=a(e,o,s)):(i(t,e),o=ce(o,t.internalContextTag,s)),o.return=t,t=o,l(t);if(wi(o))return y(t,e,o,s);if(Te(o))return x(t,e,o,s);if(c&&Ae(t,o),"undefined"===typeof o)switch(t.tag){case 2:case 1:o=t.type,r("152",o.displayName||o.name||"Component")}return i(t,e)}}function Pe(t,e,n,i,o){function a(t,e,n){s(t,e,n,e.expirationTime)}function s(t,e,n,r){e.child=null===t?Si(e,e.child,n,r):t.child===e.child?Mi(e,e.child,n,r):Ti(e,e.child,n,r)}function l(t,e){var n=e.ref;null===n||t&&t.ref===n||(e.effectTag|=128)}function c(t,e,n,r){if(l(t,e),!n)return r&&ie(e,!1),h(t,e);n=e.stateNode,Br.current=e;var i=n.render();return e.effectTag|=1,a(t,e,i),e.memoizedState=n.state,e.memoizedProps=n.props,r&&ie(e,!0),e.child}function u(t){var e=t.stateNode;e.pendingContext?ee(t,e.pendingContext,e.pendingContext!==e.context):e.context&&ee(t,e.context,!1),v(t,e.containerInfo)}function h(t,e){if(null!==t&&e.child!==t.child&&r("153"),null!==e.child){t=e.child;var n=ae(t,t.pendingProps,t.expirationTime);for(e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,n=n.sibling=ae(t,t.pendingProps,t.expirationTime),n.return=e;n.sibling=null}return e.child}function p(t,e){switch(e.tag){case 3:u(e);break;case 2:re(e);break;case 4:v(e,e.stateNode.containerInfo)}return null}var d=t.shouldSetTextContent,f=t.useSyncScheduling,m=t.shouldDeprioritizeSubtree,g=e.pushHostContext,v=e.pushHostContainer,y=n.enterHydrationState,x=n.resetHydrationState,b=n.tryToClaimNextHydratableInstance;t=Ee(i,o,function(t,e){t.memoizedProps=e},function(t,e){t.memoizedState=e});var _=t.adoptClassInstance,w=t.constructClassInstance,E=t.mountClassInstance,M=t.updateClassInstance;return{beginWork:function(t,e,n){if(0===e.expirationTime||e.expirationTime>n)return p(t,e);switch(e.tag){case 0:null!==t&&r("155");var i=e.type,o=e.pendingProps,s=Qt(e);return s=Jt(e,s),i=i(o,s),e.effectTag|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render?(e.tag=2,o=re(e),_(e,i),E(e,n),e=c(t,e,!0,o)):(e.tag=1,a(t,e,i),e.memoizedProps=o,e=e.child),e;case 1:t:{if(o=e.type,n=e.pendingProps,i=e.memoizedProps,vi.current)null===n&&(n=i);else if(null===n||i===n){e=h(t,e);break t}i=Qt(e),i=Jt(e,i),o=o(n,i),e.effectTag|=1,a(t,e,o),e.memoizedProps=n,e=e.child}return e;case 2:return o=re(e),i=void 0,null===t?e.stateNode?r("153"):(w(e,e.pendingProps),E(e,n),i=!0):i=M(t,e,n),c(t,e,i,o);case 3:return u(e),o=e.updateQueue,null!==o?(i=e.memoizedState,o=_e(t,e,o,null,null,n),i===o?(x(),e=h(t,e)):(i=o.element,s=e.stateNode,(null===t||null===t.child)&&s.hydrate&&y(e)?(e.effectTag|=2,e.child=Si(e,e.child,i,n)):(x(),a(t,e,i)),e.memoizedState=o,e=e.child)):(x(),e=h(t,e)),e;case 5:g(e),null===t&&b(e),o=e.type;var T=e.memoizedProps;return i=e.pendingProps,null===i&&null===(i=T)&&r("154"),s=null!==t?t.memoizedProps:null,vi.current||null!==i&&T!==i?(T=i.children,d(o,i)?T=null:s&&d(o,s)&&(e.effectTag|=16),l(t,e),2147483647!==n&&!f&&m(o,i)?(e.expirationTime=2147483647,e=null):(a(t,e,T),e.memoizedProps=i,e=e.child)):e=h(t,e),e;case 6:return null===t&&b(e),t=e.pendingProps,null===t&&(t=e.memoizedProps),e.memoizedProps=t,null;case 8:e.tag=7;case 7:return o=e.pendingProps,vi.current?null===o&&null===(o=t&&t.memoizedProps)&&r("154"):null!==o&&e.memoizedProps!==o||(o=e.memoizedProps),i=o.children,e.stateNode=null===t?Si(e,e.stateNode,i,n):t.child===e.child?Mi(e,e.stateNode,i,n):Ti(e,e.stateNode,i,n),e.memoizedProps=o,e.stateNode;case 9:return null;case 4:t:{if(v(e,e.stateNode.containerInfo),o=e.pendingProps,vi.current)null===o&&null==(o=t&&t.memoizedProps)&&r("154");else if(null===o||e.memoizedProps===o){e=h(t,e);break t}null===t?e.child=Ti(e,e.child,o,n):a(t,e,o),e.memoizedProps=o,e=e.child}return e;case 10:t:{if(n=e.pendingProps,vi.current)null===n&&(n=e.memoizedProps);else if(null===n||e.memoizedProps===n){e=h(t,e);break t}a(t,e,n),e.memoizedProps=n,e=e.child}return e;default:r("156")}},beginFailedWork:function(t,e,n){switch(e.tag){case 2:re(e);break;case 3:u(e);break;default:r("157")}return e.effectTag|=64,null===t?e.child=null:e.child!==t.child&&(e.child=t.child),0===e.expirationTime||e.expirationTime>n?p(t,e):(e.firstEffect=null,e.lastEffect=null,s(t,e,null,n),2===e.tag&&(t=e.stateNode,e.memoizedProps=t.props,e.memoizedState=t.state),e.child)}}}function Re(t,e,n){function i(t){t.effectTag|=4}var o=t.createInstance,a=t.createTextInstance,s=t.appendInitialChild,l=t.finalizeInitialChildren,c=t.prepareUpdate,u=t.persistence,h=e.getRootHostContainer,p=e.popHostContext,d=e.getHostContext,f=e.popHostContainer,m=n.prepareToHydrateHostInstance,g=n.prepareToHydrateHostTextInstance,v=n.popHydrationState,y=void 0,x=void 0,b=void 0;return t.mutation?(y=function(){},x=function(t,e,n){(e.updateQueue=n)&&i(e)},b=function(t,e,n,r){n!==r&&i(e)}):r(u?"235":"236"),{completeWork:function(t,e,n){var u=e.pendingProps;switch(null===u?u=e.memoizedProps:2147483647===e.expirationTime&&2147483647!==n||(e.pendingProps=null),e.tag){case 1:return null;case 2:return te(e),null;case 3:return f(e),Zt(vi,e),Zt(gi,e),u=e.stateNode,u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),null!==t&&null!==t.child||(v(e),e.effectTag&=-3),y(e),null;case 5:p(e),n=h();var _=e.type;if(null!==t&&null!=e.stateNode){var w=t.memoizedProps,E=e.stateNode,M=d();E=c(E,_,w,u,n,M),x(t,e,E,_,w,u,n),t.ref!==e.ref&&(e.effectTag|=128)}else{if(!u)return null===e.stateNode&&r("166"),null;if(t=d(),v(e))m(e,n,t)&&i(e);else{t=o(_,u,n,t,e);t:for(w=e.child;null!==w;){if(5===w.tag||6===w.tag)s(t,w.stateNode);else if(4!==w.tag&&null!==w.child){w.child.return=w,w=w.child;continue}if(w===e)break;for(;null===w.sibling;){if(null===w.return||w.return===e)break t;w=w.return}w.sibling.return=w.return,w=w.sibling}l(t,_,u,n)&&i(e),e.stateNode=t}null!==e.ref&&(e.effectTag|=128)}return null;case 6:if(t&&null!=e.stateNode)b(t,e,t.memoizedProps,u);else{if("string"!==typeof u)return null===e.stateNode&&r("166"),null;t=h(),n=d(),v(e)?g(e)&&i(e):e.stateNode=a(u,t,n,e)}return null;case 7:(u=e.memoizedProps)||r("165"),e.tag=8,_=[];t:for((w=e.stateNode)&&(w.return=e);null!==w;){if(5===w.tag||6===w.tag||4===w.tag)r("247");else if(9===w.tag)_.push(w.type);else if(null!==w.child){w.child.return=w,w=w.child;continue}for(;null===w.sibling;){if(null===w.return||w.return===e)break t;w=w.return}w.sibling.return=w.return,w=w.sibling}return w=u.handler,u=w(u.props,_),e.child=Mi(e,null!==t?t.child:null,u,n),e.child;case 8:return e.tag=7,null;case 9:case 10:return null;case 4:return f(e),y(e),null;case 0:r("167");default:r("156")}}}}function Le(t,e){function n(t){var n=t.ref;if(null!==n)try{n(null)}catch(n){e(t,n)}}function i(t){switch("function"===typeof ge&&ge(t),t.tag){case 2:n(t);var r=t.stateNode;if("function"===typeof r.componentWillUnmount)try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(n){e(t,n)}break;case 5:n(t);break;case 7:o(t.stateNode);break;case 4:c&&s(t)}}function o(t){for(var e=t;;)if(i(e),null===e.child||c&&4===e.tag){if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;e=e.return}e.sibling.return=e.return,e=e.sibling}else e.child.return=e,e=e.child}function a(t){return 5===t.tag||3===t.tag||4===t.tag}function s(t){for(var e=t,n=!1,a=void 0,s=void 0;;){if(!n){n=e.return;t:for(;;){switch(null===n&&r("160"),n.tag){case 5:a=n.stateNode,s=!1;break t;case 3:case 4:a=n.stateNode.containerInfo,s=!0;break t}n=n.return}n=!0}if(5===e.tag||6===e.tag)o(e),s?x(a,e.stateNode):y(a,e.stateNode);else if(4===e.tag?a=e.stateNode.containerInfo:i(e),null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;e=e.return,4===e.tag&&(n=!1)}e.sibling.return=e.return,e=e.sibling}}var l=t.getPublicInstance,c=t.mutation;t=t.persistence,c||r(t?"235":"236");var u=c.commitMount,h=c.commitUpdate,p=c.resetTextContent,d=c.commitTextUpdate,f=c.appendChild,m=c.appendChildToContainer,g=c.insertBefore,v=c.insertInContainerBefore,y=c.removeChild,x=c.removeChildFromContainer;return{commitResetTextContent:function(t){p(t.stateNode)},commitPlacement:function(t){t:{for(var e=t.return;null!==e;){if(a(e)){var n=e;break t}e=e.return}r("160"),n=void 0}var i=e=void 0;switch(n.tag){case 5:e=n.stateNode,i=!1;break;case 3:case 4:e=n.stateNode.containerInfo,i=!0;break;default:r("161")}16&n.effectTag&&(p(e),n.effectTag&=-17);t:e:for(n=t;;){for(;null===n.sibling;){if(null===n.return||a(n.return)){n=null;break t}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue e;if(null===n.child||4===n.tag)continue e;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break t}}for(var o=t;;){if(5===o.tag||6===o.tag)n?i?v(e,o.stateNode,n):g(e,o.stateNode,n):i?m(e,o.stateNode):f(e,o.stateNode);else if(4!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},commitDeletion:function(t){s(t),t.return=null,t.child=null,t.alternate&&(t.alternate.child=null,t.alternate.return=null)},commitWork:function(t,e){switch(e.tag){case 2:break;case 5:var n=e.stateNode;if(null!=n){var i=e.memoizedProps;t=null!==t?t.memoizedProps:i;var o=e.type,a=e.updateQueue;e.updateQueue=null,null!==a&&h(n,a,o,t,i,e)}break;case 6:null===e.stateNode&&r("162"),n=e.memoizedProps,d(e.stateNode,null!==t?t.memoizedProps:n,n);break;case 3:break;default:r("163")}},commitLifeCycles:function(t,e){switch(e.tag){case 2:var n=e.stateNode;if(4&e.effectTag)if(null===t)n.props=e.memoizedProps,n.state=e.memoizedState,n.componentDidMount();else{var i=t.memoizedProps;t=t.memoizedState,n.props=e.memoizedProps,n.state=e.memoizedState,n.componentDidUpdate(i,t)}e=e.updateQueue,null!==e&&we(e,n);break;case 3:n=e.updateQueue,null!==n&&we(n,null!==e.child?e.child.stateNode:null);break;case 5:n=e.stateNode,null===t&&4&e.effectTag&&u(n,e.type,e.memoizedProps,e);break;case 6:case 4:break;default:r("163")}},commitAttachRef:function(t){var e=t.ref;if(null!==e){var n=t.stateNode;switch(t.tag){case 5:e(l(n));break;default:e(n)}}},commitDetachRef:function(t){null!==(t=t.ref)&&t(null)}}}function Ie(t){function e(t){return t===Ai&&r("174"),t}var n=t.getChildHostContext,i=t.getRootHostContext,o={current:Ai},a={current:Ai},s={current:Ai};return{getHostContext:function(){return e(o.current)},getRootHostContainer:function(){return e(s.current)},popHostContainer:function(t){Zt(o,t),Zt(a,t),Zt(s,t)},popHostContext:function(t){a.current===t&&(Zt(o,t),Zt(a,t))},pushHostContainer:function(t,e){Kt(s,e,t),e=i(e),Kt(a,t,t),Kt(o,e,t)},pushHostContext:function(t){var r=e(s.current),i=e(o.current);r=n(i,t.type,r),i!==r&&(Kt(a,t,t),Kt(o,r,t))},resetHostContainer:function(){o.current=Ai,s.current=Ai}}}function Oe(t){function e(t,e){var n=new oe(5,null,0);n.type="DELETED",n.stateNode=e,n.return=t,n.effectTag=8,null!==t.lastEffect?(t.lastEffect.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n}function n(t,e){switch(t.tag){case 5:return null!==(e=a(e,t.type,t.pendingProps))&&(t.stateNode=e,!0);case 6:return null!==(e=s(e,t.pendingProps))&&(t.stateNode=e,!0);default:return!1}}function i(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag;)t=t.return;p=t}var o=t.shouldSetTextContent;if(!(t=t.hydration))return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){r("175")},prepareToHydrateHostTextInstance:function(){r("176")},popHydrationState:function(){return!1}};var a=t.canHydrateInstance,s=t.canHydrateTextInstance,l=t.getNextHydratableSibling,c=t.getFirstHydratableChild,u=t.hydrateInstance,h=t.hydrateTextInstance,p=null,d=null,f=!1;return{enterHydrationState:function(t){return d=c(t.stateNode.containerInfo),p=t,f=!0},resetHydrationState:function(){d=p=null,f=!1},tryToClaimNextHydratableInstance:function(t){if(f){var r=d;if(r){if(!n(t,r)){if(!(r=l(r))||!n(t,r))return t.effectTag|=2,f=!1,void(p=t);e(p,d)}p=t,d=c(r)}else t.effectTag|=2,f=!1,p=t}},prepareToHydrateHostInstance:function(t,e,n){return e=u(t.stateNode,t.type,t.memoizedProps,e,n,t),t.updateQueue=e,null!==e},prepareToHydrateHostTextInstance:function(t){return h(t.stateNode,t.memoizedProps,t)},popHydrationState:function(t){if(t!==p)return!1;if(!f)return i(t),f=!0,!1;var n=t.type;if(5!==t.tag||"head"!==n&&"body"!==n&&!o(n,t.memoizedProps))for(n=d;n;)e(t,n),n=l(n);return i(t),d=p?l(t.stateNode):null,!0}}}function Ne(t){function e(t){rt=q=!0;var e=t.stateNode;if(e.current===t&&r("177"),e.isReadyForCommit=!1,Br.current=null,1a.expirationTime)&&(o=a.expirationTime),a=a.sibling;i.expirationTime=o}if(null!==e)return e;if(null!==n&&(null===n.firstEffect&&(n.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=t.firstEffect),n.lastEffect=t.lastEffect),1t))if(K<=W)for(;null!==Y;)Y=c(Y)?o(Y):i(Y);else for(;null!==Y&&!_();)Y=c(Y)?o(Y):i(Y)}else if(!(0===K||K>t))if(K<=W)for(;null!==Y;)Y=i(Y);else for(;null!==Y&&!_();)Y=i(Y)}function s(t,e){if(q&&r("243"),q=!0,t.isReadyForCommit=!1,t!==Z||e!==K||null===Y){for(;-1e)&&(t.expirationTime=e),null!==t.alternate&&(0===t.alternate.expirationTime||t.alternate.expirationTime>e)&&(t.alternate.expirationTime=e),null===t.return){if(3!==t.tag)break;var n=t.stateNode;!q&&n===Z&&e<=K&&(Y=Z=null,K=0);var i=e;if(yt>vt&&r("185"),null===n.nextScheduledRoot)n.remainingExpirationTime=i,null===at?(ot=at=n,n.nextScheduledRoot=n):(at=at.nextScheduledRoot=n,at.nextScheduledRoot=ot);else{var o=n.remainingExpirationTime;(0===o||ixt)&&(ht=!0)}function w(t){null===ct&&r("246"),ct.remainingExpirationTime=0,pt||(pt=!0,dt=t)}var E=Ie(t),M=Oe(t),T=E.popHostContainer,S=E.popHostContext,A=E.resetHostContainer,C=Pe(t,E,M,d,p),P=C.beginWork,R=C.beginFailedWork,L=Re(t,E,M).completeWork;E=Le(t,l);var I=E.commitResetTextContent,O=E.commitPlacement,N=E.commitDeletion,D=E.commitWork,U=E.commitLifeCycles,F=E.commitAttachRef,k=E.commitDetachRef,z=t.now,B=t.scheduleDeferredCallback,H=t.useSyncScheduling,G=t.prepareForCommit,V=t.resetAfterCommit,j=z(),W=2,X=0,q=!1,Y=null,Z=null,K=0,Q=null,J=null,$=null,tt=null,et=null,nt=!1,rt=!1,it=!1,ot=null,at=null,st=!1,lt=!1,ct=null,ut=0,ht=!1,pt=!1,dt=null,ft=null,mt=!1,gt=!1,vt=1e3,yt=0,xt=1;return{computeAsyncExpiration:h,computeExpirationForFiber:p,scheduleWork:d,batchedUpdates:function(t,e){var n=mt;mt=!0;try{return t(e)}finally{(mt=n)||lt||x(1,null)}},unbatchedUpdates:function(t){if(mt&&!gt){gt=!0;try{return t()}finally{gt=!1}}return t()},flushSync:function(t){var e=mt;mt=!0;try{t:{var n=X;X=1;try{var i=t();break t}finally{X=n}i=void 0}return i}finally{mt=e,lt&&r("187"),x(1,null)}},deferredUpdates:function(t){var e=X;X=h();try{return t()}finally{X=e}}}}function De(t){function e(t){return t=St(t),null===t?null:t.stateNode}var n=t.getPublicInstance;t=Ne(t);var i=t.computeAsyncExpiration,o=t.computeExpirationForFiber,a=t.scheduleWork;return{createContainer:function(t,e){var n=new oe(3,null,0);return t={current:n,containerInfo:t,pendingChildren:null,remainingExpirationTime:0,isReadyForCommit:!1,finishedWork:null,context:null,pendingContext:null,hydrate:e,nextScheduledRoot:null},n.stateNode=t},updateContainer:function(t,e,n,s){var l=e.current;if(n){n=n._reactInternalFiber;var c;t:{for(2===wt(n)&&2===n.tag||r("170"),c=n;3!==c.tag;){if($t(c)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break t}(c=c.return)||r("171")}c=c.stateNode.context}n=$t(n)?ne(n,c):c}else n=An;null===e.context?e.context=n:e.pendingContext=n,e=s,e=void 0===e?null:e,s=null!=t&&null!=t.type&&null!=t.type.prototype&&!0===t.type.prototype.unstable_isAsyncReactComponent?i():o(l),xe(l,{expirationTime:s,partialState:{element:t},callback:e,isReplace:!1,isForced:!1,nextCallback:null,next:null}),a(l,s)},batchedUpdates:t.batchedUpdates,unbatchedUpdates:t.unbatchedUpdates,deferredUpdates:t.deferredUpdates,flushSync:t.flushSync,getPublicRootInstance:function(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return n(t.child.stateNode);default:return t.child.stateNode}},findHostInstance:e,findHostInstanceWithNoPortals:function(t){return t=At(t),null===t?null:t.stateNode},injectIntoDevTools:function(t){var n=t.findFiberByHostInstance;return fe(bn({},t,{findHostInstanceByFiber:function(t){return e(t)},findFiberByHostInstance:function(t){return n?n(t):null}}))}}}function Ue(t){return!!Wi.hasOwnProperty(t)||!ji.hasOwnProperty(t)&&(Vi.test(t)?Wi[t]=!0:(ji[t]=!0,!1))}function Fe(t,e,n){var r=a(e);if(r&&o(e,n)){var i=r.mutationMethod;i?i(t,n):null==n||r.hasBooleanValue&&!n||r.hasNumericValue&&isNaN(n)||r.hasPositiveNumericValue&&1>n||r.hasOverloadedBooleanValue&&!1===n?ze(t,e):r.mustUseProperty?t[r.propertyName]=n:(e=r.attributeName,(i=r.attributeNamespace)?t.setAttributeNS(i,e,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===n?t.setAttribute(e,""):t.setAttribute(e,""+n))}else ke(t,e,o(e,n)?n:null)}function ke(t,e,n){Ue(e)&&(null==n?t.removeAttribute(e):t.setAttribute(e,""+n))}function ze(t,e){var n=a(e);n?(e=n.mutationMethod)?e(t,void 0):n.mustUseProperty?t[n.propertyName]=!n.hasBooleanValue&&"":t.removeAttribute(n.attributeName):t.removeAttribute(e)}function Be(t,e){var n=e.value,r=e.checked;return bn({type:void 0,step:void 0,min:void 0,max:void 0},e,{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:t._wrapperState.initialValue,checked:null!=r?r:t._wrapperState.initialChecked})}function He(t,e){var n=e.defaultValue;t._wrapperState={initialChecked:null!=e.checked?e.checked:e.defaultChecked,initialValue:null!=e.value?e.value:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function Ge(t,e){var n=e.checked;null!=n&&Fe(t,"checked",n||!1),n=e.value,null!=n?0===n&&""===t.value?t.value="0":"number"===e.type?(e=parseFloat(t.value)||0,(n!=e||n==e&&t.value!=n)&&(t.value=""+n)):t.value!==""+n&&(t.value=""+n):(null==e.value&&null!=e.defaultValue&&t.defaultValue!==""+e.defaultValue&&(t.defaultValue=""+e.defaultValue),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked))}function Ve(t,e){switch(e.type){case"submit":case"reset":break;case"color":case"date":case"datetime":case"datetime-local":case"month":case"time":case"week":t.value="",t.value=t.defaultValue;break;default:t.value=t.value}e=t.name,""!==e&&(t.name=""),t.defaultChecked=!t.defaultChecked,t.defaultChecked=!t.defaultChecked,""!==e&&(t.name=e)}function je(t){var e="";return yn.Children.forEach(t,function(t){null==t||"string"!==typeof t&&"number"!==typeof t||(e+=t)}),e}function We(t,e){return t=bn({children:void 0},e),(e=je(e.children))&&(t.children=e),t}function Xe(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i=e.length||r("93"),e=e[0]),n=""+e),null==n&&(n=""),i=n),t._wrapperState={initialValue:""+i}}function Ke(t,e){var n=e.value;null!=n&&(n=""+n,n!==t.value&&(t.value=n),null==e.defaultValue&&(t.defaultValue=n)),null!=e.defaultValue&&(t.defaultValue=e.defaultValue)}function Qe(t){var e=t.textContent;e===t._wrapperState.initialValue&&(t.value=e)}function Je(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function $e(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?Je(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}function tn(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}function en(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=n,o=e[n];i=null==o||"boolean"===typeof o||""===o?"":r||"number"!==typeof o||0===o||Qi.hasOwnProperty(i)&&Qi[i]?(""+o).trim():o+"px","float"===n&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}function nn(t,e,n){e&&($i[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&r("137",t,n()),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&r("60"),"object"===typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML||r("61")),null!=e.style&&"object"!==typeof e.style&&r("62",n()))}function rn(t,e){if(-1===t.indexOf("-"))return"string"===typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function on(t,e){t=9===t.nodeType||11===t.nodeType?t:t.ownerDocument;var n=Dt(t);e=Zn[e];for(var r=0;r<\/script>",t=t.removeChild(t.firstChild)):t="string"===typeof e.is?n.createElement(t,{is:e.is}):n.createElement(t):t=n.createElementNS(r,t),t}function sn(t,e){return(9===e.nodeType?e:e.ownerDocument).createTextNode(t)}function ln(t,e,n,r){var i=rn(e,n);switch(e){case"iframe":case"object":Rt("topLoad","load",t);var o=n;break;case"video":case"audio":for(o in no)no.hasOwnProperty(o)&&Rt(o,no[o],t);o=n;break;case"source":Rt("topError","error",t),o=n;break;case"img":case"image":Rt("topError","error",t),Rt("topLoad","load",t),o=n;break;case"form":Rt("topReset","reset",t),Rt("topSubmit","submit",t),o=n;break;case"details":Rt("topToggle","toggle",t),o=n;break;case"input":He(t,n),o=Be(t,n),Rt("topInvalid","invalid",t),on(r,"onChange");break;case"option":o=We(t,n);break;case"select":qe(t,n),o=bn({},n,{value:void 0}),Rt("topInvalid","invalid",t),on(r,"onChange");break;case"textarea":Ze(t,n),o=Ye(t,n),Rt("topInvalid","invalid",t),on(r,"onChange");break;default:o=n}nn(e,o,eo);var a,s=o;for(a in s)if(s.hasOwnProperty(a)){var l=s[a];"style"===a?en(t,l,eo):"dangerouslySetInnerHTML"===a?null!=(l=l?l.__html:void 0)&&Yi(t,l):"children"===a?"string"===typeof l?("textarea"!==e||""!==l)&&Ki(t,l):"number"===typeof l&&Ki(t,""+l):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(Yn.hasOwnProperty(a)?null!=l&&on(r,a):i?ke(t,a,l):null!=l&&Fe(t,a,l))}switch(e){case"input":ot(t),Ve(t,n);break;case"textarea":ot(t),Qe(t,n);break;case"option":null!=n.value&&t.setAttribute("value",n.value);break;case"select":t.multiple=!!n.multiple,e=n.value,null!=e?Xe(t,!!n.multiple,e,!1):null!=n.defaultValue&&Xe(t,!!n.multiple,n.defaultValue,!0);break;default:"function"===typeof o.onClick&&(t.onclick=_n)}}function cn(t,e,n,r,i){var o=null;switch(e){case"input":n=Be(t,n),r=Be(t,r),o=[];break;case"option":n=We(t,n),r=We(t,r),o=[];break;case"select":n=bn({},n,{value:void 0}),r=bn({},r,{value:void 0}),o=[];break;case"textarea":n=Ye(t,n),r=Ye(t,r),o=[];break;default:"function"!==typeof n.onClick&&"function"===typeof r.onClick&&(t.onclick=_n)}nn(e,r,eo);var a,s;t=null;for(a in n)if(!r.hasOwnProperty(a)&&n.hasOwnProperty(a)&&null!=n[a])if("style"===a)for(s in e=n[a])e.hasOwnProperty(s)&&(t||(t={}),t[s]="");else"dangerouslySetInnerHTML"!==a&&"children"!==a&&"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(Yn.hasOwnProperty(a)?o||(o=[]):(o=o||[]).push(a,null));for(a in r){var l=r[a];if(e=null!=n?n[a]:void 0,r.hasOwnProperty(a)&&l!==e&&(null!=l||null!=e))if("style"===a)if(e){for(s in e)!e.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(t||(t={}),t[s]="");for(s in l)l.hasOwnProperty(s)&&e[s]!==l[s]&&(t||(t={}),t[s]=l[s])}else t||(o||(o=[]),o.push(a,t)),t=l;else"dangerouslySetInnerHTML"===a?(l=l?l.__html:void 0,e=e?e.__html:void 0,null!=l&&e!==l&&(o=o||[]).push(a,""+l)):"children"===a?e===l||"string"!==typeof l&&"number"!==typeof l||(o=o||[]).push(a,""+l):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&(Yn.hasOwnProperty(a)?(null!=l&&on(i,a),o||e===l||(o=[])):(o=o||[]).push(a,l))}return t&&(o=o||[]).push("style",t),o}function un(t,e,n,r,i){rn(n,r),r=rn(n,i);for(var o=0;o=l.hasBooleanValue+l.hasNumericValue+l.hasOverloadedBooleanValue||r("50",s),a.hasOwnProperty(s)&&(l.attributeName=a[s]),o.hasOwnProperty(s)&&(l.attributeNamespace=o[s]),t.hasOwnProperty(s)&&(l.mutationMethod=t[s]),Rn[s]=l}}},Rn={},Ln=Pn,In=Ln.MUST_USE_PROPERTY,On=Ln.HAS_BOOLEAN_VALUE,Nn=Ln.HAS_NUMERIC_VALUE,Dn=Ln.HAS_POSITIVE_NUMERIC_VALUE,Un=Ln.HAS_OVERLOADED_BOOLEAN_VALUE,Fn=Ln.HAS_STRING_BOOLEAN_VALUE,kn={Properties:{allowFullScreen:On,async:On,autoFocus:On,autoPlay:On,capture:Un,checked:In|On,cols:Dn,contentEditable:Fn,controls:On,default:On,defer:On,disabled:On,download:Un,draggable:Fn,formNoValidate:On,hidden:On,loop:On,multiple:In|On,muted:In|On,noValidate:On,open:On,playsInline:On,readOnly:On,required:On,reversed:On,rows:Dn,rowSpan:Nn,scoped:On,seamless:On,selected:In|On,size:Dn,start:Nn,span:Dn,spellCheck:Fn,style:0,tabIndex:0,itemScope:On,acceptCharset:0,className:0,htmlFor:0,httpEquiv:0,value:Fn},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMMutationMethods:{value:function(t,e){if(null==e)return t.removeAttribute("value");"number"!==t.type||!1===t.hasAttribute("value")?t.setAttribute("value",""+e):t.validity&&!t.validity.badInput&&t.ownerDocument.activeElement!==t&&t.setAttribute("value",""+e)}}},zn=Ln.HAS_STRING_BOOLEAN_VALUE,Bn={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Hn={Properties:{autoReverse:zn,externalResourcesRequired:zn,preserveAlpha:zn},DOMAttributeNames:{autoReverse:"autoReverse",externalResourcesRequired:"externalResourcesRequired",preserveAlpha:"preserveAlpha"},DOMAttributeNamespaces:{xlinkActuate:Bn.xlink,xlinkArcrole:Bn.xlink,xlinkHref:Bn.xlink,xlinkRole:Bn.xlink,xlinkShow:Bn.xlink,xlinkTitle:Bn.xlink,xlinkType:Bn.xlink,xmlBase:Bn.xml,xmlLang:Bn.xml,xmlSpace:Bn.xml}},Gn=/[\-\:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode x-height xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xmlns:xlink xml:lang xml:space".split(" ").forEach(function(t){var e=t.replace(Gn,s);Hn.Properties[e]=0,Hn.DOMAttributeNames[e]=t}),Ln.injectDOMPropertyConfig(kn),Ln.injectDOMPropertyConfig(Hn);var Vn={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,injection:{injectErrorUtils:function(t){"function"!==typeof t.invokeGuardedCallback&&r("197"),l=t.invokeGuardedCallback}},invokeGuardedCallback:function(t,e,n,r,i,o,a,s,c){l.apply(Vn,arguments)},invokeGuardedCallbackAndCatchFirstError:function(t,e,n,r,i,o,a,s,l){if(Vn.invokeGuardedCallback.apply(this,arguments),Vn.hasCaughtError()){var c=Vn.clearCaughtError();Vn._hasRethrowError||(Vn._hasRethrowError=!0,Vn._rethrowError=c)}},rethrowCaughtError:function(){return c.apply(Vn,arguments)},hasCaughtError:function(){return Vn._hasCaughtError},clearCaughtError:function(){if(Vn._hasCaughtError){var t=Vn._caughtError;return Vn._caughtError=null,Vn._hasCaughtError=!1,t}r("198")}},jn=null,Wn={},Xn=[],qn={},Yn={},Zn={},Kn=Object.freeze({plugins:Xn,eventNameDispatchConfigs:qn,registrationNameModules:Yn,registrationNameDependencies:Zn,possibleRegistrationNames:null,injectEventPluginOrder:p,injectEventPluginsByName:d}),Qn=null,Jn=null,$n=null,tr=null,er={injectEventPluginOrder:p,injectEventPluginsByName:d},nr=Object.freeze({injection:er,getListener:b,extractEvents:_,enqueueEvents:w,processEventQueue:E}),rr=Math.random().toString(36).slice(2),ir="__reactInternalInstance$"+rr,or="__reactEventHandlers$"+rr,ar=Object.freeze({precacheFiberNode:function(t,e){e[ir]=t},getClosestInstanceFromNode:M,getInstanceFromNode:function(t){return t=t[ir],!t||5!==t.tag&&6!==t.tag?null:t},getNodeFromInstance:T,getFiberCurrentPropsFromNode:S,updateFiberProps:function(t,e){t[or]=e}}),sr=Object.freeze({accumulateTwoPhaseDispatches:N,accumulateTwoPhaseDispatchesSkipTarget:function(t){g(t,L)},accumulateEnterLeaveDispatches:D,accumulateDirectDispatches:function(t){g(t,O)}}),lr=null,cr={_root:null,_startText:null,_fallbackText:null},ur="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),hr={type:null,target:null,currentTarget:_n.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};bn(z.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!==typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=_n.thatReturnsTrue)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!==typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=_n.thatReturnsTrue)},persist:function(){this.isPersistent=_n.thatReturnsTrue},isPersistent:_n.thatReturnsFalse,destructor:function(){var t,e=this.constructor.Interface;for(t in e)this[t]=null;for(e=0;e=parseInt(gr.version(),10))}var vr,yr=mr,xr=xn.canUseDOM&&(!dr||fr&&8=fr),br=String.fromCharCode(32),_r={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},wr=!1,Er=!1,Mr={eventTypes:_r,extractEvents:function(t,e,n,r){var i;if(dr)t:{switch(t){case"topCompositionStart":var o=_r.compositionStart;break t;case"topCompositionEnd":o=_r.compositionEnd;break t;case"topCompositionUpdate":o=_r.compositionUpdate;break t}o=void 0}else Er?W(t,n)&&(o=_r.compositionEnd):"topKeyDown"===t&&229===n.keyCode&&(o=_r.compositionStart);return o?(xr&&(Er||o!==_r.compositionStart?o===_r.compositionEnd&&Er&&(i=F()):(cr._root=r,cr._startText=k(),Er=!0)),o=V.getPooled(o,e,n,r),i?o.data=i:null!==(i=X(n))&&(o.data=i),N(o),i=o):i=null,(t=yr?q(t,n):Y(t,n))?(e=j.getPooled(_r.beforeInput,e,n,r),e.data=t,N(e)):e=null,[i,e]}},Tr=null,Sr=null,Ar=null,Cr={injectFiberControlledHostComponent:function(t){Tr=t}},Pr=Object.freeze({injection:Cr,enqueueStateRestore:K,restoreStateIfNeeded:Q}),Rr=!1,Lr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};xn.canUseDOM&&(vr=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var Ir={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}},Or=null,Nr=null,Dr=!1;xn.canUseDOM&&(Dr=nt("input")&&(!document.documentMode||9=document.documentMode,$r={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},ti=null,ei=null,ni=null,ri=!1,ii={eventTypes:$r,extractEvents:function(t,e,n,r){var i,o=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(i=!o)){t:{o=Dt(o),i=Zn.onSelect;for(var a=0;ae&&(e=8),Bi=e"+e+"",e=qi.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}}),Zi=/["'&<>]/;xn.canUseDOM&&("textContent"in document.documentElement||(tn=function(t,e){if(3===t.nodeType)t.nodeValue=e;else{if("boolean"===typeof e||"number"===typeof e)e=""+e;else{e=""+e;var n=Zi.exec(e);if(n){var r,i="",o=0;for(r=n.index;rr&&(i=r,r=t,t=i),i=Ft(n,t);var o=Ft(n,r);if(i&&o&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)){var a=document.createRange();a.setStart(i.node,i.offset),e.removeAllRanges(),t>r?(e.addRange(a),e.extend(o.node,o.offset)):(a.setEnd(o.node,o.offset),e.addRange(a))}}for(e=[],t=n;t=t.parentNode;)1===t.nodeType&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(Sn(n),n=0;n10?null:{brushSize:e}})},n.handleDecBrushSize=function(){n.setState(function(t){if(null!==t.drawing)return null;var e=t.brushSize-1;return e<=0?null:{brushSize:e}})},n.handleUndo=function(){n.setState(function(t){if(null!==t.drawing)return null;var e=t.grid;if(0===e.past.length)return null;var n=e.past.slice();return{grid:{past:n,present:n.pop(),future:[e.present].concat(e.future)}}})},n.handleRedo=function(){n.setState(function(t){if(null!==t.drawing)return null;var e=t.grid;if(0===e.future.length)return null;var n=e.future.slice(),r=n.shift();return{grid:{past:e.past.concat([e.present]),present:r,future:n}}})},n.state={color:l.b.Yellow,mode:"paint",brushSize:1,drawing:null,grid:{past:[],present:new s.a(220,180),future:[]}},n}return h(e,t),e.prototype.componentDidMount=function(){var t=this;fetch("/textures/send-nudes.png").then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t)}).then(function(e){var n=document.createElement("canvas");n.width=e.width,n.height=e.height;var i=n.getContext("2d");i.drawImage(e,0,0);var o=i.getImageData(0,0,e.width,e.height);t.setState({grid:{past:[],present:r(o),future:[]}})})},e.prototype.pushNextGrid=function(t,e){var n=t.grid.past.length>9?t.grid.past.slice(1):t.grid.past.slice();return n.push(t.grid.present),{past:n,present:e,future:[]}},e.prototype.render=function(){return o.createElement("div",null,o.createElement("h1",{style:{color:"red",fontStyle:"italic",textAlign:"center"}},"KIM JONG SIMULTATOR"),o.createElement("div",{className:"ControlContainer"},o.createElement(m,{mode:this.state.mode,onChange:this.handleSetMode}),o.createElement(g,{color:this.state.color,onChange:this.handleSetColor}),o.createElement(v,{brushSize:this.state.brushSize,onIncrement:this.handleIncBrushSize,onDecrement:this.handleDecBrushSize}),o.createElement(y,{canUndo:this.state.grid.past.length>0,canRedo:this.state.grid.future.length>0,onUndo:this.handleUndo,onRedo:this.handleRedo})),o.createElement(c.a,{width:1e3,height:500,rowSpacing:1,columnSpacing:1,grid:null!==this.state.drawing?this.state.drawing.pending:this.state.grid.present,drawing:null!==this.state.drawing,onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onMouseMove:this.handleMouseMove,onMouseLeave:function(){}}),o.createElement(u.a,{grid:this.state.grid.present}))},e}(o.Component);e.a=d;var f=["paint","line","rect","fill","clear"],m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.render=function(){var t=this.props.mode,e=this.props.onChange;return o.createElement("div",null,o.createElement("h3",null,"MODE"),o.createElement("ul",null,f.map(function(n){var r=t===n?{color:"white",backgroundColor:"black"}:void 0;return o.createElement("li",{key:n,onClick:function(){return e(n)},style:{cursor:"pointer"}},o.createElement("span",{style:r},n.toUpperCase()))})))},e}(o.PureComponent),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.render=function(){var t=this.props.color,e=this.props.onChange;return o.createElement("div",null,o.createElement("h3",null,"COLOR"),o.createElement("ul",null,l.a.map(function(n){var r=Object(l.c)(n),i=t===n?{color:"white",backgroundColor:"black"}:void 0;return o.createElement("li",{key:r,onClick:function(){return e(n)},style:{cursor:"pointer"}},o.createElement("span",{style:i},o.createElement("div",{style:{border:"1px solid black",backgroundColor:r,width:10,height:10,display:"inline-block"}}),r.toUpperCase()))})))},e}(o.PureComponent),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.render=function(){var t=this.props;return o.createElement("div",null,o.createElement("h3",null,"BRUSH SIZE"),o.createElement("button",{onClick:t.onDecrement},"-"),t.brushSize,o.createElement("button",{onClick:t.onIncrement},"+"))},e}(o.PureComponent),y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return h(e,t),e.prototype.render=function(){var t=this.props;return o.createElement("div",null,o.createElement("h3",null,"HISTORY"),o.createElement("ul",null,o.createElement("li",null,o.createElement("button",{disabled:!t.canUndo,onClick:t.onUndo},"UNDO")),o.createElement("li",null,o.createElement("button",{disabled:!t.canRedo,onClick:t.onRedo},"REDO"))))},e}(o.PureComponent)},function(t,e){},function(t,e,n){"use strict";function r(t,e,n,r,i){for(var o=Math.abs(n-t),a=Math.abs(r-e),s=t-a&&(c-=a,t+=s),u=0&&t=0&&e=0&&t=0&&ei/l?(n=Math.floor(i/a),e=Math.floor(1*n/1)):(e=Math.floor(r/s),n=Math.floor(1*e/1)),{cellWidth:e,cellHeight:n,xOffset:Math.floor((r-s*e)/2),yOffset:Math.floor((i-a*n)/2)}},e.prototype.getEventCoordinates=function(t,e){var n=this.state,r=t.currentTarget.getBoundingClientRect();e(Math.floor((t.clientX-r.left-n.xOffset)/n.cellWidth),Math.floor((t.clientY-r.top-n.yOffset)/n.cellHeight))},e.prototype.paint=function(){if(this.canvas){var t=this.canvas.getContext("2d");if(null!==t){var e=this,n=e.state,r=e.props,o=n.xOffset,a=n.yOffset,s=n.cellWidth,l=n.cellHeight,c=r.grid,u=c.rows,h=c.columns;t.fillStyle="#eee",t.fillRect(0,0,r.width,r.height);for(var p=0;p45&&t<65)return"continue";var n=m+.75*t;M.forEach(function(t){e(t,n)})}(h);for(var T=[-29.3,-28.5,28.5,29.3],h=0;h<105;h+=3)!function(t){if(t>25&&t<33)return"continue";var n=.75*t-43.25;T.forEach(function(t){e(t,n)})}(h);for(var S=m-3,A=-6;A<130;A+=6){var b=new r.g(l);b.scale.set(4,4,4),b.position.set(f+.3*A,0,S),c.add(b)}this.renderScene()},e.prototype.updateRender=function(){for(var t=this.props.grid,e=this.props.textures.materialMap,n=this,r=n.soldiers,i=n.lastGrid,o=0,a=r;o