2 lines
495 KiB
JavaScript
2 lines
495 KiB
JavaScript
/* 2020-9-22 15:23:18 | 版权所有 军懋国兴 */
|
|
function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE=t.THREE||{})}(this,function(t){"use strict";function e(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:0<t?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&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}),Object.assign(e.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)},removeEventListener:function(t,e){var i,n;void 0!==this._listeners&&(void 0===(i=this._listeners[t])||-1!==(n=i.indexOf(e))&&i.splice(n,1))},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var i=e.slice(0),n=0,r=i.length;n<r;n++)i[n].call(this,t)}}}});var i,n,r,a,o,s,V=0,k=1,j=2,F=1,B=2,z=0,W=1,X=2,Rt=1,c=2,Lt=0,q=0,Y=1,Z=2,J=3,Q=4,K=5,Pt=100,Ct=204,It=205,$=0,tt=1,et=2,it=3,nt=4,rt=5,at=6,ot=7,G=0,H=1,st=2,ct=0,Ut=1,ht=2,lt=3,ut=4,dt=301,pt=302,ft=303,mt=304,gt=305,vt=306,yt=307,Nt=1e3,Ot=1001,Dt=1002,Ft=1003,Bt=1004,zt=1005,Gt=1006,Ht=1008,Vt=1009,kt=1012,jt=1014,Wt=1015,Xt=1016,qt=1020,Yt=1022,Zt=1023,h=Zt,Jt=1026,Qt=1027,l=2300,u=2301,d=2400,p=2401,f=2402,Kt=0,m=3e3,g=3001,v=3007,y=3002,x=3004,_=3005,b=3006,w=3200,xt=3201,$t={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:(n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),a=0,function(){for(var t=0;t<36;t++)8===t||13===t||18===t||23===t?r[t]="-":14===t?r[t]="4":(a<=2&&(a=33554432+16777216*Math.random()|0),i=15&a,a>>=4,r[t]=n[19===t?3&i|8:i]);return r.join("")}),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*$t.DEG2RAD},radToDeg:function(t){return t*$t.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}};function _t(t,e){this.x=t||0,this.y=e||0}Object.defineProperties(_t.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(_t.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(o=new _t,s=new _t,function(t,e){return o.set(t,t),s.set(e,e),this.clamp(o,s)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(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 e=this.x-t.x,i=this.y-t.y;return e*e+i*i},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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}});var M,E,T,S,A,R,L,P,C,I,U,N,O,D,bt,wt,Mt,Et,Tt,St=0;function At(t,e,i,n,r,a,o,s,c,h){Object.defineProperty(this,"id",{value:St++}),this.uuid=$t.generateUUID(),this.name="",this.image=void 0!==t?t:At.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:At.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:Ot,this.wrapT=void 0!==n?n:Ot,this.magFilter=void 0!==r?r:Gt,this.minFilter=void 0!==a?a:Ht,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Zt,this.type=void 0!==s?s:Vt,this.offset=new _t(0,0),this.repeat=new _t(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:m,this.version=0,this.onUpdate=null}function te(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function ee(t,e,i){this.uuid=$t.generateUUID(),this.width=t,this.height=e,this.scissor=new te(0,0,t,e),this.scissorTest=!1,this.viewport=new te(0,0,t,e),void 0===(i=i||{}).minFilter&&(i.minFilter=Gt),this.texture=new At(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function ie(t,e,i){ee.call(this,t,e,i),this.activeCubeFace=0,this.activeMipMapLevel=0}function ne(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function re(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function ae(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function oe(t,e,i,n,r,a,o,s,c,h,l,u){At.call(this,null,a,o,s,c,h,n,r,l,u),this.image={data:t,width:e,height:i},this.magFilter=void 0!==c?c:Ft,this.minFilter=void 0!==h?h:Ft,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function se(t,e,i,n,r,a,o,s,c,h){At.call(this,t=void 0!==t?t:[],e=void 0!==e?e:dt,i,n,r,a,o,s,c,h),this.flipY=!1}At.DEFAULT_IMAGE=void 0,At.DEFAULT_MAPPING=300,Object.defineProperty(At.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(At.prototype,e.prototype,{constructor:At,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e,i,n,r={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};return void 0!==this.image&&(void 0===(e=this.image).uuid&&(e.uuid=$t.generateUUID()),void 0===t.images[e.uuid]&&(t.images[e.uuid]={uuid:e.uuid,url:(void 0!==(i=e).toDataURL?n=i:((n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0,i.width,i.height)),2048<n.width||2048<n.height?n.toDataURL("image/jpeg",.6):n.toDataURL("image/png"))}),r.image=e.uuid),t.textures[this.uuid]=r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||1<t.x)switch(this.wrapS){case Nt:t.x=t.x-Math.floor(t.x);break;case Ot:t.x=t.x<0?0:1;break;case Dt: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||1<t.y)switch(this.wrapT){case Nt:t.y=t.y-Math.floor(t.y);break;case Ot:t.y=t.y<0?0:1;break;case Dt: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(te.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,a=t.elements,o=a[0],s=a[4],c=a[8],h=a[1],l=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-h)<.01&&Math.abs(c-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+d)<.1&&Math.abs(u+p)<.1&&Math.abs(o+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,g=(l+1)/2,v=(f+1)/2,y=(s+h)/4,x=(c+d)/4,_=(u+p)/4;return g<m&&v<m?r=m<.01?(i=0,n=.707106781):(n=y/(i=Math.sqrt(m)),x/i):v<g?r=g<.01?(n=0,i=.707106781):(i=y/(n=Math.sqrt(g)),_/n):v<.01?(n=i=.707106781,r=0):(i=x/(r=Math.sqrt(v)),n=_/r),this.set(i,n,r,e),this}var b=Math.sqrt((p-u)*(p-u)+(c-d)*(c-d)+(h-s)*(h-s));return Math.abs(b)<.001&&(b=1),this.x=(p-u)/b,this.y=(c-d)/b,this.z=(h-s)/b,this.w=Math.acos((o+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return void 0===M&&(M=new te,E=new te),M.set(t,t,t,t),E.set(e,e,e,e),this.clamp(M,E)},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},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,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(ee.prototype,e.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((ie.prototype=Object.create(ee.prototype)).constructor=ie).prototype.isWebGLRenderTargetCube=!0,Object.assign(ne,{slerp:function(t,e,i,n){return i.copy(t).slerp(e,n)},slerpFlat:function(t,e,i,n,r,a,o){var s,c,h,l,u,d,p,f,m=i[n+0],g=i[n+1],v=i[n+2],y=i[n+3],x=r[a+0],_=r[a+1],b=r[a+2],w=r[a+3];y===w&&m===x&&g===_&&v===b||(d=1-o,c=0<=(s=m*x+g*_+v*b+y*w)?1:-1,(h=1-s*s)>Number.EPSILON&&(l=Math.sqrt(h),u=Math.atan2(l,s*c),d=Math.sin(d*u)/l,o=Math.sin(o*u)/l),m=m*d+x*(p=o*c),g=g*d+_*p,v=v*d+b*p,y=y*d+w*p,d===1-o&&(m*=f=1/Math.sqrt(m*m+g*g+v*v+y*y),g*=f,v*=f,y*=f)),t[e]=m,t[e+1]=g,t[e+2]=v,t[e+3]=y}}),Object.defineProperties(ne.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(ne.prototype,{set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(i/2),h=o(n/2),l=o(r/2),u=s(i/2),d=s(n/2),p=s(r/2);return"XYZ"===a?(this._x=u*h*l+c*d*p,this._y=c*d*l-u*h*p,this._z=c*h*p+u*d*l,this._w=c*h*l-u*d*p):"YXZ"===a?(this._x=u*h*l+c*d*p,this._y=c*d*l-u*h*p,this._z=c*h*p-u*d*l,this._w=c*h*l+u*d*p):"ZXY"===a?(this._x=u*h*l-c*d*p,this._y=c*d*l+u*h*p,this._z=c*h*p+u*d*l,this._w=c*h*l-u*d*p):"ZYX"===a?(this._x=u*h*l-c*d*p,this._y=c*d*l+u*h*p,this._z=c*h*p-u*d*l,this._w=c*h*l+u*d*p):"YZX"===a?(this._x=u*h*l+c*d*p,this._y=c*d*l+u*h*p,this._z=c*h*p-u*d*l,this._w=c*h*l-u*d*p):"XZY"===a&&(this._x=u*h*l-c*d*p,this._y=c*d*l-u*h*p,this._z=c*h*p+u*d*l,this._w=c*h*l+u*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],d=n+s+u;return 0<d?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(l-c)*e,this._y=(a-h)*e,this._z=(o-r)*e):s<n&&u<n?(e=2*Math.sqrt(1+n-s-u),this._w=(l-c)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+h)/e):u<s?(e=2*Math.sqrt(1+s-n-u),this._w=(a-h)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+h)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:(S=new re,function(t,e){return void 0===S&&(S=new re),(T=t.dot(e)+1)<1e-6?(T=0,Math.abs(t.x)>Math.abs(t.z)?S.set(-t.y,t.x,0):S.set(0,-t.z,t.y)):S.crossVectors(t,e),this._x=S.x,this._y=S.y,this._z=S.z,this._w=T,this.normalize()}),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,h=e._w;return this._x=i*h+a*o+n*c-r*s,this._y=n*h+a*s+r*o-i*c,this._z=r*h+a*c+i*s-n*o,this._w=a*h-i*o-n*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*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),1<=o)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(n+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),h=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=a*h+this._w*l,this._x=i*h+this._x*l,this._y=n*h+this._y*l,this._z=r*h+this._z*l,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(re.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(N=new ne,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(N.setFromEuler(t))}),applyAxisAngle:(U=new ne,function(t,e){return this.applyQuaternion(U.setFromAxisAngle(t,e))}),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*n-o*i,h=s*i+o*e-r*n,l=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=c*s+u*-r+h*-o-l*-a,this.y=h*s+u*-a+l*-r-c*-o,this.z=l*s+u*-o+c*-a-h*-r,this},project:(I=new ae,function(t){return I.multiplyMatrices(t.projectionMatrix,I.getInverse(t.matrixWorld)),this.applyMatrix4(I)}),unproject:(C=new ae,function(t){return C.multiplyMatrices(t.matrixWorld,C.getInverse(t.projectionMatrix)),this.applyMatrix4(C)}),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,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:(L=new re,P=new re,function(t,e){return L.set(t,t,t),P.set(e,e,e),this.clamp(L,P)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(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,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,i){return this.subVectors(e,t).multiplyScalar(i).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 i=this.x,n=this.y,r=this.z;return this.x=n*t.z-r*t.y,this.y=r*t.x-i*t.z,this.z=i*t.y-n*t.x,this},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(R=new re,function(t){return R.copy(this).projectOnVector(t),this.sub(R)}),reflect:(A=new re,function(t){return this.sub(A.copy(t).multiplyScalar(2*this.dot(t)))}),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos($t.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},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},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(ae.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,c,h,l,u,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=h,g[10]=l,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new ae).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:(Tt=new re,function(t){var e=this.elements,i=t.elements,n=1/Tt.setFromMatrixColumn(t,0).length(),r=1/Tt.setFromMatrixColumn(t,1).length(),a=1/Tt.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[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 e,i,n,r,a,o,s,c,h,l,u,d,p=this.elements,f=t.x,m=t.y,g=t.z,v=Math.cos(f),y=Math.sin(f),x=Math.cos(m),_=Math.sin(m),b=Math.cos(g),w=Math.sin(g);return"XYZ"===t.order?(a=v*b,o=v*w,s=y*b,c=y*w,p[0]=x*b,p[4]=-x*w,p[8]=_,p[1]=o+s*_,p[5]=a-c*_,p[9]=-y*x,p[2]=c-a*_,p[6]=s+o*_,p[10]=v*x):"YXZ"===t.order?(e=x*b,i=x*w,n=_*b,r=_*w,p[0]=e+r*y,p[4]=n*y-i,p[8]=v*_,p[1]=v*w,p[5]=v*b,p[9]=-y,p[2]=i*y-n,p[6]=r+e*y,p[10]=v*x):"ZXY"===t.order?(e=x*b,i=x*w,n=_*b,r=_*w,p[0]=e-r*y,p[4]=-v*w,p[8]=n+i*y,p[1]=i+n*y,p[5]=v*b,p[9]=r-e*y,p[2]=-v*_,p[6]=y,p[10]=v*x):"ZYX"===t.order?(a=v*b,o=v*w,s=y*b,c=y*w,p[0]=x*b,p[4]=s*_-o,p[8]=a*_+c,p[1]=x*w,p[5]=c*_+a,p[9]=o*_-s,p[2]=-_,p[6]=y*x,p[10]=v*x):"YZX"===t.order?(h=v*x,l=v*_,u=y*x,d=y*_,p[0]=x*b,p[4]=d-h*w,p[8]=u*w+l,p[1]=w,p[5]=v*b,p[9]=-y*b,p[2]=-_*b,p[6]=l*w+u,p[10]=h-d*w):"XZY"===t.order&&(h=v*x,l=v*_,u=y*x,d=y*_,p[0]=x*b,p[4]=-w,p[8]=_*b,p[1]=h*w+d,p[5]=v*b,p[9]=l*w-u,p[2]=u*w-l,p[6]=y*b,p[10]=d*w+h),p[3]=0,p[7]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,i=t._x,n=t._y,r=t._z,a=t._w,o=i+i,s=n+n,c=r+r,h=i*o,l=i*s,u=i*c,d=n*s,p=n*c,f=r*c,m=a*o,g=a*s,v=a*c;return e[0]=1-(d+f),e[4]=l-v,e[8]=u+g,e[1]=l+v,e[5]=1-(h+f),e[9]=p-m,e[2]=u-g,e[6]=p+m,e[10]=1-(h+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:(wt=new re,Mt=new re,Et=new re,function(t,e,i){var n=this.elements;return Et.subVectors(t,e),0===Et.lengthSq()&&(Et.z=1),Et.normalize(),wt.crossVectors(i,Et),0===wt.lengthSq()&&(1===Math.abs(i.z)?Et.x+=1e-4:Et.z+=1e-4,Et.normalize(),wt.crossVectors(i,Et)),wt.normalize(),Mt.crossVectors(Et,wt),n[0]=wt.x,n[4]=Mt.x,n[8]=Et.x,n[1]=wt.y,n[5]=Mt.y,n[9]=Et.y,n[2]=wt.z,n[6]=Mt.z,n[10]=Et.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 i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],_=i[15],b=n[0],w=n[4],M=n[8],E=n[12],T=n[1],S=n[5],A=n[9],R=n[13],L=n[2],P=n[6],C=n[10],I=n[14],U=n[3],N=n[7],O=n[11],D=n[15];return r[0]=a*b+o*T+s*L+c*U,r[4]=a*w+o*S+s*P+c*N,r[8]=a*M+o*A+s*C+c*O,r[12]=a*E+o*R+s*I+c*D,r[1]=h*b+l*T+u*L+d*U,r[5]=h*w+l*S+u*P+d*N,r[9]=h*M+l*A+u*C+d*O,r[13]=h*E+l*R+u*I+d*D,r[2]=p*b+f*T+m*L+g*U,r[6]=p*w+f*S+m*P+g*N,r[10]=p*M+f*A+m*C+g*O,r[14]=p*E+f*R+m*I+g*D,r[3]=v*b+y*T+x*L+_*U,r[7]=v*w+y*S+x*P+_*N,r[11]=v*M+y*A+x*C+_*O,r[15]=v*E+y*R+x*I+_*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:(bt=new re,function(t){for(var e=0,i=t.count;e<i;e++)bt.x=t.getX(e),bt.y=t.getY(e),bt.z=t.getZ(e),bt.applyMatrix4(this),t.setXYZ(e,bt.x,bt.y,bt.z);return t}),determinant:function(){var t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],s=t[9],c=t[13],h=t[2],l=t[6],u=t[10],d=t[14];return t[3]*(r*s*l-n*c*l-r*o*u+i*c*u+n*o*d-i*s*d)+t[7]*(e*s*d-e*c*u+r*a*u-n*a*d+n*c*h-r*s*h)+t[11]*(e*c*l-e*o*d-r*a*l+i*a*d+r*o*h-i*c*h)+t[15]*(-n*o*h-e*s*l+e*o*u+n*a*l-i*a*u+i*s*h)},transpose:function(){var t=this.elements,e=t[1];return t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var i=this.elements,n=t.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],h=n[5],l=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],v=n[13],y=n[14],x=n[15],_=p*y*u-v*f*u+v*l*m-h*y*m-p*l*x+h*f*x,b=g*f*u-d*y*u-g*l*m+c*y*m+d*l*x-c*f*x,w=d*v*u-g*p*u+g*h*m-c*v*m-d*h*x+c*p*x,M=g*p*l-d*v*l-g*h*f+c*v*f+d*h*y-c*p*y,E=r*_+a*b+o*w+s*M;if(0==E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return i[0]=_*S,i[1]=(v*f*s-p*y*s-v*o*m+a*y*m+p*o*x-a*f*x)*S,i[2]=(h*y*s-v*l*s+v*o*u-a*y*u-h*o*x+a*l*x)*S,i[3]=(p*l*s-h*f*s-p*o*u+a*f*u+h*o*m-a*l*m)*S,i[4]=b*S,i[5]=(d*y*s-g*f*s+g*o*m-r*y*m-d*o*x+r*f*x)*S,i[6]=(g*l*s-c*y*s-g*o*u+r*y*u+c*o*x-r*l*x)*S,i[7]=(c*f*s-d*l*s+d*o*u-r*f*u-c*o*m+r*l*m)*S,i[8]=w*S,i[9]=(g*p*s-d*v*s-g*a*m+r*v*m+d*a*x-r*p*x)*S,i[10]=(c*v*s-g*h*s+g*a*u-r*v*u-c*a*x+r*h*x)*S,i[11]=(d*h*s-c*p*s-d*a*u+r*p*u+c*a*m-r*h*m)*S,i[12]=M*S,i[13]=(d*v*o-g*p*o+g*a*f-r*v*f-d*a*y+r*p*y)*S,i[14]=(g*h*o-c*v*o-g*a*l+r*v*l+c*a*y-r*h*y)*S,i[15]=(c*p*o-d*h*o+d*a*l-r*p*l-c*a*f+r*h*f)*S,this},scale:function(t){var e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,s=t.z,c=r*a,h=r*o;return this.set(c*a+i,c*o-n*s,c*s+n*o,0,c*o+n*s,h*o+i,h*s-n*a,0,c*s-n*o,h*s+n*a,r*s*s+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){return this.makeRotationFromQuaternion(e),this.scale(i),this.setPosition(t),this},decompose:(O=new re,D=new ae,function(t,e,i){var n=this.elements,r=O.set(n[0],n[1],n[2]).length(),a=O.set(n[4],n[5],n[6]).length(),o=O.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],D.copy(this);var s=1/r,c=1/a,h=1/o;return D.elements[0]*=s,D.elements[1]*=s,D.elements[2]*=s,D.elements[4]*=c,D.elements[5]*=c,D.elements[6]*=c,D.elements[8]*=h,D.elements[9]*=h,D.elements[10]*=h,e.setFromRotationMatrix(D),i.x=r,i.y=a,i.z=o,this}),makePerspective:function(t,e,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(e-t),c=2*r/(i-n),h=(e+t)/(e-t),l=(i+n)/(i-n),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,n,r,a){var o=this.elements,s=1/(e-t),c=1/(i-n),h=1/(a-r),l=(e+t)*s,u=(i+n)*c,d=(a+r)*h;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}),((oe.prototype=Object.create(At.prototype)).constructor=oe).prototype.isDataTexture=!0,((se.prototype=Object.create(At.prototype)).constructor=se).prototype.isCubeTexture=!0,Object.defineProperty(se.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var ce=new At,he=new se;function le(){this.seq=[],this.map={}}var ue=[],de=[],pe=new Float32Array(16),fe=new Float32Array(9);function me(t,e,i){var n=t[0];if(n<=0||0<n)return t;var r=e*i,a=ue[r];if(void 0===a&&(a=new Float32Array(r),ue[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function ge(t,e){var i=de[e];void 0===i&&(i=new Int32Array(e),de[e]=i);for(var n=0;n!==e;++n)i[n]=t.allocTextureUnit();return i}function ve(t,e){t.uniform1f(this.addr,e)}function ye(t,e){t.uniform1i(this.addr,e)}function xe(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function _e(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 be(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function we(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function Me(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(fe.set(e.elements),t.uniformMatrix3fv(this.addr,!1,fe))}function Ee(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(pe.set(e.elements),t.uniformMatrix4fv(this.addr,!1,pe))}function Te(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTexture2D(e||ce,n)}function Se(t,e,i){var n=i.allocTextureUnit();t.uniform1i(this.addr,n),i.setTextureCube(e||he,n)}function Ae(t,e){t.uniform2iv(this.addr,e)}function Re(t,e){t.uniform3iv(this.addr,e)}function Le(t,e){t.uniform4iv(this.addr,e)}function Pe(t,e){t.uniform1fv(this.addr,e)}function Ce(t,e){t.uniform1iv(this.addr,e)}function Ie(t,e){t.uniform2fv(this.addr,me(e,this.size,2))}function Ue(t,e){t.uniform3fv(this.addr,me(e,this.size,3))}function Ne(t,e){t.uniform4fv(this.addr,me(e,this.size,4))}function Oe(t,e){t.uniformMatrix2fv(this.addr,!1,me(e,this.size,4))}function De(t,e){t.uniformMatrix3fv(this.addr,!1,me(e,this.size,9))}function Fe(t,e){t.uniformMatrix4fv(this.addr,!1,me(e,this.size,16))}function Be(t,e,i){var n=e.length,r=ge(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTexture2D(e[a]||ce,r[a])}function ze(t,e,i){var n=e.length,r=ge(i,n);t.uniform1iv(this.addr,r);for(var a=0;a!==n;++a)i.setTextureCube(e[a]||he,r[a])}function Ge(t,e,i){this.id=t,this.addr=i,this.setValue=function(t){switch(t){case 5126:return ve;case 35664:return xe;case 35665:return _e;case 35666:return be;case 35674:return we;case 35675:return Me;case 35676:return Ee;case 35678:case 36198:return Te;case 35680:return Se;case 5124:case 35670:return ye;case 35667:case 35671:return Ae;case 35668:case 35672:return Re;case 35669:case 35673:return Le}}(e.type)}function He(t,e,i){this.id=t,this.addr=i,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Pe;case 35664:return Ie;case 35665:return Ue;case 35666:return Ne;case 35674:return Oe;case 35675:return De;case 35676:return Fe;case 35678:return Be;case 35680:return ze;case 5124:case 35670:return Ce;case 35667:case 35671:return Ae;case 35668:case 35672:return Re;case 35669:case 35673:return Le}}(e.type)}function Ve(t){this.id=t,le.call(this)}Ve.prototype.setValue=function(t,e){for(var i=this.seq,n=0,r=i.length;n!==r;++n){var a=i[n];a.setValue(t,e[a.id])}};var ke=/([\w\d_]+)(\])?(\[|\.)?/g;function je(t,e){t.seq.push(e),t.map[e.id]=e}function We(t,e,i){le.call(this),this.renderer=i;for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<n;++r){var a=t.getActiveUniform(e,r),o=a.name;!function(t,e,i){var n=t.name,r=n.length;for(ke.lastIndex=0;;){var a=ke.exec(n),o=ke.lastIndex,s=a[1],c="]"===a[2],h=a[3];if(c&&(s|=0),void 0===h||"["===h&&o+2===r){je(i,new(void 0===h?Ge:He)(s,t,e));break}var l=i.map[s];void 0===l&&je(i,l=new Ve(s)),i=l}}(a,t.getUniformLocation(e,o),this)}}We.prototype.setValue=function(t,e,i){var n=this.map[e];void 0!==n&&n.setValue(t,i,this.renderer)},We.prototype.setOptional=function(t,e,i){var n=e[i];void 0!==n&&this.setValue(t,i,n)},We.upload=function(t,e,i,n){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=i[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,n)}},We.seqWithValue=function(t,e){for(var i=[],n=0,r=t.length;n!==r;++n){var a=t[n];a.id in e&&i.push(a)}return i};var Xe={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};function qe(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}function Ye(t,e,i){return i<0&&(i+=1),1<i&&--i,i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}Object.assign(qe.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(t,e,i){var n,r;return t=$t.euclideanModulo(t,1),e=$t.clamp(e,0,1),i=$t.clamp(i,0,1),0===e?this.r=this.g=this.b=i:(r=2*i-(n=i<=.5?i*(1+e):i+e-i*e),this.r=Ye(r,n,t+1/3),this.g=Ye(r,n,t),this.b=Ye(r,n,t-1/3)),this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(o,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var h,l=(h=i[1]).length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}return e&&0<e.length&&(void 0!==(h=Xe[e])?this.setHex(h):console.warn("THREE.Color: Unknown color "+e)),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 i=0<e?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(){var t=this.r,e=this.g,i=this.b;return this.r=t*t,this.g=e*e,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,i=t||{h:0,s:0,l:0},n=this.r,r=this.g,a=this.b,o=Math.max(n,r,a),s=Math.min(n,r,a),c=(s+o)/2;if(s===o)l=e=0;else{var h=o-s,l=c<=.5?h/(o+s):h/(2-o-s);switch(o){case n:e=(r-a)/h+(r<a?6:0);break;case r:e=(a-n)/h+2;break;case a:e=(n-r)/h+4}e/=6}return i.h=e,i.s=l,i.l=c,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,i){var n=this.getHSL();return n.h+=t,n.s+=e,n.l+=i,this.setHSL(n.h,n.s,n.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Ze,Je,Qe={common:{diffuse:{value:new qe(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new te(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new _t(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new qe(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new qe(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new te(0,0,1,1)}}},Ke={merge:function(t){for(var e={},i=0;i<t.length;i++){var n,r=this.clone(t[i]);for(n in r)e[n]=r[n]}return e},clone:function(t){var e,i={};for(e in t)for(var n in i[e]={},t[e]){var r=t[e][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?i[e][n]=r.clone():Array.isArray(r)?i[e][n]=r.slice():i[e][n]=r}return i}},$e={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = asin( flipNormal * reflectVec.y ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},ti={basic:{uniforms:Ke.merge([Qe.common,Qe.aomap,Qe.lightmap,Qe.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:Ke.merge([Qe.common,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.fog,Qe.lights,{emissive:{value:new qe(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:Ke.merge([Qe.common,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.gradientmap,Qe.fog,Qe.lights,{emissive:{value:new qe(0)},specular:{value:new qe(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:Ke.merge([Qe.common,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.roughnessmap,Qe.metalnessmap,Qe.fog,Qe.lights,{emissive:{value:new qe(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},points:{uniforms:Ke.merge([Qe.points,Qe.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:Ke.merge([Qe.common,Qe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:Ke.merge([Qe.common,Qe.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:Ke.merge([Qe.common,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,{opacity:{value:1}}]),vertexShader:$e.normal_vert,fragmentShader:$e.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new re}},vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag}};function ei(t,e){this.min=void 0!==t?t:new _t(1/0,1/0),this.max=void 0!==e?e:new _t(-1/0,-1/0)}function ii(y,x){var _,b,s,w,M,E,T,S,A=y.context,R=y.state;function L(){var t,e,i,n,r,a=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),o=new Uint16Array([0,1,2,0,2,3]);_=A.createBuffer(),b=A.createBuffer(),A.bindBuffer(A.ARRAY_BUFFER,_),A.bufferData(A.ARRAY_BUFFER,a,A.STATIC_DRAW),A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,b),A.bufferData(A.ELEMENT_ARRAY_BUFFER,o,A.STATIC_DRAW),T=A.createTexture(),S=A.createTexture(),R.bindTexture(A.TEXTURE_2D,T),A.texImage2D(A.TEXTURE_2D,0,A.RGB,16,16,0,A.RGB,A.UNSIGNED_BYTE,null),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.NEAREST),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.NEAREST),R.bindTexture(A.TEXTURE_2D,S),A.texImage2D(A.TEXTURE_2D,0,A.RGBA,16,16,0,A.RGBA,A.UNSIGNED_BYTE,null),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.NEAREST),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},t=s,e=A.createProgram(),i=A.createShader(A.FRAGMENT_SHADER),n=A.createShader(A.VERTEX_SHADER),r="precision "+y.getPrecision()+" float;\n",A.shaderSource(i,r+t.fragmentShader),A.shaderSource(n,r+t.vertexShader),A.compileShader(i),A.compileShader(n),A.attachShader(e,i),A.attachShader(e,n),A.linkProgram(e),w=e,M={vertex:A.getAttribLocation(w,"position"),uv:A.getAttribLocation(w,"uv")},E={renderType:A.getUniformLocation(w,"renderType"),map:A.getUniformLocation(w,"map"),occlusionMap:A.getUniformLocation(w,"occlusionMap"),opacity:A.getUniformLocation(w,"opacity"),color:A.getUniformLocation(w,"color"),scale:A.getUniformLocation(w,"scale"),rotation:A.getUniformLocation(w,"rotation"),screenPosition:A.getUniformLocation(w,"screenPosition")}}this.render=function(t,e,i){if(0!==x.length){var n=new re,r=i.w/i.z,a=.5*i.z,o=.5*i.w,s=16/i.w,c=new _t(s*r,s),h=new re(1,1,0),l=new _t(1,1),u=new ei;u.min.set(i.x,i.y),u.max.set(i.x+(i.z-16),i.y+(i.w-16)),void 0===w&&L(),A.useProgram(w),R.initAttributes(),R.enableAttribute(M.vertex),R.enableAttribute(M.uv),R.disableUnusedAttributes(),A.uniform1i(E.occlusionMap,0),A.uniform1i(E.map,1),A.bindBuffer(A.ARRAY_BUFFER,_),A.vertexAttribPointer(M.vertex,2,A.FLOAT,!1,16,0),A.vertexAttribPointer(M.uv,2,A.FLOAT,!1,16,8),A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,b),R.disable(A.CULL_FACE),R.buffers.depth.setMask(!1);for(var d=0,p=x.length;d<p;d++){s=16/i.w,c.set(s*r,s);var f=x[d];if(n.set(f.matrixWorld.elements[12],f.matrixWorld.elements[13],f.matrixWorld.elements[14]),n.applyMatrix4(e.matrixWorldInverse),n.applyMatrix4(e.projectionMatrix),h.copy(n),l.x=i.x+h.x*a+a-8,l.y=i.y+h.y*o+o-8,!0===u.containsPoint(l)){R.activeTexture(A.TEXTURE0),R.bindTexture(A.TEXTURE_2D,null),R.activeTexture(A.TEXTURE1),R.bindTexture(A.TEXTURE_2D,T),A.copyTexImage2D(A.TEXTURE_2D,0,A.RGB,l.x,l.y,16,16,0),A.uniform1i(E.renderType,0),A.uniform2f(E.scale,c.x,c.y),A.uniform3f(E.screenPosition,h.x,h.y,h.z),R.disable(A.BLEND),R.enable(A.DEPTH_TEST),A.drawElements(A.TRIANGLES,6,A.UNSIGNED_SHORT,0),R.activeTexture(A.TEXTURE0),R.bindTexture(A.TEXTURE_2D,S),A.copyTexImage2D(A.TEXTURE_2D,0,A.RGBA,l.x,l.y,16,16,0),A.uniform1i(E.renderType,1),R.disable(A.DEPTH_TEST),R.activeTexture(A.TEXTURE1),R.bindTexture(A.TEXTURE_2D,T),A.drawElements(A.TRIANGLES,6,A.UNSIGNED_SHORT,0),f.positionScreen.copy(h),f.customUpdateCallback?f.customUpdateCallback(f):f.updateLensFlares(),A.uniform1i(E.renderType,2),R.enable(A.BLEND);for(var m=0,g=f.lensFlares.length;m<g;m++){var v=f.lensFlares[m];.001<v.opacity&&.001<v.scale&&(h.x=v.x,h.y=v.y,h.z=v.z,s=v.size*v.scale/i.w,c.x=s*r,c.y=s,A.uniform3f(E.screenPosition,h.x,h.y,h.z),A.uniform2f(E.scale,c.x,c.y),A.uniform1f(E.rotation,v.rotation),A.uniform1f(E.opacity,v.opacity),A.uniform3f(E.color,v.color.r,v.color.g,v.color.b),R.setBlending(v.blending,v.blendEquation,v.blendSrc,v.blendDst),y.setTexture2D(v.texture,1),A.drawElements(A.TRIANGLES,6,A.UNSIGNED_SHORT,0))}}}R.enable(A.CULL_FACE),R.enable(A.DEPTH_TEST),R.buffers.depth.setMask(!0),y.resetGLState()}}}function ni(u,d){var p,f,m,g,v,y,x=u.context,_=u.state,b=new re,w=new ne,M=new re;function E(){var t,e,i,n=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),r=new Uint16Array([0,1,2,0,2,3]);p=x.createBuffer(),f=x.createBuffer(),x.bindBuffer(x.ARRAY_BUFFER,p),x.bufferData(x.ARRAY_BUFFER,n,x.STATIC_DRAW),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,f),x.bufferData(x.ELEMENT_ARRAY_BUFFER,r,x.STATIC_DRAW),t=x.createProgram(),e=x.createShader(x.VERTEX_SHADER),i=x.createShader(x.FRAGMENT_SHADER),x.shaderSource(e,["precision "+u.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","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")),x.shaderSource(i,["precision "+u.getPrecision()+" float;","#define SHADER_NAME SpriteMaterial","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","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")),x.compileShader(e),x.compileShader(i),x.attachShader(t,e),x.attachShader(t,i),x.linkProgram(t),m=t,g={position:x.getAttribLocation(m,"position"),uv:x.getAttribLocation(m,"uv")},v={uvOffset:x.getUniformLocation(m,"uvOffset"),uvScale:x.getUniformLocation(m,"uvScale"),rotation:x.getUniformLocation(m,"rotation"),scale:x.getUniformLocation(m,"scale"),color:x.getUniformLocation(m,"color"),map:x.getUniformLocation(m,"map"),opacity:x.getUniformLocation(m,"opacity"),modelViewMatrix:x.getUniformLocation(m,"modelViewMatrix"),projectionMatrix:x.getUniformLocation(m,"projectionMatrix"),fogType:x.getUniformLocation(m,"fogType"),fogDensity:x.getUniformLocation(m,"fogDensity"),fogNear:x.getUniformLocation(m,"fogNear"),fogFar:x.getUniformLocation(m,"fogFar"),fogColor:x.getUniformLocation(m,"fogColor"),alphaTest:x.getUniformLocation(m,"alphaTest")};var a=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");a.width=8,a.height=8;var o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),(y=new At(a)).needsUpdate=!0}function T(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(t,e){if(0!==d.length){void 0===m&&E(),x.useProgram(m),_.initAttributes(),_.enableAttribute(g.position),_.enableAttribute(g.uv),_.disableUnusedAttributes(),_.disable(x.CULL_FACE),_.enable(x.BLEND),x.bindBuffer(x.ARRAY_BUFFER,p),x.vertexAttribPointer(g.position,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(g.uv,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,f),x.uniformMatrix4fv(v.projectionMatrix,!1,e.projectionMatrix.elements),_.activeTexture(x.TEXTURE0),x.uniform1i(v.map,0);var i=0,n=0,r=t.fog;r?(x.uniform3f(v.fogColor,r.color.r,r.color.g,r.color.b),r.isFog?(x.uniform1f(v.fogNear,r.near),x.uniform1f(v.fogFar,r.far),x.uniform1i(v.fogType,1),n=i=1):r.isFogExp2&&(x.uniform1f(v.fogDensity,r.density),x.uniform1i(v.fogType,2),n=i=2)):(x.uniform1i(v.fogType,0),n=i=0);for(var a=0,o=d.length;a<o;a++){(c=d[a]).modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,c.matrixWorld),c.z=-c.modelViewMatrix.elements[14]}d.sort(T);for(var s=[],a=0,o=d.length;a<o;a++){var c,h,l=(c=d[a]).material;!1!==l.visible&&(c.onBeforeRender(u,t,e,void 0,l,void 0),x.uniform1f(v.alphaTest,l.alphaTest),x.uniformMatrix4fv(v.modelViewMatrix,!1,c.modelViewMatrix.elements),c.matrixWorld.decompose(b,w,M),s[0]=M.x,s[1]=M.y,h=0,t.fog&&l.fog&&(h=n),i!==h&&(x.uniform1i(v.fogType,h),i=h),null!==l.map?(x.uniform2f(v.uvOffset,l.map.offset.x,l.map.offset.y),x.uniform2f(v.uvScale,l.map.repeat.x,l.map.repeat.y)):(x.uniform2f(v.uvOffset,0,0),x.uniform2f(v.uvScale,1,1)),x.uniform1f(v.opacity,l.opacity),x.uniform3f(v.color,l.color.r,l.color.g,l.color.b),x.uniform1f(v.rotation,l.rotation),x.uniform2fv(v.scale,s),_.setBlending(l.blending,l.blendEquation,l.blendSrc,l.blendDst,l.blendEquationAlpha,l.blendSrcAlpha,l.blendDstAlpha,l.premultipliedAlpha),_.buffers.depth.setTest(l.depthTest),_.buffers.depth.setMask(l.depthWrite),l.map?u.setTexture2D(l.map,0):u.setTexture2D(y,0),x.drawElements(x.TRIANGLES,6,x.UNSIGNED_SHORT,0),c.onAfterRender(u,t,e,void 0,l,void 0))}_.enable(x.CULL_FACE),u.resetGLState()}}}ti.physical={uniforms:Ke.merge([ti.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},Object.assign(ei.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:(Je=new _t,function(t,e){var i=Je.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new _t;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new _t;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new _t).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.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new _t).copy(t).clamp(this.min,this.max)},distanceToPoint:(Ze=new _t,function(t){return Ze.copy(t).clamp(this.min,this.max).sub(t).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)}});var ri,ai,oi,si,ci,hi,li,ui,di,pi,fi,mi,gi,vi,yi,xi,_i,bi,wi,Mi=0;function Ei(){Object.defineProperty(this,"id",{value:Mi++}),this.uuid=$t.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Y,this.side=z,this.shading=c,this.vertexColors=Lt,this.opacity=1,this.transparent=!1,this.blendSrc=Ct,this.blendDst=It,this.blendEquation=Pt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=it,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function Ti(t){Ei.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},(this.index0AttributeName=void 0)!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function Si(t){Ei.call(this),this.type="MeshDepthMaterial",this.depthPacking=w,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)}function Ai(t,e){this.min=void 0!==t?t:new re(1/0,1/0,1/0),this.max=void 0!==e?e:new re(-1/0,-1/0,-1/0)}function Ri(t,e){this.center=void 0!==t?t:new re,this.radius=void 0!==e?e:0}function Li(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function Pi(t,e){this.normal=void 0!==t?t:new re(1,0,0),this.constant=void 0!==e?e:0}function Ci(t,e,i,n,r,a){this.planes=[void 0!==t?t:new Pi,void 0!==e?e:new Pi,void 0!==i?i:new Pi,void 0!==n?n:new Pi,void 0!==r?r:new Pi,void 0!==a?a:new Pi]}function Ii(y,t,x,e){var _=y.context,b=y.state,w=new Ci,M=new ae,E=t.shadows,T=new _t,S=new _t(e.maxTextureSize,e.maxTextureSize),A=new re,R=new re,g=1,v=2,i=1+(g|v),L=new Array(i),P=new Array(i),C={},I=[new re(1,0,0),new re(-1,0,0),new re(0,0,1),new re(0,0,-1),new re(0,1,0),new re(0,-1,0)],U=[new re(0,1,0),new re(0,1,0),new re(0,1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],N=[new te,new te,new te,new te,new te,new te],n=new Si;n.depthPacking=xt,n.clipping=!0;for(var r=ti.distanceRGBA,a=Ke.clone(r.uniforms),o=0;o!==i;++o){var s=0!=(o&g),c=0!=(o&v),h=n.clone();h.morphTargets=s,h.skinning=c,L[o]=h;var l=new Ti({defines:{USE_SHADOWMAP:""},uniforms:a,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,morphTargets:s,skinning:c,clipping:!0});P[o]=l}var O=this;function D(t,e,i,n){var r,a,o,s,c,h,l,u=t.geometry,d=null,p=L,f=t.customDepthMaterial;i&&(p=P,f=t.customDistanceMaterial),d=f||(r=!1,e.morphTargets&&(u&&u.isBufferGeometry?r=u.morphAttributes&&u.morphAttributes.position&&0<u.morphAttributes.position.length:u&&u.isGeometry&&(r=u.morphTargets&&0<u.morphTargets.length)),t.isSkinnedMesh&&!1===e.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t),a=t.isSkinnedMesh&&e.skinning,o=0,r&&(o|=g),a&&(o|=v),p[o]),y.localClippingEnabled&&!0===e.clipShadows&&0!==e.clippingPlanes.length&&(s=d.uuid,c=e.uuid,void 0===(h=C[s])&&(h={},C[s]=h),void 0===(l=h[c])&&(l=d.clone(),h[c]=l),d=l),d.visible=e.visible,d.wireframe=e.wireframe;var m=e.side;return O.renderSingleSided&&m==X&&(m=z),O.renderReverseSided&&(m===z?m=W:m===W&&(m=z)),d.side=m,d.clipShadows=e.clipShadows,d.clippingPlanes=e.clippingPlanes,d.wireframeLinewidth=e.wireframeLinewidth,d.linewidth=e.linewidth,i&&void 0!==d.uniforms.lightPos&&d.uniforms.lightPos.value.copy(n),d}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=F,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(t,e){if(!1!==O.enabled&&(!1!==O.autoUpdate||!1!==O.needsUpdate)&&0!==E.length){var i;b.disable(_.BLEND),b.buffers.color.setClear(1,1,1,1),b.buffers.depth.setTest(!0),b.setScissorTest(!1);for(var n=0,r=E.length;n<r;n++){var a=E[n],o=a.shadow,s=a&&a.isPointLight;if(void 0!==o){var c,h,l,u=o.camera;T.copy(o.mapSize),T.min(S),s&&(c=T.x,h=T.y,N[0].set(2*c,h,c,h),N[1].set(0,h,c,h),N[2].set(3*c,h,c,h),N[3].set(c,h,c,h),N[4].set(3*c,0,c,h),N[5].set(c,0,c,h),T.x*=4,T.y*=2),null===o.map&&(l={minFilter:Ft,magFilter:Ft,format:Zt},o.map=new ee(T.x,T.y,l),o.map.texture.name=a.name+".shadowMap",u.updateProjectionMatrix()),o.isSpotLightShadow&&o.update(a);var d=o.map,p=o.matrix;R.setFromMatrixPosition(a.matrixWorld),u.position.copy(R),s?(i=6,p.makeTranslation(-R.x,-R.y,-R.z)):(i=1,A.setFromMatrixPosition(a.target.matrixWorld),u.lookAt(A),u.updateMatrixWorld(),p.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),p.multiply(u.projectionMatrix),p.multiply(u.matrixWorldInverse)),y.setRenderTarget(d),y.clear();for(var f,m=0;m<i;m++){s&&(A.copy(u.position),A.add(I[m]),u.up.copy(U[m]),u.lookAt(A),u.updateMatrixWorld(),f=N[m],b.viewport(f)),M.multiplyMatrices(u.projectionMatrix,u.matrixWorldInverse),w.setFromMatrix(M),function t(e,i,n,r){if(!1===e.visible)return;var a=e.layers.test(i.layers);if(a&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||w.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld);var o=x.update(e),s=e.material;if(Array.isArray(s))for(var c=o.groups,h=0,l=c.length;h<l;h++){var u,d=c[h],p=s[d.materialIndex];p&&p.visible&&(u=D(e,p,r,R),y.renderBufferDirect(n,null,o,u,e,d))}else s.visible&&(u=D(e,s,r,R),y.renderBufferDirect(n,null,o,u,e,null))}var f=e.children;for(var m=0,g=f.length;m<g;m++)t(f[m],i,n,r)}(t,e,u,s)}}else console.warn("THREE.WebGLShadowMap:",a,"has no shadow.")}var g=y.getClearColor(),v=y.getClearAlpha();y.setClearColor(g,v),O.needsUpdate=!1}}}function Ui(c){var h={};return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),h[t.uuid]},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var e=h[t.uuid];e&&(c.deleteBuffer(e.buffer),delete h[t.uuid])},update:function(t,e){t.isInterleavedBufferAttribute&&(t=t.data);var i,n,r,a,o,s=h[t.uuid];void 0===s?h[t.uuid]=function(t,e){var i=t.array,n=t.dynamic?c.DYNAMIC_DRAW:c.STATIC_DRAW,r=c.createBuffer();c.bindBuffer(e,r),c.bufferData(e,i,n),t.onUploadCallback();var a=c.FLOAT;return i instanceof Float32Array?a=c.FLOAT:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?a=c.UNSIGNED_SHORT:i instanceof Int16Array?a=c.SHORT:i instanceof Uint32Array?a=c.UNSIGNED_INT:i instanceof Int32Array?a=c.INT:i instanceof Int8Array?a=c.BYTE:i instanceof Uint8Array&&(a=c.UNSIGNED_BYTE),{buffer:r,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,e):s.version<t.version&&(i=s.buffer,r=e,a=(n=t).array,o=n.updateRange,c.bindBuffer(r,i),!1===n.dynamic?c.bufferData(r,a,c.STATIC_DRAW):-1===o.count?c.bufferSubData(r,0,a):0===o.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(c.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),s.version=t.version)}}}function Ni(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._order=n||Ni.DefaultOrder}function Oi(){this.mask=1}Object.assign(Ei.prototype,e.prototype,{isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var i,n=t[e];void 0!==n?void 0!==(i=this[e])?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material."):console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t;e&&(t={textures:{},images:{}});var i,n,r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function a(t){var e,i=[];for(e in t){var n=t[e];delete n.metadata,i.push(n)}return i}return r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearCoat&&(r.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(r.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Y&&(r.blending=this.blending),this.shading!==c&&(r.shading=this.shading),this.side!==z&&(r.side=this.side),this.vertexColors!==Lt&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,0<this.alphaTest&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),1<this.wireframeLinewidth&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),r.skinning=this.skinning,r.morphTargets=this.morphTargets,r.dithering=this.dithering,e&&(i=a(t.textures),n=a(t.images),0<i.length&&(r.textures=i),0<n.length&&(r.images=n)),r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.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.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e)for(var n=e.length,i=new Array(n),r=0;r!==n;++r)i[r]=e[r].clone();return this.clippingPlanes=i,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((Ti.prototype=Object.create(Ei.prototype)).constructor=Ti).prototype.isShaderMaterial=!0,Ti.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ke.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Ti.prototype.toJSON=function(t){var e=Ei.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},((Si.prototype=Object.create(Ei.prototype)).constructor=Si).prototype.isMeshDepthMaterial=!0,Si.prototype.copy=function(t){return Ei.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},Object.assign(Ai.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var h=t[s],l=t[s+1],u=t[s+2];h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),r<h&&(r=h),a<l&&(a=l),o<u&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var h=t.getX(s),l=t.getY(s),u=t.getZ(s);h<e&&(e=h),l<i&&(i=l),u<n&&(n=u),r<h&&(r=h),a<l&&(a=l),o<u&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:(hi=new re,function(t,e){var i=hi.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new re;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new re;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:(ci=new re,function(t){var o=this;return t.updateMatrixWorld(!0),t.traverse(function(t){var e=t.geometry;if(void 0!==e)if(e.isGeometry)for(var i=e.vertices,n=0,r=i.length;n<r;n++)ci.copy(i[n]),ci.applyMatrix4(t.matrixWorld),o.expandByPoint(ci);else if(e.isBufferGeometry){var a=e.attributes.position;if(void 0!==a)for(n=0,r=a.count;n<r;n++)ci.fromBufferAttribute(a,n).applyMatrix4(t.matrixWorld),o.expandByPoint(ci)}}),this}),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new re).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.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:(si=new re,function(t){return this.clampPoint(t.center,si),si.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,i=0<t.normal.x?(e=t.normal.x*this.min.x,t.normal.x*this.max.x):(e=t.normal.x*this.max.x,t.normal.x*this.min.x);return 0<t.normal.y?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),0<t.normal.z?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=t.constant&&i>=t.constant},clampPoint:function(t,e){return(e||new re).copy(t).clamp(this.min,this.max)},distanceToPoint:(oi=new re,function(t){return oi.copy(t).clamp(this.min,this.max).sub(t).length()}),getBoundingSphere:(ai=new re,function(t){var e=t||new Ri;return this.getCenter(e.center),e.radius=.5*this.getSize(ai).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:(ri=[new re,new re,new re,new re,new re,new re,new re,new re],function(t){return this.isEmpty()||(ri[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ri[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ri[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ri[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ri[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ri[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ri[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ri[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ri)),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(Ri.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(li=new Ai,function(t,e){var i=this.center;void 0!==e?i.copy(e):li.setFromPoints(t).getCenter(i);for(var n=0,r=0,a=t.length;r<a;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var i=this.center.distanceToSquared(t),n=e||new re;return n.copy(t),i>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){var e=t||new Ai;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(Li.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,c){var h=this.elements;return h[0]=t,h[1]=n,h[2]=o,h[3]=e,h[4]=r,h[5]=s,h[6]=i,h[7]=a,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:(ui=new re,function(t){for(var e=0,i=t.count;e<i;e++)ui.x=t.getX(e),ui.y=t.getY(e),ui.z=t.getZ(e),ui.applyMatrix3(this),t.setXYZ(e,ui.x,ui.y,ui.z);return t}),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],s=i[6],c=i[1],h=i[4],l=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],x=n[7],_=n[2],b=n[5],w=n[8];return r[0]=a*f+o*v+s*_,r[3]=a*m+o*y+s*b,r[6]=a*g+o*x+s*w,r[1]=c*f+h*v+l*_,r[4]=c*m+h*y+l*b,r[7]=c*g+h*x+l*w,r[2]=u*f+d*v+p*_,r[5]=u*m+d*y+p*b,r[8]=u*g+d*x+p*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-i*r*h+i*o*s+n*r*c-n*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var i=t.elements,n=this.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],h=i[5],l=i[6],u=i[7],d=i[8],p=d*c-h*u,f=h*l-d*s,m=u*s-c*l,g=r*p+a*f+o*m;if(0==g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return n[0]=p*y,n[1]=(o*u-d*a)*y,n[2]=(h*a-o*c)*y,n[3]=f*y,n[4]=(d*r-o*l)*y,n[5]=(o*s-h*r)*y,n[6]=m*y,n[7]=(a*l-u*r)*y,n[8]=(c*r-a*s)*y,this},transpose:function(){var t=this.elements,e=t[1];return t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,i=t.elements,n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}}),Object.assign(Pi.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:(mi=new re,gi=new re,function(t,e,i){var n=mi.subVectors(i,e).cross(gi.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),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 i=this.distanceToPoint(t);return(e||new re).copy(this.normal).multiplyScalar(i)},intersectLine:(fi=new re,function(t,e){var i=e||new re,n=t.delta(fi),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?i.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/r;return a<0||1<a?void 0:i.copy(n).multiplyScalar(a).add(t.start)}),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&0<i||i<0&&0<e},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new re).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(di=new re,pi=new Li,function(t,e){var i=this.coplanarPoint(di).applyMatrix4(t),n=e||pi.getNormalMatrix(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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}}),Object.assign(Ci.prototype,{set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(o-n,l-s,f-u,y-m).normalize(),e[1].setComponents(o+n,l+s,f+u,y+m).normalize(),e[2].setComponents(o+r,l+c,f+d,y+g).normalize(),e[3].setComponents(o-r,l-c,f-d,y-g).normalize(),e[4].setComponents(o-a,l-h,f-p,y-v).normalize(),e[5].setComponents(o+a,l+h,f+p,y+v).normalize(),this},intersectsObject:(_i=new Ri,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),_i.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(_i)}),intersectsSprite:(xi=new Ri,function(t){return xi.center.set(0,0,0),xi.radius=.7071067811865476,xi.applyMatrix4(t.matrixWorld),this.intersectsSphere(xi)}),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(i)<n)return!1}return!0},intersectsBox:(vi=new re,yi=new re,function(t){for(var e=this.planes,i=0;i<6;i++){var n=e[i];vi.x=0<n.normal.x?t.min.x:t.max.x,yi.x=0<n.normal.x?t.max.x:t.min.x,vi.y=0<n.normal.y?t.min.y:t.max.y,yi.y=0<n.normal.y?t.max.y:t.min.y,vi.z=0<n.normal.z?t.min.z:t.max.z,yi.z=0<n.normal.z?t.max.z:t.min.z;var r=n.distanceToPoint(vi),a=n.distanceToPoint(yi);if(r<0&&a<0)return!1}return!0}),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}}),Ni.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Ni.DefaultOrder="XYZ",Object.defineProperties(Ni.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(Ni.prototype,{isEuler:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var n=$t.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],c=r[1],h=r[5],l=r[9],u=r[2],d=r[6],p=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-n(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(n(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h))):"YZX"===e?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-l,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:(wi=new ae,function(t,e,i){return wi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(wi,e,i)}),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(bi=new ne,function(t){return bi.setFromEuler(this),this.setFromQuaternion(bi,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new re(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Oi.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Di,Fi,Bi,zi,Gi,Hi,Vi,ki,ji,Wi,Xi,qi,Yi,Zi,Ji,Qi,Ki,$i=0;function tn(){Object.defineProperty(this,"id",{value:$i++}),this.uuid=$t.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=tn.DefaultUp.clone();var t=new re,e=new Ni,i=new ne,n=new re(1,1,1);e.onChange(function(){i.setFromEuler(e,!1)}),i.onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:n},modelViewMatrix:{value:new ae},normalMatrix:{value:new Li}}),this.matrix=new ae,this.matrixWorld=new ae,this.matrixAutoUpdate=tn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Oi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function en(){tn.call(this),this.type="Camera",this.matrixWorldInverse=new ae,this.projectionMatrix=new ae}function nn(t,e,i,n,r,a){en.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function rn(t,e,i,n){en.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function an(t,e,i,n,r,a){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new re,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new qe,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}tn.DefaultUp=new re(0,1,0),tn.DefaultMatrixAutoUpdate=!0,Object.assign(tn.prototype,e.prototype,{isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:(Qi=new ne,function(t,e){return Qi.setFromAxisAngle(t,e),this.quaternion.multiply(Qi),this}),rotateX:(Ji=new re(1,0,0),function(t){return this.rotateOnAxis(Ji,t)}),rotateY:(Zi=new re(0,1,0),function(t){return this.rotateOnAxis(Zi,t)}),rotateZ:(Yi=new re(0,0,1),function(t){return this.rotateOnAxis(Yi,t)}),translateOnAxis:(qi=new re,function(t,e){return qi.copy(t).applyQuaternion(this.quaternion),this.position.add(qi.multiplyScalar(e)),this}),translateX:(Xi=new re(1,0,0),function(t){return this.translateOnAxis(Xi,t)}),translateY:(Wi=new re(0,1,0),function(t){return this.translateOnAxis(Wi,t)}),translateZ:(ji=new re(0,0,1),function(t){return this.translateOnAxis(ji,t)}),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:(ki=new ae,function(t){return t.applyMatrix4(ki.getInverse(this.matrixWorld))}),lookAt:(Vi=new ae,function(t){this.isCamera?Vi.lookAt(this.position,t,this.up):Vi.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(Vi)}),add:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this},remove:function(t){if(1<arguments.length){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var i=this.children.indexOf(t);return-1!==i&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(i,1)),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var i=0,n=this.children.length;i<n;i++){var r=this.children[i].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){var e=t||new re;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(Gi=new re,Hi=new re,function(t){var e=t||new ne;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(Gi,e,Hi),e}),getWorldRotation:(zi=new ne,function(t){var e=t||new Ni;return this.getWorldQuaternion(zi),e.setFromQuaternion(zi,this.rotation.order,!1)}),getWorldScale:(Fi=new re,Bi=new ne,function(t){var e=t||new re;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(Fi,Bi,e),e}),getWorldDirection:(Di=new ne,function(t){var e=t||new re;return this.getWorldQuaternion(Di),e.set(0,0,1).applyQuaternion(Di)}),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var e=this.children,i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)},toJSON:function(i){var t=void 0===i||""===i,e={};t&&(i={geometries:{},materials:{},textures:{},images:{}},e.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var n,r,a,o,s={};function c(t,e){return void 0===t[e.uuid]&&(t[e.uuid]=e.toJSON(i)),e.uuid}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),"{}"!==JSON.stringify(this.userData)&&(s.userData=this.userData),!0===this.castShadow&&(s.castShadow=!0),!0===this.receiveShadow&&(s.receiveShadow=!0),!1===this.visible&&(s.visible=!1),s.matrix=this.matrix.toArray(),void 0!==this.geometry&&(s.geometry=c(i.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var h=[],l=0,u=this.material.length;l<u;l++)h.push(c(i.materials,this.material[l]));s.material=h}else s.material=c(i.materials,this.material);if(0<this.children.length){s.children=[];for(l=0;l<this.children.length;l++)s.children.push(this.children[l].toJSON(i).object)}return t&&(n=d(i.geometries),r=d(i.materials),a=d(i.textures),o=d(i.images),0<n.length&&(e.geometries=n),0<r.length&&(e.materials=r),0<a.length&&(e.textures=a),0<o.length&&(e.images=o)),e.object=s,e;function d(t){var e,i=[];for(e in t){var n=t[e];delete n.metadata,i.push(n)}return i}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;i<t.children.length;i++){var n=t.children[i];this.add(n.clone())}return this}}),en.prototype=Object.assign(Object.create(tn.prototype),{constructor:en,isCamera:!0,copy:function(t,e){return tn.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:(Ki=new ne,function(t){var e=t||new re;return this.getWorldQuaternion(Ki),e.set(0,0,-1).applyQuaternion(Ki)}),updateMatrixWorld:function(t){tn.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),nn.prototype=Object.assign(Object.create(en.prototype),{constructor:nn,isOrthographicCamera:!0,copy:function(t,e){return en.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,i,n,r,a){this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t,e,i,n,r=(this.right-this.left)/(2*this.zoom),a=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,s=(this.top+this.bottom)/2,c=o-r,h=o+r,l=s+a,u=s-a;null!==this.view&&(t=this.zoom/(this.view.width/this.view.fullWidth),e=this.zoom/(this.view.height/this.view.fullHeight),i=(this.right-this.left)/this.view.width,n=(this.top-this.bottom)/this.view.height,h=(c+=i*(this.view.offsetX/t))+i*(this.view.width/t),u=(l-=n*(this.view.offsetY/e))-n*(this.view.height/e)),this.projectionMatrix.makeOrthographic(c,h,l,u,this.near,this.far)},toJSON:function(t){var e=tn.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),rn.prototype=Object.assign(Object.create(en.prototype),{constructor:rn,isPerspectiveCamera:!0,copy:function(t,e){return en.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*$t.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*$t.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*$t.RAD2DEG*Math.atan(Math.tan(.5*$t.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:i,offsetY:n,width:r,height:a},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t,e,i=this.near,n=i*Math.tan(.5*$t.DEG2RAD*this.fov)/this.zoom,r=2*n,a=this.aspect*r,o=-.5*a,s=this.view;null!==s&&(t=s.fullWidth,e=s.fullHeight,o+=s.offsetX*a/t,n-=s.offsetY*r/e,a*=s.width/t,r*=s.height/e);var c=this.filmOffset;0!==c&&(o+=i*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+a,n,n-r,i,this.far)},toJSON:function(t){var e=tn.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Object.assign(an.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var on,sn,cn,hn,ln,un,dn,pn,fn,mn,gn,vn,yn,xn,_n,bn,wn,Mn,En,Tn,Sn,An,Rn,Ln,Pn,Cn,In,Un,Nn,On,Dn,Fn,Bn,zn,Gn,Hn,Vn,kn,jn,Wn,Xn,qn,Yn,Zn,Jn,Qn,Kn,$n,tr,er,ir,nr,rr,ar=0;function or(){return ar++}function sr(){Object.defineProperty(this,"id",{value:or()}),this.uuid=$t.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 cr(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=$t.generateUUID(),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function hr(t,e){cr.call(this,new Int8Array(t),e)}function lr(t,e){cr.call(this,new Uint8Array(t),e)}function ur(t,e){cr.call(this,new Uint8ClampedArray(t),e)}function dr(t,e){cr.call(this,new Int16Array(t),e)}function pr(t,e){cr.call(this,new Uint16Array(t),e)}function fr(t,e){cr.call(this,new Int32Array(t),e)}function mr(t,e){cr.call(this,new Uint32Array(t),e)}function gr(t,e){cr.call(this,new Float32Array(t),e)}function vr(t,e){cr.call(this,new Float64Array(t),e)}function yr(){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 xr(t){if(0===t.length)return-1/0;for(var e=t[0],i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}function _r(){Object.defineProperty(this,"id",{value:or()}),this.uuid=$t.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 br(t,e,i,n,r,a){sr.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new wr(t,e,i,n,r,a)),this.mergeVertices()}function wr(t,e,i,n,r,a){_r.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};var L=this;n=Math.floor(n)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var P=[],C=[],I=[],U=[],N=0,O=0;function o(t,e,i,n,r,a,o,s,c,h,l){for(var u=a/c,d=o/h,p=a/2,f=o/2,m=s/2,g=c+1,v=h+1,y=0,x=0,_=new re,b=0;b<v;b++)for(var w=b*d-f,M=0;M<g;M++){var E=M*u-p;_[t]=E*n,_[e]=w*r,_[i]=m,C.push(_.x,_.y,_.z),_[t]=0,_[e]=0,_[i]=0<s?1:-1,I.push(_.x,_.y,_.z),U.push(M/c),U.push(1-b/h),y+=1}for(b=0;b<h;b++)for(M=0;M<c;M++){var T=N+M+g*b,S=N+M+g*(b+1),A=N+(M+1)+g*(b+1),R=N+(M+1)+g*b;P.push(T,S,R),P.push(S,A,R),x+=6}L.addGroup(O,x,l),O+=x,N+=y}o("z","y","x",-1,-1,i,e,t,a,r,0),o("z","y","x",1,-1,i,e,-t,a,r,1),o("x","z","y",1,1,t,i,e,n,a,2),o("x","z","y",1,-1,t,i,-e,n,a,3),o("x","y","z",1,-1,t,e,i,n,r,4),o("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(P),this.addAttribute("position",new gr(C,3)),this.addAttribute("normal",new gr(I,3)),this.addAttribute("uv",new gr(U,2))}function Mr(t,e,i,n){sr.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n},this.fromBufferGeometry(new Er(t,e,i,n)),this.mergeVertices()}function Er(t,e,i,n){_r.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};for(var r=t/2,a=e/2,o=Math.floor(i)||1,s=Math.floor(n)||1,c=o+1,h=s+1,l=t/o,u=e/s,d=[],p=[],f=[],m=[],g=0;g<h;g++)for(var v=g*u-a,y=0;y<c;y++){var x=y*l-r;p.push(x,-v,0),f.push(0,0,1),m.push(y/o),m.push(1-g/s)}for(g=0;g<s;g++)for(y=0;y<o;y++){var _=y+c*g,b=y+c*(g+1),w=y+1+c*(g+1),M=y+1+c*g;d.push(_,b,M),d.push(b,w,M)}this.setIndex(d),this.addAttribute("position",new gr(p,3)),this.addAttribute("normal",new gr(f,3)),this.addAttribute("uv",new gr(m,2))}function Tr(t){Ei.call(this),this.type="MeshBasicMaterial",this.color=new qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function Sr(t,e){this.origin=void 0!==t?t:new re,this.direction=void 0!==e?e:new re}function Ar(t,e){this.start=void 0!==t?t:new re,this.end=void 0!==e?e:new re}function Rr(t,e,i){this.a=void 0!==t?t:new re,this.b=void 0!==e?e:new re,this.c=void 0!==i?i:new re}function Lr(t,e){tn.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new _r,this.material=void 0!==e?e:new Tr({color:16777215*Math.random()}),this.drawMode=Kt,this.updateMorphTargets()}function Pr(t,e,i,n,r,a,o){return Rr.barycoordFromPoint(t,e,i,n,ir),r.multiplyScalar(ir.x),a.multiplyScalar(ir.y),o.multiplyScalar(ir.z),r.add(a).add(o),r.clone()}function Cr(t,e,i,n,r,a,o){var s=t.material,c=s.side===W?i.intersectTriangle(a,r,n,!0,o):i.intersectTriangle(n,r,a,s.side!==X,o);if(null===c)return null;rr.copy(o),rr.applyMatrix4(t.matrixWorld);var h=e.ray.origin.distanceTo(rr);return h<e.near||h>e.far?null:{distance:h,point:rr.clone(),object:t}}function Ir(t,e,i,n,r,a,o,s){qn.fromBufferAttribute(n,a),Yn.fromBufferAttribute(n,o),Zn.fromBufferAttribute(n,s);var c=Cr(t,e,i,qn,Yn,Zn,nr);return c&&(r&&($n.fromBufferAttribute(r,a),tr.fromBufferAttribute(r,o),er.fromBufferAttribute(r,s),c.uv=Pr(nr,qn,Yn,Zn,$n,tr,er)),c.face=new an(a,o,s,Rr.normal(qn,Yn,Zn)),c.faceIndex=a),c}function Ur(r,i,a,n){var o,s,c,h,l=new qe(0),u=0;function d(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,n)}return{getClearColor:function(){return l},setClearColor:function(t,e){l.set(t),d(l,u=void 0!==e?e:1)},getClearAlpha:function(){return u},setClearAlpha:function(t){d(l,u=t)},render:function(t,e,i){var n=t.background;null===n?d(l,u):n&&n.isColor&&(d(n,1),i=!0),(r.autoClear||i)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),n&&n.isCubeTexture?(void 0===c&&(c=new rn,h=new Lr(new wr(5,5,5),new Ti({uniforms:ti.cube.uniforms,vertexShader:ti.cube.vertexShader,fragmentShader:ti.cube.fragmentShader,side:W,depthTest:!1,depthWrite:!1,fog:!1}))),c.projectionMatrix.copy(e.projectionMatrix),c.matrixWorld.extractRotation(e.matrixWorld),c.matrixWorldInverse.getInverse(c.matrixWorld),h.material.uniforms.tCube.value=n,h.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,h.matrixWorld),a.update(h),r.renderBufferDirect(c,null,h.geometry,h.material,h,null)):n&&n.isTexture&&(void 0===o&&(o=new nn(-1,1,1,-1,0,1),s=new Lr(new Er(2,2),new Tr({depthTest:!1,depthWrite:!1,fog:!1}))),s.material.map=n,a.update(s),r.renderBufferDirect(o,null,s.geometry,s.material,s,null))}}}function Nr(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.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 Or(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Dr(){var c=[],h=-1,l=[],u=-1;return{opaque:c,transparent:l,init:function(){u=h=-1},push:function(t,e,i,n,r){var a,o=i.transparent?(a=l,++u):(a=c,++h),s=a[o];s?(s.id=t.id,s.object=t,s.geometry=e,s.material=i,s.program=i.program,s.renderOrder=t.renderOrder,s.z=n,s.group=r):(s={id:t.id,object:t,geometry:e,material:i,program:i.program,renderOrder:t.renderOrder,z:n,group:r},a.push(s))},finish:function(){c.length=h+1,l.length=u+1},sort:function(){c.sort(Nr),l.sort(Or)}}}function Fr(){var r={};return{get:function(t,e){var i=t.id+","+e.id,n=r[i];return void 0===n&&(n=new Dr,r[i]=n),n},dispose:function(){r={}}}}function Br(r,a,o){var s,c,h;this.setMode=function(t){s=t},this.setIndex=function(t){c=t.type,h=t.bytesPerElement},this.render=function(t,e){r.drawElements(s,e,c,t*h),o.calls++,o.vertices+=e,s===r.TRIANGLES&&(o.faces+=e/3)},this.renderInstances=function(t,e,i){var n=a.get("ANGLE_instanced_arrays");null!==n?(n.drawElementsInstancedANGLE(s,i,c,e*h,t.maxInstancedCount),o.calls++,o.vertices+=i*t.maxInstancedCount,s===r.TRIANGLES&&(o.faces+=t.maxInstancedCount*i/3)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function zr(a,o,s){var c;this.setMode=function(t){c=t},this.render=function(t,e){a.drawArrays(c,t,e),s.calls++,s.vertices+=e,c===a.TRIANGLES&&(s.faces+=e/3)},this.renderInstances=function(t,e,i){var n,r=o.get("ANGLE_instanced_arrays");null!==r?((n=t.attributes.position).isInterleavedBufferAttribute?(i=n.data.count,r.drawArraysInstancedANGLE(c,0,i,t.maxInstancedCount)):r.drawArraysInstancedANGLE(c,e,i,t.maxInstancedCount),s.calls++,s.vertices+=i*t.maxInstancedCount,c===a.TRIANGLES&&(s.faces+=t.maxInstancedCount*i/3)):console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function Gr(u,d,a){var o={},p={};function s(t){var e,i=t.target,n=o[i.id];for(e in null!==n.index&&d.remove(n.index),n.attributes)d.remove(n.attributes[e]);i.removeEventListener("dispose",s),delete o[i.id];var r=p[i.id];r&&(d.remove(r),delete p[i.id]),(r=p[n.id])&&(d.remove(r),delete p[n.id]),a.geometries--}return{get:function(t,e){var i=o[e.id];return i||(e.addEventListener("dispose",s),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new _r).setFromObject(t)),i=e._bufferGeometry),o[e.id]=i,a.geometries++,i)},update:function(t){var e=t.index,i=t.attributes;for(n in null!==e&&d.update(e,u.ELEMENT_ARRAY_BUFFER),i)d.update(i[n],u.ARRAY_BUFFER);var n,r=t.morphAttributes;for(n in r)for(var a=r[n],o=0,s=a.length;o<s;o++)d.update(a[o],u.ARRAY_BUFFER)},getWireframeAttribute:function(t){var e=p[t.id];if(e)return e;var i=[],n=t.index,r=t.attributes;if(null!==n)for(var a=0,o=(l=n.array).length;a<o;a+=3){var s=l[a+0],c=l[a+1],h=l[a+2];i.push(s,c,c,h,h,s)}else for(var l,a=0,o=(l=r.position.array).length/3-1;a<o;a+=3){s=a+0,c=a+1,h=a+2;i.push(s,c,c,h,h,s)}return e=new(65535<xr(i)?mr:pr)(i,1),d.update(e,u.ELEMENT_ARRAY_BUFFER),p[t.id]=e}}}function Hr(){var i={};return{get:function(t){if(void 0!==i[t.id])return i[t.id];var e;switch(t.type){case"DirectionalLight":e={direction:new re,color:new qe,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"SpotLight":e={position:new re,direction:new re,color:new qe,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"PointLight":e={position:new re,color:new qe,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new _t};break;case"HemisphereLight":e={direction:new re,skyColor:new qe,groundColor:new qe};break;case"RectAreaLight":e={color:new qe,position:new re,halfWidth:new re,halfHeight:new re}}return i[t.id]=e}}}function Vr(t,r,a){var o={};return{update:function(t){var e=a.frame,i=t.geometry,n=r.get(t,i);return o[n.id]!==e&&(i.isGeometry&&n.updateFromObject(t),r.update(n),o[n.id]=e),n},clear:function(){o={}}}}function kr(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),!1===t.getShaderParameter(n,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(n)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(n),function(t){for(var e=t.split("\n"),i=0;i<e.length;i++)e[i]=i+1+": "+e[i];return e.join("\n")}(i)),n}Object.assign(sr.prototype,e.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new Li).getNormalMatrix(t),i=0,n=this.vertices.length;i<n;i++){this.vertices[i].applyMatrix4(t)}for(i=0,n=this.faces.length;i<n;i++){var r=this.faces[i];r.normal.applyMatrix3(e).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(un=new ae,function(t){return un.makeRotationX(t),this.applyMatrix(un),this}),rotateY:(ln=new ae,function(t){return ln.makeRotationY(t),this.applyMatrix(ln),this}),rotateZ:(hn=new ae,function(t){return hn.makeRotationZ(t),this.applyMatrix(hn),this}),translate:(cn=new ae,function(t,e,i){return cn.makeTranslation(t,e,i),this.applyMatrix(cn),this}),scale:(sn=new ae,function(t,e,i){return sn.makeScale(t,e,i),this.applyMatrix(sn),this}),lookAt:(on=new tn,function(t){on.lookAt(t),on.updateMatrix(),this.applyMatrix(on.matrix)}),fromBufferGeometry:function(t){var a=this,e=null!==t.index?t.index.array:void 0,i=t.attributes,n=i.position.array,o=void 0!==i.normal?i.normal.array:void 0,s=void 0!==i.color?i.color.array:void 0,c=void 0!==i.uv?i.uv.array:void 0,h=void 0!==i.uv2?i.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var l=[],u=[],d=[],r=0,p=0;r<n.length;r+=3,p+=2)a.vertices.push(new re(n[r],n[r+1],n[r+2])),void 0!==o&&l.push(new re(o[r],o[r+1],o[r+2])),void 0!==s&&a.colors.push(new qe(s[r],s[r+1],s[r+2])),void 0!==c&&u.push(new _t(c[p],c[p+1])),void 0!==h&&d.push(new _t(h[p],h[p+1]));function f(t,e,i,n){var r=new an(t,e,i,void 0!==o?[l[t].clone(),l[e].clone(),l[i].clone()]:[],void 0!==s?[a.colors[t].clone(),a.colors[e].clone(),a.colors[i].clone()]:[],n);a.faces.push(r),void 0!==c&&a.faceVertexUvs[0].push([u[t].clone(),u[e].clone(),u[i].clone()]),void 0!==h&&a.faceVertexUvs[1].push([d[t].clone(),d[e].clone(),d[i].clone()])}var m=t.groups;if(0<m.length)for(r=0;r<m.length;r++)for(var g=m[r],v=g.start,p=v,y=v+g.count;p<y;p+=3)void 0!==e?f(e[p],e[p+1],e[p+2],g.materialIndex):f(p,p+1,p+2,g.materialIndex);else if(void 0!==e)for(r=0;r<e.length;r+=3)f(e[r],e[r+1],e[r+2]);else for(r=0;r<n.length/3;r+=3)f(r,r+1,r+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new ae;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var t=new re,e=new re,i=0,n=this.faces.length;i<n;i++){var r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var e,i,n,r;for(void 0===t&&(t=!0),r=new Array(this.vertices.length),e=0,i=this.vertices.length;e<i;e++)r[e]=new re;if(t)for(var a,o,s,c=new re,h=new re,l=0,u=this.faces.length;l<u;l++)n=this.faces[l],a=this.vertices[n.a],o=this.vertices[n.b],s=this.vertices[n.c],c.subVectors(s,o),h.subVectors(a,o),c.cross(h),r[n.a].add(c),r[n.b].add(c),r[n.c].add(c);else for(this.computeFaceNormals(),l=0,u=this.faces.length;l<u;l++)r[(n=this.faces[l]).a].add(n.normal),r[n.b].add(n.normal),r[n.c].add(n.normal);for(e=0,i=this.vertices.length;e<i;e++)r[e].normalize();for(l=0,u=this.faces.length;l<u;l++){var d=(n=this.faces[l]).vertexNormals;3===d.length?(d[0].copy(r[n.a]),d[1].copy(r[n.b]),d[2].copy(r[n.c])):(d[0]=r[n.a].clone(),d[1]=r[n.b].clone(),d[2]=r[n.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var n=(i=this.faces[t]).vertexNormals;3===n.length?(n[0].copy(i.normal),n[1].copy(i.normal),n[2].copy(i.normal)):(n[0]=i.normal.clone(),n[1]=i.normal.clone(),n[2]=i.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i;for(o=0,s=this.faces.length;o<s;o++)for((i=this.faces[o]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var n=new sr;for(n.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];for(var r=this.morphNormals[t].faceNormals,a=this.morphNormals[t].vertexNormals,o=0,s=this.faces.length;o<s;o++)c=new re,h={a:new re,b:new re,c:new re},r.push(c),a.push(h)}var c,h,l=this.morphNormals[t];for(n.vertices=this.morphTargets[t].vertices,n.computeFaceNormals(),n.computeVertexNormals(),o=0,s=this.faces.length;o<s;o++)i=this.faces[o],c=l.faceNormals[o],h=l.vertexNormals[o],c.copy(i.normal),h.a.copy(i.vertexNormals[0]),h.b.copy(i.vertexNormals[1]),h.c.copy(i.vertexNormals[2])}for(o=0,s=this.faces.length;o<s;o++)(i=this.faces[o]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,i=0,n=e.length;i<n;i++)0<i&&(t+=e[i].distanceTo(e[i-1])),this.lineDistances[i]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ai),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ri),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,i){if(t&&t.isGeometry){var n,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0],u=this.colors,d=t.colors;void 0===i&&(i=0),void 0!==e&&(n=(new Li).getNormalMatrix(e));for(var p=0,f=o.length;p<f;p++){var m=o[p].clone();void 0!==e&&m.applyMatrix4(e),a.push(m)}for(p=0,f=d.length;p<f;p++)u.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var g,v,y=c[p],x=y.vertexNormals,_=y.vertexColors,b=new an(y.a+r,y.b+r,y.c+r);b.normal.copy(y.normal),void 0!==n&&b.normal.applyMatrix3(n).normalize();for(var w=0,M=x.length;w<M;w++)g=x[w].clone(),void 0!==n&&g.applyMatrix3(n).normalize(),b.vertexNormals.push(g);b.color.copy(y.color);for(w=0,M=_.length;w<M;w++)v=_[w],b.vertexColors.push(v.clone());b.materialIndex=y.materialIndex+i,s.push(b)}for(p=0,f=l.length;p<f;p++){var E=l[p],T=[];if(void 0!==E){for(w=0,M=E.length;w<M;w++)T.push(E[w].clone());h.push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){for(var t,e,i,n,r,a,o={},s=[],c=[],h=Math.pow(10,4),l=0,u=this.vertices.length;l<u;l++)t=this.vertices[l],void 0===o[e=Math.round(t.x*h)+"_"+Math.round(t.y*h)+"_"+Math.round(t.z*h)]?(o[e]=l,s.push(this.vertices[l]),c[l]=s.length-1):c[l]=c[o[e]];var d=[];for(l=0,u=this.faces.length;l<u;l++){(i=this.faces[l]).a=c[i.a],i.b=c[i.b],i.c=c[i.c],n=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(n[p]===n[(p+1)%3]){d.push(l);break}}for(l=d.length-1;0<=l;l--){var f=d[l];for(this.faces.splice(f,1),r=0,a=this.faceVertexUvs.length;r<a;r++)this.faceVertexUvs[r].splice(f,1)}var m=this.vertices.length-s.length;return this.vertices=s,m},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,i=0;i<e;i++)t[i]._id=i;t.sort(function(t,e){return t.materialIndex-e.materialIndex});var n,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===e&&(n=[]),o&&o.length===e&&(r=[]);for(i=0;i<e;i++){var s=t[i]._id;n&&n.push(a[s]),r&&r.push(o[s])}n&&(this.faceVertexUvs[0]=n),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e,i=this.parameters;for(e in i)void 0!==i[e]&&(t[e]=i[e]);return t}for(var n=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];n.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},h=[],l={},u=[],d={},r=0;r<this.faces.length;r++){var p,f,m,g,v=this.faces[r],y=void 0!==this.faceVertexUvs[0][r],x=0<v.normal.length(),_=0<v.vertexNormals.length,b=1!==v.color.r||1!==v.color.g||1!==v.color.b,w=0<v.vertexColors.length;g=M(2,3,y),g=M(g,4,x),g=M(g,5,_),g=M(g,6,b),g=M(g,7,w),o.push(g),o.push(v.a,v.b,v.c),o.push(v.materialIndex),y&&(p=this.faceVertexUvs[0][r],o.push(S(p[0]),S(p[1]),S(p[2]))),x&&o.push(E(v.normal)),_&&(f=v.vertexNormals,o.push(E(f[0]),E(f[1]),E(f[2]))),b&&o.push(T(v.color)),w&&(m=v.vertexColors,o.push(T(m[0]),T(m[1]),T(m[2])))}function M(t,e,i){return i?t|1<<e:t&~(1<<e)}function E(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]||(c[e]=s.length/3,s.push(t.x,t.y,t.z)),c[e]}function T(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==l[e]||(l[e]=h.length,h.push(t.getHex())),l[e]}function S(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]||(d[e]=u.length/2,u.push(t.x,t.y)),d[e]}return t.data={},t.data.vertices=n,t.data.normals=s,0<h.length&&(t.data.colors=h),0<u.length&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){return(new sr).copy(this)},copy:function(t){var e,i;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;for(var n=t.vertices,r=0,a=n.length;r<a;r++)this.vertices.push(n[r].clone());var o=t.colors;for(r=0,a=o.length;r<a;r++)this.colors.push(o[r].clone());var s=t.faces;for(r=0,a=s.length;r<a;r++)this.faces.push(s[r].clone());for(r=0,a=t.faceVertexUvs.length;r<a;r++){var c=t.faceVertexUvs[r];for(void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]),e=0,i=c.length;e<i;e++){for(var h=c[e],l=[],u=0,d=h.length;u<d;u++){var p=h[u];l.push(p.clone())}this.faceVertexUvs[r].push(l)}}var f=t.morphTargets;for(r=0,a=f.length;r<a;r++){var m={};if(m.name=f[r].name,void 0!==f[r].vertices)for(m.vertices=[],e=0,i=f[r].vertices.length;e<i;e++)m.vertices.push(f[r].vertices[e].clone());if(void 0!==f[r].normals)for(m.normals=[],e=0,i=f[r].normals.length;e<i;e++)m.normals.push(f[r].normals[e].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(r=0,a=g.length;r<a;r++){var v={};if(void 0!==g[r].vertexNormals)for(v.vertexNormals=[],e=0,i=g[r].vertexNormals.length;e<i;e++){var y=g[r].vertexNormals[e],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[r].faceNormals)for(v.faceNormals=[],e=0,i=g[r].faceNormals.length;e<i;e++)v.faceNormals.push(g[r].faceNormals[e].clone());this.morphNormals.push(v)}var _=t.skinWeights;for(r=0,a=_.length;r<a;r++)this.skinWeights.push(_[r].clone());var b=t.skinIndices;for(r=0,a=b.length;r<a;r++)this.skinIndices.push(b[r].clone());var w=t.lineDistances;for(r=0,a=w.length;r<a;r++)this.lineDistances.push(w[r]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var E=t.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(cr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(cr.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.itemSize,i*=e.itemSize;for(var n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new qe),e[i++]=a.r,e[i++]=a.g,e[i++]=a.b}return this},copyIndicesArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];e[i++]=a.a,e[i++]=a.b,e[i++]=a.c}return this},copyVector2sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new _t),e[i++]=a.x,e[i++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new re),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,i=0,n=0,r=t.length;n<r;n++){var a=t[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new te),e[i++]=a.x,e[i++]=a.y,e[i++]=a.z,e[i++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(hr.prototype=Object.create(cr.prototype)).constructor=hr,(lr.prototype=Object.create(cr.prototype)).constructor=lr,(ur.prototype=Object.create(cr.prototype)).constructor=ur,(dr.prototype=Object.create(cr.prototype)).constructor=dr,(pr.prototype=Object.create(cr.prototype)).constructor=pr,(fr.prototype=Object.create(cr.prototype)).constructor=fr,(mr.prototype=Object.create(cr.prototype)).constructor=mr,(gr.prototype=Object.create(cr.prototype)).constructor=gr,(vr.prototype=Object.create(cr.prototype)).constructor=vr,Object.assign(yr.prototype,{computeGroups:function(t){for(var e,i=[],n=void 0,r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,i.push(e)),e={start:3*a,materialIndex:n})}void 0!==e&&(e.count=3*a-e.start,i.push(e)),this.groups=i},fromGeometry:function(t){var e,i=t.faces,n=t.vertices,r=t.faceVertexUvs,a=r[0]&&0<r[0].length,o=r[1]&&0<r[1].length,s=t.morphTargets,c=s.length;if(0<c){e=[];for(var h=0;h<c;h++)e[h]=[];this.morphTargets.position=e}var l,u=t.morphNormals,d=u.length;if(0<d){l=[];for(h=0;h<d;h++)l[h]=[];this.morphTargets.normal=l}for(var p=t.skinIndices,f=t.skinWeights,m=p.length===n.length,g=f.length===n.length,h=0;h<i.length;h++){var v=i[h];this.vertices.push(n[v.a],n[v.b],n[v.c]);var y,x=v.vertexNormals;3===x.length?this.normals.push(x[0],x[1],x[2]):(y=v.normal,this.normals.push(y,y,y));var _,b,w=v.vertexColors;3===w.length?this.colors.push(w[0],w[1],w[2]):(_=v.color,this.colors.push(_,_,_)),!0===a&&(void 0!==(b=r[0][h])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new _t,new _t,new _t))),!0===o&&(void 0!==(b=r[1][h])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new _t,new _t,new _t)));for(var M=0;M<c;M++){var E=s[M].vertices;e[M].push(E[v.a],E[v.b],E[v.c])}for(M=0;M<d;M++){var T=u[M].vertexNormals[h];l[M].push(T.a,T.b,T.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}}),_r.MaxIndex=65535,Object.assign(_r.prototype,e.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<xr(t)?mr:pr)(t,1):this.index=t},addAttribute:function(t,e,i){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new cr(e,i)))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal;return void 0!==i&&((new Li).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(xn=new ae,function(t){return xn.makeRotationX(t),this.applyMatrix(xn),this}),rotateY:(yn=new ae,function(t){return yn.makeRotationY(t),this.applyMatrix(yn),this}),rotateZ:(vn=new ae,function(t){return vn.makeRotationZ(t),this.applyMatrix(vn),this}),translate:(gn=new ae,function(t,e,i){return gn.makeTranslation(t,e,i),this.applyMatrix(gn),this}),scale:(mn=new ae,function(t,e,i){return mn.makeScale(t,e,i),this.applyMatrix(mn),this}),lookAt:(fn=new tn,function(t){fn.lookAt(t),fn.updateMatrix(),this.applyMatrix(fn.matrix)}),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e,i,n,r=t.geometry;return t.isPoints||t.isLine?(e=new gr(3*r.vertices.length,3),i=new gr(3*r.colors.length,3),this.addAttribute("position",e.copyVector3sArray(r.vertices)),this.addAttribute("color",i.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length&&(n=new gr(r.lineDistances.length,1),this.addAttribute("lineDistance",n.copyArray(r.lineDistances))),null!==r.boundingSphere&&(this.boundingSphere=r.boundingSphere.clone()),null!==r.boundingBox&&(this.boundingBox=r.boundingBox.clone())):t.isMesh&&r&&r.isGeometry&&this.fromGeometry(r),this},updateFromObject:function(t){var e,i=t.geometry;if(t.isMesh){var n=i.__directGeometry;if(!0===i.elementsNeedUpdate&&(n=void 0,i.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(i);n.verticesNeedUpdate=i.verticesNeedUpdate,n.normalsNeedUpdate=i.normalsNeedUpdate,n.colorsNeedUpdate=i.colorsNeedUpdate,n.uvsNeedUpdate=i.uvsNeedUpdate,n.groupsNeedUpdate=i.groupsNeedUpdate,i.verticesNeedUpdate=!1,i.normalsNeedUpdate=!1,i.colorsNeedUpdate=!1,i.uvsNeedUpdate=!1,i.groupsNeedUpdate=!1,i=n}return!0===i.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(i.vertices),e.needsUpdate=!0),i.verticesNeedUpdate=!1),!0===i.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(i.normals),e.needsUpdate=!0),i.normalsNeedUpdate=!1),!0===i.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(i.colors),e.needsUpdate=!0),i.colorsNeedUpdate=!1),i.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(i.uvs),e.needsUpdate=!0),i.uvsNeedUpdate=!1),i.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(i.lineDistances),e.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 yr).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e,i,n,r,a,o,s,c,h=new Float32Array(3*t.vertices.length);for(o in this.addAttribute("position",new cr(h,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(e=new Float32Array(3*t.normals.length),this.addAttribute("normal",new cr(e,3).copyVector3sArray(t.normals))),0<t.colors.length&&(i=new Float32Array(3*t.colors.length),this.addAttribute("color",new cr(i,3).copyColorsArray(t.colors))),0<t.uvs.length&&(n=new Float32Array(2*t.uvs.length),this.addAttribute("uv",new cr(n,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(r=new Float32Array(2*t.uvs2.length),this.addAttribute("uv2",new cr(r,2).copyVector2sArray(t.uvs2))),0<t.indices.length&&(a=new(65535<xr(t.indices)?Uint32Array:Uint16Array)(3*t.indices.length),this.setIndex(new cr(a,1).copyIndicesArray(t.indices))),this.groups=t.groups,t.morphTargets){for(var l=[],u=t.morphTargets[o],d=0,p=u.length;d<p;d++){var f=u[d],m=new gr(3*f.length,3);l.push(m.copyVector3sArray(f))}this.morphAttributes[o]=l}return 0<t.skinIndices.length&&(s=new gr(4*t.skinIndices.length,4),this.addAttribute("skinIndex",s.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(c=new gr(4*t.skinWeights.length,4),this.addAttribute("skinWeight",c.copyVector4sArray(t.skinWeights))),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 Ai);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:(dn=new Ai,pn=new re,function(){null===this.boundingSphere&&(this.boundingSphere=new Ri);var t=this.attributes.position;if(t){var e=this.boundingSphere.center;dn.setFromBufferAttribute(t),dn.getCenter(e);for(var i=0,n=0,r=t.count;n<r;n++)pn.x=t.getX(n),pn.y=t.getY(n),pn.z=t.getZ(n),i=Math.max(i,e.distanceToSquared(pn));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,i=this.groups;if(e.position){var n=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new cr(new Float32Array(n.length),3));else for(var r=e.normal.array,a=0,o=r.length;a<o;a++)r[a]=0;var s,c,h,l=e.normal.array,u=new re,d=new re,p=new re,f=new re,m=new re;if(t){var g=t.array;0===i.length&&this.addGroup(0,g.length);for(var v=0,y=i.length;v<y;++v)for(var x=i[v],_=x.start,a=_,o=_+x.count;a<o;a+=3)s=3*g[a+0],c=3*g[a+1],h=3*g[a+2],u.fromArray(n,s),d.fromArray(n,c),p.fromArray(n,h),f.subVectors(p,d),m.subVectors(u,d),f.cross(m),l[s]+=f.x,l[1+s]+=f.y,l[2+s]+=f.z,l[c]+=f.x,l[1+c]+=f.y,l[2+c]+=f.z,l[h]+=f.x,l[1+h]+=f.y,l[2+h]+=f.z}else for(a=0,o=n.length;a<o;a+=9)u.fromArray(n,a),d.fromArray(n,a+3),p.fromArray(n,a+6),f.subVectors(p,d),m.subVectors(u,d),f.cross(m),l[a]=f.x,l[a+1]=f.y,l[a+2]=f.z,l[a+3]=f.x,l[a+4]=f.y,l[a+5]=f.z,l[a+6]=f.x,l[a+7]=f.y,l[a+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0);var i,n=this.attributes;for(i in n)if(void 0!==t.attributes[i])for(var r=n[i].array,a=t.attributes[i],o=a.array,s=0,c=a.itemSize*e;s<o.length;s++,c++)r[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t,e,i,n,r=this.attributes.normal,a=0,o=r.count;a<o;a++)t=r.getX(a),e=r.getY(a),i=r.getZ(a),n=1/Math.sqrt(t*t+e*e+i*i),r.setXYZ(a,t*n,e*n,i*n)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t,e=new _r,i=this.index.array,n=this.attributes;for(t in n){for(var r=n[t],a=r.array,o=r.itemSize,s=new a.constructor(i.length*o),c=0,h=0,l=0,u=i.length;l<u;l++){c=i[l]*o;for(var d=0;d<o;d++)s[h++]=a[c++]}e.addAttribute(t,new cr(s,o))}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var i=this.index;null!==i&&(o=Array.prototype.slice.call(i.array),t.data.index={type:i.array.constructor.name,array:o});var n,r=this.attributes;for(n in r){var a=r[n],o=Array.prototype.slice.call(a.array);t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:o,normalized:a.normalized}}var s=this.groups;0<s.length&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new _r).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var e=t.index;null!==e&&this.setIndex(e.clone());var i=t.attributes;for(var n in i){var r=i[n];this.addAttribute(n,r.clone())}var a=t.morphAttributes;for(n in a){for(var o=[],s=a[n],c=0,h=s.length;c<h;c++)o.push(s[c].clone());this.morphAttributes[n]=o}var l=t.groups;for(c=0,h=l.length;c<h;c++){var u=l[c];this.addGroup(u.start,u.count,u.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(br.prototype=Object.create(sr.prototype)).constructor=br,(wr.prototype=Object.create(_r.prototype)).constructor=wr,(Mr.prototype=Object.create(sr.prototype)).constructor=Mr,(Er.prototype=Object.create(_r.prototype)).constructor=Er,((Tr.prototype=Object.create(Ei.prototype)).constructor=Tr).prototype.isMeshBasicMaterial=!0,Tr.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.assign(Sr.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new re).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:(Pn=new re,function(t){return this.origin.copy(this.at(t,Pn)),this}),closestPointToPoint:function(t,e){var i=e||new re;i.subVectors(t,this.origin);var n=i.dot(this.direction);return n<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:(Ln=new re,function(t){var e=Ln.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ln.copy(this.direction).multiplyScalar(e).add(this.origin),Ln.distanceToSquared(t))}),distanceSqToSegment:(Sn=new re,An=new re,Rn=new re,function(t,e,i,n){Sn.copy(t).add(e).multiplyScalar(.5),An.copy(e).sub(t).normalize(),Rn.copy(this.origin).sub(Sn);var r,a,o,s,c,h=.5*t.distanceTo(e),l=-this.direction.dot(An),u=Rn.dot(this.direction),d=-Rn.dot(An),p=Rn.lengthSq(),f=Math.abs(1-l*l);return a=0<f?(s=l*u-d,c=h*f,0<=(o=l*d-u)?-c<=s?s<=c?(o*=r=1/f)*(o+l*(s*=r)+2*u)+s*(l*o+s+2*d)+p:(s=h,-(o=Math.max(0,-(l*s+u)))*o+s*(s+2*d)+p):(s=-h,-(o=Math.max(0,-(l*s+u)))*o+s*(s+2*d)+p):s<=-c?-(o=Math.max(0,-(-l*h+u)))*o+(s=0<o?-h:Math.min(Math.max(-h,-d),h))*(s+2*d)+p:s<=c?(o=0,(s=Math.min(Math.max(-h,-d),h))*(s+2*d)+p):-(o=Math.max(0,-(l*h+u)))*o+(s=0<o?h:Math.min(Math.max(-h,-d),h))*(s+2*d)+p):(s=0<l?-h:h,-(o=Math.max(0,-(l*s+u)))*o+s*(s+2*d)+p),i&&i.copy(this.direction).multiplyScalar(o).add(this.origin),n&&n.copy(An).multiplyScalar(s).add(Sn),a}),intersectSphere:(Tn=new re,function(t,e){Tn.subVectors(t.center,this.origin);var i=Tn.dot(this.direction),n=Tn.dot(Tn)-i*i,r=t.radius*t.radius;if(r<n)return null;var a=Math.sqrt(r-n),o=i-a,s=i+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}),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 i=-(this.origin.dot(t.normal)+t.constant)/e;return 0<=i?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,a,o=1/this.direction.x,s=1/this.direction.y,c=1/this.direction.z,h=this.origin,l=0<=o?(i=(t.min.x-h.x)*o,(t.max.x-h.x)*o):(i=(t.max.x-h.x)*o,(t.min.x-h.x)*o),u=0<=s?(n=(t.min.y-h.y)*s,(t.max.y-h.y)*s):(n=(t.max.y-h.y)*s,(t.min.y-h.y)*s);return u<i||l<n?null:((i<n||i!=i)&&(i=n),(u<l||l!=l)&&(l=u),(a=0<=c?(r=(t.min.z-h.z)*c,(t.max.z-h.z)*c):(r=(t.max.z-h.z)*c,(t.min.z-h.z)*c))<i||l<r?null:((i<r||i!=i)&&(i=r),(a<l||l!=l)&&(l=a),l<0?null:this.at(0<=i?i:l,e)))},intersectsBox:(En=new re,function(t){return null!==this.intersectBox(t,En)}),intersectTriangle:(_n=new re,bn=new re,wn=new re,Mn=new re,function(t,e,i,n,r){bn.subVectors(e,t),wn.subVectors(i,t),Mn.crossVectors(bn,wn);var a,o=this.direction.dot(Mn);if(0<o){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}_n.subVectors(this.origin,t);var s=a*this.direction.dot(wn.crossVectors(_n,wn));if(s<0)return null;var c=a*this.direction.dot(bn.cross(_n));if(c<0)return null;if(o<s+c)return null;var h=-a*_n.dot(Mn);return h<0?null:this.at(h/o,r)}),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(Ar.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new re).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new re).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var i=e||new re;return this.delta(i).multiplyScalar(t).add(this.start)},closestPointToPointParameter:(Cn=new re,In=new re,function(t,e){Cn.subVectors(t,this.start),In.subVectors(this.end,this.start);var i=In.dot(In),n=In.dot(Cn)/i;return e&&(n=$t.clamp(n,0,1)),n}),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e),r=i||new re;return this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(Rr,{normal:(Fn=new re,function(t,e,i,n){var r=n||new re;r.subVectors(i,e),Fn.subVectors(t,e),r.cross(Fn);var a=r.lengthSq();return 0<a?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}),barycoordFromPoint:(Nn=new re,On=new re,Dn=new re,function(t,e,i,n,r){Nn.subVectors(n,e),On.subVectors(i,e),Dn.subVectors(t,e);var a=Nn.dot(Nn),o=Nn.dot(On),s=Nn.dot(Dn),c=On.dot(On),h=On.dot(Dn),l=a*c-o*o,u=r||new re;if(0==l)return u.set(-2,-1,-1);var d=1/l,p=(c*s-o*h)*d,f=(a*h-o*s)*d;return u.set(1-p-f,f,p)}),containsPoint:(Un=new re,function(t,e,i,n){var r=Rr.barycoordFromPoint(t,e,i,n,Un);return 0<=r.x&&0<=r.y&&r.x+r.y<=1})}),Object.assign(Rr.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),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:(Vn=new re,kn=new re,function(){return Vn.subVectors(this.c,this.b),kn.subVectors(this.a,this.b),.5*Vn.cross(kn).length()}),midpoint:function(t){return(t||new re).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return Rr.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new Pi).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return Rr.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Rr.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:(Bn=new Pi,zn=[new Ar,new Ar,new Ar],Gn=new re,Hn=new re,function(t,e){var i=e||new re,n=1/0;if(Bn.setFromCoplanarPoints(this.a,this.b,this.c),Bn.projectPoint(t,Gn),!0===this.containsPoint(Gn))i.copy(Gn);else{zn[0].set(this.a,this.b),zn[1].set(this.b,this.c),zn[2].set(this.c,this.a);for(var r=0;r<zn.length;r++){zn[r].closestPointToPoint(Gn,!0,Hn);var a=Gn.distanceToSquared(Hn);a<n&&(n=a,i.copy(Hn))}}return i}),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Lr.prototype=Object.assign(Object.create(tn.prototype),{constructor:Lr,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return tn.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t,e,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)i=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}else{var s=n.morphTargets;if(void 0!==s&&0<s.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=s.length;t<e;t++)i=s[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}},raycast:(jn=new ae,Wn=new Sr,Xn=new Ri,qn=new re,Yn=new re,Zn=new re,Jn=new re,Qn=new re,Kn=new re,$n=new _t,tr=new _t,er=new _t,ir=new re,nr=new re,rr=new re,function(t,e){var i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0!==n&&(null===i.boundingSphere&&i.computeBoundingSphere(),Xn.copy(i.boundingSphere),Xn.applyMatrix4(r),!1!==t.ray.intersectsSphere(Xn)&&(jn.getInverse(r),Wn.copy(t.ray).applyMatrix4(jn),null===i.boundingBox||!1!==Wn.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var a,o,s,c,h,l=i.index,u=i.attributes.position,d=i.attributes.uv;if(null!==l)for(c=0,h=l.count;c<h;c+=3)a=l.getX(c),o=l.getX(c+1),s=l.getX(c+2),(E=Ir(this,t,Wn,u,d,a,o,s))&&(E.faceIndex=Math.floor(c/3),e.push(E));else for(c=0,h=u.count;c<h;c+=3)(E=Ir(this,t,Wn,u,d,a=c,o=c+1,s=c+2))&&(E.index=a,e.push(E))}else if(i.isGeometry){var p,f,m,g,v=Array.isArray(n),y=i.vertices,x=i.faces,_=i.faceVertexUvs[0];0<_.length&&(g=_);for(var b=0,w=x.length;b<w;b++){var M,E,T=x[b],S=v?n[T.materialIndex]:n;if(void 0!==S){if(p=y[T.a],f=y[T.b],m=y[T.c],!0===S.morphTargets){var A=i.morphTargets,R=this.morphTargetInfluences;qn.set(0,0,0),Yn.set(0,0,0),Zn.set(0,0,0);for(var L=0,P=A.length;L<P;L++){var C,I=R[L];0!==I&&(C=A[L].vertices,qn.addScaledVector(Jn.subVectors(C[T.a],p),I),Yn.addScaledVector(Qn.subVectors(C[T.b],f),I),Zn.addScaledVector(Kn.subVectors(C[T.c],m),I))}qn.add(p),Yn.add(f),Zn.add(m),p=qn,f=Yn,m=Zn}(E=Cr(this,t,Wn,p,f,m,nr))&&(g&&g[b]&&(M=g[b],$n.copy(M[0]),tr.copy(M[1]),er.copy(M[2]),E.uv=Pr(nr,p,f,m,$n,tr,er)),E.face=T,E.faceIndex=b,e.push(E))}}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var jr,Wr,Xr,qr,Yr,Zr,Jr,Qr,Kr,$r,ta,ea,ia,na,ra=0;function aa(t){switch(t){case m:return["Linear","( value )"];case g:return["sRGB","( value )"];case y:return["RGBE","( value )"];case x:return["RGBM","( value, 7.0 )"];case _:return["RGBM","( value, 16.0 )"];case b:return["RGBD","( value, 256.0 )"];case v:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function oa(t,e){var i=aa(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function sa(t){return""!==t}function ca(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function ha(t){return t.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,function(t,e){var i=$e[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return ha(i)})}function la(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,i,n){for(var r="",a=parseInt(e);a<parseInt(i);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]");return r})}function ua(t,e,i,n,r){var a=t.context,o=i.extensions,s=i.defines,c=n.vertexShader,h=n.fragmentShader,l="SHADOWMAP_TYPE_BASIC";r.shadowMapType===F?l="SHADOWMAP_TYPE_PCF":r.shadowMapType===B&&(l="SHADOWMAP_TYPE_PCF_SOFT");var u="ENVMAP_TYPE_CUBE",d="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(r.envMap){switch(i.envMap.mapping){case dt:case pt:u="ENVMAP_TYPE_CUBE";break;case vt:case yt:u="ENVMAP_TYPE_CUBE_UV";break;case ft:case mt:u="ENVMAP_TYPE_EQUIREC";break;case gt:u="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case pt:case mt:d="ENVMAP_MODE_REFRACTION"}switch(i.combine){case G:p="ENVMAP_BLENDING_MULTIPLY";break;case H:p="ENVMAP_BLENDING_MIX";break;case st:p="ENVMAP_BLENDING_ADD"}}var f,m,g,v,y,x,_,b=0<t.gammaFactor?t.gammaFactor:1,w=(f=o,m=r,g=t.extensions,[(f=f||{}).derivatives||m.envMapCubeUV||m.bumpMap||m.normalMap||m.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(f.fragDepth||m.logarithmicDepthBuffer)&&g.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",f.drawBuffers&&g.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(f.shaderTextureLOD||m.envMap)&&g.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(sa).join("\n")),M=function(t){var e,i=[];for(e in t){var n=t[e];!1!==n&&i.push("#define "+e+" "+n)}return i.join("\n")}(s),E=a.createProgram(),T=i.isRawShaderMaterial?(v=[M,"\n"].filter(sa).join("\n"),[w,M,"\n"].filter(sa).join("\n")):(v=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.name,M,r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+d:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+l:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.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(sa).join("\n"),[w,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.name,M,r.alphaTest?"#define ALPHATEST "+r.alphaTest:"","#define GAMMA_FACTOR "+b,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+u:"",r.envMap?"#define "+d:"",r.envMap?"#define "+p:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(r.numClippingPlanes-r.numClipIntersection),r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+l:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==ct?"#define TONE_MAPPING":"",r.toneMapping!==ct?$e.tonemapping_pars_fragment:"",r.toneMapping!==ct?function(t,e){var i;switch(e){case Ut:i="Linear";break;case ht:i="Reinhard";break;case lt:i="Uncharted2";break;case ut:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?$e.encodings_pars_fragment:"",r.mapEncoding?oa("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?oa("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?oa("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?(y="linearToOutputTexel",x=r.outputEncoding,_=aa(x),"vec4 "+y+"( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",r.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(sa).join("\n"));c=ca(c=ha(c),r),h=ca(h=ha(h),r),i.isShaderMaterial||(c=la(c),h=la(h));var S=v+c,A=T+h,R=kr(a,a.VERTEX_SHADER,S),L=kr(a,a.FRAGMENT_SHADER,A);a.attachShader(E,R),a.attachShader(E,L),void 0!==i.index0AttributeName?a.bindAttribLocation(E,0,i.index0AttributeName):!0===r.morphTargets&&a.bindAttribLocation(E,0,"position"),a.linkProgram(E);var P,C,I=a.getProgramInfoLog(E),U=a.getShaderInfoLog(R),N=a.getShaderInfoLog(L),O=!0,D=!0;return!1===a.getProgramParameter(E,a.LINK_STATUS)?(O=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(E,a.VALIDATE_STATUS),"gl.getProgramInfoLog",I,U,N)):""!==I?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",I):""!==U&&""!==N||(D=!1),D&&(this.diagnostics={runnable:O,material:i,programLog:I,vertexShader:{log:U,prefix:v},fragmentShader:{log:N,prefix:T}}),a.deleteShader(R),a.deleteShader(L),this.getUniforms=function(){return void 0===P&&(P=new We(a,E,t)),P},this.getAttributes=function(){return void 0===C&&(C=function(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<n;r++){var a=t.getActiveAttrib(e,r).name;i[a]=t.getAttribLocation(e,a)}return i}(a,E)),C},this.destroy=function(){a.deleteProgram(E),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=ra++,this.code=e,this.usedTimes=1,this.program=E,this.vertexShader=R,this.fragmentShader=L,this}function da(l,u){var c=[],d={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function p(t,e){var i;return t?t.isTexture?i=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),i=t.texture.encoding):i=m,i===m&&e&&(i=v),i}this.getParameters=function(t,e,i,n,r,a){var o=d[t.type],s=a.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(u.floatVertexTextures)return 1024;var i=u.maxVertexUniforms,n=Math.floor((i-20)/4),r=Math.min(n,e.length);return r<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+r+"."),0):r}(a):0,c=l.getPrecision();null!==t.precision&&(c=u.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLProgram.getParameters:",t.precision,"not supported, using",c,"instead.");var h=l.getRenderTarget();return{shaderID:o,precision:c,supportsVertexTextures:u.vertexTextures,outputEncoding:p(h?h.texture:null,l.gammaOutput),map:!!t.map,mapEncoding:p(t.map,l.gammaInput),envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,envMapEncoding:p(t.envMap,l.gammaInput),envMapCubeUV:!!t.envMap&&(t.envMap.mapping===vt||t.envMap.mapping===yt),lightMap:!!t.lightMap,aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:p(t.emissiveMap,l.gammaInput),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,gradientMap:!!t.gradientMap,combine:t.combine,vertexColors:t.vertexColors,fog:!!i,useFog:t.fog,fogExp:i&&i.isFogExp2,flatShading:t.shading===Rt,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:u.logarithmicDepthBuffer,skinning:t.skinning&&0<s,maxBones:s,useVertexTexture:u.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:l.maxMorphTargets,maxMorphNormals:l.maxMorphNormals,numDirLights:e.directional.length,numPointLights:e.point.length,numSpotLights:e.spot.length,numRectAreaLights:e.rectArea.length,numHemiLights:e.hemi.length,numClippingPlanes:n,numClipIntersection:r,dithering:t.dithering,shadowMapEnabled:l.shadowMap.enabled&&a.receiveShadow&&0<e.shadows.length,shadowMapType:l.shadowMap.type,toneMapping:l.toneMapping,physicallyCorrectLights:l.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===X,flipSided:t.side===W,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,e){var i=[];if(e.shaderID?i.push(e.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)i.push(n),i.push(t.defines[n]);for(var r=0;r<a.length;r++)i.push(e[a[r]]);return i.push(t.onBeforeCompile.toString()),i.push(l.gammaOutput),i.join()},this.acquireProgram=function(t,e,i,n){for(var r,a=0,o=c.length;a<o;a++){var s=c[a];if(s.code===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new ua(l,n,t,e,i),c.push(r)),r},this.releaseProgram=function(t){var e;0==--t.usedTimes&&(e=c.indexOf(t),c[e]=c[c.length-1],c.pop(),t.destroy())},this.programs=c}function pa(f,r,m,g,v,y,x){var d="undefined"!=typeof WebGL2RenderingContext&&f instanceof WebGL2RenderingContext;function _(t,e){if(t.width>e||t.height>e){var i=e/Math.max(t.width,t.height),n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.width=Math.floor(t.width*i),n.height=Math.floor(t.height*i),n.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+n.width+"x"+n.height,t),n}return t}function b(t){return $t.isPowerOfTwo(t.width)&&$t.isPowerOfTwo(t.height)}function w(t,e){return t.generateMipmaps&&e&&t.minFilter!==Ft&&t.minFilter!==Gt}function a(t){return t===Ft||t===Bt||t===zt?f.NEAREST:f.LINEAR}function M(t){var e=t.target;e.removeEventListener("dispose",M),function(t){var e=g.get(t);if(t.image&&e.__image__webglTextureCube)f.deleteTexture(e.__image__webglTextureCube);else{if(void 0===e.__webglInit)return;f.deleteTexture(e.__webglTexture)}g.remove(t)}(e),x.textures--}function o(t){var e=t.target;e.removeEventListener("dispose",o),function(t){var e=g.get(t),i=g.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&f.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var n=0;n<6;n++)f.deleteFramebuffer(e.__webglFramebuffer[n]),e.__webglDepthbuffer&&f.deleteRenderbuffer(e.__webglDepthbuffer[n]);else f.deleteFramebuffer(e.__webglFramebuffer),e.__webglDepthbuffer&&f.deleteRenderbuffer(e.__webglDepthbuffer);g.remove(t.texture),g.remove(t)}(e),x.textures--}function s(t,e){var i=g.get(t);if(0<t.version&&i.__version!==t.version){var n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==n.complete)return void function(t,e,i){void 0===t.__webglInit&&(t.__webglInit=!0,e.addEventListener("dispose",M),t.__webglTexture=f.createTexture(),x.textures++);m.activeTexture(f.TEXTURE0+i),m.bindTexture(f.TEXTURE_2D,t.__webglTexture),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,e.flipY),f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),f.pixelStorei(f.UNPACK_ALIGNMENT,e.unpackAlignment);var n=_(e.image,v.maxTextureSize);!function(t){return t.wrapS!==Ot||t.wrapT!==Ot||t.minFilter!==Ft&&t.minFilter!==Gt}(e)||!1!==b(n)||(n=function(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return e.width=$t.nearestPowerOfTwo(t.width),e.height=$t.nearestPowerOfTwo(t.height),e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}(n));var r=b(n),a=y(e.format),o=y(e.type);E(f.TEXTURE_2D,e,r);var s,c=e.mipmaps;if(e.isDepthTexture){var h=f.DEPTH_COMPONENT;if(e.type===Wt){if(!d)throw new Error("Float Depth Texture only supported in WebGL2.0");h=f.DEPTH_COMPONENT32F}else d&&(h=f.DEPTH_COMPONENT16);e.format===Jt&&h===f.DEPTH_COMPONENT&&e.type!==kt&&e.type!==jt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),e.type=kt,o=y(e.type)),e.format===Qt&&(h=f.DEPTH_STENCIL,e.type!==qt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),e.type=qt,o=y(e.type))),m.texImage2D(f.TEXTURE_2D,0,h,n.width,n.height,0,a,o,null)}else if(e.isDataTexture)if(0<c.length&&r){for(var l=0,u=c.length;l<u;l++)s=c[l],m.texImage2D(f.TEXTURE_2D,l,a,s.width,s.height,0,a,o,s.data);e.generateMipmaps=!1}else m.texImage2D(f.TEXTURE_2D,0,a,n.width,n.height,0,a,o,n.data);else if(e.isCompressedTexture)for(l=0,u=c.length;l<u;l++)s=c[l],e.format!==Zt&&e.format!==Yt?-1<m.getCompressedTextureFormats().indexOf(a)?m.compressedTexImage2D(f.TEXTURE_2D,l,a,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):m.texImage2D(f.TEXTURE_2D,l,a,s.width,s.height,0,a,o,s.data);else if(0<c.length&&r){for(l=0,u=c.length;l<u;l++)s=c[l],m.texImage2D(f.TEXTURE_2D,l,a,a,o,s);e.generateMipmaps=!1}else m.texImage2D(f.TEXTURE_2D,0,a,a,o,n);w(e,r)&&f.generateMipmap(f.TEXTURE_2D);t.__version=e.version,e.onUpdate&&e.onUpdate(e)}(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t)}}m.activeTexture(f.TEXTURE0+e),m.bindTexture(f.TEXTURE_2D,i.__webglTexture)}function E(t,e,i){var n;if(i?(f.texParameteri(t,f.TEXTURE_WRAP_S,y(e.wrapS)),f.texParameteri(t,f.TEXTURE_WRAP_T,y(e.wrapT)),f.texParameteri(t,f.TEXTURE_MAG_FILTER,y(e.magFilter)),f.texParameteri(t,f.TEXTURE_MIN_FILTER,y(e.minFilter))):(f.texParameteri(t,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(t,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),e.wrapS===Ot&&e.wrapT===Ot||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",e),f.texParameteri(t,f.TEXTURE_MAG_FILTER,a(e.magFilter)),f.texParameteri(t,f.TEXTURE_MIN_FILTER,a(e.minFilter)),e.minFilter!==Ft&&e.minFilter!==Gt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",e)),n=r.get("EXT_texture_filter_anisotropic")){if(e.type===Wt&&null===r.get("OES_texture_float_linear"))return;if(e.type===Xt&&null===r.get("OES_texture_half_float_linear"))return;(1<e.anisotropy||g.get(e).__currentAnisotropy)&&(f.texParameterf(t,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,v.getMaxAnisotropy())),g.get(e).__currentAnisotropy=e.anisotropy)}}function c(t,e,i,n){var r=y(e.texture.format),a=y(e.texture.type);m.texImage2D(n,0,r,e.width,e.height,0,r,a,null),f.bindFramebuffer(f.FRAMEBUFFER,t),f.framebufferTexture2D(f.FRAMEBUFFER,i,n,g.get(e.texture).__webglTexture,0),f.bindFramebuffer(f.FRAMEBUFFER,null)}function h(t,e){f.bindRenderbuffer(f.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,e.width,e.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,e.width,e.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,t)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,e.width,e.height),f.bindRenderbuffer(f.RENDERBUFFER,null)}function l(t){var e=g.get(t),i=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,e){if(e&&e.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(f.bindFramebuffer(f.FRAMEBUFFER,t),!e.depthTexture||!e.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");g.get(e.depthTexture).__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),s(e.depthTexture,0);var i=g.get(e.depthTexture).__webglTexture;if(e.depthTexture.format===Jt)f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.TEXTURE_2D,i,0);else{if(e.depthTexture.format!==Qt)throw new Error("Unknown depthTexture format");f.framebufferTexture2D(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.TEXTURE_2D,i,0)}}(e.__webglFramebuffer,t)}else if(i){e.__webglDepthbuffer=[];for(var n=0;n<6;n++)f.bindFramebuffer(f.FRAMEBUFFER,e.__webglFramebuffer[n]),e.__webglDepthbuffer[n]=f.createRenderbuffer(),h(e.__webglDepthbuffer[n],t)}else f.bindFramebuffer(f.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=f.createRenderbuffer(),h(e.__webglDepthbuffer,t);f.bindFramebuffer(f.FRAMEBUFFER,null)}this.setTexture2D=s,this.setTextureCube=function(t,e){var i=g.get(t);if(6===t.image.length)if(0<t.version&&i.__version!==t.version){i.__image__webglTextureCube||(t.addEventListener("dispose",M),i.__image__webglTextureCube=f.createTexture(),x.textures++),m.activeTexture(f.TEXTURE0+e),m.bindTexture(f.TEXTURE_CUBE_MAP,i.__image__webglTextureCube),f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var n=t&&t.isCompressedTexture,r=t.image[0]&&t.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=n||r?r?t.image[o].image:t.image[o]:_(t.image[o],v.maxCubemapSize);var s=b(a[0]),c=y(t.format),h=y(t.type);E(f.TEXTURE_CUBE_MAP,t,s);for(o=0;o<6;o++)if(n)for(var l,u=a[o].mipmaps,d=0,p=u.length;d<p;d++)l=u[d],t.format!==Zt&&t.format!==Yt?-1<m.getCompressedTextureFormats().indexOf(c)?m.compressedTexImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,c,l.width,l.height,0,l.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,c,l.width,l.height,0,c,h,l.data);else r?m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c,a[o].width,a[o].height,0,c,h,a[o].data):m.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,c,c,h,a[o]);w(t,s)&&f.generateMipmap(f.TEXTURE_CUBE_MAP),i.__version=t.version,t.onUpdate&&t.onUpdate(t)}else m.activeTexture(f.TEXTURE0+e),m.bindTexture(f.TEXTURE_CUBE_MAP,i.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,e){m.activeTexture(f.TEXTURE0+e),m.bindTexture(f.TEXTURE_CUBE_MAP,g.get(t).__webglTexture)},this.setupRenderTarget=function(t){var e=g.get(t),i=g.get(t.texture);t.addEventListener("dispose",o),i.__webglTexture=f.createTexture(),x.textures++;var n=!0===t.isWebGLRenderTargetCube,r=b(t);if(n){e.__webglFramebuffer=[];for(var a=0;a<6;a++)e.__webglFramebuffer[a]=f.createFramebuffer()}else e.__webglFramebuffer=f.createFramebuffer();if(n){m.bindTexture(f.TEXTURE_CUBE_MAP,i.__webglTexture),E(f.TEXTURE_CUBE_MAP,t.texture,r);for(a=0;a<6;a++)c(e.__webglFramebuffer[a],t,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+a);w(t.texture,r)&&f.generateMipmap(f.TEXTURE_CUBE_MAP),m.bindTexture(f.TEXTURE_CUBE_MAP,null)}else m.bindTexture(f.TEXTURE_2D,i.__webglTexture),E(f.TEXTURE_2D,t.texture,r),c(e.__webglFramebuffer,t,f.COLOR_ATTACHMENT0,f.TEXTURE_2D),w(t.texture,r)&&f.generateMipmap(f.TEXTURE_2D),m.bindTexture(f.TEXTURE_2D,null);t.depthBuffer&&l(t)},this.updateRenderTargetMipmap=function(t){var e,i,n=t.texture;w(n,b(t))&&(e=t.isWebGLRenderTargetCube?f.TEXTURE_CUBE_MAP:f.TEXTURE_2D,i=g.get(n).__webglTexture,m.bindTexture(e,i),f.generateMipmap(e),m.bindTexture(e,null))}}function fa(){var n={};return{get:function(t){var e=t.uuid,i=n[e];return void 0===i&&(i={},n[e]=i),i},remove:function(t){delete n[t.uuid]},clear:function(){n={}}}}function ma(l,i,c){var e=new function(){var e=!1,a=new te,i=null,o=new te;return{setMask:function(t){i===t||e||(l.colorMask(t,t,t,t),i=t)},setLocked:function(t){e=t},setClear:function(t,e,i,n,r){!0===r&&(t*=n,e*=n,i*=n),a.set(t,e,i,n),!1===o.equals(a)&&(l.clearColor(t,e,i,n),o.copy(a))},reset:function(){e=!1,i=null,o.set(0,0,0,1)}}},n=new function(){var e=!1,i=null,n=null,r=null;return{setTest:function(t){(t?O:D)(l.DEPTH_TEST)},setMask:function(t){i===t||e||(l.depthMask(t),i=t)},setFunc:function(t){if(n!==t){if(t)switch(t){case $:l.depthFunc(l.NEVER);break;case tt:l.depthFunc(l.ALWAYS);break;case et:l.depthFunc(l.LESS);break;case it:l.depthFunc(l.LEQUAL);break;case nt:l.depthFunc(l.EQUAL);break;case rt:l.depthFunc(l.GEQUAL);break;case at:l.depthFunc(l.GREATER);break;case ot:l.depthFunc(l.NOTEQUAL);break;default:l.depthFunc(l.LEQUAL)}else l.depthFunc(l.LEQUAL);n=t}},setLocked:function(t){e=t},setClear:function(t){r!==t&&(l.clearDepth(t),r=t)},reset:function(){e=!1,r=n=i=null}}},r=new function(){var e=!1,i=null,n=null,r=null,a=null,o=null,s=null,c=null,h=null;return{setTest:function(t){(t?O:D)(l.STENCIL_TEST)},setMask:function(t){i===t||e||(l.stencilMask(t),i=t)},setFunc:function(t,e,i){n===t&&r===e&&a===i||(l.stencilFunc(t,e,i),n=t,r=e,a=i)},setOp:function(t,e,i){o===t&&s===e&&c===i||(l.stencilOp(t,e,i),o=t,s=e,c=i)},setLocked:function(t){e=t},setClear:function(t){h!==t&&(l.clearStencil(t),h=t)},reset:function(){e=!1,h=c=s=o=a=r=n=i=null}}},t=l.getParameter(l.MAX_VERTEX_ATTRIBS),a=new Uint8Array(t),o=new Uint8Array(t),s=new Uint8Array(t),h={},u=null,d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=!1,_=null,b=null,w=null,M=null,E=null,T=null,S=l.getParameter(l.MAX_COMBINED_TEXTURE_IMAGE_UNITS),A=parseFloat(/^WebGL\ ([0-9])/.exec(l.getParameter(l.VERSION))[1]),R=1<=parseFloat(A),L=null,P={},C=new te,I=new te;function U(t,e,i){var n=new Uint8Array(4),r=l.createTexture();l.bindTexture(t,r),l.texParameteri(t,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(t,l.TEXTURE_MAG_FILTER,l.NEAREST);for(var a=0;a<i;a++)l.texImage2D(e+a,0,l.RGBA,1,1,0,l.RGBA,l.UNSIGNED_BYTE,n);return r}var N={};function O(t){!0!==h[t]&&(l.enable(t),h[t]=!0)}function D(t){!1!==h[t]&&(l.disable(t),h[t]=!1)}function F(t,e,i,n,r,a,o,s){(t!==q?O:D)(l.BLEND),t===K||t===d&&s===x||(t===Z?s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ONE,l.ONE,l.ONE,l.ONE)):(l.blendEquation(l.FUNC_ADD),l.blendFunc(l.SRC_ALPHA,l.ONE)):t===J?s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ZERO,l.ZERO,l.ONE_MINUS_SRC_COLOR,l.ONE_MINUS_SRC_ALPHA)):(l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR)):t===Q?s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ZERO,l.SRC_COLOR,l.ZERO,l.SRC_ALPHA)):(l.blendEquation(l.FUNC_ADD),l.blendFunc(l.ZERO,l.SRC_COLOR)):s?(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)):(l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)),d=t,x=s),t===K?(r=r||e,a=a||i,o=o||n,e===p&&r===g||(l.blendEquationSeparate(c(e),c(r)),p=e,g=r),i===f&&n===m&&a===v&&o===y||(l.blendFuncSeparate(c(i),c(n),c(a),c(o)),f=i,m=n,v=a,y=o)):y=v=g=m=f=p=null}function B(t){_!==t&&(t?l.frontFace(l.CW):l.frontFace(l.CCW),_=t)}function z(t){t!==V?(O(l.CULL_FACE),t!==b&&(t===k?l.cullFace(l.BACK):t===j?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK))):D(l.CULL_FACE),b=t}function G(t,e,i){t?(O(l.POLYGON_OFFSET_FILL),M===e&&E===i||(l.polygonOffset(e,i),M=e,E=i)):D(l.POLYGON_OFFSET_FILL)}function H(t){void 0===t&&(t=l.TEXTURE0+S-1),L!==t&&(l.activeTexture(t),L=t)}return N[l.TEXTURE_2D]=U(l.TEXTURE_2D,l.TEXTURE_2D,1),N[l.TEXTURE_CUBE_MAP]=U(l.TEXTURE_CUBE_MAP,l.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:e,depth:n,stencil:r},init:function(){e.setClear(0,0,0,1),n.setClear(1),r.setClear(0),O(l.DEPTH_TEST),n.setFunc(it),B(!1),z(k),O(l.CULL_FACE),O(l.BLEND),F(Y)},initAttributes:function(){for(var t=0,e=a.length;t<e;t++)a[t]=0},enableAttribute:function(t){a[t]=1,0===o[t]&&(l.enableVertexAttribArray(t),o[t]=1),0!==s[t]&&(i.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(t,0),s[t]=0)},enableAttributeAndDivisor:function(t,e){a[t]=1,0===o[t]&&(l.enableVertexAttribArray(t),o[t]=1),s[t]!==e&&(i.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(t,e),s[t]=e)},disableUnusedAttributes:function(){for(var t=0,e=o.length;t!==e;++t)o[t]!==a[t]&&(l.disableVertexAttribArray(t),o[t]=0)},enable:O,disable:D,getCompressedTextureFormats:function(){if(null===u&&(u=[],i.get("WEBGL_compressed_texture_pvrtc")||i.get("WEBGL_compressed_texture_s3tc")||i.get("WEBGL_compressed_texture_etc1")))for(var t=l.getParameter(l.COMPRESSED_TEXTURE_FORMATS),e=0;e<t.length;e++)u.push(t[e]);return u},setBlending:F,setMaterial:function(t){(t.side===X?D:O)(l.CULL_FACE),B(t.side===W),!0===t.transparent?F(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):F(q),n.setFunc(t.depthFunc),n.setTest(t.depthTest),n.setMask(t.depthWrite),e.setMask(t.colorWrite),G(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:B,setCullFace:z,setLineWidth:function(t){t!==w&&(R&&l.lineWidth(t),w=t)},setPolygonOffset:G,getScissorTest:function(){return T},setScissorTest:function(t){((T=t)?O:D)(l.SCISSOR_TEST)},activeTexture:H,bindTexture:function(t,e){null===L&&H();var i=P[L];void 0===i&&(i={type:void 0,texture:void 0},P[L]=i),i.type===t&&i.texture===e||(l.bindTexture(t,e||N[t]),i.type=t,i.texture=e)},compressedTexImage2D:function(){try{l.compressedTexImage2D.apply(l,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{l.texImage2D.apply(l,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(t){!1===C.equals(t)&&(l.scissor(t.x,t.y,t.z,t.w),C.copy(t))},viewport:function(t){!1===I.equals(t)&&(l.viewport(t.x,t.y,t.z,t.w),I.copy(t))},reset:function(){for(var t=0;t<o.length;t++)1===o[t]&&(l.disableVertexAttribArray(t),o[t]=0);h={},P={},b=_=d=L=u=null,e.reset(),n.reset(),r.reset()}}}function ga(e,i,t){var n;function r(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision&&0<e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision?"mediump":"lowp"}var a=void 0!==t.precision?t.precision:"highp",o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);var s=!0===t.logarithmicDepthBuffer&&!!i.get("EXT_frag_depth"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_TEXTURE_SIZE),u=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),g=0<h,v=!!i.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==n)return n;var t=i.get("EXT_texture_filter_anisotropic");return n=null!==t?e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:u,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}function va(t){rn.call(this),this.cameras=t||[]}function ya(n){var r=this,o=null,s=null;"VRFrameData"in window&&(s=new window.VRFrameData);var c=new ae,h=new ae,l=new ae,u=new rn;u.bounds=new te(0,0,.5,1),u.layers.enable(1);var d=new rn;d.bounds=new te(.5,0,.5,1),d.layers.enable(2);var a,p,f=new va([u,d]);f.layers.enable(1),f.layers.enable(2),window.addEventListener("vrdisplaypresentchange",function(){var t,e,i;o.isPresenting?(e=(t=o.getEyeParameters("left")).renderWidth,i=t.renderHeight,p=n.getPixelRatio(),a=n.getSize(),n.setDrawingBufferSize(2*e,i,1)):r.enabled&&n.setDrawingBufferSize(a.width,a.height,p)},!1),this.enabled=!1,this.standing=!1,this.getDevice=function(){return o},this.setDevice=function(t){void 0!==t&&(o=t)},this.getCamera=function(t){if(null===o)return t;o.depthNear=t.near,o.depthFar=t.far,o.getFrameData(s);var e=s.pose;null!==e.position?t.position.fromArray(e.position):t.position.set(0,0,0),null!==e.orientation&&t.quaternion.fromArray(e.orientation),t.updateMatrixWorld();var i=o.stageParameters;if(this.standing&&i&&(h.fromArray(i.sittingToStandingTransform),l.getInverse(h),t.matrixWorld.multiply(h),t.matrixWorldInverse.multiply(l)),!1===o.isPresenting)return t;f.matrixWorld.copy(t.matrixWorld),f.matrixWorldInverse.copy(t.matrixWorldInverse),u.matrixWorldInverse.fromArray(s.leftViewMatrix),d.matrixWorldInverse.fromArray(s.rightViewMatrix),this.standing&&i&&(u.matrixWorldInverse.multiply(l),d.matrixWorldInverse.multiply(l));var n=t.parent;null!==n&&(c.getInverse(n.matrixWorld),u.matrixWorldInverse.multiply(c),d.matrixWorldInverse.multiply(c)),u.matrixWorld.getInverse(u.matrixWorldInverse),d.matrixWorld.getInverse(d.matrixWorldInverse),u.projectionMatrix.fromArray(s.leftProjectionMatrix),d.projectionMatrix.fromArray(s.rightProjectionMatrix),f.projectionMatrix.copy(u.projectionMatrix);var r,a=o.getLayers();return a.length&&(null!==(r=a[0]).leftBounds&&4===r.leftBounds.length&&u.bounds.fromArray(r.leftBounds),null!==r.rightBounds&&4===r.rightBounds.length&&d.bounds.fromArray(r.rightBounds)),f},this.getStandingMatrix=function(){return h},this.submitFrame=function(){o&&o.isPresenting&&o.submitFrame()}}function xa(i){var n={};return{get:function(t){if(void 0!==n[t])return n[t];var e;switch(t){case"WEBGL_depth_texture":e=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":e=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":e=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":e=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":e=i.getExtension("WEBGL_compressed_texture_etc1");break;default:e=i.getExtension(t)}return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),n[t]=e}}}function _a(){var l=this,u=null,d=0,p=!1,f=!1,m=new Pi,g=new Li,v={value:null,needsUpdate:!1};function y(){v.value!==u&&(v.value=u,v.needsUpdate=0<d),l.numPlanes=d,l.numIntersection=0}function x(t,e,i,n){var r=null!==t?t.length:0,a=null;if(0!==r){if(a=v.value,!0!==n||null===a){var o=i+4*r,s=e.matrixWorldInverse;g.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var c=0,h=i;c!==r;++c,h+=4)m.copy(t[c]).applyMatrix4(s,g),m.normal.toArray(a,h),a[h+3]=m.constant}v.value=a,v.needsUpdate=!0}return l.numPlanes=r,a}this.uniform=v,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,i){var n=0!==t.length||e||0!==d||p;return p=e,u=x(t,i,0),d=t.length,n},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(t,e,i,n,r,a){if(!p||null===t||0===t.length||f&&!i)f?x(null):y();else{var o=f?0:d,s=4*o,c=r.clippingState||null;v.value=c,c=x(t,n,s,a);for(var h=0;h!==s;++h)c[h]=u[h];r.clippingState=c,this.numIntersection=e?this.numPlanes:0,this.numPlanes+=o}}}function ba(t){console.log("THREE.WebGLRenderer","86");var r=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,n=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,p=[],f=null,P=new Float32Array(8),m=[],g=[];this.domElement=r,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=Ut,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var C=this,I=null,h=null,u=null,U=-1,N="",O=null,D=null,l=new te,d=null,v=new te,F=0,_=r.width,B=r.height,z=1,y=new te(0,0,_,B),x=!1,b=new te(0,0,_,B),w=new Ci,G=new _a,H=!1,V=!1,M=new ae,k=new re,E=new ae,T=new ae,j={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},S={geometries:0,textures:0},A={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:A,memory:S,programs:null};try{var W,R={alpha:i,depth:n,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c};if(null===(W=e||r.getContext("webgl",R)||r.getContext("experimental-webgl",R)))throw null!==r.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===W.getShaderPrecisionFormat&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),r.addEventListener("webglcontextlost",mt,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var X=new xa(W);X.get("WEBGL_depth_texture"),X.get("OES_texture_float"),X.get("OES_texture_float_linear"),X.get("OES_texture_half_float"),X.get("OES_texture_half_float_linear"),X.get("OES_standard_derivatives"),X.get("ANGLE_instanced_arrays"),X.get("OES_element_index_uint")&&(_r.MaxIndex=4294967296);var q=new ga(W,X,t),Y=new ma(W,X,At),Z=new fa,L=new pa(W,X,Y,Z,q,At,S),J=new Ui(W),Q=new Gr(W,J,S),K=new Vr(0,Q,A),$=new da(this,q),tt=new Hr,et=new Fr,it=new Ur(this,Y,K,s),nt=new ya(this);this.info.programs=$.programs;var rt=new zr(W,X,A),at=new Br(W,X,A);function ot(){return null===h?z:1}function st(){Y.init(),Y.scissor(l.copy(y).multiplyScalar(z)),Y.viewport(v.copy(b).multiplyScalar(z))}function ct(){O=I=null,N="",U=-1,Y.reset()}st(),this.context=W,this.capabilities=q,this.extensions=X,this.properties=Z,this.renderLists=et,this.state=Y,this.vr=nt;var ht=new Ii(this,j,K,q);this.shadowMap=ht;var lt,ut,dt,pt=new ni(this,m),ft=new ii(this,g);function mt(t){t.preventDefault(),ct(),st(),Z.clear(),K.clear()}function gt(t){var e,i=t.target;i.removeEventListener("dispose",gt),vt(e=i),Z.remove(e)}function vt(t){var e=Z.get(t).program;(t.program=void 0)!==e&&$.releaseProgram(e)}function yt(t,e){return Math.abs(e[0])-Math.abs(t[0])}function xt(t,e,i,n){for(var r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,c=o.geometry,h=void 0===n?o.material:n,l=o.group;if(i.isArrayCamera)for(var u=(D=i).cameras,d=0,p=u.length;d<p;d++){var f,m,g,v,y,x=u[d];s.layers.test(x.layers)&&(m=(f=x.bounds).x*_,g=f.y*B,v=f.z*_,y=f.w*B,C.setViewport(m,g,v,y),C.setScissor(m,g,v,y),C.setScissorTest(!0),_t(s,e,x,c,h,l))}else D=null,_t(s,e,i,c,h,l)}}function _t(t,e,i,n,r,a){var o,s,c;t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.onBeforeRender(C,e,i,n,r,a),t.isImmediateRenderObject?(Y.setMaterial(r),o=wt(i,e.fog,r,t),N="",s=o,c=r,t.render(function(t){C.renderBufferImmediate(t,s,c)})):C.renderBufferDirect(i,e.fog,n,r,t,a),t.onAfterRender(C,e,i,n,r,a)}function bt(t,e,i){var n,r=Z.get(t),a=$.getParameters(t,j,e,G.numPlanes,G.numIntersection,i),o=$.getProgramCode(t,a),s=r.program,c=!0;if(void 0===s)t.addEventListener("dispose",gt);else if(s.code!==o)vt(t);else{if(void 0!==a.shaderID)return;c=!1}c&&(a.shaderID?(n=ti[a.shaderID],r.shader={name:t.type,uniforms:Ke.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}):r.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader},t.onBeforeCompile(r.shader),s=$.acquireProgram(t,r.shader,a,o),r.program=s,t.program=s);var h=s.getAttributes();if(t.morphTargets)for(var l=t.numSupportedMorphTargets=0;l<C.maxMorphTargets;l++)0<=h["morphTarget"+l]&&t.numSupportedMorphTargets++;if(t.morphNormals)for(l=t.numSupportedMorphNormals=0;l<C.maxMorphNormals;l++)0<=h["morphNormal"+l]&&t.numSupportedMorphNormals++;var u=r.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=G.numPlanes,r.numIntersection=G.numIntersection,u.clippingPlanes=G.uniform),r.fog=e,r.lightsHash=j.hash,t.lights&&(u.ambientLightColor.value=j.ambient,u.directionalLights.value=j.directional,u.spotLights.value=j.spot,u.rectAreaLights.value=j.rectArea,u.pointLights.value=j.point,u.hemisphereLights.value=j.hemi,u.directionalShadowMap.value=j.directionalShadowMap,u.directionalShadowMatrix.value=j.directionalShadowMatrix,u.spotShadowMap.value=j.spotShadowMap,u.spotShadowMatrix.value=j.spotShadowMatrix,u.pointShadowMap.value=j.pointShadowMap,u.pointShadowMatrix.value=j.pointShadowMatrix);var d=r.program.getUniforms(),p=We.seqWithValue(d.seq,u);r.uniformsList=p}function wt(t,e,i,n){F=0;var r,a=Z.get(i);H&&(!V&&t===O||(r=t===O&&i.id===U,G.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,a,r))),!1===i.needsUpdate&&(void 0===a.program||i.fog&&a.fog!==e||i.lights&&a.lightsHash!==j.hash||void 0!==a.numClippingPlanes&&(a.numClippingPlanes!==G.numPlanes||a.numIntersection!==G.numIntersection))&&(i.needsUpdate=!0),i.needsUpdate&&(bt(i,e,n),i.needsUpdate=!1);var o,s,c,h,l,u,d,p,f,m,g,v,y,x,_,b,w,M,E=!1,T=!1,S=!1,A=a.program,R=A.getUniforms(),L=a.shader.uniforms;return A.id!==I&&(W.useProgram(A.program),I=A.id,S=T=E=!0),i.id!==U&&(U=i.id,T=!0),!E&&t===O||(R.setValue(W,"projectionMatrix",t.projectionMatrix),q.logarithmicDepthBuffer&&R.setValue(W,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),O!==(D||t)&&(O=D||t,S=T=!0),!(i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap)||void 0!==(o=R.map.cameraPosition)&&o.setValue(W,k.setFromMatrixPosition(t.matrixWorld)),(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&R.setValue(W,"viewMatrix",t.matrixWorldInverse)),i.skinning&&(R.setOptional(W,n,"bindMatrix"),R.setOptional(W,n,"bindMatrixInverse"),(s=n.skeleton)&&(c=s.bones,q.floatVertexTextures?(void 0===s.boneTexture&&(h=Math.sqrt(4*c.length),h=$t.nextPowerOfTwo(Math.ceil(h)),h=Math.max(h,4),(l=new Float32Array(h*h*4)).set(s.boneMatrices),u=new oe(l,h,h,Zt,Wt),s.boneMatrices=l,s.boneTexture=u,s.boneTextureSize=h),R.setValue(W,"boneTexture",s.boneTexture),R.setValue(W,"boneTextureSize",s.boneTextureSize)):R.setOptional(W,s,"boneMatrices"))),T&&(R.setValue(W,"toneMappingExposure",C.toneMappingExposure),R.setValue(W,"toneMappingWhitePoint",C.toneMappingWhitePoint),i.lights&&(M=S,(w=L).ambientLightColor.needsUpdate=M,w.directionalLights.needsUpdate=M,w.pointLights.needsUpdate=M,w.spotLights.needsUpdate=M,w.rectAreaLights.needsUpdate=M,w.hemisphereLights.needsUpdate=M),e&&i.fog&&(b=e,(_=L).fogColor.value=b.color,b.isFog?(_.fogNear.value=b.near,_.fogFar.value=b.far):b.isFogExp2&&(_.fogDensity.value=b.density)),(i.isMeshBasicMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshNormalMaterial||i.isMeshDepthMaterial)&&function(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.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity);e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var i;e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap);{var n,r;void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),n=i.offset,r=i.repeat,t.offsetRepeat.value.set(n.x,n.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}(L,i),i.isLineBasicMaterial?Mt(L,i):i.isLineDashedMaterial?(Mt(L,i),x=i,(y=L).dashSize.value=x.dashSize,y.totalSize.value=x.dashSize+x.gapSize,y.scale.value=x.scale):i.isPointsMaterial?function(t,e){{var i,n;t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*z,t.scale.value=.5*B,t.map.value=e.map,null!==e.map&&(i=e.map.offset,n=e.map.repeat,t.offsetRepeat.value.set(i.x,i.y,n.x,n.y))}}(L,i):i.isMeshLambertMaterial?(g=L,(v=i).emissiveMap&&(g.emissiveMap.value=v.emissiveMap)):i.isMeshToonMaterial?(Et(f=L,m=i),m.gradientMap&&(f.gradientMap.value=m.gradientMap)):i.isMeshPhongMaterial?Et(L,i):i.isMeshPhysicalMaterial?(p=i,(d=L).clearCoat.value=p.clearCoat,d.clearCoatRoughness.value=p.clearCoatRoughness,Tt(d,p)):i.isMeshStandardMaterial?Tt(L,i):i.isMeshDepthMaterial?i.displacementMap&&(L.displacementMap.value=i.displacementMap,L.displacementScale.value=i.displacementScale,L.displacementBias.value=i.displacementBias):i.isMeshNormalMaterial&&function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale);e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale));e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(L,i),void 0!==L.ltcMat&&(L.ltcMat.value=Qe.LTC_MAT_TEXTURE),void 0!==L.ltcMag&&(L.ltcMag.value=Qe.LTC_MAG_TEXTURE),We.upload(W,a.uniformsList,L,C)),R.setValue(W,"modelViewMatrix",n.modelViewMatrix),R.setValue(W,"normalMatrix",n.normalMatrix),R.setValue(W,"modelMatrix",n.matrixWorld),A}function Mt(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function Et(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Tt(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function St(t,e){for(var i,n=0,r=0,a=0,o=e.matrixWorldInverse,s=0,c=0,h=0,l=0,u=0,d=0,p=t.length;d<p;d++){var f,m,g=(m=t[d]).color,v=m.intensity,y=m.distance,x=m.shadow&&m.shadow.map?m.shadow.map.texture:null;m.isAmbientLight?(n+=g.r*v,r+=g.g*v,a+=g.b*v):m.isDirectionalLight?((f=tt.get(m)).color.copy(m.color).multiplyScalar(m.intensity),f.direction.setFromMatrixPosition(m.matrixWorld),k.setFromMatrixPosition(m.target.matrixWorld),f.direction.sub(k),f.direction.transformDirection(o),f.shadow=m.castShadow,m.castShadow&&(i=m.shadow,f.shadowBias=i.bias,f.shadowRadius=i.radius,f.shadowMapSize=i.mapSize),j.directionalShadowMap[s]=x,j.directionalShadowMatrix[s]=m.shadow.matrix,j.directional[s]=f,s++):m.isSpotLight?((f=tt.get(m)).position.setFromMatrixPosition(m.matrixWorld),f.position.applyMatrix4(o),f.color.copy(g).multiplyScalar(v),f.distance=y,f.direction.setFromMatrixPosition(m.matrixWorld),k.setFromMatrixPosition(m.target.matrixWorld),f.direction.sub(k),f.direction.transformDirection(o),f.coneCos=Math.cos(m.angle),f.penumbraCos=Math.cos(m.angle*(1-m.penumbra)),f.decay=0===m.distance?0:m.decay,f.shadow=m.castShadow,m.castShadow&&(i=m.shadow,f.shadowBias=i.bias,f.shadowRadius=i.radius,f.shadowMapSize=i.mapSize),j.spotShadowMap[h]=x,j.spotShadowMatrix[h]=m.shadow.matrix,j.spot[h]=f,h++):m.isRectAreaLight?((f=tt.get(m)).color.copy(g).multiplyScalar(v/(m.width*m.height)),f.position.setFromMatrixPosition(m.matrixWorld),f.position.applyMatrix4(o),T.identity(),E.copy(m.matrixWorld),E.premultiply(o),T.extractRotation(E),f.halfWidth.set(.5*m.width,0,0),f.halfHeight.set(0,.5*m.height,0),f.halfWidth.applyMatrix4(T),f.halfHeight.applyMatrix4(T),j.rectArea[l]=f,l++):m.isPointLight?((f=tt.get(m)).position.setFromMatrixPosition(m.matrixWorld),f.position.applyMatrix4(o),f.color.copy(m.color).multiplyScalar(m.intensity),f.distance=m.distance,f.decay=0===m.distance?0:m.decay,f.shadow=m.castShadow,m.castShadow&&(i=m.shadow,f.shadowBias=i.bias,f.shadowRadius=i.radius,f.shadowMapSize=i.mapSize),j.pointShadowMap[c]=x,j.pointShadowMatrix[c]=m.shadow.matrix,j.point[c]=f,c++):m.isHemisphereLight&&((f=tt.get(m)).direction.setFromMatrixPosition(m.matrixWorld),f.direction.transformDirection(o),f.direction.normalize(),f.skyColor.copy(m.color).multiplyScalar(v),f.groundColor.copy(m.groundColor).multiplyScalar(v),j.hemi[u]=f,u++)}j.ambient[0]=n,j.ambient[1]=r,j.ambient[2]=a,j.directional.length=s,j.spot.length=h,j.rectArea.length=l,j.point.length=c,j.hemi.length=u,j.hash=s+","+c+","+h+","+l+","+u+","+j.shadows.length}function At(t){var e;if(t===Nt)return W.REPEAT;if(t===Ot)return W.CLAMP_TO_EDGE;if(t===Dt)return W.MIRRORED_REPEAT;if(t===Ft)return W.NEAREST;if(t===Bt)return W.NEAREST_MIPMAP_NEAREST;if(t===zt)return W.NEAREST_MIPMAP_LINEAR;if(t===Gt)return W.LINEAR;if(1007===t)return W.LINEAR_MIPMAP_NEAREST;if(t===Ht)return W.LINEAR_MIPMAP_LINEAR;if(t===Vt)return W.UNSIGNED_BYTE;if(1017===t)return W.UNSIGNED_SHORT_4_4_4_4;if(1018===t)return W.UNSIGNED_SHORT_5_5_5_1;if(1019===t)return W.UNSIGNED_SHORT_5_6_5;if(1010===t)return W.BYTE;if(1011===t)return W.SHORT;if(t===kt)return W.UNSIGNED_SHORT;if(1013===t)return W.INT;if(t===jt)return W.UNSIGNED_INT;if(t===Wt)return W.FLOAT;if(t===Xt&&null!==(e=X.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(1021===t)return W.ALPHA;if(t===Yt)return W.RGB;if(t===Zt)return W.RGBA;if(1024===t)return W.LUMINANCE;if(1025===t)return W.LUMINANCE_ALPHA;if(t===Jt)return W.DEPTH_COMPONENT;if(t===Qt)return W.DEPTH_STENCIL;if(t===Pt)return W.FUNC_ADD;if(101===t)return W.FUNC_SUBTRACT;if(102===t)return W.FUNC_REVERSE_SUBTRACT;if(200===t)return W.ZERO;if(201===t)return W.ONE;if(202===t)return W.SRC_COLOR;if(203===t)return W.ONE_MINUS_SRC_COLOR;if(t===Ct)return W.SRC_ALPHA;if(t===It)return W.ONE_MINUS_SRC_ALPHA;if(206===t)return W.DST_ALPHA;if(207===t)return W.ONE_MINUS_DST_ALPHA;if(208===t)return W.DST_COLOR;if(209===t)return W.ONE_MINUS_DST_COLOR;if(210===t)return W.SRC_ALPHA_SATURATE;if((2001===t||2002===t||2003===t||2004===t)&&null!==(e=X.get("WEBGL_compressed_texture_s3tc"))){if(2001===t)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===t)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===t)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===t)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((2100===t||2101===t||2102===t||2103===t)&&null!==(e=X.get("WEBGL_compressed_texture_pvrtc"))){if(2100===t)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===t)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===t)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===t)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===t&&null!==(e=X.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((103===t||104===t)&&null!==(e=X.get("EXT_blend_minmax"))){if(103===t)return e.MIN_EXT;if(104===t)return e.MAX_EXT}return t===qt&&null!==(e=X.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){var t=X.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return q.getMaxAnisotropy()},this.getPrecision=function(){return q.precision},this.getPixelRatio=function(){return z},this.setPixelRatio=function(t){void 0!==t&&(z=t,this.setSize(_,B,!1))},this.getSize=function(){return{width:_,height:B}},this.setSize=function(t,e,i){var n=nt.getDevice();n&&n.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(_=t,B=e,r.width=t*z,r.height=e*z,!1!==i&&(r.style.width=t+"px",r.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(){return{width:_*z,height:B*z}},this.setDrawingBufferSize=function(t,e,i){_=t,B=e,z=i,r.width=t*i,r.height=e*i,this.setViewport(0,0,t,e)},this.setViewport=function(t,e,i,n){b.set(t,B-e-n,i,n),Y.viewport(v.copy(b).multiplyScalar(z))},this.setScissor=function(t,e,i,n){y.set(t,B-e-n,i,n),Y.scissor(l.copy(y).multiplyScalar(z))},this.setScissorTest=function(t){Y.setScissorTest(x=t)},this.getClearColor=it.getClearColor,this.setClearColor=it.setClearColor,this.getClearAlpha=it.getClearAlpha,this.setClearAlpha=it.setClearAlpha,this.clear=function(t,e,i){var n=0;void 0!==t&&!t||(n|=W.COLOR_BUFFER_BIT),void 0!==e&&!e||(n|=W.DEPTH_BUFFER_BIT),void 0!==i&&!i||(n|=W.STENCIL_BUFFER_BIT),W.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,i,n){this.setRenderTarget(t),this.clear(e,i,n)},this.resetGLState=ct,this.dispose=function(){r.removeEventListener("webglcontextlost",mt,!1),et.dispose()},this.renderBufferImmediate=function(t,e,i){Y.initAttributes();var n=Z.get(t);t.hasPositions&&!n.position&&(n.position=W.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=W.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=W.createBuffer()),t.hasColors&&!n.color&&(n.color=W.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(W.bindBuffer(W.ARRAY_BUFFER,n.position),W.bufferData(W.ARRAY_BUFFER,t.positionArray,W.DYNAMIC_DRAW),Y.enableAttribute(r.position),W.vertexAttribPointer(r.position,3,W.FLOAT,!1,0,0)),t.hasNormals){if(W.bindBuffer(W.ARRAY_BUFFER,n.normal),!i.isMeshPhongMaterial&&!i.isMeshStandardMaterial&&!i.isMeshNormalMaterial&&i.shading===Rt)for(var a=0,o=3*t.count;a<o;a+=9){var s=t.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,h=(s[a+1]+s[a+4]+s[a+7])/3,l=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=h,s[a+2]=l,s[a+3]=c,s[a+4]=h,s[a+5]=l,s[a+6]=c,s[a+7]=h,s[a+8]=l}W.bufferData(W.ARRAY_BUFFER,t.normalArray,W.DYNAMIC_DRAW),Y.enableAttribute(r.normal),W.vertexAttribPointer(r.normal,3,W.FLOAT,!1,0,0)}t.hasUvs&&i.map&&(W.bindBuffer(W.ARRAY_BUFFER,n.uv),W.bufferData(W.ARRAY_BUFFER,t.uvArray,W.DYNAMIC_DRAW),Y.enableAttribute(r.uv),W.vertexAttribPointer(J.uv,2,W.FLOAT,!1,0,0)),t.hasColors&&i.vertexColors!==Lt&&(W.bindBuffer(W.ARRAY_BUFFER,n.color),W.bufferData(W.ARRAY_BUFFER,t.colorArray,W.DYNAMIC_DRAW),Y.enableAttribute(r.color),W.vertexAttribPointer(r.color,3,W.FLOAT,!1,0,0)),Y.disableUnusedAttributes(),W.drawArrays(W.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){Y.setMaterial(n);var o=wt(t,e,n,r),s=i.id+"_"+o.id+"_"+(!0===n.wireframe),c=!1;s!==N&&(N=s,c=!0);var h=r.morphTargetInfluences;if(void 0!==h){for(var l=[],u=0,d=h.length;u<d;u++){var p=h[u];l.push([p,u])}l.sort(yt),8<l.length&&(l.length=8);for(var f=i.morphAttributes,u=0,d=l.length;u<d;u++){p=l[u];P[u]=p[0],0!==p[0]?(v=p[1],!0===n.morphTargets&&f.position&&i.addAttribute("morphTarget"+u,f.position[v]),!0===n.morphNormals&&f.normal&&i.addAttribute("morphNormal"+u,f.normal[v])):(!0===n.morphTargets&&i.removeAttribute("morphTarget"+u),!0===n.morphNormals&&i.removeAttribute("morphNormal"+u))}for(var u=l.length,m=P.length;u<m;u++)P[u]=0;o.getUniforms().setValue(W,"morphTargetInfluences",P),c=!0}var g,v=i.index,y=i.attributes.position,x=1;!0===n.wireframe&&(v=Q.getWireframeAttribute(i),x=2);var _=rt;null!==v&&(g=J.get(v),(_=at).setIndex(g)),c&&(function(t,e,i,n){if(i&&i.isInstancedBufferGeometry&&null===X.get("ANGLE_instanced_arrays"))return console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0);Y.initAttributes();var r,a=i.attributes,o=e.getAttributes(),s=t.defaultAttributeValues;for(r in o){var c=o[r];if(0<=c){var h=a[r];if(void 0!==h){var l,u,d,p=h.normalized,f=h.itemSize,m=J.get(h),g=m.buffer,v=m.type,y=m.bytesPerElement;h.isInterleavedBufferAttribute?(l=h.data,u=l.stride,d=h.offset,l&&l.isInstancedInterleavedBuffer?(Y.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=l.meshPerAttribute*l.count)):Y.enableAttribute(c),W.bindBuffer(W.ARRAY_BUFFER,g),W.vertexAttribPointer(c,f,v,p,u*y,(n*u+d)*y)):(h.isInstancedBufferAttribute?(Y.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):Y.enableAttribute(c),W.bindBuffer(W.ARRAY_BUFFER,g),W.vertexAttribPointer(c,f,v,p,0,n*f*y))}else if(void 0!==s){var x=s[r];if(void 0!==x)switch(x.length){case 2:W.vertexAttrib2fv(c,x);break;case 3:W.vertexAttrib3fv(c,x);break;case 4:W.vertexAttrib4fv(c,x);break;default:W.vertexAttrib1fv(c,x)}}}}Y.disableUnusedAttributes()}(n,o,i),null!==v&&W.bindBuffer(W.ELEMENT_ARRAY_BUFFER,g.buffer));var b=0;null!==v?b=v.count:void 0!==y&&(b=y.count);var w,M=i.drawRange.start*x,E=i.drawRange.count*x,T=null!==a?a.start*x:0,S=null!==a?a.count*x:1/0,A=Math.max(M,T),R=Math.min(b,M+E,T+S)-1,L=Math.max(0,R-A+1);if(0!==L){if(r.isMesh)if(!0===n.wireframe)Y.setLineWidth(n.wireframeLinewidth*ot()),_.setMode(W.LINES);else switch(r.drawMode){case Kt:_.setMode(W.TRIANGLES);break;case 1:_.setMode(W.TRIANGLE_STRIP);break;case 2:_.setMode(W.TRIANGLE_FAN)}else r.isLine?(void 0===(w=n.linewidth)&&(w=1),Y.setLineWidth(w*ot()),r.isLineSegments?_.setMode(W.LINES):r.isLineLoop?_.setMode(W.LINE_LOOP):_.setMode(W.LINE_STRIP)):r.isPoints&&_.setMode(W.POINTS);i&&i.isInstancedBufferGeometry?0<i.maxInstancedCount&&_.renderInstances(i,A,L):_.render(A,L)}},this.compile=function(i,t){p=[],i.traverse(function(t){t.isLight&&p.push(t)}),St(p,t),i.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var e=0;e<t.material.length;e++)bt(t.material[e],i.fog,t);else bt(t.material,i.fog,t)})},this.animate=function(e){(nt.getDevice()||window).requestAnimationFrame(function t(){e(),(nt.getDevice()||window).requestAnimationFrame(t)})},this.render=function(t,e,i,n){var r,a,o;e&&e.isCamera?(N="",U=-1,!(O=null)===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),nt.enabled&&(e=nt.getCamera(e)),M.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),w.setFromMatrix(M),p.length=0,m.length=0,g.length=0,V=this.localClippingEnabled,H=G.init(this.clippingPlanes,V,e),(f=et.get(t,e)).init(),function t(e,i,n){if(!e.visible)return;var r=e.layers.test(i.layers);if(r)if(e.isLight)p.push(e);else if(e.isSprite)e.frustumCulled&&!w.intersectsSprite(e)||m.push(e);else if(e.isLensFlare)g.push(e);else if(e.isImmediateRenderObject)n&&k.setFromMatrixPosition(e.matrixWorld).applyMatrix4(M),f.push(e,null,e.material,k.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.update(),!e.frustumCulled||w.intersectsObject(e))){n&&k.setFromMatrixPosition(e.matrixWorld).applyMatrix4(M);var a=K.update(e),o=e.material;if(Array.isArray(o))for(var s=a.groups,c=0,h=s.length;c<h;c++){var l=s[c],u=o[l.materialIndex];u&&u.visible&&f.push(e,a,u,k.z,l)}else o.visible&&f.push(e,a,o,k.z,null)}var d=e.children;for(var c=0,h=d.length;c<h;c++)t(d[c],i,n)}(t,e,C.sortObjects),f.finish(),!0===C.sortObjects&&f.sort(),H&&G.beginShadows(),function(t){for(var e=0,i=0,n=t.length;i<n;i++){var r=t[i];r.castShadow&&(j.shadows[e]=r,e++)}j.shadows.length=e}(p),ht.render(t,e),St(p,e),H&&G.endShadows(),A.frame++,A.calls=0,A.vertices=0,A.faces=0,void(A.points=0)===i&&(i=null),this.setRenderTarget(i),it.render(t,e,n),r=f.opaque,a=f.transparent,t.overrideMaterial?(o=t.overrideMaterial,r.length&&xt(r,t,e,o),a.length&&xt(a,t,e,o)):(r.length&&xt(r,t,e),a.length&&xt(a,t,e)),pt.render(t,e),ft.render(t,e,v),i&&L.updateRenderTargetMipmap(i),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),e.isArrayCamera&&C.setScissorTest(!1),nt.enabled&&nt.submitFrame()):console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(t,e){Y.setCullFace(t),Y.setFlipSided(0===e)},this.allocTextureUnit=function(){var t=F;return t>=q.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+t+" texture units while this GPU supports only "+q.maxTextures),F+=1,t},this.setTexture2D=(lt=!1,function(t,e){t&&t.isWebGLRenderTarget&&(lt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),lt=!0),t=t.texture),L.setTexture2D(t,e)}),this.setTexture=(ut=!1,function(t,e){ut||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),ut=!0),L.setTexture2D(t,e)}),this.setTextureCube=(dt=!1,function(t,e){t&&t.isWebGLRenderTargetCube&&(dt||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),dt=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?L.setTextureCube(t,e):L.setTextureCubeDynamic(t,e)}),this.getRenderTarget=function(){return h},this.setRenderTarget=function(t){(h=t)&&void 0===Z.get(t).__webglFramebuffer&&L.setupRenderTarget(t);var e,i,n,r=t&&t.isWebGLRenderTargetCube;t?(e=Z.get(t),i=r?e.__webglFramebuffer[t.activeCubeFace]:e.__webglFramebuffer,l.copy(t.scissor),d=t.scissorTest,v.copy(t.viewport)):(i=null,l.copy(y).multiplyScalar(z),d=x,v.copy(b).multiplyScalar(z)),u!==i&&(W.bindFramebuffer(W.FRAMEBUFFER,i),u=i),Y.scissor(l),Y.setScissorTest(d),Y.viewport(v),r&&(n=Z.get(t.texture),W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,n.__webglTexture,t.activeMipMapLevel))},this.readRenderTargetPixels=function(t,e,i,n,r,a){if(t&&t.isWebGLRenderTarget){var o=Z.get(t).__webglFramebuffer;if(o){var s=!1;o!==u&&(W.bindFramebuffer(W.FRAMEBUFFER,o),s=!0);try{var c=t.texture,h=c.format,l=c.type;if(h!==Zt&&At(h)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===Vt||At(l)===W.getParameter(W.IMPLEMENTATION_COLOR_READ_TYPE)||l===Wt&&(X.get("OES_texture_float")||X.get("WEBGL_color_buffer_float"))||l===Xt&&X.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");W.checkFramebufferStatus(W.FRAMEBUFFER)===W.FRAMEBUFFER_COMPLETE?0<=e&&e<=t.width-n&&0<=i&&i<=t.height-r&&W.readPixels(e,i,n,r,At(h),At(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&W.bindFramebuffer(W.FRAMEBUFFER,u)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function wa(t,e){this.name="",this.color=new qe(t),this.density=void 0!==e?e:25e-5}function Ma(t,e,i){this.name="",this.color=new qe(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Ea(){tn.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Ta(t,e,i,n,r){tn.call(this),this.lensFlares=[],this.positionScreen=new re,(this.customUpdateCallback=void 0)!==t&&this.add(t,e,i,n,r)}function Sa(t){Ei.call(this),this.type="SpriteMaterial",this.color=new qe(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function Aa(t){tn.call(this),this.type="Sprite",this.material=void 0!==t?t:new Sa}function Ra(){tn.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function La(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new ae)}}function Pa(){tn.call(this),this.type="Bone"}function Ca(t,e){Lr.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ae,this.bindMatrixInverse=new ae;var i=new La(this.initBones());this.bind(i,this.matrixWorld),this.normalizeSkinWeights()}function Ia(t){Ei.call(this),this.type="LineBasicMaterial",this.color=new qe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function Ua(t,e,i){if(1===i)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Na(t,e);tn.call(this),this.type="Line",this.geometry=void 0!==t?t:new _r,this.material=void 0!==e?e:new Ia({color:16777215*Math.random()})}function Na(t,e){Ua.call(this,t,e),this.type="LineSegments"}function Oa(t,e){Ua.call(this,t,e),this.type="LineLoop"}function Da(t){Ei.call(this),this.type="PointsMaterial",this.color=new qe(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Fa(t,e){tn.call(this),this.type="Points",this.geometry=void 0!==t?t:new _r,this.material=void 0!==e?e:new Da({color:16777215*Math.random()})}function Ba(){tn.call(this),this.type="Group"}function za(e,t,i,n,r,a,o,s,c){At.call(this,e,t,i,n,r,a,o,s,c),this.generateMipmaps=!1;var h=this;!function t(){requestAnimationFrame(t),e.readyState>=e.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}()}function Ga(t,e,i,n,r,a,o,s,c,h,l,u){At.call(this,null,a,o,s,c,h,n,r,l,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ha(t,e,i,n,r,a,o,s,c){At.call(this,t,e,i,n,r,a,o,s,c),this.needsUpdate=!0}function Va(t,e,i,n,r,a,o,s,c,h){if((h=void 0!==h?h:Jt)!==Jt&&h!==Qt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===Jt&&(i=kt),void 0===i&&h===Qt&&(i=qt),At.call(this,null,n,r,a,o,s,h,i,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:Ft,this.minFilter=void 0!==s?s:Ft,this.flipY=!1,this.generateMipmaps=!1}function ka(t){_r.call(this),this.type="WireframeGeometry";var e,i,n,r,a,o,s=[],c=[0,0],h={},l=["a","b","c"];if(t&&t.isGeometry){for(var u=t.faces,d=0,p=u.length;d<p;d++)for(var f=u[d],m=0;m<3;m++)r=f[l[m]],a=f[l[(m+1)%3]],c[0]=Math.min(r,a),c[1]=Math.max(r,a),void 0===h[o=c[0]+","+c[1]]&&(h[o]={index1:c[0],index2:c[1]});for(o in h)n=h[o],w=t.vertices[n.index1],s.push(w.x,w.y,w.z),w=t.vertices[n.index2],s.push(w.x,w.y,w.z)}else if(t&&t.isBufferGeometry){var g,v,y,x,_,b,w=new re;if(null!==t.index){for(g=t.attributes.position,v=t.index,0===(y=t.groups).length&&(y=[{start:0,count:v.count,materialIndex:0}]),e=0,i=y.length;e<i;++e)for(p=(d=(x=y[e]).start)+x.count;d<p;d+=3)for(m=0;m<3;m++)r=v.getX(d+m),a=v.getX(d+(m+1)%3),c[0]=Math.min(r,a),c[1]=Math.max(r,a),void 0===h[o=c[0]+","+c[1]]&&(h[o]={index1:c[0],index2:c[1]});for(o in h)n=h[o],w.fromBufferAttribute(g,n.index1),s.push(w.x,w.y,w.z),w.fromBufferAttribute(g,n.index2),s.push(w.x,w.y,w.z)}else for(d=0,p=(g=t.attributes.position).count/3;d<p;d++)for(m=0;m<3;m++)_=3*d+m,w.fromBufferAttribute(g,_),s.push(w.x,w.y,w.z),b=3*d+(m+1)%3,w.fromBufferAttribute(g,b),s.push(w.x,w.y,w.z)}this.addAttribute("position",new gr(s,3))}function ja(t,e,i){sr.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:i},this.fromBufferGeometry(new Wa(t,e,i)),this.mergeVertices()}function Wa(t,e,i){_r.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:i};for(var n=[],r=[],a=[],o=[],s=new re,c=new re,h=new re,l=new re,u=new re,d=e+1,p=0;p<=i;p++)for(var f=p/i,m=0;m<=e;m++){var g=m/e,c=t(g,f,c);r.push(c.x,c.y,c.z),0<=g-1e-5?(h=t(g-1e-5,f,h),l.subVectors(c,h)):(h=t(1e-5+g,f,h),l.subVectors(h,c)),0<=f-1e-5?(h=t(g,f-1e-5,h),u.subVectors(c,h)):(h=t(g,1e-5+f,h),u.subVectors(h,c)),s.crossVectors(l,u).normalize(),a.push(s.x,s.y,s.z),o.push(g,f)}for(p=0;p<i;p++)for(m=0;m<e;m++){var v=p*d+m,y=p*d+m+1,x=(p+1)*d+m+1,_=(p+1)*d+m;n.push(v,y,_),n.push(y,x,_)}this.setIndex(n),this.addAttribute("position",new gr(r,3)),this.addAttribute("normal",new gr(a,3)),this.addAttribute("uv",new gr(o,2))}function Xa(t,e,i,n){sr.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n},this.fromBufferGeometry(new qa(t,e,i,n)),this.mergeVertices()}function qa(n,a,t,e){_r.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:n,indices:a,radius:t,detail:e},t=t||1;var l=[],u=[];function d(t){l.push(t.x,t.y,t.z)}function o(t,e){var i=3*t;e.x=n[0+i],e.y=n[1+i],e.z=n[2+i]}function p(t,e,i,n){n<0&&1===t.x&&(u[e]=t.x-1),0===i.x&&0===i.z&&(u[e]=n/2/Math.PI+.5)}function f(t){return Math.atan2(t.z,-t.x)}!function(t){for(var e=new re,i=new re,n=new re,r=0;r<a.length;r+=3)o(a[r+0],e),o(a[r+1],i),o(a[r+2],n),function(t,e,i,n){var r,a,o=Math.pow(2,n),s=[];for(r=0;r<=o;r++){s[r]=[];var c=t.clone().lerp(i,r/o),h=e.clone().lerp(i,r/o),l=o-r;for(a=0;a<=l;a++)s[r][a]=0===a&&r===o?c:c.clone().lerp(h,a/l)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var u=Math.floor(a/2);a%2==0?(d(s[r][u+1]),d(s[r+1][u]),d(s[r][u])):(d(s[r][u+1]),d(s[r+1][u+1]),d(s[r+1][u]))}}(e,i,n,t)}(e=e||0),function(t){for(var e=new re,i=0;i<l.length;i+=3)e.x=l[i+0],e.y=l[i+1],e.z=l[i+2],e.normalize().multiplyScalar(t),l[i+0]=e.x,l[i+1]=e.y,l[i+2]=e.z}(t),function(){for(var t=new re,e=0;e<l.length;e+=3){t.x=l[e+0],t.y=l[e+1],t.z=l[e+2];var i=f(t)/2/Math.PI+.5,n=function(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}(t)/Math.PI+.5;u.push(i,1-n)}(function(){for(var t=new re,e=new re,i=new re,n=new re,r=new _t,a=new _t,o=new _t,s=0,c=0;s<l.length;s+=9,c+=6){t.set(l[s+0],l[s+1],l[s+2]),e.set(l[s+3],l[s+4],l[s+5]),i.set(l[s+6],l[s+7],l[s+8]),r.set(u[c+0],u[c+1]),a.set(u[c+2],u[c+3]),o.set(u[c+4],u[c+5]),n.copy(t).add(e).add(i).divideScalar(3);var h=f(n);p(r,c+0,t,h),p(a,c+2,e,h),p(o,c+4,i,h)}})(),function(){for(var t=0;t<u.length;t+=6){var e=u[t+0],i=u[t+2],n=u[t+4],r=Math.max(e,i,n),a=Math.min(e,i,n);.9<r&&a<.1&&(e<.2&&(u[t+0]+=1),i<.2&&(u[t+2]+=1),n<.2&&(u[t+4]+=1))}}()}(),this.addAttribute("position",new gr(l,3)),this.addAttribute("normal",new gr(l.slice(),3)),this.addAttribute("uv",new gr(u,2)),0===e?this.computeVertexNormals():this.normalizeNormals()}function Ya(t,e){sr.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Za(t,e)),this.mergeVertices()}function Za(t,e){qa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ja(t,e){sr.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Qa(t,e)),this.mergeVertices()}function Qa(t,e){qa.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ka(t,e){sr.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new $a(t,e)),this.mergeVertices()}function $a(t,e){var i=(1+Math.sqrt(5))/2;qa.call(this,[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function to(t,e){sr.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new eo(t,e)),this.mergeVertices()}function eo(t,e){var i=(1+Math.sqrt(5))/2,n=1/i;qa.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function io(t,e,i,n,r,a){sr.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new no(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function no(s,c,h,l,t){_r.call(this),this.type="TubeBufferGeometry",this.parameters={path:s,tubularSegments:c,radius:h,radialSegments:l,closed:t},c=c||64,h=h||1,l=l||8,t=t||!1;var u=s.computeFrenetFrames(c,t);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var r,d,p=new re,f=new re,e=new _t,m=[],g=[],i=[],a=[];function n(t){var e=s.getPointAt(t/c),i=u.normals[t],n=u.binormals[t];for(d=0;d<=l;d++){var r=d/l*Math.PI*2,a=Math.sin(r),o=-Math.cos(r);f.x=o*i.x+a*n.x,f.y=o*i.y+a*n.y,f.z=o*i.z+a*n.z,f.normalize(),g.push(f.x,f.y,f.z),p.x=e.x+h*f.x,p.y=e.y+h*f.y,p.z=e.z+h*f.z,m.push(p.x,p.y,p.z)}}!function(){for(r=0;r<c;r++)n(r);n(!1===t?c:0),function(){for(r=0;r<=c;r++)for(d=0;d<=l;d++)e.x=r/c,e.y=d/l,i.push(e.x,e.y)}(),function(){for(d=1;d<=c;d++)for(r=1;r<=l;r++){var t=(l+1)*(d-1)+(r-1),e=(l+1)*d+(r-1),i=(l+1)*d+r,n=(l+1)*(d-1)+r;a.push(t,e,n),a.push(e,i,n)}}()}(),this.setIndex(a),this.addAttribute("position",new gr(m,3)),this.addAttribute("normal",new gr(g,3)),this.addAttribute("uv",new gr(i,2))}function ro(t,e,i,n,r,a,o){sr.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new ao(t,e,i,n,r,a)),this.mergeVertices()}function ao(t,e,i,n,r,a){_r.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:a},t=t||100,e=e||40,i=Math.floor(i)||64,n=Math.floor(n)||8,r=r||2,a=a||3;for(var o,s=[],c=[],h=[],l=[],u=new re,d=new re,p=new re,f=new re,m=new re,g=new re,v=new re,y=0;y<=i;++y){var x=y/i*r*Math.PI*2;for(A(x,r,a,t,p),A(.01+x,r,a,t,f),g.subVectors(f,p),v.addVectors(f,p),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize(),o=0;o<=n;++o){var _=o/n*Math.PI*2,b=-e*Math.cos(_),w=e*Math.sin(_);u.x=p.x+(b*v.x+w*m.x),u.y=p.y+(b*v.y+w*m.y),u.z=p.z+(b*v.z+w*m.z),c.push(u.x,u.y,u.z),d.subVectors(u,p).normalize(),h.push(d.x,d.y,d.z),l.push(y/i),l.push(o/n)}}for(o=1;o<=i;o++)for(y=1;y<=n;y++){var M=(n+1)*(o-1)+(y-1),E=(n+1)*o+(y-1),T=(n+1)*o+y,S=(n+1)*(o-1)+y;s.push(M,E,S),s.push(E,T,S)}function A(t,e,i,n,r){var a=Math.cos(t),o=Math.sin(t),s=i/e*t,c=Math.cos(s);r.x=n*(2+c)*.5*a,r.y=n*(2+c)*o*.5,r.z=n*Math.sin(s)*.5}this.setIndex(s),this.addAttribute("position",new gr(c,3)),this.addAttribute("normal",new gr(h,3)),this.addAttribute("uv",new gr(l,2))}function oo(t,e,i,n,r){sr.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},this.fromBufferGeometry(new so(t,e,i,n,r)),this.mergeVertices()}function so(t,e,i,n,r){_r.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},t=t||100,e=e||40,i=Math.floor(i)||8,n=Math.floor(n)||6,r=r||2*Math.PI;for(var a,o=[],s=[],c=[],h=[],l=new re,u=new re,d=new re,p=0;p<=i;p++)for(a=0;a<=n;a++){var f=a/n*r,m=p/i*Math.PI*2;u.x=(t+e*Math.cos(m))*Math.cos(f),u.y=(t+e*Math.cos(m))*Math.sin(f),u.z=e*Math.sin(m),s.push(u.x,u.y,u.z),l.x=t*Math.cos(f),l.y=t*Math.sin(f),d.subVectors(u,l).normalize(),c.push(d.x,d.y,d.z),h.push(a/n),h.push(p/i)}for(p=1;p<=i;p++)for(a=1;a<=n;a++){var g=(n+1)*p+a-1,v=(n+1)*(p-1)+a-1,y=(n+1)*(p-1)+a,x=(n+1)*p+a;o.push(g,v,x),o.push(v,y,x)}this.setIndex(o),this.addAttribute("position",new gr(s,3)),this.addAttribute("normal",new gr(c,3)),this.addAttribute("uv",new gr(h,2))}va.prototype=Object.assign(Object.create(rn.prototype),{constructor:va,isArrayCamera:!0}),wa.prototype.isFogExp2=!0,wa.prototype.clone=function(){return new wa(this.color.getHex(),this.density)},wa.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Ma.prototype.isFog=!0,Ma.prototype.clone=function(){return new Ma(this.color.getHex(),this.near,this.far)},Ma.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Ea.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ea,copy:function(t,e){return tn.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},toJSON:function(t){var e=tn.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}}),Ta.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ta,isLensFlare:!0,copy:function(t){tn.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,i=t.lensFlares.length;e<i;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,i,n,r,a){void 0===e&&(e=-1),void 0===i&&(i=0),void 0===a&&(a=1),void 0===r&&(r=new qe(16777215)),void 0===n&&(n=Y),i=Math.min(i,Math.max(0,i)),this.lensFlares.push({texture:t,size:e,distance:i,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:n})},updateLensFlares:function(){for(var t,e=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y,r=0;r<e;r++)(t=this.lensFlares[r]).x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)}}),((Sa.prototype=Object.create(Ei.prototype)).constructor=Sa).prototype.isSpriteMaterial=!0,Sa.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},Aa.prototype=Object.assign(Object.create(tn.prototype),{constructor:Aa,isSprite:!0,raycast:(jr=new re,Wr=new re,Xr=new re,function(t,e){Wr.setFromMatrixPosition(this.matrixWorld),t.ray.closestPointToPoint(Wr,jr),Xr.setFromMatrixScale(this.matrixWorld);var i,n=Xr.x*Xr.y/4;Wr.distanceToSquared(jr)>n||((i=t.ray.origin.distanceTo(jr))<t.near||i>t.far||e.push({distance:i,point:jr.clone(),face:null,object:this}))}),clone:function(){return new this.constructor(this.material).copy(this)}}),Ra.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ra,copy:function(t){tn.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i<n;i++){var r=e[i];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var i=this.levels,n=0;n<i.length&&!(e<i[n].distance);n++);i.splice(n,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,i=1,n=e.length;i<n&&!(t<e[i].distance);i++);return e[i-1].object},raycast:(Zr=new re,function(t,e){Zr.setFromMatrixPosition(this.matrixWorld);var i=t.ray.origin.distanceTo(Zr);this.getObjectForDistance(i).raycast(t,e)}),update:(qr=new re,Yr=new re,function(t){var e=this.levels;if(1<e.length){qr.setFromMatrixPosition(t.matrixWorld),Yr.setFromMatrixPosition(this.matrixWorld);var i=qr.distanceTo(Yr);e[0].object.visible=!0;for(var n=1,r=e.length;n<r&&i>=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(;n<r;n++)e[n].object.visible=!1}}),toJSON:function(t){var e=tn.prototype.toJSON.call(this,t);e.object.levels=[];for(var i=this.levels,n=0,r=i.length;n<r;n++){var a=i[n];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Object.assign(La.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var i=new ae;this.bones[t]&&i.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(i)}},pose:function(){for(var t,e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,i=this.bones.length;e<i;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:(Jr=new ae,Qr=new ae,function(){for(var t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,r=0,a=t.length;r<a;r++){var o=t[r]?t[r].matrixWorld:Qr;Jr.multiplyMatrices(o,e[r]),Jr.toArray(i,16*r)}void 0!==n&&(n.needsUpdate=!0)}),clone:function(){return new La(this.bones,this.boneInverses)}}),Pa.prototype=Object.assign(Object.create(tn.prototype),{constructor:Pa,isBone:!0}),Ca.prototype=Object.assign(Object.create(Lr.prototype),{constructor:Ca,isSkinnedMesh:!0,initBones:function(){var t,e,i,n,r=[];if(this.geometry&&void 0!==this.geometry.bones){for(i=0,n=this.geometry.bones.length;i<n;i++)e=this.geometry.bones[i],t=new Pa,r.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(i=0,n=this.geometry.bones.length;i<n;i++)-1!==(e=this.geometry.bones[i]).parent&&null!==e.parent&&void 0!==r[e.parent]?r[e.parent].add(r[i]):this.add(r[i])}return this.updateMatrixWorld(!0),r},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(r=0;r<this.geometry.skinWeights.length;r++){var t,e=this.geometry.skinWeights[r];(t=1/e.lengthManhattan())!==1/0?e.multiplyScalar(t):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var i=new te,n=this.geometry.attributes.skinWeight,r=0;r<n.count;r++)i.x=n.getX(r),i.y=n.getY(r),i.z=n.getZ(r),i.w=n.getW(r),(t=1/i.lengthManhattan())!==1/0?i.multiplyScalar(t):i.set(1,0,0,0),n.setXYZW(r,i.x,i.y,i.z,i.w)},updateMatrixWorld:function(t){Lr.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((Ia.prototype=Object.create(Ei.prototype)).constructor=Ia).prototype.isLineBasicMaterial=!0,Ia.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Ua.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ua,isLine:!0,raycast:(Kr=new ae,$r=new Sr,ta=new Ri,function(t,e){var i=t.linePrecision,n=i*i,r=this.geometry,a=this.matrixWorld;if(null===r.boundingSphere&&r.computeBoundingSphere(),ta.copy(r.boundingSphere),ta.applyMatrix4(a),!1!==t.ray.intersectsSphere(ta)){Kr.getInverse(a),$r.copy(t.ray).applyMatrix4(Kr);var o=new re,s=new re,c=new re,h=new re,l=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var u=r.index,d=r.attributes.position.array;if(null!==u)for(var p=u.array,f=0,m=p.length-1;f<m;f+=l){var g=p[f],v=p[f+1];o.fromArray(d,3*g),s.fromArray(d,3*v),n<$r.distanceSqToSegment(o,s,h,c)||(h.applyMatrix4(this.matrixWorld),(y=t.ray.origin.distanceTo(h))<t.near||y>t.far||e.push({distance:y,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(f=0,m=d.length/3-1;f<m;f+=l){o.fromArray(d,3*f),s.fromArray(d,3*f+3),n<$r.distanceSqToSegment(o,s,h,c)||(h.applyMatrix4(this.matrixWorld),(y=t.ray.origin.distanceTo(h))<t.near||y>t.far||e.push({distance:y,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}else if(r.isGeometry)for(var y,x=r.vertices,_=x.length,f=0;f<_-1;f+=l){n<$r.distanceSqToSegment(x[f],x[f+1],h,c)||(h.applyMatrix4(this.matrixWorld),(y=t.ray.origin.distanceTo(h))<t.near||y>t.far||e.push({distance:y,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Na.prototype=Object.assign(Object.create(Ua.prototype),{constructor:Na,isLineSegments:!0}),Oa.prototype=Object.assign(Object.create(Ua.prototype),{constructor:Oa,isLineLoop:!0}),((Da.prototype=Object.create(Ei.prototype)).constructor=Da).prototype.isPointsMaterial=!0,Da.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Fa.prototype=Object.assign(Object.create(tn.prototype),{constructor:Fa,isPoints:!0,raycast:(ea=new ae,ia=new Sr,na=new Ri,function(a,o){var s=this,t=this.geometry,c=this.matrixWorld,e=a.params.Points.threshold;if(null===t.boundingSphere&&t.computeBoundingSphere(),na.copy(t.boundingSphere),na.applyMatrix4(c),na.radius+=e,!1!==a.ray.intersectsSphere(na)){ea.getInverse(c),ia.copy(a.ray).applyMatrix4(ea);var i=e/((this.scale.x+this.scale.y+this.scale.z)/3),h=i*i,n=new re;if(t.isBufferGeometry){var r=t.index,l=t.attributes.position.array;if(null!==r)for(var u=r.array,d=0,p=u.length;d<p;d++){var f=u[d];n.fromArray(l,3*f),v(n,f)}else for(var d=0,m=l.length/3;d<m;d++)n.fromArray(l,3*d),v(n,d)}else for(var g=t.vertices,d=0,m=g.length;d<m;d++)v(g[d],d)}function v(t,e){var i=ia.distanceSqToPoint(t);if(i<h){var n=ia.closestPointToPoint(t);n.applyMatrix4(c);var r=a.ray.origin.distanceTo(n);if(r<a.near||r>a.far)return;o.push({distance:r,distanceToRay:Math.sqrt(i),point:n.clone(),index:e,face:null,object:s})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ba.prototype=Object.assign(Object.create(tn.prototype),{constructor:Ba}),(za.prototype=Object.create(At.prototype)).constructor=za,((Ga.prototype=Object.create(At.prototype)).constructor=Ga).prototype.isCompressedTexture=!0,(Ha.prototype=Object.create(At.prototype)).constructor=Ha,((Va.prototype=Object.create(At.prototype)).constructor=Va).prototype.isDepthTexture=!0,(ka.prototype=Object.create(_r.prototype)).constructor=ka,(ja.prototype=Object.create(sr.prototype)).constructor=ja,(Wa.prototype=Object.create(_r.prototype)).constructor=Wa,(Xa.prototype=Object.create(sr.prototype)).constructor=Xa,(qa.prototype=Object.create(_r.prototype)).constructor=qa,(Ya.prototype=Object.create(sr.prototype)).constructor=Ya,(Za.prototype=Object.create(qa.prototype)).constructor=Za,(Ja.prototype=Object.create(sr.prototype)).constructor=Ja,(Qa.prototype=Object.create(qa.prototype)).constructor=Qa,(Ka.prototype=Object.create(sr.prototype)).constructor=Ka,($a.prototype=Object.create(qa.prototype)).constructor=$a,(to.prototype=Object.create(sr.prototype)).constructor=to,(eo.prototype=Object.create(qa.prototype)).constructor=eo,(io.prototype=Object.create(sr.prototype)).constructor=io,(no.prototype=Object.create(_r.prototype)).constructor=no,(ro.prototype=Object.create(sr.prototype)).constructor=ro,(ao.prototype=Object.create(_r.prototype)).constructor=ao,(oo.prototype=Object.create(sr.prototype)).constructor=oo,(so.prototype=Object.create(_r.prototype)).constructor=so;var co={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i},triangulate:function(t,e){var i=t.length;if(i<3)return null;var n,r,a=[],o=[],s=[];if(0<co.area(t))for(l=0;l<i;l++)o[l]=l;else for(l=0;l<i;l++)o[l]=i-1-l;for(var c=i,h=2*c,l=c-1;2<c;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),e?s:a;if(c<=(n=l)&&(n=0),c<=(l=n+1)&&(l=0),c<=(r=l+1)&&(r=0),function(t,e,i,n,r,a){var o,s,c=t[a[e]].x,h=t[a[e]].y,l=t[a[i]].x,u=t[a[i]].y,d=t[a[n]].x,p=t[a[n]].y;if(!((l-c)*(p-h)-(u-h)*(d-c)<=0)){for(var f,m,g=d-l,v=p-u,y=c-d,x=h-p,_=l-c,b=u-h,w=0;w<r;w++)if(o=t[a[w]].x,s=t[a[w]].y,!(o===c&&s===h||o===l&&s===u||o===d&&s===p)&&(f=_*(s-h)-b*(o-c),m=y*(s-p)-x*(o-d),g*(s-u)-v*(o-l)>=-Number.EPSILON&&m>=-Number.EPSILON&&f>=-Number.EPSILON))return;return 1}}(t,n,l,r,c,o)){var u,d,p=o[n],f=o[l],m=o[r];for(a.push([t[p],t[f],t[m]]),s.push([o[n],o[l],o[r]]),d=(u=l)+1;d<c;u++,d++)o[u]=o[d];h=2*--c}}return e?s:a},triangulateShape:function(t,e){function i(t){var e=t.length;2<e&&t[e-1].equals(t[0])&&t.pop()}function T(t,e,i){return t.x!==e.x?t.x<e.x?t.x<=i.x&&i.x<=e.x:e.x<=i.x&&i.x<=t.x:t.y<e.y?t.y<=i.y&&i.y<=e.y:e.y<=i.y&&i.y<=t.y}function b(t,e,i,n,r){var a,o=e.x-t.x,s=e.y-t.y,c=n.x-i.x,h=n.y-i.y,l=t.x-i.x,u=t.y-i.y,d=s*c-o*h,p=s*l-o*u;if(Math.abs(d)>Number.EPSILON){if(0<d){if(p<0||d<p)return[];if((a=h*l-c*u)<0||d<a)return[]}else{if(0<p||p<d)return[];if(0<(a=h*l-c*u)||a<d)return[]}if(0===a)return!r||0!=p&&p!=d?[t]:[];if(a===d)return!r||0!=p&&p!=d?[e]:[];if(0==p)return[i];if(p==d)return[n];var f=a/d;return[{x:t.x+f*o,y:t.y+f*s}]}if(0!=p||h*l!=c*u)return[];var m,g,v,y,x,_,b,w,M=0==o&&0==s,E=0==c&&0==h;return M&&E?t.x!==i.x||t.y!==i.y?[]:[t]:M?T(i,n,t)?[t]:[]:E?T(t,e,i)?[i]:[]:(w=0!=o?(y=t.x<e.x?(v=(m=t).x,(g=e).x):(v=(m=e).x,(g=t).x),i.x<n.x?(b=(x=i).x,(_=n).x):(b=(x=n).x,(_=i).x)):(y=t.y<e.y?(v=(m=t).y,(g=e).y):(v=(m=e).y,(g=t).y),i.y<n.y?(b=(x=i).y,(_=n).y):(b=(x=n).y,(_=i).y)),v<=b?y<b?[]:y===b?r?[]:[x]:y<=w?[x,g]:[x,_]:w<v?[]:v===w?r?[]:[m]:y<=w?[m,g]:[m,_])}function w(t,e,i,n){var r=e.x-t.x,a=e.y-t.y,o=i.x-t.x,s=i.y-t.y,c=n.x-t.x,h=n.y-t.y,l=r*s-a*o,u=r*h-a*c;if(Math.abs(l)>Number.EPSILON){var d=c*s-h*o;return 0<l?0<=u&&0<=d:0<=u||0<=d}return 0<u}i(t),e.forEach(i);for(var n,r,a,o,s={},c=t.concat(),h=0,l=e.length;h<l;h++)Array.prototype.push.apply(c,e[h]);for(p=0,f=c.length;p<f;p++)void 0!==s[a=c[p].x+":"+c[p].y]&&console.warn("THREE.ShapeUtils: Duplicate point",a,p),s[a]=p;for(var u=function(t,o){for(var h,e,i,n,r,a,s,c,l,u,d,p=t.concat(),f=[],m=[],g=0,v=o.length;g<v;g++)f.push(g);for(var y=0,x=2*f.length;0<f.length;){if(--x<0){console.log("Infinite Loop! Holes left:"+f.length+", Probably Hole outside Shape!");break}for(i=y;i<p.length;i++){n=p[i],e=-1;for(g=0;g<f.length;g++)if(a=f[g],void 0===m[s=n.x+":"+n.y+":"+a]){h=o[a];for(var _=0;_<h.length;_++)if(r=h[_],function(t,e){var i=p.length-1,n=t-1;n<0&&(n=i);var r=t+1;i<r&&(r=0);var a=w(p[t],p[n],p[r],h[e]);if(a){var o=h.length-1,s=e-1;s<0&&(s=o);var c=e+1;if(o<c&&(c=0),w(h[e],h[s],h[c],p[t]))return 1}}(i,_)&&!function(t,e){for(var i,n=0;n<p.length;n++)if(i=n+1,i%=p.length,0<b(t,e,p[n],p[i],!0).length)return 1}(n,r)&&!function(t,e){for(var i,n,r,a=0;a<f.length;a++)for(i=o[f[a]],n=0;n<i.length;n++)if(r=n+1,r%=i.length,0<b(t,e,i[n],i[r],!0).length)return 1}(n,r)){e=_,f.splice(g,1),c=p.slice(0,i+1),l=p.slice(i),u=h.slice(e),d=h.slice(0,e+1),p=c.concat(u).concat(d).concat(l),y=i;break}if(0<=e)break;m[s]=!0}if(0<=e)break}}return p}(t,e),d=co.triangulate(u,!1),p=0,f=d.length;p<f;p++)for(r=d[p],n=0;n<3;n++)void 0!==(o=s[a=r[n].x+":"+r[n].y])&&(r[n]=o);return d.concat()},isClockWise:function(t){return co.area(t)<0}};function ho(t,e){sr.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new lo(t,e)),this.mergeVertices()}function lo(t,e){void 0!==t&&(_r.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals())}function uo(t,e){sr.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new po(t,e)),this.mergeVertices()}function po(t,e){var i=(e=e||{}).font;if(!i||!i.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new sr;var n=i.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),lo.call(this,n,e),this.type="TextBufferGeometry"}function fo(t,e,i,n,r,a,o){sr.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new mo(t,e,i,n,r,a,o)),this.mergeVertices()}function mo(t,e,i,n,r,a,o){_r.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:o},t=t||50,e=Math.max(3,Math.floor(e)||8),i=Math.max(2,Math.floor(i)||6),n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;for(var s=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),c=0,h=[],l=new re,u=new re,d=[],p=[],f=[],m=[],g=0;g<=i;g++){for(var v=[],y=g/i,x=0;x<=e;x++){var _=x/e;l.x=-t*Math.cos(n+_*r)*Math.sin(a+y*o),l.y=t*Math.cos(a+y*o),l.z=t*Math.sin(n+_*r)*Math.sin(a+y*o),p.push(l.x,l.y,l.z),u.set(l.x,l.y,l.z).normalize(),f.push(u.x,u.y,u.z),m.push(_,1-y),v.push(c++)}h.push(v)}for(g=0;g<i;g++)for(x=0;x<e;x++){var b=h[g][x+1],w=h[g][x],M=h[g+1][x],E=h[g+1][x+1];(0!==g||0<a)&&d.push(b,w,E),(g!==i-1||s<Math.PI)&&d.push(w,M,E)}this.setIndex(d),this.addAttribute("position",new gr(p,3)),this.addAttribute("normal",new gr(f,3)),this.addAttribute("uv",new gr(m,2))}function go(t,e,i,n,r,a){sr.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new vo(t,e,i,n,r,a)),this.mergeVertices()}function vo(t,e,i,n,r,a){_r.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},t=t||20,e=e||50,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,i=void 0!==i?Math.max(3,i):8;for(var o,s=[],c=[],h=[],l=[],u=t,d=(e-t)/(n=void 0!==n?Math.max(1,n):1),p=new re,f=new _t,m=0;m<=n;m++){for(v=0;v<=i;v++)o=r+v/i*a,p.x=u*Math.cos(o),p.y=u*Math.sin(o),c.push(p.x,p.y,p.z),h.push(0,0,1),f.x=(p.x/e+1)/2,f.y=(p.y/e+1)/2,l.push(f.x,f.y);u+=d}for(m=0;m<n;m++)for(var g=m*(i+1),v=0;v<i;v++){var y=(o=v+g)+i+1,x=o+i+2,_=o+1;s.push(o,y,_),s.push(y,x,_)}this.setIndex(s),this.addAttribute("position",new gr(c,3)),this.addAttribute("normal",new gr(h,3)),this.addAttribute("uv",new gr(l,2))}function yo(t,e,i,n){sr.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},this.fromBufferGeometry(new xo(t,e,i,n)),this.mergeVertices()}function xo(t,e,i,n){_r.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e)||12,i=i||0,n=n||2*Math.PI,n=$t.clamp(n,0,2*Math.PI);var r=[],a=[],o=[],s=1/e,c=new re,h=new _t;for(w=0;w<=e;w++)for(var l=i+w*s*n,u=Math.sin(l),d=Math.cos(l),p=0;p<=t.length-1;p++)c.x=t[p].x*u,c.y=t[p].y,c.z=t[p].x*d,a.push(c.x,c.y,c.z),h.x=w/e,h.y=p/(t.length-1),o.push(h.x,h.y);for(w=0;w<e;w++)for(p=0;p<t.length-1;p++){var f=(b=p+w*t.length)+t.length,m=b+t.length+1,g=b+1;r.push(b,f,g),r.push(f,m,g)}if(this.setIndex(r),this.addAttribute("position",new gr(a,3)),this.addAttribute("uv",new gr(o,2)),this.computeVertexNormals(),n===2*Math.PI){var v=this.attributes.normal.array,y=new re,x=new re,_=new re,b=e*t.length*3,w=0;for(p=0;w<t.length;w++,p+=3)y.x=v[p+0],y.y=v[p+1],y.z=v[p+2],x.x=v[b+p+0],x.y=v[b+p+1],x.z=v[b+p+2],_.addVectors(y,x).normalize(),v[p+0]=v[b+p+0]=_.x,v[p+1]=v[b+p+1]=_.y,v[p+2]=v[b+p+2]=_.z}}function _o(t,e){sr.call(this),this.type="ShapeGeometry","object"===_typeof(e)&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new bo(t,e)),this.mergeVertices()}function bo(t,f){_r.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:f},f=f||12;var m=[],g=[],v=[],y=[],e=0,x=0;if(!1===Array.isArray(t))n(t);else for(var i=0;i<t.length;i++)n(t[i]),this.addGroup(e,x,i),e+=x,x=0;function n(t){var e,i=g.length/3,n=t.extractPoints(f),r=n.shape,a=n.holes;if(!1===co.isClockWise(r))for(r=r.reverse(),s=0,c=a.length;s<c;s++)e=a[s],!0===co.isClockWise(e)&&(a[s]=e.reverse());for(var o=co.triangulateShape(r,a),s=0,c=a.length;s<c;s++)e=a[s],r=r.concat(e);for(s=0,c=r.length;s<c;s++){var h=r[s];g.push(h.x,h.y,0),v.push(0,0,1),y.push(h.x,h.y)}for(s=0,c=o.length;s<c;s++){var l=o[s],u=l[0]+i,d=l[1]+i,p=l[2]+i;m.push(u,d,p),x+=3}}this.setIndex(m),this.addAttribute("position",new gr(g,3)),this.addAttribute("normal",new gr(v,3)),this.addAttribute("uv",new gr(y,2))}function wo(t,e){_r.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var i,n,r,a,o=[],s=Math.cos($t.DEG2RAD*e),c=[0,0],h={},l=["a","b","c"];t.isBufferGeometry?(a=new sr).fromBufferGeometry(t):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)i=m[l[g]],n=m[l[(g+1)%3]],c[0]=Math.min(i,n),c[1]=Math.max(i,n),void 0===h[r=c[0]+","+c[1]]?h[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:h[r].face2=p;for(r in h){var v,y=h[r];(void 0===y.face2||d[y.face1].normal.dot(d[y.face2].normal)<=s)&&(v=u[y.index1],o.push(v.x,v.y,v.z),v=u[y.index2],o.push(v.x,v.y,v.z))}this.addAttribute("position",new gr(o,3))}function Mo(t,e,i,n,r,a,o,s){sr.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Eo(t,e,i,n,r,a,o,s)),this.mergeVertices()}function Eo(v,y,x,_,b,t,w,M){_r.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:v,radiusBottom:y,height:x,radialSegments:_,heightSegments:b,openEnded:t,thetaStart:w,thetaLength:M};var E=this;v=void 0!==v?v:20,y=void 0!==y?y:20,x=void 0!==x?x:100,_=Math.floor(_)||8,b=Math.floor(b)||1,t=void 0!==t&&t,w=void 0!==w?w:0,M=void 0!==M?M:2*Math.PI;var T=[],S=[],A=[],R=[],L=0,P=[],C=x/2,I=0;function e(t){for(var e,i=new _t,n=new re,r=0,a=!0===t?v:y,o=!0===t?1:-1,s=L,c=1;c<=_;c++)S.push(0,C*o,0),A.push(0,o,0),R.push(.5,.5),L++;for(e=L,c=0;c<=_;c++){var h=c/_*M+w,l=Math.cos(h),u=Math.sin(h);n.x=a*u,n.y=C*o,n.z=a*l,S.push(n.x,n.y,n.z),A.push(0,o,0),i.x=.5*l+.5,i.y=.5*u*o+.5,R.push(i.x,i.y),L++}for(c=0;c<_;c++){var d=s+c,p=e+c;!0===t?T.push(p,p+1,d):T.push(p+1,p,d),r+=3}E.addGroup(I,r,!0===t?1:2),I+=r}!function(){var t,e,i=new re,n=new re,r=0,a=(y-v)/x;for(e=0;e<=b;e++){var o=[],s=e/b,c=s*(y-v)+v;for(t=0;t<=_;t++){var h=t/_,l=h*M+w,u=Math.sin(l),d=Math.cos(l);n.x=c*u,n.y=-s*x+C,n.z=c*d,S.push(n.x,n.y,n.z),i.set(u,a,d).normalize(),A.push(i.x,i.y,i.z),R.push(h,1-s),o.push(L++)}P.push(o)}for(t=0;t<_;t++)for(e=0;e<b;e++){var p=P[e][t],f=P[e+1][t],m=P[e+1][t+1],g=P[e][t+1];T.push(p,f,g),T.push(f,m,g),r+=6}E.addGroup(I,r,0),I+=r}(),!1===t&&(0<v&&e(!0),0<y&&e(!1)),this.setIndex(T),this.addAttribute("position",new gr(S,3)),this.addAttribute("normal",new gr(A,3)),this.addAttribute("uv",new gr(R,2))}function To(t,e,i,n,r,a,o){Mo.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function So(t,e,i,n,r,a,o){Eo.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Ao(t,e,i,n){sr.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new Ro(t,e,i,n)),this.mergeVertices()}function Ro(t,e,i,n){_r.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||50,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,a,o=[],s=[],c=[],h=[],l=new re,u=new _t;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,r=3;a<=e;a++,r+=3){var d=i+a/e*n;l.x=t*Math.cos(d),l.y=t*Math.sin(d),s.push(l.x,l.y,l.z),c.push(0,0,1),u.x=(s[r]/t+1)/2,u.y=(s[r+1]/t+1)/2,h.push(u.x,u.y)}for(r=1;r<=e;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new gr(s,3)),this.addAttribute("normal",new gr(c,3)),this.addAttribute("uv",new gr(h,2))}(ho.prototype=Object.create(sr.prototype)).constructor=ho,((lo.prototype=Object.create(_r.prototype)).constructor=lo).prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],i=this.getAttribute("uv"),n=i?Array.prototype.slice.call(i.array):[],r=this.index;return{position:e,uv:n,index:r?Array.prototype.slice.call(r.array):[]}},lo.prototype.addShapeList=function(t,e){var i=t.length;e.arrays=this.getArrays();for(var n=0;n<i;n++){var r=t[n];this.addShape(r,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new gr(e.arrays.position,3)),this.addAttribute("uv",new gr(e.arrays.uv,2))},lo.prototype.addShape=function(t,i){var e,n,r,a,o,s,c=i.arrays?i.arrays:this.getArrays(),h=c.position,l=c.index,u=c.uv,d=[],p=void 0!==i.amount?i.amount:100,f=void 0!==i.bevelThickness?i.bevelThickness:6,m=void 0!==i.bevelSize?i.bevelSize:f-2,g=void 0!==i.bevelSegments?i.bevelSegments:3,v=void 0===i.bevelEnabled||i.bevelEnabled,y=void 0!==i.curveSegments?i.curveSegments:12,x=void 0!==i.steps?i.steps:1,_=i.extrudePath,b=!1,w=void 0!==i.UVGenerator?i.UVGenerator:ho.WorldUVGenerator;_&&(e=_.getSpacedPoints(x),v=!(b=!0),n=void 0!==i.frames?i.frames:_.computeFrenetFrames(x,!1),r=new re,a=new re,o=new re),v||(m=f=g=0);var M=this,E=t.extractPoints(y),T=E.shape,S=E.holes;if(!co.isClockWise(T))for(T=T.reverse(),L=0,P=S.length;L<P;L++)s=S[L],co.isClockWise(s)&&(S[L]=s.reverse());for(var A=co.triangulateShape(T,S),R=T,L=0,P=S.length;L<P;L++)s=S[L],T=T.concat(s);function C(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}var I,U,N,O,D,F,B=T.length,z=A.length;function G(t,e,i){var n,r=t.x-e.x,a=t.y-e.y,o=i.x-t.x,s=i.y-t.y,c=r*r+a*a,h=r*s-a*o;if(Math.abs(h)>Number.EPSILON){var l,u,d=Math.sqrt(c),p=Math.sqrt(o*o+s*s),f=e.x-a/d,m=e.y+r/d,g=((i.x-s/p-f)*s-(i.y+o/p-m)*o)/(r*s-a*o),v=(l=f+r*g-t.x)*l+(u=m+a*g-t.y)*u;if(v<=2)return new _t(l,u);n=Math.sqrt(v/2)}else{var y=!1;r>Number.EPSILON?o>Number.EPSILON&&(y=!0):r<-Number.EPSILON?o<-Number.EPSILON&&(y=!0):Math.sign(a)===Math.sign(s)&&(y=!0),n=y?(l=-a,u=r,Math.sqrt(c)):(l=r,u=a,Math.sqrt(c/2))}return new _t(l/n,u/n)}for(var H=[],V=0,k=R.length,j=k-1,W=V+1;V<k;V++,j++,W++)j===k&&(j=0),W===k&&(W=0),H[V]=G(R[V],R[j],R[W]);var X,q,Y=[],Z=H.concat();for(L=0,P=S.length;L<P;L++){for(s=S[L],X=[],V=0,j=(k=s.length)-1,W=V+1;V<k;V++,j++,W++)j===k&&(j=0),W===k&&(W=0),X[V]=G(s[V],s[j],s[W]);Y.push(X),Z=Z.concat(X)}for(I=0;I<g;I++){for(N=I/g,O=f*Math.cos(N*Math.PI/2),U=m*Math.sin(N*Math.PI/2),V=0,k=R.length;V<k;V++)Q((D=C(R[V],H[V],U)).x,D.y,-O);for(L=0,P=S.length;L<P;L++)for(s=S[L],X=Y[L],V=0,k=s.length;V<k;V++)Q((D=C(s[V],X[V],U)).x,D.y,-O)}for(U=m,V=0;V<B;V++)D=v?C(T[V],Z[V],U):T[V],b?(a.copy(n.normals[0]).multiplyScalar(D.x),r.copy(n.binormals[0]).multiplyScalar(D.y),o.copy(e[0]).add(a).add(r),Q(o.x,o.y,o.z)):Q(D.x,D.y,0);for(q=1;q<=x;q++)for(V=0;V<B;V++)D=v?C(T[V],Z[V],U):T[V],b?(a.copy(n.normals[q]).multiplyScalar(D.x),r.copy(n.binormals[q]).multiplyScalar(D.y),o.copy(e[q]).add(a).add(r),Q(o.x,o.y,o.z)):Q(D.x,D.y,p/x*q);for(I=g-1;0<=I;I--){for(N=I/g,O=f*Math.cos(N*Math.PI/2),U=m*Math.sin(N*Math.PI/2),V=0,k=R.length;V<k;V++)Q((D=C(R[V],H[V],U)).x,D.y,p+O);for(L=0,P=S.length;L<P;L++)for(s=S[L],X=Y[L],V=0,k=s.length;V<k;V++)D=C(s[V],X[V],U),b?Q(D.x,D.y+e[x-1].y,e[x-1].x+O):Q(D.x,D.y,p+O)}function J(t,e){var i,n;for(V=t.length;0<=--V;){(n=(i=V)-1)<0&&(n=t.length-1);for(var r=0,a=x+2*g,r=0;r<a;r++){var o=B*r,s=B*(r+1);!function(t,e,i,n){$(t),$(e),$(n),$(e),$(i),$(n);var r=h.length/3,a=w.generateSideWallUV(M,h,r-6,r-3,r-2,r-1);tt(a[0]),tt(a[1]),tt(a[3]),tt(a[1]),tt(a[2]),tt(a[3])}(e+i+o,e+n+o,e+n+s,e+i+s)}}}function Q(t,e,i){d.push(t),d.push(e),d.push(i)}function K(t,e,i){$(t),$(e),$(i);var n=h.length/3,r=w.generateTopUV(M,h,n-3,n-2,n-1);tt(r[0]),tt(r[1]),tt(r[2])}function $(t){l.push(h.length/3),h.push(d[3*t+0]),h.push(d[3*t+1]),h.push(d[3*t+2])}function tt(t){u.push(t.x),u.push(t.y)}!function(){var t=h.length/3;if(v){var e=0*B;for(V=0;V<z;V++)K((F=A[V])[2]+e,F[1]+e,F[0]+e);for(e=B*(x+2*g),V=0;V<z;V++)K((F=A[V])[0]+e,F[1]+e,F[2]+e)}else{for(V=0;V<z;V++)K((F=A[V])[2],F[1],F[0]);for(V=0;V<z;V++)K((F=A[V])[0]+B*x,F[1]+B*x,F[2]+B*x)}M.addGroup(t,h.length/3-t,void 0!==i.material?i.material:0)}(),function(){var t=h.length/3,e=0;for(J(R,e),e+=R.length,L=0,P=S.length;L<P;L++)J(s=S[L],e),e+=s.length;M.addGroup(t,h.length/3-t,void 0!==i.extrudeMaterial?i.extrudeMaterial:1)}(),i.arrays||(this.setIndex(l),this.addAttribute("position",new gr(h,3)),this.addAttribute("uv",new gr(i.arrays.uv,2)))},ho.WorldUVGenerator={generateTopUV:function(t,e,i,n,r){var a=e[3*i],o=e[3*i+1],s=e[3*n],c=e[3*n+1],h=e[3*r],l=e[3*r+1];return[new _t(a,o),new _t(s,c),new _t(h,l)]},generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1],c=e[3*i+2],h=e[3*n],l=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*a],g=e[3*a+1],v=e[3*a+2];return Math.abs(s-l)<.01?[new _t(o,1-c),new _t(h,1-u),new _t(d,1-f),new _t(m,1-v)]:[new _t(s,1-c),new _t(l,1-u),new _t(p,1-f),new _t(g,1-v)]}},(uo.prototype=Object.create(sr.prototype)).constructor=uo,(po.prototype=Object.create(lo.prototype)).constructor=po,(fo.prototype=Object.create(sr.prototype)).constructor=fo,(mo.prototype=Object.create(_r.prototype)).constructor=mo,(go.prototype=Object.create(sr.prototype)).constructor=go,(vo.prototype=Object.create(_r.prototype)).constructor=vo,(yo.prototype=Object.create(sr.prototype)).constructor=yo,(xo.prototype=Object.create(_r.prototype)).constructor=xo,(_o.prototype=Object.create(sr.prototype)).constructor=_o,(bo.prototype=Object.create(_r.prototype)).constructor=bo,(wo.prototype=Object.create(_r.prototype)).constructor=wo,(Mo.prototype=Object.create(sr.prototype)).constructor=Mo,(Eo.prototype=Object.create(_r.prototype)).constructor=Eo,(To.prototype=Object.create(Mo.prototype)).constructor=To,(So.prototype=Object.create(Eo.prototype)).constructor=So,(Ao.prototype=Object.create(sr.prototype)).constructor=Ao,(Ro.prototype=Object.create(_r.prototype)).constructor=Ro;var Lo=Object.freeze({WireframeGeometry:ka,ParametricGeometry:ja,ParametricBufferGeometry:Wa,TetrahedronGeometry:Ya,TetrahedronBufferGeometry:Za,OctahedronGeometry:Ja,OctahedronBufferGeometry:Qa,IcosahedronGeometry:Ka,IcosahedronBufferGeometry:$a,DodecahedronGeometry:to,DodecahedronBufferGeometry:eo,PolyhedronGeometry:Xa,PolyhedronBufferGeometry:qa,TubeGeometry:io,TubeBufferGeometry:no,TorusKnotGeometry:ro,TorusKnotBufferGeometry:ao,TorusGeometry:oo,TorusBufferGeometry:so,TextGeometry:uo,TextBufferGeometry:po,SphereGeometry:fo,SphereBufferGeometry:mo,RingGeometry:go,RingBufferGeometry:vo,PlaneGeometry:Mr,PlaneBufferGeometry:Er,LatheGeometry:yo,LatheBufferGeometry:xo,ShapeGeometry:_o,ShapeBufferGeometry:bo,ExtrudeGeometry:ho,ExtrudeBufferGeometry:lo,EdgesGeometry:wo,ConeGeometry:To,ConeBufferGeometry:So,CylinderGeometry:Mo,CylinderBufferGeometry:Eo,CircleGeometry:Ao,CircleBufferGeometry:Ro,BoxGeometry:br,BoxBufferGeometry:wr});function Po(t){Ti.call(this,{uniforms:Ke.merge([Qe.lights,{opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function Co(t){Ti.call(this,t),this.type="RawShaderMaterial"}function Io(t){Ei.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new qe(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Uo(t){Io.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function No(t){Ei.call(this),this.type="MeshPhongMaterial",this.color=new qe(16777215),this.specular=new qe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Oo(t){No.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Do(t){Ei.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new _t(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Fo(t){Ei.call(this),this.type="MeshLambertMaterial",this.color=new qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=G,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Bo(t){Ei.call(this),this.type="LineDashedMaterial",this.color=new qe(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}((Po.prototype=Object.create(Ti.prototype)).constructor=Po).prototype.isShadowMaterial=!0,((Co.prototype=Object.create(Ti.prototype)).constructor=Co).prototype.isRawShaderMaterial=!0,((Io.prototype=Object.create(Ei.prototype)).constructor=Io).prototype.isMeshStandardMaterial=!0,Io.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Uo.prototype=Object.create(Io.prototype)).constructor=Uo).prototype.isMeshPhysicalMaterial=!0,Uo.prototype.copy=function(t){return Io.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},((No.prototype=Object.create(Ei.prototype)).constructor=No).prototype.isMeshPhongMaterial=!0,No.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Oo.prototype=Object.create(No.prototype)).constructor=Oo).prototype.isMeshToonMaterial=!0,Oo.prototype.copy=function(t){return No.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},((Do.prototype=Object.create(Ei.prototype)).constructor=Do).prototype.isMeshNormalMaterial=!0,Do.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Fo.prototype=Object.create(Ei.prototype)).constructor=Fo).prototype.isMeshLambertMaterial=!0,Fo.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Bo.prototype=Object.create(Ei.prototype)).constructor=Bo).prototype.isLineDashedMaterial=!0,Bo.prototype.copy=function(t){return Ei.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var zo=Object.freeze({ShadowMaterial:Po,SpriteMaterial:Sa,RawShaderMaterial:Co,ShaderMaterial:Ti,PointsMaterial:Da,MeshPhysicalMaterial:Uo,MeshStandardMaterial:Io,MeshPhongMaterial:No,MeshToonMaterial:Oo,MeshNormalMaterial:Do,MeshLambertMaterial:Fo,MeshDepthMaterial:Si,MeshBasicMaterial:Tr,LineDashedMaterial:Bo,LineBasicMaterial:Ia,Material:Ei}),Go={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Ho(t,e,i){var n=this,r=!1,a=0,o=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)}}var Vo=new Ho;function ko(t){this.manager=void 0!==t?t:Vo}function jo(t){this.manager=void 0!==t?t:Vo,this._parser=null}function Wo(t){this.manager=void 0!==t?t:Vo,this._parser=null}function Xo(t){this.manager=void 0!==t?t:Vo}function qo(t){this.manager=void 0!==t?t:Vo}function Yo(t){this.manager=void 0!==t?t:Vo}function Zo(t,e){tn.call(this),this.type="Light",this.color=new qe(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Jo(t,e,i){Zo.call(this,t,i),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(tn.DefaultUp),this.updateMatrix(),this.groundColor=new qe(e)}function Qo(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new _t(512,512),this.map=null,this.matrix=new ae}function Ko(){Qo.call(this,new rn(50,1,.5,500))}function $o(t,e,i,n,r,a){Zo.call(this,t,e),this.type="SpotLight",this.position.copy(tn.DefaultUp),this.updateMatrix(),this.target=new tn,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==i?i:0,this.angle=void 0!==n?n:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Ko}function ts(t,e,i,n){Zo.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==i?i:0,this.decay=void 0!==n?n:1,this.shadow=new Qo(new rn(90,1,.5,500))}function es(){Qo.call(this,new nn(-5,5,5,-5,.5,500))}function is(t,e){Zo.call(this,t,e),this.type="DirectionalLight",this.position.copy(tn.DefaultUp),this.updateMatrix(),this.target=new tn,this.shadow=new es}function ns(t,e){Zo.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function rs(t,e,i,n){Zo.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==i?i:10,this.height=void 0!==n?n:10}Object.assign(ko.prototype,{load:function(i,n,e,r){void 0===i&&(i=""),void 0!==this.path&&(i=this.path+i);var a=this,t=Go.get(i);if(void 0!==t)return a.manager.itemStart(i),setTimeout(function(){n&&n(t),a.manager.itemEnd(i)},0),t;var o=i.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],h=o[3],h=window.decodeURIComponent(h);c&&(h=window.atob(h));try{var l=(this.responseType||"").toLowerCase();switch(l){case"arraybuffer":case"blob":p=new ArrayBuffer(h.length);for(var u=new Uint8Array(p),d=0;d<h.length;d++)u[d]=h.charCodeAt(d);"blob"===l&&(p=new Blob([p],{type:s}));break;case"document":var p=(new DOMParser).parseFromString(h,s);break;case"json":p=JSON.parse(h);break;default:p=h}window.setTimeout(function(){n&&n(p),a.manager.itemEnd(i)},0)}catch(t){window.setTimeout(function(){r&&r(t),a.manager.itemEnd(i),a.manager.itemError(i)},0)}}else{var f,m=new XMLHttpRequest;for(f in m.open("GET",i,!0),m.addEventListener("load",function(t){var e=t.target.response;Go.add(i,e),200===this.status?(n&&n(e),a.manager.itemEnd(i)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),n&&n(e),a.manager.itemEnd(i)):(r&&r(t),a.manager.itemEnd(i),a.manager.itemError(i))},!1),void 0!==e&&m.addEventListener("progress",function(t){e(t)},!1),m.addEventListener("error",function(t){r&&r(t),a.manager.itemEnd(i),a.manager.itemError(i)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(f,this.requestHeader[f]);m.send(null)}return a.manager.itemStart(i),m},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(jo.prototype,{load:function(t,a,e,n){var o=this,s=[],c=new Ga;c.image=s;var r=new ko(this.manager);if(r.setPath(this.path),r.setResponseType("arraybuffer"),Array.isArray(t))for(var h=0,i=0,l=t.length;i<l;++i)!function(i){r.load(t[i],function(t){var e=o._parser(t,!0);s[i]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(h+=1)&&(1===e.mipmapCount&&(c.minFilter=Gt),c.format=e.format,c.needsUpdate=!0,a&&a(c))},e,n)}(i);else r.load(t,function(t){var e=o._parser(t,!0);if(e.isCubemap)for(var i=e.mipmaps.length/e.mipmapCount,n=0;n<i;n++){s[n]={mipmaps:[]};for(var r=0;r<e.mipmapCount;r++)s[n].mipmaps.push(e.mipmaps[n*e.mipmapCount+r]),s[n].format=e.format,s[n].width=e.width,s[n].height=e.height}else c.image.width=e.width,c.image.height=e.height,c.mipmaps=e.mipmaps;1===e.mipmapCount&&(c.minFilter=Gt),c.format=e.format,c.needsUpdate=!0,a&&a(c)},e,n);return c},setPath:function(t){return this.path=t,this}}),Object.assign(Wo.prototype,{load:function(t,i,e,n){var r=this,a=new oe,o=new ko(this.manager);return o.setResponseType("arraybuffer"),o.load(t,function(t){var e=r._parser(t);e&&(void 0!==e.image?a.image=e.image:void 0!==e.data&&(a.image.width=e.width,a.image.height=e.height,a.image.data=e.data),a.wrapS=void 0!==e.wrapS?e.wrapS:Ot,a.wrapT=void 0!==e.wrapT?e.wrapT:Ot,a.magFilter=void 0!==e.magFilter?e.magFilter:Gt,a.minFilter=void 0!==e.minFilter?e.minFilter:Ht,a.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.format&&(a.format=e.format),void 0!==e.type&&(a.type=e.type),void 0!==e.mipmaps&&(a.mipmaps=e.mipmaps),1===e.mipmapCount&&(a.minFilter=Gt),a.needsUpdate=!0,i&&i(a,e))},e,n),a}}),Object.assign(Xo.prototype,{load:function(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e);var r=this,a=Go.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");return o.addEventListener("load",function(){Go.add(e,this),t&&t(this),r.manager.itemEnd(e)},!1),o.addEventListener("error",function(t){n&&n(t),r.manager.itemEnd(e),r.manager.itemError(e)},!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(qo.prototype,{load:function(t,i,e,n){var r=new se,a=new Xo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;for(var s=0;s<t.length;++s)!function(e){a.load(t[e],function(t){r.images[e]=t,6===++o&&(r.needsUpdate=!0,i&&i(r))},void 0,n)}(s);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Yo.prototype,{load:function(e,i,t,n){var r=new Xo(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);var a=new At;return a.image=r.load(e,function(){var t=0<e.search(/\.(jpg|jpeg)$/)||0===e.search(/^data\:image\/jpeg/);a.format=t?Yt:Zt,a.needsUpdate=!0,void 0!==i&&i(a)},t,n),a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Zo.prototype=Object.assign(Object.create(tn.prototype),{constructor:Zo,isLight:!0,copy:function(t){return tn.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=tn.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Jo.prototype=Object.assign(Object.create(Zo.prototype),{constructor:Jo,isHemisphereLight:!0,copy:function(t){return Zo.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Qo.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),Ko.prototype=Object.assign(Object.create(Qo.prototype),{constructor:Ko,isSpotLightShadow:!0,update:function(t){var e=this.camera,i=2*$t.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix())}}),$o.prototype=Object.assign(Object.create(Zo.prototype),{constructor:$o,isSpotLight:!0,copy:function(t){return Zo.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ts.prototype=Object.assign(Object.create(Zo.prototype),{constructor:ts,isPointLight:!0,copy:function(t){return Zo.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),es.prototype=Object.assign(Object.create(Qo.prototype),{constructor:es}),is.prototype=Object.assign(Object.create(Zo.prototype),{constructor:is,isDirectionalLight:!0,copy:function(t){return Zo.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),ns.prototype=Object.assign(Object.create(Zo.prototype),{constructor:ns,isAmbientLight:!0}),rs.prototype=Object.assign(Object.create(Zo.prototype),{constructor:rs,isRectAreaLight:!0,copy:function(t){return Zo.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Zo.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var as,os={arraySlice:function(t,e,i){return os.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(i){for(var t=i.length,e=new Array(t),n=0;n!==t;++n)e[n]=n;return e.sort(function(t,e){return i[t]-i[e]}),e},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,c=0;c!==e;++c)r[o++]=t[s+c];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[n])&&(e.push(a.time),i.push.apply(i,o)),void 0!==(a=t[r++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[n])&&(e.push(a.time),o.toArray(i,i.length)),void 0!==(a=t[r++]););else for(;void 0!==(o=a[n])&&(e.push(a.time),i.push(o)),void 0!==(a=t[r++]););}}};function ss(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function cs(t,e,i,n){ss.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function hs(t,e,i,n){ss.call(this,t,e,i,n)}function ls(t,e,i,n){ss.call(this,t,e,i,n)}function us(t,e,i,n){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=os.convertArray(e,this.TimeBufferType),this.values=os.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()}function ds(t,e,i,n){us.call(this,t,e,i,n)}function ps(t,e,i,n){ss.call(this,t,e,i,n)}function fs(t,e,i,n){us.call(this,t,e,i,n)}function ms(t,e,i,n){us.call(this,t,e,i,n)}function gs(t,e,i,n){us.call(this,t,e,i,n)}function vs(t,e,i){us.call(this,t,e,i)}function ys(t,e,i,n){us.call(this,t,e,i,n)}function xs(t,e,i,n){us.apply(this,arguments)}function _s(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=$t.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function bs(t){this.manager=void 0!==t?t:Vo,this.textures={}}function ws(t){this.manager=void 0!==t?t:Vo}Object.assign(ss.prototype,{evaluate:function(t){var e,i=this.parameterPositions,n=this._cachedIndex,r=i[n],a=i[n-1];t:{e:{i:{n:if(!(t<r)){for(var o=n+2;;){if(void 0===r){if(t<a)break n;return n=i.length,this._cachedIndex=n,this.afterEnd_(n-1,t,a)}if(n===o)break;if(a=r,t<(r=i[++n]))break e}e=i.length;break i}if(a<=t)break t;var s=i[1];t<s&&(n=2,a=s);for(o=n-2;;){if(void 0===a)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===o)break;if(r=a,(a=i[--n-1])<=t)break e}e=n,n=0}for(;n<e;){var c=n+e>>>1;t<i[c]?e=c:n=1+c}if(r=i[n],void 0===(a=i[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=i.length,this._cachedIndex=n,this.afterEnd_(n-1,a,t)}this._cachedIndex=n,this.intervalChanged_(n,a,r)}return this.interpolate_(n,a,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n,a=0;a!==n;++a)e[a]=i[r+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(ss.prototype,{beforeStart_:ss.prototype.copySampleValue_,afterEnd_:ss.prototype.copySampleValue_}),cs.prototype=Object.assign(Object.create(ss.prototype),{constructor:cs,DefaultSettings_:{endingStart:d,endingEnd:d},intervalChanged_:function(t,e,i){var n=this.parameterPositions,r=t-2,a=t+1,o=n[r],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case p:r=t,o=2*e-i;break;case f:o=e+n[r=n.length-2]-n[r+1];break;default:r=t,o=i}if(void 0===s)switch(this.getSettings_().endingEnd){case p:a=t,s=2*i-e;break;case f:s=i+n[a=1]-n[0];break;default:a=t-1,s=e}var c=.5*(i-e),h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-i),this._offsetPrev=r*h,this._offsetNext=a*h},interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,_=0;_!==o;++_)r[_]=g*a[h+_]+v*a[c+_]+y*a[s+_]+x*a[l+_];return r}}),hs.prototype=Object.assign(Object.create(ss.prototype),{constructor:hs,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,h=(i-e)/(n-e),l=1-h,u=0;u!==o;++u)r[u]=a[c+u]*l+a[s+u]*h;return r}}),ls.prototype=Object.assign(Object.create(ss.prototype),{constructor:ls,interpolate_:function(t){return this.copySampleValue_(t-1)}}),as={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:u,InterpolantFactoryMethodDiscrete:function(t){return new ls(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new hs(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new cs(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case l:e=this.InterpolantFactoryMethodDiscrete;break;case u:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0!==e)this.createInterpolant=e;else{var i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(i);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrackPrototype:",i)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return l;case this.InterpolantFactoryMethodLinear:return u;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,i=0,n=e.length;i!==n;++i)e[i]*=t;return this},trim:function(t,e){for(var i,n=this.times,r=n.length,a=0,o=r-1;a!==r&&n[a]<t;)++a;for(;-1!==o&&n[o]>e;)--o;return++o,0===a&&o===r||(o<=a&&(a=(o=Math.max(o,1))-1),i=this.getValueSize(),this.times=os.arraySlice(n,a,o),this.values=os.arraySlice(this.values,a*i,o*i)),this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrackPrototype: Invalid value size in track.",this),t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrackPrototype: Track is empty.",this),t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrackPrototype: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrackPrototype: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==n&&os.isTypedArray(n))for(var o=0,c=n.length;o!==c;++o){var h=n[o];if(isNaN(h)){console.error("THREE.KeyframeTrackPrototype: Value is not a valid number.",this,o,h),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=2302===this.getInterpolation(),r=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var h=o*i,l=h-i,u=h+i,d=0;d!==i;++d){var p=e[h+d];if(p!==e[l+d]||p!==e[u+d]){s=!0;break}}if(s){if(o!==r){t[r]=t[o];for(var f=o*i,m=r*i,d=0;d!==i;++d)e[m+d]=e[f+d]}++r}}if(0<a){t[r]=t[a];for(f=a*i,m=r*i,d=0;d!==i;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=os.arraySlice(t,0,r),this.values=os.arraySlice(e,0,r*i)),this}},ds.prototype=Object.assign(Object.create(as),{constructor:ds,ValueTypeName:"vector"}),ps.prototype=Object.assign(Object.create(ss.prototype),{constructor:ps,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=(i-e)/(n-e),h=s+o;s!==h;s+=4)ne.slerpFlat(r,0,a,s-o,a,s,c);return r}}),fs.prototype=Object.assign(Object.create(as),{constructor:fs,ValueTypeName:"quaternion",DefaultInterpolation:u,InterpolantFactoryMethodLinear:function(t){return new ps(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),ms.prototype=Object.assign(Object.create(as),{constructor:ms,ValueTypeName:"number"}),gs.prototype=Object.assign(Object.create(as),{constructor:gs,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:l,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),vs.prototype=Object.assign(Object.create(as),{constructor:vs,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:l,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ys.prototype=Object.assign(Object.create(as),{constructor:ys,ValueTypeName:"color"}),(xs.prototype=as).constructor=xs,Object.assign(xs,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e,i,n=xs._getTrackTypeForValueTypeName(t.type);return void 0===t.times&&(e=[],i=[],os.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i),void 0!==n.parse?n.parse(t):new n(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,i,n=t.constructor;return void 0!==n.toJSON?e=n.toJSON(t):(e={name:t.name,times:os.convertArray(t.times,Array),values:os.convertArray(t.values,Array)},(i=t.getInterpolation())!==t.DefaultInterpolation&&(e.interpolation=i)),e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ms;case"vector":case"vector2":case"vector3":case"vector4":return ds;case"color":return ys;case"quaternion":return fs;case"bool":case"boolean":return vs;case"string":return gs}throw new Error("Unsupported typeName: "+t)}}),Object.assign(_s,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push(xs.parse(i[r]).scale(n));return new _s(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e},r=0,a=i.length;r!==a;++r)e.push(xs.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o<r;o++){var s=[];(h=[]).push((o+r-1)%r,o,(o+1)%r),s.push(0,1,0);var c=os.getKeyframeOrder(h),h=os.sortedArray(h,1,c),s=os.sortedArray(s,1,c);n||0!==h[0]||(h.push(r),s.push(s[0])),a.push(new ms(".morphTargetInfluences["+e[o].name+"]",h,s).scale(1/i))}return new _s(t,-1,a)},findByName:function(t,e){var i=t;Array.isArray(t)||(i=t.geometry&&t.geometry.animations||t.animations);for(var n=0;n<i.length;n++)if(i[n].name===e)return i[n];return null},CreateClipsFromMorphTargetSequences:function(t,e,i){for(var n={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s,c=t[a],h=c.name.match(r);h&&1<h.length&&((s=n[l=h[1]])||(n[l]=s=[]),s.push(c))}var l,u=[];for(l in n)u.push(_s.CreateFromMorphTargetSequence(l,n[l],e,i));return u},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(t,e,i,n,r){var a,o;0!==i.length&&(a=[],o=[],os.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o)))},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var h=s[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var l,u={},d=0;d<h.length;d++)if(h[d].morphTargets)for(var p=0;p<h[d].morphTargets.length;p++)u[h[d].morphTargets[p]]=-1;for(l in u){for(var f=[],m=[],p=0;p!==h[d].morphTargets.length;++p){var g=h[d];f.push(g.time),m.push(g.morphTarget===l?1:0)}n.push(new ms(".morphTargetInfluence["+l+"]",f,m))}a=u.length*(o||1)}else{var v=".bones["+e[c].name+"]";i(ds,v+".position",h,"pos",n),i(fs,v+".quaternion",h,"rot",n),i(ds,v+".scale",h,"scl",n)}}return 0===n.length?null:new _s(r,a,n)}}),Object.assign(_s.prototype,{resetDuration:function(){for(var t=0,e=0,i=this.tracks.length;e!==i;++e)var n=this.tracks[e],t=Math.max(t,n.times[n.times.length-1]);this.duration=t},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(bs.prototype,{load:function(t,e,i,n){var r=this;new ko(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},setTextures:function(t){this.textures=t},parse:function(t){var e=this.textures;function i(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var n,r=new zo[t.type];return void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearCoat&&(r.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(r.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(r.uniforms=t.uniforms),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(r.vertexColors=t.vertexColors),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.shading&&(r.shading=t.shading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=i(t.map)),void 0!==t.alphaMap&&(r.alphaMap=i(t.alphaMap),r.transparent=!0),void 0!==t.bumpMap&&(r.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=i(t.normalMap)),void 0!==t.normalScale&&(n=t.normalScale,!1===Array.isArray(n)&&(n=[n,n]),r.normalScale=(new _t).fromArray(n)),void 0!==t.displacementMap&&(r.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=i(t.specularMap)),void 0!==t.envMap&&(r.envMap=i(t.envMap)),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.lightMap&&(r.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=i(t.gradientMap)),r}}),Object.assign(ws.prototype,{load:function(t,e,i,n){var r=this;new ko(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},i,n)},parse:function(t){var e=new _r,i=t.data.index;void 0!==i&&(o=new Rs[i.type](i.array),e.setIndex(new cr(o,1)));var n,r=t.data.attributes;for(n in r){var a=r[n],o=new Rs[a.type](a.array);e.addAttribute(n,new cr(o,a.itemSize,a.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,h=s.length;c!==h;++c){var l=s[c];e.addGroup(l.start,l.count,l.materialIndex)}var u,d=t.data.boundingSphere;return void 0!==d&&(u=new re,void 0!==d.center&&u.fromArray(d.center),e.boundingSphere=new Ri(u,d.radius)),e}});var Ms,Es,Ts,Ss,As,Rs={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ls(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function Ps(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Vo,this.withCredentials=!1}function Cs(t){this.manager=void 0!==t?t:Vo,this.texturePath=""}Ls.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,i=0,n=e.length;i<n;i+=2){var r=e[i],a=e[i+1];if(r.test(t))return a}return null}},Object.assign(Ls.prototype,{crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,i){for(var n=[],r=0;r<t.length;++r)n[r]=this.createMaterial(t[r],e,i);return n},createMaterial:(Ms={NoBlending:q,NormalBlending:Y,AdditiveBlending:Z,SubtractiveBlending:J,MultiplyBlending:Q,CustomBlending:K},Es=new qe,Ts=new Yo,Ss=new bs,function(t,h,l){var u={};function e(t,e,i,n,r){var a=h+t,o=Ls.Handlers.get(a),s=null!==o?o.load(a):(Ts.setCrossOrigin(l),Ts.load(a));void 0!==e&&(s.repeat.fromArray(e),1!==e[0]&&(s.wrapS=Nt),1!==e[1]&&(s.wrapT=Nt)),void 0!==i&&s.offset.fromArray(i),void 0!==n&&("repeat"===n[0]&&(s.wrapS=Nt),"mirror"===n[0]&&(s.wrapS=Dt),"repeat"===n[1]&&(s.wrapT=Nt),"mirror"===n[1]&&(s.wrapT=Dt)),void 0!==r&&(s.anisotropy=r);var c=$t.generateUUID();return u[c]=s,c}var i,n={uuid:$t.generateUUID(),type:"MeshLambertMaterial"};for(i in t){var r=t[i];switch(i){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":n.name=r;break;case"blending":n.blending=Ms[r];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",i,"is no longer supported.");break;case"colorDiffuse":n.color=Es.fromArray(r).getHex();break;case"colorSpecular":n.specular=Es.fromArray(r).getHex();break;case"colorEmissive":n.emissive=Es.fromArray(r).getHex();break;case"specularCoef":n.shininess=r;break;case"shading":"basic"===r.toLowerCase()&&(n.type="MeshBasicMaterial"),"phong"===r.toLowerCase()&&(n.type="MeshPhongMaterial"),"standard"===r.toLowerCase()&&(n.type="MeshStandardMaterial");break;case"mapDiffuse":n.map=e(r,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":n.emissiveMap=e(r,t.mapEmissiveRepeat,t.mapEmissiveOffset,t.mapEmissiveWrap,t.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":n.lightMap=e(r,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":n.aoMap=e(r,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":n.bumpMap=e(r,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":n.bumpScale=r;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":n.normalMap=e(r,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":n.normalScale=[r,r];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":n.specularMap=e(r,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":n.metalnessMap=e(r,t.mapMetalnessRepeat,t.mapMetalnessOffset,t.mapMetalnessWrap,t.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":n.roughnessMap=e(r,t.mapRoughnessRepeat,t.mapRoughnessOffset,t.mapRoughnessWrap,t.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":n.alphaMap=e(r,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":n.side=W;break;case"doubleSided":n.side=X;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),n.opacity=r;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":n[i]=r;break;case"vertexColors":!0===r&&(n.vertexColors=2),"face"===r&&(n.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",i,r)}}return"MeshBasicMaterial"===n.type&&delete n.emissive,"MeshPhongMaterial"!==n.type&&delete n.specular,n.opacity<1&&(n.transparent=!0),Ss.setTextures(u),Ss.parse(n)})}),Object.assign(Ps.prototype,{load:function(a,o,t,e){var s=this,c=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Ls.prototype.extractUrlBase(a),i=new ko(this.manager);i.setWithCredentials(this.withCredentials),i.load(a,function(t){var e=JSON.parse(t),i=e.metadata;if(void 0!==i){var n=i.type;if(void 0!==n){if("object"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");if("scene"===n.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.")}}var r=s.parse(e,c);o(r.geometry,r.materials)},t,e)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){void 0!==t.data&&(t=t.data),void 0!==t.scale?t.scale=1/t.scale:t.scale=1;var i=new sr;return function(t,e){var i,n,r,a,o,s,c,h,l,u,d,p,f,m,g,v,y,x,_,b,w,M,E,T,S=t.faces,A=t.vertices,R=t.normals,L=t.colors,P=t.scale,C=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&C++;for(i=0;i<C;i++)e.faceVertexUvs[i]=[]}for(a=0,o=A.length;a<o;)(y=new re).x=A[a++]*P,y.y=A[a++]*P,y.z=A[a++]*P,e.vertices.push(y);for(a=0,o=S.length;a<o;)if(d=(u=S[a++])&2,p=u&8,f=u&16,m=u&32,g=u&64,v=u&128,u&1){if((_=new an).a=S[a],_.b=S[a+1],_.c=S[a+3],(b=new an).a=S[a+1],b.b=S[a+2],b.c=S[a+3],a+=4,d&&(l=S[a++],_.materialIndex=l,b.materialIndex=l),r=e.faces.length,p)for(i=0;i<C;i++)for(E=t.uvs[i],e.faceVertexUvs[i][r]=[],e.faceVertexUvs[i][r+1]=[],n=0;n<4;n++)T=new _t(E[2*(h=S[a++])],E[2*h+1]),2!==n&&e.faceVertexUvs[i][r].push(T),0!==n&&e.faceVertexUvs[i][r+1].push(T);if(f&&(c=3*S[a++],_.normal.set(R[c++],R[c++],R[c]),b.normal.copy(_.normal)),m)for(i=0;i<4;i++)c=3*S[a++],M=new re(R[c++],R[c++],R[c]),2!==i&&_.vertexNormals.push(M),0!==i&&b.vertexNormals.push(M);if(g&&(w=L[s=S[a++]],_.color.setHex(w),b.color.setHex(w)),v)for(i=0;i<4;i++)w=L[s=S[a++]],2!==i&&_.vertexColors.push(new qe(w)),0!==i&&b.vertexColors.push(new qe(w));e.faces.push(_),e.faces.push(b)}else{if((x=new an).a=S[a++],x.b=S[a++],x.c=S[a++],d&&(l=S[a++],x.materialIndex=l),r=e.faces.length,p)for(i=0;i<C;i++)for(E=t.uvs[i],e.faceVertexUvs[i][r]=[],n=0;n<3;n++)T=new _t(E[2*(h=S[a++])],E[2*h+1]),e.faceVertexUvs[i][r].push(T);if(f&&(c=3*S[a++],x.normal.set(R[c++],R[c++],R[c])),m)for(i=0;i<3;i++)c=3*S[a++],M=new re(R[c++],R[c++],R[c]),x.vertexNormals.push(M);if(g&&(s=S[a++],x.color.setHex(L[s])),v)for(i=0;i<3;i++)s=S[a++],x.vertexColors.push(new qe(L[s]));e.faces.push(x)}}(t,i),function(t,e){var i=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,r=t.skinWeights.length;n<r;n+=i){var a=t.skinWeights[n],o=1<i?t.skinWeights[n+1]:0,s=2<i?t.skinWeights[n+2]:0,c=3<i?t.skinWeights[n+3]:0;e.skinWeights.push(new te(a,o,s,c))}if(t.skinIndices)for(n=0,r=t.skinIndices.length;n<r;n+=i){var h=t.skinIndices[n],l=1<i?t.skinIndices[n+1]:0,u=2<i?t.skinIndices[n+2]:0,d=3<i?t.skinIndices[n+3]:0;e.skinIndices.push(new te(h,l,u,d))}e.bones=t.bones,e.bones&&0<e.bones.length&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}(t,i),function(t,e){var i=t.scale;if(void 0!==t.morphTargets)for(var n=0,r=t.morphTargets.length;n<r;n++){e.morphTargets[n]={},e.morphTargets[n].name=t.morphTargets[n].name,e.morphTargets[n].vertices=[];for(var a=e.morphTargets[n].vertices,o=t.morphTargets[n].vertices,s=0,c=o.length;s<c;s+=3){var h=new re;h.x=o[s]*i,h.y=o[s+1]*i,h.z=o[s+2]*i,a.push(h)}}if(void 0!==t.morphColors&&0<t.morphColors.length){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var l=e.faces,u=t.morphColors[0].colors,n=0,r=l.length;n<r;n++)l[n].color.fromArray(u,3*n)}}(t,i),function(t,e){var i=[],n=[];void 0!==t.animation&&n.push(t.animation),void 0!==t.animations&&(t.animations.length?n=n.concat(t.animations):n.push(t.animations));for(var r,a=0;a<n.length;a++){var o=_s.parseAnimation(n[a],e.bones);o&&i.push(o)}e.morphTargets&&(r=_s.CreateClipsFromMorphTargetSequences(e.morphTargets,10),i=i.concat(r)),0<i.length&&(e.animations=i)}(t,i),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===t.materials||0===t.materials.length?{geometry:i}:{geometry:i,materials:Ls.prototype.initMaterials(t.materials,e,this.crossOrigin)}}}),Object.assign(Cs.prototype,{load:function(n,r,t,a){""===this.texturePath&&(this.texturePath=n.substring(0,n.lastIndexOf("/")+1));var o=this;new ko(o.manager).load(n,function(t){var e=null;try{e=JSON.parse(t)}catch(t){return void 0!==a&&a(t),void console.error("THREE:ObjectLoader: Can't parse "+n+".",t.message)}var i=e.metadata;void 0!==i&&void 0!==i.type&&"geometry"!==i.type.toLowerCase()?o.parse(e,r):console.error("THREE.ObjectLoader: Can't load "+n+". Use THREE.JSONLoader instead.")},t,a)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var i=this.parseGeometries(t.geometries),n=this.parseImages(t.images,function(){void 0!==e&&e(o)}),r=this.parseTextures(t.textures,n),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,i,a);return t.animations&&(o.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(o),o},parseGeometries:function(t){var e={};if(void 0!==t)for(var i=new Ps,n=new ws,r=0,a=t.length;r<a;r++){var o,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Lo[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Lo[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Lo[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Lo[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Lo[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Lo[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":o=new Lo[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Lo[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Lo[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Lo[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Lo[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":o=n.parse(s);break;case"Geometry":o=i.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),e[s.uuid]=o}return e},parseMaterials:function(t,e){var i={};if(void 0!==t){var n=new bs;n.setTextures(e);for(var r=0,a=t.length;r<a;r++){var o=t[r];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(n.parse(o.materials[c]));i[o.uuid]=s}else i[o.uuid]=n.parse(o)}}return i},parseAnimations:function(t){for(var e=[],i=0;i<t.length;i++){var n=_s.parse(t[i]);e.push(n)}return e},parseImages:function(t,e){var i=this,n={};if(void 0!==t&&0<t.length){var r=new Xo(new Ho(e));r.setCrossOrigin(this.crossOrigin);for(var a=0,o=t.length;a<o;a++){var s=t[a],c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url)?s.url:i.texturePath+s.url;n[s.uuid]=function(t){return i.manager.itemStart(t),r.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemEnd(t),i.manager.itemError(t)})}(c)}}return n},parseTextures:function(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var n={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var o=t[r];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=new At(e[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=i(o.mapping,Is)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.wrap&&(s.wrapS=i(o.wrap[0],Us),s.wrapT=i(o.wrap[1],Us)),void 0!==o.minFilter&&(s.minFilter=i(o.minFilter,Ns)),void 0!==o.magFilter&&(s.magFilter=i(o.magFilter,Ns)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),n[o.uuid]=s}return n},parseObject:(As=new ae,function(t,e,a){function i(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function n(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i];void 0===a[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(a[r])}return e}return void 0===a[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),a[t]}}switch(t.type){case"Scene":s=new Ea,void 0!==t.background&&Number.isInteger(t.background)&&(s.background=new qe(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new Ma(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new wa(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":s=new rn(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new nn(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":s=new ns(t.color,t.intensity);break;case"DirectionalLight":s=new is(t.color,t.intensity);break;case"PointLight":s=new ts(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new rs(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new $o(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new Jo(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var r=i(t.geometry),o=n(t.material),s=new(r.bones&&0<r.bones.length?Ca:Lr)(r,o);break;case"LOD":s=new Ra;break;case"Line":s=new Ua(i(t.geometry),n(t.material),t.mode);break;case"LineLoop":s=new Oa(i(t.geometry),n(t.material));break;case"LineSegments":s=new Na(i(t.geometry),n(t.material));break;case"PointCloud":case"Points":s=new Fa(i(t.geometry),n(t.material));break;case"Sprite":s=new Aa(n(t.material));break;case"Group":s=new Ba;break;default:s=new tn}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(As.fromArray(t.matrix),As.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.children)for(var c in t.children)s.add(this.parseObject(t.children[c],e,a));if("LOD"===t.type)for(var h=t.levels,l=0;l<h.length;l++){var u=h[l];void 0!==(c=s.getObjectByProperty("uuid",u.object))&&s.addLevel(c,u.distance)}return s})});var Is={UVMapping:300,CubeReflectionMapping:dt,CubeRefractionMapping:pt,EquirectangularReflectionMapping:ft,EquirectangularRefractionMapping:mt,SphericalReflectionMapping:gt,CubeUVReflectionMapping:vt,CubeUVRefractionMapping:yt},Us={RepeatWrapping:Nt,ClampToEdgeWrapping:Ot,MirroredRepeatWrapping:Dt},Ns={NearestFilter:Ft,NearestMipMapNearestFilter:Bt,NearestMipMapLinearFilter:zt,LinearFilter:Gt,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:Ht};function Os(t,e,i,n,r){var a=.5*(n-e),o=.5*(r-i),s=t*t;return(2*i-2*n+a+o)*(t*s)+(-3*i+3*n-2*a-o)*s+a*t+i}function Ds(t,e,i,n){return(o=1-t)*o*e+2*(1-(a=t))*a*i+(r=t)*r*n;var r,a,o}function Fs(t,e,i,n,r){return(h=1-t)*h*h*e+3*(c=1-(s=t))*c*s*i+3*(1-(o=t))*o*o*n+(a=t)*a*a*r;var a,o,s,c,h}function Bs(){this.arcLengthDivisions=200}function zs(t,e){Bs.call(this),this.v1=t,this.v2=e}function Gs(){Bs.call(this),this.curves=[],this.autoClose=!1}function Hs(t,e,i,n,r,a,o,s){Bs.call(this),this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s||0}function Vs(t){Bs.call(this),this.points=void 0===t?[]:t}function ks(t,e,i,n){Bs.call(this),this.v0=t,this.v1=e,this.v2=i,this.v3=n}function js(t,e,i){Bs.call(this),this.v0=t,this.v1=e,this.v2=i}Object.assign(Bs.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)a+=(e=this.getPoint(i/t)).distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){for(var i,n=this.getLengths(),r=0,a=n.length,o=e||t*n[a-1],s=0,c=a-1;s<=c;)if((i=n[r=Math.floor(s+(c-s)/2)]-o)<0)s=r+1;else{if(!(0<i)){c=r;break}c=r-1}if(n[r=c]===o)return r/(a-1);var h=n[r];return(r+(o-h)/(n[r+1]-h))/(a-1)},getTangent:function(t){var e=t-1e-4,i=t+1e-4;e<0&&(e=0),1<i&&(i=1);var n=this.getPoint(e);return this.getPoint(i).clone().sub(n).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){for(var i,n,r=new re,a=[],o=[],s=[],c=new re,h=new ae,l=0;l<=t;l++)i=l/t,a[l]=this.getTangentAt(i),a[l].normalize();o[0]=new re,s[0]=new re;var u=Number.MAX_VALUE,d=Math.abs(a[0].x),p=Math.abs(a[0].y),f=Math.abs(a[0].z);for(d<=u&&(u=d,r.set(1,0,0)),p<=u&&(u=p,r.set(0,1,0)),f<=u&&r.set(0,0,1),c.crossVectors(a[0],r).normalize(),o[0].crossVectors(a[0],c),s[0].crossVectors(a[0],o[0]),l=1;l<=t;l++)o[l]=o[l-1].clone(),s[l]=s[l-1].clone(),c.crossVectors(a[l-1],a[l]),c.length()>Number.EPSILON&&(c.normalize(),n=Math.acos($t.clamp(a[l-1].dot(a[l]),-1,1)),o[l].applyMatrix4(h.makeRotationAxis(c,n))),s[l].crossVectors(a[l],o[l]);if(!0===e)for(n=Math.acos($t.clamp(o[0].dot(o[t]),-1,1)),n/=t,0<a[0].dot(c.crossVectors(o[0],o[t]))&&(n=-n),l=1;l<=t;l++)o[l].applyMatrix4(h.makeRotationAxis(a[l],n*l)),s[l].crossVectors(a[l],o[l]);return{tangents:a,normals:o,binormals:s}}}),((zs.prototype=Object.create(Bs.prototype)).constructor=zs).prototype.isLineCurve=!0,zs.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},zs.prototype.getPointAt=function(t){return this.getPoint(t)},zs.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Gs.prototype=Object.assign(Object.create(Bs.prototype),{constructor:Gs,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new zs(e,t))},getPoint:function(t){for(var e=t*this.getLength(),i=this.getCurveLengths(),n=0;n<i.length;){if(i[n]>=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,i=[],n=0,r=this.curves;n<r.length;n++)for(var a=r[n],o=a&&a.isEllipseCurve?2*t:a&&a.isLineCurve?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var h=s[c];e&&e.equals(h)||(i.push(h),e=h)}return this.autoClose&&1<i.length&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new sr,i=0,n=t.length;i<n;i++){var r=t[i];e.vertices.push(new re(r.x,r.y,r.z||0))}return e}}),((Hs.prototype=Object.create(Bs.prototype)).constructor=Hs).prototype.isEllipseCurve=!0,Hs.prototype.getPoint=function(t){for(var e=2*Math.PI,i=this.aEndAngle-this.aStartAngle,n=Math.abs(i)<Number.EPSILON;i<0;)i+=e;for(;e<i;)i-=e;i<Number.EPSILON&&(i=n?0:e),!0!==this.aClockwise||n||(i===e?i=-e:i-=e);var r,a,o,s,c=this.aStartAngle+t*i,h=this.aX+this.xRadius*Math.cos(c),l=this.aY+this.yRadius*Math.sin(c);return 0!==this.aRotation&&(r=Math.cos(this.aRotation),a=Math.sin(this.aRotation),h=(o=h-this.aX)*r-(s=l-this.aY)*a+this.aX,l=o*a+s*r+this.aY),new _t(h,l)},((Vs.prototype=Object.create(Bs.prototype)).constructor=Vs).prototype.isSplineCurve=!0,Vs.prototype.getPoint=function(t){var e=this.points,i=(e.length-1)*t,n=Math.floor(i),r=i-n,a=e[0===n?n:n-1],o=e[n],s=e[n>e.length-2?e.length-1:n+1],c=e[n>e.length-3?e.length-1:n+2];return new _t(Os(r,a.x,o.x,s.x,c.x),Os(r,a.y,o.y,s.y,c.y))},((ks.prototype=Object.create(Bs.prototype)).constructor=ks).prototype.getPoint=function(t){var e=this.v0,i=this.v1,n=this.v2,r=this.v3;return new _t(Fs(t,e.x,i.x,n.x,r.x),Fs(t,e.y,i.y,n.y,r.y))},((js.prototype=Object.create(Bs.prototype)).constructor=js).prototype.getPoint=function(t){var e=this.v0,i=this.v1,n=this.v2;return new _t(Ds(t,e.x,i.x,n.x),Ds(t,e.y,i.y,n.y))};var Ws,Xs=Object.assign(Object.create(Gs.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var i=new zs(this.currentPoint.clone(),new _t(t,e));this.curves.push(i),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,i,n){var r=new js(this.currentPoint.clone(),new _t(t,e),new _t(i,n));this.curves.push(r),this.currentPoint.set(i,n)},bezierCurveTo:function(t,e,i,n,r,a){var o=new ks(this.currentPoint.clone(),new _t(t,e),new _t(i,n),new _t(r,a));this.curves.push(o),this.currentPoint.set(r,a)},splineThru:function(t){var e=new Vs([this.currentPoint.clone()].concat(t));this.curves.push(e),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,i,n,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+o,e+s,i,n,r,a)},absarc:function(t,e,i,n,r,a){this.absellipse(t,e,i,i,n,r,a)},ellipse:function(t,e,i,n,r,a,o,s){var c=this.currentPoint.x,h=this.currentPoint.y;this.absellipse(t+c,e+h,i,n,r,a,o,s)},absellipse:function(t,e,i,n,r,a,o,s){var c,h=new Hs(t,e,i,n,r,a,o,s);0<this.curves.length&&((c=h.getPoint(0)).equals(this.currentPoint)||this.lineTo(c.x,c.y)),this.curves.push(h);var l=h.getPoint(1);this.currentPoint.copy(l)}});function qs(t){Gs.call(this),this.currentPoint=new _t,t&&this.fromPoints(t)}function Ys(){qs.apply(this,arguments),this.holes=[]}function Zs(){this.subPaths=[],this.currentPath=null}function Js(t){this.data=t}function Qs(t){this.manager=void 0!==t?t:Vo}(qs.prototype=Xs).constructor=qs,Ys.prototype=Object.assign(Object.create(Xs),{constructor:Ys,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(Zs.prototype,{moveTo:function(t,e){this.currentPath=new qs,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,i,n){this.currentPath.quadraticCurveTo(t,e,i,n)},bezierCurveTo:function(t,e,i,n,r,a){this.currentPath.bezierCurveTo(t,e,i,n,r,a)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function i(t){for(var e=[],i=0,n=t.length;i<n;i++){var r=t[i],a=new Ys;a.curves=r.curves,e.push(a)}return e}var n=co.isClockWise,r=this.subPaths;if(0===r.length)return[];if(!0===e)return i(r);var a,o,s,c=[];if(1===r.length)return o=r[0],(s=new Ys).curves=o.curves,c.push(s),c;var h,l=!n(r[0].getPoints()),l=t?!l:l,u=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m,g=0,v=r.length;g<v;g++)a=n(h=(o=r[g]).getPoints()),(a=t?!a:a)?(!l&&d[f]&&f++,d[f]={s:new Ys,p:h},d[f].s.curves=o.curves,l&&f++,p[f]=[]):p[f].push({h:o,p:h[0]});if(!d[0])return i(r);if(1<d.length){for(var y=!1,x=[],_=0,b=d.length;_<b;_++)u[_]=[];for(_=0,b=d.length;_<b;_++)for(var w=p[_],M=0;M<w.length;M++){for(var E=w[M],T=!0,S=0;S<d.length;S++)!function(t,e){for(var i=e.length,n=!1,r=i-1,a=0;a<i;r=a++){var o=e[r],s=e[a],c=s.x-o.x,h=s.y-o.y;if(Math.abs(h)>Number.EPSILON){if(h<0&&(o=e[a],c=-c,s=e[r],h=-h),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return 1}else{var l=h*(t.x-o.x)-c*(t.y-o.y);if(0==l)return 1;if(l<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return 1}}return n}(E.p,d[S].p)||(_!==S&&x.push({froms:_,tos:S,hole:M}),T?(T=!1,u[S].push(E)):y=!0);T&&u[_].push(E)}0<x.length&&(y||(p=u))}for(var g=0,A=d.length;g<A;g++){s=d[g].s,c.push(s);for(var R=0,L=(m=p[g]).length;R<L;R++)s.holes.push(m[R].h)}return c}}),Object.assign(Js.prototype,{isFont:!0,generateShapes:function(t,l,M){void 0===l&&(l=100),void 0===M&&(M=4);for(var E=this.data,e=function(t){for(var e=String(t).split(""),i=l/E.resolution,n=(E.boundingBox.yMax-E.boundingBox.yMin+E.underlineThickness)*i,r=0,a=0,o=[],s=0;s<e.length;s++){var c,h=e[s];"\n"===h?(r=0,a-=n):(r+=(c=function(t,e,i,n){var r=E.glyphs[t]||E.glyphs["?"];if(!r)return;var a,o,s,c,h,l,u,d,p,f,m,g=new Zs,v=[];if(r.o)for(var y=r._cachedOutline||(r._cachedOutline=r.o.split(" ")),x=0,_=y.length;x<_;){switch(y[x++]){case"m":a=y[x++]*e+i,o=y[x++]*e+n,g.moveTo(a,o);break;case"l":a=y[x++]*e+i,o=y[x++]*e+n,g.lineTo(a,o);break;case"q":if(s=y[x++]*e+i,c=y[x++]*e+n,u=y[x++]*e+i,d=y[x++]*e+n,g.quadraticCurveTo(u,d,s,c),m=v[v.length-1]){h=m.x,l=m.y;for(var b=1;b<=M;b++){Ds(w=b/M,h,u,s),Ds(w,l,d,c)}}break;case"b":if(s=y[x++]*e+i,c=y[x++]*e+n,u=y[x++]*e+i,d=y[x++]*e+n,p=y[x++]*e+i,f=y[x++]*e+n,g.bezierCurveTo(u,d,p,f,s,c),m=v[v.length-1]){h=m.x,l=m.y;for(var w,b=1;b<=M;b++){Fs(w=b/M,h,u,p,s),Fs(w,l,d,f,c)}}}}return{offsetX:r.ha*e,path:g}}(h,i,r,a)).offsetX,o.push(c.path))}return o}(t),i=[],n=0,r=e.length;n<r;n++)Array.prototype.push.apply(i,e[n].toShapes());return i}}),Object.assign(Qs.prototype,{load:function(t,n,e,i){var r=this;new ko(this.manager).load(t,function(e){var i;try{i=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),i=JSON.parse(e.substring(65,e.length-2))}var t=r.parse(i);n&&n(t)},e,i)},parse:function(t){return new Js(t)}});var Ks,$s,tc,ec,ic,nc,rc,ac,oc,sc,cc,hc,lc,uc,dc,pc,fc,mc,gc,vc,yc,xc,_c,bc,wc,Mc,Ec,Tc,Sc,Ac,Rc,Lc,Pc,Cc,Ic,Uc,Nc,Oc,Dc,Fc,Bc,zc,Gc,Hc={getContext:function(){return void 0===Ws&&(Ws=new(window.AudioContext||window.webkitAudioContext)),Ws},setContext:function(t){Ws=t}};function Vc(t){this.manager=void 0!==t?t:Vo}function kc(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new rn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new rn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function jc(t,e,i){tn.call(this),this.type="CubeCamera";var r=new rn(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new re(1,0,0)),this.add(r);var a=new rn(90,1,t,e);a.up.set(0,-1,0),a.lookAt(new re(-1,0,0)),this.add(a);var o=new rn(90,1,t,e);o.up.set(0,0,1),o.lookAt(new re(0,1,0)),this.add(o);var s=new rn(90,1,t,e);s.up.set(0,0,-1),s.lookAt(new re(0,-1,0)),this.add(s);var c=new rn(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new re(0,0,1)),this.add(c);var h=new rn(90,1,t,e);h.up.set(0,-1,0),h.lookAt(new re(0,0,-1)),this.add(h);var n={format:Yt,magFilter:Gt,minFilter:Gt};this.renderTarget=new ie(i,i,n),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var i=this.renderTarget,n=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,i.activeCubeFace=0,t.render(e,r,i),i.activeCubeFace=1,t.render(e,a,i),i.activeCubeFace=2,t.render(e,o,i),i.activeCubeFace=3,t.render(e,s,i),i.activeCubeFace=4,t.render(e,c,i),i.texture.generateMipmaps=n,i.activeCubeFace=5,t.render(e,h,i),t.setRenderTarget(null)}}function Wc(){tn.call(this),this.type="AudioListener",this.context=Hc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Xc(t){tn.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function qc(t){Xc.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Yc(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Zc(t,e,i){this.binding=t,this.valueSize=i;var n,r=Float64Array;switch(e){case"quaternion":n=this._slerp;break;case"string":case"bool":r=Array,n=this._select;break;default:n=this._lerp}this.buffer=new r(4*i),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Jc(t,e,i){var n=i||Qc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function Qc(t,e,i){this.path=e,this.parsedPath=i||Qc.parseTrackName(e),this.node=Qc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Kc(t){this.uuid=$t.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var i=0,n=arguments.length;i!==n;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function $c(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:d,endingEnd:d},s=0;s!==r;++s){var c=n[s].createInterpolant(null);(a[s]=c).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function th(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function eh(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function ih(){_r.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function nh(t,e,i,n){this.uuid=$t.generateUUID(),this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function rh(t,e){this.uuid=$t.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function ah(t,e,i){rh.call(this,t,e),this.meshPerAttribute=i||1}function oh(t,e,i){cr.call(this,t,e),this.meshPerAttribute=i||1}function sh(t,e,i,n){this.ray=new Sr(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ch(t,e){return t.distance-e.distance}function hh(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n))for(var r=t.children,a=0,o=r.length;a<o;a++)hh(r[a],e,i,!0)}function lh(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function uh(t,e,i){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==i?i:0,this}function dh(t,e,i){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==i?i:0,this}function ph(t,e){Lr.call(this,t,e),this.animationsMap={},this.animationsList=[];var i=this.geometry.morphTargets.length,n=i-1,r=+i;this.createAnimation("__default",0,n,r),this.setAnimationWeight("__default",1)}function fh(t){tn.call(this),this.material=t,this.render=function(t){}}function mh(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16711680,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new _r,h=new gr(2*o*3,3);c.addAttribute("position",h),Na.call(this,c,new Ia({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function gh(t){tn.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new _r,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,r=1;n<32;n++,r++){var a=n/32*Math.PI*2,o=r/32*Math.PI*2;i.push(Math.cos(a),Math.sin(a),1,Math.cos(o),Math.sin(o),1)}e.addAttribute("position",new gr(i,3));var s=new Ia({fog:!1});this.cone=new Na(e,s),this.add(this.cone),this.update()}function vh(t){for(var e=function t(e){var i=[];e&&e.isBone&&i.push(e);for(var n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new _r,n=[],r=[],a=new qe(0,0,1),o=new qe(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}i.addAttribute("position",new gr(n,3)),i.addAttribute("color",new gr(r,3));var h=new Ia({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});Na.call(this,i,h),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.onBeforeRender()}function yh(t,e){this.light=t,this.light.updateMatrixWorld();var i=new mo(e,4,2),n=new Tr({wireframe:!0,fog:!1});n.color.copy(this.light.color),Lr.call(this,i,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function xh(t){tn.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var e=new Ia({color:t.color}),i=new _r;i.addAttribute("position",new cr(new Float32Array(15),3)),this.add(new Ua(i,e)),this.update()}function _h(t,e){tn.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var i=new Qa(e);i.rotateY(.5*Math.PI);var n=new Tr({vertexColors:2,wireframe:!0}),r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.addAttribute("color",new cr(a,3)),this.add(new Lr(i,n)),this.update()}function bh(t,e,i,n){t=t||10,e=e||10,i=new qe(void 0!==i?i:4473924),n=new qe(void 0!==n?n:8947848);for(var r=e/2,a=t/e,o=t/2,s=[],c=[],h=0,l=0,u=-o;h<=e;h++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var d=h===r?i:n;d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3}var p=new _r;p.addAttribute("position",new gr(s,3)),p.addAttribute("color",new gr(c,3));var f=new Ia({vertexColors:2});Na.call(this,p,f)}function wh(t,e,i,n,r,a){t=t||10,e=e||16,i=i||8,n=n||64,r=new qe(void 0!==r?r:4473924),a=new qe(void 0!==a?a:8947848);for(var o,s,c,h,l,u,d=[],p=[],f=0;f<=e;f++)c=f/e*(2*Math.PI),o=Math.sin(c)*t,s=Math.cos(c)*t,d.push(0,0,0),d.push(o,0,s),u=1&f?r:a,p.push(u.r,u.g,u.b),p.push(u.r,u.g,u.b);for(f=0;f<=i;f++)for(u=1&f?r:a,l=t-t/i*f,h=0;h<n;h++)c=h/n*(2*Math.PI),o=Math.sin(c)*l,s=Math.cos(c)*l,d.push(o,0,s),p.push(u.r,u.g,u.b),c=(h+1)/n*(2*Math.PI),o=Math.sin(c)*l,s=Math.cos(c)*l,d.push(o,0,s),p.push(u.r,u.g,u.b);var m=new _r;m.addAttribute("position",new gr(d,3)),m.addAttribute("color",new gr(p,3));var g=new Ia({vertexColors:2});Na.call(this,m,g)}function Mh(t,e,i,n){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==i?i:16776960,a=void 0!==n?n:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new _r,h=new gr(2*o*3,3);c.addAttribute("position",h),Na.call(this,c,new Ia({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Eh(t,e){tn.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var i=new _r;i.addAttribute("position",new gr([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var n=new Ia({fog:!1});this.add(new Ua(i,n)),(i=new _r).addAttribute("position",new gr([0,0,0,0,0,1],3)),this.add(new Ua(i,n)),this.update()}function Th(t){var e=new _r,i=new Ia({color:16777215,vertexColors:1}),n=[],r=[],a={},o=new qe(16755200),s=new qe(16711680),c=new qe(43775),h=new qe(16777215),l=new qe(3355443);function u(t,e,i){d(t,i),d(e,i)}function d(t,e){n.push(0,0,0),r.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(n.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",h),u("p","c",l),u("cn1","cn2",l),u("cn3","cn4",l),u("cf1","cf2",l),u("cf3","cf4",l),e.addAttribute("position",new gr(n,3)),e.addAttribute("color",new gr(r,3)),Na.call(this,e,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Sh(t,e,i,n){Nc.set(e,i,n).unproject(Oc);var r=Uc[t];if(void 0!==r)for(var a=Ic.getAttribute("position"),o=0,s=r.length;o<s;o++)a.setXYZ(r[o],Nc.x,Nc.y,Nc.z)}function Ah(t,e){this.object=t,void 0===e&&(e=16776960);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new _r;r.setIndex(new cr(i,1)),r.addAttribute("position",new cr(n,3)),Na.call(this,r,new Ia({color:e})),this.matrixAutoUpdate=!1,this.update()}function Rh(t,e,i,n,r,a){tn.call(this),void 0===n&&(n=16776960),void 0===i&&(i=1),void 0===r&&(r=.2*i),void 0===a&&(a=.2*r),void 0===Fc&&((Fc=new _r).addAttribute("position",new gr([0,0,0,0,1,0],3)),(Bc=new Eo(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new Ua(Fc,new Ia({color:n})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Lr(Bc,new Tr({color:n})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,r,a)}function Lh(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new _r;i.addAttribute("position",new gr(e,3)),i.addAttribute("color",new gr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new Ia({vertexColors:2});Na.call(this,i,n)}function Ph(){var r=0,a=0,o=0,s=0;function h(t,e,i,n){o=-3*(r=t)+3*e-2*(a=i)-n,s=2*t-2*e+i+n}return{initCatmullRom:function(t,e,i,n,r){h(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){var s=(e-t)/r-(i-t)/(r+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;h(e,i,s*=a,c*=a)},calc:function(t){var e=t*t;return r+a*t+o*e+s*(e*t)}}}Object.assign(Vc.prototype,{load:function(t,e,i,n){var r=new ko(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){Hc.getContext().decodeAudioData(t,function(t){e(t)})},i,n)}}),Object.assign(kc.prototype,{update:(oc=new ae,sc=new ae,function(t){var e,i,n,r,a;Ks===this&&$s===t.focus&&tc===t.fov&&ec===t.aspect*this.aspect&&ic===t.near&&nc===t.far&&rc===t.zoom&&ac===this.eyeSep||(Ks=this,$s=t.focus,tc=t.fov,ec=t.aspect*this.aspect,ic=t.near,nc=t.far,rc=t.zoom,e=t.projectionMatrix.clone(),i=(ac=this.eyeSep/2)*ic/$s,n=ic*Math.tan($t.DEG2RAD*tc*.5)/rc,sc.elements[12]=-ac,oc.elements[12]=ac,r=-n*ec+i,a=n*ec+i,e.elements[0]=2*ic/(a-r),e.elements[8]=(a+r)/(a-r),this.cameraL.projectionMatrix.copy(e),r=-n*ec-i,a=n*ec-i,e.elements[0]=2*ic/(a-r),e.elements[8]=(a+r)/(a-r),this.cameraR.projectionMatrix.copy(e)),this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(sc),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(oc)})}),(jc.prototype=Object.create(tn.prototype)).constructor=jc,Wc.prototype=Object.assign(Object.create(tn.prototype),{constructor:Wc,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:(cc=new re,hc=new ne,lc=new re,uc=new re,function(t){tn.prototype.updateMatrixWorld.call(this,t);var e=this.context.listener,i=this.up;this.matrixWorld.decompose(cc,hc,lc),uc.set(0,0,-1).applyQuaternion(hc),e.positionX?(e.positionX.setValueAtTime(cc.x,this.context.currentTime),e.positionY.setValueAtTime(cc.y,this.context.currentTime),e.positionZ.setValueAtTime(cc.z,this.context.currentTime),e.forwardX.setValueAtTime(uc.x,this.context.currentTime),e.forwardY.setValueAtTime(uc.y,this.context.currentTime),e.forwardZ.setValueAtTime(uc.z,this.context.currentTime),e.upX.setValueAtTime(i.x,this.context.currentTime),e.upY.setValueAtTime(i.y,this.context.currentTime),e.upZ.setValueAtTime(i.z,this.context.currentTime)):(e.setPosition(cc.x,cc.y,cc.z),e.setOrientation(uc.x,uc.y,uc.z,i.x,i.y,i.z))})}),Xc.prototype=Object.assign(Object.create(tn.prototype),{constructor:Xc,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t=t||[],!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),qc.prototype=Object.assign(Object.create(Xc.prototype),{constructor:qc,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:(dc=new re,function(t){tn.prototype.updateMatrixWorld.call(this,t),dc.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(dc.x,dc.y,dc.z)})}),Object.assign(Yc.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),i=0;i<e.length;i++)t+=e[i];return t/e.length}}),Object.assign(Zc.prototype,{accumulate:function(t,e){var i=this.buffer,n=this.valueSize,r=t*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)i[r+o]=i[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(i,r,0,s,n)}this.cumulativeWeight=a},apply:function(t){var e,i=this.valueSize,n=this.buffer,r=t*i+i,a=this.cumulativeWeight,o=this.binding;this.cumulativeWeight=0,a<1&&(e=3*i,this._mixBufferRegion(n,r,e,1-a,i));for(var s=i,c=i+i;s!==c;++s)if(n[s]!==n[s+i]){o.setValue(n,r);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,i=this.valueSize,n=3*i;t.getValue(e,n);for(var r=i,a=n;r!==a;++r)e[r]=e[n+r%i];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,i,n,r){if(.5<=n)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n){ne.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}}),Object.assign(Jc.prototype,{getValue:function(t,e){this.bind();var i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)},setValue:function(t,e){for(var i=this._bindings,n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}),Object.assign(Qc,{Composite:Jc,create:function(t,e,i){return t&&t.isAnimationObjectGroup?new Qc.Composite(t,e,i):new Qc(t,e,i)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(pc=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),fc=["material","materials","bones"],function(t){var e=pc.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var i,n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r&&(i=n.nodeName.substring(r+1),-1!==fc.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)),null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}),findNode:function(t,a){if(!a||""===a||"root"===a||"."===a||-1===a||a===t.name||a===t.uuid)return t;if(t.skeleton){var e=function(t){for(var e=0;e<t.bones.length;e++){var i=t.bones[e];if(i.name===a)return i}return null}(t.skeleton);if(e)return e}if(t.children){var i=function t(e){for(var i=0;i<e.length;i++){var n=e[i];if(n.name===a||n.uuid===a)return n;var r=t(n.children);if(r)return r}return null}(t.children);if(i)return i}return null}}),Object.assign(Qc.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)t[e++]=i[n]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++]},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var i=this.resolvedProperty,n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Qc.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var a=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[n];if(void 0!==s){var c=this.Versioning.None;void 0!==t.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(t.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===r){r=o;break}}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}else{var l=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+n+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(Qc.prototype,{_getValue_unbound:Qc.prototype.getValue,_setValue_unbound:Qc.prototype.setValue}),Object.assign(Kc.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._paths,o=this._parsedPaths,s=this._bindings,c=s.length,h=0,l=arguments.length;h!==l;++h){var u=arguments[h],d=u.uuid,p=r[d],f=void 0;if(void 0===p){p=i++,r[d]=p,e.push(u);for(var m=0,g=c;m!==g;++m)s[m].push(new Qc(u,a[m],o[m]))}else if(p<n){f=e[p];var v=--n,y=e[v];e[r[y.uuid]=p]=y,e[r[d]=v]=u;for(m=0,g=c;m!==g;++m){var x=s[m],_=x[v],b=x[p];x[p]=_,void 0===b&&(b=new Qc(u,a[m],o[m])),x[v]=b}}else e[p]!==f&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(t){for(var e=this._objects,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],h=c.uuid,l=n[h];if(void 0!==l&&i<=l){var u=i++,d=e[u];e[n[d.uuid]=l]=d,e[n[h]=u]=c;for(var p=0,f=a;p!==f;++p){var m=r[p],g=m[u],v=m[l];m[l]=g,m[u]=v}}}this.nCachedObjects_=i},uncache:function(t){for(var e=this._objects,i=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,o=a.length,s=0,c=arguments.length;s!==c;++s){var h=arguments[s].uuid,l=r[h];if(void 0!==l)if(delete r[h],l<n){var u,d=--n,p=e[d],f=e[u=--i];e[r[p.uuid]=l]=p,e[r[f.uuid]=d]=f,e.pop();for(var m=0,g=o;m!==g;++m){var v=(x=a[m])[d],y=x[u];x[l]=v,x[d]=y,x.pop()}}else{e[r[(f=e[u=--i]).uuid]=l]=f,e.pop();for(var x,m=0,g=o;m!==g;++m){(x=a[m])[l]=x[u],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var i=this._bindingsIndicesByPath,n=i[t],r=this._bindings;if(void 0!==n)return r[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,h=this.nCachedObjects_,l=new Array(c),n=r.length;i[t]=n,a.push(t),o.push(e),r.push(l);for(var u=h,d=s.length;u!==d;++u){var p=s[u];l[u]=new Qc(p,t,e)}return l},unsubscribe_:function(t){var e,i,n,r,a,o=this._bindingsIndicesByPath,s=o[t];void 0!==s&&(e=this._paths,i=this._parsedPaths,a=(n=this._bindings)[r=n.length-1],n[o[t[r]]=s]=a,n.pop(),i[s]=i[r],i.pop(),e[s]=e[r],e.pop())}}),Object.assign($c.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,i){var n,r,a,o;return t.fadeOut(e),this.fadeIn(e),i&&(n=this._clip.duration,a=(r=t._clip.duration)/n,o=n/r,t.warp(1,a,e),this.warp(o,1,e)),this},crossFadeTo:function(t,e,i){return t.crossFadeFrom(this,e,i)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,i){var n=this._mixer,r=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+i,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,i,n){if(this.enabled){var r=this._startTime;if(null!==r){var a=(t-r)*i;if(a<0||0===i)return;this._startTime=null,e=i*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(0<s)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(o),h[l].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e,i,n=0;return this.enabled&&(n=this.weight,null!==(e=this._weightInterpolant)&&(n*=i=e.evaluate(t)[0],t>e.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1)))),this._effectiveWeight=n},_updateTimeScale:function(t){var e,i=0;return this.paused||(i=this.timeScale,null!==(e=this._timeScaleInterpolant)&&(i*=e.evaluate(t)[0],t>e.parameterPositions[1]&&(this.stopWarping(),0===i?this.paused=!0:this.timeScale=i))),this._effectiveTimeScale=i},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var i=this._clip.duration,n=this.loop,r=this._loopCount;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i<=e)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var a,o,s,c=2202===n;if(-1===r&&(0<=t?(r=0,this._setEndings(!0,0===this.repetitions,c)):this._setEndings(0===this.repetitions,!0,c)),(i<=e||e<0)&&(e-=i*(a=Math.floor(e/i)),r+=Math.abs(a),(o=this.repetitions-r)<0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0<t?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<t?1:-1})):(0==o?(s=t<0,this._setEndings(s,!s,c)):this._setEndings(!1,!1,c),this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a}))),c&&1==(1&r))return i-(this.time=e)}return this.time=e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=p,n.endingEnd=p):(n.endingStart=t?this.zeroSlopeAtStart?p:d:f,n.endingEnd=e?this.zeroSlopeAtEnd?p:d:f)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}),Object.assign(th.prototype,e.prototype,{_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==r;++l){var u=n[l],d=u.name;if(void 0!==(p=h[d]))a[l]=p;else{if(void 0!==(p=a[l])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var p,f=e&&e._propertyBindings[l].binding.parsedPath;++(p=new Zc(Qc.create(i,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[l]=p}o[l].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){var e,i,n;null===t._cacheIndex&&(e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i],this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e));for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,i){var n,r=this._actions,a=this._actionsByClip,o=a[e];void 0===o?(o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,a[e]=o):(n=o.knownActions,t._byClipCacheIndex=n.length,n.push(t)),t._cacheIndex=r.length,r.push(t),o.actionByRoot[i]=t},_removeInactiveAction:function(t){var e=this._actions,i=e[e.length-1],n=t._cacheIndex;e[i._cacheIndex=n]=i,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],h=t._byClipCacheIndex;s[c._byClipCacheIndex=h]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_takeBackAction:function(t){var e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_addInactiveBinding:function(t,e,i){var n=this._bindingsByRootAndName,r=n[e],a=this._bindings;void 0===r&&(r={},n[e]=r),(r[i]=t)._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,o=a[n],s=e[e.length-1],c=t._cacheIndex;e[s._cacheIndex=c]=s,e.pop(),delete o[r];t:{for(var h in o)break t;delete a[n]}},_lendBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_takeBackBinding:function(t){var e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];e[t._cacheIndex=n]=t,e[r._cacheIndex=i]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&(t[(i=new hs(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e]=i),i},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];e[t.__cacheIndex=n]=t,e[r.__cacheIndex=i]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?_s.findByName(i,t):t,a=null!==r?r.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var h=new $c(this,r,e);return this._bindAction(h,s),this._addInactiveAction(h,a,n),h},existingAction:function(t,e){var i=e||this._root,n=i.uuid,r="string"==typeof t?_s.findByName(i,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,i=this._bindings,n=this._nActiveBindings;this._nActiveActions=0;for(var r=this._nActiveBindings=0;r!==e;++r)t[r].reset();for(r=0;r!==n;++r)i[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==i;++o){e[o]._update(n,t,r,a)}for(var s=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var h=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,e[l._cacheIndex=h]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}},uncacheRoot:function(t){var e,i=t.uuid,n=this._actionsByClip;for(e in n){var r=n[e].actionByRoot[i];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[i];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}),eh.prototype.clone=function(){return new eh(void 0===this.value.clone?this.value:this.value.clone())},ih.prototype=Object.assign(Object.create(_r.prototype),{constructor:ih,isInstancedBufferGeometry:!0,addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:i})},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var i,n=t.attributes;for(i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var a=t.groups,o=0,s=a.length;o<s;o++){var c=a[o];this.addGroup(c.start,c.count,c.materialIndex)}return this}}),Object.defineProperties(nh.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(nh.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this},setXYZ:function(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this},setXYZW:function(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}}),Object.defineProperty(rh.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(rh.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,i){t*=this.stride,i*=e.stride;for(var n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),ah.prototype=Object.assign(Object.create(rh.prototype),{constructor:ah,isInstancedInterleavedBuffer:!0,copy:function(t){return rh.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),oh.prototype=Object.assign(Object.create(cr.prototype),{constructor:oh,isInstancedBufferAttribute:!0,copy:function(t){return cr.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(sh.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var i=[];return hh(t,this,i,e),i.sort(ch),i},intersectObjects:function(t,e){var i=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var n=0,r=t.length;n<r;n++)hh(t[n],this,i,e);return i.sort(ch),i}}),Object.assign(lh.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t,e=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(e=((t=("undefined"==typeof performance?Date:performance).now())-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e),e)}}),Object.assign(uh.prototype,{set:function(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos($t.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(dh.prototype,{set:function(t,e,i){return this.radius=t,this.theta=e,this.y=i,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),((ph.prototype=Object.create(Lr.prototype)).constructor=ph).prototype.createAnimation=function(t,e,i,n){var r={start:e,end:i,length:i-e+1,fps:n,duration:(i-e)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},ph.prototype.autoCreateAnimations=function(t){for(var e,i=/([a-z]+)_?(\d+)/i,n={},r=this.geometry,a=0,o=r.morphTargets.length;a<o;a++){var s,c=r.morphTargets[a].name.match(i);c&&1<c.length&&(n[s=c[1]]||(n[s]={start:1/0,end:-1/0}),a<(h=n[s]).start&&(h.start=a),a>h.end&&(h.end=a),e=e||s)}for(s in n){var h=n[s];this.createAnimation(s,h.start,h.end,t)}this.firstAnimation=e},ph.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},ph.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},ph.prototype.setAnimationFPS=function(t,e){var i=this.animationsMap[t];i&&(i.fps=e,i.duration=(i.end-i.start)/i.fps)},ph.prototype.setAnimationDuration=function(t,e){var i=this.animationsMap[t];i&&(i.duration=e,i.fps=(i.end-i.start)/i.duration)},ph.prototype.setAnimationWeight=function(t,e){var i=this.animationsMap[t];i&&(i.weight=e)},ph.prototype.setAnimationTime=function(t,e){var i=this.animationsMap[t];i&&(i.time=e)},ph.prototype.getAnimationTime=function(t){var e=0,i=this.animationsMap[t];return i&&(e=i.time),e},ph.prototype.getAnimationDuration=function(t){var e=-1,i=this.animationsMap[t];return i&&(e=i.duration),e},ph.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},ph.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},ph.prototype.update=function(t){for(var e=0,i=this.animationsList.length;e<i;e++){var n,r,a,o,s=this.animationsList[e];s.active&&(n=s.duration/s.length,s.time+=s.direction*t,s.mirroredLoop?(s.time>s.duration||s.time<0)&&(s.direction*=-1,s.time>s.duration&&(s.time=s.duration,s.directionBackwards=!0),s.time<0&&(s.time=0,s.directionBackwards=!1)):(s.time=s.time%s.duration,s.time<0&&(s.time+=s.duration)),r=s.start+$t.clamp(Math.floor(s.time/n),0,s.length-1),a=s.weight,r!==s.currentFrame&&(this.morphTargetInfluences[s.lastFrame]=0,this.morphTargetInfluences[s.currentFrame]=+a,this.morphTargetInfluences[r]=0,s.lastFrame=s.currentFrame,s.currentFrame=r),o=s.time%n/n,s.directionBackwards&&(o=1-o),s.currentFrame!==s.lastFrame?(this.morphTargetInfluences[s.currentFrame]=o*a,this.morphTargetInfluences[s.lastFrame]=(1-o)*a):this.morphTargetInfluences[s.currentFrame]=a)}},((fh.prototype=Object.create(tn.prototype)).constructor=fh).prototype.isImmediateRenderObject=!0,((mh.prototype=Object.create(Na.prototype)).constructor=mh).prototype.update=(mc=new re,gc=new re,vc=new Li,function(){var t=["a","b","c"];this.object.updateMatrixWorld(!0),vc.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,i=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var r=n.vertices,a=n.faces,o=0,s=0,c=a.length;s<c;s++)for(var h=a[s],l=0,u=h.vertexNormals.length;l<u;l++){var d=r[h[t[l]]],p=h.vertexNormals[l];mc.copy(d).applyMatrix4(e),gc.copy(p).applyMatrix3(vc).normalize().multiplyScalar(this.size).add(mc),i.setXYZ(o,mc.x,mc.y,mc.z),o+=1,i.setXYZ(o,gc.x,gc.y,gc.z),o+=1}else if(n&&n.isBufferGeometry)for(var f=n.attributes.position,m=n.attributes.normal,o=0,l=0,u=f.count;l<u;l++)mc.set(f.getX(l),f.getY(l),f.getZ(l)).applyMatrix4(e),gc.set(m.getX(l),m.getY(l),m.getZ(l)),gc.applyMatrix3(vc).normalize().multiplyScalar(this.size).add(mc),i.setXYZ(o,mc.x,mc.y,mc.z),o+=1,i.setXYZ(o,gc.x,gc.y,gc.z),o+=1;i.needsUpdate=!0}),((gh.prototype=Object.create(tn.prototype)).constructor=gh).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},gh.prototype.update=(yc=new re,xc=new re,function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),yc.setFromMatrixPosition(this.light.matrixWorld),xc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(xc.sub(yc)),this.cone.material.color.copy(this.light.color)}),((vh.prototype=Object.create(Na.prototype)).constructor=vh).prototype.onBeforeRender=(_c=new re,bc=new ae,wc=new ae,function(){var t=this.bones,e=this.geometry,i=e.getAttribute("position");wc.getInverse(this.root.matrixWorld);for(var n=0,r=0;n<t.length;n++){var a=t[n];a.parent&&a.parent.isBone&&(bc.multiplyMatrices(wc,a.matrixWorld),_c.setFromMatrixPosition(bc),i.setXYZ(r,_c.x,_c.y,_c.z),bc.multiplyMatrices(wc,a.parent.matrixWorld),_c.setFromMatrixPosition(bc),i.setXYZ(r+1,_c.x,_c.y,_c.z),r+=2)}e.getAttribute("position").needsUpdate=!0}),((yh.prototype=Object.create(Lr.prototype)).constructor=yh).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},yh.prototype.update=function(){this.material.color.copy(this.light.color)},((xh.prototype=Object.create(tn.prototype)).constructor=xh).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},xh.prototype.update=function(){var t=this.children[0];t.material.color.copy(this.light.color);var e=.5*this.light.width,i=.5*this.light.height,n=t.geometry.attributes.position,r=n.array;r[0]=e,r[1]=-i,r[2]=0,r[3]=e,r[4]=i,r[5]=0,r[6]=-e,r[7]=i,r[8]=0,r[9]=-e,r[10]=-i,r[11]=0,r[12]=e,r[13]=-i,r[14]=0,n.needsUpdate=!0},((_h.prototype=Object.create(tn.prototype)).constructor=_h).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},_h.prototype.update=(Mc=new re,Ec=new qe,Tc=new qe,function(){var t=this.children[0],e=t.geometry.getAttribute("color");Ec.copy(this.light.color),Tc.copy(this.light.groundColor);for(var i=0,n=e.count;i<n;i++){var r=i<n/2?Ec:Tc;e.setXYZ(i,r.r,r.g,r.b)}t.lookAt(Mc.setFromMatrixPosition(this.light.matrixWorld).negate()),e.needsUpdate=!0}),(bh.prototype=Object.create(Na.prototype)).constructor=bh,(wh.prototype=Object.create(Na.prototype)).constructor=wh,((Mh.prototype=Object.create(Na.prototype)).constructor=Mh).prototype.update=(Sc=new re,Ac=new re,Rc=new Li,function(){this.object.updateMatrixWorld(!0),Rc.getNormalMatrix(this.object.matrixWorld);for(var t=this.object.matrixWorld,e=this.geometry.attributes.position,i=this.object.geometry,n=i.vertices,r=i.faces,a=0,o=0,s=r.length;o<s;o++){var c=r[o],h=c.normal;Sc.copy(n[c.a]).add(n[c.b]).add(n[c.c]).divideScalar(3).applyMatrix4(t),Ac.copy(h).applyMatrix3(Rc).normalize().multiplyScalar(this.size).add(Sc),e.setXYZ(a,Sc.x,Sc.y,Sc.z),a+=1,e.setXYZ(a,Ac.x,Ac.y,Ac.z),a+=1}e.needsUpdate=!0}),((Eh.prototype=Object.create(tn.prototype)).constructor=Eh).prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},Eh.prototype.update=(Lc=new re,Pc=new re,Cc=new re,function(){Lc.setFromMatrixPosition(this.light.matrixWorld),Pc.setFromMatrixPosition(this.light.target.matrixWorld),Cc.subVectors(Pc,Lc);var t=this.children[0],e=this.children[1];t.lookAt(Cc),t.material.color.copy(this.light.color),e.lookAt(Cc),e.scale.z=Cc.length()}),((Th.prototype=Object.create(Na.prototype)).constructor=Th).prototype.update=(Nc=new re,Oc=new en,function(){Ic=this.geometry,Uc=this.pointMap;Oc.projectionMatrix.copy(this.camera.projectionMatrix),Sh("c",0,0,-1),Sh("t",0,0,1),Sh("n1",-1,-1,-1),Sh("n2",1,-1,-1),Sh("n3",-1,1,-1),Sh("n4",1,1,-1),Sh("f1",-1,-1,1),Sh("f2",1,-1,1),Sh("f3",-1,1,1),Sh("f4",1,1,1),Sh("u1",.7,1.1,-1),Sh("u2",-.7,1.1,-1),Sh("u3",0,2,-1),Sh("cf1",-1,0,1),Sh("cf2",1,0,1),Sh("cf3",0,-1,1),Sh("cf4",0,1,1),Sh("cn1",-1,0,-1),Sh("cn2",1,0,-1),Sh("cn3",0,-1,-1),Sh("cn4",0,1,-1),Ic.getAttribute("position").needsUpdate=!0}),((Ah.prototype=Object.create(Na.prototype)).constructor=Ah).prototype.update=(Dc=new Ai,function(t){var e,i,n,r;void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Dc.setFromObject(this.object),Dc.isEmpty()||(e=Dc.min,i=Dc.max,(r=(n=this.geometry.attributes.position).array)[0]=i.x,r[1]=i.y,r[2]=i.z,r[3]=e.x,r[4]=i.y,r[5]=i.z,r[6]=e.x,r[7]=e.y,r[8]=i.z,r[9]=i.x,r[10]=e.y,r[11]=i.z,r[12]=i.x,r[13]=i.y,r[14]=e.z,r[15]=e.x,r[16]=i.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=i.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere())}),Ah.prototype.setFromObject=function(t){return this.object=t,this.update(),this},((Rh.prototype=Object.create(tn.prototype)).constructor=Rh).prototype.setDirection=(Gc=new re,function(t){.99999<t.y?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(Gc.set(t.z,0,-t.x).normalize(),zc=Math.acos(t.y),this.quaternion.setFromAxisAngle(Gc,zc))}),Rh.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},Rh.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},(Lh.prototype=Object.create(Na.prototype)).constructor=Lh;var Ch=new re,Ih=new Ph,Uh=new Ph,Nh=new Ph;function Oh(t){Bs.call(this),t.length<2&&console.warn("THREE.CatmullRomCurve3: Points array needs at least two entries."),this.points=t||[],this.closed=!1}function Dh(t,e,i,n){Bs.call(this),this.v0=t,this.v1=e,this.v2=i,this.v3=n}function Fh(t,e,i){Bs.call(this),this.v0=t,this.v1=e,this.v2=i}function Bh(t,e){Bs.call(this),this.v1=t,this.v2=e}function zh(t,e,i,n,r,a){Hs.call(this,t,e,i,i,n,r,a)}((Oh.prototype=Object.create(Bs.prototype)).constructor=Oh).prototype.getPoint=function(t){var e,i,n,r,a,o,s,c,h,l=this.points,u=l.length,d=(u-(this.closed?0:1))*t,p=Math.floor(d),f=d-p;return this.closed?p+=0<p?0:(Math.floor(Math.abs(p)/l.length)+1)*l.length:0===f&&p===u-1&&(p=u-2,f=1),e=this.closed||0<p?l[(p-1)%u]:(Ch.subVectors(l[0],l[1]).add(l[0]),Ch),i=l[p%u],n=l[(p+1)%u],r=this.closed||p+2<u?l[(p+2)%u]:(Ch.subVectors(l[u-1],l[u-2]).add(l[u-1]),Ch),void 0===this.type||"centripetal"===this.type||"chordal"===this.type?(a="chordal"===this.type?.5:.25,o=Math.pow(e.distanceToSquared(i),a),(s=Math.pow(i.distanceToSquared(n),a))<1e-4&&(s=1),o<1e-4&&(o=s),(c=Math.pow(n.distanceToSquared(r),a))<1e-4&&(c=s),Ih.initNonuniformCatmullRom(e.x,i.x,n.x,r.x,o,s,c),Uh.initNonuniformCatmullRom(e.y,i.y,n.y,r.y,o,s,c),Nh.initNonuniformCatmullRom(e.z,i.z,n.z,r.z,o,s,c)):"catmullrom"===this.type&&(h=void 0!==this.tension?this.tension:.5,Ih.initCatmullRom(e.x,i.x,n.x,r.x,h),Uh.initCatmullRom(e.y,i.y,n.y,r.y,h),Nh.initCatmullRom(e.z,i.z,n.z,r.z,h)),new re(Ih.calc(f),Uh.calc(f),Nh.calc(f))},((Dh.prototype=Object.create(Bs.prototype)).constructor=Dh).prototype.getPoint=function(t){var e=this.v0,i=this.v1,n=this.v2,r=this.v3;return new re(Fs(t,e.x,i.x,n.x,r.x),Fs(t,e.y,i.y,n.y,r.y),Fs(t,e.z,i.z,n.z,r.z))},((Fh.prototype=Object.create(Bs.prototype)).constructor=Fh).prototype.getPoint=function(t){var e=this.v0,i=this.v1,n=this.v2;return new re(Ds(t,e.x,i.x,n.x),Ds(t,e.y,i.y,n.y),Ds(t,e.z,i.z,n.z))},((Bh.prototype=Object.create(Bs.prototype)).constructor=Bh).prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new re;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},(zh.prototype=Object.create(Hs.prototype)).constructor=zh;var Gh={createMultiMaterialObject:function(t,e){for(var i=new Ba,n=0,r=e.length;n<r;n++)i.add(new Lr(t,e[n]));return i},detach:function(t,e,i){t.applyMatrix(e.matrixWorld),e.remove(t),i.add(t)},attach:function(t,e,i){t.applyMatrix((new ae).getInverse(i.matrixWorld)),e.remove(t),i.add(t)}};var Hh;function Vh(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Oh.call(this,t),this.type="catmullrom",this.closed=!0}function kh(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Oh.call(this,t),this.type="catmullrom"}function jh(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Oh.call(this,t),this.type="catmullrom"}Bs.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Bs.prototype),(t.prototype.constructor=t).prototype.getPoint=e,t},Vh.prototype=Object.create(Oh.prototype),kh.prototype=Object.create(Oh.prototype),jh.prototype=Object.create(Oh.prototype),Object.assign(jh.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),bh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},vh.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(ei.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(Ai.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),Ar.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},$t.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(Li.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(ae.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return void 0===Hh&&(Hh=new re),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),Hh.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)}}),Pi.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},ne.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Sr.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(Ys.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ho(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new _o(this,t)}}),Object.assign(_t.prototype,{fromAttribute:function(t,e,i){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)}}),Object.assign(re.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,i){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)}}),Object.assign(te.prototype,{fromAttribute:function(t,e,i){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)}}),sr.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(tn.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(tn.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Ra.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(La.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Bs.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),rn.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Zo.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(cr.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(_r.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(_r.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(eh.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Ei.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new qe}}}),Object.defineProperties(No.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Ti.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(ba.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(ba.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(Ii.prototype,{cullFace:{get:function(){return this.renderReverseSided?j:k},set:function(t){var e=t!==k;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(ee.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Xc.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Vc).load(t,function(t){e.setBuffer(t)}),this},Yc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var Wh={merge:function(t,e,i){var n;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),n=e.matrix,e=e.geometry),t.merge(e,n,i)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},Xh={crossOrigin:void 0,loadTexture:function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Yo;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},loadTextureCube:function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new qo;r.setCrossOrigin(this.crossOrigin);var a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}};t.WebGLRenderTargetCube=ie,t.WebGLRenderTarget=ee,t.WebGLRenderer=ba,t.ShaderLib=ti,t.UniformsLib=Qe,t.UniformsUtils=Ke,t.ShaderChunk=$e,t.FogExp2=wa,t.Fog=Ma,t.Scene=Ea,t.LensFlare=Ta,t.Sprite=Aa,t.LOD=Ra,t.SkinnedMesh=Ca,t.Skeleton=La,t.Bone=Pa,t.Mesh=Lr,t.LineSegments=Na,t.LineLoop=Oa,t.Line=Ua,t.Points=Fa,t.Group=Ba,t.VideoTexture=za,t.DataTexture=oe,t.CompressedTexture=Ga,t.CubeTexture=se,t.CanvasTexture=Ha,t.DepthTexture=Va,t.Texture=At,t.CompressedTextureLoader=jo,t.DataTextureLoader=Wo,t.CubeTextureLoader=qo,t.TextureLoader=Yo,t.ObjectLoader=Cs,t.MaterialLoader=bs,t.BufferGeometryLoader=ws,t.DefaultLoadingManager=Vo,t.LoadingManager=Ho,t.JSONLoader=Ps,t.ImageLoader=Xo,t.FontLoader=Qs,t.FileLoader=ko,t.Loader=Ls,t.Cache=Go,t.AudioLoader=Vc,t.SpotLightShadow=Ko,t.SpotLight=$o,t.PointLight=ts,t.RectAreaLight=rs,t.HemisphereLight=Jo,t.DirectionalLightShadow=es,t.DirectionalLight=is,t.AmbientLight=ns,t.LightShadow=Qo,t.Light=Zo,t.StereoCamera=kc,t.PerspectiveCamera=rn,t.OrthographicCamera=nn,t.CubeCamera=jc,t.ArrayCamera=va,t.Camera=en,t.AudioListener=Wc,t.PositionalAudio=qc,t.AudioContext=Hc,t.AudioAnalyser=Yc,t.Audio=Xc,t.VectorKeyframeTrack=ds,t.StringKeyframeTrack=gs,t.QuaternionKeyframeTrack=fs,t.NumberKeyframeTrack=ms,t.ColorKeyframeTrack=ys,t.BooleanKeyframeTrack=vs,t.PropertyMixer=Zc,t.PropertyBinding=Qc,t.KeyframeTrack=xs,t.AnimationUtils=os,t.AnimationObjectGroup=Kc,t.AnimationMixer=th,t.AnimationClip=_s,t.Uniform=eh,t.InstancedBufferGeometry=ih,t.BufferGeometry=_r,t.GeometryIdCount=or,t.Geometry=sr,t.InterleavedBufferAttribute=nh,t.InstancedInterleavedBuffer=ah,t.InterleavedBuffer=rh,t.InstancedBufferAttribute=oh,t.Face3=an,t.Object3D=tn,t.Raycaster=sh,t.Layers=Oi,t.EventDispatcher=e,t.Clock=lh,t.QuaternionLinearInterpolant=ps,t.LinearInterpolant=hs,t.DiscreteInterpolant=ls,t.CubicInterpolant=cs,t.Interpolant=ss,t.Triangle=Rr,t.Math=$t,t.Spherical=uh,t.Cylindrical=dh,t.Plane=Pi,t.Frustum=Ci,t.Sphere=Ri,t.Ray=Sr,t.Matrix4=ae,t.Matrix3=Li,t.Box3=Ai,t.Box2=ei,t.Line3=Ar,t.Euler=Ni,t.Vector4=te,t.Vector3=re,t.Vector2=_t,t.Quaternion=ne,t.Color=qe,t.MorphBlendMesh=ph,t.ImmediateRenderObject=fh,t.VertexNormalsHelper=mh,t.SpotLightHelper=gh,t.SkeletonHelper=vh,t.PointLightHelper=yh,t.RectAreaLightHelper=xh,t.HemisphereLightHelper=_h,t.GridHelper=bh,t.PolarGridHelper=wh,t.FaceNormalsHelper=Mh,t.DirectionalLightHelper=Eh,t.CameraHelper=Th,t.BoxHelper=Ah,t.ArrowHelper=Rh,t.AxisHelper=Lh,t.CatmullRomCurve3=Oh,t.CubicBezierCurve3=Dh,t.QuadraticBezierCurve3=Fh,t.LineCurve3=Bh,t.ArcCurve=zh,t.EllipseCurve=Hs,t.SplineCurve=Vs,t.CubicBezierCurve=ks,t.QuadraticBezierCurve=js,t.LineCurve=zs,t.Shape=Ys,t.Path=qs,t.ShapePath=Zs,t.Font=Js,t.CurvePath=Gs,t.Curve=Bs,t.ShapeUtils=co,t.SceneUtils=Gh,t.WireframeGeometry=ka,t.ParametricGeometry=ja,t.ParametricBufferGeometry=Wa,t.TetrahedronGeometry=Ya,t.TetrahedronBufferGeometry=Za,t.OctahedronGeometry=Ja,t.OctahedronBufferGeometry=Qa,t.IcosahedronGeometry=Ka,t.IcosahedronBufferGeometry=$a,t.DodecahedronGeometry=to,t.DodecahedronBufferGeometry=eo,t.PolyhedronGeometry=Xa,t.PolyhedronBufferGeometry=qa,t.TubeGeometry=io,t.TubeBufferGeometry=no,t.TorusKnotGeometry=ro,t.TorusKnotBufferGeometry=ao,t.TorusGeometry=oo,t.TorusBufferGeometry=so,t.TextGeometry=uo,t.TextBufferGeometry=po,t.SphereGeometry=fo,t.SphereBufferGeometry=mo,t.RingGeometry=go,t.RingBufferGeometry=vo,t.PlaneGeometry=Mr,t.PlaneBufferGeometry=Er,t.LatheGeometry=yo,t.LatheBufferGeometry=xo,t.ShapeGeometry=_o,t.ShapeBufferGeometry=bo,t.ExtrudeGeometry=ho,t.ExtrudeBufferGeometry=lo,t.EdgesGeometry=wo,t.ConeGeometry=To,t.ConeBufferGeometry=So,t.CylinderGeometry=Mo,t.CylinderBufferGeometry=Eo,t.CircleGeometry=Ao,t.CircleBufferGeometry=Ro,t.BoxGeometry=br,t.BoxBufferGeometry=wr,t.ShadowMaterial=Po,t.SpriteMaterial=Sa,t.RawShaderMaterial=Co,t.ShaderMaterial=Ti,t.PointsMaterial=Da,t.MeshPhysicalMaterial=Uo,t.MeshStandardMaterial=Io,t.MeshPhongMaterial=No,t.MeshToonMaterial=Oo,t.MeshNormalMaterial=Do,t.MeshLambertMaterial=Fo,t.MeshDepthMaterial=Si,t.MeshBasicMaterial=Tr,t.LineDashedMaterial=Bo,t.LineBasicMaterial=Ia,t.Material=Ei,t.Float64BufferAttribute=vr,t.Float32BufferAttribute=gr,t.Uint32BufferAttribute=mr,t.Int32BufferAttribute=fr,t.Uint16BufferAttribute=pr,t.Int16BufferAttribute=dr,t.Uint8ClampedBufferAttribute=ur,t.Uint8BufferAttribute=lr,t.Int8BufferAttribute=hr,t.BufferAttribute=cr,t.REVISION="86",t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},t.CullFaceNone=V,t.CullFaceBack=k,t.CullFaceFront=j,t.CullFaceFrontBack=3,t.FrontFaceDirectionCW=0,t.FrontFaceDirectionCCW=1,t.BasicShadowMap=0,t.PCFShadowMap=F,t.PCFSoftShadowMap=B,t.FrontSide=z,t.BackSide=W,t.DoubleSide=X,t.FlatShading=Rt,t.SmoothShading=c,t.NoColors=Lt,t.FaceColors=1,t.VertexColors=2,t.NoBlending=q,t.NormalBlending=Y,t.AdditiveBlending=Z,t.SubtractiveBlending=J,t.MultiplyBlending=Q,t.CustomBlending=K,t.AddEquation=Pt,t.SubtractEquation=101,t.ReverseSubtractEquation=102,t.MinEquation=103,t.MaxEquation=104,t.ZeroFactor=200,t.OneFactor=201,t.SrcColorFactor=202,t.OneMinusSrcColorFactor=203,t.SrcAlphaFactor=Ct,t.OneMinusSrcAlphaFactor=It,t.DstAlphaFactor=206,t.OneMinusDstAlphaFactor=207,t.DstColorFactor=208,t.OneMinusDstColorFactor=209,t.SrcAlphaSaturateFactor=210,t.NeverDepth=$,t.AlwaysDepth=tt,t.LessDepth=et,t.LessEqualDepth=it,t.EqualDepth=nt,t.GreaterEqualDepth=rt,t.GreaterDepth=at,t.NotEqualDepth=ot,t.MultiplyOperation=G,t.MixOperation=H,t.AddOperation=st,t.NoToneMapping=ct,t.LinearToneMapping=Ut,t.ReinhardToneMapping=ht,t.Uncharted2ToneMapping=lt,t.CineonToneMapping=ut,t.UVMapping=300,t.CubeReflectionMapping=dt,t.CubeRefractionMapping=pt,t.EquirectangularReflectionMapping=ft,t.EquirectangularRefractionMapping=mt,t.SphericalReflectionMapping=gt,t.CubeUVReflectionMapping=vt,t.CubeUVRefractionMapping=yt,t.RepeatWrapping=Nt,t.ClampToEdgeWrapping=Ot,t.MirroredRepeatWrapping=Dt,t.NearestFilter=Ft,t.NearestMipMapNearestFilter=Bt,t.NearestMipMapLinearFilter=zt,t.LinearFilter=Gt,t.LinearMipMapNearestFilter=1007,t.LinearMipMapLinearFilter=Ht,t.UnsignedByteType=Vt,t.ByteType=1010,t.ShortType=1011,t.UnsignedShortType=kt,t.IntType=1013,t.UnsignedIntType=jt,t.FloatType=Wt,t.HalfFloatType=Xt,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedInt248Type=qt,t.AlphaFormat=1021,t.RGBFormat=Yt,t.RGBAFormat=Zt,t.LuminanceFormat=1024,t.LuminanceAlphaFormat=1025,t.RGBEFormat=h,t.DepthFormat=Jt,t.DepthStencilFormat=Qt,t.RGB_S3TC_DXT1_Format=2001,t.RGBA_S3TC_DXT1_Format=2002,t.RGBA_S3TC_DXT3_Format=2003,t.RGBA_S3TC_DXT5_Format=2004,t.RGB_PVRTC_4BPPV1_Format=2100,t.RGB_PVRTC_2BPPV1_Format=2101,t.RGBA_PVRTC_4BPPV1_Format=2102,t.RGBA_PVRTC_2BPPV1_Format=2103,t.RGB_ETC1_Format=2151,t.LoopOnce=2200,t.LoopRepeat=2201,t.LoopPingPong=2202,t.InterpolateDiscrete=l,t.InterpolateLinear=u,t.InterpolateSmooth=2302,t.ZeroCurvatureEnding=d,t.ZeroSlopeEnding=p,t.WrapAroundEnding=f,t.TrianglesDrawMode=Kt,t.TriangleStripDrawMode=1,t.TriangleFanDrawMode=2,t.LinearEncoding=m,t.sRGBEncoding=g,t.GammaEncoding=v,t.RGBEEncoding=y,t.LogLuvEncoding=3003,t.RGBM7Encoding=x,t.RGBM16Encoding=_,t.RGBDEncoding=b,t.BasicDepthPacking=w,t.RGBADepthPacking=xt,t.CubeGeometry=br,t.Face4=function(t,e,i,n,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new an(t,e,i,r,a,o)},t.LineStrip=0,t.LinePieces=1,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MultiMaterial=function(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,(t.materials=t).clone=function(){return t.slice()},t},t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Fa(t,e)},t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Aa(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Fa(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Da(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Da(t)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Da(t)},t.Vertex=function(t,e,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new re(t,e,i)},t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new cr(t,e).setDynamic(!0)},t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new hr(t,e)},t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new lr(t,e)},t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new ur(t,e)},t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new dr(t,e)},t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new pr(t,e)},t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new fr(t,e)},t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new mr(t,e)},t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new gr(t,e)},t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new vr(t,e)},t.ClosedSplineCurve3=Vh,t.SplineCurve3=kh,t.Spline=jh,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Ah(t,e)},t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Na(new wo(t.geometry),new Ia({color:void 0!==e?e:16777215}))},t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Na(new ka(t.geometry),new Ia({color:void 0!==e?e:16777215}))},t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ko(t)},t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Wo(t)},t.GeometryUtils=Wh,t.ImageUtils=Xh,t.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},Object.defineProperty(t,"__esModule",{value:!0})}); |