diff --git a/dist/saver.min.8169087c-e61e-44d9-a802-fd396bd71391.js b/dist/saver.min.8169087c-e61e-44d9-a802-fd396bd71391.js new file mode 100644 index 0000000..d74788a --- /dev/null +++ b/dist/saver.min.8169087c-e61e-44d9-a802-fd396bd71391.js @@ -0,0 +1,26 @@ +var e;e=function(){"use strict";function e(){}function t(e,t){this.x=e||0,this.y=t||0}function n(){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 r(e,i,a,o,s,c,l,u,h,p){Object.defineProperty(this,"id",{value:Ia++}),this.uuid=Na.generateUUID(),this.name="",this.image=void 0!==e?e:r.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==i?i:r.DEFAULT_MAPPING,this.wrapS=void 0!==a?a:1001,this.wrapT=void 0!==o?o:1001,this.magFilter=void 0!==s?s:1006,this.minFilter=void 0!==c?c:1008,this.anisotropy=void 0!==h?h:1,this.format=void 0!==l?l:1023,this.internalFormat=null,this.type=void 0!==u?u:1009,this.offset=new t(0,0),this.repeat=new t(1,1),this.center=new t(0,0),this.rotation=0,this.matrixAutoUpdate=1,this.matrix=new n,this.generateMipmaps=1,this.premultiplyAlpha=0,this.flipY=1,this.unpackAlignment=4,this.encoding=void 0!==p?p:3e3,this.version=0,this.onUpdate=null}function i(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function a(e,t,n){this.width=e,this.height=t,this.scissor=new i(0,0,e,t),this.scissorTest=0,this.viewport=new i(0,0,e,t),n=n||{},this.texture=new r(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps?n.generateMipmaps:0,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0!==n.depthBuffer?n.depthBuffer:1,this.stencilBuffer=void 0!==n.stencilBuffer?n.stencilBuffer:1,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function o(e,t,n){a.call(this,e,t,n),this.samples=4}function s(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}function c(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function l(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function u(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||u.DefaultOrder}function h(){this.mask=1}function p(){Object.defineProperty(this,"id",{value:Xa++}),this.uuid=Na.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=p.DefaultUp.clone();var e=new c,t=new u,r=new s,i=new c(1,1,1);t._onChange((function(){r.setFromEuler(t,0)})),r._onChange((function(){t.setFromQuaternion(r,void 0,0)})),Object.defineProperties(this,{position:{configurable:1,enumerable:1,value:e},rotation:{configurable:1,enumerable:1,value:t},quaternion:{configurable:1,enumerable:1,value:r},scale:{configurable:1,enumerable:1,value:i},modelViewMatrix:{value:new l},normalMatrix:{value:new n}}),this.matrix=new l,this.matrixWorld=new l,this.matrixAutoUpdate=p.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=0,this.layers=new h,this.visible=1,this.castShadow=0,this.receiveShadow=0,this.frustumCulled=1,this.renderOrder=0,this.userData={}}function d(){p.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=1,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function f(e,t){this.min=void 0!==e?e:new c(1/0,1/0,1/0),this.max=void 0!==t?t:new c(-1/0,-1/0,-1/0)}function m(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){xo.fromArray(e,a);var s=i.x*Math.abs(xo.x)+i.y*Math.abs(xo.y)+i.z*Math.abs(xo.z),c=t.dot(xo),l=n.dot(xo),u=r.dot(xo);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return 0}return 1}function g(e,t){this.center=void 0!==e?e:new c,this.radius=void 0!==t?t:0}function v(e,t){this.origin=void 0!==e?e:new c,this.direction=void 0!==t?t:new c(0,0,-1)}function y(e,t){this.normal=void 0!==e?e:new c(1,0,0),this.constant=void 0!==t?t:0}function x(e,t,n){this.a=void 0!==e?e:new c,this.b=void 0!==t?t:new c,this.c=void 0!==n?n:new c}function b(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function w(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function _(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function M(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function S(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new c,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new b,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}function T(){Object.defineProperty(this,"id",{value:Vo++}),this.uuid=Na.generateUUID(),this.name="",this.type="Material",this.fog=1,this.blending=1,this.side=0,this.flatShading=0,this.vertexColors=0,this.opacity=1,this.transparent=0,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=1,this.depthWrite=1,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=0,this.clippingPlanes=null,this.clipIntersection=0,this.clipShadows=0,this.shadowSide=null,this.colorWrite=1,this.precision=null,this.polygonOffset=0,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=0,this.alphaTest=0,this.premultipliedAlpha=0,this.visible=1,this.toneMapped=1,this.userData={},this.version=0}function E(e){T.call(this),this.type="MeshBasicMaterial",this.color=new b(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.setValues(e)}function A(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=1==n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function L(e,t,n){A.call(this,new Int8Array(e),t,n)}function C(e,t,n){A.call(this,new Uint8Array(e),t,n)}function R(e,t,n){A.call(this,new Uint8ClampedArray(e),t,n)}function P(e,t,n){A.call(this,new Int16Array(e),t,n)}function O(e,t,n){A.call(this,new Uint16Array(e),t,n)}function N(e,t,n){A.call(this,new Int32Array(e),t,n)}function D(e,t,n){A.call(this,new Uint32Array(e),t,n)}function I(e,t,n){A.call(this,new Float32Array(e),t,n)}function z(e,t,n){A.call(this,new Float64Array(e),t,n)}function B(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=0,this.normalsNeedUpdate=0,this.colorsNeedUpdate=0,this.uvsNeedUpdate=0,this.groupsNeedUpdate=0}function U(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,r=e.length;nt&&(t=e[n]);return t}function F(){Object.defineProperty(this,"id",{value:qo+=2}),this.uuid=Na.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=0,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function H(e,t){p.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new F,this.material=void 0!==t?t:new E,this.updateMorphTargets()}function k(e,t,n,r,i,a,o,s){if(null===(1===t.side?r.intersectTriangle(o,a,i,1,s):r.intersectTriangle(i,a,o,2!==t.side,s)))return null;ms.copy(s),ms.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(ms);return cn.far?null:{distance:c,point:ms.clone(),object:e}}function G(e,n,r,i,a,o,s,c,l,u,h,p){ns.fromBufferAttribute(a,u),rs.fromBufferAttribute(a,h),is.fromBufferAttribute(a,p);var d=e.morphTargetInfluences;if(n.morphTargets&&o&&d){cs.set(0,0,0),ls.set(0,0,0),us.set(0,0,0);for(var f=0,m=o.length;f0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var i,a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=1==n.logarithmicDepthBuffer,l=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=u>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function oe(){function e(){u.value!==i&&(u.value=i,u.needsUpdate=a>0),r.numPlanes=a,r.numIntersection=0}function t(e,t,n,i){var a=null!==e?e.length:0,o=null;if(0!==a){if(o=u.value,1!=i||null===o){var s=n+4*a,h=t.matrixWorldInverse;l.getNormalMatrix(h),(null===o||o.length65535?D:O)(n,1);d.version=a,t.update(d,34963);var f=o.get(e);f&&t.remove(f),o.set(e,d)}var a=new WeakMap,o=new WeakMap;return{get:function(e,t){var i=a.get(t);return i||(t.addEventListener("dispose",r),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new F).setFromObject(e)),i=t._bufferGeometry),a.set(t,i),n.memory.geometries++,i)},update:function(e){var n=e.index,r=e.attributes;for(var i in null!==n&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s0)return e;var i=t*n,a=Ps[i];if(void 0===a&&(a=new Float32Array(i),Ps[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function ye(e,t){if(e.length!==t.length)return 0;for(var n=0,r=e.length;n");return ut(n)}function pt(e){return e.replace(Hs,ft).replace(Fs,dt)}function dt(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ft(0,t,n,r)}function ft(e,t,n,r){for(var i="",a=parseInt(t);a0?e.gammaFactor:1,g=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(st).join("\n")}(n),v=function(e){var t=[];for(var n in e){var r=e[n];0!=r&&t.push("#define "+n+" "+r)}return t.join("\n")}(c),y=s.createProgram();if(n.isRawShaderMaterial?((r=[v].filter(st).join("\n")).length>0&&(r+="\n"),(i=[g,v].filter(st).join("\n")).length>0&&(i+="\n")):(r=[mt(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&0==n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#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(st).join("\n"),i=[g,mt(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Ts.tonemapping_pars_fragment:"",0!==n.toneMapping?ot("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Ts.encodings_pars_fragment:"",n.mapEncoding?at("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?at("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?at("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?at("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?at("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?("linearToOutputTexel",a=n.outputEncoding,o=rt(a),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+o[0]+o[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(st).join("\n")),l=lt(l=ct(l=ut(l),n),n),u=lt(u=ct(u=ut(u),n),n),l=pt(l),u=pt(u),n.isWebGL2&&!n.isRawShaderMaterial){var x=0,b=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==l.match(b)&&null!==u.match(b)&&(x=1,l=l.replace(b,""),u=u.replace(b,"")),r="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+r,i=["#version 300 es\n\n#define varying in",x?"":"out highp vec4 pc_fragColor;",x?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+i}var w,_,M=i+u,S=nt(s,35633,r+l),T=nt(s,35632,M);if(s.attachShader(y,S),s.attachShader(y,T),void 0!==n.index0AttributeName?s.bindAttribLocation(y,0,n.index0AttributeName):1==n.morphTargets&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y),e.debug.checkShaderErrors){var E=s.getProgramInfoLog(y).trim(),A=s.getShaderInfoLog(S).trim(),L=s.getShaderInfoLog(T).trim(),C=1,R=1;if(0==s.getProgramParameter(y,35714)){C=0;var P=it(s,S,"vertex"),O=it(s,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(y,35715),"gl.getProgramInfoLog",E,P,O)}else""!==E?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",E):""!==A&&""!==L||(R=0);R&&(this.diagnostics={runnable:C,programLog:E,vertexShader:{log:A,prefix:r},fragmentShader:{log:L,prefix:i}})}return s.detachShader(y,S),s.detachShader(y,T),s.deleteShader(S),s.deleteShader(T),this.getUniforms=function(){return void 0===w&&(w=new tt(s,y)),w},this.getAttributes=function(){return void 0===_&&(_=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i0,maxBones:_,useVertexTexture:s,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:p.directional.length,numPointLights:p.point.length,numSpotLights:p.spot.length,numRectAreaLights:p.rectArea.length,numHemiLights:p.hemi.length,numDirLightShadows:p.directionalShadowMap.length,numPointLightShadows:p.pointShadowMap.length,numSpotLightShadows:p.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:g,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking?i.depthPacking:0,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:a||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:i.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(void 0===t.isRawShaderMaterial){for(var i=0;i<70;i++)n.push(t[p[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var r,a=0,o=i.length;a1&&r.sort(e||xt),i.length>1&&i.sort(t||bt)}}}function _t(){function e(n){var r=n.target;r.removeEventListener("dispose",e),t.delete(r)}var t=new WeakMap;return{get:function(n,r){var i,a=t.get(n);return void 0===a?(i=new wt,t.set(n,new WeakMap),t.get(n).set(r,i),n.addEventListener("dispose",e)):void 0===(i=a.get(r))&&(i=new wt,a.set(r,i)),i},dispose:function(){t=new WeakMap}}}function Mt(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new c,color:new b};break;case"SpotLight":n={position:new c,direction:new c,color:new b,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new c,color:new b,distance:0,decay:0};break;case"HemisphereLight":n={direction:new c,skyColor:new b,groundColor:new b};break;case"RectAreaLight":n={color:new b,position:new c,halfWidth:new c,halfHeight:new c}}return e[t.id]=n,n}}}function St(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Tt(){for(var e,n=new Mt,r=(e={},{get:function(n){if(void 0!==e[n.id])return e[n.id];var r;switch(n.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowRadius:1,shadowMapSize:new t};break;case"PointLight":r={shadowBias:0,shadowRadius:1,shadowMapSize:new t,shadowCameraNear:1,shadowCameraFar:1e3}}return e[n.id]=r,r}}),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},a=0;a<9;a++)i.probe.push(new c);var o=new c,s=new l,u=new l;return{setup:function(e,t,a){for(var c=0,l=0,h=0,p=0;p<9;p++)i.probe[p].set(0,0,0);var d=0,f=0,m=0,g=0,v=0,y=0,x=0,b=0,w=a.matrixWorldInverse;e.sort(St),p=0;for(var _=e.length;p<_;p++){var M=e[p],S=M.color,T=M.intensity,E=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)c+=S.r*T,l+=S.g*T,h+=S.b*T;else if(M.isLightProbe)for(var L=0;L<9;L++)i.probe[L].addScaledVector(M.sh.coefficients[L],T);else if(M.isDirectionalLight){if((P=n.get(M)).color.copy(M.color).multiplyScalar(M.intensity),P.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),P.direction.sub(o),P.direction.transformDirection(w),M.castShadow){var C=M.shadow;(R=r.get(M)).shadowBias=C.bias,R.shadowRadius=C.radius,R.shadowMapSize=C.mapSize,i.directionalShadow[d]=R,i.directionalShadowMap[d]=A,i.directionalShadowMatrix[d]=M.shadow.matrix,y++}i.directional[d]=P,d++}else if(M.isSpotLight)(P=n.get(M)).position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(w),P.color.copy(S).multiplyScalar(T),P.distance=E,P.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),P.direction.sub(o),P.direction.transformDirection(w),P.coneCos=Math.cos(M.angle),P.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),P.decay=M.decay,M.castShadow&&(C=M.shadow,(R=r.get(M)).shadowBias=C.bias,R.shadowRadius=C.radius,R.shadowMapSize=C.mapSize,i.spotShadow[m]=R,i.spotShadowMap[m]=A,i.spotShadowMatrix[m]=M.shadow.matrix,b++),i.spot[m]=P,m++;else if(M.isRectAreaLight)(P=n.get(M)).color.copy(S).multiplyScalar(T),P.position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(w),u.identity(),s.copy(M.matrixWorld),s.premultiply(w),u.extractRotation(s),P.halfWidth.set(.5*M.width,0,0),P.halfHeight.set(0,.5*M.height,0),P.halfWidth.applyMatrix4(u),P.halfHeight.applyMatrix4(u),i.rectArea[g]=P,g++;else if(M.isPointLight){var R;(P=n.get(M)).position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(w),P.color.copy(M.color).multiplyScalar(M.intensity),P.distance=M.distance,P.decay=M.decay,M.castShadow&&(C=M.shadow,(R=r.get(M)).shadowBias=C.bias,R.shadowRadius=C.radius,R.shadowMapSize=C.mapSize,R.shadowCameraNear=C.camera.near,R.shadowCameraFar=C.camera.far,i.pointShadow[f]=R,i.pointShadowMap[f]=A,i.pointShadowMatrix[f]=M.shadow.matrix,x++),i.point[f]=P,f++}else if(M.isHemisphereLight){var P;(P=n.get(M)).direction.setFromMatrixPosition(M.matrixWorld),P.direction.transformDirection(w),P.direction.normalize(),P.skyColor.copy(M.color).multiplyScalar(T),P.groundColor.copy(M.groundColor).multiplyScalar(T),i.hemi[v]=P,v++}}i.ambient[0]=c,i.ambient[1]=l,i.ambient[2]=h;var O=i.hash;O.directionalLength===d&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===g&&O.hemiLength===v&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===b||(i.directional.length=d,i.spot.length=m,i.rectArea.length=g,i.point.length=f,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=x,i.spotShadowMatrix.length=b,O.directionalLength=d,O.pointLength=f,O.spotLength=m,O.rectAreaLength=g,O.hemiLength=v,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=b,i.version=ks++)},state:i}}function Et(){var e=new Tt,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(r){e.setup(t,n,r)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function At(){function e(n){var r=n.target;r.removeEventListener("dispose",e),t.delete(r)}var t=new WeakMap;return{get:function(n,r){var i;return 0==t.has(n)?(i=new Et,t.set(n,new WeakMap),t.get(n).set(r,i),n.addEventListener("dispose",e)):0==t.get(n).has(r)?(i=new Et,t.get(n).set(r,i)):i=t.get(n).get(r),i},dispose:function(){t=new WeakMap}}}function Lt(e){T.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=0,this.morphTargets=0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=0,this.wireframeLinewidth=1,this.fog=0,this.setValues(e)}function Ct(e){T.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new c,this.nearDistance=1,this.farDistance=1e3,this.skinning=0,this.morphTargets=0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=0,this.setValues(e)}function Rt(e,n,r){function o(t,r){var i=n.update(_);x.uniforms.shadow_pass.value=t.map.texture,x.uniforms.resolution.value=t.mapSize,x.uniforms.radius.value=t.radius,e.setRenderTarget(t.mapPass),e.clear(),e.renderBufferDirect(r,null,i,x,_,null),b.uniforms.shadow_pass.value=t.mapPass.texture,b.uniforms.resolution.value=t.mapSize,b.uniforms.radius.value=t.radius,e.setRenderTarget(t.map),e.clear(),e.renderBufferDirect(r,null,i,b,_,null)}function s(e,t,n){var r=e<<0|t<<1|n<<2,i=m[r];return void 0===i&&(i=new Lt({depthPacking:3201,morphTargets:e,skinning:t}),m[r]=i),i}function c(e,t,n){var r=e<<0|t<<1|n<<2,i=g[r];return void 0===i&&(i=new Ct({morphTargets:e,skinning:t}),g[r]=i),i}function l(t,n,r,i,a,o){var l=t.geometry,u=null,h=s,p=t.customDepthMaterial;if(1==r.isPointLight&&(h=c,p=t.customDistanceMaterial),void 0===p){var d=0;1==n.morphTargets&&(1==l.isBufferGeometry?d=l.morphAttributes&&l.morphAttributes.position&&l.morphAttributes.position.length>0:1==l.isGeometry&&(d=l.morphTargets&&l.morphTargets.length>0));var f=0;1==t.isSkinnedMesh&&(1==n.skinning?f=1:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),u=h(d,f,1==t.isInstancedMesh)}else u=p;if(e.localClippingEnabled&&1==n.clipShadows&&0!==n.clippingPlanes.length){var m=u.uuid,g=n.uuid,x=v[m];void 0===x&&(x={},v[m]=x);var b=x[g];void 0===b&&(b=u.clone(),x[g]=b),u=b}return u.visible=n.visible,u.wireframe=n.wireframe,u.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:y[n.side],u.clipShadows=n.clipShadows,u.clippingPlanes=n.clippingPlanes,u.clipIntersection=n.clipIntersection,u.wireframeLinewidth=n.wireframeLinewidth,u.linewidth=n.linewidth,1==r.isPointLight&&1==u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(r.matrixWorld),u.nearDistance=i,u.farDistance=a),u}function u(t,r,i,a,o){if(0!=t.visible){if(t.layers.test(r.layers)&&(t.isMesh||t.isLine||t.isPoints)&&(t.castShadow||t.receiveShadow&&3===o)&&(!t.frustumCulled||h.intersectsObject(t))){t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld);var s=n.update(t),c=t.material;if(Array.isArray(c))for(var p=s.groups,d=0,f=p.length;d\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),b=x.clone();b.defines.HORIZONAL_PASS=1;var w=new F;w.setAttribute("position",new A(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var _=new H(w,x),M=this;this.enabled=0,this.autoUpdate=1,this.needsUpdate=0,this.type=1,this.render=function(t,n,i){if(0!=M.enabled&&(0!=M.autoUpdate||0!=M.needsUpdate)&&0!==t.length){var s=e.getRenderTarget(),c=e.getActiveCubeFace(),l=e.getActiveMipmapLevel(),m=e.state;m.setBlending(0),m.buffers.color.setClear(1,1,1,1),m.buffers.depth.setTest(1),m.setScissorTest(0);for(var g=0,v=t.length;gr||p.y>r)&&(console.warn("THREE.WebGLShadowMap:",y,"has shadow exceeding max texture size, reducing"),p.x>r&&(d.x=Math.floor(r/b.x),p.x=d.x*b.x,x.mapSize.x=d.x),p.y>r&&(d.y=Math.floor(r/b.y),p.y=d.y*b.y,x.mapSize.y=d.y)),null===x.map&&!x.isPointLightShadow&&3===this.type){var w={minFilter:1006,magFilter:1006,format:1023};x.map=new a(p.x,p.y,w),x.map.texture.name=y.name+".shadowMap",x.mapPass=new a(p.x,p.y,w),x.camera.updateProjectionMatrix()}null===x.map&&(w={minFilter:1003,magFilter:1003,format:1023},x.map=new a(p.x,p.y,w),x.map.texture.name=y.name+".shadowMap",x.camera.updateProjectionMatrix()),e.setRenderTarget(x.map),e.clear();for(var _=x.getViewportCount(),S=0;S<_;S++){var T=x.getViewport(S);f.set(d.x*T.x,d.y*T.y,d.x*T.z,d.y*T.w),m.viewport(f),x.updateMatrices(y,S),h=x.getFrustum(),u(n,i,x.camera,y,this.type)}x.isPointLightShadow||3!==this.type||o(x,i)}else console.warn("THREE.WebGLShadowMap:",y,"has no shadow.")}M.needsUpdate=0,e.setRenderTarget(s,c,l)}}}function Pt(e,t,n){function r(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o=1):-1!==H.indexOf("OpenGL ES")&&(F=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(H)[1]),U=F>=2);var k=null,G={},j=new i,V=new i,W={};W[3553]=r(3553,3553,1),W[34067]=r(34067,34069,6),f.setClear(0,0,0,1),m.setClear(1),g.setClear(0),o(2929),m.setFunc(3),l(0),u(1),o(2884),c(0);var q={100:32774,101:32778,102:32779};if(d)q[103]=32775,q[104]=32776;else{var X=t.get("EXT_blend_minmax");null!==X&&(q[103]=X.MIN_EXT,q[104]=X.MAX_EXT)}var Y={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};return{buffers:{color:f,depth:m,stencil:g},initAttributes:function(){for(var e=0,t=y.length;er||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||1==t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Na.floorPowerOfTwo:Math.floor,o=a(i*e.width),c=a(i*e.height);void 0===T&&(T=s(o,c));var l=n?s(o,c):T;return l.width=o,l.height=c,l.getContext("2d").drawImage(e,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+c+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function l(e){return Na.isPowerOfTwo(e.width)&&Na.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function h(t,n,i,a){e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function p(n,r,i){if(0==E)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function d(e){return 1003===e||1004===e||1005===e?9728:9729}function f(t){var n=t.target;n.removeEventListener("dispose",f),function(t){var n=r.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),r.remove(t))}(n),n.isVideoTexture&&P.delete(n),o.memory.textures--}function m(t){var n=t.target;n.removeEventListener("dispose",m),function(t){var n=r.get(t),i=r.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}}(n),o.memory.textures--}function g(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;P.get(e)!==t&&(P.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(0!=a.complete)return void w(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function v(t,i){if(6===t.image.length){var o=r.get(t);if(t.version>0&&o.__version!==t.version){b(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),d=t.image[0]&&t.image[0].isDataTexture,f=[],m=0;m<6;m++)f[m]=s||d?d?t.image[m].image:t.image[m]:c(t.image[m],0,1,L);var g,v=f[0],y=l(v)||E,w=a.convert(t.format),_=a.convert(t.type),M=p(t.internalFormat,w,_);if(x(34067,t,y),s){for(m=0;m<6;m++){g=f[m].mipmaps;for(var S=0;S1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function b(t,n){void 0===t.__webglInit&&(t.__webglInit=1,n.addEventListener("dispose",f),t.__webglTexture=e.createTexture(),o.memory.textures++)}function w(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),b(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var s=function(e){return E?0:1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter}(r)&&0==l(r.image),d=c(r.image,s,0,C),f=l(d)||E,m=a.convert(r.format),g=a.convert(r.type),v=p(r.internalFormat,m,g);x(o,r,f);var y,w=r.mipmaps;if(r.isDepthTexture)v=6402,E?v=1015===r.type?36012:1014===r.type?33190:1020===r.type?35056:33189:1015===r.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===r.format&&6402===v&&1012!==r.type&&1014!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=1012,g=a.convert(r.type)),1027===r.format&&6402===v&&(v=34041,1020!==r.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=1020,g=a.convert(r.type))),n.texImage2D(3553,0,v,d.width,d.height,0,m,g,null);else if(r.isDataTexture)if(w.length>0&&f){for(var _=0,M=w.length;_0&&f){for(_=0,M=w.length;_=A&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+A),N+=1,e},this.resetTextureUnits=function(){N=0},this.setTexture2D=g,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?w(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?w(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=function(t){var i=r.get(t),s=r.get(t.texture);t.addEventListener("dispose",m),s.__webglTexture=e.createTexture(),o.memory.textures++;var c=1==t.isWebGLCubeRenderTarget,d=1==t.isWebGLMultisampleRenderTarget,f=l(t)||E;if(!E||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){i.__webglFramebuffer=[];for(var v=0;v<6;v++)i.__webglFramebuffer[v]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),d)if(E){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var y=a.convert(t.texture.format),b=a.convert(t.texture.type),w=p(t.texture.internalFormat,y,b),T=S(t);e.renderbufferStorageMultisample(36161,T,w,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),M(i.__webglDepthRenderbuffer,t,1)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){for(n.bindTexture(34067,s.__webglTexture),x(34067,t.texture,f),v=0;v<6;v++)_(i.__webglFramebuffer[v],t,36064,34069+v);u(t.texture,f)&&h(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),x(3553,t.texture,f),_(i.__webglFramebuffer,t,36064,3553),u(t.texture,f)&&h(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&function(t){var n=r.get(t),i=1==t.isWebGLCubeRenderTarget;if(t.depthTexture){if(i)throw Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=1),g(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(1026===n.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(1027!==n.depthTexture.format)throw Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),M(n.__webglDepthbuffer[a],t,0)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),M(n.__webglDepthbuffer,t,0);e.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(u(t,l(e)||E)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),h(i,t,e.width,e.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(E){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(0==z&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),z=1),e=e.texture),g(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(0==B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=1),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?v(e,t):y(e,t)}}function Nt(e,t,n){var r=n.isWebGL2;return{convert:function(e){var n;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return r?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:1020===e?r?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Dt(e){Y.call(this),this.cameras=e||[]}function It(){p.call(this),this.type="Group"}function zt(e,t){function n(e){var t=g.get(e.inputSource);t&&(t.targetRay&&t.targetRay.dispatchEvent({type:e.type}),t.grip&&t.grip.dispatchEvent({type:e.type}))}function r(){g.forEach((function(e,t){e.targetRay&&(e.targetRay.dispatchEvent({type:"disconnected",data:t}),e.targetRay.visible=0),e.grip&&(e.grip.dispatchEvent({type:"disconnected",data:t}),e.grip.visible=0)})),g.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),T.stop(),l.isPresenting=0,l.dispatchEvent({type:"sessionend"})}function a(e){p=e,T.setContext(u),T.start(),l.isPresenting=1,l.dispatchEvent({type:"sessionstart"})}function o(e){for(var t=u.inputSources,n=0;n=0&&e.numSupportedMorphTargets++}if(e.morphNormals)for(e.numSupportedMorphNormals=0,f=0;f=0&&e.numSupportedMorphNormals++;var m=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&1!=e.clipping||(r.numClippingPlanes=Pe.numPlanes,r.numIntersection=Pe.numIntersection,m.clippingPlanes=Pe.uniform),r.fog=t.fog,r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&1==e.lights}(e),r.lightsStateVersion=o,r.needsLights&&(m.ambientLightColor.value=i.state.ambient,m.lightProbe.value=i.state.probe,m.directionalLights.value=i.state.directional,m.directionalLightShadows.value=i.state.directionalShadow,m.spotLights.value=i.state.spot,m.spotLightShadows.value=i.state.spotShadow,m.rectAreaLights.value=i.state.rectArea,m.pointLights.value=i.state.point,m.pointLightShadows.value=i.state.pointShadow,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotShadowMatrix.value=i.state.spotShadowMatrix,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix);var g=r.program.getUniforms(),v=tt.seqWithValue(g.seq,m);r.uniformsList=v}function m(e,t,n,r){z.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=I.get(n),s=C.state.lights;if(Oe&&(Ne||e!==ve)){var c=e===ve&&n.id===me;Pe.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,o,c)}n.version===o.__version?void 0===o.program||n.fog&&o.fog!==i||o.environment!==a||o.needsLights&&o.lightsStateVersion!==s.state.version?f(n,t,r):void 0===o.numClippingPlanes||o.numClippingPlanes===Pe.numPlanes&&o.numIntersection===Pe.numIntersection?o.outputEncoding!==Y.outputEncoding&&f(n,t,r):f(n,t,r):(f(n,t,r),o.__version=n.version);var l,u,h=0,p=0,d=0,m=o.program,y=m.getUniforms(),x=o.uniforms;if(N.useProgram(m.program)&&(h=1,p=1,d=1),n.id!==me&&(me=n.id,p=1),h||ve!==e){if(y.setValue(R,"projectionMatrix",e.projectionMatrix),O.logarithmicDepthBuffer&&y.setValue(R,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),ve!==e&&(ve=e,p=1,d=1),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var b=y.map.cameraPosition;void 0!==b&&b.setValue(R,Ie.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&y.setValue(R,"isOrthographic",1==e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&y.setValue(R,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){y.setOptional(R,r,"bindMatrix"),y.setOptional(R,r,"bindMatrixInverse");var w=r.skeleton;if(w){var _=w.bones;if(O.floatVertexTextures){if(void 0===w.boneTexture){var M=Math.sqrt(4*_.length);M=Na.ceilPowerOfTwo(M),M=Math.max(M,4);var S=new Float32Array(M*M*4);S.set(w.boneMatrices);var T=new $(S,M,M,1023,1015);w.boneMatrices=S,w.boneTexture=T,w.boneTextureSize=M}y.setValue(R,"boneTexture",w.boneTexture,z),y.setValue(R,"boneTextureSize",w.boneTextureSize)}else y.setOptional(R,w,"boneMatrices")}}return(p||o.receiveShadow!==r.receiveShadow)&&(o.receiveShadow=r.receiveShadow,y.setValue(R,"receiveShadow",r.receiveShadow)),p&&(y.setValue(R,"toneMappingExposure",Y.toneMappingExposure),y.setValue(R,"toneMappingWhitePoint",Y.toneMappingWhitePoint),o.needsLights&&(u=d,(l=x).ambientLightColor.needsUpdate=u,l.lightProbe.needsUpdate=u,l.directionalLights.needsUpdate=u,l.directionalLightShadows.needsUpdate=u,l.pointLights.needsUpdate=u,l.pointLightShadows.needsUpdate=u,l.spotLights.needsUpdate=u,l.spotLightShadows.needsUpdate=u,l.rectAreaLights.needsUpdate=u,l.hemisphereLights.needsUpdate=u),i&&n.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(x,i),n.isMeshBasicMaterial?g(x,n):n.isMeshLambertMaterial?(g(x,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(x,n)):n.isMeshToonMaterial?(g(x,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(x,n)):n.isMeshPhongMaterial?(g(x,n),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(x,n)):n.isMeshStandardMaterial?(g(x,n,a),n.isMeshPhysicalMaterial?function(e,t,n){v(e,t,n),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate()),e.transparency.value=t.transparency}(x,n,a):v(x,n,a)):n.isMeshMatcapMaterial?(g(x,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(x,n)):n.isMeshDepthMaterial?(g(x,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(x,n)):n.isMeshDistanceMaterial?(g(x,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(x,n)):n.isMeshNormalMaterial?(g(x,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(x,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(x,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(x,n)):n.isPointsMaterial?function(e,t){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*Se,e.scale.value=.5*Me,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(1==n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(x,n):n.isSpriteMaterial?function(e,t){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(1==n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(x,n):n.isShadowMaterial&&(x.color.value.copy(n.color),x.opacity.value=n.opacity),void 0!==x.ltc_1&&(x.ltc_1.value=Ss.LTC_1),void 0!==x.ltc_2&&(x.ltc_2.value=Ss.LTC_2),tt.upload(R,o.uniformsList,x,z),n.isShaderMaterial&&(n.uniformsNeedUpdate=0)),n.isShaderMaterial&&1==n.uniformsNeedUpdate&&(tt.upload(R,o.uniformsList,x,z),n.uniformsNeedUpdate=0),n.isSpriteMaterial&&y.setValue(R,"center",r.center),y.setValue(R,"modelViewMatrix",r.modelViewMatrix),y.setValue(R,"normalMatrix",r.normalMatrix),y.setValue(R,"modelMatrix",r.matrixWorld),m}function g(e,t,n){e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap);var r,i,a=t.envMap||n;a&&(e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=I.get(a).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?r=t.map:t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.roughnessMap?r=t.roughnessMap:t.metalnessMap?r=t.metalnessMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),1==r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),t.aoMap?i=t.aoMap:t.lightMap&&(i=t.lightMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),1==i.matrixAutoUpdate&&i.updateMatrix(),e.uv2Transform.value.copy(i.matrix))}function v(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}var y=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),x=void 0!==e.context?e.context:null,b=void 0!==e.alpha?e.alpha:0,w=void 0!==e.depth?e.depth:1,_=void 0!==e.stencil?e.stencil:1,M=void 0!==e.antialias?e.antialias:0,S=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:1,T=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:0,E=void 0!==e.powerPreference?e.powerPreference:"default",A=void 0!==e.failIfMajorPerformanceCaveat?e.failIfMajorPerformanceCaveat:0,L=null,C=null;this.domElement=y,this.debug={checkShaderErrors:1},this.autoClear=1,this.autoClearColor=1,this.autoClearDepth=1,this.autoClearStencil=1,this.sortObjects=1,this.clippingPlanes=[],this.localClippingEnabled=0,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=0,this.toneMapping=1,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var R,P,O,N,D,I,z,B,U,F,H,k,G,j,V,W,q,X,Y=this,Z=0,J=null,te=0,ne=0,he=null,fe=null,me=-1,ge={geometry:null,program:null,wireframe:0},ve=null,ye=null,xe=new i,be=new i,we=null,_e=y.width,Me=y.height,Se=1,Te=null,Ee=null,Ae=new i(0,0,_e,Me),Le=new i(0,0,_e,Me),Ce=0,Re=new Q,Pe=new oe,Oe=0,Ne=0,De=new l,Ie=new c;try{var ze={alpha:b,depth:w,stencil:_,antialias:M,premultipliedAlpha:S,preserveDrawingBuffer:T,powerPreference:E,failIfMajorPerformanceCaveat:A,xrCompatible:1};if(y.addEventListener("webglcontextlost",a,0),y.addEventListener("webglcontextrestored",o,0),null===(R=x||y.getContext("webgl",ze)||y.getContext("experimental-webgl",ze)))throw null!==y.getContext("webgl")?Error("Error creating WebGL context with your selected attributes."):Error("Error creating WebGL context.");void 0===R.getShaderPrecisionFormat&&(R.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}r();var Be=new zt(Y,R);this.xr=Be;var Ue=new Rt(Y,F,O.maxTextureSize);this.shadowMap=Ue,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){var e=P.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=P.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Se},this.setPixelRatio=function(e){void 0!==e&&(Se=e,this.setSize(_e,Me,0))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new t),e.set(_e,Me)},this.setSize=function(e,t,n){Be.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(_e=e,Me=t,y.width=Math.floor(e*Se),y.height=Math.floor(t*Se),0!=n&&(y.style.width=e+"px",y.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new t),e.set(_e*Se,Me*Se).floor()},this.setDrawingBufferSize=function(e,t,n){_e=e,Me=t,Se=n,y.width=Math.floor(e*n),y.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new i),e.copy(xe)},this.getViewport=function(e){return e.copy(Ae)},this.setViewport=function(e,t,n,r){e.isVector4?Ae.set(e.x,e.y,e.z,e.w):Ae.set(e,t,n,r),N.viewport(xe.copy(Ae).multiplyScalar(Se).floor())},this.getScissor=function(e){return e.copy(Le)},this.setScissor=function(e,t,n,r){e.isVector4?Le.set(e.x,e.y,e.z,e.w):Le.set(e,t,n,r),N.scissor(be.copy(Le).multiplyScalar(Se).floor())},this.getScissorTest=function(){return Ce},this.setScissorTest=function(e){N.setScissorTest(Ce=e)},this.setOpaqueSort=function(e){Te=e},this.setTransparentSort=function(e){Ee=e},this.getClearColor=function(){return j.getClearColor()},this.setClearColor=function(){j.setClearColor.apply(j,arguments)},this.getClearAlpha=function(){return j.getClearAlpha()},this.setClearAlpha=function(){j.setClearAlpha.apply(j,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),R.clear(r)},this.clearColor=function(){this.clear(1,0,0)},this.clearDepth=function(){this.clear(0,1,0)},this.clearStencil=function(){this.clear(0,0,1)},this.dispose=function(){y.removeEventListener("webglcontextlost",a,0),y.removeEventListener("webglcontextrestored",o,0),k.dispose(),G.dispose(),I.dispose(),F.dispose(),Be.dispose(),ke.stop(),this.forceContextLoss()},this.renderBufferImmediate=function(e,t){N.initAttributes();var n=I.get(e);e.hasPositions&&!n.position&&(n.position=R.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=R.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=R.createBuffer()),e.hasColors&&!n.color&&(n.color=R.createBuffer());var r=t.getAttributes();e.hasPositions&&(R.bindBuffer(34962,n.position),R.bufferData(34962,e.positionArray,35048),N.enableAttribute(r.position),R.vertexAttribPointer(r.position,3,5126,0,0,0)),e.hasNormals&&(R.bindBuffer(34962,n.normal),R.bufferData(34962,e.normalArray,35048),N.enableAttribute(r.normal),R.vertexAttribPointer(r.normal,3,5126,0,0,0)),e.hasUvs&&(R.bindBuffer(34962,n.uv),R.bufferData(34962,e.uvArray,35048),N.enableAttribute(r.uv),R.vertexAttribPointer(r.uv,2,5126,0,0,0)),e.hasColors&&(R.bindBuffer(34962,n.color),R.bufferData(34962,e.colorArray,35048),N.enableAttribute(r.color),R.vertexAttribPointer(r.color,3,5126,0,0,0)),N.disableUnusedAttributes(),R.drawArrays(4,0,e.count),e.count=0};var Fe=new d;this.renderBufferDirect=function(e,t,r,i,a,o){null===t&&(t=Fe);var s=a.isMesh&&a.matrixWorld.determinant()<0,c=m(e,t,i,a);N.setMaterial(i,s);var l=0;ge.geometry===r.id&&ge.program===c.id&&ge.wireframe===(1==i.wireframe)||(ge.geometry=r.id,ge.program=c.id,ge.wireframe=1==i.wireframe,l=1),(i.morphTargets||i.morphNormals)&&(V.update(a,r,i,c),l=1);var u=r.index,h=r.attributes.position;if(null===u){if(void 0===h||0===h.count)return}else if(0===u.count)return;var p,d=1;1==i.wireframe&&(u=U.getWireframeAttribute(r),d=2);var f=W;null!==u&&(p=B.get(u),(f=q).setIndex(p)),l&&(function(e,t,n,r){if(0!=O.isWebGL2||!e.isInstancedMesh&&!t.isInstancedBufferGeometry||null!==P.get("ANGLE_instanced_arrays")){N.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(void 0!==l){var u=l.normalized,h=l.itemSize;if(void 0===(y=B.get(l)))continue;var p=y.buffer,d=y.type,f=y.bytesPerElement;if(l.isInterleavedBufferAttribute){var m=l.data,g=m.stride,v=l.offset;m&&m.isInstancedInterleavedBuffer?(N.enableAttributeAndDivisor(c,m.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=m.meshPerAttribute*m.count)):N.enableAttribute(c),R.bindBuffer(34962,p),R.vertexAttribPointer(c,h,d,u,g*f,v*f)}else l.isInstancedBufferAttribute?(N.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=l.meshPerAttribute*l.count)):N.enableAttribute(c),R.bindBuffer(34962,p),R.vertexAttribPointer(c,h,d,u,0,0)}else if("instanceMatrix"===s){var y;if(void 0===(y=B.get(e.instanceMatrix)))continue;p=y.buffer,d=y.type,N.enableAttributeAndDivisor(c+0,1),N.enableAttributeAndDivisor(c+1,1),N.enableAttributeAndDivisor(c+2,1),N.enableAttributeAndDivisor(c+3,1),R.bindBuffer(34962,p),R.vertexAttribPointer(c+0,4,d,0,64,0),R.vertexAttribPointer(c+1,4,d,0,64,16),R.vertexAttribPointer(c+2,4,d,0,64,32),R.vertexAttribPointer(c+3,4,d,0,64,48)}else if(void 0!==o){var x=o[s];if(void 0!==x)switch(x.length){case 2:R.vertexAttrib2fv(c,x);break;case 3:R.vertexAttrib3fv(c,x);break;case 4:R.vertexAttrib4fv(c,x);break;default:R.vertexAttrib1fv(c,x)}}}}N.disableUnusedAttributes()}}(a,r,i,c),null!==u&&R.bindBuffer(34963,p.buffer));var g=null!==u?u.count:h.count,v=r.drawRange.start*d,y=r.drawRange.count*d,x=null!==o?o.start*d:0,b=null!==o?o.count*d:1/0,w=Math.max(v,x),_=Math.max(0,Math.min(g,v+y,x+b)-1-w+1);if(0!==_){if(a.isMesh)1==i.wireframe?(N.setLineWidth(i.wireframeLinewidth*n()),f.setMode(1)):f.setMode(4);else if(a.isLine){var M=i.linewidth;void 0===M&&(M=1),N.setLineWidth(M*n()),a.isLineSegments?f.setMode(1):a.isLineLoop?f.setMode(2):f.setMode(3)}else a.isPoints?f.setMode(0):a.isSprite&&f.setMode(4);a.isInstancedMesh?f.renderInstances(r,w,_,a.count):r.isInstancedBufferGeometry?f.renderInstances(r,w,_,r.maxInstancedCount):f.render(w,_)}},this.compile=function(e,t){(C=G.get(e,t)).init(),e.traverse((function(e){e.isLight&&(C.pushLight(e),e.castShadow&&C.pushShadow(e))})),C.setupLights(t);var n={};e.traverse((function(t){if(t.material)if(Array.isArray(t.material))for(var r=0;r=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&R.readPixels(t,n,r,i,X.convert(u),X.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&R.bindFramebuffer(36160,fe)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=X.convert(t.format);z.setTexture2D(t,0),R.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),N.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){var i=t.image.width,a=t.image.height,o=X.convert(n.format),s=X.convert(n.type);z.setTexture2D(n,0),t.isDataTexture?R.texSubImage2D(3553,r||0,e.x,e.y,i,a,o,s,t.image.data):R.texSubImage2D(3553,r||0,e.x,e.y,o,s,t.image),N.unbindTexture()},this.initTexture=function(e){z.setTexture2D(e,0),N.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ut(e,t){this.name="",this.color=new b(e),this.density=void 0!==t?t:25e-5}function Ft(e,t,n){this.name="",this.color=new b(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Ht(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function kt(e,t,n,r){this.data=e,this.itemSize=t,this.offset=n,this.normalized=1==r}function Gt(e){T.call(this),this.type="SpriteMaterial",this.color=new b(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=1,this.transparent=1,this.setValues(e)}function jt(e){if(p.call(this),this.type="Sprite",void 0===Gs){Gs=new F;var n=new Ht(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Gs.setIndex([0,1,2,0,2,3]),Gs.setAttribute("position",new kt(n,3,0,0)),Gs.setAttribute("uv",new kt(n,2,3,0))}this.geometry=Gs,this.material=void 0!==e?e:new Gt,this.center=new t(.5,.5)}function Vt(e,t,n,r,i,a){Xs.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Ys.x=a*Xs.x-i*Xs.y,Ys.y=i*Xs.x+a*Xs.y):Ys.copy(Xs),e.copy(t),e.x+=Ys.x,e.y+=Ys.y,e.applyMatrix4(Zs)}function Wt(){p.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:1,value:[]}}),this.autoUpdate=1}function qt(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),H.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new l,this.bindMatrixInverse=new l}function Xt(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;ni.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function rn(e,t,n,i,a,o,s,c,l){r.call(this,e,t,n,i,a,o,s,c,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==a?a:1006,this.generateMipmaps=0}function an(e,t,n,i,a,o,s,c,l,u,h,p){r.call(this,null,o,s,c,l,u,i,a,h,p),this.image={width:t,height:n},this.mipmaps=e,this.flipY=0,this.generateMipmaps=0}function on(e,t,n,i,a,o,s,c,l){r.call(this,e,t,n,i,a,o,s,c,l),this.needsUpdate=1}function sn(e,t,n,i,a,o,s,c,l,u){if(1026!==(u=void 0!==u?u:1026)&&1027!==u)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===u&&(n=1012),void 0===n&&1027===u&&(n=1020),r.call(this,null,i,a,o,s,c,u,n,l),this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==c?c:1003,this.flipY=0,this.generateMipmaps=0}function cn(e){F.call(this),this.type="WireframeGeometry";var t,n,r,i,a,o,s,l,u,h,p=[],d=[0,0],f={},m=["a","b","c"];if(e&&e.isGeometry){var g=e.faces;for(t=0,r=g.length;t=0?(e(y-u,v,d),f.subVectors(p,d)):(e(y+u,v,d),f.subVectors(d,p)),v-u>=0?(e(y,v-u,d),m.subVectors(p,d)):(e(y,v+u,d),m.subVectors(d,p)),h.crossVectors(f,m).normalize(),s.push(h.x,h.y,h.z),l.push(y,v)}}for(r=0;r.9&&Math.min(t,n,r)<.1&&(t<.2&&(p[e+0]+=1),n<.2&&(p[e+2]+=1),r<.2&&(p[e+4]+=1))}}()}(),this.setAttribute("position",new I(h,3)),this.setAttribute("normal",new I(h.slice(),3)),this.setAttribute("uv",new I(p,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function dn(e,t){j.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new fn(e,t)),this.mergeVertices()}function fn(e,t){pn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function mn(e,t){j.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new gn(e,t)),this.mergeVertices()}function gn(e,t){pn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function vn(e,t){j.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new yn(e,t)),this.mergeVertices()}function yn(e,t){var n=1.618033988749895,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];pn.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function xn(e,t){j.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new bn(e,t)),this.mergeVertices()}function bn(e,t){var n=1.618033988749895,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];pn.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function wn(e,t,n,r,i,a){j.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new _n(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function _n(e,n,r,i,a){function o(t){f=e.getPointAt(t/n,f);var a=s.normals[t],o=s.binormals[t];for(u=0;u<=i;u++){var c=u/i*Math.PI*2,l=Math.sin(c),d=-Math.cos(c);p.x=d*a.x+l*o.x,p.y=d*a.y+l*o.y,p.z=d*a.z+l*o.z,p.normalize(),g.push(p.x,p.y,p.z),h.x=f.x+r*p.x,h.y=f.y+r*p.y,h.z=f.z+r*p.z,m.push(h.x,h.y,h.z)}}F.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:a},n=n||64,r=r||1,i=i||8,a=a||0;var s=e.computeFrenetFrames(n,a);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;var l,u,h=new c,p=new c,d=new t,f=new c,m=[],g=[],v=[],y=[];!function(){for(l=0;l0)for(a=t;a=t;a-=r)o=Wn(a,e[a],e[a+1],o);return o&&kn(o,o.next)&&(qn(o),o=o.next),o}function Ln(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=0,r.steiner||!kn(r,r.next)&&0!==Hn(r.prev,r,r.next))r=r.next;else{if(qn(r),(r=t=r.prev)===r.next)break;n=1}}while(n||r!==t);return t}function Cn(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=zn(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?Pn(e,r,i,a):Rn(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),qn(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?Cn(e=On(e,t,n),t,n,r,i,a,2):2===o&&Nn(e,t,n,r,i,a):Cn(Ln(e),t,n,r,i,a,1);break}}}function Rn(e){var t=e.prev,n=e,r=e.next;if(Hn(t,n,r)>=0)return 0;for(var i=e.next.next;i!==e.prev;){if(Un(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Hn(i.prev,i,i.next)>=0)return 0;i=i.next}return 1}function Pn(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Hn(i,a,o)>=0)return 0;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=zn(s,c,t,n,r),p=zn(l,u,t,n,r),d=e.prevZ,f=e.nextZ;d&&d.z>=h&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&Un(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Hn(d.prev,d,d.next)>=0)return 0;if(d=d.prevZ,f!==e.prev&&f!==e.next&&Un(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Hn(f.prev,f,f.next)>=0)return 0;f=f.nextZ}for(;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&Un(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Hn(d.prev,d,d.next)>=0)return 0;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&Un(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Hn(f.prev,f,f.next)>=0)return 0;f=f.nextZ}return 1}function On(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!kn(i,a)&&Gn(i,r,r.next,a)&&jn(i,a)&&jn(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),qn(r),qn(r.next),r=e=a),r=r.next}while(r!==e);return r}function Nn(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Fn(o,s)){var c=Vn(o,s);return o=Ln(o,o.next),c=Ln(c,c.next),Cn(o,t,n,r,i,a),void Cn(c,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function Dn(e,t){return e.x-t.x}function In(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=u&&i!==r.x&&Un(an.x)&&jn(r,e)&&(n=r,p=c),r=r.next;return n}(e,t)){var n=Vn(t,e);Ln(n,n.next)}}function zn(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Bn(e){var t=e,n=e;do{(t.x=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Fn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Gn(n,n.next,e,t))return 1;n=n.next}while(n!==e);return 0}(e,t)&&jn(e,t)&&jn(t,e)&&function(e,t){var n=e,r=0,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)}function Hn(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function kn(e,t){return e.x===t.x&&e.y===t.y}function Gn(e,t,n,r){return kn(e,n)&&kn(t,r)||kn(e,r)&&kn(n,t)?1:Hn(e,t,n)>0!=Hn(e,t,r)>0&&Hn(n,r,e)>0!=Hn(n,r,t)>0}function jn(e,t){return Hn(e.prev,e,e.next)<0?Hn(e,t,e.next)>=0&&Hn(e,e.prev,t)>=0:Hn(e,t,e.prev)<0||Hn(e,e.next,t)<0}function Vn(e,t){var n=new Xn(e.i,e.x,e.y),r=new Xn(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Wn(e,t,n,r){var i=new Xn(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function qn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Xn(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=0}function Yn(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Zn(e,t){for(var n=0;nNumber.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(l*l+u*u),f=n.x-c/p,m=n.y+s/p,g=((r.x-u/d-f)*u-(r.y+l/d-m)*l)/(s*u-c*l),v=(i=f+s*g-e.x)*i+(a=m+c*g-e.y)*a;if(v<=2)return new t(i,a);o=Math.sqrt(v/2)}else{var y=0;s>Number.EPSILON?l>Number.EPSILON&&(y=1):s<-Number.EPSILON?l<-Number.EPSILON&&(y=1):Math.sign(c)===Math.sign(u)&&(y=1),y?(i=-c,a=s,o=Math.sqrt(h)):(i=s,a=c,o=Math.sqrt(h/2))}return new t(i/o,a/o)}function l(e,t){var n,r;for(Z=e.length;--Z>=0;){n=Z,(r=Z-1)<0&&(r=e.length-1);var i=0,a=v+2*M;for(i=0;i=0;H--){for(j=b*Math.cos((G=H/M)*Math.PI/2),k=w*Math.sin(G*Math.PI/2)+_,Z=0,J=F.length;Z0)&&m.push(M,S,E),(l!==n-1||u0&&u(1),n>0&&u(0)),this.setIndex(p),this.setAttribute("position",new I(d,3)),this.setAttribute("normal",new I(f,3)),this.setAttribute("uv",new I(m,2))}function dr(e,t,n,r,i,a,o){hr.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function fr(e,t,n,r,i,a,o){pr.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function mr(e,t,n,r){j.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new gr(e,t,n,r)),this.mergeVertices()}function gr(e,n,r,i){F.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},e=e||1,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var a,o,s=[],l=[],u=[],h=[],p=new c,d=new t;for(l.push(0,0,0),u.push(0,0,1),h.push(.5,.5),o=0,a=3;o<=n;o++,a+=3){var f=r+o/n*i;p.x=e*Math.cos(f),p.y=e*Math.sin(f),l.push(p.x,p.y,p.z),u.push(0,0,1),d.x=(l[a]/e+1)/2,d.y=(l[a+1]/e+1)/2,h.push(d.x,d.y)}for(a=1;a<=n;a++)s.push(a,a+1,0);this.setIndex(s),this.setAttribute("position",new I(l,3)),this.setAttribute("normal",new I(u,3)),this.setAttribute("uv",new I(h,2))}function vr(e){T.call(this),this.type="ShadowMaterial",this.color=new b(0),this.transparent=1,this.setValues(e)}function yr(e){q.call(this,e),this.type="RawShaderMaterial"}function xr(e){T.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new b(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new t(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=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.vertexTangents=0,this.setValues(e)}function br(e){xr.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new t(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function wr(e){T.call(this),this.type="MeshPhongMaterial",this.color=new b(16777215),this.specular=new b(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(e)}function _r(e){T.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new b(16777215),this.specular=new b(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(e)}function Mr(e){T.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=0,this.wireframeLinewidth=1,this.fog=0,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(e)}function Sr(e){T.call(this),this.type="MeshLambertMaterial",this.color=new b(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new b(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=0,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(e)}function Tr(e){T.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new b(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=0,this.morphTargets=0,this.morphNormals=0,this.setValues(e)}function Er(e){Jt.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Ar(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Lr(e,t,n,r){Ar.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Cr(e,t,n,r){Ar.call(this,e,t,n,r)}function Rr(e,t,n,r){Ar.call(this,e,t,n,r)}function Pr(e,t,n,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Tc.convertArray(t,this.TimeBufferType),this.values=Tc.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Or(e,t,n){Pr.call(this,e,t,n)}function Nr(e,t,n,r){Pr.call(this,e,t,n,r)}function Dr(e,t,n,r){Pr.call(this,e,t,n,r)}function Ir(e,t,n,r){Ar.call(this,e,t,n,r)}function zr(e,t,n,r){Pr.call(this,e,t,n,r)}function Br(e,t,n,r){Pr.call(this,e,t,n,r)}function Ur(e,t,n,r){Pr.call(this,e,t,n,r)}function Fr(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Na.generateUUID(),this.duration<0&&this.resetDuration()}function Hr(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Dr;case"vector":case"vector2":case"vector3":case"vector4":return Ur;case"color":return Nr;case"quaternion":return zr;case"bool":case"boolean":return Or;case"string":return Br}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];Tc.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function kr(e,t,n){var r=this,i=0,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,0==i&&void 0!==r.onStart&&r.onStart(e,a,o),i=1},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=0,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;te+t)>0?console.log(`morphed: ${Bl.name}`):console.log(`not morphed: ${Bl.name}`);for(let l=0;l0?zl("#subdivideSLT").val():void 0,t=CK.character.data.mirroredPose,n=Ca(CK.character,e,t),r=(new Pl).parse(n),i=La(),a=new Blob([r],{type:"application/sla;charset=utf-8"});Il(a,i+(e?"-smooth":"")+".stl")}function Ta(){var e=zl("#subdivideSLT").val()>0?zl("#subdivideSLT").val():void 0,t=CK.character.data.mirroredPose,n=Ca(CK.character,e,t),r=(new Ol).parse(n),i=La(),a=new Blob([r],{type:"text/plain;charset=utf-8"});Il(a,i+(e?"-smooth":"")+".obj")}function Ea(){var e=La(),t=new Blob([JSON.stringify(CK.data.getJson())],{type:"text/plain;charset=utf-8"});Il(t,e+".json")}function Aa(e){var t=e.target.files[0],n=new FileReader;n.onload=function(e){e.preventDefault(),CK.change(JSON.parse(e.target.result))},null!=t&&n.readAsText(t)}function La(){var e=CK.character.data.meta.character_name;return""===e?"Hero":e}function Ca(e,t,n){var r=new E,i=new It;return e.traverseVisible((function(e){if(e.isMesh){var a=wa(e);1==n&&(a=function(e){const t=[0,0,0];e.index&&e.copy(e.toNonIndexed());for(let n=0;n0?1:+e}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+Ra[e>>16&255]+Ra[e>>24&255]+"-"+Ra[255&t]+Ra[t>>8&255]+"-"+Ra[t>>16&15|64]+Ra[t>>24&255]+"-"+Ra[63&n|128]+Ra[n>>8&255]+"-"+Ra[n>>16&255]+Ra[n>>24&255]+Ra[255&r]+Ra[r>>8&255]+Ra[r>>16&255]+Ra[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Na.DEG2RAD},radToDeg:function(e){return e*Na.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),h=a((t-r)/2),p=o((t-r)/2),d=a((r-t)/2),f=o((r-t)/2);"XYX"===i?e.set(s*u,c*h,c*p,s*l):"YZY"===i?e.set(c*p,s*u,c*h,s*l):"ZXZ"===i?e.set(c*h,c*p,s*u,s*l):"XZX"===i?e.set(s*u,c*f,c*d,s*l):"YXY"===i?e.set(c*d,s*u,c*f,s*l):"ZYZ"===i?e.set(c*f,c*d,s*u,s*l):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};Object.defineProperties(t.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(t.prototype,{isVector2:1,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},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(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}}),Object.assign(n.prototype,{isMatrix3:1,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],p=n[5],d=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=a*f+o*v+s*b,i[3]=a*m+o*y+s*w,i[6]=a*g+o*x+s*_,i[1]=c*f+l*v+u*b,i[4]=c*m+l*y+u*w,i[7]=c*g+l*x+u*_,i[2]=h*f+p*v+d*b,i[5]=h*m+p*y+d*w,i[8]=h*g+p*x+d*_,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],p=n[8],d=p*c-l*h,f=l*u-p*s,m=h*s-c*u,g=i*d+a*f+o*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);var v=1/g;return r[0]=d*v,r[1]=(o*h-p*a)*v,r[2]=(l*a-o*c)*v,r[3]=f*v,r[4]=(p*i-o*u)*v,r[5]=(o*s-l*i)*v,r[6]=m*v,r[7]=(a*u-h*i)*v,r[8]=(c*i-a*s)*v,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return 0;return 1},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var Da={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Oa&&(Oa=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Oa.width=e.width,Oa.height=e.height;var n=Oa.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Oa}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Ia=0;r.DEFAULT_IMAGE=void 0,r.DEFAULT_MAPPING=300,r.prototype=Object.assign(Object.create(e.prototype),{constructor:r,isTexture:1,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=Na.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(r.prototype,"needsUpdate",{set:function(e){1==e&&this.version++}}),Object.defineProperties(i.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(i.prototype,{isVector4:1,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],p=i[6],d=i[10];if(Math.abs(o-c)<.01&&Math.abs(s-h)<.01&&Math.abs(u-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(s+h)<.1&&Math.abs(u+p)<.1&&Math.abs(a+l+d-3)<.1)return this.set(1,0,0,0),this;var f=(a+1)/2,m=(l+1)/2,g=(d+1)/2,v=(o+c)/4,y=(s+h)/4,x=(u+p)/4;return f>m&&f>g?f<.01?(t=0,n=.707106781,r=.707106781):(n=v/(t=Math.sqrt(f)),r=y/t):m>g?m<.01?(t=.707106781,n=0,r=.707106781):(t=v/(n=Math.sqrt(m)),r=x/n):g<.01?(t=.707106781,n=.707106781,r=0):(t=y/(r=Math.sqrt(g)),n=x/r),this.set(t,n,r,3.141592653589793),this}var b=Math.sqrt((p-u)*(p-u)+(s-h)*(s-h)+(c-o)*(c-o));return Math.abs(b)<.001&&(b=1),this.x=(p-u)/b,this.y=(s-h)/b,this.z=(c-o)/b,this.w=Math.acos((a+l+d-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),a.prototype=Object.assign(Object.create(e.prototype),{constructor:a,isWebGLRenderTarget:1,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),o.prototype=Object.assign(Object.create(a.prototype),{constructor:o,isWebGLMultisampleRenderTarget:1,copy:function(e){return a.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(s,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],p=i[a+1],d=i[a+2],f=i[a+3];if(u!==f||s!==h||c!==p||l!==d){var m=1-o,g=s*h+c*p+l*d+u*f,v=g>=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,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+h*w,c=c*m+p*w,l=l*m+d*w,u=u*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=_,c*=_,l*=_,u*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}}),Object.defineProperties(s.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(s.prototype,{isQuaternion:1,set:function(e,t,n,r){return this._x=e,this._y=t,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(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),p=s(r/2),d=s(i/2);return"XYZ"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"YXZ"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"ZXY"===a?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"ZYX"===a?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"YZX"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u-h*p*d):"XZY"===a&&(this._x=h*l*u-c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u+h*p*d),0!=t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],p=r+s+h;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(u-c)*t,this._y=(a-l)*t,this._z=(o-i)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+l)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(a-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-i)/t,this._x=(a+l)/t,this._y=(c+u)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Na.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,p=Math.sin(t*u)/l;return this._w=a*h+this._w*p,this._x=n*h+this._x*p,this._y=r*h+this._y*p,this._z=i*h+this._z*p,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var za=new c,Ba=new s;Object.assign(c.prototype,{isVector3:1,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Ba.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Ba.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},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(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return za.copy(this).projectOnVector(e),this.sub(za)},reflect:function(e){return this.sub(za.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Na.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var Ua=new c,Fa=new l,Ha=new c(0,0,0),ka=new c(1,1,1),Ga=new c,ja=new c,Va=new c;Object.assign(l.prototype,{isMatrix4:1,set:function(e,t,n,r,i,a,o,s,c,l,u,h,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,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 l).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/Ua.setFromMatrixColumn(e,0).length(),i=1/Ua.setFromMatrixColumn(e,1).length(),a=1/Ua.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=a*l,p=a*u,d=o*l,f=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=p+d*c,t[5]=h-f*c,t[9]=-o*s,t[2]=f-h*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,g=s*u,v=c*l,y=c*u;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order)m=s*l,g=s*u,v=c*l,y=c*u,t[0]=m-y*o,t[4]=-a*u,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s;else if("ZYX"===e.order)h=a*l,p=a*u,d=o*l,f=o*u,t[0]=s*l,t[4]=d*c-p,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s;else if("YZX"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=_-x*u,t[8]=w*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+w,t[10]=x-_*u}else"XZY"===e.order&&(x=a*s,b=a*c,w=o*s,_=o*c,t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=x*u+_,t[5]=a*l,t[9]=b*u-w,t[2]=w*u-b,t[6]=o*l,t[10]=_*u+x);return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(Ha,e,ka)},lookAt:function(e,t,n){var r=this.elements;return Va.subVectors(e,t),0===Va.lengthSq()&&(Va.z=1),Va.normalize(),Ga.crossVectors(n,Va),0===Ga.lengthSq()&&(1===Math.abs(n.z)?Va.x+=1e-4:Va.z+=1e-4,Va.normalize(),Ga.crossVectors(n,Va)),Ga.normalize(),ja.crossVectors(Va,Ga),r[0]=Ga.x,r[4]=ja.x,r[8]=Va.x,r[1]=Ga.y,r[5]=ja.y,r[9]=Va.y,r[2]=Ga.z,r[6]=ja.z,r[10]=Va.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=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],w=r[0],_=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],C=r[2],R=r[6],P=r[10],O=r[14],N=r[3],D=r[7],I=r[11],z=r[15];return i[0]=a*w+o*T+s*C+c*N,i[4]=a*_+o*E+s*R+c*D,i[8]=a*M+o*A+s*P+c*I,i[12]=a*S+o*L+s*O+c*z,i[1]=l*w+u*T+h*C+p*N,i[5]=l*_+u*E+h*R+p*D,i[9]=l*M+u*A+h*P+p*I,i[13]=l*S+u*L+h*O+p*z,i[2]=d*w+f*T+m*C+g*N,i[6]=d*_+f*E+m*R+g*D,i[10]=d*M+f*A+m*P+g*I,i[14]=d*S+f*L+m*O+g*z,i[3]=v*w+y*T+x*C+b*N,i[7]=v*_+y*E+x*R+b*D,i[11]=v*M+y*A+x*P+b*I,i[15]=v*S+y*L+x*O+b*z,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],p=e[14];return e[3]*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*p-n*s*p)+e[7]*(+t*s*p-t*c*h+i*a*h-r*a*p+r*c*l-i*s*l)+e[11]*(+t*c*u-t*o*p-i*a*u+n*a*p+i*o*l-n*c*l)+e[15]*(-r*o*l-t*s*u+t*o*h+r*a*u-n*a*h+n*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],p=r[8],d=r[9],f=r[10],m=r[11],g=r[12],v=r[13],y=r[14],x=r[15],b=d*y*h-v*f*h+v*u*m-l*y*m-d*u*x+l*f*x,w=g*f*h-p*y*h-g*u*m+c*y*m+p*u*x-c*f*x,_=p*v*h-g*d*h+g*l*m-c*v*m-p*l*x+c*d*x,M=g*d*u-p*v*u-g*l*f+c*v*f+p*l*y-c*d*y,S=i*b+a*w+o*_+s*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/S;return n[0]=b*T,n[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*T,n[2]=(l*y*s-v*u*s+v*o*h-a*y*h-l*o*x+a*u*x)*T,n[3]=(d*u*s-l*f*s-d*o*h+a*f*h+l*o*m-a*u*m)*T,n[4]=w*T,n[5]=(p*y*s-g*f*s+g*o*m-i*y*m-p*o*x+i*f*x)*T,n[6]=(g*u*s-c*y*s-g*o*h+i*y*h+c*o*x-i*u*x)*T,n[7]=(c*f*s-p*u*s+p*o*h-i*f*h-c*o*m+i*u*m)*T,n[8]=_*T,n[9]=(g*d*s-p*v*s-g*a*m+i*v*m+p*a*x-i*d*x)*T,n[10]=(c*v*s-g*l*s+g*a*h-i*v*h-c*a*x+i*l*x)*T,n[11]=(p*l*s-c*d*s-p*a*h+i*d*h+c*a*m-i*l*m)*T,n[12]=M*T,n[13]=(p*v*o-g*d*o+g*a*f-i*v*f-p*a*y+i*d*y)*T,n[14]=(g*l*o-c*v*o-g*a*u+i*v*u+c*a*y-i*l*y)*T,n[15]=(c*d*o-p*l*o+p*a*u-i*d*u-c*a*f+i*l*f)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,h=i*c,p=i*l,d=i*u,f=a*l,m=a*u,g=o*u,v=s*c,y=s*l,x=s*u,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+g))*b,r[1]=(p+x)*b,r[2]=(d-y)*b,r[3]=0,r[4]=(p-x)*w,r[5]=(1-(h+g))*w,r[6]=(m+v)*w,r[7]=0,r[8]=(d+y)*_,r[9]=(m-v)*_,r[10]=(1-(h+f))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=Ua.set(r[0],r[1],r[2]).length(),a=Ua.set(r[4],r[5],r[6]).length(),o=Ua.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Fa.copy(this);var s=1/i,c=1/a,l=1/o;return Fa.elements[0]*=s,Fa.elements[1]*=s,Fa.elements[2]*=s,Fa.elements[4]*=c,Fa.elements[5]*=c,Fa.elements[6]*=c,Fa.elements[8]*=l,Fa.elements[9]*=l,Fa.elements[10]*=l,t.setFromRotationMatrix(Fa),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),p=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,h=(n+r)*c,p=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return 0;return 1},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var Wa=new l,qa=new s;u.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],u.DefaultOrder="XYZ",Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(u.prototype,{isEuler:1,set:function(e,t,n,r){return this._x=e,this._y=t,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(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=Na.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],p=i[6],d=i[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===t?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,0!=n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Wa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Wa,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return qa.setFromEuler(this),this.setFromQuaternion(qa,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new c(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(h.prototype,{set:function(e){this.mask=1<1){for(var t=0;t1){for(var t=0;t0)for(a.children=[],c=0;c0&&(i.geometries=p),d.length>0&&(i.materials=d),f.length>0&&(i.textures=f),m.length>0&&(i.images=m),s.length>0&&(i.shapes=s)}return i.object=a,i},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=1),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),1==t)for(var n=0;ni&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;si&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z?0:1},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new c),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z?0:1},intersectsSphere:function(e){return this.clampPoint(e.center,so),so.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return 0;this.getCenter(go),vo.subVectors(this.max,go),lo.subVectors(e.a,go),uo.subVectors(e.b,go),ho.subVectors(e.c,go),po.subVectors(uo,lo),fo.subVectors(ho,uo),mo.subVectors(lo,ho);var t=[0,-po.z,po.y,0,-fo.z,fo.y,0,-mo.z,mo.y,po.z,0,-po.x,fo.z,0,-fo.x,mo.z,0,-mo.x,-po.y,po.x,0,-fo.y,fo.x,0,-mo.y,mo.x,0];return m(t,lo,uo,ho,vo)&&m(t=[1,0,0,0,1,0,0,0,1],lo,uo,ho,vo)?(yo.crossVectors(po,fo),m(t=[yo.x,yo.y,yo.z],lo,uo,ho,vo)):0},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new c),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return so.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(so).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(oo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oo)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var bo=new f;Object.assign(g.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):bo.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new f),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var wo=new c,_o=new c,Mo=new c,So=new c,To=new c,Eo=new c,Ao=new c;Object.assign(v.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new c),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,wo)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new c),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=wo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(wo.copy(this.direction).multiplyScalar(t).add(this.origin),wo.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){_o.copy(e).add(t).multiplyScalar(.5),Mo.copy(t).sub(e).normalize(),So.copy(this.origin).sub(_o);var i,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(Mo),u=So.dot(this.direction),h=-So.dot(Mo),p=So.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(a=l*u-h,s=c*d,(i=l*h-u)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(i*=f)*(i+l*(a*=f)+2*u)+a*(l*i+a+2*h)+p}else o=-(i=Math.max(0,-(l*(a=c)+u)))*i+a*(a+2*h)+p;else o=-(i=Math.max(0,-(l*(a=-c)+u)))*i+a*(a+2*h)+p;else a<=-s?o=-(i=Math.max(0,-(-l*c+u)))*i+(a=i>0?-c:Math.min(Math.max(-c,-h),c))*(a+2*h)+p:a<=s?(i=0,o=(a=Math.min(Math.max(-c,-h),c))*(a+2*h)+p):o=-(i=Math.max(0,-(l*c+u)))*i+(a=i>0?c:Math.min(Math.max(-c,-h),c))*(a+2*h)+p;else o=-(i=Math.max(0,-(l*(a=l>0?-c:c)+u)))*i+a*(a+2*h)+p;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Mo).multiplyScalar(a).add(_o),o},intersectSphere:function(e,t){wo.subVectors(e.center,this.origin);var n=wo.dot(this.direction),r=wo.dot(wo)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0?1:0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s=0?n:r,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,wo)},intersectTriangle:function(e,t,n,r,i){To.subVectors(t,e),Eo.subVectors(n,e),Ao.crossVectors(To,Eo);var a,o=this.direction.dot(Ao);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}So.subVectors(this.origin,e);var s=a*this.direction.dot(Eo.crossVectors(So,Eo));if(s<0)return null;var c=a*this.direction.dot(To.cross(So));if(c<0)return null;if(s+c>o)return null;var l=-a*So.dot(Ao);return l<0?null:this.at(l/o,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Lo=new c,Co=new c,Ro=new n;Object.assign(y.prototype,{isPlane:1,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=Lo.subVectors(n,t).cross(Co.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new c),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new c);var n=e.delta(Lo),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new c),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Ro.getNormalMatrix(e),r=this.coplanarPoint(Lo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Po=new c,Oo=new c,No=new c,Do=new c,Io=new c,zo=new c,Bo=new c,Uo=new c,Fo=new c,Ho=new c;Object.assign(x,{getNormal:function(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new c),r.subVectors(n,t),Po.subVectors(e,t),r.cross(Po);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){Po.subVectors(r,t),Oo.subVectors(n,t),No.subVectors(e,t);var a=Po.dot(Po),o=Po.dot(Oo),s=Po.dot(No),l=Oo.dot(Oo),u=Oo.dot(No),h=a*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new c),0===h)return i.set(-2,-1,-1);var p=1/h,d=(l*s-o*u)*p,f=(a*u-o*s)*p;return i.set(1-d-f,f,d)},containsPoint:function(e,t,n,r){return x.getBarycoord(e,t,n,r,Do),Do.x>=0&&Do.y>=0&&Do.x+Do.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Do),s.set(0,0),s.addScaledVector(i,Do.x),s.addScaledVector(a,Do.y),s.addScaledVector(o,Do.z),s},isFrontFacing:function(e,t,n,r){return Po.subVectors(n,t),Oo.subVectors(e,t),Po.cross(Oo).dot(r)<0?1:0}}),Object.assign(x.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Po.subVectors(this.c,this.b),Oo.subVectors(this.a,this.b),.5*Po.cross(Oo).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new c),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return x.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new y),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return x.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return x.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return x.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return x.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new c);var n,r,i=this.a,a=this.b,o=this.c;Io.subVectors(a,i),zo.subVectors(o,i),Uo.subVectors(e,i);var s=Io.dot(Uo),l=zo.dot(Uo);if(s<=0&&l<=0)return t.copy(i);Fo.subVectors(e,a);var u=Io.dot(Fo),h=zo.dot(Fo);if(u>=0&&h<=u)return t.copy(a);var p=s*h-u*l;if(p<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(i).addScaledVector(Io,n);Ho.subVectors(e,o);var d=Io.dot(Ho),f=zo.dot(Ho);if(f>=0&&d<=f)return t.copy(o);var m=d*l-s*f;if(m<=0&&l>=0&&f<=0)return r=l/(l-f),t.copy(i).addScaledVector(zo,r);var g=u*f-d*h;if(g<=0&&h-u>=0&&d-f>=0)return Bo.subVectors(o,a),r=(h-u)/(h-u+(d-f)),t.copy(a).addScaledVector(Bo,r);var v=1/(g+m+p);return n=m*v,r=p*v,t.copy(i).addScaledVector(Io,n).addScaledVector(zo,r)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var ko={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},Go={h:0,s:0,l:0},jo={h:0,s:0,l:0};Object.assign(b.prototype,{isColor:1,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Na.euclideanModulo(e,1),t=Na.clamp(t,0,1),n=Na.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=w(i,r,e+1/3),this.g=w(i,r,e),this.b=w(i,r,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],a=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(a))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,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))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,t(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(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=ko[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=_(e.r),this.g=_(e.g),this.b=_(e.b),this},copyLinearToSRGB:function(e){return this.r=M(e.r),this.g=M(e.g),this.b=M(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(s+o)/2;if(s===o)t=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case r:t=(i-a)/l+(i0&&(r.alphaTest=this.alphaTest),1==this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),1==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),1==this.morphTargets&&(r.morphTargets=1),1==this.morphNormals&&(r.morphNormals=1),1==this.skinning&&(r.skinning=1),0==this.visible&&(r.visible=0),0==this.toneMapped&&(r.toneMapped=0),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),n){var i=t(e.textures),a=t(e.images);i.length>0&&(r.textures=i),a.length>0&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(T.prototype,"needsUpdate",{set:function(e){1==e&&this.version++}}),E.prototype=Object.create(T.prototype),E.prototype.constructor=E,E.prototype.isMeshBasicMaterial=1,E.prototype.copy=function(e){return T.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var Wo=new c;Object.defineProperty(A.prototype,"needsUpdate",{set:function(e){1==e&&this.version++}}),Object.assign(A.prototype,{isBufferAttribute:1,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r0,s=a[1]&&a[1].length>0,c=e.morphTargets,l=c.length;if(l>0){n=[];for(var u=0;u0){for(h=[],u=0;u0&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported."),u=0;u65535?D:O)(e,1):e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=1);var r=this.attributes.normal;if(void 0!==r){var i=(new n).getNormalMatrix(e);r.applyNormalMatrix(i),r.needsUpdate=1}var a=this.attributes.tangent;return void 0!==a&&(a.transformDirection(e),a.needsUpdate=1),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Xo.makeRotationX(e),this.applyMatrix4(Xo),this},rotateY:function(e){return Xo.makeRotationY(e),this.applyMatrix4(Xo),this},rotateZ:function(e){return Xo.makeRotationZ(e),this.applyMatrix4(Xo),this},translate:function(e,t,n){return Xo.makeTranslation(e,t,n),this.applyMatrix4(Xo),this},scale:function(e,t,n){return Xo.makeScale(e,t,n),this.applyMatrix4(Xo),this},lookAt:function(e){return Yo.lookAt(e),Yo.updateMatrix(),this.applyMatrix4(Yo.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zo).negate(),this.translate(Zo.x,Zo.y,Zo.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new I(3*t.vertices.length,3),r=new I(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new I(t.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new A(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.setAttribute("color",new A(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new A(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new A(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l0){var d=new I(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new I(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new f);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=(p=i[n]).toJSON();""!==p.name&&(a.name=p.name),e.data.attributes[n]=a}var o={},s=0;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],l=[],u=0,h=c.length;u0&&(o[n]=l,s=1)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new F).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,n){var r,i=this.geometry,a=this.material,o=this.matrixWorld;if(void 0!==a&&(null===i.boundingSphere&&i.computeBoundingSphere(),ts.copy(i.boundingSphere),ts.applyMatrix4(o),0!=e.ray.intersectsSphere(ts)&&(Ko.getInverse(o),es.copy(e.ray).applyMatrix4(Ko),null===i.boundingBox||0!=es.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var s,c,l,u,h,p,d,f,m,g=i.index,v=i.attributes.position,y=i.morphAttributes.position,b=i.morphTargetsRelative,w=i.attributes.uv,_=i.attributes.uv2,M=i.groups,S=i.drawRange;if(null!==g)if(Array.isArray(a))for(u=0,p=M.length;u0&&(L=O);for(var N=0,D=P.length;N0)for(p=0;p0&&(this.normalsNeedUpdate=1)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=1)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n=0;n--){var d=h[n];for(this.faces.splice(d,1),o=0,s=this.faceVertexUvs.length;o0,b=v.vertexNormals.length>0,w=1!==v.color.r||1!==v.color.g||1!==v.color.b,_=v.vertexColors.length>0,M=0;if(M=e(M,0,0),M=e(M,1,1),M=e(M,2,0),M=e(M,3,y),M=e(M,4,x),M=e(M,5,b),M=e(M,6,w),M=e(M,7,_),u.push(M),u.push(v.a,v.b,v.c),u.push(v.materialIndex),y){var S=this.faceVertexUvs[0][c];u.push(r(S[0]),r(S[1]),r(S[2]))}if(x&&u.push(t(v.normal)),b){var T=v.vertexNormals;u.push(t(T[0]),t(T[1]),t(T[2]))}if(w&&u.push(n(v.color)),_){var E=v.vertexColors;u.push(n(E[0]),n(E[1]),n(E[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 j).copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t0?1:-1,h.push(R.x,R.y,R.z),p.push(x/g),p.push(1-b/v),L+=1}}for(b=0;b0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)1==this.extensions[a]&&(i[a]=1);return Object.keys(i).length>0&&(t.extensions=i),t},X.prototype=Object.assign(Object.create(p.prototype),{constructor:X,isCamera:1,copy:function(e,t){return p.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new c),this.updateMatrixWorld(1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){p.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){p.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Y.prototype=Object.assign(Object.create(X.prototype),{constructor:Y,isPerspectiveCamera:1,copy:function(e,t){return X.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Na.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Na.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Na.RAD2DEG*Math.atan(Math.tan(.5*Na.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=1,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=0),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Na.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=p.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),Z.prototype=Object.create(p.prototype),Z.prototype.constructor=Z,J.prototype=Object.create(a.prototype),J.prototype.constructor=J,J.prototype.isWebGLCubeRenderTarget=1,J.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new d,r="varying vec3 vWorldDirection;\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",i="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\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}",a=new q({type:"CubemapFromEquirect",uniforms:V({tEquirect:{value:null}}),vertexShader:r,fragmentShader:i,side:1,blending:0});a.uniforms.tEquirect.value=t;var o=new H(new bs(5,5,5),a);n.add(o);var s=new Z(1,10,1);return s.renderTarget=this,s.renderTarget.texture.name="CubeCameraTexture",s.update(e,n),o.geometry.dispose(),o.material.dispose(),this},$.prototype=Object.create(r.prototype),$.prototype.constructor=$,$.prototype.isDataTexture=1;var _s=new g,Ms=new c;Object.assign(Q.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=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 t[0].setComponents(o-r,u-s,f-h,y-m).normalize(),t[1].setComponents(o+r,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+c,f+p,y+g).normalize(),t[3].setComponents(o-i,u-c,f-p,y-g).normalize(),t[4].setComponents(o-a,u-l,f-d,y-v).normalize(),t[5].setComponents(o+a,u+l,f+d,y+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),_s.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(_s)},intersectsSprite:function(e){return _s.center.set(0,0,0),_s.radius=.7071067811865476,_s.applyMatrix4(e.matrixWorld),this.intersectsSphere(_s)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)0?e.max.x:e.min.x,Ms.y=r.normal.y>0?e.max.y:e.min.y,Ms.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ms)<0)return 0}return 1},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return 0;return 1}});var Ss={common:{diffuse:{value:new b(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new n},uv2Transform:{value:new n},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new t(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new b(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new b(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new n}},sprite:{diffuse:{value:new b(15658734)},opacity:{value:1},center:{value:new t(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new n}}};te.prototype=Object.create(j.prototype),te.prototype.constructor=te,ne.prototype=Object.create(F.prototype),ne.prototype.constructor=ne;var Ts={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( 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 dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\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.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - 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\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",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\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\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",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",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#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",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.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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.a );\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.a );\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.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, 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.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.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 = cLogLuvM * value.rgb;\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 = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, 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_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\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\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\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\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, 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\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\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",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\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",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",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",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 = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\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};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\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};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\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};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\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 ltc_1;\tuniform sampler2D ltc_2;\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",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\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_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",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\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\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)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\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\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), 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#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\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 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\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\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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * 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 defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\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 *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#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\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\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\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\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}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef 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",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\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( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\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 ) || defined( SHADOWMAP_TYPE_VSM )\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",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\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 highp 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",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",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\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#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}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\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\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\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 \nvarying vec2 vHighPrecisionZW;\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\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\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\tvHighPrecisionZW = gl_Position.zw;\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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\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\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \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}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \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\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * 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}",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}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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 \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#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\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}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\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 \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\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\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 \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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\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 \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\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}",meshtoon_vert:"#define TOON\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}",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 \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\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}",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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\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 \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\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#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\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\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \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( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}",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#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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\t#include \n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\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}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Es={basic:{uniforms:W([Ss.common,Ss.specularmap,Ss.envmap,Ss.aomap,Ss.lightmap,Ss.fog]),vertexShader:Ts.meshbasic_vert,fragmentShader:Ts.meshbasic_frag},lambert:{uniforms:W([Ss.common,Ss.specularmap,Ss.envmap,Ss.aomap,Ss.lightmap,Ss.emissivemap,Ss.fog,Ss.lights,{emissive:{value:new b(0)}}]),vertexShader:Ts.meshlambert_vert,fragmentShader:Ts.meshlambert_frag},phong:{uniforms:W([Ss.common,Ss.specularmap,Ss.envmap,Ss.aomap,Ss.lightmap,Ss.emissivemap,Ss.bumpmap,Ss.normalmap,Ss.displacementmap,Ss.fog,Ss.lights,{emissive:{value:new b(0)},specular:{value:new b(1118481)},shininess:{value:30}}]),vertexShader:Ts.meshphong_vert,fragmentShader:Ts.meshphong_frag},standard:{uniforms:W([Ss.common,Ss.envmap,Ss.aomap,Ss.lightmap,Ss.emissivemap,Ss.bumpmap,Ss.normalmap,Ss.displacementmap,Ss.roughnessmap,Ss.metalnessmap,Ss.fog,Ss.lights,{emissive:{value:new b(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Ts.meshphysical_vert,fragmentShader:Ts.meshphysical_frag},toon:{uniforms:W([Ss.common,Ss.specularmap,Ss.aomap,Ss.lightmap,Ss.emissivemap,Ss.bumpmap,Ss.normalmap,Ss.displacementmap,Ss.gradientmap,Ss.fog,Ss.lights,{emissive:{value:new b(0)},specular:{value:new b(1118481)},shininess:{value:30}}]),vertexShader:Ts.meshtoon_vert,fragmentShader:Ts.meshtoon_frag},matcap:{uniforms:W([Ss.common,Ss.bumpmap,Ss.normalmap,Ss.displacementmap,Ss.fog,{matcap:{value:null}}]),vertexShader:Ts.meshmatcap_vert,fragmentShader:Ts.meshmatcap_frag},points:{uniforms:W([Ss.points,Ss.fog]),vertexShader:Ts.points_vert,fragmentShader:Ts.points_frag},dashed:{uniforms:W([Ss.common,Ss.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ts.linedashed_vert,fragmentShader:Ts.linedashed_frag},depth:{uniforms:W([Ss.common,Ss.displacementmap]),vertexShader:Ts.depth_vert,fragmentShader:Ts.depth_frag},normal:{uniforms:W([Ss.common,Ss.bumpmap,Ss.normalmap,Ss.displacementmap,{opacity:{value:1}}]),vertexShader:Ts.normal_vert,fragmentShader:Ts.normal_frag},sprite:{uniforms:W([Ss.sprite,Ss.fog]),vertexShader:Ts.sprite_vert,fragmentShader:Ts.sprite_frag},background:{uniforms:{uvTransform:{value:new n},t2D:{value:null}},vertexShader:Ts.background_vert,fragmentShader:Ts.background_frag},cube:{uniforms:W([Ss.envmap,{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:W([Ss.common,Ss.displacementmap,{referencePosition:{value:new c},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ts.distanceRGBA_vert,fragmentShader:Ts.distanceRGBA_frag},shadow:{uniforms:W([Ss.lights,Ss.fog,{color:{value:new b(0)},opacity:{value:1}}]),vertexShader:Ts.shadow_vert,fragmentShader:Ts.shadow_frag}};Es.physical={uniforms:W([Es.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new t(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new b(0)},transparency:{value:0}}]),vertexShader:Ts.meshphysical_vert,fragmentShader:Ts.meshphysical_frag},fe.prototype=Object.create(r.prototype),fe.prototype.constructor=fe,fe.prototype.isCubeTexture=1,Object.defineProperty(fe.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),me.prototype=Object.create(r.prototype),me.prototype.constructor=me,me.prototype.isDataTexture2DArray=1,ge.prototype=Object.create(r.prototype),ge.prototype.constructor=ge,ge.prototype.isDataTexture3D=1;var As=new r,Ls=new me,Cs=new ge,Rs=new fe,Ps=[],Os=[],Ns=new Float32Array(16),Ds=new Float32Array(9),Is=new Float32Array(4);$e.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),xe(t,e)},Qe.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var zs=/([\w\d_]+)(\])?(\[|\.)?/g;tt.prototype.setValue=function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)},tt.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},tt.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];0!=s.needsUpdate&&o.setValue(e,s.value,r)}},tt.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var Bs=0,Us=/^[ \t]*#include +<([\w\d./]+)>/gm,Fs=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Hs=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g,ks=0;Lt.prototype=Object.create(T.prototype),Lt.prototype.constructor=Lt,Lt.prototype.isMeshDepthMaterial=1,Lt.prototype.copy=function(e){return T.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Ct.prototype=Object.create(T.prototype),Ct.prototype.constructor=Ct,Ct.prototype.isMeshDistanceMaterial=1,Ct.prototype.copy=function(e){return T.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Dt.prototype=Object.assign(Object.create(Y.prototype),{constructor:Dt,isArrayCamera:1}),It.prototype=Object.assign(Object.create(p.prototype),{constructor:It,isGroup:1}),Object.assign(zt.prototype,e.prototype),Object.assign(Ut.prototype,{isFogExp2:1,clone:function(){return new Ut(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Ft.prototype,{isFog:1,clone:function(){return new Ft(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Ht.prototype,"needsUpdate",{set:function(e){1==e&&this.version++}}),Object.assign(Ht.prototype,{isInterleavedBuffer:1,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;re.far||n.push({distance:c,point:Vs.clone(),uv:x.getUV(Vs,Js,$s,Qs,Ks,ec,tc,new t),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return p.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var nc=new c,rc=new c;Wt.prototype=Object.assign(Object.create(p.prototype),{constructor:Wt,isLOD:1,copy:function(e){p.prototype.copy.call(this,e,0);for(var t=e.levels,n=0,r=t.length;n0){for(var n=1,r=t.length;n0){nc.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(nc);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){nc.setFromMatrixPosition(e.matrixWorld),rc.setFromMatrixPosition(this.matrixWorld);var n=nc.distanceTo(rc)/e.zoom;t[0].object.visible=1;for(var r=1,i=t.length;r=t[r].distance;r++)t[r-1].object.visible=0,t[r].object.visible=1;for(this._currentLevel=r-1;r0&&(cc[0].instanceId=i,cc[0].object=this,t.push(cc[0]),cc.length=0)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),Jt.prototype=Object.create(T.prototype),Jt.prototype.constructor=Jt,Jt.prototype.isLineBasicMaterial=1,Jt.prototype.copy=function(e){return T.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var uc=new c,hc=new c,pc=new l,dc=new v,fc=new g;$t.prototype=Object.assign(Object.create(p.prototype),{constructor:$t,isLine:1,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;ro||(h.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(h))e.far||t.push({distance:_,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else for(g=0,v=f.length/3-1;go||(h.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(h))e.far||t.push({distance:_,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(n.isGeometry){var b=n.vertices,w=b.length;for(g=0;go||(h.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(h))e.far||t.push({distance:_,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var mc=new c,gc=new c;Qt.prototype=Object.assign(Object.create($t.prototype),{constructor:Qt,isLineSegments:1,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),rn.prototype=Object.assign(Object.create(r.prototype),{constructor:rn,isVideoTexture:1,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=1)}}),an.prototype=Object.create(r.prototype),an.prototype.constructor=an,an.prototype.isCompressedTexture=1,on.prototype=Object.create(r.prototype),on.prototype.constructor=on,on.prototype.isCanvasTexture=1,sn.prototype=Object.create(r.prototype),sn.prototype.constructor=sn,sn.prototype.isDepthTexture=1,cn.prototype=Object.create(F.prototype),cn.prototype.constructor=cn,ln.prototype=Object.create(j.prototype),ln.prototype.constructor=ln,un.prototype=Object.create(F.prototype),un.prototype.constructor=un,hn.prototype=Object.create(j.prototype),hn.prototype.constructor=hn,pn.prototype=Object.create(F.prototype),pn.prototype.constructor=pn,dn.prototype=Object.create(j.prototype),dn.prototype.constructor=dn,fn.prototype=Object.create(pn.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(j.prototype),mn.prototype.constructor=mn,gn.prototype=Object.create(pn.prototype),gn.prototype.constructor=gn,vn.prototype=Object.create(j.prototype),vn.prototype.constructor=vn,yn.prototype=Object.create(pn.prototype),yn.prototype.constructor=yn,xn.prototype=Object.create(j.prototype),xn.prototype.constructor=xn,bn.prototype=Object.create(pn.prototype),bn.prototype.constructor=bn,wn.prototype=Object.create(j.prototype),wn.prototype.constructor=wn,_n.prototype=Object.create(F.prototype),_n.prototype.constructor=_n,_n.prototype.toJSON=function(){var e=F.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},Mn.prototype=Object.create(j.prototype),Mn.prototype.constructor=Mn,Sn.prototype=Object.create(F.prototype),Sn.prototype.constructor=Sn,Tn.prototype=Object.create(j.prototype),Tn.prototype.constructor=Tn,En.prototype=Object.create(F.prototype),En.prototype.constructor=En;var wc={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i80*n){r=a=e[0],i=o=e[1];for(var f=n;fa&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-r,o-i))?1/l:0}return Cn(p,d,n,r,i,l),d}(n,r);for(o=0;o=r)){u.push(c.times[p]);for(var f=0;fa.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s=i)break e;var s=t[1];for(e=(i=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Tc.arraySlice(n,i,a),this.values=Tc.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=1,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=0);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=0);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=0;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=0;break}a=s}if(void 0!==r&&Tc.isTypedArray(r)){o=0;for(var c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=0;break}}}return e},optimize:function(){for(var e=Tc.arraySlice(this.times),t=Tc.arraySlice(this.values),n=this.getValueSize(),r=2302===this.getInterpolation(),i=1,a=e.length-1,o=1;o0){for(e[i]=e[a],f=a*n,m=i*n,p=0;p!==n;++p)t[m+p]=t[f+p];++i}return i!==e.length?(this.times=Tc.arraySlice(e,0,i),this.values=Tc.arraySlice(t,0,i*n)):(this.times=e,this.values=t),this},clone:function(){var e=Tc.arraySlice(this.times,0),t=Tc.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Or.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Or,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Nr.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Nr,ValueTypeName:"color"}),Dr.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Dr,ValueTypeName:"number"}),Ir.prototype=Object.assign(Object.create(Ar.prototype),{constructor:Ir,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=(n-t)/(r-t),u=c+o;c!==u;c+=4)s.slerpFlat(i,0,a,c-o,a,c,l);return i}}),zr.prototype=Object.assign(Object.create(Pr.prototype),{constructor:zr,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Ir(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Br.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Br,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ur.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Ur,ValueTypeName:"vector"}),Object.assign(Fr,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Hr(n[i]).scale(r));return new Fr(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=n.length;i!==a;++i)t.push(Pr.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o1){var l=r[h=c[1]];l||(r[h]=l=[]),l.push(s)}}var u=[];for(var h in r)u.push(Fr.CreateFromMorphTargetSequence(h,r[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];Tc.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c0||0===e.search(/^data\:image\/jpeg/);a.format=r?1022:1023,a.needsUpdate=1,void 0!==t&&t(a)}),n,i),a}}),Object.assign(Jr.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=0;var t,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=1,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var r=this.getPoint(t);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,i,a=new c,o=[],s=[],u=[],h=new c,p=new l;for(n=0;n<=e;n++)r=n/e,o[n]=this.getTangentAt(r),o[n].normalize();s[0]=new c,u[0]=new c;var d=Number.MAX_VALUE,f=Math.abs(o[0].x),m=Math.abs(o[0].y),g=Math.abs(o[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(o[0],a).normalize(),s[0].crossVectors(o[0],h),u[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),u[n]=u[n-1].clone(),h.crossVectors(o[n-1],o[n]),h.length()>Number.EPSILON&&(h.normalize(),i=Math.acos(Na.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(p.makeRotationAxis(h,i))),u[n].crossVectors(o[n],s[n]);if(1==t)for(i=Math.acos(Na.clamp(s[0].dot(s[e]),-1,1)),i/=e,o[0].dot(h.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(p.makeRotationAxis(o[n],i*n)),u[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:u}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),$r.prototype=Object.create(Jr.prototype),$r.prototype.constructor=$r,$r.prototype.isEllipseCurve=1,$r.prototype.getPoint=function(e,n){for(var r=n||new t,i=2*Math.PI,a=this.aEndAngle-this.aStartAngle,o=Math.abs(a)i;)a-=i;a0?0:(Math.floor(Math.abs(h)/l)+1)*l:0===p&&h===l-1&&(h=l-2,p=1),this.closed||h>0?n=s[(h-1)%l]:(Cc.subVectors(s[0],s[1]).add(s[0]),n=Cc),r=s[h%l],i=s[(h+1)%l],this.closed||h+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(ti(s,c.x,l.x,u.x,h.x),ti(s,c.y,l.y,u.y,h.y)),r},ui.prototype.copy=function(e){Jr.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=1,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Jr.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return hi.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=hi.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return hi.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),di.prototype=Object.assign(Object.create(pi.prototype),{constructor:di,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n0?1:0:o.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var s in e.uniforms){var u=e.uniforms[s];switch(o.uniforms[s]={},u.type){case"t":o.uniforms[s].value=r(u.value);break;case"c":o.uniforms[s].value=(new b).setHex(u.value);break;case"v2":o.uniforms[s].value=(new t).fromArray(u.value);break;case"v3":o.uniforms[s].value=(new c).fromArray(u.value);break;case"v4":o.uniforms[s].value=(new i).fromArray(u.value);break;case"m3":o.uniforms[s].value=(new n).fromArray(u.value);case"m4":o.uniforms[s].value=(new l).fromArray(u.value);break;default:o.uniforms[s].value=u.value}}if(void 0!==e.defines&&(o.defines=e.defines),void 0!==e.vertexShader&&(o.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(o.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var h in e.extensions)o.extensions[h]=e.extensions[h];if(void 0!==e.shading&&(o.flatShading=1===e.shading),void 0!==e.size&&(o.size=e.size),void 0!==e.sizeAttenuation&&(o.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(o.map=r(e.map)),void 0!==e.matcap&&(o.matcap=r(e.matcap)),void 0!==e.alphaMap&&(o.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(o.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(o.bumpScale=e.bumpScale),void 0!==e.normalMap&&(o.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(o.normalMapType=e.normalMapType),void 0!==e.normalScale){var p=e.normalScale;0==Array.isArray(p)&&(p=[p,p]),o.normalScale=(new t).fromArray(p)}return void 0!==e.displacementMap&&(o.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(o.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(o.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(o.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(o.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(o.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(o.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(o.specularMap=r(e.specularMap)),void 0!==e.envMap&&(o.envMap=r(e.envMap)),void 0!==e.envMapIntensity&&(o.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(o.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(o.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(o.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(o.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(o.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(o.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(o.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(o.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(o.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(o.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(o.clearcoatNormalScale=(new t).fromArray(e.clearcoatNormalScale)),o},setTextures:function(e){return this.textures=e,this}});var Dc=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};Ai.prototype=Object.assign(Object.create(F.prototype),{constructor:Ai,isInstancedBufferGeometry:1,copy:function(e){return F.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=F.prototype.toJSON.call(this);return e.maxInstancedCount=this.maxInstancedCount,e.isInstancedBufferGeometry=1,e}}),Li.prototype=Object.assign(Object.create(A.prototype),{constructor:Li,isInstancedBufferAttribute:1,copy:function(e){return A.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=A.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=1,e}}),Ci.prototype=Object.assign(Object.create(Gr.prototype),{constructor:Ci,load:function(e,t,n,r){var i=this,a=new jr(i.manager);a.setPath(i.path),a.load(e,(function(e){t(i.parse(JSON.parse(e)))}),n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new Ai:new F,n=e.data.index;if(void 0!==n){var r=new Ic[n.type](n.array);t.setIndex(new A(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],s=(r=new Ic[o.type](o.array),new(o.isInstancedBufferAttribute?Li:A)(r,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var u=l[a],h=[],p=0,d=u.length;p0){var a=new Xr(new kr(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;oNumber.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return 1}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(0===u)return 1;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return 1}}return r}var i=wc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(1==t)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new di).curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var h,p,d=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v1){for(var x=0,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S0&&(x||(m=d))}v=0;for(var L=f.length;v0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){s.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}});var $c=/[\[\]\.:\/]/g,Qc=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Kc=/(WCOD+)?/.source.replace("WCOD","[^\\[\\]:\\/]"),el=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),tl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),nl=RegExp("^"+Qc+Kc+el+tl+"$"),rl=["material","materials","bones"];Object.assign(Xi.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Yi,{Composite:Xi,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Yi.Composite(e,t,n):new Yi(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace($c,"")},parseTrackName:function(e){var t=nl.exec(e);if(!t)throw Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==rl.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function(e){for(var n=0;n=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var p=0,d=i;p!==d;++p){var f=r[p],m=f[u],g=f[l];f[l]=m,f[u]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=r[l];if(void 0!==u)if(delete r[l],u0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=0))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=1:this.timeScale=t))}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=2202===r;if(0===e)return-1===i?t:a&&1==(1&i)?n-t:t;if(2200===r){-1===i&&(this._loopCount=0,this._setEndings(1,1,0));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=1:this.enabled=0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(1,0===this.repetitions,a)):this._setEndings(0===this.repetitions,1,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=1:this.enabled=0,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(0,0,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&i))return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),Ji.prototype=Object.assign(Object.create(e.prototype),{constructor:Ji,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],p=h.name,d=l[p];if(void 0!==d)a[u]=d;else{if(void 0!==(d=a[u])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(d=new qi(Yi.create(n,p,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[u]=d}o[u].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y?0:1},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,n){return void 0===n&&(console.warn("THREE.Box2: .getParameter() target is now required"),n=new t),n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y?0:1},clampPoint:function(e,n){return void 0===n&&(console.warn("THREE.Box2: .clampPoint() target is now required"),n=new t),n.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return il.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var al=new c,ol=new c;Object.assign(ra.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new c),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new c),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new c),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){al.subVectors(e,this.start),ol.subVectors(this.end,this.start);var n=ol.dot(ol),r=ol.dot(al)/n;return t&&(r=Na.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new c),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),ia.prototype=Object.create(p.prototype),ia.prototype.constructor=ia,ia.prototype.isImmediateRenderObject=1;var sl=new c;aa.prototype=Object.create(p.prototype),aa.prototype.constructor=aa,aa.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},aa.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),sl.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(sl),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var cl=new c,ll=new l,ul=new l;oa.prototype=Object.create(Qt.prototype),oa.prototype.constructor=oa,oa.prototype.isSkeletonHelper=1,oa.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");ul.getInverse(this.root.matrixWorld);for(var i=0,a=0;i.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{_l.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(_l,t)}},va.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},va.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},va.prototype.copy=function(e){return p.prototype.copy.call(this,e,0),this.line.copy(e.line),this.cone.copy(e.cone),this},va.prototype.clone=function(){return(new this.constructor).copy(this)},ya.prototype=Object.create(Qt.prototype),ya.prototype.constructor=ya;var Ml=[.125,.215,.35,.446,.526,.582],Sl=5+Ml.length,Tl={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},{_lodPlanes:El,_sizeLods:Al,_sigmas:Ll}=(new wi,new yr({defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:0},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new c(0,1,0)},inputEncoding:{value:Tl[3e3]},outputEncoding:{value:Tl[3e3]}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:0,depthWrite:0}).type="SphericalGaussianBlur",function(){for(var e=[],t=[],n=[],r=8,i=0;i4?a=Ml[i-8+4-1]:0==i&&(a=0),n.push(a);for(var o=-1/255/2,s=1+1/255/2,c=[o,o,s,o,s,s,o,o,s,s,o,s],l=new Float32Array(108),u=new Float32Array(72),h=new Float32Array(36),p=0;p<6;p++){var d=-1,f=[d,-1,0,d+2/3,-1,0,d+2/3,0,0,d,-1,0,d+2/3,0,0,d,0,0];l.set(f,18*p),u.set(c,12*p);var m=[p,p,p,p,p,p];h.set(m,6*p)}var g=new F;g.setAttribute("position",new A(l,3)),g.setAttribute("uv",new A(u,2)),g.setAttribute("faceIndex",new A(h,1)),e.push(g),r>4&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}());Jr.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Jr.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(hi.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new j,n=0,r=e.length;n0;)this.smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e},function(){function e(e,t,n){return n[Math.min(e,t)+"_"+Math.max(e,t)]}function n(e,t,n,r,i,a){var o,s=Math.min(e,t),c=Math.max(e,t),l=s+"_"+c;l in r?o=r[l]:(o={a:n[s],b:n[c],newEdge:null,faces:[]},r[l]=o),o.faces.push(i),a[e].edges.push(o),a[t].edges.push(o)}function r(e,t,n,r,i){e.push(new S(t,n,r,void 0,void 0,i))}function i(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function a(e,t,n,r){e.push([t.clone(),n.clone(),r.clone()])}var o=["a","b","c"];Nl.prototype.smooth=function(s){var l,u,h,p,d,f,m,g,v,y,x,b,w,_=new c,M=[];l=s.vertices,u=s.faces;var S,T,E,A,L,C,R,P,O,N,D,I,z,B,U=void 0!==(h=s.faceVertexUvs)[0]&&h[0].length>0;if(U)for(var F=0;F3&&(P=3/(8*f)),O=1-f*P,N=P,f<=2&&2==f&&(O=3/4,N=1/8),B=z.clone().multiplyScalar(O),_.set(0,0,0),F=0;F=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",1,1,window,0,0,0,80,20,0,0,0,0,0,null),e.dispatchEvent(t)}}var i="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof Dl&&Dl.global===Dl?Dl:void 0,a=i.saveAs||("object"!=typeof window||window!==i?function(){}:"download"in HTMLAnchorElement.prototype?function(e,a,o){var s=i.URL||i.webkitURL,c=document.createElement("a");a=a||e.name||"download",c.download=a,c.rel="noopener","string"==typeof e?(c.href=e,c.origin===location.origin?r(c):n(c.href)?t(e,a,o):r(c,c.target="_blank")):(c.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(c.href)}),4e4),setTimeout((function(){r(c)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,i,a){if(i=i||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:0}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(e,a),i);else if(n(e))t(e,i,a);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout((function(){r(o)}))}}:function(e,n,r,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,r);var o="application/octet-stream"===e.type,s=/constructor/i.test(i.HTMLElement)||i.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||o&&s)&&"object"==typeof FileReader){var l=new FileReader;l.onloadend=function(){var e=l.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},l.readAsDataURL(e)}else{var u=i.URL||i.webkitURL,h=u.createObjectURL(e);a?a.location=h:location.href=h,a=null,setTimeout((function(){u.revokeObjectURL(h)}),4e4)}});i.saveAs=a.saveAs=a,e.exports=a}()})).saveAs,zl=ba((function(e){ +/*! + * jQuery JavaScript Library v3.4.1 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2019-05-01T21:04Z + */ +!function(t,n){e.exports=t.document?n(t,1):function(e){if(!e.document)throw Error("jQuery requires a window with a document");return n(e)}}("undefined"!=typeof window?window:Dl,(function(e,t){function n(e,t,n){var r,i,a=(n=n||ee).createElement("script");if(a.text=e,t)for(r in fe)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&a.setAttribute(r,i);n.head.appendChild(a).parentNode.removeChild(a)}function r(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?oe[se.call(e)]||"object":typeof e}function i(e){var t=!!e&&"length"in e&&e.length,n=r(e);return pe(e)||de(e)?0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function a(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}function o(e,t,n){return pe(t)?me.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?me.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?me.grep(e,(function(e){return ae.call(t,e)>-1!==n})):me.filter(t,e,n)}function s(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function c(e){return e}function l(e){throw e}function u(e,t,n,r){var i;try{e&&pe(i=e.promise)?i.call(e).done(t).fail(n):e&&pe(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.call(void 0,e)}}function h(){ee.removeEventListener("DOMContentLoaded",h),e.removeEventListener("load",h),me.ready()}function p(e,t){return t.toUpperCase()}function d(e){return e.replace(Re,"ms-").replace(Pe,p)}function f(){this.expando=me.expando+f.uid++}function m(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ze,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n=function(e){return"true"===e?1:"false"===e?0:"null"===e?null:e===+e+""?+e:Ie.test(e)?JSON.parse(e):e}(n)}catch(e){}De.set(e,t,n)}else n=void 0;return n}function g(e,t,n,r){var i,a,o=20,s=r?function(){return r.cur()}:function(){return me.css(e,t,"")},c=s(),l=n&&n[3]||(me.cssNumber[t]?"":"px"),u=e.nodeType&&(me.cssNumber[t]||"px"!==l&&+c)&&Ue.exec(me.css(e,t));if(u&&u[3]!==l){for(c/=2,l=l||u[3],u=+c||1;o--;)me.style(e,t,u+l),(1-a)*(1-(a=s()/c||.5))<=0&&(o=0),u/=a;u*=2,me.style(e,t,u+l),n=n||[]}return n&&(u=+u||+c||0,i=n[1]?u+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=u,r.end=i)),i}function v(e){var t,n=e.ownerDocument,r=e.nodeName,i=We[r];return i||(t=n.body.appendChild(n.createElement(r)),i=me.css(t,"display"),t.parentNode.removeChild(t),"none"===i&&(i="block"),We[r]=i,i)}function y(e,t){for(var n,r,i=[],a=0,o=e.length;a-1)a&&a.push(o);else if(u=ke(o),s=x(p.appendChild(o),"script"),u&&b(s),n)for(h=0;o=s[h++];)Ye.test(o.type||"")&&n.push(o);return p}function _(){return 1}function M(){return 0}function S(e,t){return e===function(){try{return ee.activeElement}catch(e){}}()==("focus"===t)}function T(e,t,n,r,i,a){var o,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)T(e,s,n,r,t[s],a);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),0==i)i=M;else if(!i)return e;return 1===a&&(o=i,(i=function(e){return me().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=me.guid++)),e.each((function(){me.event.add(this,t,i,r,n)}))}function E(e,t,n){n?(Ne.set(e,t,0),me.event.add(e,t,{namespace:0,handler:function(e){var r,i,a=Ne.get(this,t);if(1&e.isTrigger&&this[t]){if(a.length)(me.event.special[t]||{}).delegateType&&e.stopPropagation();else if(a=ne.call(arguments),Ne.set(this,t,a),r=n(this,t),this[t](),a!==(i=Ne.get(this,t))||r?Ne.set(this,t,0):i={},a!==i)return e.stopImmediatePropagation(),e.preventDefault(),i.value}else a.length&&(Ne.set(this,t,{value:me.event.trigger(me.extend(a[0],me.Event.prototype),a.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Ne.get(e,t)&&me.event.add(e,t,_)}function A(e,t){return a(e,"table")&&a(11!==t.nodeType?t:t.firstChild,"tr")&&me(e).children("tbody")[0]||e}function L(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function C(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function R(e,t){var n,r,i,a,o,s,c,l;if(1===t.nodeType){if(Ne.hasData(e)&&(a=Ne.access(e),o=Ne.set(t,a),l=a.events))for(i in delete o.handle,o.events={},l)for(n=0,r=l[i].length;n1&&"string"==typeof f&&!he.checkClone&&it.test(f))return e.each((function(n){var a=e.eq(n);m&&(t[0]=f.call(this,n,a.html())),O(a,t,r,i)}));if(p&&(o=(a=w(t,e[0].ownerDocument,0,e,i)).firstChild,1===a.childNodes.length&&(a=o),o||i)){for(c=(s=me.map(x(a,"script"),L)).length;h=0&&(c+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-a-c-s-.5))||0),c}function F(e,t,n){var r=st(e),i=(!he.boxSizingReliable()||n)&&"border-box"===me.css(e,"boxSizing",0,r),a=i,o=D(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(ot.test(o)){if(!n)return o;o="auto"}return(!he.boxSizingReliable()&&i||"auto"===o||!parseFloat(o)&&"inline"===me.css(e,"display",0,r))&&e.getClientRects().length&&(i="border-box"===me.css(e,"boxSizing",0,r),(a=s in e)&&(o=e[s])),(o=parseFloat(o)||0)+U(e,t,n||(i?"border":"content"),a,r,o)+"px"}function H(e,t,n,r,i){return new H.prototype.init(e,t,n,r,i)}function k(){vt&&(0==ee.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(k):e.setTimeout(k,me.fx.interval),me.fx.tick())}function G(){return e.setTimeout((function(){gt=void 0})),gt=Date.now()}function j(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=Fe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function V(e,t,n){for(var r,i=(W.tweeners[t]||[]).concat(W.tweeners["*"]),a=0,o=i.length;a=0&&nw.cacheLength&&delete t[e.shift()],t[n+" "]=r}}function r(e){return e[U]=1,e}function i(e){var t=P.createElement("fieldset");try{return!!e(t)}catch(e){return 0}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function a(e,t){for(var n=e.split("|"),r=n.length;r--;)w.attrHandle[n[r]]=t}function o(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function c(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return function(t){return"form"in t?t.parentNode&&0==t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&we(t)===e:t.disabled===e:"label"in t?t.disabled===e:0}}function u(e){return r((function(t){return t=+t,r((function(n,r){for(var i,a=e([],n.length,t),o=a.length;o--;)n[i=a[o]]&&(n[i]=!(r[i]=n[i]))}))}))}function h(e){return e&&void 0!==e.getElementsByTagName&&e}function p(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return 0;return 1}:e[0]}function g(e,t,n,r,i){for(var a,o=[],s=0,c=e.length,l=null!=t;s-1&&(r[u]=!(s[u]=p))}}else x=g(x===s?x.splice(m,x.length):x),o?o(null,s,x,l):$.apply(s,x)}))}function y(e){for(var t,n,r,i=e.length,a=w.relative[e[0].type],o=a||w.relative[" "],s=a?1:0,c=f((function(e){return e===t}),o,1),l=f((function(e){return K(t,e)>-1}),o,1),u=[function(e,n,r){var i=!a&&(r||n!==A)||((t=n).nodeType?c(e,n,r):l(e,n,r));return t=null,i}];s1&&m(u),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(re,"$1"),n,s+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,oe=/[\x20\t\r\n\f]|>/,se=/:((?:\\.|[\w-]|[^-\xa0])+)(?:\((('((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)")|((?:\\.|[^\\()[\]]|\[[\x20\t\r\n\f]*((?:\\.|[\w-]|[^-\xa0])+)(?:[\x20\t\r\n\f]*([*^$|!~]?=)[\x20\t\r\n\f]*(?:'((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)"|((?:\\.|[\w-]|[^-\xa0])+))|)[\x20\t\r\n\f]*\])*)|.*)\)|)/,ce=/^(?:\\.|[\w-]|[^-\xa0])+$/,le={ID:/^#((?:\\.|[\w-]|[^-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^-\xa0])+)/,TAG:/^((?:\\.|[\w-]|[^-\xa0])+|[*])/,ATTR:/^\[[\x20\t\r\n\f]*((?:\\.|[\w-]|[^-\xa0])+)(?:[\x20\t\r\n\f]*([*^$|!~]?=)[\x20\t\r\n\f]*(?:'((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)"|((?:\\.|[\w-]|[^-\xa0])+))|)[\x20\t\r\n\f]*\]/,PSEUDO:/^:((?:\\.|[\w-]|[^-\xa0])+)(?:\((('((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)")|((?:\\.|[^\\()[\]]|\[[\x20\t\r\n\f]*((?:\\.|[\w-]|[^-\xa0])+)(?:[\x20\t\r\n\f]*([*^$|!~]?=)[\x20\t\r\n\f]*(?:'((?:\\.|[^\\'])*)'|"((?:\\.|[^\\"])*)"|((?:\\.|[\w-]|[^-\xa0])+))|)[\x20\t\r\n\f]*\])*)|.*)\)|)/,CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,bool:/^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},ue=/HTML$/i,he=/^(?:input|select|textarea|button)$/i,pe=/^h\d$/i,de=/^[^{]+\{\s*\[native \w/,fe=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,me=/[+~]/,ge=/\\([\da-f]{1,6}[\x20\t\r\n\f]?|([\x20\t\r\n\f])|.)/gi,ve=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},ye=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,xe=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},be=function(){R()},we=f((function(e){return 1==e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{$.apply(Y=Q.call(F.childNodes),F.childNodes),Y[F.childNodes.length].nodeType}catch(e){$={apply:Y.length?function(e,t){J.apply(e,Q.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}for(x in b=t.support={},M=t.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!ue.test(t||n&&n.nodeName||"HTML")},R=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:F;return r!==P&&9===r.nodeType&&r.documentElement?(O=(P=r).documentElement,N=!M(P),F!==P&&(n=P.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",be,0):n.attachEvent&&n.attachEvent("onunload",be)),b.attributes=i((function(e){return e.className="i",!e.getAttribute("className")})),b.getElementsByTagName=i((function(e){return e.appendChild(P.createComment("")),!e.getElementsByTagName("*").length})),b.getElementsByClassName=de.test(P.getElementsByClassName),b.getById=i((function(e){return O.appendChild(e).id=U,!P.getElementsByName||!P.getElementsByName(U).length})),b.getById?(w.filter.ID=function(e){var t=e.replace(ge,ve);return function(e){return e.getAttribute("id")===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&N){var n=t.getElementById(e);return n?[n]:[]}}):(w.filter.ID=function(e){var t=e.replace(ge,ve);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&N){var n,r,i,a=t.getElementById(e);if(a){if((n=a.getAttributeNode("id"))&&n.value===e)return[a];for(i=t.getElementsByName(e),r=0;a=i[r++];)if((n=a.getAttributeNode("id"))&&n.value===e)return[a]}return[]}}),w.find.TAG=b.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):b.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,a=t.getElementsByTagName(e);if("*"===e){for(;n=a[i++];)1===n.nodeType&&r.push(n);return r}return a},w.find.CLASS=b.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&N)return t.getElementsByClassName(e)},I=[],D=[],(b.qsa=de.test(P.querySelectorAll))&&(i((function(e){O.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&D.push("[*^$]="+te+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||D.push("\\["+te+"*(?:value|"+ee+")"),e.querySelectorAll("[id~="+U+"-]").length||D.push("~="),e.querySelectorAll(":checked").length||D.push(":checked"),e.querySelectorAll("a#"+U+"+*").length||D.push(".#.+[+~]")})),i((function(e){e.innerHTML="";var t=P.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&D.push("name"+te+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&D.push(":enabled",":disabled"),O.appendChild(e).disabled=1,2!==e.querySelectorAll(":disabled").length&&D.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),D.push(",.*:")}))),(b.matchesSelector=de.test(z=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&i((function(e){b.disconnectedMatch=z.call(e,"*"),z.call(e,"[s!='']:x"),I.push("!=",":((?:\\\\.|[\\w-]|[^\0-\\xa0])+)(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\0-\\xa0])+)(?:[\\x20\\t\\r\\n\\f]*([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|((?:\\\\.|[\\w-]|[^\0-\\xa0])+))|)[\\x20\\t\\r\\n\\f]*\\])*)|.*)\\)|)")})),D=D.length&&RegExp(D.join("|")),I=I.length&&RegExp(I.join("|")),t=de.test(O.compareDocumentPosition),B=t||de.test(O.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return 1;return 0},q=t?function(e,t){if(e===t)return C=1,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!b.sortDetached&&t.compareDocumentPosition(e)===n?e===P||e.ownerDocument===F&&B(F,e)?-1:t===P||t.ownerDocument===F&&B(F,t)?1:L?K(L,e)-K(L,t):0:4&n?-1:1)}:function(e,t){if(e===t)return C=1,0;var n,r=0,i=e.parentNode,a=t.parentNode,s=[e],c=[t];if(!i||!a)return e===P?-1:t===P?1:i?-1:a?1:L?K(L,e)-K(L,t):0;if(i===a)return o(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)c.unshift(n);for(;s[r]===c[r];)r++;return r?o(s[r],c[r]):s[r]===F?-1:c[r]===F?1:0},P):P},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==P&&R(e),b.matchesSelector&&N&&!W[n+" "]&&(!I||!I.test(n))&&(!D||!D.test(n)))try{var r=z.call(e,n);if(r||b.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){W(n,1)}return t(n,P,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==P&&R(e),B(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==P&&R(e);var n=w.attrHandle[t.toLowerCase()],r=n&&X.call(w.attrHandle,t.toLowerCase())?n(e,t,!N):void 0;return void 0!==r?r:b.attributes||!N?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(ye,xe)},t.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(C=!b.detectDuplicates,L=!b.sortStable&&e.slice(0),e.sort(q),C){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return L=null,e},_=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=_(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=_(t);return n},(w=t.selectors={cacheLength:50,createPseudo:r,match:le,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:1}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:1},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ge,ve),e[3]=(e[3]||e[4]||e[5]||"").replace(ge,ve),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return le.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&se.test(n)&&(t=S(n,1))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ge,ve).toLowerCase();return"*"===e?function(){return 1}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=G[e+" "];return t||(t=RegExp("(^|"+te+")"+e+"("+te+"|$)"))&&G(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,n,r){return function(i){var a=t.attr(i,e);return null==a?"!="===n:n?(a+="","="===n?a===r:"!="===n?a!==r:"^="===n?r&&0===a.indexOf(r):"*="===n?r&&a.indexOf(r)>-1:"$="===n?r&&a.slice(-r.length)===r:"~="===n?(" "+a.replace(ne," ")+" ").indexOf(r)>-1:"|="===n?a===r||a.slice(0,r.length+1)===r+"-":0):1}},CHILD:function(e,t,n,r,i){var a="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,c){var l,u,h,p,d,f,m=a!==o?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!c&&!s,x=0;if(g){if(a){for(;m;){for(p=t;p=p[m];)if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return 0;f=m="only"===e&&!f&&"nextSibling"}return 1}if(f=[o?g.firstChild:g.lastChild],o&&y){for(x=(d=(l=(u=(h=(p=g)[U]||(p[U]={}))[p.uniqueID]||(h[p.uniqueID]={}))[e]||[])[0]===H&&l[1])&&l[2],p=d&&g.childNodes[d];p=++d&&p&&p[m]||(x=d=0)||f.pop();)if(1===p.nodeType&&++x&&p===t){u[e]=[H,d,x];break}}else if(y&&(x=d=(l=(u=(h=(p=t)[U]||(p[U]={}))[p.uniqueID]||(h[p.uniqueID]={}))[e]||[])[0]===H&&l[1]),0==x)for(;(p=++d&&p&&p[m]||(x=d=0)||f.pop())&&((s?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++x||(y&&((u=(h=p[U]||(p[U]={}))[p.uniqueID]||(h[p.uniqueID]={}))[e]=[H,x]),p!==t)););return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,n){var i,a=w.pseudos[e]||w.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return a[U]?a(n):a.length>1?(i=[e,e,"",n],w.setFilters.hasOwnProperty(e.toLowerCase())?r((function(e,t){for(var r,i=a(e,n),o=i.length;o--;)e[r=K(e,i[o])]=!(t[r]=i[o])})):function(e){return a(e,0,i)}):a}},pseudos:{not:r((function(e){var t=[],n=[],i=T(e.replace(re,"$1"));return i[U]?r((function(e,t,n,r){for(var a,o=i(e,null,r,[]),s=e.length;s--;)(a=o[s])&&(e[s]=!(t[s]=a))})):function(e,r,a){return t[0]=e,i(t,null,a,n),t[0]=null,!n.pop()}})),has:r((function(e){return function(n){return t(e,n).length>0}})),contains:r((function(e){return e=e.replace(ge,ve),function(t){return(t.textContent||_(t)).indexOf(e)>-1}})),lang:r((function(e){return ce.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(ge,ve).toLowerCase(),function(t){var n;do{if(n=N?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return 0}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===O},focus:function(e){return e===P.activeElement&&(!P.hasFocus||P.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:l(0),disabled:l(1),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,1==e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return 0;return 1},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return pe.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:u((function(){return[0]})),last:u((function(e,t){return[t-1]})),eq:u((function(e,t,n){return[n<0?n+t:n]})),even:u((function(e,t){for(var n=0;nt?t:n;--r>=0;)e.push(r);return e})),gt:u((function(e,t,n){for(var r=n<0?n+t:n;++r0,a=e.length>0,o=function(r,o,s,c,l){var u,h,p,d=0,f="0",m=r&&[],v=[],y=A,x=r||a&&w.find.TAG("*",l),b=H+=null==y?1:Math.random()||.1,_=x.length;for(l&&(A=o===P||o||l);f!==_&&null!=(u=x[f]);f++){if(a&&u){for(h=0,o||u.ownerDocument===P||(R(u),s=!N);p=e[h++];)if(p(u,o||P,s)){c.push(u);break}l&&(H=b)}i&&((u=!p&&u)&&d--,r&&m.push(u))}if(d+=f,i&&f!==d){for(h=0;p=n[h++];)p(m,v,o,s);if(r){if(d>0)for(;f--;)m[f]||v[f]||(v[f]=Z.call(c));v=g(v)}$.apply(c,v),l&&!r&&v.length>0&&d+n.length>1&&t.uniqueSort(c)}return l&&(H=b,A=y),m};return i?r(o):o}(o,a))).selector=e}return s},E=t.select=function(e,t,n,r){var i,a,o,s,c,l="function"==typeof e&&e,u=!r&&S(e=l.selector||e);if(n=n||[],1===u.length){if((a=u[0]=u[0].slice(0)).length>2&&"ID"===(o=a[0]).type&&9===t.nodeType&&N&&w.relative[a[1].type]){if(!(t=(w.find.ID(o.matches[0].replace(ge,ve),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(a.shift().value.length)}for(i=le.needsContext.test(e)?0:a.length;i--&&(o=a[i],!w.relative[s=o.type]);)if((c=w.find[s])&&(r=c(o.matches[0].replace(ge,ve),me.test(a[0].type)&&h(t.parentNode)||t))){if(a.splice(i,1),!(e=r.length&&d(a)))return $.apply(n,r),n;break}}return(l||T(e,u))(r,t,!N,n,!t||me.test(e)&&h(t.parentNode)||t),n},b.sortStable=U.split("").sort(q).join("")===U,b.detectDuplicates=!!C,R(),b.sortDetached=i((function(e){return 1&e.compareDocumentPosition(P.createElement("fieldset"))})),i((function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")}))||a("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),b.attributes&&i((function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||a("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),i((function(e){return null==e.getAttribute("disabled")}))||a(ee,(function(e,t,n){var r;if(!n)return 1==e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null})),t}(e);me.find=ve,me.expr=ve.selectors,me.expr[":"]=me.expr.pseudos,me.uniqueSort=me.unique=ve.uniqueSort,me.text=ve.getText,me.isXMLDoc=ve.isXML,me.contains=ve.contains,me.escapeSelector=ve.escape;var ye=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&me(e).is(n))break;r.push(e)}return r},xe=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},be=me.expr.match.needsContext,we=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;me.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?me.find.matchesSelector(r,e)?[r]:[]:me.find.matches(e,me.grep(t,(function(e){return 1===e.nodeType})))},me.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(me(e).filter((function(){for(t=0;t1?me.uniqueSort(n):n},filter:function(e){return this.pushStack(o(this,e||[],0))},not:function(e){return this.pushStack(o(this,e||[],1))},is:function(e){return!!o(this,"string"==typeof e&&be.test(e)?me(e):e||[],0).length}});var _e,Me=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(me.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||_e,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Me.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof me?t[0]:t,me.merge(this,me.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:ee,1)),we.test(r[1])&&me.isPlainObject(t))for(r in t)pe(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=ee.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):pe(e)?void 0!==n.ready?n.ready(e):e(me):me.makeArray(e,this)}).prototype=me.fn,_e=me(ee);var Se=/^(?:parents|prev(?:Until|All))/,Te={children:1,contents:1,next:1,prev:1};me.fn.extend({has:function(e){var t=me(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&me.find.matchesSelector(n,e))){a.push(n);break}return this.pushStack(a.length>1?me.uniqueSort(a):a)},index:function(e){return e?"string"==typeof e?ae.call(me(e),this[0]):ae.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(me.uniqueSort(me.merge(this.get(),me(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),me.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return ye(e,"parentNode")},parentsUntil:function(e,t,n){return ye(e,"parentNode",n)},next:function(e){return s(e,"nextSibling")},prev:function(e){return s(e,"previousSibling")},nextAll:function(e){return ye(e,"nextSibling")},prevAll:function(e){return ye(e,"previousSibling")},nextUntil:function(e,t,n){return ye(e,"nextSibling",n)},prevUntil:function(e,t,n){return ye(e,"previousSibling",n)},siblings:function(e){return xe((e.parentNode||{}).firstChild,e)},children:function(e){return xe(e.firstChild)},contents:function(e){return void 0!==e.contentDocument?e.contentDocument:(a(e,"template")&&(e=e.content||e),me.merge([],e.childNodes))}},(function(e,t){me.fn[e]=function(n,r){var i=me.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=me.filter(r,i)),this.length>1&&(Te[e]||me.uniqueSort(i),Se.test(e)&&i.reverse()),this.pushStack(i)}}));var Ee=/[^\x20\t\r\n\f]+/g;me.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return me.each(e.match(Ee)||[],(function(e,n){t[n]=1})),t}(e):me.extend({},e);var t,n,i,a,o=[],s=[],c=-1,l=function(){for(a=a||e.once,i=t=1;s.length;c=-1)for(n=s.shift();++c-1;)o.splice(n,1),n<=c&&c--})),this},has:function(e){return e?me.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return a=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return a=s=[],n||t||(o=n=""),this},locked:function(){return!!a},fireWith:function(e,n){return a||(n=[e,(n=n||[]).slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},me.extend({Deferred:function(t){var n=[["notify","progress",me.Callbacks("memory"),me.Callbacks("memory"),2],["resolve","done",me.Callbacks("once memory"),me.Callbacks("once memory"),0,"resolved"],["reject","fail",me.Callbacks("once memory"),me.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return a.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return me.Deferred((function(t){me.each(n,(function(n,r){var i=pe(e[r[4]])&&e[r[4]];a[r[1]]((function(){var e=i&&i.apply(this,arguments);e&&pe(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)}))})),e=null})).promise()},then:function(t,r,i){function a(t,n,r,i){return function(){var s=this,u=arguments,h=function(){var e,h;if(!(t=o&&(r!==l&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?p():(me.Deferred.getStackHook&&(p.stackTrace=me.Deferred.getStackHook()),e.setTimeout(p))}}var o=0;return me.Deferred((function(e){n[0][3].add(a(0,e,pe(i)?i:c,e.notifyWith)),n[1][3].add(a(0,e,pe(t)?t:c)),n[2][3].add(a(0,e,pe(r)?r:l))})).promise()},promise:function(e){return null!=e?me.extend(e,i):i}},a={};return me.each(n,(function(e,t){var o=t[2],s=t[5];i[t[1]]=o.add,s&&o.add((function(){r=s}),n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),o.add(t[3].fire),a[t[0]]=function(){return a[t[0]+"With"](this===a?void 0:this,arguments),this},a[t[0]+"With"]=o.fireWith})),i.promise(a),t&&t.call(a,a),a},when:function(e){var t=arguments.length,n=t,r=Array(n),i=ne.call(arguments),a=me.Deferred(),o=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?ne.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&(u(e,a.done(o(n)).resolve,a.reject,!t),"pending"===a.state()||pe(i[n]&&i[n].then)))return a.then();for(;n--;)u(i[n],o(n),a.reject);return a.promise()}});var Ae=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;me.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&Ae.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},me.readyException=function(t){e.setTimeout((function(){throw t}))};var Le=me.Deferred();me.fn.ready=function(e){return Le.then(e).catch((function(e){me.readyException(e)})),this},me.extend({isReady:0,readyWait:1,ready:function(e){(1==e?--me.readyWait:me.isReady)||(me.isReady=1,1!=e&&--me.readyWait>0||Le.resolveWith(ee,[me]))}}),me.ready.then=Le.then,"complete"===ee.readyState||"loading"!==ee.readyState&&!ee.documentElement.doScroll?e.setTimeout(me.ready):(ee.addEventListener("DOMContentLoaded",h),e.addEventListener("load",h));var Ce=function(e,t,n,i,a,o,s){var c=0,l=e.length,u=null==n;if("object"===r(n))for(c in a=1,n)Ce(e,t,c,n[c],1,o,s);else if(void 0!==i&&(a=1,pe(i)||(s=1),u&&(s?(t.call(e,i),t=null):(u=t,t=function(e,t,n){return u.call(me(e),n)})),t))for(;c1,null,1)},removeData:function(e){return this.each((function(){De.remove(this,e)}))}}),me.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Ne.get(e,t),n&&(!r||Array.isArray(n)?r=Ne.access(e,t,me.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=me.queue(e,t),r=n.length,i=n.shift(),a=me._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete a.stop,i.call(e,(function(){me.dequeue(e,t)}),a)),!r&&a&&a.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Ne.get(e,n)||Ne.access(e,n,{empty:me.Callbacks("once memory").add((function(){Ne.remove(e,[t+"queue",n])}))})}}),me.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,Ye=/^$|^module$|\/(?:java|ecma)script/i,Ze={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Ze.optgroup=Ze.option,Ze.tbody=Ze.tfoot=Ze.colgroup=Ze.caption=Ze.thead,Ze.th=Ze.td;var Je,$e,Qe=/<|&#?\w+;/;Je=ee.createDocumentFragment().appendChild(ee.createElement("div")),($e=ee.createElement("input")).setAttribute("type","radio"),$e.setAttribute("checked","checked"),$e.setAttribute("name","t"),Je.appendChild($e),he.checkClone=Je.cloneNode(1).cloneNode(1).lastChild.checked,Je.innerHTML="",he.noCloneChecked=!!Je.cloneNode(1).lastChild.defaultValue;var Ke=/^key/,et=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,tt=/^([^.]*)(?:\.(.+)|)/;me.event={global:{},add:function(e,t,n,r,i){var a,o,s,c,l,u,h,p,d,f,m,g=Ne.get(e);if(g)for(n.handler&&(n=(a=n).handler,i=a.selector),i&&me.find.matchesSelector(He,i),n.guid||(n.guid=me.guid++),(c=g.events)||(c=g.events={}),(o=g.handle)||(o=g.handle=function(t){return void 0!==me&&me.event.triggered!==t.type?me.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(Ee)||[""]).length;l--;)d=m=(s=tt.exec(t[l])||[])[1],f=(s[2]||"").split(".").sort(),d&&(h=me.event.special[d]||{},d=(i?h.delegateType:h.bindType)||d,h=me.event.special[d]||{},u=me.extend({type:d,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&me.expr.match.needsContext.test(i),namespace:f.join(".")},a),(p=c[d])||((p=c[d]=[]).delegateCount=0,h.setup&&0!=h.setup.call(e,r,f,o)||e.addEventListener&&e.addEventListener(d,o)),h.add&&(h.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,u):p.push(u),me.event.global[d]=1)},remove:function(e,t,n,r,i){var a,o,s,c,l,u,h,p,d,f,m,g=Ne.hasData(e)&&Ne.get(e);if(g&&(c=g.events)){for(l=(t=(t||"").match(Ee)||[""]).length;l--;)if(d=m=(s=tt.exec(t[l])||[])[1],f=(s[2]||"").split(".").sort(),d){for(h=me.event.special[d]||{},p=c[d=(r?h.delegateType:h.bindType)||d]||[],s=s[2]&&RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=p.length;a--;)u=p[a],!i&&m!==u.origType||n&&n.guid!==u.guid||s&&!s.test(u.namespace)||r&&r!==u.selector&&("**"!==r||!u.selector)||(p.splice(a,1),u.selector&&p.delegateCount--,h.remove&&h.remove.call(e,u));o&&!p.length&&(h.teardown&&0!=h.teardown.call(e,f,g.handle)||me.removeEvent(e,d,g.handle),delete c[d])}else for(d in c)me.event.remove(e,d+t[l],n,r,1);me.isEmptyObject(c)&&Ne.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,a,o,s=me.event.fix(e),c=Array(arguments.length),l=(Ne.get(this,"events")||{})[s.type]||[],u=me.event.special[s.type]||{};for(c[0]=s,t=1;t=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||1!=l.disabled)){for(a=[],o={},n=0;n-1:me.find(i,this,null,[l]).length),o[i]&&a.push(r);a.length&&s.push({elem:l,handlers:a})}return l=this,c\x20\t\r\n\f]*)[^>]*)\/>/gi,rt=/\s*$/g;me.extend({htmlPrefilter:function(e){return e.replace(nt,"<$1>")},clone:function(e,t,n){var r,i,a,o,s=e.cloneNode(1),c=ke(e);if(!(he.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||me.isXMLDoc(e)))for(o=x(s),r=0,i=(a=x(e)).length;r0&&b(o,!c&&x(e,"script")),s},cleanData:function(e){for(var t,n,r,i=me.event.special,a=0;void 0!==(n=e[a]);a++)if(Oe(n)){if(t=n[Ne.expando]){if(t.events)for(r in t.events)i[r]?me.event.remove(n,r):me.removeEvent(n,r,t.handle);n[Ne.expando]=void 0}n[De.expando]&&(n[De.expando]=void 0)}}}),me.fn.extend({detach:function(e){return N(this,e,1)},remove:function(e){return N(this,e)},text:function(e){return Ce(this,(function(e){return void 0===e?me.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return O(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||A(this,e).appendChild(e)}))},prepend:function(){return O(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=A(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return O(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return O(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(me.cleanData(x(e,0)),e.textContent="");return this},clone:function(e,t){return e=null==e?0:e,t=null==t?e:t,this.map((function(){return me.clone(this,e,t)}))},html:function(e){return Ce(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!rt.test(e)&&!Ze[(Xe.exec(e)||["",""])[1].toLowerCase()]){e=me.htmlPrefilter(e);try{for(;n1)}}),me.Tween=H,H.prototype={constructor:H,init:function(e,t,n,r,i,a){this.elem=e,this.prop=n,this.easing=i||me.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=a||(me.cssNumber[n]?"":"px")},cur:function(){var e=H.propHooks[this.prop];return e&&e.get?e.get(this):H.propHooks._default.get(this)},run:function(e){var t,n=H.propHooks[this.prop];return this.options.duration?this.pos=t=me.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):H.propHooks._default.set(this),this}},H.prototype.init.prototype=H.prototype,H.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=me.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){me.fx.step[e.prop]?me.fx.step[e.prop](e):1!==e.elem.nodeType||!me.cssHooks[e.prop]&&null==e.elem.style[z(e.prop)]?e.elem[e.prop]=e.now:me.style(e.elem,e.prop,e.now+e.unit)}}},H.propHooks.scrollTop=H.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},me.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},me.fx=H.prototype.init,me.fx.step={};var gt,vt,yt=/^(?:toggle|show|hide)$/,xt=/queueHooks$/;me.Animation=me.extend(W,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return g(n.elem,e,Ue.exec(t),n),n}]},tweener:function(e,t){pe(e)?(t=e,e=["*"]):e=e.match(Ee);for(var n,r=0,i=e.length;r1)},removeAttr:function(e){return this.each((function(){me.removeAttr(this,e)}))}}),me.extend({attr:function(e,t,n){var r,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===e.getAttribute?me.prop(e,t,n):(1===a&&me.isXMLDoc(e)||(i=me.attrHooks[t.toLowerCase()]||(me.expr.match.bool.test(t)?bt:void 0)),void 0!==n?null===n?void me.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=me.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!he.radioValue&&"radio"===t&&a(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(Ee);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),bt={set:function(e,t,n){return 0==t?me.removeAttr(e,n):e.setAttribute(n,n),n}},me.each(me.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=wt[t]||me.find.attr;wt[t]=function(e,t,r){var i,a,o=t.toLowerCase();return r||(a=wt[o],wt[o]=i,i=null!=n(e,t,r)?o:null,wt[o]=a),i}}));var _t=/^(?:input|select|textarea|button)$/i,Mt=/^(?:a|area)$/i;me.fn.extend({prop:function(e,t){return Ce(this,me.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[me.propFix[e]||e]}))}}),me.extend({prop:function(e,t,n){var r,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&me.isXMLDoc(e)||(t=me.propFix[t]||t,i=me.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=me.find.attr(e,"tabindex");return t?parseInt(t,10):_t.test(e.nodeName)||Mt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),he.optSelected||(me.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),me.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){me.propFix[this.toLowerCase()]=this})),me.fn.extend({addClass:function(e){var t,n,r,i,a,o,s,c=0;if(pe(e))return this.each((function(t){me(this).addClass(e.call(this,t,X(this)))}));if((t=Y(e)).length)for(;n=this[c++];)if(i=X(n),r=1===n.nodeType&&" "+q(i)+" "){for(o=0;a=t[o++];)r.indexOf(" "+a+" ")<0&&(r+=a+" ");i!==(s=q(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,a,o,s,c=0;if(pe(e))return this.each((function(t){me(this).removeClass(e.call(this,t,X(this)))}));if(!arguments.length)return this.attr("class","");if((t=Y(e)).length)for(;n=this[c++];)if(i=X(n),r=1===n.nodeType&&" "+q(i)+" "){for(o=0;a=t[o++];)for(;r.indexOf(" "+a+" ")>-1;)r=r.replace(" "+a+" "," ");i!==(s=q(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):pe(e)?this.each((function(n){me(this).toggleClass(e.call(this,n,X(this),t),t)})):this.each((function(){var t,i,a,o;if(r)for(i=0,a=me(this),o=Y(e);t=o[i++];)a.hasClass(t)?a.removeClass(t):a.addClass(t);else void 0!==e&&"boolean"!==n||((t=X(this))&&Ne.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||0==e?"":Ne.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+q(X(n))+" ").indexOf(t)>-1)return 1;return 0}});var St=/\r/g;me.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=pe(e),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,me(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=me.map(i,(function(e){return null==e?"":e+""}))),(t=me.valHooks[this.type]||me.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=me.valHooks[i.type]||me.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(St,""):null==n?"":n:void 0}}),me.extend({valHooks:{option:{get:function(e){var t=me.find.attr(e,"value");return null!=t?t:q(me.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,s="select-one"===e.type,c=s?null:[],l=s?o+1:i.length;for(r=o<0?l:s?o:0;r-1)&&(n=1);return n||(e.selectedIndex=-1),a}}}}),me.each(["radio","checkbox"],(function(){me.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=me.inArray(me(e).val(),t)>-1}},he.checkOn||(me.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),he.focusin="onfocusin"in e;var Tt=/^(?:focusinfocus|focusoutblur)$/,Et=function(e){e.stopPropagation()};me.extend(me.event,{trigger:function(t,n,r,i){var a,o,s,c,l,u,h,p,d=[r||ee],f=ce.call(t,"type")?t.type:t,m=ce.call(t,"namespace")?t.namespace.split("."):[];if(o=p=s=r=r||ee,3!==r.nodeType&&8!==r.nodeType&&!Tt.test(f+me.event.triggered)&&(f.indexOf(".")>-1&&(m=f.split("."),f=m.shift(),m.sort()),l=f.indexOf(":")<0&&"on"+f,(t=t[me.expando]?t:new me.Event(f,"object"==typeof t&&t)).isTrigger=i?2:3,t.namespace=m.join("."),t.rnamespace=t.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:me.makeArray(n,[t]),h=me.event.special[f]||{},i||!h.trigger||0!=h.trigger.apply(r,n))){if(!i&&!h.noBubble&&!de(r)){for(c=h.delegateType||f,Tt.test(c+f)||(o=o.parentNode);o;o=o.parentNode)d.push(o),s=o;s===(r.ownerDocument||ee)&&d.push(s.defaultView||s.parentWindow||e)}for(a=0;(o=d[a++])&&!t.isPropagationStopped();)p=o,t.type=a>1?c:h.bindType||f,(u=(Ne.get(o,"events")||{})[t.type]&&Ne.get(o,"handle"))&&u.apply(o,n),(u=l&&o[l])&&u.apply&&Oe(o)&&(t.result=u.apply(o,n),0==t.result&&t.preventDefault());return t.type=f,i||t.isDefaultPrevented()||h._default&&0!=h._default.apply(d.pop(),n)||!Oe(r)||l&&pe(r[f])&&!de(r)&&((s=r[l])&&(r[l]=null),me.event.triggered=f,t.isPropagationStopped()&&p.addEventListener(f,Et),r[f](),t.isPropagationStopped()&&p.removeEventListener(f,Et),me.event.triggered=void 0,s&&(r[l]=s)),t.result}},simulate:function(e,t,n){var r=me.extend(new me.Event,n,{type:e,isSimulated:1});me.event.trigger(r,null,t)}}),me.fn.extend({trigger:function(e,t){return this.each((function(){me.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return me.event.trigger(e,t,n,1)}}),he.focusin||me.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){me.event.simulate(t,e.target,me.event.fix(e))};me.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=Ne.access(r,t);i||r.addEventListener(e,n,1),Ne.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=Ne.access(r,t)-1;i?Ne.access(r,t,i):(r.removeEventListener(e,n,1),Ne.remove(r,t))}}}));var At=e.location,Lt=Date.now(),Ct=/\?/;me.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||me.error("Invalid XML: "+t),n};var Rt=/\[\]$/,Pt=/\r?\n/g,Ot=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;me.param=function(e,t){var n,r=[],i=function(e,t){var n=pe(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!me.isPlainObject(e))me.each(e,(function(){i(this.name,this.value)}));else for(n in e)Z(n,e[n],t,i);return r.join("&")},me.fn.extend({serialize:function(){return me.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=me.prop(this,"elements");return e?me.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!me(this).is(":disabled")&&Nt.test(this.nodeName)&&!Ot.test(e)&&(this.checked||!qe.test(e))})).map((function(e,t){var n=me(this).val();return null==n?null:Array.isArray(n)?me.map(n,(function(e){return{name:t.name,value:e.replace(Pt,"\r\n")}})):{name:t.name,value:n.replace(Pt,"\r\n")}})).get()}});var Dt=/%20/g,It=/#.*$/,zt=/([?&])_=[^&]*/,Bt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ut=/^(?:GET|HEAD)$/,Ft=/^\/\//,Ht={},kt={},Gt=ee.createElement("a");Gt.href=At.href,me.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:At.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(At.protocol),global:1,processData:1,async:1,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":1,"text json":JSON.parse,"text xml":me.parseXML},flatOptions:{url:1,context:1}},ajaxSetup:function(e,t){return t?Q(Q(e,me.ajaxSettings),t):Q(me.ajaxSettings,e)},ajaxPrefilter:J(Ht),ajaxTransport:J(kt),ajax:function(t,n){function r(t,n,r,s){var l,p,d,b,w,_=n;u||(u=1,c&&e.clearTimeout(c),i=void 0,o=s||"",M.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=function(e,t,n){for(var r,i,a,o,s=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){c.unshift(i);break}if(c[0]in n)a=c[0];else{for(i in n){if(!c[0]||e.converters[i+" "+c[0]]){a=i;break}o||(o=i)}a=a||o}if(a)return a!==c[0]&&c.unshift(a),n[a]}(f,M,r)),b=function(e,t,n,r){var i,a,o,s,c,l={},u=e.dataTypes.slice();if(u[1])for(o in e.converters)l[o.toLowerCase()]=e.converters[o];for(a=u.shift();a;)if(e.responseFields[a]&&(n[e.responseFields[a]]=t),!c&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=a,a=u.shift())if("*"===a)a=c;else if("*"!==c&&c!==a){if(!(o=l[c+" "+a]||l["* "+a]))for(i in l)if((s=i.split(" "))[1]===a&&(o=l[c+" "+s[0]]||l["* "+s[0]])){1==o?o=l[i]:1!=l[i]&&(a=s[0],u.unshift(s[1]));break}if(1!=o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+c+" to "+a}}}return{state:"success",data:t}}(f,b,M,l),l?(f.ifModified&&((w=M.getResponseHeader("Last-Modified"))&&(me.lastModified[a]=w),(w=M.getResponseHeader("etag"))&&(me.etag[a]=w)),204===t||"HEAD"===f.type?_="nocontent":304===t?_="notmodified":(_=b.state,p=b.data,l=!(d=b.error))):(d=_,!t&&_||(_="error",t<0&&(t=0))),M.status=t,M.statusText=(n||_)+"",l?v.resolveWith(m,[p,_,M]):v.rejectWith(m,[M,_,d]),M.statusCode(x),x=void 0,h&&g.trigger(l?"ajaxSuccess":"ajaxError",[M,f,l?p:d]),y.fireWith(m,[M,_]),h&&(g.trigger("ajaxComplete",[M,f]),--me.active||me.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,a,o,s,c,l,u,h,p,d,f=me.ajaxSetup({},n),m=f.context||f,g=f.context&&(m.nodeType||m.jquery)?me(m):me.event,v=me.Deferred(),y=me.Callbacks("once memory"),x=f.statusCode||{},b={},w={},_="canceled",M={readyState:0,getResponseHeader:function(e){var t;if(u){if(!s)for(s={};t=Bt.exec(o);)s[t[1].toLowerCase()+" "]=(s[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=s[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(e,t){return null==u&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==u&&(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)M.always(e[M.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||_;return i&&i.abort(t),r(0,t),this}};if(v.promise(M),f.url=((t||f.url||At.href)+"").replace(Ft,At.protocol+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(Ee)||[""],null==f.crossDomain){l=ee.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Gt.protocol+"//"+Gt.host!=l.protocol+"//"+l.host}catch(e){f.crossDomain=1}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=me.param(f.data,f.traditional)),$(Ht,f,n,M),u)return M;for(p in(h=me.event&&f.global)&&0==me.active++&&me.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Ut.test(f.type),a=f.url.replace(It,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(Dt,"+")):(d=f.url.slice(a.length),f.data&&(f.processData||"string"==typeof f.data)&&(a+=(Ct.test(a)?"&":"?")+f.data,delete f.data),0==f.cache&&(a=a.replace(zt,"$1"),d=(Ct.test(a)?"&":"?")+"_="+Lt+++d),f.url=a+d),f.ifModified&&(me.lastModified[a]&&M.setRequestHeader("If-Modified-Since",me.lastModified[a]),me.etag[a]&&M.setRequestHeader("If-None-Match",me.etag[a])),(f.data&&f.hasContent&&0!=f.contentType||n.contentType)&&M.setRequestHeader("Content-Type",f.contentType),M.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", */*; q=0.01":""):f.accepts["*"]),f.headers)M.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(0==f.beforeSend.call(m,M,f)||u))return M.abort();if(_="abort",y.add(f.complete),M.done(f.success),M.fail(f.error),i=$(kt,f,n,M)){if(M.readyState=1,h&&g.trigger("ajaxSend",[M,f]),u)return M;f.async&&f.timeout>0&&(c=e.setTimeout((function(){M.abort("timeout")}),f.timeout));try{u=0,i.send(b,r)}catch(e){if(u)throw e;r(-1,e)}}else r(-1,"No Transport");return M},getJSON:function(e,t,n){return me.get(e,t,n,"json")},getScript:function(e,t){return me.get(e,void 0,t,"script")}}),me.each(["get","post"],(function(e,t){me[t]=function(e,n,r,i){return pe(n)&&(i=i||r,r=n,n=void 0),me.ajax(me.extend({url:e,type:t,dataType:i,data:n,success:r},me.isPlainObject(e)&&e))}})),me._evalUrl=function(e,t){return me.ajax({url:e,type:"GET",dataType:"script",cache:1,async:0,global:0,converters:{"text script":function(){}},dataFilter:function(e){me.globalEval(e,t)}})},me.fn.extend({wrapAll:function(e){var t;return this[0]&&(pe(e)&&(e=e.call(this[0])),t=me(e,this[0].ownerDocument).eq(0).clone(1),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return pe(e)?this.each((function(t){me(this).wrapInner(e.call(this,t))})):this.each((function(){var t=me(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=pe(e);return this.each((function(n){me(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){me(this).replaceWith(this.childNodes)})),this}}),me.expr.pseudos.hidden=function(e){return!me.expr.pseudos.visible(e)},me.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},me.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var jt={0:200,1223:204},Vt=me.ajaxSettings.xhr();he.cors=!!Vt&&"withCredentials"in Vt,he.ajax=Vt=!!Vt,me.ajaxTransport((function(t){var n,r;if(he.cors||Vt&&!t.crossDomain)return{send:function(i,a){var o,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)s[o]=t.xhrFields[o];for(o in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(o,i[o]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?a(0,"error"):a(s.status,s.statusText):a(jt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout((function(){n&&r()}))},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}})),me.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=0)})),me.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return me.globalEval(e),e}}}),me.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=0),e.crossDomain&&(e.type="GET")})),me.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=me("