!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i():"function"==typeof define&&define.amd?define(i):i()}(0,function(){"use strict";function t(t,i,e){i||alert("No callback specified");var r=t.tileSet,n=t.clip;if(this.loadCallback=i,this.errorCallback=e,t.z>r.dtmMaxZoom){var s=Math.pow(2,t.z-r.dtmMaxZoom);this.x=Math.floor(t.x/s),this.y=Math.floor(t.y/s),this.z=r.dtmMaxZoom;var a=r.divisions,o=a*(t.x%s)/s,h=(a+1)*(a*(t.y%s))/s;n.dtmOffset=h+o,n.dtmWidth=r.divisions+1}else this.x=t.x,this.y=t.y,this.z=t.z,n.dtmOffset=0;this.tileFile=r.directory+"/"+this.z+"/DTM-"+this.x+"-"+this.y+".bin"}function i(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function e(t,i,e,r){this._x=t||0,this._y=i||0,this._z=e||0,this._w=void 0!==r?r:1}function r(t,i,e){this.x=t||0,this.y=i||0,this.z=e||0}function n(t,i){this.center=void 0!==t?t:new r,this.radius=void 0!==i?i:0}function s(t,i){this.min=void 0!==t?t:new r(1/0,1/0,1/0),this.max=void 0!==i?i:new r(-1/0,-1/0,-1/0)}function a(){}function o(t,i,e,r){this.x=t||0,this.y=i||0,this.z=e||0,this.w=void 0!==r?r:1}function h(t,i){this.x=t||0,this.y=i||0}function u(t,i,e){return void 0===i&&void 0===e?this.set(t):this.setRGB(t,i,e)}function c(t,i,e){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=k.generateUUID(),this.name="",this.array=t,this.itemSize=i,this.count=void 0!==t?t.length/i:0,this.normalized=!0===e,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function l(t,i){c.call(this,new Uint16Array(t),i)}function d(t,i){c.call(this,new Uint32Array(t),i)}function f(t,i){c.call(this,new Float32Array(t),i)}function m(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function y(t,i,e,r){this._x=t||0,this._y=i||0,this._z=e||0,this._order=r||y.DefaultOrder}function p(){this.mask=1}function x(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function v(){function t(){o.setFromEuler(a,!1)}function n(){a.setFromQuaternion(o,void 0,!1)}Object.defineProperty(this,"id",{value:U++}),this.uuid=k.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=v.DefaultUp.clone();var s=new r,a=new y,o=new e,h=new r(1,1,1);a.onChange(t),o.onChange(n),Object.defineProperties(this,{position:{enumerable:!0,value:s},rotation:{enumerable:!0,value:a},quaternion:{enumerable:!0,value:o},scale:{enumerable:!0,value:h},modelViewMatrix:{value:new i},normalMatrix:{value:new x}}),this.matrix=new i,this.matrixWorld=new i,this.matrixAutoUpdate=v.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new p,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function g(t){if(0===t.length)return-1/0;for(var i=t[0],e=1,r=t.length;ei&&(i=t[e]);return i}function b(t,i,e,n,s,a){this.a=t,this.b=i,this.c=e,this.normal=n&&n.isVector3?n:new r,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new u,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=void 0!==a?a:0}function w(){return V++}function M(){Object.defineProperty(this,"id",{value:w()}),this.uuid=k.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function z(){Object.defineProperty(this,"id",{value:w()}),this.uuid=k.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function _(t,i,e,n,a,o,h,u){z.call(this),this.type="TerrainTileGeometry";var c,l,d,m,y,p,x=Math.floor(e)||1,v=Math.floor(n)||1,g=x+1,b=v+1,w=t/x,M=i/v,_=[],A=[],S=[],N=0,k=1/0,E=-1/0,U=0,V=0;void 0===h.terrainWidth&&(h.terrainWidth=x,h.terrainHeight=v),void 0===h.dtmWidth&&(h.dtmWidth=h.terrainWidth+1);var T=g+h.left,O=b+h.top;for(l=h.top;lE&&(E=m),S.push(c/h.terrainWidth),S.push(1-l/h.terrainHeight),U+=w;V+=M}for(this.boundingBox=(new s).set(new r(0,0,k),new r(t,-i,E)),l=0;l0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),e=1;e>=4,e[n]=i[19===n?3&t|8:t]);return e.join("")}}(),clamp:function(t,i,e){return Math.max(i,Math.min(e,t))},euclideanModulo:function(t,i){return(t%i+i)%i},mapLinear:function(t,i,e,r,n){return r+(t-i)*(n-r)/(e-i)},lerp:function(t,i,e){return(1-e)*t+e*i},smoothstep:function(t,i,e){return t<=i?0:t>=e?1:(t=(t-i)/(e-i))*t*(3-2*t)},smootherstep:function(t,i,e){return t<=i?0:t>=e?1:(t=(t-i)/(e-i))*t*t*(t*(6*t-15)+10)},randInt:function(t,i){return t+Math.floor(Math.random()*(i-t+1))},randFloat:function(t,i){return t+Math.random()*(i-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*k.DEG2RAD},radToDeg:function(t){return t*k.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.assign(i.prototype,{isMatrix4:!0,set:function(t,i,e,r,n,s,a,o,h,u,c,l,d,f,m,y){var p=this.elements;return p[0]=t,p[4]=i,p[8]=e,p[12]=r,p[1]=n,p[5]=s,p[9]=a,p[13]=o,p[2]=h,p[6]=u,p[10]=c,p[14]=l,p[3]=d,p[7]=f,p[11]=m,p[15]=y,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){var i=this.elements,e=t.elements;return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],this},copyPosition:function(t){var i=this.elements,e=t.elements;return i[12]=e[12],i[13]=e[13],i[14]=e[14],this},extractBasis:function(t,i,e){return t.setFromMatrixColumn(this,0),i.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this},makeBasis:function(t,i,e){return this.set(t.x,i.x,e.x,0,t.y,i.y,e.y,0,t.z,i.z,e.z,0,0,0,0,1),this},extractRotation:function(){var t=new r;return function(i){var e=this.elements,r=i.elements,n=1/t.setFromMatrixColumn(i,0).length(),s=1/t.setFromMatrixColumn(i,1).length(),a=1/t.setFromMatrixColumn(i,2).length();return e[0]=r[0]*n,e[1]=r[1]*n,e[2]=r[2]*n,e[4]=r[4]*s,e[5]=r[5]*s,e[6]=r[6]*s,e[8]=r[8]*a,e[9]=r[9]*a,e[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var i=this.elements,e=t.x,r=t.y,n=t.z,s=Math.cos(e),a=Math.sin(e),o=Math.cos(r),h=Math.sin(r),u=Math.cos(n),c=Math.sin(n);if("XYZ"===t.order){var l=s*u,d=s*c,f=a*u,m=a*c;i[0]=o*u,i[4]=-o*c,i[8]=h,i[1]=d+f*h,i[5]=l-m*h,i[9]=-a*o,i[2]=m-l*h,i[6]=f+d*h,i[10]=s*o}else if("YXZ"===t.order){var y=o*u,p=o*c,x=h*u,v=h*c;i[0]=y+v*a,i[4]=x*a-p,i[8]=s*h,i[1]=s*c,i[5]=s*u,i[9]=-a,i[2]=p*a-x,i[6]=v+y*a,i[10]=s*o}else if("ZXY"===t.order){var y=o*u,p=o*c,x=h*u,v=h*c;i[0]=y-v*a,i[4]=-s*c,i[8]=x+p*a,i[1]=p+x*a,i[5]=s*u,i[9]=v-y*a,i[2]=-s*h,i[6]=a,i[10]=s*o}else if("ZYX"===t.order){var l=s*u,d=s*c,f=a*u,m=a*c;i[0]=o*u,i[4]=f*h-d,i[8]=l*h+m,i[1]=o*c,i[5]=m*h+l,i[9]=d*h-f,i[2]=-h,i[6]=a*o,i[10]=s*o}else if("YZX"===t.order){var g=s*o,b=s*h,w=a*o,M=a*h;i[0]=o*u,i[4]=M-g*c,i[8]=w*c+b,i[1]=c,i[5]=s*u,i[9]=-a*u,i[2]=-h*u,i[6]=b*c+w,i[10]=g-M*c}else if("XZY"===t.order){var g=s*o,b=s*h,w=a*o,M=a*h;i[0]=o*u,i[4]=-c,i[8]=h*u,i[1]=g*c+M,i[5]=s*u,i[9]=b*c-w,i[2]=w*c-b,i[6]=a*u,i[10]=M*c+g}return i[3]=0,i[7]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this},makeRotationFromQuaternion:function(t){var i=this.elements,e=t._x,r=t._y,n=t._z,s=t._w,a=e+e,o=r+r,h=n+n,u=e*a,c=e*o,l=e*h,d=r*o,f=r*h,m=n*h,y=s*a,p=s*o,x=s*h;return i[0]=1-(d+m),i[4]=c-x,i[8]=l+p,i[1]=c+x,i[5]=1-(u+m),i[9]=f-y,i[2]=l-p,i[6]=f+y,i[10]=1-(u+d),i[3]=0,i[7]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this},lookAt:function(){var t=new r,i=new r,e=new r;return function(r,n,s){var a=this.elements;return e.subVectors(r,n),0===e.lengthSq()&&(e.z=1),e.normalize(),t.crossVectors(s,e),0===t.lengthSq()&&(1===Math.abs(s.z)?e.x+=1e-4:e.z+=1e-4,e.normalize(),t.crossVectors(s,e)),t.normalize(),i.crossVectors(e,t),a[0]=t.x,a[4]=i.x,a[8]=e.x,a[1]=t.y,a[5]=i.y,a[9]=e.y,a[2]=t.z,a[6]=i.z,a[10]=e.z,this}}(),multiply:function(t,i){return void 0!==i?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,i)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,i){var e=t.elements,r=i.elements,n=this.elements,s=e[0],a=e[4],o=e[8],h=e[12],u=e[1],c=e[5],l=e[9],d=e[13],f=e[2],m=e[6],y=e[10],p=e[14],x=e[3],v=e[7],g=e[11],b=e[15],w=r[0],M=r[4],z=r[8],_=r[12],A=r[1],S=r[5],N=r[9],k=r[13],E=r[2],U=r[6],V=r[10],B=r[14],C=r[3],T=r[7],O=r[11],F=r[15];return n[0]=s*w+a*A+o*E+h*C,n[4]=s*M+a*S+o*U+h*T,n[8]=s*z+a*N+o*V+h*O,n[12]=s*_+a*k+o*B+h*F,n[1]=u*w+c*A+l*E+d*C,n[5]=u*M+c*S+l*U+d*T,n[9]=u*z+c*N+l*V+d*O,n[13]=u*_+c*k+l*B+d*F,n[2]=f*w+m*A+y*E+p*C,n[6]=f*M+m*S+y*U+p*T,n[10]=f*z+m*N+y*V+p*O,n[14]=f*_+m*k+y*B+p*F,n[3]=x*w+v*A+g*E+b*C,n[7]=x*M+v*S+g*U+b*T,n[11]=x*z+v*N+g*V+b*O,n[15]=x*_+v*k+g*B+b*F,this},multiplyScalar:function(t){var i=this.elements;return i[0]*=t,i[4]*=t,i[8]*=t,i[12]*=t,i[1]*=t,i[5]*=t,i[9]*=t,i[13]*=t,i[2]*=t,i[6]*=t,i[10]*=t,i[14]*=t,i[3]*=t,i[7]*=t,i[11]*=t,i[15]*=t,this},applyToBufferAttribute:function(){var t=new r;return function(i){for(var e=0,r=i.count;e=0?1:-1,v=1-p*p;if(v>Number.EPSILON){var g=Math.sqrt(v),b=Math.atan2(g,p*x);y=Math.sin(y*b)/g,a=Math.sin(a*b)/g}var w=a*x;if(o=o*y+l*w,h=h*y+d*w,u=u*y+f*w,c=c*y+m*w,y===1-a){var M=1/Math.sqrt(o*o+h*h+u*u+c*c);o*=M,h*=M,u*=M,c*=M}}t[i]=o,t[i+1]=h,t[i+2]=u,t[i+3]=c}}),Object.defineProperties(e.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(e.prototype,{set:function(t,i,e,r){return this._x=t,this._y=i,this._z=e,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,i){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var e=t._x,r=t._y,n=t._z,s=t.order,a=Math.cos,o=Math.sin,h=a(e/2),u=a(r/2),c=a(n/2),l=o(e/2),d=o(r/2),f=o(n/2);return"XYZ"===s?(this._x=l*u*c+h*d*f,this._y=h*d*c-l*u*f,this._z=h*u*f+l*d*c,this._w=h*u*c-l*d*f):"YXZ"===s?(this._x=l*u*c+h*d*f,this._y=h*d*c-l*u*f,this._z=h*u*f-l*d*c,this._w=h*u*c+l*d*f):"ZXY"===s?(this._x=l*u*c-h*d*f,this._y=h*d*c+l*u*f,this._z=h*u*f+l*d*c,this._w=h*u*c-l*d*f):"ZYX"===s?(this._x=l*u*c-h*d*f,this._y=h*d*c+l*u*f,this._z=h*u*f-l*d*c,this._w=h*u*c+l*d*f):"YZX"===s?(this._x=l*u*c+h*d*f,this._y=h*d*c+l*u*f,this._z=h*u*f-l*d*c,this._w=h*u*c-l*d*f):"XZY"===s&&(this._x=l*u*c-h*d*f,this._y=h*d*c-l*u*f,this._z=h*u*f+l*d*c,this._w=h*u*c+l*d*f),!1!==i&&this.onChangeCallback(),this},setFromAxisAngle:function(t,i){var e=i/2,r=Math.sin(e);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(e),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var i,e=t.elements,r=e[0],n=e[4],s=e[8],a=e[1],o=e[5],h=e[9],u=e[2],c=e[6],l=e[10],d=r+o+l;return d>0?(i=.5/Math.sqrt(d+1),this._w=.25/i,this._x=(c-h)*i,this._y=(s-u)*i,this._z=(a-n)*i):r>o&&r>l?(i=2*Math.sqrt(1+r-o-l),this._w=(c-h)/i,this._x=.25*i,this._y=(n+a)/i,this._z=(s+u)/i):o>l?(i=2*Math.sqrt(1+o-r-l),this._w=(s-u)/i,this._x=(n+a)/i,this._y=.25*i,this._z=(h+c)/i):(i=2*Math.sqrt(1+l-r-o),this._w=(a-n)/i,this._x=(s+u)/i,this._y=(h+c)/i,this._z=.25*i),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,i=new r;return function(e,n){return void 0===i&&(i=new r),t=e.dot(n)+1,t<1e-6?(t=0,Math.abs(e.x)>Math.abs(e.z)?i.set(-e.y,e.x,0):i.set(0,-e.z,e.y)):i.crossVectors(e,n),this._x=i.x,this._y=i.y,this._z=i.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,i){return void 0!==i?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,i)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,i){var e=t._x,r=t._y,n=t._z,s=t._w,a=i._x,o=i._y,h=i._z,u=i._w;return this._x=e*u+s*a+r*h-n*o,this._y=r*u+s*o+n*a-e*h,this._z=n*u+s*h+e*o-r*a,this._w=s*u-e*a-r*o-n*h,this.onChangeCallback(),this},slerp:function(t,i){if(0===i)return this;if(1===i)return this.copy(t);var e=this._x,r=this._y,n=this._z,s=this._w,a=s*t._w+e*t._x+r*t._y+n*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=e,this._y=r,this._z=n,this;var o=Math.sqrt(1-a*a);if(Math.abs(o)<.001)return this._w=.5*(s+this._w),this._x=.5*(e+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var h=Math.atan2(o,a),u=Math.sin((1-i)*h)/o,c=Math.sin(i*h)/o;return this._w=s*u+this._w*c,this._x=e*u+this._x*c,this._y=r*u+this._y*c,this._z=n*u+this._z*c,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,i){return void 0===i&&(i=0),this._x=t[i],this._y=t[i+1],this._z=t[i+2],this._w=t[i+3],this.onChangeCallback(),this},toArray:function(t,i){return void 0===t&&(t=[]),void 0===i&&(i=0),t[i]=this._x,t[i+1]=this._y,t[i+2]=this._z,t[i+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(r.prototype,{isVector3:!0,set:function(t,i,e){return this.x=t,this.y=i,this.z=e,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,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;case 2:this.z=i;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,i)):(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,i){return this.x=t.x+i.x,this.y=t.y+i.y,this.z=t.z+i.z,this},addScaledVector:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this.z+=t.z*i,this},sub:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,i)):(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,i){return this.x=t.x-i.x,this.y=t.y-i.y,this.z=t.z-i.z,this},multiply:function(t,i){return void 0!==i?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,i)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,i){return this.x=t.x*i.x,this.y=t.y*i.y,this.z=t.z*i.z,this},applyEuler:function(){var t=new e;return function(i){return i&&i.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(i))}}(),applyAxisAngle:function(){var t=new e;return function(i,e){return this.applyQuaternion(t.setFromAxisAngle(i,e))}}(),applyMatrix3:function(t){var i=this.x,e=this.y,r=this.z,n=t.elements;return this.x=n[0]*i+n[3]*e+n[6]*r,this.y=n[1]*i+n[4]*e+n[7]*r,this.z=n[2]*i+n[5]*e+n[8]*r,this},applyMatrix4:function(t){var i=this.x,e=this.y,r=this.z,n=t.elements,s=1/(n[3]*i+n[7]*e+n[11]*r+n[15]);return this.x=(n[0]*i+n[4]*e+n[8]*r+n[12])*s,this.y=(n[1]*i+n[5]*e+n[9]*r+n[13])*s,this.z=(n[2]*i+n[6]*e+n[10]*r+n[14])*s,this},applyQuaternion:function(t){var i=this.x,e=this.y,r=this.z,n=t.x,s=t.y,a=t.z,o=t.w,h=o*i+s*r-a*e,u=o*e+a*i-n*r,c=o*r+n*e-s*i,l=-n*i-s*e-a*r;return this.x=h*o+l*-n+u*-a-c*-s,this.y=u*o+l*-s+c*-n-h*-a,this.z=c*o+l*-a+h*-s-u*-n,this},project:function(){var t=new i;return function(i){return t.multiplyMatrices(i.projectionMatrix,t.getInverse(i.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new i;return function(i){return t.multiplyMatrices(i.matrixWorld,t.getInverse(i.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var i=this.x,e=this.y,r=this.z,n=t.elements;return this.x=n[0]*i+n[4]*e+n[8]*r,this.y=n[1]*i+n[5]*e+n[9]*r,this.z=n[2]*i+n[6]*e+n[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this},clampScalar:function(){var t=new r,i=new r;return function(e,r){return t.set(e,e,e),i.set(r,r,r),this.clamp(t,i)}}(),clampLength:function(t,i){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(i,e)))},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()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this},lerpVectors:function(t,i,e){return this.subVectors(i,t).multiplyScalar(e).add(t)},cross:function(t,i){if(void 0!==i)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,i);var e=this.x,r=this.y,n=this.z;return this.x=r*t.z-n*t.y,this.y=n*t.x-e*t.z,this.z=e*t.y-r*t.x,this},crossVectors:function(t,i){var e=t.x,r=t.y,n=t.z,s=i.x,a=i.y,o=i.z;return this.x=r*o-n*a,this.y=n*s-e*o,this.z=e*a-r*s,this},projectOnVector:function(t){var i=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(i)},projectOnPlane:function(){var t=new r;return function(i){return t.copy(this).projectOnVector(i),this.sub(t)}}(),reflect:function(){var t=new r;return function(i){return this.sub(t.copy(i).multiplyScalar(2*this.dot(i)))}}(),angleTo:function(t){var i=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(k.clamp(i,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var i=this.x-t.x,e=this.y-t.y,r=this.z-t.z;return i*i+e*e+r*r},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 i=Math.sin(t.phi)*t.radius;return this.x=i*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=i*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var i=t.elements;return this.x=i[12],this.y=i[13],this.z=i[14],this},setFromMatrixScale:function(t){var i=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=i,this.y=e,this.z=r,this},setFromMatrixColumn:function(t,i){return this.fromArray(t.elements,4*i)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,i){return void 0===i&&(i=0),this.x=t[i],this.y=t[i+1],this.z=t[i+2],this},toArray:function(t,i){return void 0===t&&(t=[]),void 0===i&&(i=0),t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t},fromBufferAttribute:function(t,i,e){return void 0!==e&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this}}),Object.assign(n.prototype,{set:function(t,i){return this.center.copy(t),this.radius=i,this},setFromPoints:function(){var t=new s;return function(i,e){var r=this.center;void 0!==e?r.copy(e):t.setFromPoints(i).getCenter(r);for(var n=0,s=0,a=i.length;sthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var i=t||new s;return i.set(this.center,this.center),i.expandByScalar(this.radius),i},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(s.prototype,{isBox3:!0,set:function(t,i){return this.min.copy(t),this.max.copy(i),this},setFromArray:function(t){for(var i=1/0,e=1/0,r=1/0,n=-1/0,s=-1/0,a=-1/0,o=0,h=t.length;on&&(n=u),c>s&&(s=c),l>a&&(a=l)}return this.min.set(i,e,r),this.max.set(n,s,a),this},setFromBufferAttribute:function(t){for(var i=1/0,e=1/0,r=1/0,n=-1/0,s=-1/0,a=-1/0,o=0,h=t.count;on&&(n=u),c>s&&(s=c),l>a&&(a=l)}return this.min.set(i,e,r),this.max.set(n,s,a),this},setFromPoints:function(t){this.makeEmpty();for(var i=0,e=t.length;ithis.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,i){return(i||new r).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(){var t=new r;return function(i){return this.clampPoint(i.center,t),t.distanceToSquared(i.center)<=i.radius*i.radius}}(),intersectsPlane:function(t){var i,e;return t.normal.x>0?(i=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(i=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(i+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(i+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(i+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(i+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),i<=t.constant&&e>=t.constant},clampPoint:function(t,i){return(i||new r).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r;return function(i){return t.copy(i).clamp(this.min,this.max).sub(i).length()}}(),getBoundingSphere:function(){var t=new r;return function(i){var e=i||new n;return this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),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,new r,new r,new r,new r,new r,new r,new r];return function(i){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(i),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(i),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(i),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(i),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(i),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(i),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(i),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(i),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(a.prototype,{addEventListener:function(t,i){void 0===this._listeners&&(this._listeners={});var e=this._listeners;void 0===e[t]&&(e[t]=[]),-1===e[t].indexOf(i)&&e[t].push(i)},hasEventListener:function(t,i){if(void 0===this._listeners)return!1;var e=this._listeners;return void 0!==e[t]&&-1!==e[t].indexOf(i)},removeEventListener:function(t,i){if(void 0!==this._listeners){var e=this._listeners[t];if(void 0!==e){var r=e.indexOf(i);-1!==r&&e.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var i=this._listeners[t.type];if(void 0!==i){t.target=this;for(var e=i.slice(0),r=0,n=e.length;rp&&y>x?y<.01?(e=0,r=.707106781,n=.707106781):(r=v/(e=Math.sqrt(y)),n=g/e):p>x?p<.01?(e=.707106781,r=0,n=.707106781):(e=v/(r=Math.sqrt(p)),n=b/r):x<.01?(e=.707106781,r=.707106781,n=0):(e=g/(n=Math.sqrt(x)),r=b/n),this.set(e,r,n,i),this}var w=Math.sqrt((f-l)*(f-l)+(h-d)*(h-d)+(u-o)*(u-o));return Math.abs(w)<.001&&(w=1),this.x=(f-l)/w,this.y=(h-d)/w,this.z=(u-o)/w,this.w=Math.acos((a+c+m-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this.z=Math.max(t.z,Math.min(i.z,this.z)),this.w=Math.max(t.w,Math.min(i.w,this.w)),this},clampScalar:function(){var t,i;return function(e,r){return void 0===t&&(t=new o,i=new o),t.set(e,e,e,e),i.set(r,r,r,r),this.clamp(t,i)}}(),clampLength:function(t,i){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(i,e)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this.z+=(t.z-this.z)*i,this.w+=(t.w-this.w)*i,this},lerpVectors:function(t,i,e){return this.subVectors(i,t).multiplyScalar(e).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,i){return void 0===i&&(i=0),this.x=t[i],this.y=t[i+1],this.z=t[i+2],this.w=t[i+3],this},toArray:function(t,i){return void 0===t&&(t=[]),void 0===i&&(i=0),t[i]=this.x,t[i+1]=this.y,t[i+2]=this.z,t[i+3]=this.w,t},fromBufferAttribute:function(t,i,e){return void 0!==e&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(i),this.y=t.getY(i),this.z=t.getZ(i),this.w=t.getW(i),this}}),Object.defineProperties(h.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(h.prototype,{isVector2:!0,set:function(t,i){return this.x=t,this.y=i,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,i){switch(t){case 0:this.x=i;break;case 1:this.y=i;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,i){return void 0!==i?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,i)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,i){return this.x=t.x+i.x,this.y=t.y+i.y,this},addScaledVector:function(t,i){return this.x+=t.x*i,this.y+=t.y*i,this},sub:function(t,i){return void 0!==i?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,i)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,i){return this.x=t.x-i.x,this.y=t.y-i.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,i){return this.x=Math.max(t.x,Math.min(i.x,this.x)),this.y=Math.max(t.y,Math.min(i.y,this.y)),this},clampScalar:function(){var t=new h,i=new h;return function(e,r){return t.set(e,e),i.set(r,r),this.clamp(t,i)}}(),clampLength:function(t,i){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(i,e)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var i=this.x-t.x,e=this.y-t.y;return i*i+e*e},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,i){return this.x+=(t.x-this.x)*i,this.y+=(t.y-this.y)*i,this},lerpVectors:function(t,i,e){return this.subVectors(i,t).multiplyScalar(e).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,i){return void 0===i&&(i=0),this.x=t[i],this.y=t[i+1],this},toArray:function(t,i){return void 0===t&&(t=[]),void 0===i&&(i=0),t[i]=this.x,t[i+1]=this.y,t},fromBufferAttribute:function(t,i,e){return void 0!==e&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(i),this.y=t.getY(i),this},rotateAround:function(t,i){var e=Math.cos(i),r=Math.sin(i),n=this.x-t.x,s=this.y-t.y;return this.x=n*e-s*r+t.x,this.y=n*r+s*e+t.y,this}});var E={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(u.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,i,e){return this.r=t,this.g=i,this.b=e,this},setHSL:function(){function t(t,i,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(i-t)*e:e<.5?i:e<2/3?t+6*(i-t)*(2/3-e):t}return function(i,e,r){if(i=k.euclideanModulo(i,1),e=k.clamp(e,0,1),r=k.clamp(r,0,1),0===e)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+e):r+e-r*e,s=2*r-n;this.r=t(s,n,i+1/3),this.g=t(s,n,i),this.b=t(s,n,i-1/3)}return this}}(),setStyle:function(t){function i(i){void 0!==i&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var e;if(e=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,n=e[1],s=e[2];switch(n){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,i(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,i(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(s)){var a=parseFloat(r[1])/360,o=parseInt(r[2],10)/100,h=parseInt(r[3],10)/100;return i(r[5]),this.setHSL(a,o,h)}}}else if(e=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=(c=e[1]).length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}if(t&&t.length>0){var c=E[t];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,i){return void 0===i&&(i=2),this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},copyLinearToGamma:function(t,i){void 0===i&&(i=2);var e=i>0?1/i:1;return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},convertGammaToLinear:function(){var t=this.r,i=this.g,e=this.b;return this.r=t*t,this.g=i*i,this.b=e*e,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 i,e,r=t||{h:0,s:0,l:0},n=this.r,s=this.g,a=this.b,o=Math.max(n,s,a),h=Math.min(n,s,a),u=(h+o)/2;if(h===o)i=0,e=0;else{var c=o-h;switch(e=u<=.5?c/(o+h):c/(2-o-h),o){case n:i=(s-a)/c+(s0,a=n[1]&&n[1].length>0,o=t.morphTargets,u=o.length;if(u>0){i=[];for(x=0;x0){c=[];for(x=0;x1){for(var i=0;i1){for(var i=0;i0){s.children=[];for(o=0;o0&&(n.geometries=u),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),d.length>0&&(n.images=d)}return n.object=s,n},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,i){if(void 0===i&&(i=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===i)for(var e=0;e0)for(p=0;p0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,i,e;for(this.computeFaceNormals(),t=0,i=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,i,e,n,s;for(e=0,n=this.faces.length;e0&&(t+=i[e].distanceTo(i[e-1])),this.lineDistances[e]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new s),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new n),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,i,e){if(!t||!t.isGeometry)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var r,n=this.vertices.length,s=this.vertices,a=t.vertices,o=this.faces,h=t.faces,u=this.faceVertexUvs[0],c=t.faceVertexUvs[0],l=this.colors,d=t.colors;void 0===e&&(e=0),void 0!==i&&(r=(new x).getNormalMatrix(i));for(var f=0,m=a.length;f=0;e--){var m=d[e];for(this.faces.splice(m,1),a=0,o=this.faceVertexUvs.length;a0,b=x.vertexNormals.length>0,w=1!==x.color.r||1!==x.color.g||1!==x.color.b,M=x.vertexColors.length>0,z=0;if(z=t(z,0,0),z=t(z,1,!0),z=t(z,2,!1),z=t(z,3,v),z=t(z,4,g),z=t(z,5,b),z=t(z,6,w),z=t(z,7,M),c.push(z),c.push(x.a,x.b,x.c),c.push(x.materialIndex),v){var _=this.faceVertexUvs[0][h];c.push(r(_[0]),r(_[1]),r(_[2]))}if(g&&c.push(i(x.normal)),b){var A=x.vertexNormals;c.push(i(A[0]),i(A[1]),i(A[2]))}if(w&&c.push(e(x.color)),M){var S=x.vertexColors;c.push(e(S[0]),e(S[1]),e(S[2]))}}return n.data={},n.data.vertices=o,n.data.normals=l,f.length>0&&(n.data.colors=f),y.length>0&&(n.data.uvs=[y]),n.data.faces=c,n},clone:function(){return(new M).copy(this)},copy:function(t){var i,e,r,n,s,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var o=t.vertices;for(i=0,e=o.length;i65535?d:l)(t,1):this.index=t},addAttribute:function(t,i){return i&&i.isBufferAttribute||i&&i.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(i)):(this.attributes[t]=i,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new c(arguments[1],arguments[2])))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,i,e){this.groups.push({start:t,count:i,materialIndex:void 0!==e?e:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,i){this.drawRange.start=t,this.drawRange.count=i},applyMatrix:function(t){var i=this.attributes.position;void 0!==i&&(t.applyToBufferAttribute(i),i.needsUpdate=!0);var e=this.attributes.normal;return void 0!==e&&((new x).getNormalMatrix(t).applyToBufferAttribute(e),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new i;return function(i){return t.makeRotationX(i),this.applyMatrix(t),this}}(),rotateY:function(){var t=new i;return function(i){return t.makeRotationY(i),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new i;return function(i){return t.makeRotationZ(i),this.applyMatrix(t),this}}(),translate:function(){var t=new i;return function(i,e,r){return t.makeTranslation(i,e,r),this.applyMatrix(t),this}}(),scale:function(){var t=new i;return function(i,e,r){return t.makeScale(i,e,r),this.applyMatrix(t),this}}(),lookAt:function(){var t=new v;return function(i){t.lookAt(i),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var i=t.geometry;if(t.isPoints||t.isLine){var e=new f(3*i.vertices.length,3),r=new f(3*i.colors.length,3);if(this.addAttribute("position",e.copyVector3sArray(i.vertices)),this.addAttribute("color",r.copyColorsArray(i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){var n=new f(i.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(i.lineDistances))}null!==i.boundingSphere&&(this.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(this.boundingBox=i.boundingBox.clone())}else t.isMesh&&i&&i.isGeometry&&this.fromGeometry(i);return this},updateFromObject:function(t){var i=t.geometry;if(t.isMesh){var e=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(e=void 0,i.elementsNeedUpdate=!1),void 0===e)return this.fromGeometry(i);e.verticesNeedUpdate=i.verticesNeedUpdate,e.normalsNeedUpdate=i.normalsNeedUpdate,e.colorsNeedUpdate=i.colorsNeedUpdate,e.uvsNeedUpdate=i.uvsNeedUpdate,e.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=e}var r;return!0===i.verticesNeedUpdate&&(void 0!==(r=this.attributes.position)&&(r.copyVector3sArray(i.vertices),r.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(r=this.attributes.normal)&&(r.copyVector3sArray(i.normals),r.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(r=this.attributes.color)&&(r.copyColorsArray(i.colors),r.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(r=this.attributes.uv)&&(r.copyVector2sArray(i.uvs),r.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(r=this.attributes.lineDistance)&&(r.copyArray(i.lineDistances),r.needsUpdate=!0),i.lineDistancesNeedUpdate=!1),i.groupsNeedUpdate&&(i.computeGroups(t.geometry),this.groups=i.groups,i.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new m).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var i=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new c(i,3).copyVector3sArray(t.vertices)),t.normals.length>0){var e=new Float32Array(3*t.normals.length);this.addAttribute("normal",new c(e,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.addAttribute("color",new c(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var n=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new c(n,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var s=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new c(s,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=new(g(t.indices)>65535?Uint32Array:Uint16Array)(3*t.indices.length);this.setIndex(new c(a,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var o in t.morphTargets){for(var h=[],u=t.morphTargets[o],l=0,d=u.length;l0){var p=new f(4*t.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var x=new f(4*t.skinWeights.length,4);this.addAttribute("skinWeight",x.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 s);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new s,i=new r;return function(){null===this.boundingSphere&&(this.boundingSphere=new n);var e=this.attributes.position;if(e){var r=this.boundingSphere.center;t.setFromBufferAttribute(e),t.getCenter(r);for(var s=0,a=0,o=e.count;a0&&(t.data.groups=JSON.parse(JSON.stringify(o)));var h=this.boundingSphere;return null!==h&&(t.data.boundingSphere={center:h.center.toArray(),radius:h.radius}),t},clone:function(){return(new z).copy(this)},copy:function(t){var i,e,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone());var s=t.attributes;for(i in s){var a=s[i];this.addAttribute(i,a.clone())}var o=t.morphAttributes;for(i in o){var h=[],u=o[i];for(e=0,r=u.length;e