!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function a(t){this.options=Object.assign({},{container:document.getElementById("container"),masternodeTotalCount:4e3,pointSize:1.1,imgDir:"assets/",url:"assets/mn_locations.tsv"},t||{}),this.globeData=[],this.globe=null,this.init()}Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),s=r(o),l=n(179),c=r(l),u=n(184),h=i(u),d=n(185),f=i(d);window.DashGlobe=a,a.Detector=h["default"],a.prototype.init=function(){var t=this;this.globe=new f["default"](this.options.container,{imgDir:this.options.imgDir,pointSize:this.options.pointSize,cameraOffset:this.options.cameraOffset,initialZoom:this.options.initialZoom,colorFn:function(e){return new s.Color(t.options.barColor||4294967295)}}),this.fetchData(function(){for(var e=0;e=0){var u=a[l];if(void 0!==u){var h=re.FLOAT,d=u.array,f=u.normalized;d instanceof Float32Array?h=re.FLOAT:d instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):d instanceof Uint16Array?h=re.UNSIGNED_SHORT:d instanceof Int16Array?h=re.SHORT:d instanceof Uint32Array?h=re.UNSIGNED_INT:d instanceof Int32Array?h=re.INT:d instanceof Int8Array?h=re.BYTE:d instanceof Uint8Array&&(h=re.UNSIGNED_BYTE);var p=u.itemSize,m=de.getAttributeBuffer(u);if(u&&u.isInterleavedBufferAttribute){var v=u.data,g=v.stride,x=u.offset;v&&v.isInstancedInterleavedBuffer?(ce.enableAttributeAndDivisor(c,v.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=v.meshPerAttribute*v.count)):ce.enableAttribute(c),re.bindBuffer(re.ARRAY_BUFFER,m),re.vertexAttribPointer(c,p,h,f,g*v.array.BYTES_PER_ELEMENT,(i*g+x)*v.array.BYTES_PER_ELEMENT)}else u&&u.isInstancedBufferAttribute?(ce.enableAttributeAndDivisor(c,u.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=u.meshPerAttribute*u.count)):ce.enableAttribute(c),re.bindBuffer(re.ARRAY_BUFFER,m),re.vertexAttribPointer(c,p,h,f,0,i*p*u.array.BYTES_PER_ELEMENT)}else if(void 0!==s){var _=s[l];if(void 0!==_)switch(_.length){case 2:re.vertexAttrib2fv(c,_);break;case 3:re.vertexAttrib3fv(c,_);break;case 4:re.vertexAttrib4fv(c,_);break;default:re.vertexAttrib1fv(c,_)}}}}ce.disableUnusedAttributes()}function k(t,e){return Math.abs(e[0])-Math.abs(t[0])}function H(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function j(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function W(t,e,n,i,r){var a,o;n.transparent?(a=St,o=++Tt):(a=wt,o=++Et);var s=a[o];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=ee.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:n,z:ee.z,group:r},a.push(s))}function X(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),$t.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),Y($t)}function q(t){return $t.center.set(0,0,0),$t.radius=.7071067811865476,$t.applyMatrix4(t.matrixWorld),Y($t)}function Y(t){if(!Zt.intersectsSphere(t))return!1;var e=Qt.numPlanes;if(0===e)return!0;var n=Rt.clippingPlanes,i=t.center,r=-t.radius,a=0;do if(n[a].distanceToPoint(i)=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var f=0;f=0&&t.numSupportedMorphNormals++}var p=i.__webglShader.uniforms;!t.isShaderMaterial&&!t.isRawShaderMaterial|t.clipping===!0&&(i.numClippingPlanes=Qt.numPlanes,p.clippingPlanes=Qt.uniform),i.fog=e,i.lightsHash=ne.hash,t.lights&&(p.ambientLightColor.value=ne.ambient,p.directionalLights.value=ne.directional,p.spotLights.value=ne.spot,p.pointLights.value=ne.point,p.hemisphereLights.value=ne.hemi,p.directionalShadowMap.value=ne.directionalShadowMap,p.directionalShadowMatrix.value=ne.directionalShadowMatrix,p.spotShadowMap.value=ne.spotShadowMap,p.spotShadowMatrix.value=ne.spotShadowMatrix,p.pointShadowMap.value=ne.pointShadowMap,p.pointShadowMatrix.value=ne.pointShadowMatrix);var m=i.program.getUniforms(),v=o.WebGLUniforms.seqWithValue(m.seq,p);i.uniformsList=v,i.dynamicUniforms=o.WebGLUniforms.splitDynamic(v,p)}function K(t){t.side===r.DoubleSide?ce.disable(re.CULL_FACE):ce.enable(re.CULL_FACE),ce.setFlipSided(t.side===r.BackSide),t.transparent===!0?ce.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):ce.setBlending(r.NoBlending),ce.setDepthFunc(t.depthFunc),ce.setDepthTest(t.depthTest),ce.setDepthWrite(t.depthWrite),ce.setColorWrite(t.colorWrite),ce.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function $(t,e,n,i){Gt=0;var r=ue.get(n);if(Jt&&(Kt||t!==It)){var a=t===It&&n.id===Nt;Qt.setState(n.clippingPlanes,n.clipShadows,t,r,a)}n.needsUpdate===!1&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==ne.hash?n.needsUpdate=!0:void 0!==r.numClippingPlanes&&r.numClippingPlanes!==Qt.numPlanes&&(n.needsUpdate=!0)),n.needsUpdate&&(J(n,e,i),n.needsUpdate=!1);var s=!1,l=!1,c=!1,u=r.program,h=u.getUniforms(),d=r.__webglShader.uniforms;if(u.id!==Ct&&(re.useProgram(u.program),Ct=u.id,s=!0,l=!0,c=!0),n.id!==Nt&&(Nt=n.id,l=!0),s||t!==It){if(h.set(re,t,"projectionMatrix"),le.logarithmicDepthBuffer&&h.setValue(re,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==It&&(It=t,l=!0,c=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=h.map.cameraPosition;void 0!==f&&f.setValue(re,ee.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&h.setValue(re,"viewMatrix",t.matrixWorldInverse),h.set(re,Rt,"toneMappingExposure"),h.set(re,Rt,"toneMappingWhitePoint")}if(n.skinning){h.setOptional(re,i,"bindMatrix"),h.setOptional(re,i,"bindMatrixInverse");var p=i.skeleton;p&&(le.floatVertexTextures&&p.useVertexTexture?(h.set(re,p,"boneTexture"),h.set(re,p,"boneTextureWidth"),h.set(re,p,"boneTextureHeight")):h.setOptional(re,p,"boneMatrices"))}l&&(n.lights&&ct(d,c),e&&n.fog&&rt(d,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshDepthMaterial)&&tt(d,n),n.isLineBasicMaterial?et(d,n):n.isLineDashedMaterial?(et(d,n),nt(d,n)):n.isPointsMaterial?it(d,n):n.isMeshLambertMaterial?at(d,n):n.isMeshPhongMaterial?ot(d,n):n.isMeshPhysicalMaterial?lt(d,n):n.isMeshStandardMaterial?st(d,n):n.isMeshDepthMaterial?n.displacementMap&&(d.displacementMap.value=n.displacementMap,d.displacementScale.value=n.displacementScale,d.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&(d.opacity.value=n.opacity),o.WebGLUniforms.upload(re,r.uniformsList,d,Rt)),h.set(re,i,"modelViewMatrix"),h.set(re,i,"normalMatrix"),h.setValue(re,"modelMatrix",i.matrixWorld);var m=r.dynamicUniforms;return null!==m&&(o.WebGLUniforms.evalDynamic(m,d,i,t),o.WebGLUniforms.upload(re,m,d,Rt)),u}function tt(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;t.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function et(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function nt(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function it(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*Wt,t.scale.value=.5*pt.clientHeight,t.map.value=e.map,null!==e.map){var n=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}function rt(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function at(t,e){e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function ot(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function st(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function lt(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,st(t,e)}function ct(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function ut(t){for(var e=0,n=0,i=t.length;n=le.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+le.maxTextures),Gt+=1,t}function ft(t){var e;if(t===r.RepeatWrapping)return re.REPEAT;if(t===r.ClampToEdgeWrapping)return re.CLAMP_TO_EDGE;if(t===r.MirroredRepeatWrapping)return re.MIRRORED_REPEAT;if(t===r.NearestFilter)return re.NEAREST;if(t===r.NearestMipMapNearestFilter)return re.NEAREST_MIPMAP_NEAREST;if(t===r.NearestMipMapLinearFilter)return re.NEAREST_MIPMAP_LINEAR;if(t===r.LinearFilter)return re.LINEAR;if(t===r.LinearMipMapNearestFilter)return re.LINEAR_MIPMAP_NEAREST;if(t===r.LinearMipMapLinearFilter)return re.LINEAR_MIPMAP_LINEAR;if(t===r.UnsignedByteType)return re.UNSIGNED_BYTE;if(t===r.UnsignedShort4444Type)return re.UNSIGNED_SHORT_4_4_4_4;if(t===r.UnsignedShort5551Type)return re.UNSIGNED_SHORT_5_5_5_1;if(t===r.UnsignedShort565Type)return re.UNSIGNED_SHORT_5_6_5;if(t===r.ByteType)return re.BYTE;if(t===r.ShortType)return re.SHORT;if(t===r.UnsignedShortType)return re.UNSIGNED_SHORT;if(t===r.IntType)return re.INT;if(t===r.UnsignedIntType)return re.UNSIGNED_INT;if(t===r.FloatType)return re.FLOAT;if(e=se.get("OES_texture_half_float"),null!==e&&t===r.HalfFloatType)return e.HALF_FLOAT_OES;if(t===r.AlphaFormat)return re.ALPHA;if(t===r.RGBFormat)return re.RGB;if(t===r.RGBAFormat)return re.RGBA;if(t===r.LuminanceFormat)return re.LUMINANCE;if(t===r.LuminanceAlphaFormat)return re.LUMINANCE_ALPHA;if(t===r.DepthFormat)return re.DEPTH_COMPONENT;if(t===r.DepthStencilFormat)return re.DEPTH_STENCIL;if(t===r.AddEquation)return re.FUNC_ADD;if(t===r.SubtractEquation)return re.FUNC_SUBTRACT;if(t===r.ReverseSubtractEquation)return re.FUNC_REVERSE_SUBTRACT;if(t===r.ZeroFactor)return re.ZERO;if(t===r.OneFactor)return re.ONE;if(t===r.SrcColorFactor)return re.SRC_COLOR;if(t===r.OneMinusSrcColorFactor)return re.ONE_MINUS_SRC_COLOR;if(t===r.SrcAlphaFactor)return re.SRC_ALPHA;if(t===r.OneMinusSrcAlphaFactor)return re.ONE_MINUS_SRC_ALPHA;if(t===r.DstAlphaFactor)return re.DST_ALPHA;if(t===r.OneMinusDstAlphaFactor)return re.ONE_MINUS_DST_ALPHA;if(t===r.DstColorFactor)return re.DST_COLOR;if(t===r.OneMinusDstColorFactor)return re.ONE_MINUS_DST_COLOR;if(t===r.SrcAlphaSaturateFactor)return re.SRC_ALPHA_SATURATE;if(e=se.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===r.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===r.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===r.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===r.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=se.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===r.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===r.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===r.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===r.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=se.get("WEBGL_compressed_texture_etc1"),null!==e&&t===r.RGB_ETC1_Format)return e.COMPRESSED_RGB_ETC1_WEBGL;if(e=se.get("EXT_blend_minmax"),null!==e){if(t===r.MinEquation)return e.MIN_EXT;if(t===r.MaxEquation)return e.MAX_EXT}return e=se.get("WEBGL_depth_texture"),null!==e&&t===r.UnsignedInt248Type?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",r.REVISION),t=t||{};var pt=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),mt=void 0!==t.context?t.context:null,vt=void 0!==t.alpha&&t.alpha,gt=void 0===t.depth||t.depth,xt=void 0===t.stencil||t.stencil,_t=void 0!==t.antialias&&t.antialias,yt=void 0===t.premultipliedAlpha||t.premultipliedAlpha,Mt=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,bt=[],wt=[],Et=-1,St=[],Tt=-1,Lt=new Float32Array(8),At=[],Pt=[];this.domElement=pt,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=r.LinearToneMapping,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var Rt=this,Ct=null,Dt=null,Ut=null,Nt=-1,Ft="",It=null,Ot=new N.Vector4,Bt=null,Vt=new N.Vector4,Gt=0,zt=new F.Color(0),kt=0,Ht=pt.width,jt=pt.height,Wt=1,Xt=new N.Vector4(0,0,Ht,jt),qt=!1,Yt=new N.Vector4(0,0,Ht,jt),Zt=new U.Frustum,Qt=new D.WebGLClipping,Jt=!1,Kt=!1,$t=new C.Sphere,te=new a.Matrix4,ee=new R.Vector3,ne={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},ie={calls:0,vertices:0,faces:0,points:0};this.info={render:ie,memory:{geometries:0,textures:0},programs:null};var re;try{var ae={alpha:vt,depth:gt,stencil:xt,antialias:_t,premultipliedAlpha:yt,preserveDrawingBuffer:Mt};if(re=mt||pt.getContext("webgl",ae)||pt.getContext("experimental-webgl",ae),null===re)throw null!==pt.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===re.getShaderPrecisionFormat&&(re.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),pt.addEventListener("webglcontextlost",O,!1)}catch(oe){console.error("THREE.WebGLRenderer: "+oe)}var se=new P.WebGLExtensions(re);se.get("WEBGL_depth_texture"),se.get("OES_texture_float"),se.get("OES_texture_float_linear"),se.get("OES_texture_half_float"),se.get("OES_texture_half_float_linear"),se.get("OES_standard_derivatives"),se.get("ANGLE_instanced_arrays"),se.get("OES_element_index_uint")&&(A.BufferGeometry.MaxIndex=4294967296);var le=new L.WebGLCapabilities(re,se,t),ce=new T.WebGLState(re,se,ft),ue=new S.WebGLProperties,he=new E.WebGLTextures(re,se,ce,ue,le,ft,this.info),de=new w.WebGLObjects(re,ue,this.info),fe=new b.WebGLPrograms(this,le),pe=new M.WebGLLights;this.info.programs=fe.programs;var me=new y.WebGLBufferRenderer(re,se,ie),ve=new _.WebGLIndexedBufferRenderer(re,se,ie),ge=new x.OrthographicCamera((-1),1,1,(-1),0,1),xe=new g.PerspectiveCamera,_e=new p.Mesh(new v.PlaneBufferGeometry(2,2),new m.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1})),ye=l.ShaderLib.cube,Me=new p.Mesh(new f.BoxBufferGeometry(5,5,5),new d.ShaderMaterial({uniforms:ye.uniforms,vertexShader:ye.vertexShader,fragmentShader:ye.fragmentShader,side:r.BackSide,depthTest:!1,depthWrite:!1,fog:!1}));i(),this.context=re,this.capabilities=le,this.extensions=se,this.properties=ue,this.state=ce;var be=new h.WebGLShadowMap(this,ne,de,le);this.shadowMap=be;var we=new u.SpritePlugin(this,At),Ee=new c.LensFlarePlugin(this,Pt);this.getContext=function(){return re},this.getContextAttributes=function(){return re.getContextAttributes()},this.forceContextLoss=function(){se.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return le.getMaxAnisotropy()},this.getPrecision=function(){return le.precision},this.getPixelRatio=function(){return Wt},this.setPixelRatio=function(t){void 0!==t&&(Wt=t,this.setSize(Yt.z,Yt.w,!1))},this.getSize=function(){return{width:Ht,height:jt}},this.setSize=function(t,e,n){Ht=t,jt=e,pt.width=t*Wt,pt.height=e*Wt,n!==!1&&(pt.style.width=t+"px",pt.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,i){ce.viewport(Yt.set(t,e,n,i))},this.setScissor=function(t,e,n,i){ce.scissor(Xt.set(t,e,n,i))},this.setScissorTest=function(t){ce.setScissorTest(qt=t)},this.getClearColor=function(){return zt},this.setClearColor=function(t,e){zt.set(t),kt=void 0!==e?e:1,n(zt.r,zt.g,zt.b,kt)},this.getClearAlpha=function(){return kt},this.setClearAlpha=function(t){kt=t,n(zt.r,zt.g,zt.b,kt)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=re.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=re.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=re.STENCIL_BUFFER_BIT),re.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},this.resetGLState=I,this.dispose=function(){St=[],Tt=-1,wt=[],Et=-1,pt.removeEventListener("webglcontextlost",O,!1)},this.renderBufferImmediate=function(t,e,n){ce.initAttributes();var i=ue.get(t);t.hasPositions&&!i.position&&(i.position=re.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=re.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=re.createBuffer()),t.hasColors&&!i.color&&(i.color=re.createBuffer());var a=e.getAttributes();if(t.hasPositions&&(re.bindBuffer(re.ARRAY_BUFFER,i.position),re.bufferData(re.ARRAY_BUFFER,t.positionArray,re.DYNAMIC_DRAW),ce.enableAttribute(a.position),re.vertexAttribPointer(a.position,3,re.FLOAT,!1,0,0)),t.hasNormals){if(re.bindBuffer(re.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&n.shading===r.FlatShading)for(var o=0,s=3*t.count;o8&&(d.length=8);for(var v=i.morphAttributes,f=0,p=d.length;f0&&_.renderInstances(i,T,A):_.render(T,A)},this.render=function(t,e,i,a){if((e&&e.isCamera)===!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=t.fog;Ft="",Nt=-1,It=null,t.autoUpdate===!0&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),te.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Zt.setFromMatrix(te),bt.length=0,Et=-1,Tt=-1,At.length=0,Pt.length=0,Kt=this.localClippingEnabled,Jt=Qt.init(this.clippingPlanes,Kt,e),Z(t,e),wt.length=Et+1,St.length=Tt+1,Rt.sortObjects===!0&&(wt.sort(H),St.sort(j)),Jt&&Qt.beginShadows(),ut(bt),be.render(t,e),ht(bt,e),Jt&&Qt.endShadows(),ie.calls=0,ie.vertices=0,ie.faces=0,ie.points=0,void 0===i&&(i=null),this.setRenderTarget(i);var s=t.background;if(null===s?n(zt.r,zt.g,zt.b,kt):s&&s.isColor&&(n(s.r,s.g,s.b,1),a=!0),(this.autoClear||a)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),s&&s.isCubeTexture?(xe.projectionMatrix.copy(e.projectionMatrix),xe.matrixWorld.extractRotation(e.matrixWorld),xe.matrixWorldInverse.getInverse(xe.matrixWorld),Me.material.uniforms.tCube.value=s,Me.modelViewMatrix.multiplyMatrices(xe.matrixWorldInverse,Me.matrixWorld),de.update(Me),Rt.renderBufferDirect(xe,null,Me.geometry,Me.material,Me,null)):s&&s.isTexture&&(_e.material.map=s,de.update(_e),Rt.renderBufferDirect(ge,null,_e.geometry,_e.material,_e,null)),t.overrideMaterial){var l=t.overrideMaterial;Q(wt,e,o,l),Q(St,e,o,l)}else ce.setBlending(r.NoBlending), Q(wt,e,o),Q(St,e,o);we.render(t,e),Ee.render(t,e,Vt),i&&he.updateRenderTargetMipmap(i),ce.setDepthTest(!0),ce.setDepthWrite(!0),ce.setColorWrite(!0)},this.setFaceCulling=function(t,e){ce.setCullFace(t),ce.setFlipSided(e===r.FrontFaceDirectionCW)},this.allocTextureUnit=dt,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),he.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),he.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?he.setTextureCube(e,n):he.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return Dt},this.setRenderTarget=function(t){Dt=t,t&&void 0===ue.get(t).__webglFramebuffer&&he.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var i=ue.get(t);e=n?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,Ot.copy(t.scissor),Bt=t.scissorTest,Vt.copy(t.viewport)}else e=null,Ot.copy(Xt).multiplyScalar(Wt),Bt=qt,Vt.copy(Yt).multiplyScalar(Wt);if(Ut!==e&&(re.bindFramebuffer(re.FRAMEBUFFER,e),Ut=e),ce.scissor(Ot),ce.setScissorTest(Bt),ce.viewport(Vt),n){var r=ue.get(t.texture);re.framebufferTexture2D(re.FRAMEBUFFER,re.COLOR_ATTACHMENT0,re.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,a,o){if((t&&t.isWebGLRenderTarget)===!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=ue.get(t).__webglFramebuffer;if(s){var l=!1;s!==Ut&&(re.bindFramebuffer(re.FRAMEBUFFER,s),l=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==r.RGBAFormat&&ft(u)!==re.getParameter(re.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===r.UnsignedByteType||ft(h)===re.getParameter(re.IMPLEMENTATION_COLOR_READ_TYPE)||h===r.FloatType&&(se.get("OES_texture_float")||se.get("WEBGL_color_buffer_float"))||h===r.HalfFloatType&&se.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");re.checkFramebufferStatus(re.FRAMEBUFFER)===re.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-a&&re.readPixels(e,n,i,a,ft(u),ft(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&re.bindFramebuffer(re.FRAMEBUFFER,Ut)}}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLRenderer=void 0;var r=n(3),a=n(4),o=n(8),s=n(13),l=n(14),c=n(124),u=n(126),h=n(127),d=n(129),f=n(137),p=n(146),m=n(150),v=n(151),g=n(152),x=n(154),_=n(155),y=n(156),M=n(157),b=n(158),w=n(161),E=n(163),S=n(164),T=n(165),L=n(166),A=n(138),P=n(167),R=n(6),C=n(133),D=n(168),U=n(132),N=n(122),F=n(123);e.WebGLRenderer=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=(e.REVISION="80",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=0,e.CullFaceBack=1,e.CullFaceFront=2,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=1,e.PCFSoftShadowMap=2,e.FrontSide=0,e.BackSide=1,e.DoubleSide=2,e.FlatShading=1,e.SmoothShading=2,e.NoColors=0,e.FaceColors=1,e.VertexColors=2,e.NoBlending=0,e.NormalBlending=1,e.AdditiveBlending=2,e.SubtractiveBlending=3,e.MultiplyBlending=4,e.CustomBlending=5,e.AddEquation=100,e.SubtractEquation=101,e.ReverseSubtractEquation=102,e.MinEquation=103,e.MaxEquation=104,e.ZeroFactor=200,e.OneFactor=201,e.SrcColorFactor=202,e.OneMinusSrcColorFactor=203,e.SrcAlphaFactor=204,e.OneMinusSrcAlphaFactor=205,e.DstAlphaFactor=206,e.OneMinusDstAlphaFactor=207,e.DstColorFactor=208,e.OneMinusDstColorFactor=209,e.SrcAlphaSaturateFactor=210,e.NeverDepth=0,e.AlwaysDepth=1,e.LessDepth=2,e.LessEqualDepth=3,e.EqualDepth=4,e.GreaterEqualDepth=5,e.GreaterDepth=6,e.NotEqualDepth=7,e.MultiplyOperation=0,e.MixOperation=1,e.AddOperation=2,e.NoToneMapping=0,e.LinearToneMapping=1,e.ReinhardToneMapping=2,e.Uncharted2ToneMapping=3,e.CineonToneMapping=4,e.UVMapping=300,e.CubeReflectionMapping=301,e.CubeRefractionMapping=302,e.EquirectangularReflectionMapping=303,e.EquirectangularRefractionMapping=304,e.SphericalReflectionMapping=305,e.CubeUVReflectionMapping=306,e.CubeUVRefractionMapping=307,e.RepeatWrapping=1e3,e.ClampToEdgeWrapping=1001,e.MirroredRepeatWrapping=1002,e.NearestFilter=1003,e.NearestMipMapNearestFilter=1004,e.NearestMipMapLinearFilter=1005,e.LinearFilter=1006,e.LinearMipMapNearestFilter=1007,e.LinearMipMapLinearFilter=1008,e.UnsignedByteType=1009,e.ByteType=1010,e.ShortType=1011,e.UnsignedShortType=1012,e.IntType=1013,e.UnsignedIntType=1014,e.FloatType=1015,e.HalfFloatType=1016,e.UnsignedShort4444Type=1017,e.UnsignedShort5551Type=1018,e.UnsignedShort565Type=1019,e.UnsignedInt248Type=1020,e.AlphaFormat=1021,e.RGBFormat=1022,e.RGBAFormat=1023);e.LuminanceFormat=1024,e.LuminanceAlphaFormat=1025,e.RGBEFormat=n,e.DepthFormat=1026,e.DepthStencilFormat=1027,e.RGB_S3TC_DXT1_Format=2001,e.RGBA_S3TC_DXT1_Format=2002,e.RGBA_S3TC_DXT3_Format=2003,e.RGBA_S3TC_DXT5_Format=2004,e.RGB_PVRTC_4BPPV1_Format=2100,e.RGB_PVRTC_2BPPV1_Format=2101,e.RGBA_PVRTC_4BPPV1_Format=2102,e.RGBA_PVRTC_2BPPV1_Format=2103,e.RGB_ETC1_Format=2151,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=2400,e.ZeroSlopeEnding=2401,e.WrapAroundEnding=2402,e.TrianglesDrawMode=0,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=3e3,e.sRGBEncoding=3001,e.GammaEncoding=3007,e.RGBEEncoding=3002,e.LogLuvEncoding=3003,e.RGBM7Encoding=3004,e.RGBM16Encoding=3005,e.RGBDEncoding=3006,e.BasicDepthPacking=3200,e.RGBADepthPacking=3201},function(t,e,n){"use strict";function i(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix4=void 0;var r=n(5),a=n(6);i.prototype={constructor:i,isMatrix4:!0,set:function(t,e,n,i,r,a,o,s,l,c,u,h,d,f,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=f,v[11]=p,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new i).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new a.Vector3);var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),s=1/t.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*s,n[9]=i[9]*s,n[10]=i[10]*s,this}}(),makeRotationFromEuler:function(t){(t&&t.isEuler)===!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var h=a*c,d=a*u,f=o*c,p=o*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=d+f*l,e[5]=h-p*l,e[9]=-o*s,e[2]=p-h*l,e[6]=f+d*l,e[10]=a*s}else if("YXZ"===t.order){var m=s*c,v=s*u,g=l*c,x=l*u;e[0]=m+x*o,e[4]=g*o-v,e[8]=a*l,e[1]=a*u,e[5]=a*c,e[9]=-o,e[2]=v*o-g,e[6]=x+m*o,e[10]=a*s}else if("ZXY"===t.order){var m=s*c,v=s*u,g=l*c,x=l*u;e[0]=m-x*o,e[4]=-a*u,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*c,e[9]=x-m*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var h=a*c,d=a*u,f=o*c,p=o*u;e[0]=s*c,e[4]=f*l-d,e[8]=h*l+p,e[1]=s*u,e[5]=p*l+h,e[9]=d*l-f,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var _=a*s,y=a*l,M=o*s,b=o*l;e[0]=s*c,e[4]=b-_*u,e[8]=M*u+y,e[1]=u,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=y*u+M,e[10]=_-b*u}else if("XZY"===t.order){var _=a*s,y=a*l,M=o*s,b=o*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=_*u+b,e[5]=a*c,e[9]=y*u-M,e[2]=M*u-y,e[6]=o*c,e[10]=b*u+_}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z,a=t.w,o=n+n,s=i+i,l=r+r,c=n*o,u=n*s,h=n*l,d=i*s,f=i*l,p=r*l,m=a*o,v=a*s,g=a*l;return e[0]=1-(d+p),e[4]=u-g,e[8]=h+v,e[1]=u+g,e[5]=1-(c+p),e[9]=f-m,e[2]=h-v,e[6]=f+m,e[10]=1-(c+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(i,r,o){void 0===t&&(t=new a.Vector3,e=new a.Vector3,n=new a.Vector3);var s=this.elements;return n.subVectors(i,r).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),s[0]=t.x,s[4]=e.x,s[8]=n.x,s[1]=t.y,s[5]=e.y,s[9]=n.y,s[2]=t.z,s[6]=e.z,s[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],f=n[2],p=n[6],m=n[10],v=n[14],g=n[3],x=n[7],_=n[11],y=n[15],M=i[0],b=i[4],w=i[8],E=i[12],S=i[1],T=i[5],L=i[9],A=i[13],P=i[2],R=i[6],C=i[10],D=i[14],U=i[3],N=i[7],F=i[11],I=i[15];return r[0]=a*M+o*S+s*P+l*U,r[4]=a*b+o*T+s*R+l*N,r[8]=a*w+o*L+s*C+l*F,r[12]=a*E+o*A+s*D+l*I,r[1]=c*M+u*S+h*P+d*U,r[5]=c*b+u*T+h*R+d*N,r[9]=c*w+u*L+h*C+d*F,r[13]=c*E+u*A+h*D+d*I,r[2]=f*M+p*S+m*P+v*U,r[6]=f*b+p*T+m*R+v*N,r[10]=f*w+p*L+m*C+v*F,r[14]=f*E+p*A+m*D+v*I,r[3]=g*M+x*S+_*P+y*U,r[7]=g*b+x*T+_*R+y*N,r[11]=g*w+x*L+_*C+y*F,r[15]=g*E+x*A+_*D+y*I,this},multiplyToArray:function(t,e,n){var i=this.elements;return this.multiplyMatrices(t,e),n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,n,i){void 0===t&&(t=new a.Vector3),void 0===n&&(n=0),void 0===i&&(i=e.length);for(var r=0,o=n;r>=4,n[r]=e[19===r?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*n.DEG2RAD},radToDeg:function(t){return t*n.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}},e._Math=n},function(t,e,n){"use strict";function i(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}Object.defineProperty(e,"__esModule",{value:!0}),e.Vector3=void 0;var r=n(5),a=n(4),o=n(7);i.prototype={constructor:i,isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return(e&&e.isEuler)===!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new o.Quaternion),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new o.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14],this},applyProjection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,s=t.w,l=s*e+a*i-o*n,c=s*n+o*e-r*i,u=s*i+r*n-a*e,h=-r*e-a*n-o*i;return this.x=l*s+h*-r+c*-o-u*-a,this.y=c*s+h*-a+u*-r-l*-o,this.z=u*s+h*-o+l*-a-c*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new a.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new i,e=new i),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new i),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new i),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(r._Math.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){if("number"==typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this}},e.Vector3=i},function(t,e,n){"use strict";function i(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}Object.defineProperty(e,"__esModule",{value:!0}),e.Quaternion=void 0;var r=n(6);i.prototype={constructor:i,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if((t&&t.isEuler)===!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),i=Math.cos(t._y/2),r=Math.cos(t._z/2),a=Math.sin(t._x/2),o=Math.sin(t._y/2),s=Math.sin(t._z/2),l=t.order;return"XYZ"===l?(this._x=a*i*r+n*o*s,this._y=n*o*r-a*i*s,this._z=n*i*s+a*o*r,this._w=n*i*r-a*o*s):"YXZ"===l?(this._x=a*i*r+n*o*s,this._y=n*o*r-a*i*s,this._z=n*i*s-a*o*r,this._w=n*i*r+a*o*s):"ZXY"===l?(this._x=a*i*r-n*o*s,this._y=n*o*r+a*i*s,this._z=n*i*s+a*o*r,this._w=n*i*r-a*o*s):"ZYX"===l?(this._x=a*i*r-n*o*s,this._y=n*o*r+a*i*s,this._z=n*i*s-a*o*r,this._w=n*i*r+a*o*s):"YZX"===l?(this._x=a*i*r+n*o*s,this._y=n*o*r+a*i*s,this._z=n*i*s-a*o*r,this._w=n*i*r-a*o*s):"XZY"===l&&(this._x=a*i*r-n*o*s,this._y=n*o*r-a*i*s,this._z=n*i*s+a*o*r,this._w=n*i*r+a*o*s),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],d=i+s+h;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-l)*e,this._y=(a-c)*e,this._z=(o-r)*e):i>s&&i>h?(e=2*Math.sqrt(1+i-s-h),this._w=(u-l)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+c)/e):s>h?(e=2*Math.sqrt(1+s-i-h),this._w=(a-c)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(l+u)/e):(e=2*Math.sqrt(1+h-i-s),this._w=(o-r)/e,this._x=(a+c)/e,this._y=(l+u)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,n=1e-6;return function(i,a){return void 0===t&&(t=new r.Vector3),e=i.dot(a)+1,eMath.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,a),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var l=Math.atan2(s,o),c=Math.sin((1-e)*l)/s,u=Math.sin(e*l)/s;return this._w=a*c+this._w*u,this._x=n*c+this._x*u,this._y=i*c+this._y*u,this._z=r*c+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(i,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3],h=r[a+0],d=r[a+1],f=r[a+2],p=r[a+3];if(u!==p||s!==h||l!==d||c!==f){var m=1-o,v=s*h+l*d+c*f+u*p,g=v>=0?1:-1,x=1-v*v;if(x>Number.EPSILON){var _=Math.sqrt(x),y=Math.atan2(_,v*g);m=Math.sin(m*y)/_,o=Math.sin(o*y)/_}var M=o*g;if(s=s*m+h*M,l=l*m+d*M,c=c*m+f*M,u=u*m+p*M,m===1-o){var b=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=b,l*=b,c*=b,u*=b}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}}),e.Quaternion=i},function(t,e,n){"use strict";function i(){this.seq=[],this.map={}}function r(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,a=z[r];if(void 0===a&&(a=new Float32Array(r),z[r]=a),0!==e){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function a(t,e){var n=k[e];void 0===n&&(n=new Int32Array(e),k[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function o(t,e){t.uniform1f(this.addr,e)}function s(t,e){t.uniform1i(this.addr,e)}function l(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function c(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function u(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w); }function h(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function d(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function f(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function p(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||V,i)}function m(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||G,i)}function v(t,e){t.uniform2iv(this.addr,e)}function g(t,e){t.uniform3iv(this.addr,e)}function x(t,e){t.uniform4iv(this.addr,e)}function _(t){switch(t){case 5126:return o;case 35664:return l;case 35665:return c;case 35666:return u;case 35674:return h;case 35675:return d;case 35676:return f;case 35678:return p;case 35680:return m;case 5124:case 35670:return s;case 35667:case 35671:return v;case 35668:case 35672:return g;case 35669:case 35673:return x}}function y(t,e){t.uniform1fv(this.addr,e)}function M(t,e){t.uniform1iv(this.addr,e)}function b(t,e){t.uniform2fv(this.addr,r(e,this.size,2))}function w(t,e){t.uniform3fv(this.addr,r(e,this.size,3))}function E(t,e){t.uniform4fv(this.addr,r(e,this.size,4))}function S(t,e){t.uniformMatrix2fv(this.addr,!1,r(e,this.size,4))}function T(t,e){t.uniformMatrix3fv(this.addr,!1,r(e,this.size,9))}function L(t,e){t.uniformMatrix4fv(this.addr,!1,r(e,this.size,16))}function A(t,e,n){var i=e.length,r=a(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||V,r[o])}function P(t,e,n){var i=e.length,r=a(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||G,r[o])}function R(t){switch(t){case 5126:return y;case 35664:return b;case 35665:return w;case 35666:return E;case 35674:return S;case 35675:return T;case 35676:return L;case 35678:return A;case 35680:return P;case 5124:case 35670:return M;case 35667:case 35671:return v;case 35668:case 35672:return g;case 35669:case 35673:return x}}function C(t,e,n){this.id=t,this.addr=n,this.setValue=_(e.type)}function D(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=R(e.type)}function U(t){this.id=t,i.call(this)}function N(t,e){t.seq.push(e),t.map[e.id]=e}function F(t,e,n){var i=t.name,r=i.length;for(H.lastIndex=0;;){var a=H.exec(i),o=H.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s=0|s),void 0===c||"["===c&&o+2===r){N(n,void 0===c?new C(s,t,e):new D(s,t,e));break}var u=n.map,h=u[s];void 0===h&&(h=new U(s),N(n,h)),n=h}}function I(t,e,n){i.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),a=0;a!==r;++a){var o=t.getActiveUniform(e,a),s=o.name,l=t.getUniformLocation(e,s);F(o,l,this)}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLUniforms=void 0;var O=n(9),B=n(10),V=new B.Texture,G=new O.CubeTexture,z=[],k=[];U.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var a=n[i];a.setValue(t,e[a.id])}};var H=/([\w\d_]+)(\])?(\[|\.)?/g;I.prototype.setValue=function(t,e,n){var i=this.map[e];void 0!==i&&i.setValue(t,n,this.renderer)},I.prototype.set=function(t,e,n){var i=this.map[n];void 0!==i&&i.setValue(t,e[n],this.renderer)},I.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},I.upload=function(t,e,n,i){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=n[o.id];s.needsUpdate!==!1&&o.setValue(t,s.value,i)}},I.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var a=t[i];a.id in e&&n.push(a)}return n},I.splitDynamic=function(t,e){for(var n=null,i=t.length,r=0,a=0;a!==i;++a){var o=t[a],s=e[o.id];s&&s.dynamic===!0?(null===n&&(n=[]),n.push(o)):(r2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=s._Math.generateUUID()),void 0===t.images[i.uuid]&&(t.images[i.uuid]={uuid:i.uuid,url:e(i)}),n.image=i.uuid}return t.textures[this.uuid]=n,n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===o.UVMapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case o.RepeatWrapping:t.x=t.x-Math.floor(t.x);break;case o.ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case o.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case o.RepeatWrapping:t.y=t.y-Math.floor(t.y);break;case o.ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case o.MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(i.prototype,a.EventDispatcher.prototype);var c=0;e.TextureIdCount=r,e.Texture=i},function(t,e){"use strict";function n(){}Object.defineProperty(e,"__esModule",{value:!0}),Object.assign(n.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&n[t].indexOf(e)!==-1},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,i=n[t];if(void 0!==i){var r=i.indexOf(e);r!==-1&&i.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var i=[],r=0,a=n.length;for(r=0;rx&&g>_?g_?x>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){if(e=a._Math.euclideanModulo(e,1),n=a._Math.clamp(n,0,1),i=a._Math.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(s,l,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=n[1],h=u.length;if(3===h)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=r[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i=t||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),l=Math.min(r,a,o),c=(l+s)/2;if(l===s)e=0,n=0;else{var u=s-l;switch(n=c<=.5?u/(s+l):u/(2-s-l),s){case r:e=(a-o)/u+(a.001&&D.scale>.001&&(E.x=D.x,E.y=D.y,E.z=D.z,b=D.size*D.scale/g.w,w.x=b*_,w.y=b,m.uniform3f(d.screenPosition,E.x,E.y,E.z),m.uniform2f(d.scale,w.x,w.y),m.uniform1f(d.rotation,D.rotation),m.uniform1f(d.opacity,D.opacity),m.uniform3f(d.color,D.color.r,D.color.g,D.color.b),v.setBlending(D.blending,D.blendEquation,D.blendSrc,D.blendDst),t.setTexture2D(D.texture,1),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0))}}}v.enable(m.CULL_FACE),v.enable(m.DEPTH_TEST),v.setDepthWrite(!0),t.resetGLState()}}}Object.defineProperty(e,"__esModule",{value:!0}),e.LensFlarePlugin=void 0;var r=n(125),a=n(12),o=n(6);e.LensFlarePlugin=i},function(t,e,n){"use strict";function i(t,e){this.min=void 0!==t?t:new r.Vector2((+(1/0)),(+(1/0))),this.max=void 0!==e?e:new r.Vector2((-(1/0)),(-(1/0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.Box2=void 0;var r=n(12);i.prototype={constructor:i,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){var n=e||new r.Vector2;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){var n=e||new r.Vector2;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r.Vector2;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},e.Box2=i},function(t,e,n){"use strict";function i(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);l=p.createBuffer(),c=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,l),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,c),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),u=i(),h={position:p.getAttribLocation(u,"position"),uv:p.getAttribLocation(u,"uv")},d={uvOffset:p.getUniformLocation(u,"uvOffset"),uvScale:p.getUniformLocation(u,"uvScale"),rotation:p.getUniformLocation(u,"rotation"),scale:p.getUniformLocation(u,"scale"),color:p.getUniformLocation(u,"color"),map:p.getUniformLocation(u,"map"),opacity:p.getUniformLocation(u,"opacity"),modelViewMatrix:p.getUniformLocation(u,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(u,"projectionMatrix"),fogType:p.getUniformLocation(u,"fogType"),fogDensity:p.getUniformLocation(u,"fogDensity"),fogNear:p.getUniformLocation(u,"fogNear"),fogFar:p.getUniformLocation(u,"fogFar"),fogColor:p.getUniformLocation(u,"fogColor"),alphaTest:p.getUniformLocation(u,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var a=n.getContext("2d");a.fillStyle="white",a.fillRect(0,0,8,8),f=new r.Texture(n),f.needsUpdate=!0}function i(){var e=p.createProgram(),n=p.createShader(p.VERTEX_SHADER),i=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),p.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),p.compileShader(n),p.compileShader(i),p.attachShader(e,n),p.attachShader(e,i),p.linkProgram(e),e}function s(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var l,c,u,h,d,f,p=t.context,m=t.state,v=new a.Vector3,g=new o.Quaternion,x=new a.Vector3;this.render=function(i,r){if(0!==e.length){void 0===u&&n(),p.useProgram(u),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(p.CULL_FACE),m.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,l),p.vertexAttribPointer(h.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,c),p.uniformMatrix4fv(d.projectionMatrix,!1,r.projectionMatrix.elements),m.activeTexture(p.TEXTURE0),p.uniform1i(d.map,0);var a=0,o=0,_=i.fog;_?(p.uniform3f(d.fogColor,_.color.r,_.color.g,_.color.b),_&&_.isFog?(p.uniform1f(d.fogNear,_.near),p.uniform1f(d.fogFar,_.far),p.uniform1i(d.fogType,1),a=1,o=1):_&&_.isFogExp2&&(p.uniform1f(d.fogDensity,_.density),p.uniform1i(d.fogType,2),a=2,o=2)):(p.uniform1i(d.fogType,0),a=0,o=0);for(var y=0,M=e.length;y0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0));var h=e.isSkinnedMesh&&n.skinning,d=0;u&&(d|=L),h&&(d|=A),s=l[d]}if(t.localClippingEnabled&&n.clipShadows===!0&&0!==n.clippingPlanes.length){var f=s.uuid,p=n.uuid,m=D[f];void 0===m&&(m={},D[f]=m);var v=m[p];void 0===v&&(v=s.clone(),m[p]=v),s=v}s.visible=n.visible,s.wireframe=n.wireframe;var g=n.side;return j.renderSingleSided&&g==r.DoubleSide&&(g=r.FrontSide),j.renderReverseSided&&(g===r.FrontSide?g=r.BackSide:g===r.BackSide&&(g=r.FrontSide)),s.side=g,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,i&&void 0!==s.uniforms.lightPos&&s.uniforms.lightPos.value.copy(a),s}function v(t,e,n){if(t.visible!==!1){var i=0!==(t.layers.mask&e.layers.mask);if(i&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(t.frustumCulled===!1||_.intersectsObject(t)===!0)){var r=t.material;r.visible===!0&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),T.push(t))}for(var a=t.children,o=0,s=a.length;o0&&(i.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,n){var r=e(t.textures),a=e(t.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(i.prototype,a.EventDispatcher.prototype);var l=0;e.MaterialIdCount=r,e.Material=i},function(t,e,n){"use strict";function i(t){r.Material.call(this),this.type="MeshDepthMaterial",this.depthPacking=a.BasicDepthPacking,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.MeshDepthMaterial=void 0;var r=n(130),a=n(3);i.prototype=Object.create(r.Material.prototype),i.prototype.constructor=i,i.prototype.isMeshDepthMaterial=!0,i.prototype.copy=function(t){return r.Material.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},e.MeshDepthMaterial=i},function(t,e,n){"use strict";function i(t,e,n,i,r,a){this.planes=[void 0!==t?t:new o.Plane,void 0!==e?e:new o.Plane,void 0!==n?n:new o.Plane,void 0!==i?i:new o.Plane,void 0!==r?r:new o.Plane,void 0!==a?a:new o.Plane]}Object.defineProperty(e,"__esModule",{value:!0}),e.Frustum=void 0;var r=n(6),a=n(133),o=n(135);i.prototype={constructor:i,set:function(t,e,n,i,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],f=n[10],p=n[11],m=n[12],v=n[13],g=n[14],x=n[15];return e[0].setComponents(o-i,u-s,p-h,x-m).normalize(),e[1].setComponents(o+i,u+s,p+h,x+m).normalize(),e[2].setComponents(o+r,u+l,p+d,x+v).normalize(),e[3].setComponents(o-r,u-l,p-d,x-v).normalize(),e[4].setComponents(o-a,u-c,p-f,x-g).normalize(),e[5].setComponents(o+a,u+c,p+f,x+g).normalize(),this},intersectsObject:function(){var t=new a.Sphere;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new a.Sphere;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){var a=e[r].distanceToPoint(n);if(a0?n.min.x:n.max.x,e.x=a.normal.x>0?n.max.x:n.min.x,t.y=a.normal.y>0?n.min.y:n.max.y,e.y=a.normal.y>0?n.max.y:n.min.y,t.z=a.normal.z>0?n.min.z:n.max.z,e.z=a.normal.z>0?n.max.z:n.min.z;var o=a.distanceToPoint(t),s=a.distanceToPoint(e);if(o<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},e.Frustum=i},function(t,e,n){"use strict";function i(t,e){this.center=void 0!==t?t:new a.Vector3,this.radius=void 0!==e?e:0}Object.defineProperty(e,"__esModule",{value:!0}),e.Sphere=void 0;var r=n(134),a=n(6);i.prototype={constructor:i,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new r.Box3;return function(e,n){var i=this.center;void 0!==n?i.copy(n):t.setFromPoints(e).center(i);for(var r=0,a=0,o=e.length;athis.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new r.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},e.Sphere=i},function(t,e,n){"use strict";function i(t,e){this.min=void 0!==t?t:new r.Vector3((+(1/0)),(+(1/0)),(+(1/0))),this.max=void 0!==e?e:new r.Vector3((-(1/0)),(-(1/0)),(-(1/0)))}Object.defineProperty(e,"__esModule",{value:!0}),e.Box3=void 0;var r=n(6),a=n(133);i.prototype={constructor:i,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=+(1/0),n=+(1/0),i=+(1/0),r=-(1/0),a=-(1/0),o=-(1/0),s=0,l=t.length;sr&&(r=c),u>a&&(a=u),h>o&&(o=h)}this.min.set(e,n,i),this.max.set(r,a,o)},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){var n=e||new r.Vector3;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new r.Vector3),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){var n=e||new r.Vector3;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r.Vector3;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),getBoundingSphere:function(){var t=new r.Vector3;return function(e){var n=e||new a.Sphere;return n.center=this.center(),n.radius=.5*this.size(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3,new r.Vector3];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},e.Box3=i},function(t,e,n){"use strict";function i(t,e){this.normal=void 0!==t?t:new a.Vector3(1,0,0),this.constant=void 0!==e?e:0}Object.defineProperty(e,"__esModule",{value:!0}),e.Plane=void 0;var r=n(136),a=n(6);i.prototype={constructor:i,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new a.Vector3,e=new a.Vector3;return function(n,i,r){var a=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(a,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t),i=e||new a.Vector3;return i.copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new a.Vector3;return function(e,n){var i=n||new a.Vector3,r=e.delta(t),o=this.normal.dot(r);if(0!==o){var s=-(e.start.dot(this.normal)+this.constant)/o;if(!(s<0||s>1))return i.copy(r).multiplyScalar(s).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){ var e=t||new a.Vector3;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new a.Vector3,e=new r.Matrix3;return function(n,i){var r=this.coplanarPoint(t).applyMatrix4(n),a=i||e.getNormalMatrix(n),o=this.normal.applyMatrix3(a).normalize();return this.constant=-r.dot(o),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},e.Plane=i},function(t,e,n){"use strict";function i(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix3=void 0;var r=n(6);i.prototype={constructor:i,isMatrix3:!0,set:function(t,e,n,i,r,a,o,s,l){var c=this.elements;return c[0]=t,c[1]=i,c[2]=o,c[3]=e,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,n,i){void 0===t&&(t=new r.Vector3),void 0===n&&(n=0),void 0===i&&(i=e.length);for(var a=0,o=n;a0?1:-1,g[_]=C.x,g[_+1]=C.y,g[_+2]=C.z,x[y]=N/c,x[y+1]=1-D/u,_+=3,y+=2,P+=1}for(D=0;D65535?Uint32Array:Uint16Array)(p),v=new Float32Array(3*f),g=new Float32Array(3*f),x=new Float32Array(2*f),_=0,y=0,M=0,b=0,w=0;h("z","y","x",-1,-1,n,e,t,l,s,0),h("z","y","x",1,-1,n,e,-t,l,s,1),h("x","z","y",1,1,t,n,e,i,l,2),h("x","z","y",1,-1,t,n,-e,i,l,3),h("x","y","z",1,-1,t,e,n,i,s,4),h("x","y","z",-1,-1,t,e,-n,i,s,5),this.setIndex(new o.BufferAttribute(m,1)),this.addAttribute("position",new o.BufferAttribute(v,3)),this.addAttribute("normal",new o.BufferAttribute(g,3)),this.addAttribute("uv",new o.BufferAttribute(x,2))}Object.defineProperty(e,"__esModule",{value:!0}),e.BoxBufferGeometry=void 0;var r=n(138),a=n(6),o=n(139);i.prototype=Object.create(r.BufferGeometry.prototype),i.prototype.constructor=i,e.BoxBufferGeometry=i},function(t,e,n){"use strict";function i(){Object.defineProperty(this,"id",{value:(0,p.GeometryIdCount)()}),this.uuid=f._Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}Object.defineProperty(e,"__esModule",{value:!0}),e.BufferGeometry=void 0;var r=n(6),a=n(134),o=n(11),s=n(139),l=n(133),c=n(140),u=n(143),h=n(4),d=n(136),f=n(5),p=n(141);Object.assign(i.prototype,o.EventDispatcher.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e){return(e&&e.isBufferAttribute)===!1&&(e&&e.isInterleavedBufferAttribute)===!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new s.BufferAttribute(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new d.Matrix3).getNormalMatrix(t);i.applyToVector3Array(n.array),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new h.Matrix4),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,i){return void 0===t&&(t=new h.Matrix4),t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,i){return void 0===t&&(t=new h.Matrix4),t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new u.Object3D),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t&&t.isPoints||t&&t.isLine){var n=new s.Float32Attribute(3*e.vertices.length,3),i=new s.Float32Attribute(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new s.Float32Attribute(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t&&t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t&&t.isMesh){var n=e.__directGeometry;if(e.elementsNeedUpdate===!0&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}var i;return e.verticesNeedUpdate===!0&&(i=this.attributes.position,void 0!==i&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),e.normalsNeedUpdate===!0&&(i=this.attributes.normal,void 0!==i&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),e.colorsNeedUpdate===!0&&(i=this.attributes.color,void 0!==i&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(i=this.attributes.uv,void 0!==i&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,void 0!==i&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new c.DirectGeometry).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new s.BufferAttribute(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new s.BufferAttribute(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new s.BufferAttribute(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new s.BufferAttribute(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new s.BufferAttribute(a,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var o=t.vertices.length>65535?Uint32Array:Uint16Array,l=new o(3*t.indices.length);this.setIndex(new s.BufferAttribute(l,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],h=t.morphTargets[c],d=0,f=h.length;d0){var v=new s.Float32Attribute(4*t.skinIndices.length,4);this.addAttribute("skinIndex",v.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new s.Float32Attribute(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var t=this.attributes.position.array;void 0!==t?this.boundingBox.setFromArray(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new a.Box3,e=new r.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new l.Sphere);var n=this.attributes.position;if(n){var i=n.array,r=this.boundingSphere.center;t.setFromArray(i),t.center(r);for(var a=0,o=0,s=i.length;o0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(t.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),t},clone:function(){return(new i).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var a=t.groups,o=0,s=a.length;o0,s=r[1]&&r[1].length>0,l=t.morphTargets,c=l.length;if(c>0){e=[];for(var u=0;u0){h=[];for(var u=0;u0)for(var g=0;g<_.length;g++)for(var y=_[g],M=y.start,b=y.count,x=M,w=M+b;x0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,a;for(n=0,r=this.faces.length;n0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new c.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new l.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if((t&&t.isGeometry)===!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var i,r=this.vertices.length,a=this.vertices,l=t.vertices,c=this.faces,u=t.faces,h=this.faceVertexUvs[0],d=t.faceVertexUvs[0];void 0===n&&(n=0),void 0!==e&&(i=(new s.Matrix3).getNormalMatrix(e));for(var f=0,p=l.length;f=0;n--){var v=f[n];for(this.faces.splice(v,1),o=0,s=this.faceVertexUvs.length;o0,b=g.vertexNormals.length>0,w=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,S=0;if(S=t(S,0,0),S=t(S,1,x),S=t(S,2,_),S=t(S,3,y),S=t(S,4,M),S=t(S,5,b),S=t(S,6,w),S=t(S,7,E),u.push(S),u.push(g.a,g.b,g.c),u.push(g.materialIndex),y){var T=this.faceVertexUvs[0][l];u.push(i(T[0]),i(T[1]),i(T[2]))}if(M&&u.push(e(g.normal)),b){var L=g.vertexNormals;u.push(e(L[0]),e(L[1]),e(L[2]))}if(w&&u.push(n(g.color)),E){var A=g.vertexColors;u.push(n(A[0]),n(A[1]),n(A[2]))}}return r.data={},r.data.vertices=s,r.data.normals=h,f.length>0&&(r.data.colors=f),m.length>0&&(r.data.uvs=[m]),r.data.faces=u,r},clone:function(){return(new i).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var e=t.vertices,n=0,i=e.length;n1){for(var e=0;e1)for(var e=0;e0){r.children=[];for(var a=0;a0&&(i.geometries=o),s.length>0&&(i.materials=s),l.length>0&&(i.textures=l),c.length>0&&(i.images=c)}return i.object=r,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(var n=0;n0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;te.far?null:{distance:c,point:S.clone(),object:t}}function n(n,i,r,a,o,s,l,c){p.fromArray(a,3*s),m.fromArray(a,3*l),v.fromArray(a,3*c);var d=e(n,i,r,p,m,v,E);return d&&(o&&(y.fromArray(o,2*s),M.fromArray(o,2*l),b.fromArray(o,2*c),d.uv=t(E,p,m,v,y,M,b)),d.face=new h.Face3(s,l,c,u.Triangle.normal(p,m,v)),d.faceIndex=s),d}var i=new l.Matrix4,c=new s.Ray,f=new o.Sphere,p=new r.Vector3,m=new r.Vector3,v=new r.Vector3,g=new r.Vector3,x=new r.Vector3,_=new r.Vector3,y=new a.Vector2,M=new a.Vector2,b=new a.Vector2,w=new r.Vector3,E=new r.Vector3,S=new r.Vector3;return function(r,a){var o=this.geometry,s=this.material,l=this.matrixWorld;if(void 0!==s&&(null===o.boundingSphere&&o.computeBoundingSphere(),f.copy(o.boundingSphere),f.applyMatrix4(l),r.ray.intersectsSphere(f)!==!1&&(i.getInverse(l),c.copy(r.ray).applyMatrix4(i),null===o.boundingBox||c.intersectsBox(o.boundingBox)!==!1))){var u,h;if(o&&o.isBufferGeometry){var d,w,S,T=o.index,L=o.attributes,A=L.position.array;if(void 0!==L.uv&&(u=L.uv.array),null!==T)for(var P=T.array,R=0,C=P.length;R0&&(u=V);for(var G=0,z=B.length;G0)if(s=d*p-f,l=d*f-p,u=h*v,s>=0)if(l>=-u)if(l<=u){var g=1/v;s*=g,l*=g,c=s*(s+d*l+2*f)+l*(d*s+l+2*p)+m}else l=h,s=Math.max(0,-(d*l+f)),c=-s*s+l*(l+2*p)+m;else l=-h,s=Math.max(0,-(d*l+f)),c=-s*s+l*(l+2*p)+m;else l<=-u?(s=Math.max(0,-(-d*h+f)),l=s>0?-h:Math.min(Math.max(-h,-p),h),c=-s*s+l*(l+2*p)+m):l<=u?(s=0,l=Math.min(Math.max(-h,-p),h),c=l*(l+2*p)+m):(s=Math.max(0,-(d*h+f)),l=s>0?h:Math.min(Math.max(-h,-p),h),c=-s*s+l*(l+2*p)+m);else l=d>0?-h:h,s=Math.max(0,-(d*l+f)),c=-s*s+l*(l+2*p)+m;return a&&a.copy(this.direction).multiplyScalar(s).add(this.origin),o&&o.copy(e).multiplyScalar(l).add(t),c}}(),intersectSphere:function(){var t=new r.Vector3;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=i-o,l=i+o;return s<0&&l<0?null:s<0?this.at(l,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var n=t.normal.dot(this.direction);return n*e<0},intersectBox:function(t,e){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,i=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,i=(t.min.x-h.x)*l),c>=0?(r=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(r=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),n>a||r>i?null:((r>n||n!==n)&&(n=r),(a=0?(o=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||o>i?null:((o>n||n!==n)&&(n=o),(s=0?n:i,e)))},intersectsBox:function(){var t=new r.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new r.Vector3,e=new r.Vector3,n=new r.Vector3,i=new r.Vector3;return function(r,a,o,s,l){e.subVectors(a,r),n.subVectors(o,r),i.crossVectors(e,n);var c,u=this.direction.dot(i);if(u>0){if(s)return null;c=1}else{if(!(u<0))return null;c=-1,u=-u}t.subVectors(this.origin,r);var h=c*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var d=c*this.direction.dot(e.cross(t));if(d<0)return null;if(h+d>u)return null;var f=-c*t.dot(i);return f<0?null:this.at(f/u,l)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},e.Ray=i},function(t,e,n){"use strict";function i(t,e,n){this.a=void 0!==t?t:new r.Vector3,this.b=void 0!==e?e:new r.Vector3,this.c=void 0!==n?n:new r.Vector3}Object.defineProperty(e,"__esModule",{value:!0}),e.Triangle=void 0;var r=n(6),a=n(149),o=n(135);i.normal=function(){var t=new r.Vector3;return function(e,n,i,a){var o=a||new r.Vector3;o.subVectors(i,n),t.subVectors(e,n),o.cross(t);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),i.barycoordFromPoint=function(){var t=new r.Vector3,e=new r.Vector3,n=new r.Vector3;return function(i,a,o,s,l){t.subVectors(s,a),e.subVectors(o,a),n.subVectors(i,a);var c=t.dot(t),u=t.dot(e),h=t.dot(n),d=e.dot(e),f=e.dot(n),p=c*d-u*u,m=l||new r.Vector3;if(0===p)return m.set(-2,-1,-1);var v=1/p,g=(d*h-u*f)*v,x=(c*f-u*h)*v;return m.set(1-g-x,x,g)}}(),i.containsPoint=function(){var t=new r.Vector3;return function(e,n,r,a){var o=i.barycoordFromPoint(e,n,r,a,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),i.prototype={constructor:i,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new r.Vector3,e=new r.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new r.Vector3;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return i.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new o.Plane;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return i.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return i.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,n,i;return function(s,l){void 0===t&&(t=new o.Plane,e=[new a.Line3,new a.Line3,new a.Line3],n=new r.Vector3,i=new r.Vector3);var c=l||new r.Vector3,u=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(s,n),this.containsPoint(n)===!0)c.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var h=0;h65535?Uint32Array:Uint16Array)(l*c*6),_=0;_0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===a.DoubleSide,flipSided:r.side===a.BackSide,depthPacking:void 0!==r.depthPacking&&r.depthPacking};return m},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);for(var r=0;r");return d(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function f(t){function e(t,e,n,i){for(var r="",a=parseInt(e);a0?t.gammaFactor:1,C=s(y,i,t.extensions),D=l(M),U=p.createProgram();n.isRawShaderMaterial?(A=[D,"\n"].filter(u).join("\n"),P=[C,D,"\n"].filter(u).join("\n")):(A=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,D,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+R,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+T:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+E:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(u).join("\n"),P=[C,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,D,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+R,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+S:"",i.envMap?"#define "+T:"",i.envMap?"#define "+L:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+E:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==x.NoToneMapping?"#define TONE_MAPPING":"",i.toneMapping!==x.NoToneMapping?g.ShaderChunk.tonemapping_pars_fragment:"",i.toneMapping!==x.NoToneMapping?o("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?g.ShaderChunk.encodings_pars_fragment:"",i.mapEncoding?r("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?r("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?r("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?a("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(u).join("\n")),b=d(b,i),b=h(b,i),w=d(w,i),w=h(w,i),n.isShaderMaterial||(b=f(b),w=f(w));var N=A+b,F=P+w,I=(0,v.WebGLShader)(p,p.VERTEX_SHADER,N),O=(0,v.WebGLShader)(p,p.FRAGMENT_SHADER,F);p.attachShader(U,I),p.attachShader(U,O),void 0!==n.index0AttributeName?p.bindAttribLocation(U,0,n.index0AttributeName):i.morphTargets===!0&&p.bindAttribLocation(U,0,"position"),p.linkProgram(U);var B=p.getProgramInfoLog(U),V=p.getShaderInfoLog(I),G=p.getShaderInfoLog(O),z=!0,k=!0;p.getProgramParameter(U,p.LINK_STATUS)===!1?(z=!1,console.error("THREE.WebGLProgram: shader error: ",p.getError(),"gl.VALIDATE_STATUS",p.getProgramParameter(U,p.VALIDATE_STATUS),"gl.getProgramInfoLog",B,V,G)):""!==B?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",B):""!==V&&""!==G||(k=!1),k&&(this.diagnostics={runnable:z,material:n,programLog:B,vertexShader:{log:V,prefix:A},fragmentShader:{log:G,prefix:P}}),p.deleteShader(I),p.deleteShader(O);var H;this.getUniforms=function(){return void 0===H&&(H=new m.WebGLUniforms(p,U,t)),H};var j;return this.getAttributes=function(){return void 0===j&&(j=c(p,U)),j},this.destroy=function(){p.deleteProgram(U),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=_++,this.code=e,this.usedTimes=1,this.program=U,this.vertexShader=I,this.fragmentShader=O,this}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLProgram=void 0;var m=n(8),v=n(160),g=n(15),x=n(3),_=0;e.WebGLProgram=p},function(t,e){"use strict";function n(t){for(var e=t.split("\n"),n=0;n65535?Uint32Array:Uint16Array,_=new r.BufferAttribute(new x(a),1);return o(_,t.ELEMENT_ARRAY_BUFFER),i.wireframe=_,_}function h(t,e,n){if(e>n){var i=e;e=n,n=i}var r=t[e];return void 0===r?(t[e]=[n],!0):r.indexOf(n)===-1&&(r.push(n),!0)}var d=new a.WebGLGeometries(t,e,n);return{getAttributeBuffer:c,getWireframeAttribute:u,update:i}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLObjects=void 0;var r=n(139),a=n(162);e.WebGLObjects=i},function(t,e,n){"use strict";function i(t,e,n){function i(t){var r=t.target,a=c[r.id];null!==a.index&&o(a.index),s(a.attributes),r.removeEventListener("dispose",i),delete c[r.id];var l=e.get(r);l.wireframe&&o(l.wireframe),e["delete"](r);var u=e.get(a);u.wireframe&&o(u.wireframe),e["delete"](a),n.memory.geometries--}function a(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function o(e){var n=a(e);void 0!==n&&(t.deleteBuffer(n),l(e))}function s(t){for(var e in t)o(t[e])}function l(t){t.isInterleavedBufferAttribute?e["delete"](t.data):e["delete"](t)}var c={};return{get:function(t){var e=t.geometry;if(void 0!==c[e.id])return c[e.id];e.addEventListener("dispose",i);var a;return e.isBufferGeometry?a=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new r.BufferGeometry).setFromObject(t)),a=e._bufferGeometry),c[e.id]=a,n.memory.geometries++,a}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLGeometries=void 0;var r=n(138);e.WebGLGeometries=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s,l){function c(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n);var r=i.getContext("2d");return r.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function u(t){return a._Math.isPowerOfTwo(t.width)&&a._Math.isPowerOfTwo(t.height)}function h(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=a._Math.nearestPowerOfTwo(t.width),e.height=a._Math.nearestPowerOfTwo(t.height);var n=e.getContext("2d");return n.drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function d(t){return t.wrapS!==r.ClampToEdgeWrapping||t.wrapT!==r.ClampToEdgeWrapping||t.minFilter!==r.NearestFilter&&t.minFilter!==r.LinearFilter}function f(e){return e===r.NearestFilter||e===r.NearestMipMapNearestFilter||e===r.NearestMipMapLinearFilter?t.NEAREST:t.LINEAR}function p(t){var e=t.target;e.removeEventListener("dispose",p),v(e),P.textures--}function m(t){var e=t.target;e.removeEventListener("dispose",m),g(e),P.textures--}function v(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i["delete"](e)}function g(e){var n=i.get(e),r=i.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e&&e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[a]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i["delete"](e.texture),i["delete"](e)}}function x(e,r){var a=i.get(e);if(e.version>0&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(o.complete!==!1)return void b(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D,a.__webglTexture)}function _(e,a){var l=i.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",p),l.__image__webglTextureCube=t.createTexture(),P.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,d=e.image[0]&&e.image[0].isDataTexture,f=[],m=0;m<6;m++)h||d?f[m]=d?e.image[m].image:e.image[m]:f[m]=c(e.image[m],o.maxCubemapSize);var v=f[0],g=u(v),x=s(e.format),_=s(e.type);M(t.TEXTURE_CUBE_MAP,e,g);for(var m=0;m<6;m++)if(h)for(var y,b=f[m].mipmaps,w=0,E=b.length;w-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,x,y.width,y.height,0,y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,w,x,y.width,y.height,0,x,_,y.data);else d?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,x,f[m].width,f[m].height,0,x,_,f[m].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,x,x,_,f[m]);e.generateMipmaps&&g&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function y(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)}function M(n,a,l){var c;if(l?(t.texParameteri(n,t.TEXTURE_WRAP_S,s(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,s(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,s(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,s(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===r.ClampToEdgeWrapping&&a.wrapT===r.ClampToEdgeWrapping||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,f(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,f(a.minFilter)),a.minFilter!==r.NearestFilter&&a.minFilter!==r.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===r.FloatType&&null===e.get("OES_texture_float_linear"))return;if(a.type===r.HalfFloatType&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,o.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,i,a){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",p),e.__webglTexture=t.createTexture(),P.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var l=c(i.image,o.maxTextureSize);d(i)&&u(l)===!1&&(l=h(l));var f=u(l),m=s(i.format),v=s(i.type);M(t.TEXTURE_2D,i,f);var g,x=i.mipmaps;if(i&&i.isDepthTexture){var _=t.DEPTH_COMPONENT;if(i.type===r.FloatType){if(!R)throw new Error("Float Depth Texture only supported in WebGL2.0");_=t.DEPTH_COMPONENT32F}else R&&(_=t.DEPTH_COMPONENT16);i.format===r.DepthStencilFormat&&(_=t.DEPTH_STENCIL),n.texImage2D(t.TEXTURE_2D,0,_,l.width,l.height,0,m,v,null)}else if(i&&i.isDataTexture)if(x.length>0&&f){for(var y=0,b=x.length;y-1?n.compressedTexImage2D(t.TEXTURE_2D,y,m,g.width,g.height,0,g.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,y,m,g.width,g.height,0,m,v,g.data);else if(x.length>0&&f){for(var y=0,b=x.length;y0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=n.logarithmicDepthBuffer===!0&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=u>0,x=!!e.get("OES_texture_float"),_=g&&x;return{getMaxAnisotropy:i,getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:f,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:x,floatVertexTextures:_}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLCapabilities=n},function(t,e){"use strict";function n(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i,i}}}Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLExtensions=n},function(t,e,n){"use strict";function i(){function t(){h.value!==i&&(h.value=i,h.needsUpdate=o>0),n.numPlanes=o}function e(t,e,i,r){var a=null!==t?t.length:0,o=null;if(0!==a){if(o=h.value,r!==!0||null===o){var s=i+4*a,l=e.matrixWorldInverse;u.getNormalMatrix(l),(null===o||o.length0||0===t.search(/^data\:image\/jpeg/);s.format=i?r.RGBFormat:r.RGBAFormat,s.image=n,s.needsUpdate=!0,void 0!==e&&e(s)},n,i),s},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),e.TextureLoader=i},function(t,e,n){"use strict";function i(t){this.manager=void 0!==t?t:a.DefaultLoadingManager}Object.defineProperty(e,"__esModule",{value:!0}),e.ImageLoader=void 0;var r=n(171),a=n(173);Object.assign(i.prototype,{load:function(t,e,n,i){var a=this,o=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(o.onload=function(){URL.revokeObjectURL(o.src),e&&e(o),a.manager.itemEnd(t)},0===t.indexOf("data:"))o.src=t;else{var s=new r.XHRLoader;s.setPath(this.path),s.setResponseType("blob"),s.setWithCredentials(this.withCredentials),s.load(t,function(t){o.src=URL.createObjectURL(t)},n,i)}return a.manager.itemStart(t),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),e.ImageLoader=i},function(t,e,n){"use strict";function i(t){this.manager=void 0!==t?t:a.DefaultLoadingManager}Object.defineProperty(e,"__esModule",{value:!0}),e.XHRLoader=void 0;var r=n(172),a=n(173);Object.assign(i.prototype,{load:function(t,e,n,i){void 0!==this.path&&(t=this.path+t);var a=this,o=r.Cache.get(t);if(void 0!==o)return a.manager.itemStart(t),setTimeout(function(){e&&e(o),a.manager.itemEnd(t)},0),o;var s=new XMLHttpRequest;return s.open("GET",t,!0),s.addEventListener("load",function(n){var o=n.target.response;r.Cache.add(t,o),200===this.status?(e&&e(o),a.manager.itemEnd(t)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),e&&e(o),a.manager.itemEnd(t)):(i&&i(n),a.manager.itemError(t))},!1),void 0!==n&&s.addEventListener("progress",function(t){n(t)},!1),s.addEventListener("error",function(e){i&&i(e),a.manager.itemError(t)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType("text/plain"),s.send(null),a.manager.itemStart(t),s},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this}}),e.XHRLoader=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n;e.Cache=n={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(this.files[t]=e)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},e.Cache=n},function(t,e){"use strict";function n(t,e,n){var i=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,r===!1&&void 0!==i.onStart&&i.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}}Object.defineProperty(e,"__esModule",{value:!0});var i;e.DefaultLoadingManager=i=new n,e.DefaultLoadingManager=i,e.LoadingManager=n},function(t,e,n){"use strict";function i(){r.Object3D.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}Object.defineProperty(e,"__esModule",{value:!0}),e.Scene=void 0;var r=n(143);i.prototype=Object.create(r.Object3D.prototype),i.prototype.constructor=i,i.prototype.copy=function(t,e){return r.Object3D.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},i.prototype.toJSON=function(t){var e=r.Object3D.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},e.Scene=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s){r.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:o,depthSegments:s},this.fromBufferGeometry(new a.BoxBufferGeometry(t,e,n,i,o,s)),this.mergeVertices()}Object.defineProperty(e,"__esModule",{value:!0}),e.BoxGeometry=void 0;var r=n(141),a=n(137);i.prototype=Object.create(r.Geometry.prototype),i.prototype.constructor=i,e.BoxGeometry=i},function(t,e,n){"use strict";function i(t,e,n,i,o,s,l){r.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:o,thetaStart:s,thetaLength:l},this.fromBufferGeometry(new a.SphereBufferGeometry(t,e,n,i,o,s,l))}Object.defineProperty(e,"__esModule",{value:!0}),e.SphereGeometry=void 0;var r=n(141),a=n(177);i.prototype=Object.create(r.Geometry.prototype),i.prototype.constructor=i,e.SphereGeometry=i},function(t,e,n){"use strict";function i(t,e,n,i,l,c,u){r.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:l,thetaStart:c,thetaLength:u},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,l=void 0!==l?l:2*Math.PI,c=void 0!==c?c:0,u=void 0!==u?u:Math.PI;for(var h=c+u,d=(e+1)*(n+1),f=new s.BufferAttribute(new Float32Array(3*d),3),p=new s.BufferAttribute(new Float32Array(3*d),3),m=new s.BufferAttribute(new Float32Array(2*d),2),v=0,g=[],x=new a.Vector3,_=0;_<=n;_++){for(var y=[],M=_/n,b=0;b<=e;b++){var w=b/e,E=-t*Math.cos(i+w*l)*Math.sin(c+M*u),S=t*Math.cos(c+M*u),T=t*Math.sin(i+w*l)*Math.sin(c+M*u);x.set(E,S,T).normalize(),f.setXYZ(v,E,S,T),p.setXYZ(v,x.x,x.y,x.z),m.setXY(v,w,1-M),y.push(v),v++}g.push(y)}for(var L=[],_=0;_0)&&L.push(A,P,C),(_!==n-1||h65535?s.Uint32Attribute:s.Uint16Attribute)(L,1)),this.addAttribute("position",f),this.addAttribute("normal",p),this.addAttribute("uv",m),this.boundingSphere=new o.Sphere(new a.Vector3,t)}Object.defineProperty(e,"__esModule",{value:!0}),e.SphereBufferGeometry=void 0;var r=n(138),a=n(6),o=n(133),s=n(139);i.prototype=Object.create(r.BufferGeometry.prototype),i.prototype.constructor=i,e.SphereBufferGeometry=i},function(t,e){"use strict";void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&!function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n=200&&n<300||304===n){if(c)try{e=c.call(s,f)}catch(i){return void h.call("error",s,i)}else e=f;h.call("load",s,e)}else h.call("error",s,t)}var s,l,c,u,h=n.dispatch("beforesend","progress","load","error"),d=e.map(),f=new XMLHttpRequest,p=null,m=null,v=0;if("undefined"==typeof XDomainRequest||"withCredentials"in f||!/^(http(s)?:)?\/\//.test(t)||(f=new XDomainRequest),"onload"in f?f.onload=f.onerror=f.ontimeout=r:f.onreadystatechange=function(t){f.readyState>3&&r(t)},f.onprogress=function(t){h.call("progress",s,t)},s={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?d.get(t):(null==e?d.remove(t):d.set(t,e+""),s)},mimeType:function(t){return arguments.length?(l=null==t?null:t+"",s):l},responseType:function(t){return arguments.length?(u=t,s):u},timeout:function(t){return arguments.length?(v=+t,s):v},user:function(t){return arguments.length<1?p:(p=null==t?null:t+"",s)},password:function(t){return arguments.length<1?m:(m=null==t?null:t+"",s)},response:function(t){return c=t,s},get:function(t,e){return s.send("GET",t,e)},post:function(t,e){return s.send("POST",t,e)},send:function(e,n,i){return f.open(e,t,!0,p,m),null==l||d.has("accept")||d.set("accept",l+",*/*"),f.setRequestHeader&&d.each(function(t,e){f.setRequestHeader(e,t)}),null!=l&&f.overrideMimeType&&f.overrideMimeType(l),null!=u&&(f.responseType=u),v>0&&(f.timeout=v),null==i&&"function"==typeof n&&(i=n,n=null),null!=i&&1===i.length&&(i=a(i)),null!=i&&s.on("error",i).on("load",function(t){i(null,t)}),h.call("beforesend",s,f),f.send(null==n?null:n),s},abort:function(){return f.abort(),s},on:function(){var t=h.on.apply(h,arguments);return t===h?s:t}},null!=i){if("function"!=typeof i)throw new Error("invalid callback: "+i);return s.get(i)}return s}function a(t){return function(e,n){t(null==e?n:null)}}function o(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function s(t,e){return function(n,i){var a=r(n).mimeType(t).response(e);if(null!=i){if("function"!=typeof i)throw new Error("invalid callback: "+i);return a.get(i)}return a}}function l(t,e){return function(n,i,a){arguments.length<3&&(a=i,i=null);var o=r(n).mimeType(t);return o.row=function(t){return arguments.length?o.response(c(e,i=t)):i},o.row(i),a?o.get(a):o}}function c(t,e){return function(n){return t(n.responseText,e)}}var u=s("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)}),h=s("application/json",function(t){return JSON.parse(t.responseText)}),d=s("text/plain",function(t){return t.responseText}),f=s("application/xml",function(t){var e=t.responseXML;if(!e)throw new Error("parse error");return e}),p=l("text/csv",i.csvParse),m=l("text/tab-separated-values",i.tsvParse);t.request=r,t.html=u,t.json=h,t.text=d,t.xml=f,t.csv=p,t.tsv=m,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(){}function n(t,n){var i=new e;if(t instanceof e)t.each(function(t,e){i.set(e,t)});else if(Array.isArray(t)){var r,a=-1,o=t.length;if(null==n)for(;++a=u.length)return null!=l?l(e):null!=i?e.sort(i):e;for(var s,c,h,d=-1,f=e.length,p=u[r++],m=n(),v=a();++du.length)return t;var i,r=h[n-1];return null!=l&&n>=u.length?i=t.entries():(i=[],t.each(function(t,r){i.push({key:r,values:e(t,n)})})),null!=r?i.sort(function(t,e){return r(t.key,e.key)}):i}var i,l,c,u=[],h=[];return c={object:function(e){return t(e,0,r,a)},map:function(e){return t(e,0,o,s)},entries:function(n){return e(t(n,0,o,s),0)},key:function(t){return u.push(t),c},sortKeys:function(t){return h[u.length-1]=t,c},sortValues:function(t){return i=t,c},rollup:function(t){return l=t,c}}}function r(){return{}}function a(t,e,n){t[e]=n}function o(){return n()}function s(t,e,n){t.set(e,n)}function l(){}function c(t,e){var n=new l;if(t instanceof l)t.each(function(t){n.add(t)});else if(t){var i=-1,r=t.length;if(null==e)for(;++i=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}function r(t,e){for(var n,i=0,r=t.length;i0)for(var n,i,r=new Array(n),a=0;a=l)return o;if(r)return r=!1,a;var e,n=c;if(34===t.charCodeAt(n)){for(var i=n;i++WebGL.
','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].join("\n")),t},addGetWebGLMessage:function(t){var e,i,r;t=t||{},e=void 0!==t.parent?t.parent:document.body,i=void 0!==t.id?t.id:"oldie",r=n.getWebGLErrorMessage(),r.id=i,e.appendChild(r)}};e["default"]=n},function(t,e,n){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e}function r(t,e){function n(){t.style.color="#fff",t.style.font="13px/20px Arial, sans-serif";var n,i,r;y=t.offsetWidth||window.innerWidth,M=t.offsetHeight||window.innerHeight,g=new o.PerspectiveCamera(30,y/M,1,1e4),g.position.z=O,x=new o.Scene;var a=new o.SphereGeometry(200,40,30);n=P.earth,i=o.UniformsUtils.clone(n.uniforms);var l=new o.TextureLoader;i.texture.value=l.load(T+"world.jpg"),r=new o.ShaderMaterial({uniforms:i,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),b=new o.Mesh(a,r),b.rotation.y=Math.PI,x.add(b),n=P.atmosphere,i=o.UniformsUtils.clone(n.uniforms),r=new o.ShaderMaterial({uniforms:i,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:o.BackSide,blending:o.AdditiveBlending,transparent:!0}),b=new o.Mesh(a,r),b.scale.set(1.1,1.1,1.1),x.add(b),a=new o.BoxGeometry(e.pointSize||.75,e.pointSize||.75,1),a.applyMatrix((new o.Matrix4).makeTranslation(0,0,-.5)),w=new o.Mesh(a),_=new o.WebGLRenderer({antialias:!0}),_.setSize(y,M),_.domElement.style.position="absolute",t.appendChild(_.domElement),t.addEventListener("mousedown",s,!1),t.addEventListener("mousewheel",h,!1),document.addEventListener("keydown",d,!1),window.addEventListener("resize",f,!1),t.addEventListener("mouseover",function(){E=!0},!1),t.addEventListener("mouseout",function(){E=!1},!1)}function i(t,e){var n,i,r,s,l,c,u;if(e.animated=e.animated||!1,this.is_animated=e.animated,e.format=e.format||"magnitude","magnitude"===e.format)c=3,u=function(t,e){return S(t[e+2])};else{if("legend"!==e.format)throw"error: format not supported: "+e.format;c=4,u=function(t,e){return S(t[e+3])}}if(e.animated){if(void 0===this._baseGeometry)for(this._baseGeometry=new o.Geometry,l=0;lV?V:F.y,F.y=F.y<-V?-V:F.y}function c(e){t.removeEventListener("mousemove",l,!1),t.removeEventListener("mouseup",c,!1),t.removeEventListener("mouseout",u,!1),t.style.cursor="auto"}function u(e){t.removeEventListener("mousemove",l,!1),t.removeEventListener("mouseup",c,!1),t.removeEventListener("mouseout",u,!1)}function h(t){return t.preventDefault(),E&&p(.3*t.wheelDeltaY),!1}function d(t){switch(t.keyCode){case 38:p(100),t.preventDefault();break;case 40:p(-100),t.preventDefault()}}function f(e){g.aspect=t.offsetWidth/t.offsetHeight,g.updateProjectionMatrix(),_.setSize(t.offsetWidth,t.offsetHeight)}function p(t){B-=t,B=B>1e3?1e3:B,B=B<350?350:B}function m(){requestAnimationFrame(m),v()}function v(){p(R),F.x-=N.x,F.y-=N.y,U.x+=.1*(F.x-U.x),U.y+=.1*(F.y-U.y),O+=.3*(B-O),g.position.x=O*Math.sin(U.x)*Math.cos(U.y),g.position.y=O*Math.sin(U.y),g.position.z=O*Math.cos(U.x)*Math.cos(U.y),g.lookAt(new o.Vector3(b.position.x+A.x,b.position.y+A.y,b.position.z+A.z)),_.render(x,g)}e=e||{};var g,x,_,y,M,b,w,E,S=e.colorFn||function(t){var e=new o.Color;return e.setHSL(.6-.5*t,1,.5),e},T=e.imgDir||"/globe/",L=e.initialZoom||1e5,A=e.cameraOffset||{x:0,y:0,z:0},P={earth:{uniforms:{texture:{type:"t",value:null}},vertexShader:["varying vec3 vNormal;","varying vec2 vUv;","void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","vNormal = normalize( normalMatrix * normal );","vUv = uv;","}"].join("\n"),fragmentShader:["uniform sampler2D texture;","varying vec3 vNormal;","varying vec2 vUv;","void main() {","vec3 diffuse = texture2D( texture, vUv ).xyz;","float intensity = 1.05 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );","vec3 atmosphere = vec3( 0.11764, 0.4509, 0.745 ) * pow( intensity, 3.0 );","gl_FragColor = vec4( diffuse + atmosphere, 1.0 );","}"].join("\n")},atmosphere:{uniforms:{},vertexShader:["varying vec3 vNormal;","void main() {","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec3 vNormal;","void main() {","float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 12.0 );","gl_FragColor = vec4( 0.11764, 0.4509, 0.745, 0.5 ) * intensity;","}"].join("\n")}},R=0,C={x:0,y:0},D={x:0,y:0},U={x:0,y:0},N={x:-.001,y:0},F={x:1.1*Math.PI,y:.06*Math.PI},I={x:0,y:0},O=1e5,B=L||1e5,V=Math.PI/2;return n(),this.animate=m,this.__defineGetter__("time",function(){return this._time||0}),this.__defineSetter__("time",function(t){var e=[],n=this.points.morphTargetDictionary;for(var i in n)i.indexOf("morphPadding")<0&&e.push(n[i]);e.sort();for(var r=e.length-1,a=t*r+1,o=Math.floor(a),s=0;s=0&&(this.points.morphTargetInfluences[l]=1-c),this.points.morphTargetInfluences[o]=c,this._time=t}),this.addData=i,this.createPoints=r,this.renderer=_,this.scene=x,this}Object.defineProperty(e,"__esModule",{value:!0});var a=n(1),o=i(a);e["default"]=r}]);