diff --git a/htdocs/mathbox-bundle.min.js b/htdocs/mathbox-bundle.min.js new file mode 100644 index 0000000..4f61f9f --- /dev/null +++ b/htdocs/mathbox-bundle.min.js @@ -0,0 +1,33 @@ +var THREE={REVISION:"71"};"object"==typeof module&&(module.exports=THREE),void 0===Math.sign&&(Math.sign=function(t){return 0>t?-1:t>0?1:+t}),THREE.log=function(){console.log.apply(console,arguments)},THREE.warn=function(){console.warn.apply(console,arguments)},THREE.error=function(){console.error.apply(console,arguments)},THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.NoShading=0,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=300,THREE.CubeReflectionMapping=301,THREE.CubeRefractionMapping=302,THREE.EquirectangularReflectionMapping=303,THREE.EquirectangularRefractionMapping=304,THREE.SphericalReflectionMapping=305,THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.HalfFloatType=1025,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGBEFormat=THREE.RGBAFormat,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){THREE.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(t,e){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},THREE.Color=function(t){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(t)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(t){return t instanceof THREE.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(t,e,n){if(0===e)this.r=this.g=this.b=n;else{var r=function(t,e,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?t+6*(e-t)*n:.5>n?e:2/3>n?t+6*(e-t)*(2/3-n):t},i=.5>=n?n*(1+e):n+e-n*e,o=2*n-i;this.r=r(o,i,t+1/3),this.g=r(o,i,t),this.b=r(o,i,t-1/3)}return this},setStyle:function(t){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(t)){var e=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(t);return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(t)){var e=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(t);return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(t)){var e=/^\#([0-9a-f]{6})$/i.exec(t);return this.setHex(parseInt(e[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(t)){var e=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);return this.setHex(parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3],16)),this}return/^(\w+)$/i.test(t)?(this.setHex(THREE.ColorKeywords[t]),this):void 0},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,s=this.b,a=Math.max(i,o,s),u=Math.min(i,o,s),h=(u+a)/2;if(u===a)e=0,n=0;else{var l=a-u;switch(n=.5>=h?l/(a+u):l/(2-a-u),a){case i:e=(o-s)/l+(s>o?6:0);break;case o:e=(s-i)/l+2;break;case s:e=(i-o)/l+4}e/=6}return r.h=e,r.s=n,r.l=h,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var r=this.getHSL();return r.h+=t,r.s+=e,r.l+=n,this.setHSL(r.h,r.s,r.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},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){return this.r=t[0],this.g=t[1],this.b=t[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},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}},THREE.ColorKeywords={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},THREE.Quaternion=function(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1},THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},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 instanceof THREE.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),r=Math.cos(t._y/2),i=Math.cos(t._z/2),o=Math.sin(t._x/2),s=Math.sin(t._y/2),a=Math.sin(t._z/2);return"XYZ"===t.order?(this._x=o*r*i+n*s*a,this._y=n*s*i-o*r*a,this._z=n*r*a+o*s*i,this._w=n*r*i-o*s*a):"YXZ"===t.order?(this._x=o*r*i+n*s*a,this._y=n*s*i-o*r*a,this._z=n*r*a-o*s*i,this._w=n*r*i+o*s*a):"ZXY"===t.order?(this._x=o*r*i-n*s*a,this._y=n*s*i+o*r*a,this._z=n*r*a+o*s*i,this._w=n*r*i-o*s*a):"ZYX"===t.order?(this._x=o*r*i-n*s*a,this._y=n*s*i+o*r*a,this._z=n*r*a-o*s*i,this._w=n*r*i+o*s*a):"YZX"===t.order?(this._x=o*r*i+n*s*a,this._y=n*s*i+o*r*a,this._z=n*r*a-o*s*i,this._w=n*r*i-o*s*a):"XZY"===t.order&&(this._x=o*r*i-n*s*a,this._y=n*s*i-o*r*a,this._z=n*r*a+o*s*i,this._w=n*r*i+o*s*a),e!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],s=n[1],a=n[5],u=n[9],h=n[2],l=n[6],c=n[10],p=r+a+c;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(l-u)*e,this._y=(o-h)*e,this._z=(s-i)*e):r>a&&r>c?(e=2*Math.sqrt(1+r-a-c),this._w=(l-u)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(o+h)/e):a>c?(e=2*Math.sqrt(1+a-r-c),this._w=(o-h)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(u+l)/e):(e=2*Math.sqrt(1+c-r-a),this._w=(s-i)/e,this._x=(o+h)/e,this._y=(u+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e,n=1e-6;return function(r,i){return void 0===t&&(t=new THREE.Vector3),e=r.dot(i)+1,n>e?(e=0,Math.abs(r.x)>Math.abs(r.z)?t.set(-r.y,r.x,0):t.set(0,-r.z,r.y)):t.crossVectors(r,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},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?(THREE.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,s=e._x,a=e._y,u=e._z,h=e._w;return this._x=n*h+o*s+r*u-i*a,this._y=r*h+o*a+i*s-n*u,this._z=i*h+o*u+n*a-r*s,this._w=o*h-n*s-r*a-i*u,this.onChangeCallback(),this},multiplyVector3:function(t){return THREE.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,s=o*t._w+n*t._x+r*t._y+i*t._z;if(0>s?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var a=Math.acos(s),u=Math.sqrt(1-s*s);if(Math.abs(u)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var h=Math.sin((1-e)*a)/u,l=Math.sin(e*a)/u;return this._w=o*h+this._w*l,this._x=n*h+this._x*l,this._y=r*h+this._y*l,this._z=i*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(){},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}},THREE.Quaternion.slerp=function(t,e,n,r){return n.copy(t).slerp(e,r)},THREE.Vector2=function(t,e){this.x=t||0,this.y=e||0},THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(t,e){return this.x=t,this.y=e,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)}},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)}},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(THREE.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},sub:function(t,e){return void 0!==e?(THREE.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){if(0!==t){var e=1/t;this.x*=e,this.y*=e}else this.x=0,this.y=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this},max:function(t){return this.xe.x&&(this.x=e.x),this.ye.y&&(this.y=e.y),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new THREE.Vector2,e=new THREE.Vector2),t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t),this},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},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this},clone:function(){return new THREE.Vector2(this.x,this.y)}},THREE.Vector3=function(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},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?(THREE.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},sub:function(t,e){return void 0!==e?(THREE.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?(THREE.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return e instanceof THREE.Euler==!1&&THREE.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new THREE.Quaternion),this.applyQuaternion(t.setFromEuler(e)),this}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new THREE.Quaternion),this.applyQuaternion(t.setFromAxisAngle(e,n)),this}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r+i[12],this.y=i[1]*e+i[5]*n+i[9]*r+i[13],this.z=i[2]*e+i[6]*n+i[10]*r+i[14],this},applyProjection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,s=t.z,a=t.w,u=a*e+o*r-s*n,h=a*n+s*e-i*r,l=a*r+i*n-o*e,c=-i*e-o*n-s*r;return this.x=u*a+c*-i+h*-s-l*-o,this.y=h*a+c*-o+l*-i-u*-s,this.z=l*a+c*-s+u*-o-h*-i,this},project:function(){var t;return function(e){return void 0===t&&(t=new THREE.Matrix4),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new THREE.Matrix4),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.xe.x&&(this.x=e.x),this.ye.y&&(this.y=e.y),this.ze.z&&(this.z=e.z),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new THREE.Vector3,e=new THREE.Vector3),t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t),this},cross:function(t,e){if(void 0!==e)return THREE.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this},projectOnVector:function(){var t,e;return function(n){return void 0===t&&(t=new THREE.Vector3),t.copy(n).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new THREE.Vector3),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new THREE.Vector3),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/(this.length()*t.length());return Math.acos(THREE.Math.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},setEulerFromRotationMatrix:function(t,e){THREE.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,e){THREE.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return THREE.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return THREE.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return THREE.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),n=this.set(t.elements[4],t.elements[5],t.elements[6]).length(),r=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){var n=4*t,r=e.elements;return this.x=r[n],this.y=r[n+1],this.z=r[n+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}},THREE.Vector4=function(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,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)}},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)}},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?(THREE.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},sub:function(t,e){return void 0!==e?(THREE.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e,this.w*=e}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return 1e-4>e?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=.01,s=.1,a=t.elements,u=a[0],h=a[4],l=a[8],c=a[1],p=a[5],f=a[9],d=a[2],m=a[6],v=a[10];if(Math.abs(h-c)E&&g>y?o>g?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(g),r=_/n,i=b/n):E>y?o>E?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(E),n=_/r,i=T/r):o>y?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(y),n=b/i,r=T/i),this.set(n,r,i,e),this}var x=Math.sqrt((m-f)*(m-f)+(l-d)*(l-d)+(c-h)*(c-h));return Math.abs(x)<.001&&(x=1),this.x=(m-f)/x,this.y=(l-d)/x,this.z=(c-h)/x,this.w=Math.acos((u+p+v-1)/2),this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this.w>t.w&&(this.w=t.w),this},max:function(t){return this.xe.x&&(this.x=e.x),this.ye.y&&(this.y=e.y),this.ze.z&&(this.z=e.z),this.we.w&&(this.w=e.w),this},clampScalar:function(){var t,e;return function(n,r){return void 0===t&&(t=new THREE.Vector4,e=new THREE.Vector4),t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t),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},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},fromAttribute:function(t,e,n){return void 0===n&&(n=0),e=e*t.itemSize+n,this.x=t.array[e],this.y=t.array[e+1],this.z=t.array[e+2],this.w=t.array[e+3],this; +},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}},THREE.Euler=function(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||THREE.Euler.DefaultOrder},THREE.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],THREE.Euler.DefaultOrder="XYZ",THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=THREE.Math.clamp,i=t.elements,o=i[0],s=i[4],a=i[8],u=i[1],h=i[5],l=i[9],c=i[2],p=i[6],f=i[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(a,f),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-c,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-c,f),this._z=Math.atan2(-s,h)):(this._y=0,this._z=Math.atan2(u,o))):"ZYX"===e?(this._y=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-s,h))):"YZX"===e?(this._z=Math.asin(r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-c,o)):(this._x=0,this._y=Math.atan2(a,f))):"XZY"===e?(this._z=Math.asin(-r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-l,f),this._y=0)):THREE.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,n,r){return void 0===t&&(t=new THREE.Matrix4),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,r),this}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new THREE.Quaternion;return function(e){t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}},THREE.Line3=function(t,e){this.start=void 0!==t?t:new THREE.Vector3,this.end=void 0!==e?e:new THREE.Vector3},THREE.Line3.prototype={constructor:THREE.Line3,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},center:function(t){var e=t||new THREE.Vector3;return e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var e=t||new THREE.Vector3;return e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var n=e||new THREE.Vector3;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new THREE.Vector3,e=new THREE.Vector3;return function(n,r){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var i=e.dot(e),o=e.dot(t),s=o/i;return r&&(s=THREE.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e),i=n||new THREE.Vector3;return this.delta(i).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}},THREE.Box2=function(t,e){this.min=void 0!==t?t:new THREE.Vector2(1/0,1/0),this.max=void 0!==e?e:new THREE.Vector2(-(1/0),-(1/0))},THREE.Box2.prototype={constructor:THREE.Box2,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;n>e;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new THREE.Vector2;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),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},empty:function(){return this.max.xthis.max.x||t.ythis.max.y?!1:!0},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?!0:!1},getParameter:function(t,e){var n=e||new THREE.Vector2;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(t){return t.max.xthis.max.x||t.max.ythis.max.y?!1:!0},clampPoint:function(t,e){var n=e||new THREE.Vector2;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new THREE.Vector2;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}},THREE.Box3=function(t,e){this.min=void 0!==t?t:new THREE.Vector3(1/0,1/0,1/0),this.max=void 0!==e?e:new THREE.Vector3(-(1/0),-(1/0),-(1/0))},THREE.Box3.prototype={constructor:THREE.Box3,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;n>e;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new THREE.Vector3;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),setFromObject:function(){var t=new THREE.Vector3;return function(e){var n=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var r=e.geometry;if(void 0!==r)if(r instanceof THREE.Geometry)for(var i=r.vertices,o=0,s=i.length;s>o;o++)t.copy(i[o]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t);else if(r instanceof THREE.BufferGeometry&&void 0!==r.attributes.position)for(var a=r.attributes.position.array,o=0,s=a.length;s>o;o+=3)t.set(a[o],a[o+1],a[o+2]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}),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},empty:function(){return this.max.xthis.max.x||t.ythis.max.y||t.zthis.max.z?!1:!0},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?!0:!1},getParameter:function(t,e){var n=e||new THREE.Vector3;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(t){return t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z?!1:!0},clampPoint:function(t,e){var n=e||new THREE.Vector3;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new THREE.Vector3;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),getBoundingSphere:function(){var t=new THREE.Vector3;return function(e){var n=e||new THREE.Sphere;return n.center=this.center(),n.radius=.5*this.size(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(e){return t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.makeEmpty(),this.setFromPoints(t),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}},THREE.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&THREE.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(t,e,n,r,i,o,s,a,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=n,h[1]=r,h[4]=i,h[7]=o,h[2]=s,h[5]=a,h[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},multiplyVector3:function(t){return THREE.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return THREE.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var t=new THREE.Vector3;return function(e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.length);for(var i=0,o=n;r>i;i+=3,o+=3)t.x=e[o],t.y=e[o+1],t.z=e[o+2],t.applyMatrix3(this),e[o]=t.x,e[o+1]=t.y,e[o+2]=t.z;return e}}(),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],n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],a=t[6],u=t[7],h=t[8];return e*o*h-e*s*u-n*i*h+n*s*a+r*i*u-r*o*a},getInverse:function(t,e){var n=t.elements,r=this.elements;r[0]=n[10]*n[5]-n[6]*n[9],r[1]=-n[10]*n[1]+n[2]*n[9],r[2]=n[6]*n[1]-n[2]*n[5],r[3]=-n[10]*n[4]+n[6]*n[8],r[4]=n[10]*n[0]-n[2]*n[8],r[5]=-n[6]*n[0]+n[2]*n[4],r[6]=n[9]*n[4]-n[5]*n[8],r[7]=-n[9]*n[0]+n[1]*n[8],r[8]=n[5]*n[0]-n[1]*n[4];var i=n[0]*r[0]+n[1]*r[3]+n[2]*r[6];if(0===i){var o="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(o);return THREE.warn(o),this.identity(),this}return this.multiplyScalar(1/i),this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},flattenToArrayOffset:function(t,e){var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t},getNormalMatrix:function(t){return this.getInverse(t).transpose(),this},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},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]},clone:function(){return(new THREE.Matrix3).fromArray(this.elements)}},THREE.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&THREE.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=s,v[13]=a,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=p,v[7]=f,v[11]=d,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(t){return this.elements.set(t.elements),this},extractPosition:function(t){return THREE.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),n.set(r[8],r[9],r[10]),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new THREE.Vector3;return function(e){var n=this.elements,r=e.elements,i=1/t.set(r[0],r[1],r[2]).length(),o=1/t.set(r[4],r[5],r[6]).length(),s=1/t.set(r[8],r[9],r[10]).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,this}}(),makeRotationFromEuler:function(t){t instanceof THREE.Euler==!1&&THREE.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(r),u=Math.sin(r),h=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var c=o*h,p=o*l,f=s*h,d=s*l;e[0]=a*h,e[4]=-a*l,e[8]=u,e[1]=p+f*u,e[5]=c-d*u,e[9]=-s*a,e[2]=d-c*u,e[6]=f+p*u,e[10]=o*a}else if("YXZ"===t.order){var m=a*h,v=a*l,g=u*h,E=u*l;e[0]=m+E*s,e[4]=g*s-v,e[8]=o*u,e[1]=o*l,e[5]=o*h,e[9]=-s,e[2]=v*s-g,e[6]=E+m*s,e[10]=o*a}else if("ZXY"===t.order){var m=a*h,v=a*l,g=u*h,E=u*l;e[0]=m-E*s,e[4]=-o*l,e[8]=g+v*s,e[1]=v+g*s,e[5]=o*h,e[9]=E-m*s,e[2]=-o*u,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){var c=o*h,p=o*l,f=s*h,d=s*l;e[0]=a*h,e[4]=f*u-p,e[8]=c*u+d,e[1]=a*l,e[5]=d*u+c,e[9]=p*u-f,e[2]=-u,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){var y=o*a,_=o*u,b=s*a,T=s*u;e[0]=a*h,e[4]=T-y*l,e[8]=b*l+_,e[1]=l,e[5]=o*h,e[9]=-s*h,e[2]=-u*h,e[6]=_*l+b,e[10]=y-T*l}else if("XZY"===t.order){var y=o*a,_=o*u,b=s*a,T=s*u;e[0]=a*h,e[4]=-l,e[8]=u*h,e[1]=y*l+T,e[5]=o*h,e[9]=_*l-b,e[2]=b*l-_,e[6]=s*h,e[10]=T*l+y}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},setRotationFromQuaternion:function(t){return THREE.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z,o=t.w,s=n+n,a=r+r,u=i+i,h=n*s,l=n*a,c=n*u,p=r*a,f=r*u,d=i*u,m=o*s,v=o*a,g=o*u;return e[0]=1-(p+d),e[4]=l-g,e[8]=c+v,e[1]=l+g,e[5]=1-(h+d),e[9]=f-m,e[2]=c-v,e[6]=f+m,e[10]=1-(h+p),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(r,i,o){var s=this.elements;return n.subVectors(r,i).normalize(),0===n.length()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.length()&&(n.x+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),s[0]=t.x,s[4]=e.x,s[8]=n.x,s[1]=t.y,s[5]=e.y,s[9]=n.y,s[2]=t.z,s[6]=e.z,s[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(THREE.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],s=n[4],a=n[8],u=n[12],h=n[1],l=n[5],c=n[9],p=n[13],f=n[2],d=n[6],m=n[10],v=n[14],g=n[3],E=n[7],y=n[11],_=n[15],b=r[0],T=r[4],x=r[8],w=r[12],R=r[1],H=r[5],M=r[9],S=r[13],k=r[2],A=r[6],C=r[10],P=r[14],L=r[3],z=r[7],O=r[11],D=r[15];return i[0]=o*b+s*R+a*k+u*L,i[4]=o*T+s*H+a*A+u*z,i[8]=o*x+s*M+a*C+u*O,i[12]=o*w+s*S+a*P+u*D,i[1]=h*b+l*R+c*k+p*L,i[5]=h*T+l*H+c*A+p*z,i[9]=h*x+l*M+c*C+p*O,i[13]=h*w+l*S+c*P+p*D,i[2]=f*b+d*R+m*k+v*L,i[6]=f*T+d*H+m*A+v*z,i[10]=f*x+d*M+m*C+v*O,i[14]=f*w+d*S+m*P+v*D,i[3]=g*b+E*R+y*k+_*L,i[7]=g*T+E*H+y*A+_*z,i[11]=g*x+E*M+y*C+_*O,i[15]=g*w+E*S+y*P+_*D,this},multiplyToArray:function(t,e,n){var r=this.elements;return this.multiplyMatrices(t,e),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},multiplyVector3:function(t){return THREE.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return THREE.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return THREE.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var t=new THREE.Vector3;return function(e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.length);for(var i=0,o=n;r>i;i+=3,o+=3)t.x=e[o],t.y=e[o+1],t.z=e[o+2],t.applyMatrix4(this),e[o]=t.x,e[o+1]=t.y,e[o+2]=t.z;return e}}(),rotateAxis:function(t){THREE.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return THREE.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},determinant:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],s=t[5],a=t[9],u=t[13],h=t[2],l=t[6],c=t[10],p=t[14],f=t[3],d=t[7],m=t[11],v=t[15];return f*(+i*a*l-r*u*l-i*s*c+n*u*c+r*s*p-n*a*p)+d*(+e*a*p-e*u*c+i*o*c-r*o*p+r*u*h-i*a*h)+m*(+e*u*l-e*s*p-i*o*l+n*o*p+i*s*h-n*u*h)+v*(-r*s*h-e*a*l+e*s*c+r*o*l-n*o*c+n*a*h)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArrayOffset:function(t,e){var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t},getPosition:function(){var t=new THREE.Vector3;return function(){THREE.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var e=this.elements;return t.set(e[12],e[13],e[14])}}(),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 n=this.elements,r=t.elements,i=r[0],o=r[4],s=r[8],a=r[12],u=r[1],h=r[5],l=r[9],c=r[13],p=r[2],f=r[6],d=r[10],m=r[14],v=r[3],g=r[7],E=r[11],y=r[15];n[0]=l*m*g-c*d*g+c*f*E-h*m*E-l*f*y+h*d*y,n[4]=a*d*g-s*m*g-a*f*E+o*m*E+s*f*y-o*d*y,n[8]=s*c*g-a*l*g+a*h*E-o*c*E-s*h*y+o*l*y,n[12]=a*l*f-s*c*f-a*h*d+o*c*d+s*h*m-o*l*m,n[1]=c*d*v-l*m*v-c*p*E+u*m*E+l*p*y-u*d*y,n[5]=s*m*v-a*d*v+a*p*E-i*m*E-s*p*y+i*d*y,n[9]=a*l*v-s*c*v-a*u*E+i*c*E+s*u*y-i*l*y,n[13]=s*c*p-a*l*p+a*u*d-i*c*d-s*u*m+i*l*m,n[2]=h*m*v-c*f*v+c*p*g-u*m*g-h*p*y+u*f*y,n[6]=a*f*v-o*m*v-a*p*g+i*m*g+o*p*y-i*f*y,n[10]=o*c*v-a*h*v+a*u*g-i*c*g-o*u*y+i*h*y,n[14]=a*h*p-o*c*p-a*u*f+i*c*f+o*u*m-i*h*m,n[3]=l*f*v-h*d*v-l*p*g+u*d*g+h*p*E-u*f*E,n[7]=o*d*v-s*f*v+s*p*g-i*d*g-o*p*E+i*f*E,n[11]=s*h*v-o*l*v-s*u*g+i*l*g+o*u*E-i*h*E,n[15]=o*l*p-s*h*p+s*u*f-i*l*f-o*u*d+i*h*d;var _=i*n[0]+u*n[4]+p*n[8]+v*n[12];if(0==_){var b="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(b);return THREE.warn(b),this.identity(),this}return this.multiplyScalar(1/_),this},translate:function(t){THREE.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){THREE.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){THREE.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){THREE.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,e){THREE.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,Math.max(n,r)))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,s=t.y,a=t.z,u=i*o,h=i*s;return this.set(u*o+n,u*s-r*a,u*a+r*s,0,u*s+r*a,h*s+n,h*a-r*o,0,u*a-r*s,h*a+r*o,i*a*a+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t=new THREE.Vector3,e=new THREE.Matrix4;return function(n,r,i){var o=this.elements,s=t.set(o[0],o[1],o[2]).length(),a=t.set(o[4],o[5],o[6]).length(),u=t.set(o[8],o[9],o[10]).length(),h=this.determinant();0>h&&(s=-s),n.x=o[12],n.y=o[13],n.z=o[14],e.elements.set(this.elements);var l=1/s,c=1/a,p=1/u;return e.elements[0]*=l,e.elements[1]*=l,e.elements[2]*=l,e.elements[4]*=c,e.elements[5]*=c,e.elements[6]*=c,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,r.setFromRotationMatrix(e),i.x=s,i.y=a,i.z=u,this}}(),makeFrustum:function(t,e,n,r,i,o){var s=this.elements,a=2*i/(e-t),u=2*i/(r-n),h=(e+t)/(e-t),l=(r+n)/(r-n),c=-(o+i)/(o-i),p=-2*o*i/(o-i);return s[0]=a,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=u,s[9]=l,s[13]=0,s[2]=0,s[6]=0,s[10]=c,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this},makePerspective:function(t,e,n,r){var i=n*Math.tan(THREE.Math.degToRad(.5*t)),o=-i,s=o*e,a=i*e;return this.makeFrustum(s,a,o,i,n,r)},makeOrthographic:function(t,e,n,r,i,o){var s=this.elements,a=e-t,u=n-r,h=o-i,l=(e+t)/a,c=(n+r)/u,p=(o+i)/h;return s[0]=2/a,s[4]=0,s[8]=0,s[12]=-l,s[1]=0,s[5]=2/u,s[9]=0,s[13]=-c,s[2]=0,s[6]=0,s[10]=-2/h,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this},fromArray:function(t){return this.elements.set(t),this},toArray:function(){var t=this.elements;return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]},clone:function(){return(new THREE.Matrix4).fromArray(this.elements)}},THREE.Ray=function(t,e){this.origin=void 0!==t?t:new THREE.Vector3,this.direction=void 0!==e?e:new THREE.Vector3},THREE.Ray.prototype={constructor:THREE.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){var n=e||new THREE.Vector3;return n.copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var t=new THREE.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new THREE.Vector3;n.subVectors(t,this.origin);var r=n.dot(this.direction);return 0>r?n.copy(this.origin):n.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(){var t=new THREE.Vector3;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return 0>n?this.origin.distanceTo(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceTo(e))}}(),distanceSqToSegment:function(){var t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(r,i,o,s){t.copy(r).add(i).multiplyScalar(.5),e.copy(i).sub(r).normalize(),n.copy(this.origin).sub(t);var a,u,h,l,c=.5*r.distanceTo(i),p=-this.direction.dot(e),f=n.dot(this.direction),d=-n.dot(e),m=n.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(a=p*d-f,u=p*f-d,l=c*v,a>=0)if(u>=-l)if(l>=u){var g=1/v;a*=g,u*=g,h=a*(a+p*u+2*f)+u*(p*a+u+2*d)+m}else u=c,a=Math.max(0,-(p*u+f)),h=-a*a+u*(u+2*d)+m;else u=-c,a=Math.max(0,-(p*u+f)),h=-a*a+u*(u+2*d)+m;else-l>=u?(a=Math.max(0,-(-p*c+f)),u=a>0?-c:Math.min(Math.max(-c,-d),c),h=-a*a+u*(u+2*d)+m):l>=u?(a=0,u=Math.min(Math.max(-c,-d),c),h=u*(u+2*d)+m):(a=Math.max(0,-(p*c+f)),u=a>0?c:Math.min(Math.max(-c,-d),c),h=-a*a+u*(u+2*d)+m);else u=p>0?-c:c,a=Math.max(0,-(p*u+f)),h=-a*a+u*(u+2*d)+m;return o&&o.copy(this.direction).multiplyScalar(a).add(this.origin),s&&s.copy(e).multiplyScalar(u).add(t),h}}(),isIntersectionSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},intersectSphere:function(){var t=new THREE.Vector3;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var s=Math.sqrt(o-i),a=r-s,u=r+s;return 0>a&&0>u?null:0>a?this.at(u,n):this.at(a,n)}}(),isIntersectionPlane:function(t){var e=t.distanceToPoint(this.origin);if(0===e)return!0;var n=t.normal.dot(this.direction);return 0>n*e?!0:!1},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0==e)return 0==t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},isIntersectionBox:function(){var t=new THREE.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectBox:function(t,e){var n,r,i,o,s,a,u=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,c=this.origin;return u>=0?(n=(t.min.x-c.x)*u,r=(t.max.x-c.x)*u):(n=(t.max.x-c.x)*u,r=(t.min.x-c.x)*u),h>=0?(i=(t.min.y-c.y)*h,o=(t.max.y-c.y)*h):(i=(t.max.y-c.y)*h,o=(t.min.y-c.y)*h),n>o||i>r?null:((i>n||n!==n)&&(n=i),(r>o||r!==r)&&(r=o),l>=0?(s=(t.min.z-c.z)*l,a=(t.max.z-c.z)*l):(s=(t.max.z-c.z)*l,a=(t.min.z-c.z)*l),n>a||s>r?null:((s>n||n!==n)&&(n=s),(r>a||r!==r)&&(r=a),0>r?null:this.at(n>=0?n:r,e)))},intersectTriangle:function(){var t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3;return function(i,o,s,a,u){e.subVectors(o,i),n.subVectors(s,i),r.crossVectors(e,n);var h,l=this.direction.dot(r);if(l>0){if(a)return null;h=1}else{if(!(0>l))return null;h=-1,l=-l}t.subVectors(this.origin,i);var c=h*this.direction.dot(n.crossVectors(t,n));if(0>c)return null;var p=h*this.direction.dot(e.cross(t));if(0>p)return null;if(c+p>l)return null;var f=-h*t.dot(r);return 0>f?null:this.at(f/l,u)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)},clone:function(){return(new THREE.Ray).copy(this)}},THREE.Sphere=function(t,e){this.center=void 0!==t?t:new THREE.Vector3,this.radius=void 0!==e?e:0},THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new THREE.Box3;return function(e,n){var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).center(r);for(var i=0,o=0,s=e.length;s>o;o++)i=Math.max(i,r.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),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},clampPoint:function(t,e){var n=this.center.distanceToSquared(t),r=e||new THREE.Vector3;return r.copy(t),n>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new THREE.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}},THREE.Frustum=function(t,e,n,r,i,o){this.planes=[void 0!==t?t:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==n?n:new THREE.Plane,void 0!==r?r:new THREE.Plane,void 0!==i?i:new THREE.Plane,void 0!==o?o:new THREE.Plane]},THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(t,e,n,r,i,o){var s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(o),this},copy:function(t){for(var e=this.planes,n=0;6>n;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=n[5],h=n[6],l=n[7],c=n[8],p=n[9],f=n[10],d=n[11],m=n[12],v=n[13],g=n[14],E=n[15];return e[0].setComponents(s-r,l-a,d-c,E-m).normalize(),e[1].setComponents(s+r,l+a,d+c,E+m).normalize(),e[2].setComponents(s+i,l+u,d+p,E+v).normalize(),e[3].setComponents(s-i,l-u,d-p,E-v).normalize(),e[4].setComponents(s-o,l-h,d-f,E-g).normalize(),e[5].setComponents(s+o,l+h,d+f,E+g).normalize(),this},intersectsObject:function(){var t=new THREE.Sphere;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere),t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;6>i;i++){var o=e[i].distanceToPoint(n);if(r>o)return!1}return!0},intersectsBox:function(){var t=new THREE.Vector3,e=new THREE.Vector3;return function(n){for(var r=this.planes,i=0;6>i;i++){var o=r[i];t.x=o.normal.x>0?n.min.x:n.max.x,e.x=o.normal.x>0?n.max.x:n.min.x,t.y=o.normal.y>0?n.min.y:n.max.y,e.y=o.normal.y>0?n.max.y:n.min.y,t.z=o.normal.z>0?n.min.z:n.max.z,e.z=o.normal.z>0?n.max.z:n.min.z;var s=o.distanceToPoint(t),a=o.distanceToPoint(e);if(0>s&&0>a)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;6>n;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this); +}},THREE.Plane=function(t,e){this.normal=void 0!==t?t:new THREE.Vector3(1,0,0),this.constant=void 0!==e?e:0},THREE.Plane.prototype={constructor:THREE.Plane,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new THREE.Vector3,e=new THREE.Vector3;return function(n,r,i){var o=t.subVectors(i,r).cross(e.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t),r=e||new THREE.Vector3;return r.copy(this.normal).multiplyScalar(n)},isIntersectionLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return 0>e&&n>0||0>n&&e>0},intersectLine:function(){var t=new THREE.Vector3;return function(e,n){var r=n||new THREE.Vector3,i=e.delta(t),o=this.normal.dot(i);if(0==o)return 0==this.distanceToPoint(e.start)?r.copy(e.start):void 0;var s=-(e.start.dot(this.normal)+this.constant)/o;return 0>s||s>1?void 0:r.copy(i).multiplyScalar(s).add(e.start)}}(),coplanarPoint:function(t){var e=t||new THREE.Vector3;return e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Matrix3;return function(r,i){var o=i||n.getNormalMatrix(r),s=t.copy(this.normal).applyMatrix3(o),a=this.coplanarPoint(e);return a.applyMatrix4(r),this.setFromNormalAndCoplanarPoint(s,a),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},clone:function(){return(new THREE.Plane).copy(this)}},THREE.Math={generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var i=0;36>i;i++)8==i||13==i||18==i||23==i?n[i]="-":14==i?n[i]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),t=15&r,r>>=4,n[i]=e[19==i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return e>t?e:t>n?n:t},clampBottom:function(t,e){return e>t?e:t},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},smoothstep:function(t,e,n){return e>=t?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))},smootherstep:function(t,e,n){return e>=t?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(6*t-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(t,e){return Math.floor(this.randFloat(t,e))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(){var t=Math.PI/180;return function(e){return e*t}}(),radToDeg:function(){var t=180/Math.PI;return function(e){return e*t}}(),isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t}},THREE.Spline=function(t){function e(t,e,n,r,i,o,s){var a=.5*(n-t),u=.5*(r-e);return(2*(e-n)+a+u)*s+(-3*(e-n)-2*a-u)*o+a*i+e}this.points=t;var n,r,i,o,s,a,u,h,l,c=[],p={x:0,y:0,z:0};this.initFromArray=function(t){this.points=[];for(var e=0;ethis.points.length-2?this.points.length-1:r+1,c[3]=r>this.points.length-3?this.points.length-1:r+2,a=this.points[c[0]],u=this.points[c[1]],h=this.points[c[2]],l=this.points[c[3]],o=i*i,s=i*o,p.x=e(a.x,u.x,h.x,l.x,i,o,s),p.y=e(a.y,u.y,h.y,l.y,i,o,s),p.z=e(a.z,u.z,h.z,l.z,i,o,s),p},this.getControlPointsArray=function(){var t,e,n=this.points.length,r=[];for(t=0;n>t;t++)e=this.points[t],r[t]=[e.x,e.y,e.z];return r},this.getLength=function(t){var e,n,r,i,o=0,s=0,a=0,u=new THREE.Vector3,h=new THREE.Vector3,l=[],c=0;for(l[0]=0,t||(t=100),r=this.points.length*t,u.copy(this.points[0]),e=1;r>e;e++)n=e/r,i=this.getPoint(n),h.copy(i),c+=h.distanceTo(u),u.copy(i),o=(this.points.length-1)*n,s=Math.floor(o),s!=a&&(l[s]=c,a=s);return l[l.length]=c,{chunks:l,total:c}},this.reparametrizeByArcLength=function(t){var e,n,r,i,o,s,a,u,h=[],l=new THREE.Vector3,c=this.getLength();for(h.push(l.copy(this.points[0]).clone()),e=1;en;n++)r=i+n*(1/a)*(o-i),u=this.getPoint(r),h.push(l.copy(u).clone());h.push(l.copy(this.points[e]).clone())}this.points=h}},THREE.Triangle=function(t,e,n){this.a=void 0!==t?t:new THREE.Vector3,this.b=void 0!==e?e:new THREE.Vector3,this.c=void 0!==n?n:new THREE.Vector3},THREE.Triangle.normal=function(){var t=new THREE.Vector3;return function(e,n,r,i){var o=i||new THREE.Vector3;o.subVectors(r,n),t.subVectors(e,n),o.cross(t);var s=o.lengthSq();return s>0?o.multiplyScalar(1/Math.sqrt(s)):o.set(0,0,0)}}(),THREE.Triangle.barycoordFromPoint=function(){var t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(r,i,o,s,a){t.subVectors(s,i),e.subVectors(o,i),n.subVectors(r,i);var u=t.dot(t),h=t.dot(e),l=t.dot(n),c=e.dot(e),p=e.dot(n),f=u*c-h*h,d=a||new THREE.Vector3;if(0==f)return d.set(-2,-1,-1);var m=1/f,v=(c*l-h*p)*m,g=(u*p-h*l)*m;return d.set(1-v-g,g,v)}}(),THREE.Triangle.containsPoint=function(){var t=new THREE.Vector3;return function(e,n,r,i){var o=THREE.Triangle.barycoordFromPoint(e,n,r,i,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new THREE.Vector3,e=new THREE.Vector3;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){var e=t||new THREE.Vector3;return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return THREE.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){var e=t||new THREE.Plane;return e.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return THREE.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return THREE.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)},clone:function(){return(new THREE.Triangle).copy(this)}},THREE.Clock=function(t){this.autoStart=void 0!==t?t:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();t=.001*(e-this.oldTime),this.oldTime=e,this.elapsedTime+=t}return t}},THREE.EventDispatcher=function(){},THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(t){t.addEventListener=THREE.EventDispatcher.prototype.addEventListener,t.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener,t.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener,t.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)?!0:!1},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,r=n[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;for(var r=[],i=n.length,o=0;i>o;o++)r[o]=n[o];for(var o=0;i>o;o++)r[o].call(this,t)}}}},function(t){t.Raycaster=function(e,n,r,i){this.ray=new t.Ray(e,n),this.near=r||0,this.far=i||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var e=function(t,e){return t.distance-e.distance},n=function(t,e,r,i){if(t.raycast(e,r),i===!0)for(var o=t.children,s=0,a=o.length;a>s;s++)n(o[s],e,r,!0)};t.Raycaster.prototype={constructor:t.Raycaster,precision:1e-4,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(e,n){n instanceof t.PerspectiveCamera?(this.ray.origin.copy(n.position),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(n.position).normalize()):n instanceof t.OrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld)):t.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,r){var i=[];return n(t,this,i,r),i.sort(e),i},intersectObjects:function(r,i){var o=[];if(r instanceof Array==!1)return t.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),o;for(var s=0,a=r.length;a>s;s++)n(r[s],this,o,i);return o.sort(e),o}}}(THREE),THREE.Object3D=function(){Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=THREE.Object3D.DefaultUp.clone();var t=new THREE.Vector3,e=new THREE.Euler,n=new THREE.Quaternion,r=new THREE.Vector3(1,1,1),i=function(){n.setFromEuler(e,!1)},o=function(){e.setFromQuaternion(n,void 0,!1)};e.onChange(i),n.onChange(o),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:e},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:r}}),this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0),THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder(){return THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(t){THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=t},get useQuaternion(){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(t){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},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:function(){var t=new THREE.Quaternion;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new THREE.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new THREE.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new THREE.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new THREE.Vector3;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translate:function(t,e){return THREE.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},translateX:function(){var t=new THREE.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new THREE.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new THREE.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new THREE.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new THREE.Matrix4;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e1)for(var e=0;en;n++){var i=this.children[n],o=i.getObjectByProperty(t,e);if(void 0!==o)return o}return void 0},getWorldPosition:function(t){var e=t||new THREE.Vector3;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new THREE.Vector3,e=new THREE.Vector3;return function(n){var r=n||new THREE.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,r,e),r}}(),getWorldRotation:function(){var t=new THREE.Quaternion;return function(e){var n=e||new THREE.Euler;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new THREE.Vector3,e=new THREE.Quaternion;return function(n){var r=n||new THREE.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,r),r}}(),getWorldDirection:function(){var t=new THREE.Quaternion;return function(e){var n=e||new THREE.Vector3;return this.getWorldQuaternion(t),n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=0,n=this.children.length;n>e;e++)this.children[e].traverse(t)},traverseVisible:function(t){if(this.visible!==!1){t(this);for(var e=0,n=this.children.length;n>e;e++)this.children[e].traverseVisible(t)}},traverseAncestors:function(t){this.parent&&(t(this.parent),this.parent.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||t===!0)&&(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=0,n=this.children.length;n>e;e++)this.children[e].updateMatrixWorld(t)},toJSON:function(){var t={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},e={},n=function(n){if(void 0===t.geometries&&(t.geometries=[]),void 0===e[n.uuid]){var r=n.toJSON();delete r.metadata,e[n.uuid]=r,t.geometries.push(r)}return n.uuid},r={},i=function(e){if(void 0===t.materials&&(t.materials=[]),void 0===r[e.uuid]){var n=e.toJSON();delete n.metadata,r[e.uuid]=n,t.materials.push(n)}return e.uuid},o=function(t){var e={};if(e.uuid=t.uuid,e.type=t.type,""!==t.name&&(e.name=t.name),"{}"!==JSON.stringify(t.userData)&&(e.userData=t.userData),t.visible!==!0&&(e.visible=t.visible),t instanceof THREE.PerspectiveCamera?(e.fov=t.fov,e.aspect=t.aspect,e.near=t.near,e.far=t.far):t instanceof THREE.OrthographicCamera?(e.left=t.left,e.right=t.right,e.top=t.top,e.bottom=t.bottom,e.near=t.near,e.far=t.far):t instanceof THREE.AmbientLight?e.color=t.color.getHex():t instanceof THREE.DirectionalLight?(e.color=t.color.getHex(),e.intensity=t.intensity):t instanceof THREE.PointLight?(e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance,e.decay=t.decay):t instanceof THREE.SpotLight?(e.color=t.color.getHex(),e.intensity=t.intensity,e.distance=t.distance,e.angle=t.angle,e.exponent=t.exponent,e.decay=t.decay):t instanceof THREE.HemisphereLight?(e.color=t.color.getHex(),e.groundColor=t.groundColor.getHex()):t instanceof THREE.Mesh||t instanceof THREE.Line||t instanceof THREE.PointCloud?(e.geometry=n(t.geometry),e.material=i(t.material),t instanceof THREE.Line&&(e.mode=t.mode)):t instanceof THREE.Sprite&&(e.material=i(t.material)),e.matrix=t.matrix.toArray(),t.children.length>0){e.children=[];for(var r=0;re;e++)t.vertexNormals[e]=this.vertexNormals[e].clone();for(var e=0,n=this.vertexColors.length;n>e;e++)t.vertexColors[e]=this.vertexColors[e].clone();for(var e=0,n=this.vertexTangents.length;n>e;e++)t.vertexTangents[e]=this.vertexTangents[e].clone();return t}},THREE.Face4=function(t,e,n,r,i,o,s){return THREE.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new THREE.Face3(t,e,n,i,o,s)},THREE.BufferAttribute=function(t,e){this.array=t,this.itemSize=e,this.needsUpdate=!1},THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length(){return this.array.length},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;i>r;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},setX:function(t,e){return this.array[t*this.itemSize]=e,this},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},clone:function(){return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},THREE.Int8Attribute=function(t,e){return THREE.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint8Attribute=function(t,e){return THREE.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint8ClampedAttribute=function(t,e){return THREE.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Int16Attribute=function(t,e){return THREE.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint16Attribute=function(t,e){return THREE.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Int32Attribute=function(t,e){return THREE.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Uint32Attribute=function(t,e){return THREE.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Float32Attribute=function(t,e){return THREE.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.Float64Attribute=function(t,e){return THREE.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new THREE.BufferAttribute(t,e)},THREE.DynamicBufferAttribute=function(t,e){THREE.BufferAttribute.call(this,t,e),this.updateRange={offset:0,count:-1}},THREE.DynamicBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype),THREE.DynamicBufferAttribute.prototype.constructor=THREE.DynamicBufferAttribute,THREE.DynamicBufferAttribute.prototype.clone=function(){return new THREE.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)},THREE.BufferGeometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(t,e){return e instanceof THREE.BufferAttribute==!1?(THREE.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void(this.attributes[t]={array:arguments[1],itemSize:arguments[2]})):(this.attributes[t]=e,void(this.attributesKeys=Object.keys(this.attributes)))},getAttribute:function(t){return this.attributes[t]},addDrawCall:function(t,e,n){this.drawcalls.push({start:t,count:e,index:void 0!==n?n:0})},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new THREE.Matrix3).getNormalMatrix(t);r.applyToVector3Array(n.array),n.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.applyMatrix((new THREE.Matrix4).setPosition(t)),t},fromGeometry:function(t,e){e=e||{vertexColors:THREE.NoColors};var n=t.vertices,r=t.faces,i=t.faceVertexUvs,o=e.vertexColors,s=i[0].length>0,a=3==r[0].vertexNormals.length,u=new Float32Array(3*r.length*3);this.addAttribute("position",new THREE.BufferAttribute(u,3));var h=new Float32Array(3*r.length*3);if(this.addAttribute("normal",new THREE.BufferAttribute(h,3)),o!==THREE.NoColors){var l=new Float32Array(3*r.length*3);this.addAttribute("color",new THREE.BufferAttribute(l,3))}if(s===!0){var c=new Float32Array(3*r.length*2);this.addAttribute("uv",new THREE.BufferAttribute(c,2))}for(var p=0,f=0,d=0;pr;r+=3)t.set(e[r],e[r+1],e[r+2]),n.expandByPoint(t)}(void 0===e||0===e.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&THREE.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),computeBoundingSphere:function(){var t=new THREE.Box3,e=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var n=this.attributes.position.array;if(n){t.makeEmpty();for(var r=this.boundingSphere.center,i=0,o=n.length;o>i;i+=3)e.set(n[i],n[i+1],n[i+2]),t.expandByPoint(e);t.center(r);for(var s=0,i=0,o=n.length;o>i;i+=3)e.set(n[i],n[i+1],n[i+2]),s=Math.max(s,r.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&THREE.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.attributes;if(t.position){var e=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(e.length),3));else for(var n=t.normal.array,r=0,i=n.length;i>r;r++)n[r]=0;var o,s,a,n=t.normal.array,u=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3,p=new THREE.Vector3;if(t.index)for(var f=t.index.array,d=this.offsets.length>0?this.offsets:[{start:0,count:f.length,index:0}],m=0,v=d.length;v>m;++m)for(var g=d[m].start,E=d[m].count,y=d[m].index,r=g,i=g+E;i>r;r+=3)o=3*(y+f[r]),s=3*(y+f[r+1]),a=3*(y+f[r+2]),u.fromArray(e,o),h.fromArray(e,s),l.fromArray(e,a),c.subVectors(l,h),p.subVectors(u,h),c.cross(p),n[o]+=c.x,n[o+1]+=c.y,n[o+2]+=c.z,n[s]+=c.x,n[s+1]+=c.y,n[s+2]+=c.z,n[a]+=c.x,n[a+1]+=c.y,n[a+2]+=c.z;else for(var r=0,i=e.length;i>r;r+=9)u.fromArray(e,r),h.fromArray(e,r+3),l.fromArray(e,r+6),c.subVectors(l,h),p.subVectors(u,h),c.cross(p),n[r]=c.x,n[r+1]=c.y,n[r+2]=c.z,n[r+3]=c.x,n[r+4]=c.y,n[r+5]=c.z,n[r+6]=c.x,n[r+7]=c.y,n[r+8]=c.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){function t(t,e,n){k.fromArray(r,3*t),A.fromArray(r,3*e),C.fromArray(r,3*n),P.fromArray(o,2*t),L.fromArray(o,2*e),z.fromArray(o,2*n),c=A.x-k.x,p=C.x-k.x,f=A.y-k.y,d=C.y-k.y,m=A.z-k.z,v=C.z-k.z,g=L.x-P.x,E=z.x-P.x,y=L.y-P.y,_=z.y-P.y,b=1/(g*_-E*y),O.set((_*c-y*p)*b,(_*f-y*d)*b,(_*m-y*v)*b),D.set((g*p-E*c)*b,(g*d-E*f)*b,(g*v-E*m)*b),u[t].add(O),u[e].add(O),u[n].add(O),h[t].add(D),h[e].add(D),h[n].add(D)}function e(t){q.fromArray(i,3*t),X.copy(q),I=u[t],G.copy(I),G.sub(q.multiplyScalar(q.dot(I))).normalize(),W.crossVectors(X,I),j=W.dot(h[t]),V=0>j?-1:1,a[4*t]=G.x,a[4*t+1]=G.y,a[4*t+2]=G.z,a[4*t+3]=V}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)return void THREE.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");var n=this.attributes.index.array,r=this.attributes.position.array,i=this.attributes.normal.array,o=this.attributes.uv.array,s=r.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*s),4));for(var a=this.attributes.tangent.array,u=[],h=[],l=0;s>l;l++)u[l]=new THREE.Vector3,h[l]=new THREE.Vector3;var c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k=new THREE.Vector3,A=new THREE.Vector3,C=new THREE.Vector3,P=new THREE.Vector2,L=new THREE.Vector2,z=new THREE.Vector2,O=new THREE.Vector3,D=new THREE.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,n.length,0);var F=this.drawcalls;for(w=0,R=F.length;R>w;++w){var U=F[w].start,B=F[w].count,N=F[w].index;for(T=U,x=U+B;x>T;T+=3)H=N+n[T],M=N+n[T+1],S=N+n[T+2],t(H,M,S)}var V,I,j,G=new THREE.Vector3,W=new THREE.Vector3,q=new THREE.Vector3,X=new THREE.Vector3;for(w=0,R=F.length;R>w;++w){var U=F[w].start,B=F[w].count,N=F[w].index;for(T=U,x=U+B;x>T;T+=3)H=N+n[T],M=N+n[T+1],S=N+n[T+2],e(H),e(M),e(S)}},computeOffsets:function(t){void 0===t&&(t=65535);for(var e=this.attributes.index.array,n=this.attributes.position.array,r=e.length/3,i=new Uint16Array(e.length),o=0,s=0,a=[{start:0,count:0,index:0}],u=a[0],h=0,l=0,c=new Int32Array(6),p=new Int32Array(n.length),f=new Int32Array(n.length),d=0;dm;m++){l=0;for(var v=0;3>v;v++){var g=e[3*m+v];-1==p[g]?(c[2*v]=g,c[2*v+1]=-1,l++):p[g]u.index+t){var y={start:o,count:0,index:s};a.push(y),u=y;for(var _=0;6>_;_+=2){var b=c[_+1];b>-1&&b_;_+=2){var g=c[_],b=c[_+1];-1===b&&(b=s++),p[g]=b,f[b]=g,i[o++]=b-u.index,u.count++}}return this.reorderBuffers(i,f,s),this.offsets=a,this.drawcalls=a,a},merge:function(t,e){if(t instanceof THREE.BufferGeometry==!1)return void THREE.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var n=this.attributes;for(var r in n)if(void 0!==t.attributes[r])for(var i=n[r],o=i.array,s=t.attributes[r],a=s.array,u=s.itemSize,h=0,l=u*e;ho;o+=3)t=i[o],e=i[o+1],n=i[o+2],r=1/Math.sqrt(t*t+e*e+n*n),i[o]*=r,i[o+1]*=r,i[o+2]*=r},reorderBuffers:function(t,e,n){var r={};for(var i in this.attributes)if("index"!=i){var o=this.attributes[i].array;r[i]=new o.constructor(this.attributes[i].itemSize*n)}for(var s=0;n>s;s++){var a=e[s];for(var i in this.attributes)if("index"!=i)for(var u=this.attributes[i].array,h=this.attributes[i].itemSize,l=r[i],c=0;h>c;c++)l[s*h+c]=u[a*h+c]}this.attributes.index.array=t;for(var i in this.attributes)"index"!=i&&(this.attributes[i].array=r[i],this.attributes[i].numItems=this.attributes[i].itemSize*n)},toJSON:function(){var t={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},e=this.attributes,n=this.offsets,r=this.boundingSphere; +for(var i in e){var o=e[i],s=Array.prototype.slice.call(o.array);t.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:s}}return n.length>0&&(t.data.offsets=JSON.parse(JSON.stringify(n))),null!==r&&(t.data.boundingSphere={center:r.center.toArray(),radius:r.radius}),t},clone:function(){var t=new THREE.BufferGeometry;for(var e in this.attributes){var n=this.attributes[e];t.addAttribute(e,n.clone())}for(var r=0,i=this.offsets.length;i>r;r++){var o=this.offsets[r];t.offsets.push({start:o.start,index:o.index,count:o.count})}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype),THREE.Geometry=function(){Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++}),this.uuid=THREE.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(t){for(var e=(new THREE.Matrix3).getNormalMatrix(t),n=0,r=this.vertices.length;r>n;n++){var i=this.vertices[n];i.applyMatrix4(t)}for(var n=0,r=this.faces.length;r>n;n++){var o=this.faces[n];o.normal.applyMatrix3(e).normalize();for(var s=0,a=o.vertexNormals.length;a>s;s++)o.vertexNormals[s].applyMatrix3(e).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},fromBufferGeometry:function(t){for(var e=this,n=t.attributes,r=n.position.array,i=void 0!==n.index?n.index.array:void 0,o=void 0!==n.normal?n.normal.array:void 0,s=void 0!==n.color?n.color.array:void 0,a=void 0!==n.uv?n.uv.array:void 0,u=[],h=[],l=0,c=0;l0)for(var l=0;lc;c+=3)p(g+i[c],g+i[c+1],g+i[c+2]);else for(var l=0;ln;n++){var i=this.faces[n],o=this.vertices[i.a],s=this.vertices[i.b],a=this.vertices[i.c];t.subVectors(a,s),e.subVectors(o,s),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){var e,n,r,i,o,s;for(s=new Array(this.vertices.length),e=0,n=this.vertices.length;n>e;e++)s[e]=new THREE.Vector3;if(t){var a,u,h,l=new THREE.Vector3,c=new THREE.Vector3;for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],a=this.vertices[o.a],u=this.vertices[o.b],h=this.vertices[o.c],l.subVectors(h,u),c.subVectors(a,u),l.cross(c),s[o.a].add(l),s[o.b].add(l),s[o.c].add(l)}else for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],s[o.a].add(o.normal),s[o.b].add(o.normal),s[o.c].add(o.normal);for(e=0,n=this.vertices.length;n>e;e++)s[e].normalize();for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],o.vertexNormals[0]=s[o.a].clone(),o.vertexNormals[1]=s[o.b].clone(),o.vertexNormals[2]=s[o.c].clone()},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;r>n;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;e>t;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var o=new THREE.Geometry;for(o.faces=this.faces,t=0,e=this.morphTargets.length;e>t;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var s,a,u=this.morphNormals[t].faceNormals,h=this.morphNormals[t].vertexNormals;for(n=0,r=this.faces.length;r>n;n++)s=new THREE.Vector3,a={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},u.push(s),h.push(a)}var l=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals();var s,a;for(n=0,r=this.faces.length;r>n;n++)i=this.faces[n],s=l.faceNormals[n],a=l.vertexNormals[n],s.copy(i.normal),a.a.copy(i.vertexNormals[0]),a.b.copy(i.vertexNormals[1]),a.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;r>n;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeTangents:function(){function t(t,e,n,r,i,o,s){h=t.vertices[e],l=t.vertices[n],c=t.vertices[r],p=u[i],f=u[o],d=u[s],m=l.x-h.x,v=c.x-h.x,g=l.y-h.y,E=c.y-h.y,y=l.z-h.z,_=c.z-h.z,b=f.x-p.x,T=d.x-p.x,x=f.y-p.y,w=d.y-p.y,R=1/(b*w-T*x),C.set((w*m-x*v)*R,(w*g-x*E)*R,(w*y-x*_)*R),P.set((b*v-T*m)*R,(b*E-T*g)*R,(b*_-T*y)*R),k[e].add(C),k[n].add(C),k[r].add(C),A[e].add(P),A[n].add(P),A[r].add(P)}var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k=[],A=[],C=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,z=new THREE.Vector3,O=new THREE.Vector3;for(r=0,i=this.vertices.length;i>r;r++)k[r]=new THREE.Vector3,A[r]=new THREE.Vector3;for(e=0,n=this.faces.length;n>e;e++)a=this.faces[e],u=this.faceVertexUvs[0][e],t(this,a.a,a.b,a.c,0,1,2);var D=["a","b","c","d"];for(e=0,n=this.faces.length;n>e;e++)for(a=this.faces[e],o=0;oM?-1:1,a.vertexTangents[o]=new THREE.Vector4(L.x,L.y,L.z,S);this.hasTangents=!0},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,r=e.length;r>n;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(t instanceof THREE.Geometry==!1)return void THREE.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var r,i=this.vertices.length,o=this.vertices,s=t.vertices,a=this.faces,u=t.faces,h=this.faceVertexUvs[0],l=t.faceVertexUvs[0];void 0===n&&(n=0),void 0!==e&&(r=(new THREE.Matrix3).getNormalMatrix(e));for(var c=0,p=s.length;p>c;c++){var f=s[c],d=f.clone();void 0!==e&&d.applyMatrix4(e),o.push(d)}for(c=0,p=u.length;p>c;c++){var m,v,g,E=u[c],y=E.vertexNormals,_=E.vertexColors;m=new THREE.Face3(E.a+i,E.b+i,E.c+i),m.normal.copy(E.normal),void 0!==r&&m.normal.applyMatrix3(r).normalize();for(var b=0,T=y.length;T>b;b++)v=y[b].clone(),void 0!==r&&v.applyMatrix3(r).normalize(),m.vertexNormals.push(v);m.color.copy(E.color);for(var b=0,T=_.length;T>b;b++)g=_[b],m.vertexColors.push(g.clone());m.materialIndex=E.materialIndex+n,a.push(m)}for(c=0,p=l.length;p>c;c++){var x=l[c],w=[];if(void 0!==x){for(var b=0,T=x.length;T>b;b++)w.push(x[b].clone());h.push(w)}}},mergeMesh:function(t){return t instanceof THREE.Mesh==!1?void THREE.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t):(t.matrixAutoUpdate&&t.updateMatrix(),void this.merge(t.geometry,t.matrix))},mergeVertices:function(){var t,e,n,r,i,o,s,a,u={},h=[],l=[],c=4,p=Math.pow(10,c);for(n=0,r=this.vertices.length;r>n;n++)t=this.vertices[n],e=Math.round(t.x*p)+"_"+Math.round(t.y*p)+"_"+Math.round(t.z*p),void 0===u[e]?(u[e]=n,h.push(this.vertices[n]),l[n]=h.length-1):l[n]=l[u[e]];var f=[];for(n=0,r=this.faces.length;r>n;n++){i=this.faces[n],i.a=l[i.a],i.b=l[i.b],i.c=l[i.c],o=[i.a,i.b,i.c];for(var d=-1,m=0;3>m;m++)if(o[m]==o[(m+1)%3]){d=m,f.push(n);break}}for(n=f.length-1;n>=0;n--){var v=f[n];for(this.faces.splice(v,1),s=0,a=this.faceVertexUvs.length;a>s;s++)this.faceVertexUvs[s].splice(v,1)}var g=this.vertices.length-h.length;return this.vertices=h,g},toJSON:function(){function t(t,e,n){return n?t|1<0,T=g.vertexNormals.length>0,x=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,R=0;if(R=t(R,0,0),R=t(R,1,E),R=t(R,2,y),R=t(R,3,_),R=t(R,4,b),R=t(R,5,T),R=t(R,6,x),R=t(R,7,w),l.push(R),l.push(g.a,g.b,g.c),_){var H=this.faceVertexUvs[0][u];l.push(r(H[0]),r(H[1]),r(H[2]))}if(b&&l.push(e(g.normal)),T){var M=g.vertexNormals;l.push(e(M[0]),e(M[1]),e(M[2]))}if(x&&l.push(n(g.color)),w){var S=g.vertexColors;l.push(n(S[0]),n(S[1]),n(S[2]))}}return i.data={},i.data.vertices=a,i.data.normals=c,f.length>0&&(i.data.colors=f),m.length>0&&(i.data.uvs=[m]),i.data.faces=l,i},clone:function(){for(var t=new THREE.Geometry,e=this.vertices,n=0,r=e.length;r>n;n++)t.vertices.push(e[n].clone());for(var i=this.faces,n=0,r=i.length;r>n;n++)t.faces.push(i[n].clone());for(var n=0,r=this.faceVertexUvs.length;r>n;n++){var o=this.faceVertexUvs[n];void 0===t.faceVertexUvs[n]&&(t.faceVertexUvs[n]=[]);for(var s=0,a=o.length;a>s;s++){for(var u=o[s],h=[],l=0,c=u.length;c>l;l++){var p=u[l];h.push(p.clone())}t.faceVertexUvs[n].push(h)}}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype),THREE.GeometryIdCount=0,THREE.Camera=function(){THREE.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new THREE.Matrix4,this.projectionMatrix=new THREE.Matrix4},THREE.Camera.prototype=Object.create(THREE.Object3D.prototype),THREE.Camera.prototype.constructor=THREE.Camera,THREE.Camera.prototype.getWorldDirection=function(){var t=new THREE.Quaternion;return function(e){var n=e||new THREE.Vector3;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),THREE.Camera.prototype.lookAt=function(){var t=new THREE.Matrix4;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),THREE.Camera.prototype.clone=function(t){return void 0===t&&(t=new THREE.Camera),THREE.Object3D.prototype.clone.call(this,t),t.matrixWorldInverse.copy(this.matrixWorldInverse),t.projectionMatrix.copy(this.projectionMatrix),t},THREE.CubeCamera=function(t,e,n){THREE.Object3D.call(this),this.type="CubeCamera";var r=90,i=1,o=new THREE.PerspectiveCamera(r,i,t,e);o.up.set(0,-1,0),o.lookAt(new THREE.Vector3(1,0,0)),this.add(o);var s=new THREE.PerspectiveCamera(r,i,t,e);s.up.set(0,-1,0),s.lookAt(new THREE.Vector3(-1,0,0)),this.add(s);var a=new THREE.PerspectiveCamera(r,i,t,e);a.up.set(0,0,1),a.lookAt(new THREE.Vector3(0,1,0)),this.add(a);var u=new THREE.PerspectiveCamera(r,i,t,e);u.up.set(0,0,-1),u.lookAt(new THREE.Vector3(0,-1,0)),this.add(u);var h=new THREE.PerspectiveCamera(r,i,t,e);h.up.set(0,-1,0),h.lookAt(new THREE.Vector3(0,0,1)),this.add(h);var l=new THREE.PerspectiveCamera(r,i,t,e);l.up.set(0,-1,0),l.lookAt(new THREE.Vector3(0,0,-1)),this.add(l),this.renderTarget=new THREE.WebGLRenderTargetCube(n,n,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter}),this.updateCubeMap=function(t,e){var n=this.renderTarget,r=n.generateMipmaps;n.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,o,n),n.activeCubeFace=1,t.render(e,s,n),n.activeCubeFace=2,t.render(e,a,n),n.activeCubeFace=3,t.render(e,u,n),n.activeCubeFace=4,t.render(e,h,n),n.generateMipmaps=r,n.activeCubeFace=5,t.render(e,l,n)}},THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype),THREE.CubeCamera.prototype.constructor=THREE.CubeCamera,THREE.OrthographicCamera=function(t,e,n,r,i,o){THREE.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()},THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype),THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera,THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(n-t,n+t,r+e,r-e,this.near,this.far)},THREE.OrthographicCamera.prototype.clone=function(){var t=new THREE.OrthographicCamera;return THREE.Camera.prototype.clone.call(this,t),t.zoom=this.zoom,t.left=this.left,t.right=this.right,t.top=this.top,t.bottom=this.bottom,t.near=this.near,t.far=this.far,t.projectionMatrix.copy(this.projectionMatrix),t},THREE.PerspectiveCamera=function(t,e,n,r){THREE.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==e?e:1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype),THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera,THREE.PerspectiveCamera.prototype.setLens=function(t,e){void 0===e&&(e=24),this.fov=2*THREE.Math.radToDeg(Math.atan(e/(2*t))),this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.setViewOffset=function(t,e,n,r,i,o){this.fullWidth=t,this.fullHeight=e,this.x=n,this.y=r,this.width=i,this.height=o,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var e=this.fullWidth/this.fullHeight,n=Math.tan(THREE.Math.degToRad(.5*t))*this.near,r=-n,i=e*r,o=e*n,s=Math.abs(o-i),a=Math.abs(n-r);this.projectionMatrix.makeFrustum(i+this.x*s/this.fullWidth,i+(this.x+this.width)*s/this.fullWidth,n-(this.y+this.height)*a/this.fullHeight,n-this.y*a/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)},THREE.PerspectiveCamera.prototype.clone=function(){var t=new THREE.PerspectiveCamera;return THREE.Camera.prototype.clone.call(this,t),t.zoom=this.zoom,t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t.projectionMatrix.copy(this.projectionMatrix),t},THREE.Light=function(t){THREE.Object3D.call(this),this.type="Light",this.color=new THREE.Color(t)},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.Light.prototype.constructor=THREE.Light,THREE.Light.prototype.clone=function(t){return void 0===t&&(t=new THREE.Light),THREE.Object3D.prototype.clone.call(this,t),t.color.copy(this.color),t},THREE.AmbientLight=function(t){THREE.Light.call(this,t),this.type="AmbientLight"},THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype),THREE.AmbientLight.prototype.constructor=THREE.AmbientLight,THREE.AmbientLight.prototype.clone=function(){var t=new THREE.AmbientLight;return THREE.Light.prototype.clone.call(this,t),t},THREE.AreaLight=function(t,e){THREE.Light.call(this,t),this.type="AreaLight",this.normal=new THREE.Vector3(0,-1,0),this.right=new THREE.Vector3(1,0,0),this.intensity=void 0!==e?e:1,this.width=1,this.height=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},THREE.AreaLight.prototype=Object.create(THREE.Light.prototype),THREE.AreaLight.prototype.constructor=THREE.AreaLight,THREE.DirectionalLight=function(t,e){THREE.Light.call(this,t),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new THREE.Object3D,this.intensity=void 0!==e?e:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,this.shadowCascadeOffset=new THREE.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype),THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight,THREE.DirectionalLight.prototype.clone=function(){var t=new THREE.DirectionalLight;return THREE.Light.prototype.clone.call(this,t),t.target=this.target.clone(),t.intensity=this.intensity,t.castShadow=this.castShadow,t.onlyShadow=this.onlyShadow,t.shadowCameraNear=this.shadowCameraNear,t.shadowCameraFar=this.shadowCameraFar,t.shadowCameraLeft=this.shadowCameraLeft,t.shadowCameraRight=this.shadowCameraRight,t.shadowCameraTop=this.shadowCameraTop,t.shadowCameraBottom=this.shadowCameraBottom,t.shadowCameraVisible=this.shadowCameraVisible,t.shadowBias=this.shadowBias,t.shadowDarkness=this.shadowDarkness,t.shadowMapWidth=this.shadowMapWidth,t.shadowMapHeight=this.shadowMapHeight,t.shadowCascade=this.shadowCascade,t.shadowCascadeOffset.copy(this.shadowCascadeOffset),t.shadowCascadeCount=this.shadowCascadeCount,t.shadowCascadeBias=this.shadowCascadeBias.slice(0),t.shadowCascadeWidth=this.shadowCascadeWidth.slice(0),t.shadowCascadeHeight=this.shadowCascadeHeight.slice(0),t.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0),t.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0),t},THREE.HemisphereLight=function(t,e,n){THREE.Light.call(this,t),this.type="HemisphereLight",this.position.set(0,100,0),this.groundColor=new THREE.Color(e),this.intensity=void 0!==n?n:1},THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype),THREE.HemisphereLight.prototype.constructor=THREE.HemisphereLight,THREE.HemisphereLight.prototype.clone=function(){var t=new THREE.HemisphereLight;return THREE.Light.prototype.clone.call(this,t),t.groundColor.copy(this.groundColor),t.intensity=this.intensity,t},THREE.PointLight=function(t,e,n,r){THREE.Light.call(this,t),this.type="PointLight",this.intensity=void 0!==e?e:1,this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1},THREE.PointLight.prototype=Object.create(THREE.Light.prototype),THREE.PointLight.prototype.constructor=THREE.PointLight,THREE.PointLight.prototype.clone=function(){var t=new THREE.PointLight;return THREE.Light.prototype.clone.call(this,t),t.intensity=this.intensity,t.distance=this.distance,t.decay=this.decay,t},THREE.SpotLight=function(t,e,n,r,i,o){THREE.Light.call(this,t),this.type="SpotLight",this.position.set(0,1,0),this.target=new THREE.Object3D,this.intensity=void 0!==e?e:1,this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.exponent=void 0!==i?i:10,this.decay=void 0!==o?o:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},THREE.SpotLight.prototype=Object.create(THREE.Light.prototype),THREE.SpotLight.prototype.constructor=THREE.SpotLight,THREE.SpotLight.prototype.clone=function(){var t=new THREE.SpotLight;return THREE.Light.prototype.clone.call(this,t),t.target=this.target.clone(),t.intensity=this.intensity,t.distance=this.distance,t.angle=this.angle,t.exponent=this.exponent,t.decay=this.decay,t.castShadow=this.castShadow,t.onlyShadow=this.onlyShadow,t.shadowCameraNear=this.shadowCameraNear,t.shadowCameraFar=this.shadowCameraFar,t.shadowCameraFov=this.shadowCameraFov,t.shadowCameraVisible=this.shadowCameraVisible,t.shadowBias=this.shadowBias,t.shadowDarkness=this.shadowDarkness,t.shadowMapWidth=this.shadowMapWidth,t.shadowMapHeight=this.shadowMapHeight,t},THREE.Cache={files:{},add:function(t,e){this.files[t]=e},get:function(t){return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},THREE.Loader=function(t){this.showStatus=t,this.statusDomElement=t?THREE.Loader.prototype.addStatusElement():null,this.imageLoader=new THREE.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function(){var t=document.createElement("div");return t.style.position="absolute",t.style.right="0px",t.style.top="0px",t.style.fontSize="0.8em",t.style.textAlign="left",t.style.background="rgba(0,0,0,0.25)",t.style.color="#fff",t.style.width="120px",t.style.padding="0.5em 0.5em 0.5em 0.5em",t.style.zIndex=1e3,t.innerHTML="Loading ...",t},updateProgress:function(t){var e="Loaded ";e+=t.total?(100*t.loaded/t.total).toFixed(0)+"%":(t.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=e},extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e){for(var n=[],r=0;re;e++){var r=t[e];if(r instanceof THREE.ShaderMaterial)return!0}return!1},createMaterial:function(t,e){function n(t){var e=Math.log(t)/Math.LN2;return Math.pow(2,Math.round(e))}function r(t,r,i,s,a,u,h){var l,c=e+i,p=THREE.Loader.Handlers.get(c);if(null!==p?l=p.load(c):(l=new THREE.Texture,p=o.imageLoader,p.crossOrigin=o.crossOrigin,p.load(c,function(t){if(THREE.Math.isPowerOfTwo(t.width)===!1||THREE.Math.isPowerOfTwo(t.height)===!1){var e=n(t.width),r=n(t.height),i=document.createElement("canvas");i.width=e,i.height=r;var o=i.getContext("2d");o.drawImage(t,0,0,e,r),l.image=i}else l.image=t;l.needsUpdate=!0})),l.sourceFile=i,s&&(l.repeat.set(s[0],s[1]),1!==s[0]&&(l.wrapS=THREE.RepeatWrapping),1!==s[1]&&(l.wrapT=THREE.RepeatWrapping)),a&&l.offset.set(a[0],a[1]),u){var f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};void 0!==f[u[0]]&&(l.wrapS=f[u[0]]),void 0!==f[u[1]]&&(l.wrapT=f[u[1]])}h&&(l.anisotropy=h),t[r]=l}function i(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]}var o=this,s="MeshLambertMaterial",a={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(t.shading){var u=t.shading.toLowerCase();"phong"===u?s="MeshPhongMaterial":"basic"===u&&(s="MeshBasicMaterial")}void 0!==t.blending&&void 0!==THREE[t.blending]&&(a.blending=THREE[t.blending]),void 0!==t.transparent&&(a.transparent=t.transparent),void 0!==t.opacity&&t.opacity<1&&(a.transparent=!0),void 0!==t.depthTest&&(a.depthTest=t.depthTest),void 0!==t.depthWrite&&(a.depthWrite=t.depthWrite),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.flipSided&&(a.side=THREE.BackSide),void 0!==t.doubleSided&&(a.side=THREE.DoubleSide),void 0!==t.wireframe&&(a.wireframe=t.wireframe),void 0!==t.vertexColors&&("face"===t.vertexColors?a.vertexColors=THREE.FaceColors:t.vertexColors&&(a.vertexColors=THREE.VertexColors)),t.colorDiffuse?a.color=i(t.colorDiffuse):t.DbgColor&&(a.color=t.DbgColor),t.colorSpecular&&(a.specular=i(t.colorSpecular)),t.colorEmissive&&(a.emissive=i(t.colorEmissive)),void 0!==t.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),t.opacity=t.transparency),void 0!==t.opacity&&(a.opacity=t.opacity),t.specularCoef&&(a.shininess=t.specularCoef),t.mapDiffuse&&e&&r(a,"map",t.mapDiffuse,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy),t.mapLight&&e&&r(a,"lightMap",t.mapLight,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy),t.mapBump&&e&&r(a,"bumpMap",t.mapBump,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy),t.mapNormal&&e&&r(a,"normalMap",t.mapNormal,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy),t.mapSpecular&&e&&r(a,"specularMap",t.mapSpecular,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy),t.mapAlpha&&e&&r(a,"alphaMap",t.mapAlpha,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy),t.mapBumpScale&&(a.bumpScale=t.mapBumpScale),t.mapNormalFactor&&(a.normalScale=new THREE.Vector2(t.mapNormalFactor,t.mapNormalFactor));var h=new THREE[s](a);return void 0!==t.DbgName&&(h.name=t.DbgName),h}},THREE.Loader.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=0,n=this.handlers.length;n>e;e+=2){var r=this.handlers[e],i=this.handlers[e+1];if(r.test(t))return i}return null}},THREE.XHRLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(t,e,n,r){var i=this,o=THREE.Cache.get(t);if(void 0!==o)return void(e&&e(o));var s=new XMLHttpRequest;s.open("GET",t,!0),s.addEventListener("load",function(n){THREE.Cache.add(t,this.response),e&&e(this.response),i.manager.itemEnd(t)},!1),void 0!==n&&s.addEventListener("progress",function(t){n(t)},!1),void 0!==r&&s.addEventListener("error",function(t){r(t)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(s.responseType=this.responseType),s.send(null),i.manager.itemStart(t)},setResponseType:function(t){this.responseType=t},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.ImageLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(t,e,n,r){var i=this,o=THREE.Cache.get(t);if(void 0!==o)return void e(o);var s=document.createElement("img");return s.addEventListener("load",function(n){THREE.Cache.add(t,this),e&&e(this),i.manager.itemEnd(t)},!1),void 0!==n&&s.addEventListener("progress",function(t){n(t)},!1),void 0!==r&&s.addEventListener("error",function(t){r(t)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),s.src=t,i.manager.itemStart(t),s},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.JSONLoader=function(t){THREE.Loader.call(this,t),this.withCredentials=!1},THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype),THREE.JSONLoader.prototype.constructor=THREE.JSONLoader,THREE.JSONLoader.prototype.load=function(t,e,n){n=n&&"string"==typeof n?n:this.extractUrlBase(t),this.onLoadStart(),this.loadAjaxJSON(this,t,e,n)},THREE.JSONLoader.prototype.loadAjaxJSON=function(t,e,n,r,i){var o=new XMLHttpRequest,s=0;o.onreadystatechange=function(){if(o.readyState===o.DONE)if(200===o.status||0===o.status){if(o.responseText){var a=JSON.parse(o.responseText),u=a.metadata;if(void 0!==u){if("object"===u.type)return void THREE.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===u.type)return void THREE.error("THREE.JSONLoader: "+e+" seems to be a Scene. Use THREE.SceneLoader instead.")}var h=t.parse(a,r);n(h.geometry,h.materials)}else THREE.error("THREE.JSONLoader: "+e+" seems to be unreachable or the file is empty.");t.onLoadComplete()}else THREE.error("THREE.JSONLoader: Couldn't load "+e+" ("+o.status+")");else o.readyState===o.LOADING?i&&(0===s&&(s=o.getResponseHeader("Content-Length")),i({total:s,loaded:o.responseText.length})):o.readyState===o.HEADERS_RECEIVED&&void 0!==i&&(s=o.getResponseHeader("Content-Length"))},o.open("GET",e,!0),o.withCredentials=this.withCredentials,o.send(null)},THREE.JSONLoader.prototype.parse=function(t,e){function n(e){function n(t,e){return t&1<r;r++)o.faceVertexUvs[r]=[]}for(a=0,u=P.length;u>a;)b=new THREE.Vector3,b.x=P[a++]*e,b.y=P[a++]*e,b.z=P[a++]*e,o.vertices.push(b);for(a=0,u=C.length;u>a;)if(f=C[a++],d=n(f,0),m=n(f,1),v=n(f,3),g=n(f,4),E=n(f,5),y=n(f,6),_=n(f,7),d){if(x=new THREE.Face3,x.a=C[a],x.b=C[a+1],x.c=C[a+3],w=new THREE.Face3,w.a=C[a+1],w.b=C[a+2],w.c=C[a+3],a+=4,m&&(p=C[a++],x.materialIndex=p,w.materialIndex=p),s=o.faces.length,v)for(r=0;O>r;r++)for(M=t.uvs[r],o.faceVertexUvs[r][s]=[],o.faceVertexUvs[r][s+1]=[],i=0;4>i;i++)c=C[a++],k=M[2*c],A=M[2*c+1],S=new THREE.Vector2(k,A),2!==i&&o.faceVertexUvs[r][s].push(S),0!==i&&o.faceVertexUvs[r][s+1].push(S);if(g&&(l=3*C[a++],x.normal.set(L[l++],L[l++],L[l]),w.normal.copy(x.normal)),E)for(r=0;4>r;r++)l=3*C[a++],H=new THREE.Vector3(L[l++],L[l++],L[l]),2!==r&&x.vertexNormals.push(H),0!==r&&w.vertexNormals.push(H);if(y&&(h=C[a++],R=z[h],x.color.setHex(R),w.color.setHex(R)),_)for(r=0;4>r;r++)h=C[a++],R=z[h],2!==r&&x.vertexColors.push(new THREE.Color(R)),0!==r&&w.vertexColors.push(new THREE.Color(R));o.faces.push(x),o.faces.push(w)}else{if(T=new THREE.Face3,T.a=C[a++],T.b=C[a++],T.c=C[a++],m&&(p=C[a++],T.materialIndex=p),s=o.faces.length,v)for(r=0;O>r;r++)for(M=t.uvs[r],o.faceVertexUvs[r][s]=[],i=0;3>i;i++)c=C[a++],k=M[2*c],A=M[2*c+1],S=new THREE.Vector2(k,A),o.faceVertexUvs[r][s].push(S);if(g&&(l=3*C[a++],T.normal.set(L[l++],L[l++],L[l])),E)for(r=0;3>r;r++)l=3*C[a++],H=new THREE.Vector3(L[l++],L[l++],L[l]),T.vertexNormals.push(H);if(y&&(h=C[a++],T.color.setHex(z[h])),_)for(r=0;3>r;r++)h=C[a++],T.vertexColors.push(new THREE.Color(z[h]));o.faces.push(T)}}function r(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var n=0,r=t.skinWeights.length;r>n;n+=e){var i=t.skinWeights[n],s=e>1?t.skinWeights[n+1]:0,a=e>2?t.skinWeights[n+2]:0,u=e>3?t.skinWeights[n+3]:0;o.skinWeights.push(new THREE.Vector4(i,s,a,u))}if(t.skinIndices)for(var n=0,r=t.skinIndices.length;r>n;n+=e){var h=t.skinIndices[n],l=e>1?t.skinIndices[n+1]:0,c=e>2?t.skinIndices[n+2]:0,p=e>3?t.skinIndices[n+3]:0;o.skinIndices.push(new THREE.Vector4(h,l,c,p))}o.bones=t.bones,o.bones&&o.bones.length>0&&(o.skinWeights.length!==o.skinIndices.length||o.skinIndices.length!==o.vertices.length)&&THREE.warn("THREE.JSONLoader: When skinning, number of vertices ("+o.vertices.length+"), skinIndices ("+o.skinIndices.length+"), and skinWeights ("+o.skinWeights.length+") should match."),o.animation=t.animation,o.animations=t.animations}function i(e){if(void 0!==t.morphTargets){var n,r,i,s,a,u;for(n=0,r=t.morphTargets.length;r>n;n++)for(o.morphTargets[n]={},o.morphTargets[n].name=t.morphTargets[n].name,o.morphTargets[n].vertices=[],a=o.morphTargets[n].vertices,u=t.morphTargets[n].vertices,i=0,s=u.length;s>i;i+=3){var h=new THREE.Vector3;h.x=u[i]*e,h.y=u[i+1]*e,h.z=u[i+2]*e,a.push(h)}}if(void 0!==t.morphColors){var n,r,l,c,p,f,d;for(n=0,r=t.morphColors.length;r>n;n++)for(o.morphColors[n]={}, +o.morphColors[n].name=t.morphColors[n].name,o.morphColors[n].colors=[],p=o.morphColors[n].colors,f=t.morphColors[n].colors,l=0,c=f.length;c>l;l+=3)d=new THREE.Color(16755200),d.setRGB(f[l],f[l+1],f[l+2]),p.push(d)}}var o=new THREE.Geometry,s=void 0!==t.scale?1/t.scale:1;if(n(s),r(),i(s),o.computeFaceNormals(),o.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:o};var a=this.initMaterials(t.materials,e);return this.needsTangents(a)&&o.computeTangents(),{geometry:o,materials:a}},THREE.LoadingManager=function(t,e,n){var r=this,i=0,o=0;this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++},this.itemEnd=function(t){i++,void 0!==r.onProgress&&r.onProgress(t,i,o),i===o&&void 0!==r.onLoad&&r.onLoad()}},THREE.DefaultLoadingManager=new THREE.LoadingManager,THREE.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(t,e,n,r){var i=this,o=new THREE.XHRLoader(i.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){e(i.parse(JSON.parse(t)))},n,r)},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t){var e=new THREE.BufferGeometry,n=t.data.attributes;for(var r in n){var i=n[r],o=new self[i.type](i.array);e.addAttribute(r,new THREE.BufferAttribute(o,i.itemSize))}var s=t.data.offsets;void 0!==s&&(e.offsets=JSON.parse(JSON.stringify(s)));var a=t.data.boundingSphere;if(void 0!==a){var u=new THREE.Vector3;void 0!==a.center&&u.fromArray(a.center),e.boundingSphere=new THREE.Sphere(u,a.radius)}return e}},THREE.MaterialLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(t,e,n,r){var i=this,o=new THREE.XHRLoader(i.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){e(i.parse(JSON.parse(t)))},n,r)},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t){var e=new THREE[t.type];if(void 0!==t.color&&e.color.setHex(t.color),void 0!==t.emissive&&e.emissive.setHex(t.emissive),void 0!==t.specular&&e.specular.setHex(t.specular),void 0!==t.shininess&&(e.shininess=t.shininess),void 0!==t.uniforms&&(e.uniforms=t.uniforms),void 0!==t.vertexShader&&(e.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(e.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(e.vertexColors=t.vertexColors),void 0!==t.shading&&(e.shading=t.shading),void 0!==t.blending&&(e.blending=t.blending),void 0!==t.side&&(e.side=t.side),void 0!==t.opacity&&(e.opacity=t.opacity),void 0!==t.transparent&&(e.transparent=t.transparent),void 0!==t.wireframe&&(e.wireframe=t.wireframe),void 0!==t.size&&(e.size=t.size),void 0!==t.sizeAttenuation&&(e.sizeAttenuation=t.sizeAttenuation),void 0!==t.materials)for(var n=0,r=t.materials.length;r>n;n++)e.materials.push(this.parse(t.materials[n]));return e}},THREE.ObjectLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager,this.texturePath=""},THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(t,e,n,r){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var i=this,o=new THREE.XHRLoader(i.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){i.parse(JSON.parse(t),e)},n,r)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),r=this.parseImages(t.images,function(){void 0!==e&&e(s)}),i=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,i),s=this.parseObject(t.object,n,o);return(void 0===t.images||0===t.images.length)&&void 0!==e&&e(s),s},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new THREE.JSONLoader,r=new THREE.BufferGeometryLoader,i=0,o=t.length;o>i;i++){var s,a=t[i];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new THREE[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"CubeGeometry":s=new THREE.BoxGeometry(a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":s=new THREE.CircleGeometry(a.radius,a.segments);break;case"CylinderGeometry":s=new THREE.CylinderGeometry(a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded);break;case"SphereGeometry":s=new THREE.SphereGeometry(a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"IcosahedronGeometry":s=new THREE.IcosahedronGeometry(a.radius,a.detail);break;case"TorusGeometry":s=new THREE.TorusGeometry(a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":s=new THREE.TorusKnotGeometry(a.radius,a.tube,a.radialSegments,a.tubularSegments,a.p,a.q,a.heightScale);break;case"BufferGeometry":s=r.parse(a);break;case"Geometry":s=n.parse(a.data).geometry}s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),e[a.uuid]=s}return e},parseMaterials:function(t,e){var n={};if(void 0!==t)for(var r=function(t){return void 0===e[t]&&THREE.warn("THREE.ObjectLoader: Undefined texture",t),e[t]},i=new THREE.MaterialLoader,o=0,s=t.length;s>o;o++){var a=t[o],u=i.parse(a);u.uuid=a.uuid,void 0!==a.name&&(u.name=a.name),void 0!==a.map&&(u.map=r(a.map)),void 0!==a.bumpMap&&(u.bumpMap=r(a.bumpMap),a.bumpScale&&(u.bumpScale=new THREE.Vector2(a.bumpScale,a.bumpScale))),void 0!==a.alphaMap&&(u.alphaMap=r(a.alphaMap)),void 0!==a.envMap&&(u.envMap=r(a.envMap)),void 0!==a.normalMap&&(u.normalMap=r(a.normalMap),a.normalScale&&(u.normalScale=new THREE.Vector2(a.normalScale,a.normalScale))),void 0!==a.lightMap&&(u.lightMap=r(a.lightMap)),void 0!==a.specularMap&&(u.specularMap=r(a.specularMap)),n[a.uuid]=u}return n},parseImages:function(t,e){var n=this,r={};if(void 0!==t&&t.length>0){var i=new THREE.LoadingManager(e),o=new THREE.ImageLoader(i);o.setCrossOrigin(this.crossOrigin);for(var s=function(t){return n.manager.itemStart(t),o.load(t,function(){n.manager.itemEnd(t)})},a=0,u=t.length;u>a;a++){var h=t[a],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h.url)?h.url:n.texturePath+h.url;r[h.uuid]=s(l)}}return r},parseTextures:function(t,e){var n={};if(void 0!==t)for(var r=0,i=t.length;i>r;r++){var o=t[r];void 0===o.image&&THREE.warn('THREE.ObjectLoader: No "image" speficied for',o.uuid),void 0===e[o.image]&&THREE.warn("THREE.ObjectLoader: Undefined image",o.image);var s=new THREE.Texture(e[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.repeat&&(s.repeat=new THREE.Vector2(o.repeat[0],o.repeat[1])),void 0!==o.minFilter&&(s.minFilter=THREE[o.minFilter]),void 0!==o.magFilter&&(s.magFilter=THREE[o.magFilter]),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),o.wrap instanceof Array&&(s.wrapS=THREE[o.wrap[0]],s.wrapT=THREE[o.wrap[1]]),n[o.uuid]=s}return n},parseObject:function(){var t=new THREE.Matrix4;return function(e,n,r){var i,o=function(t){return void 0===n[t]&&THREE.warn("THREE.ObjectLoader: Undefined geometry",t),n[t]},s=function(t){return void 0===r[t]&&THREE.warn("THREE.ObjectLoader: Undefined material",t),r[t]};switch(e.type){case"Scene":i=new THREE.Scene;break;case"PerspectiveCamera":i=new THREE.PerspectiveCamera(e.fov,e.aspect,e.near,e.far);break;case"OrthographicCamera":i=new THREE.OrthographicCamera(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":i=new THREE.AmbientLight(e.color);break;case"DirectionalLight":i=new THREE.DirectionalLight(e.color,e.intensity);break;case"PointLight":i=new THREE.PointLight(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":i=new THREE.SpotLight(e.color,e.intensity,e.distance,e.angle,e.exponent,e.decay);break;case"HemisphereLight":i=new THREE.HemisphereLight(e.color,e.groundColor,e.intensity);break;case"Mesh":i=new THREE.Mesh(o(e.geometry),s(e.material));break;case"Line":i=new THREE.Line(o(e.geometry),s(e.material),e.mode);break;case"PointCloud":i=new THREE.PointCloud(o(e.geometry),s(e.material));break;case"Sprite":i=new THREE.Sprite(s(e.material));break;case"Group":i=new THREE.Group;break;default:i=new THREE.Object3D}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.children)for(var a in e.children)i.add(this.parseObject(e.children[a],n,r));return i}}()},THREE.TextureLoader=function(t){this.manager=void 0!==t?t:THREE.DefaultLoadingManager},THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(t,e,n,r){var i=this,o=new THREE.ImageLoader(i.manager);o.setCrossOrigin(this.crossOrigin),o.load(t,function(t){var n=new THREE.Texture(t);n.needsUpdate=!0,void 0!==e&&e(n)},n,r)},setCrossOrigin:function(t){this.crossOrigin=t}},THREE.DataTextureLoader=THREE.BinaryTextureLoader=function(){this._parser=null},THREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(t,e,n,r){var i=this,o=new THREE.DataTexture,s=new THREE.XHRLoader;return s.setResponseType("arraybuffer"),s.load(t,function(t){var n=i._parser(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:THREE.ClampToEdgeWrapping,o.wrapT=void 0!==n.wrapT?n.wrapT:THREE.ClampToEdgeWrapping,o.magFilter=void 0!==n.magFilter?n.magFilter:THREE.LinearFilter,o.minFilter=void 0!==n.minFilter?n.minFilter:THREE.LinearMipMapLinearFilter,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps),1===n.mipmapCount&&(o.minFilter=THREE.LinearFilter),o.needsUpdate=!0,e&&e(o,n))},n,r),o}},THREE.CompressedTextureLoader=function(){this._parser=null},THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(t,e,n){var r=this,i=[],o=new THREE.CompressedTexture;o.image=i;var s=new THREE.XHRLoader;if(s.setResponseType("arraybuffer"),t instanceof Array)for(var a=0,u=function(n){s.load(t[n],function(t){var s=r._parser(t,!0);i[n]={width:s.width,height:s.height,format:s.format,mipmaps:s.mipmaps},a+=1,6===a&&(1==s.mipmapCount&&(o.minFilter=THREE.LinearFilter),o.format=s.format,o.needsUpdate=!0,e&&e(o))})},h=0,l=t.length;l>h;++h)u(h);else s.load(t,function(t){var n=r._parser(t,!0);if(n.isCubemap)for(var s=n.mipmaps.length/n.mipmapCount,a=0;s>a;a++){i[a]={mipmaps:[]};for(var u=0;ue;e++)t.materials.push(this.materials[e].toJSON());return t},clone:function(){for(var t=new THREE.MeshFaceMaterial,e=0;es){var u=e.closestPointToPoint(t);u.applyMatrix4(i.matrixWorld);var h=n.ray.origin.distanceTo(u);r.push({distance:h,distanceToRay:s,point:u.clone(),index:o,face:null,object:i})}};if(o instanceof THREE.BufferGeometry){var l=o.attributes,c=l.position.array;if(void 0!==l.index){var p=l.index.array,f=o.offsets;if(0===f.length){var d={start:0,count:p.length,index:0};f=[d]}for(var m=0,v=f.length;v>m;++m)for(var g=f[m].start,E=f[m].count,y=f[m].index,_=g,b=g+E;b>_;_++){var T=y+p[_];u.fromArray(c,3*T),h(u,T)}}else for(var x=c.length/3,_=0;x>_;_++)u.set(c[3*_],c[3*_+1],c[3*_+2]),h(u,_)}else for(var w=this.geometry.vertices,_=0;_b;b+=p){var T=_+d[b],x=_+d[b+1];u.fromArray(m,3*T),h.fromArray(m,3*x);var w=e.distanceSqToSegment(u,h,c,l);if(!(w>s)){var R=e.origin.distanceTo(c);Rr.far||i.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:b,offsetIndex:g,face:null,faceIndex:null,object:this})}}}else for(var m=f.position.array,b=0;bs)){var R=e.origin.distanceTo(c);Rr.far||i.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(a instanceof THREE.Geometry)for(var H=a.vertices,M=H.length,b=0;M-1>b;b+=p){var w=e.distanceSqToSegment(H[b],H[b+1],c,l);if(!(w>s)){var R=e.origin.distanceTo(c);Rr.far||i.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),THREE.Line.prototype.clone=function(t){return void 0===t&&(t=new THREE.Line(this.geometry,this.material,this.mode)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.Mesh=function(t,e){THREE.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new THREE.Geometry,this.material=void 0!==e?e:new THREE.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.constructor=THREE.Mesh,THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var t=0,e=this.geometry.morphTargets.length;e>t;t++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[t].name]=t}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(THREE.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){var t=new THREE.Matrix4,e=new THREE.Ray,n=new THREE.Sphere,r=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3;return function(s,a){var u=this.geometry;if(null===u.boundingSphere&&u.computeBoundingSphere(),n.copy(u.boundingSphere),n.applyMatrix4(this.matrixWorld),s.ray.isIntersectionSphere(n)!==!1&&(t.getInverse(this.matrixWorld),e.copy(s.ray).applyMatrix4(t),null===u.boundingBox||e.isIntersectionBox(u.boundingBox)!==!1))if(u instanceof THREE.BufferGeometry){var h=this.material;if(void 0===h)return;var l,c,p,f=u.attributes,d=s.precision;if(void 0!==f.index){var m=f.index.array,v=f.position.array,g=u.offsets;0===g.length&&(g=[{start:0,count:m.length,index:0}]);for(var E=0,y=g.length;y>E;++E)for(var _=g[E].start,b=g[E].count,T=g[E].index,x=_,w=_+b;w>x;x+=3){if(l=T+m[x],c=T+m[x+1],p=T+m[x+2],r.fromArray(v,3*l),i.fromArray(v,3*c),o.fromArray(v,3*p),h.side===THREE.BackSide)var R=e.intersectTriangle(o,i,r,!0);else var R=e.intersectTriangle(r,i,o,h.side!==THREE.DoubleSide);if(null!==R){R.applyMatrix4(this.matrixWorld);var H=s.ray.origin.distanceTo(R);d>H||Hs.far||a.push({distance:H,point:R,face:new THREE.Face3(l,c,p,THREE.Triangle.normal(r,i,o)),faceIndex:null,object:this})}}}else for(var v=f.position.array,x=0,M=0,w=v.length;w>x;x+=3,M+=9){if(l=x,c=x+1,p=x+2,r.fromArray(v,M),i.fromArray(v,M+3),o.fromArray(v,M+6),h.side===THREE.BackSide)var R=e.intersectTriangle(o,i,r,!0);else var R=e.intersectTriangle(r,i,o,h.side!==THREE.DoubleSide);if(null!==R){R.applyMatrix4(this.matrixWorld);var H=s.ray.origin.distanceTo(R);d>H||Hs.far||a.push({distance:H,point:R,face:new THREE.Face3(l,c,p,THREE.Triangle.normal(r,i,o)),faceIndex:null,object:this})}}}else if(u instanceof THREE.Geometry)for(var l,c,p,S=this.material instanceof THREE.MeshFaceMaterial,k=S===!0?this.material.materials:null,d=s.precision,A=u.vertices,C=0,P=u.faces.length;P>C;C++){var L=u.faces[C],h=S===!0?k[L.materialIndex]:this.material;if(void 0!==h){if(l=A[L.a],c=A[L.b],p=A[L.c],h.morphTargets===!0){var z=u.morphTargets,O=this.morphTargetInfluences;r.set(0,0,0),i.set(0,0,0),o.set(0,0,0);for(var D=0,F=z.length;F>D;D++){var U=O[D];if(0!==U){var B=z[D].vertices;r.x+=(B[L.a].x-l.x)*U,r.y+=(B[L.a].y-l.y)*U,r.z+=(B[L.a].z-l.z)*U,i.x+=(B[L.b].x-c.x)*U,i.y+=(B[L.b].y-c.y)*U,i.z+=(B[L.b].z-c.z)*U,o.x+=(B[L.c].x-p.x)*U,o.y+=(B[L.c].y-p.y)*U,o.z+=(B[L.c].z-p.z)*U}}r.add(l),i.add(c),o.add(p),l=r,c=i,p=o}if(h.side===THREE.BackSide)var R=e.intersectTriangle(p,c,l,!0);else var R=e.intersectTriangle(l,c,p,h.side!==THREE.DoubleSide);if(null!==R){R.applyMatrix4(this.matrixWorld);var H=s.ray.origin.distanceTo(R);d>H||Hs.far||a.push({distance:H,point:R,face:L,faceIndex:C,object:this})}}}}}(),THREE.Mesh.prototype.clone=function(t,e){return void 0===t&&(t=new THREE.Mesh(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,t,e),t},THREE.Bone=function(t){THREE.Object3D.call(this),this.type="Bone",this.skin=t},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Bone.prototype.constructor=THREE.Bone,THREE.Skeleton=function(t,e,n){if(this.useVertexTexture=void 0!==n?n:!0,this.identityMatrix=new THREE.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var r;r=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16:8,this.boneTextureWidth=r,this.boneTextureHeight=r,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{THREE.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var i=0,o=this.bones.length;o>i;i++)this.boneInverses.push(new THREE.Matrix4)}},THREE.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,e=this.bones.length;e>t;t++){var n=new THREE.Matrix4;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},THREE.Skeleton.prototype.pose=function(){for(var t,e=0,n=this.bones.length;n>e;e++)t=this.bones[e],t&&t.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,n=this.bones.length;n>e;e++)t=this.bones[e],t&&(t.parent?(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))},THREE.Skeleton.prototype.update=function(){var t=new THREE.Matrix4;return function(){for(var e=0,n=this.bones.length;n>e;e++){var r=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(r,this.boneInverses[e]),t.flattenToArrayOffset(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),THREE.SkinnedMesh=function(t,e,n){THREE.Mesh.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new THREE.Matrix4,this.bindMatrixInverse=new THREE.Matrix4;var r=[];if(this.geometry&&void 0!==this.geometry.bones){for(var i,o,s,a,u,h=0,l=this.geometry.bones.length;l>h;++h)o=this.geometry.bones[h],s=o.pos,a=o.rotq,u=o.scl,i=new THREE.Bone(this),r.push(i),i.name=o.name,i.position.set(s[0],s[1],s[2]),i.quaternion.set(a[0],a[1],a[2],a[3]),void 0!==u?i.scale.set(u[0],u[1],u[2]):i.scale.set(1,1,1);for(var h=0,l=this.geometry.bones.length;l>h;++h)o=this.geometry.bones[h],-1!==o.parent?r[o.parent].add(r[h]):this.add(r[h])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new THREE.Skeleton(r,void 0,n))},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh,THREE.SkinnedMesh.prototype.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},THREE.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var t=0;ti;i++){var s=t.morphTargets[i],a=s.name.match(r);if(a&&a.length>1){var u=a[1];n[u]||(n[u]={start:1/0,end:-(1/0)});var h=n[u];ih.end&&(h.end=i),e||(e=u)}}t.firstAnimation=e},THREE.MorphAnimMesh.prototype.setAnimationLabel=function(t,e,n){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[t]={start:e,end:n}},THREE.MorphAnimMesh.prototype.playAnimation=function(t,e){var n=this.geometry.animations[t];n?(this.setFrameRange(n.start,n.end),this.duration=1e3*((n.end-n.start)/e),this.time=0):THREE.warn("THREE.MorphAnimMesh: animation["+t+"] undefined in .playAnimation()")},THREE.MorphAnimMesh.prototype.updateAnimation=function(t){var e=this.duration/this.length;this.time+=this.direction*t,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var n=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/e),0,this.length-1);n!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[n]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=n);var r=this.time%e/e;this.directionBackwards&&(r=1-r),this.morphTargetInfluences[this.currentKeyframe]=r,this.morphTargetInfluences[this.lastKeyframe]=1-r},THREE.MorphAnimMesh.prototype.interpolateTargets=function(t,e,n){for(var r=this.morphTargetInfluences,i=0,o=r.length;o>i;i++)r[i]=0;t>-1&&(r[t]=1-n),e>-1&&(r[e]=n)},THREE.MorphAnimMesh.prototype.clone=function(t){return void 0===t&&(t=new THREE.MorphAnimMesh(this.geometry,this.material)),t.duration=this.duration,t.mirroredLoop=this.mirroredLoop,t.time=this.time,t.lastKeyframe=this.lastKeyframe,t.currentKeyframe=this.currentKeyframe,t.direction=this.direction,t.directionBackwards=this.directionBackwards,THREE.Mesh.prototype.clone.call(this,t),t},THREE.LOD=function(){THREE.Object3D.call(this),this.objects=[]},THREE.LOD.prototype=Object.create(THREE.Object3D.prototype),THREE.LOD.prototype.constructor=THREE.LOD,THREE.LOD.prototype.addLevel=function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=0;ne&&!(t1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);this.objects[0].object.visible=!0;for(var i=1,o=this.objects.length;o>i&&r>=this.objects[i].distance;i++)this.objects[i-1].object.visible=!1,this.objects[i].object.visible=!0;for(;o>i;i++)this.objects[i].object.visible=!1}}}(),THREE.LOD.prototype.clone=function(t){void 0===t&&(t=new THREE.LOD),THREE.Object3D.prototype.clone.call(this,t);for(var e=0,n=this.objects.length;n>e;e++){var r=this.objects[e].object.clone();r.visible=0===e,t.addLevel(r,this.objects[e].distance)}return t},THREE.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),e=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),n=new Float32Array([0,0,1,0,1,1,0,1]),r=new THREE.BufferGeometry;return r.addAttribute("index",new THREE.BufferAttribute(t,1)),r.addAttribute("position",new THREE.BufferAttribute(e,3)),r.addAttribute("uv",new THREE.BufferAttribute(n,2)),function(t){THREE.Object3D.call(this),this.type="Sprite",this.geometry=r,this.material=void 0!==t?t:new THREE.SpriteMaterial}}(),THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.constructor=THREE.Sprite,THREE.Sprite.prototype.raycast=function(){var t=new THREE.Vector3;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var r=e.ray.distanceToPoint(t);r>this.scale.x||n.push({distance:r,point:this.position,face:null,object:this})}}(),THREE.Sprite.prototype.clone=function(t){return void 0===t&&(t=new THREE.Sprite(this.material)),THREE.Object3D.prototype.clone.call(this,t),t},THREE.Particle=THREE.Sprite,THREE.LensFlare=function(t,e,n,r,i){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new THREE.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.constructor=THREE.LensFlare,THREE.LensFlare.prototype.add=function(t,e,n,r,i,o){void 0===e&&(e=-1),void 0===n&&(n=0),void 0===o&&(o=1),void 0===i&&(i=new THREE.Color(16777215)),void 0===r&&(r=THREE.NormalBlending),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:t,size:e,distance:n,x:0,y:0,z:0,scale:1,rotation:1,opacity:o,color:i,blending:r})},THREE.LensFlare.prototype.updateLensFlares=function(){var t,e,n=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(t=0;n>t;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+r*e.distance,e.y=this.positionScreen.y+i*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)},THREE.Scene=function(){THREE.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.constructor=THREE.Scene,THREE.Scene.prototype.clone=function(t){return void 0===t&&(t=new THREE.Scene),THREE.Object3D.prototype.clone.call(this,t),null!==this.fog&&(t.fog=this.fog.clone()),null!==this.overrideMaterial&&(t.overrideMaterial=this.overrideMaterial.clone()),t.autoUpdate=this.autoUpdate,t.matrixAutoUpdate=this.matrixAutoUpdate,t},THREE.Fog=function(t,e,n){this.name="",this.color=new THREE.Color(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3},THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)},THREE.FogExp2=function(t,e){this.name="",this.color=new THREE.Color(t),this.density=void 0!==e?e:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.ShaderChunk={},THREE.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n float distance = dot( planeNormal, point-pointOnPlane );\n return point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n if ( decayExponent > 0.0 ) {\n return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n }\n return 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\n",THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, dirVector );\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n #endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n float dotProduct = dot( transformedNormal, lVector );\n\n vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float dotProduct = dot( transformedNormal, lVector );\n vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, lVector );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n vLightBack += ambientLightColor;\n\n#endif\n",THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n\n#endif\n",THREE.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n #ifdef USE_MORPHNORMALS\n\n vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n #else\n\n vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n #endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif",THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n\n#endif",THREE.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n totalDiffuseLight += hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\n#ifdef METAL\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n", +THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif",THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n vec3 morphedNormal = vec3( 0.0 );\n\n morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n morphedNormal += normal;\n\n#endif",THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n uniform sampler2D lightMap;\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif",THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n vUv2 = uv2;\n\n#endif",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n vColor.xyz = inputToLinear( color.xyz );\n\n#endif",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n #ifdef USE_MORPHTARGETS\n\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n #endif\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",THREE.ShaderChunk.linear_to_gamma_fragment="\n outgoingLight = linearToOutput( outgoingLight );\n",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n",THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n",THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n // Transforming Normal Vectors with the Inverse Transformation\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n\n envColor.xyz = inputToLinear( envColor.xyz );\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n",THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif",THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif",THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif",THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif",THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n fogFactor = whiteCompliment( fogFactor );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n",THREE.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n vec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n vec3 objectNormal = morphedNormal;\n\n#else\n\n vec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n",THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n outgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n diffuseColor.rgb *= vColor;\n\n#endif",THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n vec3 morphed = vec3( 0.0 );\n morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n morphed += position;\n\n#endif",THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n",THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n #ifdef SHADOWMAP_DEBUG\n\n vec3 frustumColors[3];\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n #endif\n\n #ifdef SHADOWMAP_CASCADE\n\n int inFrustumCount = 0;\n\n #endif\n\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n // don't shadow pixels outside of light frustum\n // use just first frustum (for cascades)\n // don't shadow pixels behind far plane of light frustum\n\n #ifdef SHADOWMAP_CASCADE\n\n inFrustumCount += int( inFrustum );\n bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n #else\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n #endif\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n shadowCoord.z += shadowBias[ i ];\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n /*\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n // must enroll loop manually\n\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n\n }\n\n shadow /= 9.0;\n\n */\n\n const float shadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.25 * xPixelOffset;\n float dy0 = -1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.0 * xPixelOffset;\n float dy0 = -1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n shadowKernel[0] *= vec3(0.25);\n\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n shadowKernel[1] *= vec3(0.25);\n\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n shadowKernel[2] *= vec3(0.25);\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) );\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #else\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n\n // spot with multiple shadows is darker\n\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n // spot with multiple shadows has the same color as single shadow spot\n\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n #endif\n\n }\n\n\n #ifdef SHADOWMAP_DEBUG\n\n #ifdef SHADOWMAP_CASCADE\n\n if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n #else\n\n if ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n #endif\n\n #endif\n\n }\n\n // NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n shadowColor = inputToLinear( shadowColor );\n\n outgoingLight = outgoingLight * shadowColor;\n\n#endif\n",THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #elif defined( USE_MORPHTARGETS )\n\n vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n #endif\n\n#endif\n",THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n#endif",THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n #extension GL_EXT_frag_depth : enable\n varying float vFragDepth;\n\n #endif\n\n#endif",THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n",THREE.UniformsUtils={merge:function(t){for(var e={},n=0;n dashSize ) {"," discard;"," }"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment," outgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",THREE.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].join("\n")}},THREE.WebGLRenderer=function(t){function e(t){t.__webglVertexBuffer=At.createBuffer(),t.__webglColorBuffer=At.createBuffer(),Ct.info.memory.geometries++}function n(t){t.__webglVertexBuffer=At.createBuffer(),t.__webglColorBuffer=At.createBuffer(),t.__webglLineDistanceBuffer=At.createBuffer(),Ct.info.memory.geometries++}function r(t){t.__webglVertexBuffer=At.createBuffer(),t.__webglNormalBuffer=At.createBuffer(),t.__webglTangentBuffer=At.createBuffer(),t.__webglColorBuffer=At.createBuffer(),t.__webglUVBuffer=At.createBuffer(),t.__webglUV2Buffer=At.createBuffer(),t.__webglSkinIndicesBuffer=At.createBuffer(),t.__webglSkinWeightsBuffer=At.createBuffer(),t.__webglFaceBuffer=At.createBuffer(),t.__webglLineBuffer=At.createBuffer();var e=t.numMorphTargets;if(e){t.__webglMorphTargetsBuffers=[];for(var n=0,r=e;r>n;n++)t.__webglMorphTargetsBuffers.push(At.createBuffer())}var i=t.numMorphNormals;if(i){t.__webglMorphNormalsBuffers=[];for(var n=0,r=i;r>n;n++)t.__webglMorphNormalsBuffers.push(At.createBuffer())}Ct.info.memory.geometries++}function i(t){var e=t.geometry,n=t.material,r=e.vertices.length;if(n.attributes){void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]);for(var i in n.attributes){var o=n.attributes[i];if(!o.__webglInitialized||o.createUniqueBuffers){o.__webglInitialized=!0;var s=1;"v2"===o.type?s=2:"v3"===o.type?s=3:"v4"===o.type?s=4:"c"===o.type&&(s=3),o.size=s,o.array=new Float32Array(r*s),o.buffer=At.createBuffer(),o.buffer.belongsToAttribute=i,o.needsUpdate=!0}e.__webglCustomAttributesList.push(o)}}}function o(t,e){var n=t.vertices.length;t.__vertexArray=new Float32Array(3*n),t.__colorArray=new Float32Array(3*n),t.__webglParticleCount=n,i(e)}function s(t,e){var n=t.vertices.length;t.__vertexArray=new Float32Array(3*n),t.__colorArray=new Float32Array(3*n),t.__lineDistanceArray=new Float32Array(1*n),t.__webglLineCount=n,i(e)}function a(t,e){var n=e.geometry,r=t.faces3,i=3*r.length,o=1*r.length,s=3*r.length,a=u(e,t);t.__vertexArray=new Float32Array(3*i),t.__normalArray=new Float32Array(3*i),t.__colorArray=new Float32Array(3*i),t.__uvArray=new Float32Array(2*i),n.faceVertexUvs.length>1&&(t.__uv2Array=new Float32Array(2*i)),n.hasTangents&&(t.__tangentArray=new Float32Array(4*i)),e.geometry.skinWeights.length&&e.geometry.skinIndices.length&&(t.__skinIndexArray=new Float32Array(4*i),t.__skinWeightArray=new Float32Array(4*i));var h=null!==te.get("OES_element_index_uint")&&o>21845?Uint32Array:Uint16Array;t.__typeArray=h,t.__faceArray=new h(3*o),t.__lineArray=new h(2*s);var l=t.numMorphTargets;if(l){t.__morphTargetsArrays=[];for(var c=0,p=l;p>c;c++)t.__morphTargetsArrays.push(new Float32Array(3*i))}var f=t.numMorphNormals;if(f){t.__morphNormalsArrays=[];for(var c=0,p=f;p>c;c++)t.__morphNormalsArrays.push(new Float32Array(3*i))}if(t.__webglFaceCount=3*o,t.__webglLineCount=2*s,a.attributes){void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]);for(var d in a.attributes){var m=a.attributes[d],v={};for(var g in m)v[g]=m[g];if(!v.__webglInitialized||v.createUniqueBuffers){v.__webglInitialized=!0;var E=1;"v2"===v.type?E=2:"v3"===v.type?E=3:"v4"===v.type?E=4:"c"===v.type&&(E=3),v.size=E,v.array=new Float32Array(i*E),v.buffer=At.createBuffer(),v.buffer.belongsToAttribute=d,m.needsUpdate=!0,v.__original=m}t.__webglCustomAttributesList.push(v)}}t.__inittedArrays=!0}function u(t,e){return t.material instanceof THREE.MeshFaceMaterial?t.material.materials[e.materialIndex]:t.material}function h(t){return t instanceof THREE.MeshPhongMaterial==!1&&t.shading===THREE.FlatShading}function l(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d=t.vertices,m=d.length,v=t.colors,g=v.length,E=t.__vertexArray,y=t.__colorArray,_=t.verticesNeedUpdate,b=t.colorsNeedUpdate,T=t.__webglCustomAttributesList;if(_){for(r=0;m>r;r++)o=d[r],s=3*r,E[s]=o.x,E[s+1]=o.y,E[s+2]=o.z;At.bindBuffer(At.ARRAY_BUFFER,t.__webglVertexBuffer),At.bufferData(At.ARRAY_BUFFER,E,e)}if(b){for(i=0;g>i;i++)a=v[i],s=3*i,y[s]=a.r,y[s+1]=a.g,y[s+2]=a.b;At.bindBuffer(At.ARRAY_BUFFER,t.__webglColorBuffer),At.bufferData(At.ARRAY_BUFFER,y,e)}if(T)for(u=0,h=T.length;h>u;u++){if(f=T[u],f.needsUpdate&&(void 0===f.boundTo||"vertices"===f.boundTo))if(c=f.value.length,s=0,1===f.size)for(l=0;c>l;l++)f.array[l]=f.value[l];else if(2===f.size)for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.x,f.array[s+1]=p.y,s+=2;else if(3===f.size)if("c"===f.type)for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.r,f.array[s+1]=p.g,f.array[s+2]=p.b,s+=3;else for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.x,f.array[s+1]=p.y,f.array[s+2]=p.z,s+=3;else if(4===f.size)for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.x,f.array[s+1]=p.y,f.array[s+2]=p.z,f.array[s+3]=p.w,s+=4;At.bindBuffer(At.ARRAY_BUFFER,f.buffer),At.bufferData(At.ARRAY_BUFFER,f.array,e),f.needsUpdate=!1}}function c(t,e){var n,r,i,o,s,a,u,h,l,c,p,f,d=t.vertices,m=t.colors,v=t.lineDistances,g=d.length,E=m.length,y=v.length,_=t.__vertexArray,b=t.__colorArray,T=t.__lineDistanceArray,x=t.verticesNeedUpdate,w=t.colorsNeedUpdate,R=t.lineDistancesNeedUpdate,H=t.__webglCustomAttributesList;if(x){for(n=0;g>n;n++)o=d[n],s=3*n,_[s]=o.x,_[s+1]=o.y,_[s+2]=o.z;At.bindBuffer(At.ARRAY_BUFFER,t.__webglVertexBuffer),At.bufferData(At.ARRAY_BUFFER,_,e)}if(w){for(r=0;E>r;r++)a=m[r],s=3*r,b[s]=a.r,b[s+1]=a.g,b[s+2]=a.b;At.bindBuffer(At.ARRAY_BUFFER,t.__webglColorBuffer),At.bufferData(At.ARRAY_BUFFER,b,e)}if(R){for(i=0;y>i;i++)T[i]=v[i];At.bindBuffer(At.ARRAY_BUFFER,t.__webglLineDistanceBuffer),At.bufferData(At.ARRAY_BUFFER,T,e)}if(H)for(u=0,h=H.length;h>u;u++)if(f=H[u],f.needsUpdate&&(void 0===f.boundTo||"vertices"===f.boundTo)){if(s=0,c=f.value.length,1===f.size)for(l=0;c>l;l++)f.array[l]=f.value[l];else if(2===f.size)for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.x,f.array[s+1]=p.y,s+=2;else if(3===f.size)if("c"===f.type)for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.r,f.array[s+1]=p.g,f.array[s+2]=p.b,s+=3;else for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.x,f.array[s+1]=p.y,f.array[s+2]=p.z,s+=3;else if(4===f.size)for(l=0;c>l;l++)p=f.value[l],f.array[s]=p.x,f.array[s+1]=p.y,f.array[s+2]=p.z,f.array[s+3]=p.w,s+=4;At.bindBuffer(At.ARRAY_BUFFER,f.buffer),At.bufferData(At.ARRAY_BUFFER,f.array,e),f.needsUpdate=!1}}function p(t,e,n,r,i){if(t.__inittedArrays){var o,s,a,u,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V,I,j,G,W,q,X,Y=h(i),Z=0,K=0,Q=0,J=0,$=0,tt=0,et=0,nt=0,rt=0,it=0,ot=0,st=0,at=t.__vertexArray,ut=t.__uvArray,ht=t.__uv2Array,lt=t.__normalArray,ct=t.__tangentArray,pt=t.__colorArray,ft=t.__skinIndexArray,dt=t.__skinWeightArray,mt=t.__morphTargetsArrays,vt=t.__morphNormalsArrays,gt=t.__webglCustomAttributesList,Et=t.__faceArray,yt=t.__lineArray,_t=e.geometry,bt=_t.verticesNeedUpdate,Tt=_t.elementsNeedUpdate,xt=_t.uvsNeedUpdate,wt=_t.normalsNeedUpdate,Rt=_t.tangentsNeedUpdate,Ht=_t.colorsNeedUpdate,Mt=_t.morphTargetsNeedUpdate,St=_t.vertices,kt=t.faces3,Ct=_t.faces,Pt=_t.faceVertexUvs[0],Lt=_t.faceVertexUvs[1],zt=_t.skinIndices,Ot=_t.skinWeights,Dt=_t.morphTargets,Ft=_t.morphNormals;if(bt){for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],g=St[u.a],E=St[u.b],y=St[u.c],at[K]=g.x,at[K+1]=g.y,at[K+2]=g.z,at[K+3]=E.x,at[K+4]=E.y,at[K+5]=E.z,at[K+6]=y.x,at[K+7]=y.y,at[K+8]=y.z,K+=9;At.bindBuffer(At.ARRAY_BUFFER,t.__webglVertexBuffer),At.bufferData(At.ARRAY_BUFFER,at,n)}if(Mt)for(N=0,V=Dt.length;V>N;N++){for(ot=0,o=0,s=kt.length;s>o;o++)G=kt[o],u=Ct[G],g=Dt[N].vertices[u.a],E=Dt[N].vertices[u.b],y=Dt[N].vertices[u.c],I=mt[N],I[ot]=g.x,I[ot+1]=g.y,I[ot+2]=g.z,I[ot+3]=E.x,I[ot+4]=E.y,I[ot+5]=E.z,I[ot+6]=y.x,I[ot+7]=y.y,I[ot+8]=y.z,i.morphNormals&&(Y?(x=Ft[N].faceNormals[G],w=x,R=x):(W=Ft[N].vertexNormals[G],x=W.a,w=W.b,R=W.c),j=vt[N],j[ot]=x.x,j[ot+1]=x.y,j[ot+2]=x.z,j[ot+3]=w.x,j[ot+4]=w.y,j[ot+5]=w.z,j[ot+6]=R.x,j[ot+7]=R.y,j[ot+8]=R.z),ot+=9;At.bindBuffer(At.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[N]),At.bufferData(At.ARRAY_BUFFER,mt[N],n),i.morphNormals&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[N]),At.bufferData(At.ARRAY_BUFFER,vt[N],n))}if(Ot.length){for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],k=Ot[u.a],A=Ot[u.b],C=Ot[u.c],dt[it]=k.x,dt[it+1]=k.y,dt[it+2]=k.z,dt[it+3]=k.w,dt[it+4]=A.x,dt[it+5]=A.y,dt[it+6]=A.z,dt[it+7]=A.w,dt[it+8]=C.x,dt[it+9]=C.y,dt[it+10]=C.z,dt[it+11]=C.w,P=zt[u.a],L=zt[u.b],z=zt[u.c],ft[it]=P.x,ft[it+1]=P.y,ft[it+2]=P.z,ft[it+3]=P.w,ft[it+4]=L.x,ft[it+5]=L.y,ft[it+6]=L.z,ft[it+7]=L.w,ft[it+8]=z.x,ft[it+9]=z.y,ft[it+10]=z.z,ft[it+11]=z.w,it+=12;it>0&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),At.bufferData(At.ARRAY_BUFFER,ft,n),At.bindBuffer(At.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),At.bufferData(At.ARRAY_BUFFER,dt,n))}if(Ht){for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],p=u.vertexColors,f=u.color,3===p.length&&i.vertexColors===THREE.VertexColors?(H=p[0],M=p[1],S=p[2]):(H=f,M=f,S=f),pt[rt]=H.r,pt[rt+1]=H.g,pt[rt+2]=H.b,pt[rt+3]=M.r,pt[rt+4]=M.g,pt[rt+5]=M.b,pt[rt+6]=S.r,pt[rt+7]=S.g,pt[rt+8]=S.b,rt+=9;rt>0&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglColorBuffer),At.bufferData(At.ARRAY_BUFFER,pt,n))}if(Rt&&_t.hasTangents){for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],d=u.vertexTangents,_=d[0],b=d[1],T=d[2],ct[et]=_.x,ct[et+1]=_.y,ct[et+2]=_.z,ct[et+3]=_.w,ct[et+4]=b.x,ct[et+5]=b.y,ct[et+6]=b.z,ct[et+7]=b.w,ct[et+8]=T.x,ct[et+9]=T.y,ct[et+10]=T.z,ct[et+11]=T.w,et+=12;At.bindBuffer(At.ARRAY_BUFFER,t.__webglTangentBuffer),At.bufferData(At.ARRAY_BUFFER,ct,n)}if(wt){for(o=0,s=kt.length;s>o;o++)if(u=Ct[kt[o]],l=u.vertexNormals,c=u.normal,3===l.length&&Y===!1)for(O=0;3>O;O++)F=l[O],lt[tt]=F.x,lt[tt+1]=F.y,lt[tt+2]=F.z,tt+=3;else for(O=0;3>O;O++)lt[tt]=c.x,lt[tt+1]=c.y,lt[tt+2]=c.z,tt+=3;At.bindBuffer(At.ARRAY_BUFFER,t.__webglNormalBuffer),At.bufferData(At.ARRAY_BUFFER,lt,n)}if(xt&&Pt){for(o=0,s=kt.length;s>o;o++)if(a=kt[o],m=Pt[a],void 0!==m)for(O=0;3>O;O++)U=m[O],ut[Q]=U.x,ut[Q+1]=U.y,Q+=2;Q>0&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglUVBuffer),At.bufferData(At.ARRAY_BUFFER,ut,n))}if(xt&&Lt){for(o=0,s=kt.length;s>o;o++)if(a=kt[o],v=Lt[a],void 0!==v)for(O=0;3>O;O++)B=v[O],ht[J]=B.x,ht[J+1]=B.y,J+=2;J>0&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglUV2Buffer),At.bufferData(At.ARRAY_BUFFER,ht,n))}if(Tt){for(o=0,s=kt.length;s>o;o++)Et[$]=Z,Et[$+1]=Z+1,Et[$+2]=Z+2,$+=3,yt[nt]=Z,yt[nt+1]=Z+1,yt[nt+2]=Z,yt[nt+3]=Z+2,yt[nt+4]=Z+1,yt[nt+5]=Z+2,nt+=6,Z+=3;At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),At.bufferData(At.ELEMENT_ARRAY_BUFFER,Et,n),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),At.bufferData(At.ELEMENT_ARRAY_BUFFER,yt,n)}if(gt)for(O=0,D=gt.length;D>O;O++)if(X=gt[O],X.__original.needsUpdate){if(st=0,1===X.size){if(void 0===X.boundTo||"vertices"===X.boundTo)for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],X.array[st]=X.value[u.a],X.array[st+1]=X.value[u.b],X.array[st+2]=X.value[u.c],st+=3;else if("faces"===X.boundTo)for(o=0,s=kt.length;s>o;o++)q=X.value[kt[o]],X.array[st]=q,X.array[st+1]=q,X.array[st+2]=q,st+=3}else if(2===X.size){if(void 0===X.boundTo||"vertices"===X.boundTo)for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],g=X.value[u.a],E=X.value[u.b],y=X.value[u.c],X.array[st]=g.x,X.array[st+1]=g.y,X.array[st+2]=E.x,X.array[st+3]=E.y,X.array[st+4]=y.x,X.array[st+5]=y.y,st+=6;else if("faces"===X.boundTo)for(o=0,s=kt.length;s>o;o++)q=X.value[kt[o]],g=q,E=q,y=q,X.array[st]=g.x,X.array[st+1]=g.y,X.array[st+2]=E.x,X.array[st+3]=E.y,X.array[st+4]=y.x,X.array[st+5]=y.y,st+=6}else if(3===X.size){var Ut;if(Ut="c"===X.type?["r","g","b"]:["x","y","z"],void 0===X.boundTo||"vertices"===X.boundTo)for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],g=X.value[u.a],E=X.value[u.b],y=X.value[u.c],X.array[st]=g[Ut[0]],X.array[st+1]=g[Ut[1]],X.array[st+2]=g[Ut[2]],X.array[st+3]=E[Ut[0]],X.array[st+4]=E[Ut[1]],X.array[st+5]=E[Ut[2]],X.array[st+6]=y[Ut[0]],X.array[st+7]=y[Ut[1]],X.array[st+8]=y[Ut[2]],st+=9;else if("faces"===X.boundTo)for(o=0,s=kt.length;s>o;o++)q=X.value[kt[o]],g=q,E=q,y=q,X.array[st]=g[Ut[0]],X.array[st+1]=g[Ut[1]],X.array[st+2]=g[Ut[2]],X.array[st+3]=E[Ut[0]],X.array[st+4]=E[Ut[1]],X.array[st+5]=E[Ut[2]],X.array[st+6]=y[Ut[0]],X.array[st+7]=y[Ut[1]],X.array[st+8]=y[Ut[2]],st+=9;else if("faceVertices"===X.boundTo)for(o=0,s=kt.length;s>o;o++)q=X.value[kt[o]],g=q[0],E=q[1],y=q[2],X.array[st]=g[Ut[0]],X.array[st+1]=g[Ut[1]],X.array[st+2]=g[Ut[2]],X.array[st+3]=E[Ut[0]],X.array[st+4]=E[Ut[1]],X.array[st+5]=E[Ut[2]],X.array[st+6]=y[Ut[0]],X.array[st+7]=y[Ut[1]],X.array[st+8]=y[Ut[2]],st+=9}else if(4===X.size)if(void 0===X.boundTo||"vertices"===X.boundTo)for(o=0,s=kt.length;s>o;o++)u=Ct[kt[o]],g=X.value[u.a],E=X.value[u.b],y=X.value[u.c],X.array[st]=g.x,X.array[st+1]=g.y,X.array[st+2]=g.z,X.array[st+3]=g.w,X.array[st+4]=E.x,X.array[st+5]=E.y,X.array[st+6]=E.z,X.array[st+7]=E.w,X.array[st+8]=y.x,X.array[st+9]=y.y,X.array[st+10]=y.z,X.array[st+11]=y.w,st+=12;else if("faces"===X.boundTo)for(o=0,s=kt.length;s>o;o++)q=X.value[kt[o]],g=q,E=q,y=q,X.array[st]=g.x,X.array[st+1]=g.y,X.array[st+2]=g.z,X.array[st+3]=g.w,X.array[st+4]=E.x,X.array[st+5]=E.y,X.array[st+6]=E.z,X.array[st+7]=E.w,X.array[st+8]=y.x,X.array[st+9]=y.y,X.array[st+10]=y.z,X.array[st+11]=y.w,st+=12;else if("faceVertices"===X.boundTo)for(o=0,s=kt.length;s>o;o++)q=X.value[kt[o]],g=q[0],E=q[1],y=q[2],X.array[st]=g.x,X.array[st+1]=g.y,X.array[st+2]=g.z,X.array[st+3]=g.w,X.array[st+4]=E.x,X.array[st+5]=E.y,X.array[st+6]=E.z,X.array[st+7]=E.w,X.array[st+8]=y.x,X.array[st+9]=y.y,X.array[st+10]=y.z,X.array[st+11]=y.w,st+=12;At.bindBuffer(At.ARRAY_BUFFER,X.buffer),At.bufferData(At.ARRAY_BUFFER,X.array,n)}r&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}}function f(t,e,n,r){for(var i=n.attributes,o=e.attributes,s=e.attributesKeys,a=0,u=s.length;u>a;a++){var h=s[a],l=o[h];if(l>=0){var c=i[h];if(void 0!==c){var p=c.itemSize;At.bindBuffer(At.ARRAY_BUFFER,c.buffer),$t.enableAttribute(l),At.vertexAttribPointer(l,p,At.FLOAT,!1,0,r*p*4)}else void 0!==t.defaultAttributeValues&&(2===t.defaultAttributeValues[h].length?At.vertexAttrib2fv(l,t.defaultAttributeValues[h]):3===t.defaultAttributeValues[h].length&&At.vertexAttrib3fv(l,t.defaultAttributeValues[h]))}}$t.disableUnusedAttributes()}function d(t,e,n){var r=t.program.attributes;if(-1!==n.morphTargetBase&&r.position>=0?(At.bindBuffer(At.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n.morphTargetBase]),$t.enableAttribute(r.position),At.vertexAttribPointer(r.position,3,At.FLOAT,!1,0,0)):r.position>=0&&(At.bindBuffer(At.ARRAY_BUFFER,e.__webglVertexBuffer),$t.enableAttribute(r.position),At.vertexAttribPointer(r.position,3,At.FLOAT,!1,0,0)),n.morphTargetForcedOrder.length)for(var i,o=0,s=n.morphTargetForcedOrder,a=n.morphTargetInfluences;o=0&&(At.bindBuffer(At.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[s[o]]),$t.enableAttribute(i),At.vertexAttribPointer(i,3,At.FLOAT,!1,0,0)),i=r["morphNormal"+o],i>=0&&t.morphNormals&&(At.bindBuffer(At.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[s[o]]),$t.enableAttribute(i),At.vertexAttribPointer(i,3,At.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[o]=a[s[o]],o++;else{var u=[],a=n.morphTargetInfluences,h=n.geometry.morphTargets;a.length>h.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),a.length=h.length);for(var l=0,c=a.length;c>l;l++){var p=a[l];u.push([p,l])}u.length>t.numSupportedMorphTargets?(u.sort(g),u.length=t.numSupportedMorphTargets):u.length>t.numSupportedMorphNormals?u.sort(g):0===u.length&&u.push([0,0]);for(var i,o=0,f=t.numSupportedMorphTargets;f>o;o++)if(u[o]){var d=u[o][1];i=r["morphTarget"+o],i>=0&&(At.bindBuffer(At.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[d]),$t.enableAttribute(i),At.vertexAttribPointer(i,3,At.FLOAT,!1,0,0)),i=r["morphNormal"+o],i>=0&&t.morphNormals&&(At.bindBuffer(At.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[d]),$t.enableAttribute(i),At.vertexAttribPointer(i,3,At.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[o]=a[d]}else n.__webglMorphTargetInfluences[o]=0}null!==t.program.uniforms.morphTargetInfluences&&At.uniform1fv(t.program.uniforms.morphTargetInfluences,n.__webglMorphTargetInfluences)}function m(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder: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 v(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function g(t,e){return e[0]-t[0]}function E(t){if(t.visible!==!1){if(t instanceof THREE.Scene||t instanceof THREE.Group);else if(x(t),t instanceof THREE.Light)xt.push(t);else if(t instanceof THREE.Sprite)St.push(t);else if(t instanceof THREE.LensFlare)kt.push(t);else{var e=wt[t.id];if(e&&(t.frustumCulled===!1||Wt.intersectsObject(t)===!0))for(var n=0,r=e.length;r>n;n++){var i=e[n];T(i),i.render=!0,Ct.sortObjects===!0&&(Xt.setFromMatrixPosition(t.matrixWorld),Xt.applyProjection(qt),i.z=Xt.z)}}for(var n=0,r=t.children.length;r>n;n++)E(t.children[n])}}function y(t,e,n,r,i){for(var o,s=0,a=t.length;a>s;s++){var u=t[s],h=u.object,l=u.buffer;if(Z(h,e),i)o=i;else{if(o=u.material,!o)continue;z(o)}Ct.setMaterialFaces(o),l instanceof THREE.BufferGeometry?Ct.renderBufferDirect(e,n,r,o,l,h):Ct.renderBuffer(e,n,r,o,l,h)}}function _(t,e,n,r,i,o){for(var s,a=0,u=t.length;u>a;a++){var h=t[a],l=h.object;if(l.visible){if(o)s=o;else{if(s=h[e],!s)continue;z(s)}Ct.renderImmediateObject(n,r,i,s,l)}}}function b(t){var e=t.object,n=e.material;n.transparent?(t.transparent=n,t.opaque=null):(t.opaque=n,t.transparent=null)}function T(t){var e=t.object,n=t.buffer,r=e.geometry,i=e.material;if(i instanceof THREE.MeshFaceMaterial){var o=r instanceof THREE.BufferGeometry?0:n.materialIndex;i=i.materials[o],t.material=i,i.transparent?Mt.push(t):Ht.push(t)}else i&&(t.material=i,i.transparent?Mt.push(t):Ht.push(t))}function x(t){void 0===t.__webglInit&&(t.__webglInit=!0,t._modelViewMatrix=new THREE.Matrix4,t._normalMatrix=new THREE.Matrix3,t.addEventListener("removed",_e));var r=t.geometry;if(void 0===r||void 0===r.__webglInit&&(r.__webglInit=!0,r.addEventListener("dispose",be),r instanceof THREE.BufferGeometry?Ct.info.memory.geometries++:t instanceof THREE.Mesh?R(t,r):t instanceof THREE.Line?void 0===r.__webglVertexBuffer&&(n(r),s(r,t),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0,r.lineDistancesNeedUpdate=!0):t instanceof THREE.PointCloud&&void 0===r.__webglVertexBuffer&&(e(r),o(r,t),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0)),void 0===t.__webglActive)if(t.__webglActive=!0,t instanceof THREE.Mesh){if(r instanceof THREE.BufferGeometry)H(wt,r,t);else if(r instanceof THREE.Geometry)for(var i=Ae[r.id],a=0,u=i.length;u>a;a++)H(wt,i[a],t)}else t instanceof THREE.Line||t instanceof THREE.PointCloud?H(wt,r,t):(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)&&M(Rt,t)}function w(t,e){for(var n,r,i=te.get("OES_element_index_uint")?4294967296:65535,o={},s=t.morphTargets.length,a=t.morphNormals.length,u={},h=[],l=0,c=t.faces.length;c>l;l++){var p=t.faces[l],f=e?p.materialIndex:0;f in o||(o[f]={hash:f,counter:0}),n=o[f].hash+"_"+o[f].counter,n in u||(r={id:Ce++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:s,numMorphNormals:a},u[n]=r,h.push(r)),u[n].vertices+3>i&&(o[f].counter+=1,n=o[f].hash+"_"+o[f].counter,n in u||(r={id:Ce++,faces3:[],materialIndex:f,vertices:0,numMorphTargets:s,numMorphNormals:a},u[n]=r,h.push(r))),u[n].faces3.push(l),u[n].vertices+=3}return h}function R(t,e){var n=t.material,i=!1;(void 0===Ae[e.id]||e.groupsNeedUpdate===!0)&&(delete wt[t.id],Ae[e.id]=w(e,n instanceof THREE.MeshFaceMaterial),e.groupsNeedUpdate=!1);for(var o=Ae[e.id],s=0,u=o.length;u>s;s++){var h=o[s];void 0===h.__webglVertexBuffer?(r(h),a(h,t),e.verticesNeedUpdate=!0,e.morphTargetsNeedUpdate=!0,e.elementsNeedUpdate=!0,e.uvsNeedUpdate=!0,e.normalsNeedUpdate=!0,e.tangentsNeedUpdate=!0,e.colorsNeedUpdate=!0,i=!0):i=!1,(i||void 0===t.__webglActive)&&H(wt,h,t)}t.__webglActive=!0}function H(t,e,n){var r=n.id;t[r]=t[r]||[],t[r].push({id:r,buffer:e,object:n,material:null,z:0})}function M(t,e){t.push({id:null,object:e,opaque:null,transparent:null,z:0})}function S(t){var e=t.geometry;if(e instanceof THREE.BufferGeometry)for(var n=e.attributes,r=e.attributesKeys,i=0,o=r.length;o>i;i++){var s=r[i],a=n[s],h="index"===s?At.ELEMENT_ARRAY_BUFFER:At.ARRAY_BUFFER;void 0===a.buffer?(a.buffer=At.createBuffer(),At.bindBuffer(h,a.buffer),At.bufferData(h,a.array,a instanceof THREE.DynamicBufferAttribute?At.DYNAMIC_DRAW:At.STATIC_DRAW),a.needsUpdate=!1):a.needsUpdate===!0&&(At.bindBuffer(h,a.buffer),void 0===a.updateRange||-1===a.updateRange.count?At.bufferSubData(h,0,a.array):0===a.updateRange.count?console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):(At.bufferSubData(h,a.updateRange.offset*a.array.BYTES_PER_ELEMENT,a.array.subarray(a.updateRange.offset,a.updateRange.offset+a.updateRange.count)),a.updateRange.count=0),a.needsUpdate=!1)}else if(t instanceof THREE.Mesh){e.groupsNeedUpdate===!0&&R(t,e);for(var f=Ae[e.id],i=0,d=f.length;d>i;i++){var m=f[i],v=u(t,m),g=v.attributes&&k(v);(e.verticesNeedUpdate||e.morphTargetsNeedUpdate||e.elementsNeedUpdate||e.uvsNeedUpdate||e.normalsNeedUpdate||e.colorsNeedUpdate||e.tangentsNeedUpdate||g)&&p(m,t,At.DYNAMIC_DRAW,!e.dynamic,v)}e.verticesNeedUpdate=!1,e.morphTargetsNeedUpdate=!1,e.elementsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.tangentsNeedUpdate=!1,v.attributes&&A(v)}else if(t instanceof THREE.Line){var v=u(t,e),g=v.attributes&&k(v);(e.verticesNeedUpdate||e.colorsNeedUpdate||e.lineDistancesNeedUpdate||g)&&c(e,At.DYNAMIC_DRAW),e.verticesNeedUpdate=!1,e.colorsNeedUpdate=!1,e.lineDistancesNeedUpdate=!1,v.attributes&&A(v)}else if(t instanceof THREE.PointCloud){var v=u(t,e),g=v.attributes&&k(v);(e.verticesNeedUpdate||e.colorsNeedUpdate||g)&&l(e,At.DYNAMIC_DRAW,t),e.verticesNeedUpdate=!1,e.colorsNeedUpdate=!1,v.attributes&&A(v)}}function k(t){for(var e in t.attributes)if(t.attributes[e].needsUpdate)return!0;return!1}function A(t){for(var e in t.attributes)t.attributes[e].needsUpdate=!1}function C(t){t instanceof THREE.Mesh||t instanceof THREE.PointCloud||t instanceof THREE.Line?delete wt[t.id]:(t instanceof THREE.ImmediateRenderObject||t.immediateRenderCallback)&&P(Rt,t),delete t.__webglInit,delete t._modelViewMatrix,delete t._normalMatrix,delete t.__webglActive}function P(t,e){for(var n=t.length-1;n>=0;n--)t[n].object===e&&t.splice(n,1)}function L(t,e,n,r){t.addEventListener("dispose",we);var i=Pe[t.type];if(i){var o=THREE.ShaderLib[i];t.__webglShader={uniforms:THREE.UniformsUtils.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}}else t.__webglShader={uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};var s=ut(e),a=ht(e),u=at(r),h={precision:ft,supportsVertexTextures:ue,map:!!t.map,envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,lightMap:!!t.lightMap,bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,combine:t.combine,vertexColors:t.vertexColors,fog:n,useFog:t.fog,fogExp:n instanceof THREE.FogExp2,flatShading:t.shading===THREE.FlatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:_t,skinning:t.skinning,maxBones:u,useVertexTexture:he&&r&&r.skeleton&&r.skeleton.useVertexTexture,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:Ct.maxMorphTargets,maxMorphNormals:Ct.maxMorphNormals,maxDirLights:s.directional,maxPointLights:s.point,maxSpotLights:s.spot,maxHemiLights:s.hemi,maxShadows:a,shadowMapEnabled:Ct.shadowMapEnabled&&r.receiveShadow&&a>0,shadowMapType:Ct.shadowMapType,shadowMapDebug:Ct.shadowMapDebug, +shadowMapCascade:Ct.shadowMapCascade,alphaTest:t.alphaTest,metal:t.metal,wrapAround:t.wrapAround,doubleSided:t.side===THREE.DoubleSide,flipSided:t.side===THREE.BackSide},l=[];if(i?l.push(i):(l.push(t.fragmentShader),l.push(t.vertexShader)),void 0!==t.defines)for(var c in t.defines)l.push(c),l.push(t.defines[c]);for(var c in h)l.push(c),l.push(h[c]);for(var p,f=l.join(),d=0,m=Pt.length;m>d;d++){var v=Pt[d];if(v.code===f){p=v,p.usedTimes++;break}}void 0===p&&(p=new THREE.WebGLProgram(Ct,f,t,h),Pt.push(p),Ct.info.memory.programs=Pt.length),t.program=p;var g=p.attributes;if(t.morphTargets){t.numSupportedMorphTargets=0;for(var E,y="morphTarget",_=0;_=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;var E,y="morphNormal";for(_=0;_=0&&t.numSupportedMorphNormals++}t.uniformsList=[];for(var b in t.__webglShader.uniforms){var T=t.program.uniforms[b];T&&t.uniformsList.push([t.__webglShader.uniforms[b],T])}}function z(t){t.transparent===!0?$t.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):$t.setBlending(THREE.NoBlending),$t.setDepthTest(t.depthTest),$t.setDepthWrite(t.depthWrite),$t.setColorWrite(t.colorWrite),$t.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function O(t,e,n,r,i){Ut=0,r.needsUpdate&&(r.program&&ke(r),L(r,e,n,i),r.needsUpdate=!1),r.morphTargets&&(i.__webglMorphTargetInfluences||(i.__webglMorphTargetInfluences=new Float32Array(Ct.maxMorphTargets)));var o=!1,s=!1,a=!1,u=r.program,h=u.uniforms,l=r.__webglShader.uniforms;if(u.id!==Lt&&(At.useProgram(u.program),Lt=u.id,o=!0,s=!0,a=!0),r.id!==Ot&&(-1===Ot&&(a=!0),Ot=r.id,s=!0),(o||t!==Ft)&&(At.uniformMatrix4fv(h.projectionMatrix,!1,t.projectionMatrix.elements),_t&&At.uniform1f(h.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==Ft&&(Ft=t),(r instanceof THREE.ShaderMaterial||r instanceof THREE.MeshPhongMaterial||r.envMap)&&null!==h.cameraPosition&&(Xt.setFromMatrixPosition(t.matrixWorld),At.uniform3f(h.cameraPosition,Xt.x,Xt.y,Xt.z)),(r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshBasicMaterial||r instanceof THREE.ShaderMaterial||r.skinning)&&null!==h.viewMatrix&&At.uniformMatrix4fv(h.viewMatrix,!1,t.matrixWorldInverse.elements)),r.skinning)if(i.bindMatrix&&null!==h.bindMatrix&&At.uniformMatrix4fv(h.bindMatrix,!1,i.bindMatrix.elements),i.bindMatrixInverse&&null!==h.bindMatrixInverse&&At.uniformMatrix4fv(h.bindMatrixInverse,!1,i.bindMatrixInverse.elements),he&&i.skeleton&&i.skeleton.useVertexTexture){if(null!==h.boneTexture){var c=X();At.uniform1i(h.boneTexture,c),Ct.setTexture(i.skeleton.boneTexture,c)}null!==h.boneTextureWidth&&At.uniform1i(h.boneTextureWidth,i.skeleton.boneTextureWidth),null!==h.boneTextureHeight&&At.uniform1i(h.boneTextureHeight,i.skeleton.boneTextureHeight)}else i.skeleton&&i.skeleton.boneMatrices&&null!==h.boneGlobalMatrices&&At.uniformMatrix4fv(h.boneGlobalMatrices,!1,i.skeleton.boneMatrices);return s&&(n&&r.fog&&N(l,n),(r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r.lights)&&(Zt&&(a=!0,Q(e),Zt=!1),a?(j(l,Kt),G(l,!0)):G(l,!1)),(r instanceof THREE.MeshBasicMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshPhongMaterial)&&D(l,r),r instanceof THREE.LineBasicMaterial?F(l,r):r instanceof THREE.LineDashedMaterial?(F(l,r),U(l,r)):r instanceof THREE.PointCloudMaterial?B(l,r):r instanceof THREE.MeshPhongMaterial?V(l,r):r instanceof THREE.MeshLambertMaterial?I(l,r):r instanceof THREE.MeshDepthMaterial?(l.mNear.value=t.near,l.mFar.value=t.far,l.opacity.value=r.opacity):r instanceof THREE.MeshNormalMaterial&&(l.opacity.value=r.opacity),i.receiveShadow&&!r._shadowPass&&W(l,e),Y(r.uniformsList)),q(h,i),null!==h.modelMatrix&&At.uniformMatrix4fv(h.modelMatrix,!1,i.matrixWorld.elements),u}function D(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,t.map.value=e.map,t.lightMap.value=e.lightMap,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,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));var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.alphaMap&&(n=e.alphaMap),void 0!==n){var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function F(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function U(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function B(t,e){if(t.psColor.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size,t.scale.value=lt.height/2,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function N(t,e){t.fogColor.value=e.color,e instanceof THREE.Fog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e instanceof THREE.FogExp2&&(t.fogDensity.value=e.density)}function V(t,e){t.shininess.value=e.shininess,t.emissive.value=e.emissive,t.specular.value=e.specular,e.wrapAround&&t.wrapRGB.value.copy(e.wrapRGB)}function I(t,e){t.emissive.value=e.emissive,e.wrapAround&&t.wrapRGB.value.copy(e.wrapRGB)}function j(t,e){t.ambientLightColor.value=e.ambient,t.directionalLightColor.value=e.directional.colors,t.directionalLightDirection.value=e.directional.positions,t.pointLightColor.value=e.point.colors,t.pointLightPosition.value=e.point.positions,t.pointLightDistance.value=e.point.distances,t.pointLightDecay.value=e.point.decays,t.spotLightColor.value=e.spot.colors,t.spotLightPosition.value=e.spot.positions,t.spotLightDistance.value=e.spot.distances,t.spotLightDirection.value=e.spot.directions,t.spotLightAngleCos.value=e.spot.anglesCos,t.spotLightExponent.value=e.spot.exponents,t.spotLightDecay.value=e.spot.decays,t.hemisphereLightSkyColor.value=e.hemi.skyColors,t.hemisphereLightGroundColor.value=e.hemi.groundColors,t.hemisphereLightDirection.value=e.hemi.positions}function G(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLightColor.needsUpdate=e,t.directionalLightDirection.needsUpdate=e,t.pointLightColor.needsUpdate=e,t.pointLightPosition.needsUpdate=e,t.pointLightDistance.needsUpdate=e,t.pointLightDecay.needsUpdate=e,t.spotLightColor.needsUpdate=e,t.spotLightPosition.needsUpdate=e,t.spotLightDistance.needsUpdate=e,t.spotLightDirection.needsUpdate=e,t.spotLightAngleCos.needsUpdate=e,t.spotLightExponent.needsUpdate=e,t.spotLightDecay.needsUpdate=e,t.hemisphereLightSkyColor.needsUpdate=e,t.hemisphereLightGroundColor.needsUpdate=e,t.hemisphereLightDirection.needsUpdate=e}function W(t,e){if(t.shadowMatrix)for(var n=0,r=0,i=e.length;i>r;r++){var o=e[r];o.castShadow&&(o instanceof THREE.SpotLight||o instanceof THREE.DirectionalLight&&!o.shadowCascade)&&(t.shadowMap.value[n]=o.shadowMap,t.shadowMapSize.value[n]=o.shadowMapSize,t.shadowMatrix.value[n]=o.shadowMatrix,t.shadowDarkness.value[n]=o.shadowDarkness,t.shadowBias.value[n]=o.shadowBias,n++)}}function q(t,e){At.uniformMatrix4fv(t.modelViewMatrix,!1,e._modelViewMatrix.elements),t.normalMatrix&&At.uniformMatrix3fv(t.normalMatrix,!1,e._normalMatrix.elements)}function X(){var t=Ut;return t>=ie&&THREE.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+ie),Ut+=1,t}function Y(t){for(var e,n,r,i=0,o=t.length;o>i;i++){var s=t[i][0];if(s.needsUpdate!==!1){var a=s.type,u=s.value,h=t[i][1];switch(a){case"1i":At.uniform1i(h,u);break;case"1f":At.uniform1f(h,u);break;case"2f":At.uniform2f(h,u[0],u[1]);break;case"3f":At.uniform3f(h,u[0],u[1],u[2]);break;case"4f":At.uniform4f(h,u[0],u[1],u[2],u[3]);break;case"1iv":At.uniform1iv(h,u);break;case"3iv":At.uniform3iv(h,u);break;case"1fv":At.uniform1fv(h,u);break;case"2fv":At.uniform2fv(h,u);break;case"3fv":At.uniform3fv(h,u);break;case"4fv":At.uniform4fv(h,u);break;case"Matrix3fv":At.uniformMatrix3fv(h,!1,u);break;case"Matrix4fv":At.uniformMatrix4fv(h,!1,u);break;case"i":At.uniform1i(h,u);break;case"f":At.uniform1f(h,u);break;case"v2":At.uniform2f(h,u.x,u.y);break;case"v3":At.uniform3f(h,u.x,u.y,u.z);break;case"v4":At.uniform4f(h,u.x,u.y,u.z,u.w);break;case"c":At.uniform3f(h,u.r,u.g,u.b);break;case"iv1":At.uniform1iv(h,u);break;case"iv":At.uniform3iv(h,u);break;case"fv1":At.uniform1fv(h,u);break;case"fv":At.uniform3fv(h,u);break;case"v2v":void 0===s._array&&(s._array=new Float32Array(2*u.length));for(var l=0,c=u.length;c>l;l++)r=2*l,s._array[r]=u[l].x,s._array[r+1]=u[l].y;At.uniform2fv(h,s._array);break;case"v3v":void 0===s._array&&(s._array=new Float32Array(3*u.length));for(var l=0,c=u.length;c>l;l++)r=3*l,s._array[r]=u[l].x,s._array[r+1]=u[l].y,s._array[r+2]=u[l].z;At.uniform3fv(h,s._array);break;case"v4v":void 0===s._array&&(s._array=new Float32Array(4*u.length));for(var l=0,c=u.length;c>l;l++)r=4*l,s._array[r]=u[l].x,s._array[r+1]=u[l].y,s._array[r+2]=u[l].z,s._array[r+3]=u[l].w;At.uniform4fv(h,s._array);break;case"m3":At.uniformMatrix3fv(h,!1,u.elements);break;case"m3v":void 0===s._array&&(s._array=new Float32Array(9*u.length));for(var l=0,c=u.length;c>l;l++)u[l].flattenToArrayOffset(s._array,9*l);At.uniformMatrix3fv(h,!1,s._array);break;case"m4":At.uniformMatrix4fv(h,!1,u.elements);break;case"m4v":void 0===s._array&&(s._array=new Float32Array(16*u.length));for(var l=0,c=u.length;c>l;l++)u[l].flattenToArrayOffset(s._array,16*l);At.uniformMatrix4fv(h,!1,s._array);break;case"t":if(e=u,n=X(),At.uniform1i(h,n),!e)continue;e instanceof THREE.CubeTexture||e.image instanceof Array&&6===e.image.length?tt(e,n):e instanceof THREE.WebGLRenderTargetCube?et(e,n):Ct.setTexture(e,n);break;case"tv":void 0===s._array&&(s._array=[]);for(var l=0,c=s.value.length;c>l;l++)s._array[l]=X();At.uniform1iv(h,s._array);for(var l=0,c=s.value.length;c>l;l++)e=s.value[l],n=s._array[l],e&&Ct.setTexture(e,n);break;default:THREE.warn("THREE.WebGLRenderer: Unknown uniform type: "+a)}}}}function Z(t,e){t._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse,t.matrixWorld),t._normalMatrix.getNormalMatrix(t._modelViewMatrix)}function K(t,e,n,r){t[e]=n.r*r,t[e+1]=n.g*r,t[e+2]=n.b*r}function Q(t){var e,n,r,i,o,s,a,u,h=0,l=0,c=0,p=Kt,f=p.directional.colors,d=p.directional.positions,m=p.point.colors,v=p.point.positions,g=p.point.distances,E=p.point.decays,y=p.spot.colors,_=p.spot.positions,b=p.spot.distances,T=p.spot.directions,x=p.spot.anglesCos,w=p.spot.exponents,R=p.spot.decays,H=p.hemi.skyColors,M=p.hemi.groundColors,S=p.hemi.positions,k=0,A=0,C=0,P=0,L=0,z=0,O=0,D=0,F=0,U=0,B=0,N=0;for(e=0,n=t.length;n>e;e++)if(r=t[e],!r.onlyShadow)if(i=r.color,a=r.intensity,u=r.distance,r instanceof THREE.AmbientLight){if(!r.visible)continue;h+=i.r,l+=i.g,c+=i.b}else if(r instanceof THREE.DirectionalLight){if(L+=1,!r.visible)continue;Yt.setFromMatrixPosition(r.matrixWorld),Xt.setFromMatrixPosition(r.target.matrixWorld),Yt.sub(Xt),Yt.normalize(),F=3*k,d[F]=Yt.x,d[F+1]=Yt.y,d[F+2]=Yt.z,K(f,F,i,a),k+=1}else if(r instanceof THREE.PointLight){if(z+=1,!r.visible)continue;U=3*A,K(m,U,i,a),Xt.setFromMatrixPosition(r.matrixWorld),v[U]=Xt.x,v[U+1]=Xt.y,v[U+2]=Xt.z,g[A]=u,E[A]=0===r.distance?0:r.decay,A+=1}else if(r instanceof THREE.SpotLight){if(O+=1,!r.visible)continue;B=3*C,K(y,B,i,a),Yt.setFromMatrixPosition(r.matrixWorld),_[B]=Yt.x,_[B+1]=Yt.y,_[B+2]=Yt.z,b[C]=u,Xt.setFromMatrixPosition(r.target.matrixWorld),Yt.sub(Xt),Yt.normalize(),T[B]=Yt.x,T[B+1]=Yt.y,T[B+2]=Yt.z,x[C]=Math.cos(r.angle),w[C]=r.exponent,R[C]=0===r.distance?0:r.decay,C+=1}else if(r instanceof THREE.HemisphereLight){if(D+=1,!r.visible)continue;Yt.setFromMatrixPosition(r.matrixWorld),Yt.normalize(),N=3*P,S[N]=Yt.x,S[N+1]=Yt.y,S[N+2]=Yt.z,o=r.color,s=r.groundColor,K(H,N,o,a),K(M,N,s,a),P+=1}for(e=3*k,n=Math.max(f.length,3*L);n>e;e++)f[e]=0;for(e=3*A,n=Math.max(m.length,3*z);n>e;e++)m[e]=0;for(e=3*C,n=Math.max(y.length,3*O);n>e;e++)y[e]=0;for(e=3*P,n=Math.max(H.length,3*D);n>e;e++)H[e]=0;for(e=3*P,n=Math.max(M.length,3*D);n>e;e++)M[e]=0;p.directional.length=k,p.point.length=A,p.spot.length=C,p.hemi.length=P,p.ambient[0]=h,p.ambient[1]=l,p.ambient[2]=c}function J(t,e,n){var r;n?(At.texParameteri(t,At.TEXTURE_WRAP_S,st(e.wrapS)),At.texParameteri(t,At.TEXTURE_WRAP_T,st(e.wrapT)),At.texParameteri(t,At.TEXTURE_MAG_FILTER,st(e.magFilter)),At.texParameteri(t,At.TEXTURE_MIN_FILTER,st(e.minFilter))):(At.texParameteri(t,At.TEXTURE_WRAP_S,At.CLAMP_TO_EDGE),At.texParameteri(t,At.TEXTURE_WRAP_T,At.CLAMP_TO_EDGE),(e.wrapS!==THREE.ClampToEdgeWrapping||e.wrapT!==THREE.ClampToEdgeWrapping)&&THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+e.sourceFile+" )"),At.texParameteri(t,At.TEXTURE_MAG_FILTER,ot(e.magFilter)),At.texParameteri(t,At.TEXTURE_MIN_FILTER,ot(e.minFilter)),e.minFilter!==THREE.NearestFilter&&e.minFilter!==THREE.LinearFilter&&THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+e.sourceFile+" )")),r=te.get("EXT_texture_filter_anisotropic"),r&&e.type!==THREE.FloatType&&e.type!==THREE.HalfFloatType&&(e.anisotropy>1||e.__currentAnisotropy)&&(At.texParameterf(t,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(e.anisotropy,Ct.getMaxAnisotropy())),e.__currentAnisotropy=e.anisotropy)}function $(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElement("canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);var i=r.getContext("2d");return i.drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),THREE.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function tt(t,e){if(6===t.image.length)if(t.needsUpdate){t.image.__webglTextureCube||(t.addEventListener("dispose",Te),t.image.__webglTextureCube=At.createTexture(),Ct.info.memory.textures++),At.activeTexture(At.TEXTURE0+e),At.bindTexture(At.TEXTURE_CUBE_MAP,t.image.__webglTextureCube),At.pixelStorei(At.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var n=t instanceof THREE.CompressedTexture,r=t.image[0]instanceof THREE.DataTexture,i=[],o=0;6>o;o++)!Ct.autoScaleCubemaps||n||r?i[o]=r?t.image[o].image:t.image[o]:i[o]=$(t.image[o],ae);var s=i[0],a=THREE.Math.isPowerOfTwo(s.width)&&THREE.Math.isPowerOfTwo(s.height),u=st(t.format),h=st(t.type);J(At.TEXTURE_CUBE_MAP,t,a);for(var o=0;6>o;o++)if(n)for(var l,c=i[o].mipmaps,p=0,f=c.length;f>p;p++)l=c[p],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?de().indexOf(u)>-1?At.compressedTexImage2D(At.TEXTURE_CUBE_MAP_POSITIVE_X+o,p,u,l.width,l.height,0,l.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):At.texImage2D(At.TEXTURE_CUBE_MAP_POSITIVE_X+o,p,u,l.width,l.height,0,u,h,l.data);else r?At.texImage2D(At.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,u,i[o].width,i[o].height,0,u,h,i[o].data):At.texImage2D(At.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,u,u,h,i[o]);t.generateMipmaps&&a&&At.generateMipmap(At.TEXTURE_CUBE_MAP),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()}else At.activeTexture(At.TEXTURE0+e),At.bindTexture(At.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}function et(t,e){At.activeTexture(At.TEXTURE0+e),At.bindTexture(At.TEXTURE_CUBE_MAP,t.__webglTexture)}function nt(t,e,n){At.bindFramebuffer(At.FRAMEBUFFER,t),At.framebufferTexture2D(At.FRAMEBUFFER,At.COLOR_ATTACHMENT0,n,e.__webglTexture,0)}function rt(t,e){At.bindRenderbuffer(At.RENDERBUFFER,t),e.depthBuffer&&!e.stencilBuffer?(At.renderbufferStorage(At.RENDERBUFFER,At.DEPTH_COMPONENT16,e.width,e.height),At.framebufferRenderbuffer(At.FRAMEBUFFER,At.DEPTH_ATTACHMENT,At.RENDERBUFFER,t)):e.depthBuffer&&e.stencilBuffer?(At.renderbufferStorage(At.RENDERBUFFER,At.DEPTH_STENCIL,e.width,e.height),At.framebufferRenderbuffer(At.FRAMEBUFFER,At.DEPTH_STENCIL_ATTACHMENT,At.RENDERBUFFER,t)):At.renderbufferStorage(At.RENDERBUFFER,At.RGBA4,e.width,e.height)}function it(t){t instanceof THREE.WebGLRenderTargetCube?(At.bindTexture(At.TEXTURE_CUBE_MAP,t.__webglTexture),At.generateMipmap(At.TEXTURE_CUBE_MAP),At.bindTexture(At.TEXTURE_CUBE_MAP,null)):(At.bindTexture(At.TEXTURE_2D,t.__webglTexture),At.generateMipmap(At.TEXTURE_2D),At.bindTexture(At.TEXTURE_2D,null))}function ot(t){return t===THREE.NearestFilter||t===THREE.NearestMipMapNearestFilter||t===THREE.NearestMipMapLinearFilter?At.NEAREST:At.LINEAR}function st(t){var e;if(t===THREE.RepeatWrapping)return At.REPEAT;if(t===THREE.ClampToEdgeWrapping)return At.CLAMP_TO_EDGE;if(t===THREE.MirroredRepeatWrapping)return At.MIRRORED_REPEAT;if(t===THREE.NearestFilter)return At.NEAREST;if(t===THREE.NearestMipMapNearestFilter)return At.NEAREST_MIPMAP_NEAREST;if(t===THREE.NearestMipMapLinearFilter)return At.NEAREST_MIPMAP_LINEAR;if(t===THREE.LinearFilter)return At.LINEAR;if(t===THREE.LinearMipMapNearestFilter)return At.LINEAR_MIPMAP_NEAREST;if(t===THREE.LinearMipMapLinearFilter)return At.LINEAR_MIPMAP_LINEAR;if(t===THREE.UnsignedByteType)return At.UNSIGNED_BYTE;if(t===THREE.UnsignedShort4444Type)return At.UNSIGNED_SHORT_4_4_4_4;if(t===THREE.UnsignedShort5551Type)return At.UNSIGNED_SHORT_5_5_5_1;if(t===THREE.UnsignedShort565Type)return At.UNSIGNED_SHORT_5_6_5;if(t===THREE.ByteType)return At.BYTE;if(t===THREE.ShortType)return At.SHORT;if(t===THREE.UnsignedShortType)return At.UNSIGNED_SHORT;if(t===THREE.IntType)return At.INT;if(t===THREE.UnsignedIntType)return At.UNSIGNED_INT;if(t===THREE.FloatType)return At.FLOAT;if(e=te.get("OES_texture_half_float"),null!==e&&t===THREE.HalfFloatType)return e.HALF_FLOAT_OES;if(t===THREE.AlphaFormat)return At.ALPHA;if(t===THREE.RGBFormat)return At.RGB;if(t===THREE.RGBAFormat)return At.RGBA;if(t===THREE.LuminanceFormat)return At.LUMINANCE;if(t===THREE.LuminanceAlphaFormat)return At.LUMINANCE_ALPHA;if(t===THREE.AddEquation)return At.FUNC_ADD;if(t===THREE.SubtractEquation)return At.FUNC_SUBTRACT;if(t===THREE.ReverseSubtractEquation)return At.FUNC_REVERSE_SUBTRACT;if(t===THREE.ZeroFactor)return At.ZERO;if(t===THREE.OneFactor)return At.ONE;if(t===THREE.SrcColorFactor)return At.SRC_COLOR;if(t===THREE.OneMinusSrcColorFactor)return At.ONE_MINUS_SRC_COLOR;if(t===THREE.SrcAlphaFactor)return At.SRC_ALPHA;if(t===THREE.OneMinusSrcAlphaFactor)return At.ONE_MINUS_SRC_ALPHA;if(t===THREE.DstAlphaFactor)return At.DST_ALPHA;if(t===THREE.OneMinusDstAlphaFactor)return At.ONE_MINUS_DST_ALPHA;if(t===THREE.DstColorFactor)return At.DST_COLOR;if(t===THREE.OneMinusDstColorFactor)return At.ONE_MINUS_DST_COLOR;if(t===THREE.SrcAlphaSaturateFactor)return At.SRC_ALPHA_SATURATE;if(e=te.get("WEBGL_compressed_texture_s3tc"),null!==e){if(t===THREE.RGB_S3TC_DXT1_Format)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT1_Format)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===THREE.RGBA_S3TC_DXT3_Format)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===THREE.RGBA_S3TC_DXT5_Format)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e=te.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(t===THREE.RGB_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===THREE.RGB_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===THREE.RGBA_PVRTC_4BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===THREE.RGBA_PVRTC_2BPPV1_Format)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e=te.get("EXT_blend_minmax"),null!==e){if(t===THREE.MinEquation)return e.MIN_EXT;if(t===THREE.MaxEquation)return e.MAX_EXT}return 0}function at(t){if(he&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var e=At.getParameter(At.MAX_VERTEX_UNIFORM_VECTORS),n=Math.floor((e-20)/4),r=n;return void 0!==t&&t instanceof THREE.SkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r),ro;o++){var a=t[o];a.onlyShadow||a.visible===!1||(a instanceof THREE.DirectionalLight&&e++,a instanceof THREE.PointLight&&n++,a instanceof THREE.SpotLight&&r++,a instanceof THREE.HemisphereLight&&i++)}return{directional:e,point:n,spot:r,hemi:i}}function ht(t){for(var e=0,n=0,r=t.length;r>n;n++){var i=t[n];i.castShadow&&(i instanceof THREE.SpotLight&&e++,i instanceof THREE.DirectionalLight&&!i.shadowCascade&&e++)}return e}console.log("THREE.WebGLRenderer",THREE.REVISION),t=t||{};var lt=void 0!==t.canvas?t.canvas:document.createElement("canvas"),ct=void 0!==t.context?t.context:null,pt=1,ft=void 0!==t.precision?t.precision:"highp",dt=void 0!==t.alpha?t.alpha:!1,mt=void 0!==t.depth?t.depth:!0,vt=void 0!==t.stencil?t.stencil:!0,gt=void 0!==t.antialias?t.antialias:!1,Et=void 0!==t.premultipliedAlpha?t.premultipliedAlpha:!0,yt=void 0!==t.preserveDrawingBuffer?t.preserveDrawingBuffer:!1,_t=void 0!==t.logarithmicDepthBuffer?t.logarithmicDepthBuffer:!1,bt=new THREE.Color(0),Tt=0,xt=[],wt={},Rt=[],Ht=[],Mt=[],St=[],kt=[];this.domElement=lt,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=THREE.PCFShadowMap,this.shadowMapCullFace=THREE.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var At,Ct=this,Pt=[],Lt=null,zt=null,Ot=-1,Dt="",Ft=null,Ut=0,Bt=0,Nt=0,Vt=lt.width,It=lt.height,jt=0,Gt=0,Wt=new THREE.Frustum,qt=new THREE.Matrix4,Xt=new THREE.Vector3,Yt=new THREE.Vector3,Zt=!0,Kt={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var Qt={alpha:dt,depth:mt,stencil:vt,antialias:gt,premultipliedAlpha:Et,preserveDrawingBuffer:yt};if(At=ct||lt.getContext("webgl",Qt)||lt.getContext("experimental-webgl",Qt),null===At)throw null!==lt.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";lt.addEventListener("webglcontextlost",function(t){t.preventDefault(),re(),ne(),wt={}},!1)}catch(Jt){THREE.error("THREE.WebGLRenderer: "+Jt)}var $t=new THREE.WebGLState(At,st);void 0===At.getShaderPrecisionFormat&&(At.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var te=new THREE.WebGLExtensions(At);te.get("OES_texture_float"),te.get("OES_texture_float_linear"),te.get("OES_texture_half_float"),te.get("OES_texture_half_float_linear"),te.get("OES_standard_derivatives"),_t&&te.get("EXT_frag_depth");var ee=function(t,e,n,r){Et===!0&&(t*=r,e*=r,n*=r),At.clearColor(t,e,n,r)},ne=function(){At.clearColor(0,0,0,1),At.clearDepth(1),At.clearStencil(0),At.enable(At.DEPTH_TEST),At.depthFunc(At.LEQUAL),At.frontFace(At.CCW),At.cullFace(At.BACK),At.enable(At.CULL_FACE),At.enable(At.BLEND),At.blendEquation(At.FUNC_ADD),At.blendFunc(At.SRC_ALPHA,At.ONE_MINUS_SRC_ALPHA),At.viewport(Bt,Nt,Vt,It),ee(bt.r,bt.g,bt.b,Tt)},re=function(){Lt=null,Ft=null,Dt="",Ot=-1,Zt=!0,$t.reset()};ne(),this.context=At,this.state=$t;var ie=At.getParameter(At.MAX_TEXTURE_IMAGE_UNITS),oe=At.getParameter(At.MAX_VERTEX_TEXTURE_IMAGE_UNITS),se=At.getParameter(At.MAX_TEXTURE_SIZE),ae=At.getParameter(At.MAX_CUBE_MAP_TEXTURE_SIZE),ue=oe>0,he=ue&&te.get("OES_texture_float"),le=At.getShaderPrecisionFormat(At.VERTEX_SHADER,At.HIGH_FLOAT),ce=At.getShaderPrecisionFormat(At.VERTEX_SHADER,At.MEDIUM_FLOAT),pe=At.getShaderPrecisionFormat(At.FRAGMENT_SHADER,At.HIGH_FLOAT),fe=At.getShaderPrecisionFormat(At.FRAGMENT_SHADER,At.MEDIUM_FLOAT),de=function(){var t;return function(){if(void 0!==t)return t;if(t=[],te.get("WEBGL_compressed_texture_pvrtc")||te.get("WEBGL_compressed_texture_s3tc"))for(var e=At.getParameter(At.COMPRESSED_TEXTURE_FORMATS),n=0;n0&&pe.precision>0,ve=ce.precision>0&&fe.precision>0;"highp"!==ft||me||(ve?(ft="mediump",THREE.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(ft="lowp",THREE.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==ft||ve||(ft="lowp",THREE.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var ge=new THREE.ShadowMapPlugin(this,xt,wt,Rt),Ee=new THREE.SpritePlugin(this,St),ye=new THREE.LensFlarePlugin(this,kt);this.getContext=function(){return At},this.forceContextLoss=function(){te.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return ue},this.supportsFloatTextures=function(){return te.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return te.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return te.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return te.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return te.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return te.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){var t;return function(){if(void 0!==t)return t;var e=te.get("EXT_texture_filter_anisotropic");return t=null!==e?At.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return ft},this.getPixelRatio=function(){return pt},this.setPixelRatio=function(t){pt=t},this.setSize=function(t,e,n){lt.width=t*pt,lt.height=e*pt,n!==!1&&(lt.style.width=t+"px",lt.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){Bt=t*pt,Nt=e*pt,Vt=n*pt,It=r*pt,At.viewport(Bt,Nt,Vt,It)},this.setScissor=function(t,e,n,r){At.scissor(t*pt,e*pt,n*pt,r*pt)},this.enableScissorTest=function(t){t?At.enable(At.SCISSOR_TEST):At.disable(At.SCISSOR_TEST)},this.getClearColor=function(){return bt},this.setClearColor=function(t,e){bt.set(t),Tt=void 0!==e?e:1,ee(bt.r,bt.g,bt.b,Tt)},this.getClearAlpha=function(){return Tt},this.setClearAlpha=function(t){Tt=t,ee(bt.r,bt.g,bt.b,Tt)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=At.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=At.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=At.STENCIL_BUFFER_BIT),At.clear(r)},this.clearColor=function(){At.clear(At.COLOR_BUFFER_BIT)},this.clearDepth=function(){At.clear(At.DEPTH_BUFFER_BIT)},this.clearStencil=function(){At.clear(At.STENCIL_BUFFER_BIT)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=re;var _e=function(t){var e=t.target;e.traverse(function(t){t.removeEventListener("remove",_e),C(t)})},be=function(t){var e=t.target;e.removeEventListener("dispose",be),He(e)},Te=function(t){var e=t.target;e.removeEventListener("dispose",Te),Me(e),Ct.info.memory.textures--},xe=function(t){var e=t.target;e.removeEventListener("dispose",xe),Se(e),Ct.info.memory.textures--},we=function(t){var e=t.target;e.removeEventListener("dispose",we),ke(e)},Re=function(t){for(var e=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],n=0,r=e.length;r>n;n++){var i=e[n];void 0!==t[i]&&(At.deleteBuffer(t[i]),delete t[i])}if(void 0!==t.__webglCustomAttributesList){for(var i in t.__webglCustomAttributesList)At.deleteBuffer(t.__webglCustomAttributesList[i].buffer);delete t.__webglCustomAttributesList}Ct.info.memory.geometries--},He=function(t){if(delete t.__webglInit,t instanceof THREE.BufferGeometry){for(var e in t.attributes){var n=t.attributes[e];void 0!==n.buffer&&(At.deleteBuffer(n.buffer),delete n.buffer)}Ct.info.memory.geometries--}else{var r=Ae[t.id];if(void 0!==r){for(var i=0,o=r.length;o>i;i++){var s=r[i];if(void 0!==s.numMorphTargets){for(var a=0,u=s.numMorphTargets;u>a;a++)At.deleteBuffer(s.__webglMorphTargetsBuffers[a]);delete s.__webglMorphTargetsBuffers}if(void 0!==s.numMorphNormals){for(var a=0,u=s.numMorphNormals;u>a;a++)At.deleteBuffer(s.__webglMorphNormalsBuffers[a]);delete s.__webglMorphNormalsBuffers}Re(s)}delete Ae[t.id]}else Re(t)}Dt=""},Me=function(t){if(t.image&&t.image.__webglTextureCube)At.deleteTexture(t.image.__webglTextureCube),delete t.image.__webglTextureCube;else{if(void 0===t.__webglInit)return;At.deleteTexture(t.__webglTexture),delete t.__webglTexture,delete t.__webglInit}},Se=function(t){if(t&&void 0!==t.__webglTexture){if(At.deleteTexture(t.__webglTexture),delete t.__webglTexture,t instanceof THREE.WebGLRenderTargetCube)for(var e=0;6>e;e++)At.deleteFramebuffer(t.__webglFramebuffer[e]),At.deleteRenderbuffer(t.__webglRenderbuffer[e]);else At.deleteFramebuffer(t.__webglFramebuffer),At.deleteRenderbuffer(t.__webglRenderbuffer);delete t.__webglFramebuffer,delete t.__webglRenderbuffer}},ke=function(t){var e=t.program.program;if(void 0!==e){t.program=void 0;var n,r,i,o=!1;for(n=0,r=Pt.length;r>n;n++)if(i=Pt[n],i.program===e){i.usedTimes--,0===i.usedTimes&&(o=!0);break}if(o===!0){var s=[];for(n=0,r=Pt.length;r>n;n++)i=Pt[n],i.program!==e&&s.push(i);Pt=s,At.deleteProgram(e),Ct.info.memory.programs--}}};this.renderBufferImmediate=function(t,e,n){if($t.initAttributes(),t.hasPositions&&!t.__webglVertexBuffer&&(t.__webglVertexBuffer=At.createBuffer()),t.hasNormals&&!t.__webglNormalBuffer&&(t.__webglNormalBuffer=At.createBuffer()),t.hasUvs&&!t.__webglUvBuffer&&(t.__webglUvBuffer=At.createBuffer()),t.hasColors&&!t.__webglColorBuffer&&(t.__webglColorBuffer=At.createBuffer()),t.hasPositions&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglVertexBuffer),At.bufferData(At.ARRAY_BUFFER,t.positionArray,At.DYNAMIC_DRAW),$t.enableAttribute(e.attributes.position),At.vertexAttribPointer(e.attributes.position,3,At.FLOAT,!1,0,0)),t.hasNormals){if(At.bindBuffer(At.ARRAY_BUFFER,t.__webglNormalBuffer),n instanceof THREE.MeshPhongMaterial==!1&&n.shading===THREE.FlatShading){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g=3*t.count;for(v=0;g>v;v+=9)m=t.normalArray,s=m[v],h=m[v+1],p=m[v+2],a=m[v+3],l=m[v+4],f=m[v+5],u=m[v+6],c=m[v+7],d=m[v+8],r=(s+a+u)/3,i=(h+l+c)/3,o=(p+f+d)/3,m[v]=r,m[v+1]=i,m[v+2]=o,m[v+3]=r,m[v+4]=i,m[v+5]=o,m[v+6]=r,m[v+7]=i,m[v+8]=o}At.bufferData(At.ARRAY_BUFFER,t.normalArray,At.DYNAMIC_DRAW),$t.enableAttribute(e.attributes.normal),At.vertexAttribPointer(e.attributes.normal,3,At.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglUvBuffer),At.bufferData(At.ARRAY_BUFFER,t.uvArray,At.DYNAMIC_DRAW),$t.enableAttribute(e.attributes.uv),At.vertexAttribPointer(e.attributes.uv,2,At.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==THREE.NoColors&&(At.bindBuffer(At.ARRAY_BUFFER,t.__webglColorBuffer),At.bufferData(At.ARRAY_BUFFER,t.colorArray,At.DYNAMIC_DRAW),$t.enableAttribute(e.attributes.color),At.vertexAttribPointer(e.attributes.color,3,At.FLOAT,!1,0,0)),$t.disableUnusedAttributes(),At.drawArrays(At.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,o){if(r.visible!==!1){S(o);var s=O(t,e,n,r,o),a=!1,u=r.wireframe?1:0,h="direct_"+i.id+"_"+s.id+"_"+u;if(h!==Dt&&(Dt=h,a=!0),a&&$t.initAttributes(),o instanceof THREE.Mesh){var l=r.wireframe===!0?At.LINES:At.TRIANGLES,c=i.attributes.index;if(c){var p,d;c.array instanceof Uint32Array&&te.get("OES_element_index_uint")?(p=At.UNSIGNED_INT,d=4):(p=At.UNSIGNED_SHORT,d=2);var m=i.offsets;if(0===m.length)a&&(f(r,s,i,0),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,c.buffer)),At.drawElements(l,c.array.length,p,0),Ct.info.render.calls++,Ct.info.render.vertices+=c.array.length,Ct.info.render.faces+=c.array.length/3;else{a=!0;for(var v=0,g=m.length;g>v;v++){var E=m[v].index;a&&(f(r,s,i,E),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,c.buffer)),At.drawElements(l,m[v].count,p,m[v].start*d),Ct.info.render.calls++,Ct.info.render.vertices+=m[v].count,Ct.info.render.faces+=m[v].count/3}}}else{a&&f(r,s,i,0); +var y=i.attributes.position;At.drawArrays(l,0,y.array.length/y.itemSize),Ct.info.render.calls++,Ct.info.render.vertices+=y.array.length/y.itemSize,Ct.info.render.faces+=y.array.length/(3*y.itemSize)}}else if(o instanceof THREE.PointCloud){var l=At.POINTS,c=i.attributes.index;if(c){var p,d;c.array instanceof Uint32Array&&te.get("OES_element_index_uint")?(p=At.UNSIGNED_INT,d=4):(p=At.UNSIGNED_SHORT,d=2);var m=i.offsets;if(0===m.length)a&&(f(r,s,i,0),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,c.buffer)),At.drawElements(l,c.array.length,p,0),Ct.info.render.calls++,Ct.info.render.points+=c.array.length;else{m.length>1&&(a=!0);for(var v=0,g=m.length;g>v;v++){var E=m[v].index;a&&(f(r,s,i,E),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,c.buffer)),At.drawElements(l,m[v].count,p,m[v].start*d),Ct.info.render.calls++,Ct.info.render.points+=m[v].count}}}else{a&&f(r,s,i,0);var y=i.attributes.position,m=i.offsets;if(0===m.length)At.drawArrays(l,0,y.array.length/3),Ct.info.render.calls++,Ct.info.render.points+=y.array.length/3;else for(var v=0,g=m.length;g>v;v++)At.drawArrays(l,m[v].index,m[v].count),Ct.info.render.calls++,Ct.info.render.points+=m[v].count}}else if(o instanceof THREE.Line){var l=o.mode===THREE.LineStrip?At.LINE_STRIP:At.LINES;$t.setLineWidth(r.linewidth*pt);var c=i.attributes.index;if(c){var p,d;c.array instanceof Uint32Array?(p=At.UNSIGNED_INT,d=4):(p=At.UNSIGNED_SHORT,d=2);var m=i.offsets;if(0===m.length)a&&(f(r,s,i,0),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,c.buffer)),At.drawElements(l,c.array.length,p,0),Ct.info.render.calls++,Ct.info.render.vertices+=c.array.length;else{m.length>1&&(a=!0);for(var v=0,g=m.length;g>v;v++){var E=m[v].index;a&&(f(r,s,i,E),At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,c.buffer)),At.drawElements(l,m[v].count,p,m[v].start*d),Ct.info.render.calls++,Ct.info.render.vertices+=m[v].count}}}else{a&&f(r,s,i,0);var y=i.attributes.position,m=i.offsets;if(0===m.length)At.drawArrays(l,0,y.array.length/3),Ct.info.render.calls++,Ct.info.render.vertices+=y.array.length/3;else for(var v=0,g=m.length;g>v;v++)At.drawArrays(l,m[v].index,m[v].count),Ct.info.render.calls++,Ct.info.render.vertices+=m[v].count}}}},this.renderBuffer=function(t,e,n,r,i,o){if(r.visible!==!1){S(o);var s=O(t,e,n,r,o),a=s.attributes,u=!1,h=r.wireframe?1:0,l=i.id+"_"+s.id+"_"+h;if(l!==Dt&&(Dt=l,u=!0),u&&$t.initAttributes(),!r.morphTargets&&a.position>=0?u&&(At.bindBuffer(At.ARRAY_BUFFER,i.__webglVertexBuffer),$t.enableAttribute(a.position),At.vertexAttribPointer(a.position,3,At.FLOAT,!1,0,0)):o.morphTargetBase&&d(r,i,o),u){if(i.__webglCustomAttributesList)for(var c=0,p=i.__webglCustomAttributesList.length;p>c;c++){var f=i.__webglCustomAttributesList[c];a[f.buffer.belongsToAttribute]>=0&&(At.bindBuffer(At.ARRAY_BUFFER,f.buffer),$t.enableAttribute(a[f.buffer.belongsToAttribute]),At.vertexAttribPointer(a[f.buffer.belongsToAttribute],f.size,At.FLOAT,!1,0,0))}a.color>=0&&(o.geometry.colors.length>0||o.geometry.faces.length>0?(At.bindBuffer(At.ARRAY_BUFFER,i.__webglColorBuffer),$t.enableAttribute(a.color),At.vertexAttribPointer(a.color,3,At.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&At.vertexAttrib3fv(a.color,r.defaultAttributeValues.color)),a.normal>=0&&(At.bindBuffer(At.ARRAY_BUFFER,i.__webglNormalBuffer),$t.enableAttribute(a.normal),At.vertexAttribPointer(a.normal,3,At.FLOAT,!1,0,0)),a.tangent>=0&&(At.bindBuffer(At.ARRAY_BUFFER,i.__webglTangentBuffer),$t.enableAttribute(a.tangent),At.vertexAttribPointer(a.tangent,4,At.FLOAT,!1,0,0)),a.uv>=0&&(o.geometry.faceVertexUvs[0]?(At.bindBuffer(At.ARRAY_BUFFER,i.__webglUVBuffer),$t.enableAttribute(a.uv),At.vertexAttribPointer(a.uv,2,At.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&At.vertexAttrib2fv(a.uv,r.defaultAttributeValues.uv)),a.uv2>=0&&(o.geometry.faceVertexUvs[1]?(At.bindBuffer(At.ARRAY_BUFFER,i.__webglUV2Buffer),$t.enableAttribute(a.uv2),At.vertexAttribPointer(a.uv2,2,At.FLOAT,!1,0,0)):void 0!==r.defaultAttributeValues&&At.vertexAttrib2fv(a.uv2,r.defaultAttributeValues.uv2)),r.skinning&&a.skinIndex>=0&&a.skinWeight>=0&&(At.bindBuffer(At.ARRAY_BUFFER,i.__webglSkinIndicesBuffer),$t.enableAttribute(a.skinIndex),At.vertexAttribPointer(a.skinIndex,4,At.FLOAT,!1,0,0),At.bindBuffer(At.ARRAY_BUFFER,i.__webglSkinWeightsBuffer),$t.enableAttribute(a.skinWeight),At.vertexAttribPointer(a.skinWeight,4,At.FLOAT,!1,0,0)),a.lineDistance>=0&&(At.bindBuffer(At.ARRAY_BUFFER,i.__webglLineDistanceBuffer),$t.enableAttribute(a.lineDistance),At.vertexAttribPointer(a.lineDistance,1,At.FLOAT,!1,0,0))}if($t.disableUnusedAttributes(),o instanceof THREE.Mesh){var m=i.__typeArray===Uint32Array?At.UNSIGNED_INT:At.UNSIGNED_SHORT;r.wireframe?($t.setLineWidth(r.wireframeLinewidth*pt),u&&At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,i.__webglLineBuffer),At.drawElements(At.LINES,i.__webglLineCount,m,0)):(u&&At.bindBuffer(At.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),At.drawElements(At.TRIANGLES,i.__webglFaceCount,m,0)),Ct.info.render.calls++,Ct.info.render.vertices+=i.__webglFaceCount,Ct.info.render.faces+=i.__webglFaceCount/3}else if(o instanceof THREE.Line){var v=o.mode===THREE.LineStrip?At.LINE_STRIP:At.LINES;$t.setLineWidth(r.linewidth*pt),At.drawArrays(v,0,i.__webglLineCount),Ct.info.render.calls++}else o instanceof THREE.PointCloud&&(At.drawArrays(At.POINTS,0,i.__webglParticleCount),Ct.info.render.calls++,Ct.info.render.points+=i.__webglParticleCount)}},this.render=function(t,e,n,r){if(e instanceof THREE.Camera==!1)return void THREE.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var i=t.fog;Dt="",Ot=-1,Ft=null,Zt=!0,t.autoUpdate===!0&&t.updateMatrixWorld(),void 0===e.parent&&e.updateMatrixWorld(),t.traverse(function(t){t instanceof THREE.SkinnedMesh&&t.skeleton.update()}),e.matrixWorldInverse.getInverse(e.matrixWorld),qt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Wt.setFromMatrix(qt),xt.length=0,Ht.length=0,Mt.length=0,St.length=0,kt.length=0,E(t),Ct.sortObjects===!0&&(Ht.sort(m),Mt.sort(v)),ge.render(t,e),Ct.info.render.calls=0,Ct.info.render.vertices=0,Ct.info.render.faces=0,Ct.info.render.points=0,this.setRenderTarget(n),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var o=0,s=Rt.length;s>o;o++){var a=Rt[o],u=a.object;u.visible&&(Z(u,e),b(a))}if(t.overrideMaterial){var h=t.overrideMaterial;z(h),y(Ht,e,xt,i,h),y(Mt,e,xt,i,h),_(Rt,"",e,xt,i,h)}else $t.setBlending(THREE.NoBlending),y(Ht,e,xt,i,null),_(Rt,"opaque",e,xt,i,null),y(Mt,e,xt,i,null),_(Rt,"transparent",e,xt,i,null);Ee.render(t,e),ye.render(t,e,jt,Gt),n&&n.generateMipmaps&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&it(n),$t.setDepthTest(!0),$t.setDepthWrite(!0),$t.setColorWrite(!0)},this.renderImmediateObject=function(t,e,n,r,i){var o=O(t,e,n,r,i);Dt="",Ct.setMaterialFaces(r),i.immediateRenderCallback?i.immediateRenderCallback(o,At,Wt):i.render(function(t){Ct.renderBufferImmediate(t,o,r)})};var Ae={},Ce=0,Pe={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(t,e){t===THREE.CullFaceNone?At.disable(At.CULL_FACE):(e===THREE.FrontFaceDirectionCW?At.frontFace(At.CW):At.frontFace(At.CCW),t===THREE.CullFaceBack?At.cullFace(At.BACK):t===THREE.CullFaceFront?At.cullFace(At.FRONT):At.cullFace(At.FRONT_AND_BACK),At.enable(At.CULL_FACE))},this.setMaterialFaces=function(t){$t.setDoubleSided(t.side===THREE.DoubleSide),$t.setFlipSided(t.side===THREE.BackSide)},this.uploadTexture=function(t){void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",Te),t.__webglTexture=At.createTexture(),Ct.info.memory.textures++),At.bindTexture(At.TEXTURE_2D,t.__webglTexture),At.pixelStorei(At.UNPACK_FLIP_Y_WEBGL,t.flipY),At.pixelStorei(At.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),At.pixelStorei(At.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=$(t.image,se);var e=t.image,n=THREE.Math.isPowerOfTwo(e.width)&&THREE.Math.isPowerOfTwo(e.height),r=st(t.format),i=st(t.type);J(At.TEXTURE_2D,t,n);var o,s=t.mipmaps;if(t instanceof THREE.DataTexture)if(s.length>0&&n){for(var a=0,u=s.length;u>a;a++)o=s[a],At.texImage2D(At.TEXTURE_2D,a,r,o.width,o.height,0,r,i,o.data);t.generateMipmaps=!1}else At.texImage2D(At.TEXTURE_2D,0,r,e.width,e.height,0,r,i,e.data);else if(t instanceof THREE.CompressedTexture)for(var a=0,u=s.length;u>a;a++)o=s[a],t.format!==THREE.RGBAFormat&&t.format!==THREE.RGBFormat?de().indexOf(r)>-1?At.compressedTexImage2D(At.TEXTURE_2D,a,r,o.width,o.height,0,o.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):At.texImage2D(At.TEXTURE_2D,a,r,o.width,o.height,0,r,i,o.data);else if(s.length>0&&n){for(var a=0,u=s.length;u>a;a++)o=s[a],At.texImage2D(At.TEXTURE_2D,a,r,r,i,o);t.generateMipmaps=!1}else At.texImage2D(At.TEXTURE_2D,0,r,r,i,t.image);t.generateMipmaps&&n&&At.generateMipmap(At.TEXTURE_2D),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()},this.setTexture=function(t,e){At.activeTexture(At.TEXTURE0+e),t.needsUpdate?Ct.uploadTexture(t):At.bindTexture(At.TEXTURE_2D,t.__webglTexture)},this.setRenderTarget=function(t){var e=t instanceof THREE.WebGLRenderTargetCube;if(t&&void 0===t.__webglFramebuffer){void 0===t.depthBuffer&&(t.depthBuffer=!0),void 0===t.stencilBuffer&&(t.stencilBuffer=!0),t.addEventListener("dispose",xe),t.__webglTexture=At.createTexture(),Ct.info.memory.textures++;var n=THREE.Math.isPowerOfTwo(t.width)&&THREE.Math.isPowerOfTwo(t.height),r=st(t.format),i=st(t.type);if(e){t.__webglFramebuffer=[],t.__webglRenderbuffer=[],At.bindTexture(At.TEXTURE_CUBE_MAP,t.__webglTexture),J(At.TEXTURE_CUBE_MAP,t,n);for(var o=0;6>o;o++)t.__webglFramebuffer[o]=At.createFramebuffer(),t.__webglRenderbuffer[o]=At.createRenderbuffer(),At.texImage2D(At.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r,t.width,t.height,0,r,i,null),nt(t.__webglFramebuffer[o],t,At.TEXTURE_CUBE_MAP_POSITIVE_X+o),rt(t.__webglRenderbuffer[o],t);n&&At.generateMipmap(At.TEXTURE_CUBE_MAP)}else t.__webglFramebuffer=At.createFramebuffer(),t.shareDepthFrom?t.__webglRenderbuffer=t.shareDepthFrom.__webglRenderbuffer:t.__webglRenderbuffer=At.createRenderbuffer(),At.bindTexture(At.TEXTURE_2D,t.__webglTexture),J(At.TEXTURE_2D,t,n),At.texImage2D(At.TEXTURE_2D,0,r,t.width,t.height,0,r,i,null),nt(t.__webglFramebuffer,t,At.TEXTURE_2D),t.shareDepthFrom?t.depthBuffer&&!t.stencilBuffer?At.framebufferRenderbuffer(At.FRAMEBUFFER,At.DEPTH_ATTACHMENT,At.RENDERBUFFER,t.__webglRenderbuffer):t.depthBuffer&&t.stencilBuffer&&At.framebufferRenderbuffer(At.FRAMEBUFFER,At.DEPTH_STENCIL_ATTACHMENT,At.RENDERBUFFER,t.__webglRenderbuffer):rt(t.__webglRenderbuffer,t),n&&At.generateMipmap(At.TEXTURE_2D);e?At.bindTexture(At.TEXTURE_CUBE_MAP,null):At.bindTexture(At.TEXTURE_2D,null),At.bindRenderbuffer(At.RENDERBUFFER,null),At.bindFramebuffer(At.FRAMEBUFFER,null)}var s,a,u,h,l;t?(s=e?t.__webglFramebuffer[t.activeCubeFace]:t.__webglFramebuffer,a=t.width,u=t.height,h=0,l=0):(s=null,a=Vt,u=It,h=Bt,l=Nt),s!==zt&&(At.bindFramebuffer(At.FRAMEBUFFER,s),At.viewport(h,l,a,u),zt=s),jt=a,Gt=u},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(!(t instanceof THREE.WebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");if(t.__webglFramebuffer){if(t.format!==THREE.RGBAFormat)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");var s=!1;t.__webglFramebuffer!==zt&&(At.bindFramebuffer(At.FRAMEBUFFER,t.__webglFramebuffer),s=!0),At.checkFramebufferStatus(At.FRAMEBUFFER)===At.FRAMEBUFFER_COMPLETE?At.readPixels(e,n,r,i,At.RGBA,At.UNSIGNED_BYTE,o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),s&&At.bindFramebuffer(At.FRAMEBUFFER,zt)}},this.initMaterial=function(){THREE.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){THREE.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){THREE.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},THREE.WebGLRenderTarget=function(t,e,n){this.width=t,this.height=e,n=n||{},this.wrapS=void 0!==n.wrapS?n.wrapS:THREE.ClampToEdgeWrapping,this.wrapT=void 0!==n.wrapT?n.wrapT:THREE.ClampToEdgeWrapping,this.magFilter=void 0!==n.magFilter?n.magFilter:THREE.LinearFilter,this.minFilter=void 0!==n.minFilter?n.minFilter:THREE.LinearMipMapLinearFilter,this.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.format=void 0!==n.format?n.format:THREE.RGBAFormat,this.type=void 0!==n.type?n.type:THREE.UnsignedByteType,this.depthBuffer=void 0!==n.depthBuffer?n.depthBuffer:!0,this.stencilBuffer=void 0!==n.stencilBuffer?n.stencilBuffer:!0,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==n.shareDepthFrom?n.shareDepthFrom:null},THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(t,e){this.width=t,this.height=e},clone:function(){var t=new THREE.WebGLRenderTarget(this.width,this.height);return t.wrapS=this.wrapS,t.wrapT=this.wrapT,t.magFilter=this.magFilter,t.minFilter=this.minFilter,t.anisotropy=this.anisotropy,t.offset.copy(this.offset),t.repeat.copy(this.repeat),t.format=this.format,t.type=this.type,t.depthBuffer=this.depthBuffer,t.stencilBuffer=this.stencilBuffer,t.generateMipmaps=this.generateMipmaps,t.shareDepthFrom=this.shareDepthFrom,t},dispose:function(){this.dispatchEvent({type:"dispose"})}},THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube=function(t,e,n){THREE.WebGLRenderTarget.call(this,t,e,n),this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube,THREE.WebGLExtensions=function(t){var e={};this.get=function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return null===r&&THREE.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}},THREE.WebGLProgram=function(){var t=0,e=function(t){var e,n,r=[];for(var i in t)e=t[i],e!==!1&&(n="#define "+i+" "+e,r.push(n));return r.join("\n")},n=function(t,e,n){for(var r={},i=0,o=n.length;o>i;i++){var s=n[i];r[s]=t.getUniformLocation(e,s)}return r},r=function(t,e,n){for(var r={},i=0,o=n.length;o>i;i++){var s=n[i];r[s]=t.getAttribLocation(e,s)}return r};return function(i,o,s,a){var u=i,h=u.context,l=s.defines,c=s.__webglShader.uniforms,p=s.attributes,f=s.__webglShader.vertexShader,d=s.__webglShader.fragmentShader,m=s.index0AttributeName;void 0===m&&a.morphTargets===!0&&(m="position");var v="SHADOWMAP_TYPE_BASIC";a.shadowMapType===THREE.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":a.shadowMapType===THREE.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");var g="ENVMAP_TYPE_CUBE",E="ENVMAP_MODE_REFLECTION",y="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(s.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:g="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:g="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:g="ENVMAP_TYPE_SPHERE"}switch(s.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:E="ENVMAP_MODE_REFRACTION"}switch(s.combine){case THREE.MultiplyOperation:y="ENVMAP_BLENDING_MULTIPLY";break;case THREE.MixOperation:y="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:y="ENVMAP_BLENDING_ADD"}}var _,b,T=i.gammaFactor>0?i.gammaFactor:1,x=e(l),w=h.createProgram();s instanceof THREE.RawShaderMaterial?(_="",b=""):(_=["precision "+a.precision+" float;","precision "+a.precision+" int;",x,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"",u.gammaInput?"#define GAMMA_INPUT":"",u.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+T,"#define MAX_DIR_LIGHTS "+a.maxDirLights,"#define MAX_POINT_LIGHTS "+a.maxPointLights,"#define MAX_SPOT_LIGHTS "+a.maxSpotLights,"#define MAX_HEMI_LIGHTS "+a.maxHemiLights,"#define MAX_SHADOWS "+a.maxShadows,"#define MAX_BONES "+a.maxBones,a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+E:"",a.lightMap?"#define USE_LIGHTMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals?"#define USE_MORPHNORMALS":"",a.wrapAround?"#define WRAP_AROUND":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+v:"",a.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",a.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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;","attribute vec2 uv2;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",""].join("\n"),b=["precision "+a.precision+" float;","precision "+a.precision+" int;",a.bumpMap||a.normalMap||a.flatShading?"#extension GL_OES_standard_derivatives : enable":"",x,"#define MAX_DIR_LIGHTS "+a.maxDirLights,"#define MAX_POINT_LIGHTS "+a.maxPointLights,"#define MAX_SPOT_LIGHTS "+a.maxSpotLights,"#define MAX_HEMI_LIGHTS "+a.maxHemiLights,"#define MAX_SHADOWS "+a.maxShadows,a.alphaTest?"#define ALPHATEST "+a.alphaTest:"",u.gammaInput?"#define GAMMA_INPUT":"",u.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+T,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+g:"",a.envMap?"#define "+E:"",a.envMap?"#define "+y:"",a.lightMap?"#define USE_LIGHTMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.metal?"#define METAL":"",a.wrapAround?"#define WRAP_AROUND":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+v:"",a.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",a.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var R=new THREE.WebGLShader(h,h.VERTEX_SHADER,_+f),H=new THREE.WebGLShader(h,h.FRAGMENT_SHADER,b+d);h.attachShader(w,R),h.attachShader(w,H),void 0!==m&&h.bindAttribLocation(w,0,m),h.linkProgram(w);var M=h.getProgramInfoLog(w);h.getProgramParameter(w,h.LINK_STATUS)===!1&&THREE.error("THREE.WebGLProgram: shader error: "+h.getError(),"gl.VALIDATE_STATUS",h.getProgramParameter(w,h.VALIDATE_STATUS),"gl.getPRogramInfoLog",M),""!==M&&THREE.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+M),h.deleteShader(R),h.deleteShader(H);var S=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];a.useVertexTexture?(S.push("boneTexture"),S.push("boneTextureWidth"),S.push("boneTextureHeight")):S.push("boneGlobalMatrices"),a.logarithmicDepthBuffer&&S.push("logDepthBufFC");for(var k in c)S.push(k);this.uniforms=n(h,w,S),S=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var A=0;At;t++)n[t]=0},this.enableAttribute=function(e){n[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1)},this.disableUnusedAttributes=function(){for(var e=0,i=r.length;i>e;e++)r[e]!==n[e]&&(t.disableVertexAttribArray(e),r[e]=0)},this.setBlending=function(n,r,c,p,f,d,m){n!==i&&(n===THREE.NoBlending?t.disable(t.BLEND):n===THREE.AdditiveBlending?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):n===THREE.SubtractiveBlending?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):n===THREE.MultiplyBlending?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):n===THREE.CustomBlending?t.enable(t.BLEND):(t.enable(t.BLEND),t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),i=n),n===THREE.CustomBlending?(f=f||r,d=d||c,m=m||p,(r!==o||f!==u)&&(t.blendEquationSeparate(e(r),e(f)),o=r,u=f),(c!==s||p!==a||d!==h||m!==l)&&(t.blendFuncSeparate(e(c),e(p),e(d),e(m)),s=c,a=p,h=d,l=m)):(o=null,s=null,a=null,u=null,h=null,l=null)},this.setDepthTest=function(e){c!==e&&(e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),c=e)},this.setDepthWrite=function(e){p!==e&&(t.depthMask(e),p=e)},this.setColorWrite=function(e){f!==e&&(t.colorMask(e,e,e,e),f=e)},this.setDoubleSided=function(e){d!==e&&(e?t.disable(t.CULL_FACE):t.enable(t.CULL_FACE),d=e)},this.setFlipSided=function(e){m!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),m=e)},this.setLineWidth=function(e){e!==v&&(t.lineWidth(e),v=e)},this.setPolygonOffset=function(e,n,r){g!==e&&(e?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),g=e),!e||E===n&&y===r||(t.polygonOffset(n,r),E=n,y=r)},this.reset=function(){for(var t=0;t0;var p;p=u?{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")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","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:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},o=n(p),s={vertex:c.getAttribLocation(o,"position"),uv:c.getAttribLocation(o,"uv")},a={renderType:c.getUniformLocation(o,"renderType"),map:c.getUniformLocation(o,"map"),occlusionMap:c.getUniformLocation(o,"occlusionMap"),opacity:c.getUniformLocation(o,"opacity"),color:c.getUniformLocation(o,"color"),scale:c.getUniformLocation(o,"scale"),rotation:c.getUniformLocation(o,"rotation"),screenPosition:c.getUniformLocation(o,"screenPosition")}};this.render=function(n,f,d,m){if(0!==e.length){var v=new THREE.Vector3,g=m/d,E=.5*d,y=.5*m,_=16/m,b=new THREE.Vector2(_*g,_),T=new THREE.Vector3(1,1,0),x=new THREE.Vector2(1,1);void 0===o&&p(),c.useProgram(o),c.enableVertexAttribArray(s.vertex),c.enableVertexAttribArray(s.uv),c.uniform1i(a.occlusionMap,0),c.uniform1i(a.map,1),c.bindBuffer(c.ARRAY_BUFFER,r),c.vertexAttribPointer(s.vertex,2,c.FLOAT,!1,16,0),c.vertexAttribPointer(s.uv,2,c.FLOAT,!1,16,8),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,i),c.disable(c.CULL_FACE),c.depthMask(!1);for(var w=0,R=e.length;R>w;w++){_=16/m,b.set(_*g,_);var H=e[w];if(v.set(H.matrixWorld.elements[12],H.matrixWorld.elements[13],H.matrixWorld.elements[14]),v.applyMatrix4(f.matrixWorldInverse),v.applyProjection(f.projectionMatrix),T.copy(v),x.x=T.x*E+E,x.y=T.y*y+y,u||x.x>0&&x.x0&&x.yM;M++){var k=H.lensFlares[M];k.opacity>.001&&k.scale>.001&&(T.x=k.x,T.y=k.y,T.z=k.z,_=k.size*k.scale/m,b.x=_*g,b.y=_,c.uniform3f(a.screenPosition,T.x,T.y,T.z),c.uniform2f(a.scale,b.x,b.y),c.uniform1f(a.rotation,k.rotation),c.uniform1f(a.opacity,k.opacity),c.uniform3f(a.color,k.color.r,k.color.g,k.color.b),t.state.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst),t.setTexture(k.texture,1),c.drawElements(c.TRIANGLES,6,c.UNSIGNED_SHORT,0))}}}c.enable(c.CULL_FACE),c.enable(c.DEPTH_TEST),c.depthMask(!0),t.resetGLState()}}},THREE.ShadowMapPlugin=function(t,e,n,r){function i(t,e,r){if(e.visible){var o=n[e.id];if(o&&e.castShadow&&(e.frustumCulled===!1||d.intersectsObject(e)===!0))for(var s=0,a=o.length;a>s;s++){var u=o[s];e._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),y.push(u)}for(var s=0,a=e.children.length;a>s;s++)i(t,e.children[s],r)}}function o(t,e){var n=new THREE.DirectionalLight;n.isVirtual=!0,n.onlyShadow=!0,n.castShadow=!0,n.shadowCameraNear=t.shadowCameraNear,n.shadowCameraFar=t.shadowCameraFar,n.shadowCameraLeft=t.shadowCameraLeft,n.shadowCameraRight=t.shadowCameraRight,n.shadowCameraBottom=t.shadowCameraBottom,n.shadowCameraTop=t.shadowCameraTop,n.shadowCameraVisible=t.shadowCameraVisible,n.shadowDarkness=t.shadowDarkness, +n.shadowBias=t.shadowCascadeBias[e],n.shadowMapWidth=t.shadowCascadeWidth[e],n.shadowMapHeight=t.shadowCascadeHeight[e],n.pointsWorld=[],n.pointsFrustum=[];for(var r=n.pointsWorld,i=n.pointsFrustum,o=0;8>o;o++)r[o]=new THREE.Vector3,i[o]=new THREE.Vector3;var s=t.shadowCascadeNearZ[e],a=t.shadowCascadeFarZ[e];return i[0].set(-1,-1,s),i[1].set(1,-1,s),i[2].set(-1,1,s),i[3].set(1,1,s),i[4].set(-1,-1,a),i[5].set(1,-1,a),i[6].set(-1,1,a),i[7].set(1,1,a),n}function s(t,e){var n=t.shadowCascadeArray[e];n.position.copy(t.position),n.target.position.copy(t.target.position),n.lookAt(n.target),n.shadowCameraVisible=t.shadowCameraVisible,n.shadowDarkness=t.shadowDarkness,n.shadowBias=t.shadowCascadeBias[e];var r=t.shadowCascadeNearZ[e],i=t.shadowCascadeFarZ[e],o=n.pointsFrustum;o[0].z=r,o[1].z=r,o[2].z=r,o[3].z=r,o[4].z=i,o[5].z=i,o[6].z=i,o[7].z=i}function a(t,e){var n=e.shadowCamera,r=e.pointsFrustum,i=e.pointsWorld;v.set(1/0,1/0,1/0),g.set(-(1/0),-(1/0),-(1/0));for(var o=0;8>o;o++){var s=i[o];s.copy(r[o]),s.unproject(t),s.applyMatrix4(n.matrixWorldInverse),s.xg.x&&(g.x=s.x),s.yg.y&&(g.y=s.y),s.zg.z&&(g.z=s.z)}n.left=v.x,n.right=g.x,n.top=g.y,n.bottom=v.y,n.updateProjectionMatrix()}function u(t){return t.material instanceof THREE.MeshFaceMaterial?t.material.materials[0]:t.material}var h,l,c,p,f=t.context,d=new THREE.Frustum,m=new THREE.Matrix4,v=new THREE.Vector3,g=new THREE.Vector3,E=new THREE.Vector3,y=[],_=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(_.uniforms);h=new THREE.ShaderMaterial({uniforms:b,vertexShader:_.vertexShader,fragmentShader:_.fragmentShader}),l=new THREE.ShaderMaterial({uniforms:b,vertexShader:_.vertexShader,fragmentShader:_.fragmentShader,morphTargets:!0}),c=new THREE.ShaderMaterial({uniforms:b,vertexShader:_.vertexShader,fragmentShader:_.fragmentShader,skinning:!0}),p=new THREE.ShaderMaterial({uniforms:b,vertexShader:_.vertexShader,fragmentShader:_.fragmentShader,morphTargets:!0,skinning:!0}),h._shadowPass=!0,l._shadowPass=!0,c._shadowPass=!0,p._shadowPass=!0,this.render=function(n,v){if(t.shadowMapEnabled!==!1){var g,_,b,T,x,w,R,H,M,S,k,A,C,P=[],L=0,z=null;for(f.clearColor(1,1,1,1),f.disable(f.BLEND),f.enable(f.CULL_FACE),f.frontFace(f.CCW),t.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK),t.state.setDepthTest(!0),g=0,_=e.length;_>g;g++)if(C=e[g],C.castShadow)if(C instanceof THREE.DirectionalLight&&C.shadowCascade)for(x=0;xg;g++){if(C=P[g],!C.shadowMap){var F=THREE.LinearFilter;t.shadowMapType===THREE.PCFSoftShadowMap&&(F=THREE.NearestFilter);var U={minFilter:F,magFilter:F,format:THREE.RGBAFormat};C.shadowMap=new THREE.WebGLRenderTarget(C.shadowMapWidth,C.shadowMapHeight,U),C.shadowMapSize=new THREE.Vector2(C.shadowMapWidth,C.shadowMapHeight),C.shadowMatrix=new THREE.Matrix4}if(!C.shadowCamera){if(C instanceof THREE.SpotLight)C.shadowCamera=new THREE.PerspectiveCamera(C.shadowCameraFov,C.shadowMapWidth/C.shadowMapHeight,C.shadowCameraNear,C.shadowCameraFar);else{if(!(C instanceof THREE.DirectionalLight)){THREE.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",C);continue}C.shadowCamera=new THREE.OrthographicCamera(C.shadowCameraLeft,C.shadowCameraRight,C.shadowCameraTop,C.shadowCameraBottom,C.shadowCameraNear,C.shadowCameraFar)}n.add(C.shadowCamera),n.autoUpdate===!0&&n.updateMatrixWorld()}C.shadowCameraVisible&&!C.cameraHelper&&(C.cameraHelper=new THREE.CameraHelper(C.shadowCamera),n.add(C.cameraHelper)),C.isVirtual&&O.originalCamera==v&&a(v,C),w=C.shadowMap,R=C.shadowMatrix,H=C.shadowCamera,H.position.setFromMatrixPosition(C.matrixWorld),E.setFromMatrixPosition(C.target.matrixWorld),H.lookAt(E),H.updateMatrixWorld(),H.matrixWorldInverse.getInverse(H.matrixWorld),C.cameraHelper&&(C.cameraHelper.visible=C.shadowCameraVisible),C.shadowCameraVisible&&C.cameraHelper.update(),R.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),R.multiply(H.projectionMatrix),R.multiply(H.matrixWorldInverse),m.multiplyMatrices(H.projectionMatrix,H.matrixWorldInverse),d.setFromMatrix(m),t.setRenderTarget(w),t.clear(),y.length=0,i(n,n,H);var B,N,V;for(b=0,T=y.length;T>b;b++)k=y[b],A=k.object,M=k.buffer,B=u(A),N=void 0!==A.geometry.morphTargets&&A.geometry.morphTargets.length>0&&B.morphTargets,V=A instanceof THREE.SkinnedMesh&&B.skinning,S=A.customDepthMaterial?A.customDepthMaterial:V?N?p:c:N?l:h,t.setMaterialFaces(B),M instanceof THREE.BufferGeometry?t.renderBufferDirect(H,e,z,S,M,A):t.renderBuffer(H,e,z,S,M,A);for(b=0,T=r.length;T>b;b++)k=r[b],A=k.object,A.visible&&A.castShadow&&(A._modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,A.matrixWorld),t.renderImmediateObject(H,e,z,h,A))}var I=t.getClearColor(),j=t.getClearAlpha();f.clearColor(I.r,I.g,I.b,j),f.enable(f.BLEND),t.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK),t.resetGLState()}}},THREE.SpritePlugin=function(t,e){function n(){var e=l.createProgram(),n=l.createShader(l.VERTEX_SHADER),r=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","float 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")),l.compileShader(n),l.compileShader(r),l.attachShader(e,n),l.attachShader(e,r),l.linkProgram(e),e}function r(t,e){return t.z!==e.z?e.z-t.z:e.id-t.id}var i,o,s,a,u,h,l=t.context,c=new THREE.Vector3,p=new THREE.Quaternion,f=new THREE.Vector3,d=function(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);i=l.createBuffer(),o=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,i),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,o),l.bufferData(l.ELEMENT_ARRAY_BUFFER,e,l.STATIC_DRAW),s=n(),a={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},u={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var r=document.createElement("canvas");r.width=8,r.height=8;var c=r.getContext("2d");c.fillStyle="white",c.fillRect(0,0,8,8),h=new THREE.Texture(r),h.needsUpdate=!0};this.render=function(n,m){if(0!==e.length){void 0===s&&d(),l.useProgram(s),l.enableVertexAttribArray(a.position),l.enableVertexAttribArray(a.uv),l.disable(l.CULL_FACE),l.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,i),l.vertexAttribPointer(a.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(a.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,o),l.uniformMatrix4fv(u.projectionMatrix,!1,m.projectionMatrix.elements),l.activeTexture(l.TEXTURE0),l.uniform1i(u.map,0);var v=0,g=0,E=n.fog;E?(l.uniform3f(u.fogColor,E.color.r,E.color.g,E.color.b),E instanceof THREE.Fog?(l.uniform1f(u.fogNear,E.near),l.uniform1f(u.fogFar,E.far),l.uniform1i(u.fogType,1),v=1,g=1):E instanceof THREE.FogExp2&&(l.uniform1f(u.fogDensity,E.density),l.uniform1i(u.fogType,2),v=2,g=2)):(l.uniform1i(u.fogType,0),v=0,g=0);for(var y=0,_=e.length;_>y;y++){var b=e[y];b._modelViewMatrix.multiplyMatrices(m.matrixWorldInverse,b.matrixWorld),b.z=-b._modelViewMatrix.elements[14]}e.sort(r);for(var T=[],y=0,_=e.length;_>y;y++){var b=e[y],x=b.material;l.uniform1f(u.alphaTest,x.alphaTest),l.uniformMatrix4fv(u.modelViewMatrix,!1,b._modelViewMatrix.elements),b.matrixWorld.decompose(c,p,f),T[0]=f.x,T[1]=f.y;var w=0;n.fog&&x.fog&&(w=g),v!==w&&(l.uniform1i(u.fogType,w),v=w),null!==x.map?(l.uniform2f(u.uvOffset,x.map.offset.x,x.map.offset.y),l.uniform2f(u.uvScale,x.map.repeat.x,x.map.repeat.y)):(l.uniform2f(u.uvOffset,0,0),l.uniform2f(u.uvScale,1,1)),l.uniform1f(u.opacity,x.opacity),l.uniform3f(u.color,x.color.r,x.color.g,x.color.b),l.uniform1f(u.rotation,x.rotation),l.uniform2fv(u.scale,T),t.state.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst),t.state.setDepthTest(x.depthTest),t.state.setDepthWrite(x.depthWrite),x.map&&x.map.image&&x.map.image.width?t.setTexture(x.map,0):t.setTexture(h,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}l.enable(l.CULL_FACE),t.resetGLState()}}},THREE.GeometryUtils={merge:function(t,e,n){THREE.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var r;e instanceof THREE.Mesh&&(e.matrixAutoUpdate&&e.updateMatrix(),r=e.matrix,e=e.geometry),t.merge(e,r,n)},center:function(t){return THREE.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(t,e,n,r){var i=new THREE.ImageLoader;i.crossOrigin=this.crossOrigin;var o=new THREE.Texture(void 0,e);return i.load(t,function(t){o.image=t,o.needsUpdate=!0,n&&n(o)},void 0,function(t){r&&r(t)}),o.sourceFile=t,o},loadTextureCube:function(t,e,n,r){var i=[],o=new THREE.ImageLoader;o.crossOrigin=this.crossOrigin;var s=new THREE.CubeTexture(i,e);s.flipY=!1;for(var a=0,u=function(e){o.load(t[e],function(t){s.images[e]=t,a+=1,6===a&&(s.needsUpdate=!0,n&&n(s))},void 0,r)},h=0,l=t.length;l>h;++h)u(h);return s},loadCompressedTexture:function(){THREE.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){THREE.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(t,e){var n=function(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]},r=function(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]},i=function(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);return[t[0]/e,t[1]/e,t[2]/e]};e=1|e;var o=t.width,s=t.height,a=document.createElement("canvas");a.width=o,a.height=s;var u=a.getContext("2d");u.drawImage(t,0,0);for(var h=u.getImageData(0,0,o,s).data,l=u.createImageData(o,s),c=l.data,p=0;o>p;p++)for(var f=0;s>f;f++){var d=0>f-1?0:f-1,m=f+1>s-1?s-1:f+1,v=0>p-1?0:p-1,g=p+1>o-1?o-1:p+1,E=[],y=[0,0,h[4*(f*o+p)]/255*e];E.push([-1,0,h[4*(f*o+v)]/255*e]),E.push([-1,-1,h[4*(d*o+v)]/255*e]),E.push([0,-1,h[4*(d*o+p)]/255*e]),E.push([1,-1,h[4*(d*o+g)]/255*e]),E.push([1,0,h[4*(f*o+g)]/255*e]),E.push([1,1,h[4*(m*o+g)]/255*e]),E.push([0,1,h[4*(m*o+p)]/255*e]),E.push([-1,1,h[4*(m*o+v)]/255*e]);for(var _=[],b=E.length,T=0;b>T;T++){var x=E[T],w=E[(T+1)%b];x=r(x,y),w=r(w,y),_.push(i(n(x,w)))}for(var R=[0,0,0],T=0;T<_.length;T++)R[0]+=_[T][0],R[1]+=_[T][1],R[2]+=_[T][2];R[0]/=_.length,R[1]/=_.length,R[2]/=_.length;var H=4*(f*o+p);c[H]=(R[0]+1)/2*255|0,c[H+1]=(R[1]+1)/2*255|0,c[H+2]=255*R[2]|0,c[H+3]=255}return u.putImageData(l,0,0),a},generateDataTexture:function(t,e,n){for(var r=t*e,i=new Uint8Array(3*r),o=Math.floor(255*n.r),s=Math.floor(255*n.g),a=Math.floor(255*n.b),u=0;r>u;u++)i[3*u]=o,i[3*u+1]=s,i[3*u+2]=a;var h=new THREE.DataTexture(i,t,e,THREE.RGBFormat);return h.needsUpdate=!0,h}},THREE.SceneUtils={createMultiMaterialObject:function(t,e){for(var n=new THREE.Object3D,r=0,i=e.length;i>r;r++)n.add(new THREE.Mesh(t,e[r]));return n},detach:function(t,e,n){t.applyMatrix(e.matrixWorld),e.remove(t),n.add(t)},attach:function(t,e,n){var r=new THREE.Matrix4;r.getInverse(n.matrixWorld),t.applyMatrix(r),e.remove(t),n.add(t)}},THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(t){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(t){var e=t.familyName.toLowerCase(),n=this;return n.faces[e]=n.faces[e]||{},n.faces[e][t.cssFontWeight]=n.faces[e][t.cssFontWeight]||{},n.faces[e][t.cssFontWeight][t.cssFontStyle]=t,n.faces[e][t.cssFontWeight][t.cssFontStyle]=t,t},drawText:function(t){var e,n=this.getFace(),r=this.size/n.resolution,i=0,o=String(t).split(""),s=o.length,a=[];for(e=0;s>e;e++){var u=new THREE.Path,h=this.extractGlyphPoints(o[e],n,r,i,u);i+=h.offset,a.push(h.path)}var l=i/2;return{paths:a,offset:l}},extractGlyphPoints:function(t,e,n,r,i){var o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w=[],R=e.glyphs[t]||e.glyphs["?"];if(R){if(R.o)for(u=R._cachedOutline||(R._cachedOutline=R.o.split(" ")),l=u.length,c=n,p=n,o=0;l>o;)switch(h=u[o++]){case"m":f=u[o++]*c+r,d=u[o++]*p,i.moveTo(f,d);break;case"l":f=u[o++]*c+r,d=u[o++]*p,i.lineTo(f,d);break;case"q":if(m=u[o++]*c+r,v=u[o++]*p,y=u[o++]*c+r,_=u[o++]*p,i.quadraticCurveTo(y,_,m,v),x=w[w.length-1])for(g=x.x,E=x.y,s=1,a=this.divisions;a>=s;s++){var H=s/a;THREE.Shape.Utils.b2(H,g,y,m),THREE.Shape.Utils.b2(H,E,_,v)}break;case"b":if(m=u[o++]*c+r,v=u[o++]*p,y=u[o++]*c+r,_=u[o++]*p,b=u[o++]*c+r,T=u[o++]*p,i.bezierCurveTo(y,_,b,T,m,v),x=w[w.length-1])for(g=x.x,E=x.y,s=1,a=this.divisions;a>=s;s++){var H=s/a;THREE.Shape.Utils.b3(H,g,y,b,m),THREE.Shape.Utils.b3(H,E,_,T,v)}}return{offset:R.ha*n,path:i}}}},THREE.FontUtils.generateShapes=function(t,e){e=e||{};var n=void 0!==e.size?e.size:100,r=void 0!==e.curveSegments?e.curveSegments:4,i=void 0!==e.font?e.font:"helvetiker",o=void 0!==e.weight?e.weight:"normal",s=void 0!==e.style?e.style:"normal";THREE.FontUtils.size=n,THREE.FontUtils.divisions=r,THREE.FontUtils.face=i,THREE.FontUtils.weight=o,THREE.FontUtils.style=s;for(var a=THREE.FontUtils.drawText(t),u=a.paths,h=[],l=0,c=u.length;c>l;l++)Array.prototype.push.apply(h,u[l].toShapes());return h},function(t){var e=1e-10,n=function(t,e){var n=t.length;if(3>n)return null;var o,s,a,u=[],h=[],l=[];if(r(t)>0)for(s=0;n>s;s++)h[s]=s;else for(s=0;n>s;s++)h[s]=n-1-s;var c=n,p=2*c;for(s=c-1;c>2;){if(p--<=0)return THREE.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()"),e?l:u;if(o=s,o>=c&&(o=0),s=o+1,s>=c&&(s=0),a=s+1,a>=c&&(a=0),i(t,o,s,a,c,h)){var f,d,m,v,g;for(f=h[o],d=h[s],m=h[a],u.push([t[f],t[d],t[m]]),l.push([h[o],h[s],h[a]]),v=s,g=s+1;c>g;v++,g++)h[v]=h[g];c--,p=2*c}}return e?l:u},r=function(t){for(var e=t.length,n=0,r=e-1,i=0;e>i;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},i=function(t,n,r,i,o,s){var a,u,h,l,c,p,f,d,m;if(u=t[s[n]].x,h=t[s[n]].y,l=t[s[r]].x,c=t[s[r]].y,p=t[s[i]].x,f=t[s[i]].y,e>(l-u)*(f-h)-(c-h)*(p-u))return!1;var v,g,E,y,_,b,T,x,w,R,H,M,S,k,A;for(v=p-l,g=f-c,E=u-p,y=h-f,_=l-u,b=c-h,a=0;o>a;a++)if(d=t[s[a]].x,m=t[s[a]].y,!(d===u&&m===h||d===l&&m===c||d===p&&m===f)&&(T=d-u,x=m-h,w=d-l,R=m-c,H=d-p,M=m-f,A=v*R-g*w,S=_*x-b*T,k=E*M-y*H,A>=-e&&k>=-e&&S>=-e))return!1;return!0};return t.Triangulate=n,t.Triangulate.area=r,t}(THREE.FontUtils),self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace},THREE.typeface_js=self._typeface_js,THREE.Audio=function(t){THREE.Object3D.call(this),this.type="Audio",this.context=t.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.isPlaying=!1},THREE.Audio.prototype=Object.create(THREE.Object3D.prototype),THREE.Audio.prototype.constructor=THREE.Audio,THREE.Audio.prototype.load=function(t){var e=this,n=new XMLHttpRequest;return n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(t){e.context.decodeAudioData(this.response,function(t){e.source.buffer=t,e.autoplay&&e.play()})},n.send(),this},THREE.Audio.prototype.play=function(){if(this.isPlaying===!0)return void THREE.warn("THREE.Audio: Audio is already playing.");var t=this.context.createBufferSource();t.buffer=this.source.buffer,t.loop=this.source.loop,t.onended=this.source.onended,t.connect(this.panner),t.start(0,this.startTime),this.isPlaying=!0,this.source=t},THREE.Audio.prototype.pause=function(){this.source.stop(),this.startTime=this.context.currentTime},THREE.Audio.prototype.stop=function(){this.source.stop(),this.startTime=0},THREE.Audio.prototype.onEnded=function(){this.isPlaying=!1},THREE.Audio.prototype.setLoop=function(t){this.source.loop=t},THREE.Audio.prototype.setRefDistance=function(t){this.panner.refDistance=t},THREE.Audio.prototype.setRolloffFactor=function(t){this.panner.rolloffFactor=t},THREE.Audio.prototype.setVolume=function(t){this.gain.gain.value=t},THREE.Audio.prototype.updateMatrixWorld=function(){var t=new THREE.Vector3;return function(e){THREE.Object3D.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}(),THREE.AudioListener=function(){THREE.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype),THREE.AudioListener.prototype.constructor=THREE.AudioListener,THREE.AudioListener.prototype.updateMatrixWorld=function(){var t=new THREE.Vector3,e=new THREE.Quaternion,n=new THREE.Vector3,r=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3;return function(s){THREE.Object3D.prototype.updateMatrixWorld.call(this,s);var a=this.context.listener,u=this.up;this.matrixWorld.decompose(t,e,n),r.set(0,0,-1).applyQuaternion(e),i.subVectors(t,o),a.setPosition(t.x,t.y,t.z),a.setOrientation(r.x,r.y,r.z,u.x,u.y,u.z),a.setVelocity(i.x,i.y,i.z),o.copy(t)}}(),THREE.Curve=function(){},THREE.Curve.prototype.getPoint=function(t){return THREE.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},THREE.Curve.prototype.getPointAt=function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},THREE.Curve.prototype.getPoints=function(t){t||(t=5);var e,n=[];for(e=0;t>=e;e++)n.push(this.getPoint(e/t));return n},THREE.Curve.prototype.getSpacedPoints=function(t){t||(t=5);var e,n=[];for(e=0;t>=e;e++)n.push(this.getPointAt(e/t));return n},THREE.Curve.prototype.getLength=function(){var t=this.getLengths();return t[t.length-1]},THREE.Curve.prototype.getLengths=function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,r=[],i=this.getPoint(0),o=0;for(r.push(0),n=1;t>=n;n++)e=this.getPoint(n/t),o+=e.distanceTo(i),r.push(o),i=e;return this.cacheArcLengths=r,r},THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},THREE.Curve.prototype.getUtoTmapping=function(t,e){var n,r=this.getLengths(),i=0,o=r.length;n=e?e:t*r[o-1];for(var s,a=0,u=o-1;u>=a;)if(i=Math.floor(a+(u-a)/2),s=r[i]-n,0>s)a=i+1;else{if(!(s>0)){u=i;break}u=i-1}if(i=u,r[i]==n){var h=i/(o-1);return h}var l=r[i],c=r[i+1],p=c-l,f=(n-l)/p,h=(i+f)/(o-1);return h},THREE.Curve.prototype.getTangent=function(t){var e=1e-4,n=t-e,r=t+e;0>n&&(n=0),r>1&&(r=1);var i=this.getPoint(n),o=this.getPoint(r),s=o.clone().sub(i);return s.normalize()},THREE.Curve.prototype.getTangentAt=function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},THREE.Curve.Utils={tangentQuadraticBezier:function(t,e,n,r){return 2*(1-t)*(n-e)+2*t*(r-n)},tangentCubicBezier:function(t,e,n,r,i){return-3*e*(1-t)*(1-t)+3*n*(1-t)*(1-t)-6*t*n*(1-t)+6*t*r*(1-t)-3*t*t*r+3*t*t*i},tangentSpline:function(t,e,n,r,i){var o=6*t*t-6*t,s=3*t*t-4*t+1,a=-6*t*t+6*t,u=3*t*t-2*t;return o+s+a+u},interpolate:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i,u=i*a;return(2*e-2*n+o+s)*u+(-3*e+3*n-2*o-s)*a+o*i+e}},THREE.Curve.create=function(t,e){return t.prototype=Object.create(THREE.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},THREE.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype),THREE.CurvePath.prototype.constructor=THREE.CurvePath,THREE.CurvePath.prototype.add=function(t){this.curves.push(t)},THREE.CurvePath.prototype.checkConnection=function(){},THREE.CurvePath.prototype.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 THREE.LineCurve(e,t))},THREE.CurvePath.prototype.getPoint=function(t){for(var e,n,r=t*this.getLength(),i=this.getCurveLengths(),o=0;o=r){e=i[o]-r,n=this.curves[o];var s=1-e/n.getLength();return n.getPointAt(s)}o++}return null},THREE.CurvePath.prototype.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var t,e=[],n=0,r=this.curves.length;for(t=0;r>t;t++)n+=this.curves[t].getLength(),e.push(n);return this.cacheLengths=e,e},THREE.CurvePath.prototype.getBoundingBox=function(){var t,e,n,r,i,o,s=this.getPoints();t=e=Number.NEGATIVE_INFINITY,r=i=Number.POSITIVE_INFINITY;var a,u,h,l,c=s[0]instanceof THREE.Vector3;for(l=c?new THREE.Vector3:new THREE.Vector2,u=0,h=s.length;h>u;u++)a=s[u],a.x>t?t=a.x:a.xe?e=a.y:a.yn?n=a.z:a.zn;n++)i=this.getWrapPoints(i,e[n]);return i},THREE.CurvePath.prototype.getTransformedSpacedPoints=function(t,e){var n,r,i=this.getSpacedPoints(t);for(e||(e=this.bends),n=0,r=e.length;r>n;n++)i=this.getWrapPoints(i,e[n]);return i},THREE.CurvePath.prototype.getWrapPoints=function(t,e){var n,r,i,o,s,a,u=this.getBoundingBox();for(n=0,r=t.length;r>n;n++){i=t[n],o=i.x,s=i.y,a=o/u.maxX,a=e.getUtoTmapping(a,o);var h=e.getPoint(a),l=e.getTangent(a);l.set(-l.y,l.x).multiplyScalar(s),i.x=h.x+l.x,i.y=h.y+l.y}return t},THREE.Gyroscope=function(){THREE.Object3D.call(this)},THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype),THREE.Gyroscope.prototype.constructor=THREE.Gyroscope,THREE.Gyroscope.prototype.updateMatrixWorld=function(){var t=new THREE.Vector3,e=new THREE.Quaternion,n=new THREE.Vector3,r=new THREE.Vector3,i=new THREE.Quaternion,o=new THREE.Vector3;return function(s){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||s)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(r,i,o),this.matrix.decompose(t,e,n),this.matrixWorld.compose(r,e,o)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,s=!0);for(var a=0,u=this.children.length;u>a;a++)this.children[a].updateMatrixWorld(s)}}(),THREE.Path=function(t){THREE.CurvePath.call(this),this.actions=[],t&&this.fromPoints(t)},THREE.Path.prototype=Object.create(THREE.CurvePath.prototype),THREE.Path.prototype.constructor=THREE.Path,THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},THREE.Path.prototype.fromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;n>e;e++)this.lineTo(t[e].x,t[e].y)},THREE.Path.prototype.moveTo=function(t,e){var n=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:n})},THREE.Path.prototype.lineTo=function(t,e){var n=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,i=r[r.length-2],o=r[r.length-1],s=new THREE.LineCurve(new THREE.Vector2(i,o),new THREE.Vector2(t,e));this.curves.push(s),this.actions.push({action:THREE.PathActions.LINE_TO,args:n})},THREE.Path.prototype.quadraticCurveTo=function(t,e,n,r){var i=Array.prototype.slice.call(arguments),o=this.actions[this.actions.length-1].args,s=o[o.length-2],a=o[o.length-1],u=new THREE.QuadraticBezierCurve(new THREE.Vector2(s,a),new THREE.Vector2(t,e),new THREE.Vector2(n,r));this.curves.push(u),this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:i})},THREE.Path.prototype.bezierCurveTo=function(t,e,n,r,i,o){var s=Array.prototype.slice.call(arguments),a=this.actions[this.actions.length-1].args,u=a[a.length-2],h=a[a.length-1],l=new THREE.CubicBezierCurve(new THREE.Vector2(u,h),new THREE.Vector2(t,e),new THREE.Vector2(n,r),new THREE.Vector2(i,o));this.curves.push(l),this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:s})},THREE.Path.prototype.splineThru=function(t){var e=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args,r=n[n.length-2],i=n[n.length-1],o=[new THREE.Vector2(r,i)];Array.prototype.push.apply(o,t);var s=new THREE.SplineCurve(o);this.curves.push(s),this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:e})},THREE.Path.prototype.arc=function(t,e,n,r,i,o){var s=this.actions[this.actions.length-1].args,a=s[s.length-2],u=s[s.length-1];this.absarc(t+a,e+u,n,r,i,o)},THREE.Path.prototype.absarc=function(t,e,n,r,i,o){this.absellipse(t,e,n,n,r,i,o)},THREE.Path.prototype.ellipse=function(t,e,n,r,i,o,s){var a=this.actions[this.actions.length-1].args,u=a[a.length-2],h=a[a.length-1];this.absellipse(t+u,e+h,n,r,i,o,s)},THREE.Path.prototype.absellipse=function(t,e,n,r,i,o,s){var a=Array.prototype.slice.call(arguments),u=new THREE.EllipseCurve(t,e,n,r,i,o,s);this.curves.push(u);var h=u.getPoint(1);a.push(h.x),a.push(h.y),this.actions.push({action:THREE.PathActions.ELLIPSE,args:a})},THREE.Path.prototype.getSpacedPoints=function(t,e){t||(t=40);for(var n=[],r=0;t>r;r++)n.push(this.getPoint(r/t));return n},THREE.Path.prototype.getPoints=function(t,e){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(t,e);t=t||12;var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_=[];for(n=0,r=this.actions.length;r>n;n++)switch(i=this.actions[n],o=i.action,s=i.args,o){case THREE.PathActions.MOVE_TO:_.push(new THREE.Vector2(s[0],s[1]));break;case THREE.PathActions.LINE_TO:_.push(new THREE.Vector2(s[0],s[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:for(a=s[2],u=s[3],c=s[0],p=s[1],_.length>0?(m=_[_.length-1],f=m.x,d=m.y):(m=this.actions[n-1].args,f=m[m.length-2],d=m[m.length-1]),v=1;t>=v;v++)g=v/t,E=THREE.Shape.Utils.b2(g,f,c,a),y=THREE.Shape.Utils.b2(g,d,p,u),_.push(new THREE.Vector2(E,y));break;case THREE.PathActions.BEZIER_CURVE_TO:for(a=s[4],u=s[5],c=s[0],p=s[1],h=s[2],l=s[3],_.length>0?(m=_[_.length-1],f=m.x,d=m.y):(m=this.actions[n-1].args,f=m[m.length-2],d=m[m.length-1]),v=1;t>=v;v++)g=v/t,E=THREE.Shape.Utils.b3(g,f,c,h,a),y=THREE.Shape.Utils.b3(g,d,p,l,u),_.push(new THREE.Vector2(E,y));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[n-1].args;var b=new THREE.Vector2(m[m.length-2],m[m.length-1]),T=[b],x=t*s[0].length;T=T.concat(s[0]);var w=new THREE.SplineCurve(T);for(v=1;x>=v;v++)_.push(w.getPointAt(v/x));break;case THREE.PathActions.ARC:var R,H=s[0],M=s[1],S=s[2],k=s[3],A=s[4],C=!!s[5],P=A-k,L=2*t;for(v=1;L>=v;v++)g=v/L,C||(g=1-g),R=k+g*P,E=H+S*Math.cos(R),y=M+S*Math.sin(R),_.push(new THREE.Vector2(E,y));break;case THREE.PathActions.ELLIPSE:var R,H=s[0],M=s[1],z=s[2],O=s[3],k=s[4],A=s[5],C=!!s[6],P=A-k,L=2*t;for(v=1;L>=v;v++)g=v/L,C||(g=1-g),R=k+g*P,E=H+z*Math.cos(R),y=M+O*Math.sin(R),_.push(new THREE.Vector2(E,y))}var D=_[_.length-1],F=1e-10;return Math.abs(D.x-_[0].x)e;e++)r=t[e],o=r.args,i=r.action,i==THREE.PathActions.MOVE_TO&&0!=a.actions.length&&(s.push(a),a=new THREE.Path),a[i].apply(a,o);return 0!=a.actions.length&&s.push(a),s}function r(t){for(var e=[],n=0,r=t.length;r>n;n++){var i=t[n],o=new THREE.Shape;o.actions=i.actions,o.curves=i.curves,e.push(o)}return e}function i(t,e){for(var n=1e-10,r=e.length,i=!1,o=r-1,s=0;r>s;o=s++){var a=e[o],u=e[s],h=u.x-a.x,l=u.y-a.y;if(Math.abs(l)>n){if(0>l&&(a=e[s],h=-h,u=e[o],l=-l),t.yu.y)continue;if(t.y==a.y){if(t.x==a.x)return!0}else{var c=l*(t.x-a.x)-h*(t.y-a.y);if(0==c)return!0;if(0>c)continue;i=!i}}else{if(t.y!=a.y)continue;if(u.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=u.x)return!0}}return i}var o=n(this.actions);if(0==o.length)return[];if(e===!0)return r(o);var s,a,u,h=[];if(1==o.length)return a=o[0],u=new THREE.Shape,u.actions=a.actions,u.curves=a.curves,h.push(u),h;var l=!THREE.Shape.Utils.isClockWise(o[0].getPoints());l=t?!l:l;var c,p=[],f=[],d=[],m=0;f[m]=void 0,d[m]=[];var v,g;for(v=0,g=o.length;g>v;v++)a=o[v],c=a.getPoints(),s=THREE.Shape.Utils.isClockWise(c),s=t?!s:s,s?(!l&&f[m]&&m++,f[m]={s:new THREE.Shape,p:c},f[m].s.actions=a.actions,f[m].s.curves=a.curves,l&&m++,d[m]=[]):d[m].push({h:a,p:c[0]});if(!f[0])return r(o);if(f.length>1){for(var E=!1,y=[],_=0,b=f.length;b>_;_++)p[_]=[];for(var _=0,b=f.length;b>_;_++)for(var T=d[_],x=0;x0&&(E||(d=p))}var M,S,k;for(v=0,g=f.length;g>v;v++)for(u=f[v].s,h.push(u),M=d[v],S=0,k=M.length;k>S;S++)u.holes.push(M[S].h);return h},THREE.Shape=function(){THREE.Path.apply(this,arguments),this.holes=[]},THREE.Shape.prototype=Object.create(THREE.Path.prototype),THREE.Shape.prototype.constructor=THREE.Shape,THREE.Shape.prototype.extrude=function(t){var e=new THREE.ExtrudeGeometry(this,t);return e},THREE.Shape.prototype.makeGeometry=function(t){var e=new THREE.ShapeGeometry(this,t);return e},THREE.Shape.prototype.getPointsHoles=function(t){var e,n=this.holes.length,r=[];for(e=0;n>e;e++)r[e]=this.holes[e].getTransformedPoints(t,this.bends);return r},THREE.Shape.prototype.getSpacedPointsHoles=function(t){ +var e,n=this.holes.length,r=[];for(e=0;n>e;e++)r[e]=this.holes[e].getTransformedSpacedPoints(t,this.bends);return r},THREE.Shape.prototype.extractAllPoints=function(t){return{shape:this.getTransformedPoints(t),holes:this.getPointsHoles(t)}},THREE.Shape.prototype.extractPoints=function(t){return this.useSpacedPoints?this.extractAllSpacedPoints(t):this.extractAllPoints(t)},THREE.Shape.prototype.extractAllSpacedPoints=function(t){return{shape:this.getTransformedSpacedPoints(t),holes:this.getSpacedPointsHoles(t)}},THREE.Shape.Utils={triangulateShape:function(t,e){function n(t,e,n){return t.x!=e.x?t.xs){var m;if(f>0){if(0>d||d>f)return[];if(m=l*c-h*p,0>m||m>f)return[]}else{if(d>0||f>d)return[];if(m=l*c-h*p,m>0||f>m)return[]}if(0==m)return!o||0!=d&&d!=f?[t]:[];if(m==f)return!o||0!=d&&d!=f?[e]:[];if(0==d)return[r];if(d==f)return[i];var v=m/f;return[{x:t.x+v*a,y:t.y+v*u}]}if(0!=d||l*c!=h*p)return[];var g=0==a&&0==u,E=0==h&&0==l;if(g&&E)return t.x!=r.x||t.y!=r.y?[]:[t];if(g)return n(r,i,t)?[t]:[];if(E)return n(t,e,r)?[r]:[];var y,_,b,T,x,w,R,H;return 0!=a?(t.x=b?R>T?[]:T==R?o?[]:[x]:H>=T?[x,_]:[x,w]:b>H?[]:b==H?o?[]:[y]:H>=T?[y,_]:[y,w]}function i(t,e,n,r){var i=1e-10,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,h=r.x-t.x,l=r.y-t.y,c=o*u-s*a,p=o*l-s*h;if(Math.abs(c)>i){var f=h*u-l*a;return c>0?p>=0&&f>=0:p>=0||f>=0}return p>0}function o(t,e){function n(t,e){var n=E.length-1,r=t-1;0>r&&(r=n);var o=t+1;o>n&&(o=0);var s=i(E[t],E[r],E[o],a[e]);if(!s)return!1;var u=a.length-1,h=e-1;0>h&&(h=u);var l=e+1;return l>u&&(l=0),s=i(a[e],a[h],a[l],E[t]),s?!0:!1}function o(t,e){var n,i,o;for(n=0;n0)return!0;return!1}function s(t,n){var i,o,s,a,u;for(i=0;i0)return!0;return!1}for(var a,u,h,l,c,p,f,d,m,v,g,E=t.concat(),y=[],_=[],b=0,T=e.length;T>b;b++)y.push(b);for(var x=0,w=2*y.length;y.length>0;){if(w--,0>w){console.log("Infinite Loop! Holes left:"+y.length+", Probably Hole outside Shape!");break}for(h=x;h=0)break;_[f]=!0}if(u>=0)break}}return E}for(var s,a,u,h,l,c,p={},f=t.concat(),d=0,m=e.length;m>d;d++)Array.prototype.push.apply(f,e[d]);for(s=0,a=f.length;a>s;s++)l=f[s].x+":"+f[s].y,void 0!==p[l]&&THREE.warn("THREE.Shape: Duplicate point",l),p[l]=s;var v=o(t,e),g=THREE.FontUtils.Triangulate(v,!1);for(s=0,a=g.length;a>s;s++)for(h=g[s],u=0;3>u;u++)l=h[u].x+":"+h[u].y,c=p[l],void 0!==c&&(h[u]=c);return g.concat()},isClockWise:function(t){return THREE.FontUtils.Triangulate.area(t)<0},b2p0:function(t,e){var n=1-t;return n*n*e},b2p1:function(t,e){return 2*(1-t)*t*e},b2p2:function(t,e){return t*t*e},b2:function(t,e,n,r){return this.b2p0(t,e)+this.b2p1(t,n)+this.b2p2(t,r)},b3p0:function(t,e){var n=1-t;return n*n*n*e},b3p1:function(t,e){var n=1-t;return 3*n*n*t*e},b3p2:function(t,e){var n=1-t;return 3*n*t*t*e},b3p3:function(t,e){return t*t*t*e},b3:function(t,e,n,r,i){return this.b3p0(t,e)+this.b3p1(t,n)+this.b3p2(t,r)+this.b3p3(t,i)}},THREE.LineCurve=function(t,e){this.v1=t,this.v2=e},THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.LineCurve.prototype.constructor=THREE.LineCurve,THREE.LineCurve.prototype.getPoint=function(t){var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},THREE.LineCurve.prototype.getPointAt=function(t){return this.getPoint(t)},THREE.LineCurve.prototype.getTangent=function(t){var e=this.v2.clone().sub(this.v1);return e.normalize()},THREE.QuadraticBezierCurve=function(t,e,n){this.v0=t,this.v1=e,this.v2=n},THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve,THREE.QuadraticBezierCurve.prototype.getPoint=function(t){var e=new THREE.Vector2;return e.x=THREE.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x),e.y=THREE.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y),e},THREE.QuadraticBezierCurve.prototype.getTangent=function(t){var e=new THREE.Vector2;return e.x=THREE.Curve.Utils.tangentQuadraticBezier(t,this.v0.x,this.v1.x,this.v2.x),e.y=THREE.Curve.Utils.tangentQuadraticBezier(t,this.v0.y,this.v1.y,this.v2.y),e.normalize()},THREE.CubicBezierCurve=function(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r},THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve,THREE.CubicBezierCurve.prototype.getPoint=function(t){var e,n;return e=THREE.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n=THREE.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new THREE.Vector2(e,n)},THREE.CubicBezierCurve.prototype.getTangent=function(t){var e,n;e=THREE.Curve.Utils.tangentCubicBezier(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n=THREE.Curve.Utils.tangentCubicBezier(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var r=new THREE.Vector2(e,n);return r.normalize(),r},THREE.SplineCurve=function(t){this.points=void 0==t?[]:t},THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.SplineCurve.prototype.constructor=THREE.SplineCurve,THREE.SplineCurve.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),i=n-r,o=e[0==r?r:r-1],s=e[r],a=e[r>e.length-2?e.length-1:r+1],u=e[r>e.length-3?e.length-1:r+2],h=new THREE.Vector2;return h.x=THREE.Curve.Utils.interpolate(o.x,s.x,a.x,u.x,i),h.y=THREE.Curve.Utils.interpolate(o.y,s.y,a.y,u.y,i),h},THREE.EllipseCurve=function(t,e,n,r,i,o,s){this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=s},THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype),THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve,THREE.EllipseCurve.prototype.getPoint=function(t){var e=this.aEndAngle-this.aStartAngle;0>e&&(e+=2*Math.PI),e>2*Math.PI&&(e-=2*Math.PI);var n;n=this.aClockwise===!0?this.aEndAngle+(1-t)*(2*Math.PI-e):this.aStartAngle+t*e;var r=new THREE.Vector2;return r.x=this.aX+this.xRadius*Math.cos(n),r.y=this.aY+this.yRadius*Math.sin(n),r},THREE.ArcCurve=function(t,e,n,r,i,o){THREE.EllipseCurve.call(this,t,e,n,n,r,i,o)},THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype),THREE.ArcCurve.prototype.constructor=THREE.ArcCurve,THREE.LineCurve3=THREE.Curve.create(function(t,e){this.v1=t,this.v2=e},function(t){var e=new THREE.Vector3;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e}),THREE.QuadraticBezierCurve3=THREE.Curve.create(function(t,e,n){this.v0=t,this.v1=e,this.v2=n},function(t){var e=new THREE.Vector3;return e.x=THREE.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x),e.y=THREE.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y),e.z=THREE.Shape.Utils.b2(t,this.v0.z,this.v1.z,this.v2.z),e}),THREE.CubicBezierCurve3=THREE.Curve.create(function(t,e,n,r){this.v0=t,this.v1=e,this.v2=n,this.v3=r},function(t){var e=new THREE.Vector3;return e.x=THREE.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e.y=THREE.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e.z=THREE.Shape.Utils.b3(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z),e}),THREE.SplineCurve3=THREE.Curve.create(function(t){this.points=void 0==t?[]:t},function(t){var e=this.points,n=(e.length-1)*t,r=Math.floor(n),i=n-r,o=e[0==r?r:r-1],s=e[r],a=e[r>e.length-2?e.length-1:r+1],u=e[r>e.length-3?e.length-1:r+2],h=new THREE.Vector3;return h.x=THREE.Curve.Utils.interpolate(o.x,s.x,a.x,u.x,i),h.y=THREE.Curve.Utils.interpolate(o.y,s.y,a.y,u.y,i),h.z=THREE.Curve.Utils.interpolate(o.z,s.z,a.z,u.z,i),h}),THREE.ClosedSplineCurve3=THREE.Curve.create(function(t){this.points=void 0==t?[]:t},function(t){var e=this.points,n=(e.length-0)*t,r=Math.floor(n),i=n-r;r+=r>0?0:(Math.floor(Math.abs(r)/e.length)+1)*e.length;var o=e[(r-1)%e.length],s=e[r%e.length],a=e[(r+1)%e.length],u=e[(r+2)%e.length],h=new THREE.Vector3;return h.x=THREE.Curve.Utils.interpolate(o.x,s.x,a.x,u.x,i),h.y=THREE.Curve.Utils.interpolate(o.y,s.y,a.y,u.y,i),h.z=THREE.Curve.Utils.interpolate(o.z,s.z,a.z,u.z,i),h}),THREE.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){THREE.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){THREE.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){THREE.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(t){if(t.initialized===!0)return t;for(var e=0;et;t++){var n=this.hierarchy[t];void 0===n.animationCache&&(n.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var r=this.data.name,i=n.animationCache.animations,o=i[r];void 0===o&&(o={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:n.matrix},i[r]=o);for(var s=0;3>s;s++){for(var a=this.keyTypes[s],u=this.data.hierarchy[t].keys[0],h=this.getNextKeyWith(a,t,1);h.timeu.index;)u=h,h=this.getNextKeyWith(a,t,h.index+1);o.prevKey[a]=u,o.nextKey[a]=h}}},resetBlendWeights:function(){for(var t=0,e=this.hierarchy.length;e>t;t++){var n=this.hierarchy[t],r=n.animationCache;if(void 0!==r){var i=r.blending;i.positionWeight=0,i.quaternionWeight=0,i.scaleWeight=0}}},update:function(){var t=[],e=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Quaternion,i=function(t,e){var n,r,i,s,a,u,h,l,c,p=[],f=[];return n=(t.length-1)*e,r=Math.floor(n),i=n-r,p[0]=0===r?r:r-1,p[1]=r,p[2]=r>t.length-2?r:r+1,p[3]=r>t.length-3?r:r+2,u=t[p[0]],h=t[p[1]],l=t[p[2]],c=t[p[3]],s=i*i,a=i*s,f[0]=o(u[0],h[0],l[0],c[0],i,s,a),f[1]=o(u[1],h[1],l[1],c[1],i,s,a),f[2]=o(u[2],h[2],l[2],c[2],i,s,a),f},o=function(t,e,n,r,i,o,s){var a=.5*(n-t),u=.5*(r-e);return(2*(e-n)+a+u)*s+(-3*(e-n)-2*a-u)*o+a*i+e};return function(o){if(this.isPlaying!==!1&&(this.currentTime+=o*this.timeScale,0!==this.weight)){var s=this.data.length;(this.currentTime>s||this.currentTime<0)&&(this.loop?(this.currentTime%=s,this.currentTime<0&&(this.currentTime+=s),this.reset()):this.stop());for(var a=0,u=this.hierarchy.length;u>a;a++)for(var h=this.hierarchy[a],l=h.animationCache.animations[this.data.name],c=h.animationCache.blending,p=0;3>p;p++){var f=this.keyTypes[p],d=l.prevKey[f],m=l.nextKey[f];if(this.timeScale>0&&m.time<=this.currentTime||this.timeScale<0&&d.time>=this.currentTime){for(d=this.data.hierarchy[a].keys[0],m=this.getNextKeyWith(f,a,1);m.timed.index;)d=m,m=this.getNextKeyWith(f,a,m.index+1);l.prevKey[f]=d,l.nextKey[f]=m}var v=(this.currentTime-d.time)/(m.time-d.time),g=d[f],E=m[f];if(0>v&&(v=0),v>1&&(v=1),"pos"===f){if(this.interpolationType===THREE.AnimationHandler.LINEAR){n.x=g[0]+(E[0]-g[0])*v,n.y=g[1]+(E[1]-g[1])*v,n.z=g[2]+(E[2]-g[2])*v;var y=this.weight/(this.weight+c.positionWeight);h.position.lerp(n,y),c.positionWeight+=this.weight}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){t[0]=this.getPrevKeyWith("pos",a,d.index-1).pos,t[1]=g,t[2]=E,t[3]=this.getNextKeyWith("pos",a,m.index+1).pos,v=.33*v+.33;var _=i(t,v),y=this.weight/(this.weight+c.positionWeight);c.positionWeight+=this.weight;var b=h.position;if(b.x=b.x+(_[0]-b.x)*y,b.y=b.y+(_[1]-b.y)*y,b.z=b.z+(_[2]-b.z)*y,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){var T=i(t,1.01*v);e.set(T[0],T[1],T[2]),e.sub(b),e.y=0,e.normalize();var x=Math.atan2(e.x,e.z);h.rotation.set(0,x,0)}}}else if("rot"===f)if(THREE.Quaternion.slerp(g,E,r,v),0===c.quaternionWeight)h.quaternion.copy(r),c.quaternionWeight=this.weight;else{var y=this.weight/(this.weight+c.quaternionWeight);THREE.Quaternion.slerp(h.quaternion,r,h.quaternion,y),c.quaternionWeight+=this.weight}else if("scl"===f){n.x=g[0]+(E[0]-g[0])*v,n.y=g[1]+(E[1]-g[1])*v,n.z=g[2]+(E[2]-g[2])*v;var y=this.weight/(this.weight+c.scaleWeight);h.scale.lerp(n,y),c.scaleWeight+=this.weight}}return!0}}}(),getNextKeyWith:function(t,e,n){var r=this.data.hierarchy[e].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?n=n0?n:0:n>=0?n:n+r.length;n>=0;n--)if(void 0!==r[n][t])return r[n];return this.data.hierarchy[e].keys[r.length-1]}},THREE.KeyFrameAnimation=function(t){this.root=t.node,this.data=THREE.AnimationHandler.init(t),this.hierarchy=THREE.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var e=0,n=this.hierarchy.length;n>e;e++){var r=this.data.hierarchy[e].keys,i=this.data.hierarchy[e].sids,o=this.hierarchy[e];if(r.length&&i){for(var s=0;se;e++){n=this.hierarchy[e],r=this.data.hierarchy[e],void 0===r.animationCache&&(r.animationCache={},r.animationCache.prevKey=null,r.animationCache.nextKey=null,r.animationCache.originalMatrix=n.matrix);var o=this.data.hierarchy[e].keys;o.length&&(r.animationCache.prevKey=o[0],r.animationCache.nextKey=o[1],this.startTime=Math.min(o[0].time,this.startTime),this.endTime=Math.max(o[o.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,THREE.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,this.isPaused=!1,THREE.AnimationHandler.stop(this);for(var t=0;te&&(this.currentTime%=e),this.currentTime=Math.min(this.currentTime,e);for(var n=0,r=this.hierarchy.length;r>n;n++){var i=this.hierarchy[n],o=this.data.hierarchy[n],s=o.keys,a=o.animationCache;if(s.length){var u=a.prevKey,h=a.nextKey;if(h.time<=this.currentTime){for(;h.timeu.index;)u=h,h=s[u.index+1];a.prevKey=u,a.nextKey=h}h.time>=this.currentTime?u.interpolate(h,this.currentTime):u.interpolate(h,h.time),this.data.hierarchy[n].node.updateMatrix(),i.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(t,e,n){var r=this.data.hierarchy[e].keys;for(n%=r.length;n=0?n:n+r.length;n>=0;n--)if(r[n].hasTarget(t))return r[n];return r[r.length-1]}},THREE.MorphAnimation=function(t){this.mesh=t,this.frames=t.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},THREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(t){if(this.isPlaying!==!1){this.currentTime+=t,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var e=this.duration/this.frames,n=Math.floor(this.currentTime/e),r=this.mesh.morphTargetInfluences;n!=this.currentFrame&&(r[this.lastFrame]=0,r[this.currentFrame]=1,r[n]=0,this.lastFrame=this.currentFrame,this.currentFrame=n),r[n]=this.currentTime%e/e,r[this.lastFrame]=1-r[n]}}},THREE.BoxGeometry=function(t,e,n,r,i,o){function s(t,e,n,r,i,o,s,u){var h,l,c,p=a.widthSegments,f=a.heightSegments,d=i/2,m=o/2,v=a.vertices.length;"x"===t&&"y"===e||"y"===t&&"x"===e?h="z":"x"===t&&"z"===e||"z"===t&&"x"===e?(h="y",f=a.depthSegments):("z"===t&&"y"===e||"y"===t&&"z"===e)&&(h="x",p=a.depthSegments);var g=p+1,E=f+1,y=i/p,_=o/f,b=new THREE.Vector3;for(b[h]=s>0?1:-1,c=0;E>c;c++)for(l=0;g>l;l++){var T=new THREE.Vector3;T[t]=(l*y-d)*n,T[e]=(c*_-m)*r,T[h]=s,a.vertices.push(T)}for(c=0;f>c;c++)for(l=0;p>l;l++){var x=l+g*c,w=l+g*(c+1),R=l+1+g*(c+1),H=l+1+g*c,M=new THREE.Vector2(l/p,1-c/f),S=new THREE.Vector2(l/p,1-(c+1)/f),k=new THREE.Vector2((l+1)/p,1-(c+1)/f),A=new THREE.Vector2((l+1)/p,1-c/f),C=new THREE.Face3(x+v,w+v,H+v);C.normal.copy(b),C.vertexNormals.push(b.clone(),b.clone(),b.clone()),C.materialIndex=u,a.faces.push(C),a.faceVertexUvs[0].push([M,S,A]),C=new THREE.Face3(w+v,R+v,H+v),C.normal.copy(b),C.vertexNormals.push(b.clone(),b.clone(),b.clone()),C.materialIndex=u,a.faces.push(C),a.faceVertexUvs[0].push([S.clone(),k,A.clone()])}}THREE.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.widthSegments=r||1,this.heightSegments=i||1,this.depthSegments=o||1;var a=this,u=t/2,h=e/2,l=n/2;s("z","y",-1,-1,n,e,u,0),s("z","y",1,-1,n,e,-u,1),s("x","z",1,1,t,n,h,2),s("x","z",1,-1,t,n,-h,3),s("x","y",1,-1,t,e,l,4),s("x","y",-1,-1,t,e,-l,5),this.mergeVertices()},THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry,THREE.CircleGeometry=function(t,e,n,r){THREE.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,o=[],s=new THREE.Vector3,a=new THREE.Vector2(.5,.5);for(this.vertices.push(s),o.push(a),i=0;e>=i;i++){var u=new THREE.Vector3,h=n+i/e*r;u.x=t*Math.cos(h),u.y=t*Math.sin(h),this.vertices.push(u),o.push(new THREE.Vector2((u.x/t+1)/2,(u.y/t+1)/2))}var l=new THREE.Vector3(0,0,1);for(i=1;e>=i;i++)this.faces.push(new THREE.Face3(i,i+1,0,[l.clone(),l.clone(),l.clone()])),this.faceVertexUvs[0].push([o[i].clone(),o[i+1].clone(),a.clone()]);this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry,THREE.CubeGeometry=function(t,e,n,r,i,o){return THREE.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new THREE.BoxGeometry(t,e,n,r,i,o)},THREE.CylinderGeometry=function(t,e,n,r,i,o,s,a){THREE.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a},t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=r||8,i=i||1,o=void 0!==o?o:!1,s=void 0!==s?s:0,a=void 0!==a?a:2*Math.PI;var u,h,l=n/2,c=[],p=[];for(h=0;i>=h;h++){var f=[],d=[],m=h/i,v=m*(e-t)+t;for(u=0;r>=u;u++){var g=u/r,E=new THREE.Vector3;E.x=v*Math.sin(g*a+s),E.y=-m*n+l,E.z=v*Math.cos(g*a+s),this.vertices.push(E),f.push(this.vertices.length-1),d.push(new THREE.Vector2(g,1-m))}c.push(f),p.push(d)}var y,_,b=(e-t)/n;for(u=0;r>u;u++)for(0!==t?(y=this.vertices[c[0][u]].clone(),_=this.vertices[c[0][u+1]].clone()):(y=this.vertices[c[1][u]].clone(),_=this.vertices[c[1][u+1]].clone()),y.setY(Math.sqrt(y.x*y.x+y.z*y.z)*b).normalize(),_.setY(Math.sqrt(_.x*_.x+_.z*_.z)*b).normalize(),h=0;i>h;h++){var T=c[h][u],x=c[h+1][u],w=c[h+1][u+1],R=c[h][u+1],H=y.clone(),M=y.clone(),S=_.clone(),k=_.clone(),A=p[h][u].clone(),C=p[h+1][u].clone(),P=p[h+1][u+1].clone(),L=p[h][u+1].clone();this.faces.push(new THREE.Face3(T,x,R,[H,M,k])),this.faceVertexUvs[0].push([A,C,L]),this.faces.push(new THREE.Face3(x,w,R,[M.clone(),S,k.clone()])),this.faceVertexUvs[0].push([C.clone(),P,L.clone()])}if(o===!1&&t>0)for(this.vertices.push(new THREE.Vector3(0,l,0)),u=0;r>u;u++){var T=c[0][u],x=c[0][u+1],w=this.vertices.length-1,H=new THREE.Vector3(0,1,0),M=new THREE.Vector3(0,1,0),S=new THREE.Vector3(0,1,0),A=p[0][u].clone(),C=p[0][u+1].clone(),P=new THREE.Vector2(C.x,0);this.faces.push(new THREE.Face3(T,x,w,[H,M,S])),this.faceVertexUvs[0].push([A,C,P])}if(o===!1&&e>0)for(this.vertices.push(new THREE.Vector3(0,-l,0)),u=0;r>u;u++){var T=c[i][u+1],x=c[i][u],w=this.vertices.length-1,H=new THREE.Vector3(0,-1,0),M=new THREE.Vector3(0,-1,0),S=new THREE.Vector3(0,-1,0),A=p[i][u+1].clone(),C=p[i][u].clone(),P=new THREE.Vector2(C.x,1);this.faces.push(new THREE.Face3(T,x,w,[H,M,S])),this.faceVertexUvs[0].push([A,C,P])}this.computeFaceNormals()},THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry,THREE.ExtrudeGeometry=function(t,e){return"undefined"==typeof t?void(t=[]):(THREE.Geometry.call(this),this.type="ExtrudeGeometry",t=t instanceof Array?t:[t],this.addShapeList(t,e),void this.computeFaceNormals())},THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry,THREE.ExtrudeGeometry.prototype.addShapeList=function(t,e){for(var n=t.length,r=0;n>r;r++){var i=t[r];this.addShape(i,e)}},THREE.ExtrudeGeometry.prototype.addShape=function(t,e){function n(t,e,n){return e||THREE.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}function r(t,e,n){var r,i,o=1e-10,s=1,a=t.x-e.x,u=t.y-e.y,h=n.x-t.x,l=n.y-t.y,c=a*a+u*u,p=a*l-u*h;if(Math.abs(p)>o){var f=Math.sqrt(c),d=Math.sqrt(h*h+l*l),m=e.x-u/f,v=e.y+a/f,g=n.x-l/d,E=n.y+h/d,y=((g-m)*l-(E-v)*h)/(a*l-u*h);r=m+a*y-t.x,i=v+u*y-t.y;var _=r*r+i*i;if(2>=_)return new THREE.Vector2(r,i);s=Math.sqrt(_/2)}else{var b=!1;a>o?h>o&&(b=!0):-o>a?-o>h&&(b=!0):Math.sign(u)==Math.sign(l)&&(b=!0),b?(r=-u,i=a,s=Math.sqrt(c)):(r=a,i=u,s=Math.sqrt(c/2))}return new THREE.Vector2(r/s,i/s)}function i(){if(y){var t=0,e=G*t;for(X=0;W>X;X++)j=D[X],u(j[2]+e,j[1]+e,j[0]+e);for(t=b+2*E,e=G*t,X=0;W>X;X++)j=D[X],u(j[0]+e,j[1]+e,j[2]+e)}else{for(X=0;W>X;X++)j=D[X],u(j[2],j[1],j[0]);for(X=0;W>X;X++)j=D[X],u(j[0]+G*b,j[1]+G*b,j[2]+G*b)}}function o(){var t=0;for(s(F,t),t+=F.length,S=0,k=z.length;k>S;S++)M=z[S],s(M,t),t+=M.length}function s(t,e){var n,r;for(X=t.length;--X>=0;){n=X,r=X-1,0>r&&(r=t.length-1);var i=0,o=b+2*E;for(i=0;o>i;i++){var s=G*i,a=G*(i+1),u=e+n+s,l=e+r+s,c=e+r+a,p=e+n+a;h(u,l,c,p,t,i,o,n,r)}}}function a(t,e,n){A.vertices.push(new THREE.Vector3(t,e,n))}function u(t,e,n){t+=C,e+=C,n+=C,A.faces.push(new THREE.Face3(t,e,n,null,null,w));var r=H.generateTopUV(A,t,e,n);A.faceVertexUvs[0].push(r)}function h(t,e,n,r,i,o,s,a,u){t+=C,e+=C,n+=C,r+=C,A.faces.push(new THREE.Face3(t,e,r,null,null,R)),A.faces.push(new THREE.Face3(e,n,r,null,null,R));var h=H.generateSideWallUV(A,t,e,n,r);A.faceVertexUvs[0].push([h[0],h[1],h[3]]),A.faceVertexUvs[0].push([h[1],h[2],h[3]])}var l,c,p,f,d,m=void 0!==e.amount?e.amount:100,v=void 0!==e.bevelThickness?e.bevelThickness:6,g=void 0!==e.bevelSize?e.bevelSize:v-2,E=void 0!==e.bevelSegments?e.bevelSegments:3,y=void 0!==e.bevelEnabled?e.bevelEnabled:!0,_=void 0!==e.curveSegments?e.curveSegments:12,b=void 0!==e.steps?e.steps:1,T=e.extrudePath,x=!1,w=e.material,R=e.extrudeMaterial,H=void 0!==e.UVGenerator?e.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator;T&&(l=T.getSpacedPoints(b),x=!0,y=!1,c=void 0!==e.frames?e.frames:new THREE.TubeGeometry.FrenetFrames(T,b,!1),p=new THREE.Vector3,f=new THREE.Vector3,d=new THREE.Vector3),y||(E=0,v=0,g=0);var M,S,k,A=this,C=this.vertices.length,P=t.extractPoints(_),L=P.shape,z=P.holes,O=!THREE.Shape.Utils.isClockWise(L);if(O){for(L=L.reverse(),S=0,k=z.length;k>S;S++)M=z[S],THREE.Shape.Utils.isClockWise(M)&&(z[S]=M.reverse());O=!1}var D=THREE.Shape.Utils.triangulateShape(L,z),F=L;for(S=0,k=z.length;k>S;S++)M=z[S],L=L.concat(M);for(var U,B,N,V,I,j,G=L.length,W=D.length,q=[],X=0,Y=F.length,Z=Y-1,K=X+1;Y>X;X++,Z++,K++)Z===Y&&(Z=0),K===Y&&(K=0),q[X]=r(F[X],F[Z],F[K]);var Q,J=[],$=q.concat();for(S=0,k=z.length;k>S;S++){for(M=z[S],Q=[],X=0,Y=M.length,Z=Y-1,K=X+1;Y>X;X++,Z++,K++)Z===Y&&(Z=0),K===Y&&(K=0),Q[X]=r(M[X],M[Z],M[K]);J.push(Q),$=$.concat(Q)}for(U=0;E>U;U++){for(N=U/E,V=v*(1-N),B=g*Math.sin(N*Math.PI/2),X=0,Y=F.length;Y>X;X++)I=n(F[X],q[X],B),a(I.x,I.y,-V);for(S=0,k=z.length;k>S;S++)for(M=z[S],Q=J[S],X=0,Y=M.length;Y>X;X++)I=n(M[X],Q[X],B),a(I.x,I.y,-V)}for(B=g,X=0;G>X;X++)I=y?n(L[X],$[X],B):L[X],x?(f.copy(c.normals[0]).multiplyScalar(I.x),p.copy(c.binormals[0]).multiplyScalar(I.y),d.copy(l[0]).add(f).add(p),a(d.x,d.y,d.z)):a(I.x,I.y,0);var tt;for(tt=1;b>=tt;tt++)for(X=0;G>X;X++)I=y?n(L[X],$[X],B):L[X],x?(f.copy(c.normals[tt]).multiplyScalar(I.x),p.copy(c.binormals[tt]).multiplyScalar(I.y),d.copy(l[tt]).add(f).add(p),a(d.x,d.y,d.z)):a(I.x,I.y,m/b*tt);for(U=E-1;U>=0;U--){for(N=U/E,V=v*(1-N),B=g*Math.sin(N*Math.PI/2),X=0,Y=F.length;Y>X;X++)I=n(F[X],q[X],B),a(I.x,I.y,m+V);for(S=0,k=z.length;k>S;S++)for(M=z[S],Q=J[S],X=0,Y=M.length;Y>X;X++)I=n(M[X],Q[X],B),x?a(I.x,I.y+l[b-1].y,l[b-1].x+V):a(I.x,I.y,m+V)}i(),o()},THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,e,n,r){var i=t.vertices,o=i[e],s=i[n],a=i[r];return[new THREE.Vector2(o.x,o.y),new THREE.Vector2(s.x,s.y),new THREE.Vector2(a.x,a.y)]},generateSideWallUV:function(t,e,n,r,i){var o=t.vertices,s=o[e],a=o[n],u=o[r],h=o[i];return Math.abs(s.y-a.y)<.01?[new THREE.Vector2(s.x,1-s.z),new THREE.Vector2(a.x,1-a.z),new THREE.Vector2(u.x,1-u.z),new THREE.Vector2(h.x,1-h.z)]:[new THREE.Vector2(s.y,1-s.z),new THREE.Vector2(a.y,1-a.z),new THREE.Vector2(u.y,1-u.z),new THREE.Vector2(h.y,1-h.z)]}},THREE.ShapeGeometry=function(t,e){THREE.Geometry.call(this),this.type="ShapeGeometry",t instanceof Array==!1&&(t=[t]),this.addShapeList(t,e),this.computeFaceNormals()},THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry,THREE.ShapeGeometry.prototype.addShapeList=function(t,e){for(var n=0,r=t.length;r>n;n++)this.addShape(t[n],e);return this},THREE.ShapeGeometry.prototype.addShape=function(t,e){void 0===e&&(e={});var n,r,i,o=void 0!==e.curveSegments?e.curveSegments:12,s=e.material,a=void 0===e.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:e.UVGenerator,u=this.vertices.length,h=t.extractPoints(o),l=h.shape,c=h.holes,p=!THREE.Shape.Utils.isClockWise(l);if(p){for(l=l.reverse(),n=0,r=c.length;r>n;n++)i=c[n],THREE.Shape.Utils.isClockWise(i)&&(c[n]=i.reverse());p=!1}var f=THREE.Shape.Utils.triangulateShape(l,c);for(n=0,r=c.length;r>n;n++)i=c[n],l=l.concat(i);var d,m,v=l.length,g=f.length;for(n=0;v>n;n++)d=l[n],this.vertices.push(new THREE.Vector3(d.x,d.y,0));for(n=0;g>n;n++){m=f[n];var E=m[0]+u,y=m[1]+u,_=m[2]+u;this.faces.push(new THREE.Face3(E,y,_,null,null,s)),this.faceVertexUvs[0].push(a.generateTopUV(this,E,y,_))}},THREE.LatheGeometry=function(t,e,n,r){THREE.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=e||12,n=n||0,r=r||2*Math.PI;for(var i=1/(t.length-1),o=1/e,s=0,a=e;a>=s;s++)for(var u=n+s*o*r,h=Math.cos(u),l=Math.sin(u),c=0,p=t.length;p>c;c++){var f=t[c],d=new THREE.Vector3;d.x=h*f.x-l*f.y,d.y=l*f.x+h*f.y,d.z=f.z,this.vertices.push(d)}for(var m=t.length,s=0,a=e;a>s;s++)for(var c=0,p=t.length-1;p>c;c++){var v=c+m*s,g=v,E=v+m,h=v+1+m,y=v+1,_=s*o,b=c*i,T=_+o,x=b+i;this.faces.push(new THREE.Face3(g,E,y)),this.faceVertexUvs[0].push([new THREE.Vector2(_,b),new THREE.Vector2(T,b),new THREE.Vector2(_,x)]),this.faces.push(new THREE.Face3(E,h,y)),this.faceVertexUvs[0].push([new THREE.Vector2(T,b),new THREE.Vector2(T,x),new THREE.Vector2(_,x)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry,THREE.PlaneGeometry=function(t,e,n,r){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint."),THREE.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new THREE.PlaneBufferGeometry(t,e,n,r))},THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry,THREE.PlaneBufferGeometry=function(t,e,n,r){THREE.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};for(var i=t/2,o=e/2,s=n||1,a=r||1,u=s+1,h=a+1,l=t/s,c=e/a,p=new Float32Array(u*h*3),f=new Float32Array(u*h*3),d=new Float32Array(u*h*2),m=0,v=0,g=0;h>g;g++)for(var E=g*c-o,y=0;u>y;y++){var _=y*l-i;p[m]=_,p[m+1]=-E,f[m+2]=1,d[v]=y/s,d[v+1]=1-g/a,m+=3,v+=2}m=0;for(var b=new(p.length/3>65535?Uint32Array:Uint16Array)(s*a*6),g=0;a>g;g++)for(var y=0;s>y;y++){var T=y+u*g,x=y+u*(g+1),w=y+1+u*(g+1),R=y+1+u*g;b[m]=T,b[m+1]=x,b[m+2]=R,b[m+3]=x,b[m+4]=w,b[m+5]=R,m+=6}this.addAttribute("index",new THREE.BufferAttribute(b,1)),this.addAttribute("position",new THREE.BufferAttribute(p,3)),this.addAttribute("normal",new THREE.BufferAttribute(f,3)), +this.addAttribute("uv",new THREE.BufferAttribute(d,2))},THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype),THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry,THREE.RingGeometry=function(t,e,n,r,i,o){THREE.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},t=t||0,e=e||50,i=void 0!==i?i:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):8;var s,a,u=[],h=t,l=(e-t)/r;for(s=0;r+1>s;s++){for(a=0;n+1>a;a++){var c=new THREE.Vector3,p=i+a/n*o;c.x=h*Math.cos(p),c.y=h*Math.sin(p),this.vertices.push(c),u.push(new THREE.Vector2((c.x/e+1)/2,(c.y/e+1)/2))}h+=l}var f=new THREE.Vector3(0,0,1);for(s=0;r>s;s++){var d=s*(n+1);for(a=0;n>a;a++){var p=a+d,m=p,v=p+n+1,g=p+n+2;this.faces.push(new THREE.Face3(m,v,g,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([u[m].clone(),u[v].clone(),u[g].clone()]),m=p,v=p+n+2,g=p+1,this.faces.push(new THREE.Face3(m,v,g,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([u[m].clone(),u[v].clone(),u[g].clone()])}}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,h)},THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.RingGeometry.prototype.constructor=THREE.RingGeometry,THREE.SphereGeometry=function(t,e,n,r,i,o,s){THREE.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,o=void 0!==o?o:0,s=void 0!==s?s:Math.PI;var a,u,h=[],l=[];for(u=0;n>=u;u++){var c=[],p=[];for(a=0;e>=a;a++){var f=a/e,d=u/n,m=new THREE.Vector3;m.x=-t*Math.cos(r+f*i)*Math.sin(o+d*s),m.y=t*Math.cos(o+d*s),m.z=t*Math.sin(r+f*i)*Math.sin(o+d*s),this.vertices.push(m),c.push(this.vertices.length-1),p.push(new THREE.Vector2(f,1-d))}h.push(c),l.push(p)}for(u=0;n>u;u++)for(a=0;e>a;a++){var v=h[u][a+1],g=h[u][a],E=h[u+1][a],y=h[u+1][a+1],_=this.vertices[v].clone().normalize(),b=this.vertices[g].clone().normalize(),T=this.vertices[E].clone().normalize(),x=this.vertices[y].clone().normalize(),w=l[u][a+1].clone(),R=l[u][a].clone(),H=l[u+1][a].clone(),M=l[u+1][a+1].clone();Math.abs(this.vertices[v].y)===t?(w.x=(w.x+R.x)/2,this.faces.push(new THREE.Face3(v,E,y,[_,T,x])),this.faceVertexUvs[0].push([w,H,M])):Math.abs(this.vertices[E].y)===t?(H.x=(H.x+M.x)/2,this.faces.push(new THREE.Face3(v,g,E,[_,b,T])),this.faceVertexUvs[0].push([w,R,H])):(this.faces.push(new THREE.Face3(v,g,y,[_,b,x])),this.faceVertexUvs[0].push([w,R,M]),this.faces.push(new THREE.Face3(g,E,y,[b.clone(),T,x.clone()])),this.faceVertexUvs[0].push([R.clone(),H,M.clone()]))}this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,t)},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry,THREE.TextGeometry=function(t,e){e=e||{};var n=THREE.FontUtils.generateShapes(t,e);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),THREE.ExtrudeGeometry.call(this,n,e),this.type="TextGeometry"},THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype),THREE.TextGeometry.prototype.constructor=THREE.TextGeometry,THREE.TorusGeometry=function(t,e,n,r,i){THREE.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},t=t||100,e=e||40,n=n||8,r=r||6,i=i||2*Math.PI;for(var o=new THREE.Vector3,s=[],a=[],u=0;n>=u;u++)for(var h=0;r>=h;h++){var l=h/r*i,c=u/n*Math.PI*2;o.x=t*Math.cos(l),o.y=t*Math.sin(l);var p=new THREE.Vector3;p.x=(t+e*Math.cos(c))*Math.cos(l),p.y=(t+e*Math.cos(c))*Math.sin(l),p.z=e*Math.sin(c),this.vertices.push(p),s.push(new THREE.Vector2(h/r,u/n)),a.push(p.clone().sub(o).normalize())}for(var u=1;n>=u;u++)for(var h=1;r>=h;h++){var f=(r+1)*u+h-1,d=(r+1)*(u-1)+h-1,m=(r+1)*(u-1)+h,v=(r+1)*u+h,g=new THREE.Face3(f,d,v,[a[f].clone(),a[d].clone(),a[v].clone()]);this.faces.push(g),this.faceVertexUvs[0].push([s[f].clone(),s[d].clone(),s[v].clone()]),g=new THREE.Face3(d,m,v,[a[d].clone(),a[m].clone(),a[v].clone()]),this.faces.push(g),this.faceVertexUvs[0].push([s[d].clone(),s[m].clone(),s[v].clone()])}this.computeFaceNormals()},THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry,THREE.TorusKnotGeometry=function(t,e,n,r,i,o,s){function a(t,e,n,r,i){var o=Math.cos(t),s=Math.sin(t),a=e/n*t,u=Math.cos(a),h=r*(2+u)*.5*o,l=r*(2+u)*s*.5,c=i*r*Math.sin(a)*.5;return new THREE.Vector3(h,l,c)}THREE.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,p:i,q:o,heightScale:s},t=t||100,e=e||40,n=n||64,r=r||8,i=i||2,o=o||3,s=s||1;for(var u=new Array(n),h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3,p=0;n>p;++p){u[p]=new Array(r);var f=p/n*2*i*Math.PI,d=a(f,o,i,t,s),m=a(f+.01,o,i,t,s);h.subVectors(m,d),l.addVectors(m,d),c.crossVectors(h,l),l.crossVectors(c,h),c.normalize(),l.normalize();for(var v=0;r>v;++v){var g=v/r*2*Math.PI,E=-e*Math.cos(g),y=e*Math.sin(g),_=new THREE.Vector3;_.x=d.x+E*l.x+y*c.x,_.y=d.y+E*l.y+y*c.y,_.z=d.z+E*l.z+y*c.z,u[p][v]=this.vertices.push(_)-1}}for(var p=0;n>p;++p)for(var v=0;r>v;++v){var b=(p+1)%n,T=(v+1)%r,x=u[p][v],w=u[b][v],R=u[b][T],H=u[p][T],M=new THREE.Vector2(p/n,v/r),S=new THREE.Vector2((p+1)/n,v/r),k=new THREE.Vector2((p+1)/n,(v+1)/r),A=new THREE.Vector2(p/n,(v+1)/r);this.faces.push(new THREE.Face3(x,w,H)),this.faceVertexUvs[0].push([M,S,A]),this.faces.push(new THREE.Face3(w,R,H)),this.faceVertexUvs[0].push([S.clone(),k,A.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry,THREE.TubeGeometry=function(t,e,n,r,i,o){function s(t,e,n){return k.vertices.push(new THREE.Vector3(t,e,n))-1}THREE.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:e,radius:n,radialSegments:r,closed:i},e=e||64,n=n||1,r=r||8,i=i||!1,o=o||THREE.TubeGeometry.NoTaper;var a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S=[],k=this,A=e+1,C=new THREE.Vector3,P=new THREE.TubeGeometry.FrenetFrames(t,e,i),L=P.tangents,z=P.normals,O=P.binormals;for(this.tangents=L,this.normals=z,this.binormals=O,v=0;A>v;v++)for(S[v]=[],l=v/(A-1),m=t.getPointAt(l),a=L[v],u=z[v],h=O[v],p=n*o(l),g=0;r>g;g++)c=g/r*2*Math.PI,f=-p*Math.cos(c),d=p*Math.sin(c),C.copy(m),C.x+=f*u.x+d*h.x,C.y+=f*u.y+d*h.y,C.z+=f*u.z+d*h.z,S[v][g]=s(C.x,C.y,C.z);for(v=0;e>v;v++)for(g=0;r>g;g++)E=i?(v+1)%e:v+1,y=(g+1)%r,_=S[v][g],b=S[E][g],T=S[E][y],x=S[v][y],w=new THREE.Vector2(v/e,g/r),R=new THREE.Vector2((v+1)/e,g/r),H=new THREE.Vector2((v+1)/e,(g+1)/r),M=new THREE.Vector2(v/e,(g+1)/r),this.faces.push(new THREE.Face3(_,b,x)),this.faceVertexUvs[0].push([w,R,M]),this.faces.push(new THREE.Face3(b,T,x)),this.faceVertexUvs[0].push([R.clone(),H,M.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry,THREE.TubeGeometry.NoTaper=function(t){return 1},THREE.TubeGeometry.SinusoidalTaper=function(t){return Math.sin(Math.PI*t)},THREE.TubeGeometry.FrenetFrames=function(t,e,n){function r(){f[0]=new THREE.Vector3,d[0]=new THREE.Vector3,o=Number.MAX_VALUE,s=Math.abs(p[0].x),a=Math.abs(p[0].y),u=Math.abs(p[0].z),o>=s&&(o=s,c.set(1,0,0)),o>=a&&(o=a,c.set(0,1,0)),o>=u&&c.set(0,0,1),m.crossVectors(p[0],c).normalize(),f[0].crossVectors(p[0],m),d[0].crossVectors(p[0],f[0])}var i,o,s,a,u,h,l,c=new THREE.Vector3,p=[],f=[],d=[],m=new THREE.Vector3,v=new THREE.Matrix4,g=e+1,E=1e-4;for(this.tangents=p,this.normals=f,this.binormals=d,h=0;g>h;h++)l=h/(g-1),p[h]=t.getTangentAt(l),p[h].normalize();for(r(),h=1;g>h;h++)f[h]=f[h-1].clone(),d[h]=d[h-1].clone(),m.crossVectors(p[h-1],p[h]),m.length()>E&&(m.normalize(),i=Math.acos(THREE.Math.clamp(p[h-1].dot(p[h]),-1,1)),f[h].applyMatrix4(v.makeRotationAxis(m,i))),d[h].crossVectors(p[h],f[h]);if(n)for(i=Math.acos(THREE.Math.clamp(f[0].dot(f[g-1]),-1,1)),i/=g-1,p[0].dot(m.crossVectors(f[0],f[g-1]))>0&&(i=-i),h=1;g>h;h++)f[h].applyMatrix4(v.makeRotationAxis(p[h],i*h)),d[h].crossVectors(p[h],f[h])},THREE.PolyhedronGeometry=function(t,e,n,r){function i(t){var e=t.normalize().clone();e.index=l.vertices.push(e)-1;var n=a(t)/2/Math.PI+.5,r=u(t)/Math.PI+.5;return e.uv=new THREE.Vector2(n,1-r),e}function o(t,e,n){var r=new THREE.Face3(t.index,e.index,n.index,[t.clone(),e.clone(),n.clone()]);l.faces.push(r),y.copy(t).add(e).add(n).divideScalar(3);var i=a(y);l.faceVertexUvs[0].push([h(t.uv,t,i),h(e.uv,e,i),h(n.uv,n,i)])}function s(t,e){for(var n=Math.pow(2,e),r=i(l.vertices[t.a]),s=i(l.vertices[t.b]),a=i(l.vertices[t.c]),u=[],h=0;n>=h;h++){u[h]=[];for(var c=i(r.clone().lerp(a,h/n)),p=i(s.clone().lerp(a,h/n)),f=n-h,d=0;f>=d;d++)0==d&&h==n?u[h][d]=c:u[h][d]=i(c.clone().lerp(p,d/f))}for(var h=0;n>h;h++)for(var d=0;2*(n-h)-1>d;d++){var m=Math.floor(d/2);d%2==0?o(u[h][m+1],u[h+1][m],u[h][m]):o(u[h][m+1],u[h+1][m+1],u[h+1][m])}}function a(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}function h(t,e,n){return 0>n&&1===t.x&&(t=new THREE.Vector2(t.x-1,t.y)),0===e.x&&0===e.z&&(t=new THREE.Vector2(n/2/Math.PI+.5,t.y)),t.clone()}THREE.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1,r=r||0;for(var l=this,c=0,p=t.length;p>c;c+=3)i(new THREE.Vector3(t[c],t[c+1],t[c+2]));for(var f=this.vertices,d=[],c=0,m=0,p=e.length;p>c;c+=3,m++){var v=f[e[c]],g=f[e[c+1]],E=f[e[c+2]];d[m]=new THREE.Face3(v.index,g.index,E.index,[v.clone(),g.clone(),E.clone()])}for(var y=new THREE.Vector3,c=0,p=d.length;p>c;c++)s(d[c],r);for(var c=0,p=this.faceVertexUvs[0].length;p>c;c++){var _=this.faceVertexUvs[0][c],b=_[0].x,T=_[1].x,x=_[2].x,w=Math.max(b,Math.max(T,x)),R=Math.min(b,Math.min(T,x));w>.9&&.1>R&&(.2>b&&(_[0].x+=1),.2>T&&(_[1].x+=1),.2>x&&(_[2].x+=1))}for(var c=0,p=this.vertices.length;p>c;c++)this.vertices[c].multiplyScalar(n);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new THREE.Sphere(new THREE.Vector3,n)},THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry,THREE.DodecahedronGeometry=function(t,e){this.parameters={radius:t,detail:e};var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],o=[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];THREE.PolyhedronGeometry.call(this,i,o,t,e)},THREE.DodecahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry,THREE.IcosahedronGeometry=function(t,e){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],i=[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];THREE.PolyhedronGeometry.call(this,r,i,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}},THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry,THREE.OctahedronGeometry=function(t,e){this.parameters={radius:t,detail:e};var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];THREE.PolyhedronGeometry.call(this,n,r,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}},THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry,THREE.TetrahedronGeometry=function(t,e){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];THREE.PolyhedronGeometry.call(this,n,r,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}},THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry,THREE.ParametricGeometry=function(t,e,n){THREE.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};var r,i,o,s,a,u=this.vertices,h=this.faces,l=this.faceVertexUvs[0],c=e+1;for(r=0;n>=r;r++)for(a=r/n,i=0;e>=i;i++)s=i/e,o=t(s,a),u.push(o);var p,f,d,m,v,g,E,y;for(r=0;n>r;r++)for(i=0;e>i;i++)p=r*c+i,f=r*c+i+1,d=(r+1)*c+i+1,m=(r+1)*c+i,v=new THREE.Vector2(i/e,r/n),g=new THREE.Vector2((i+1)/e,r/n),E=new THREE.Vector2((i+1)/e,(r+1)/n),y=new THREE.Vector2(i/e,(r+1)/n),h.push(new THREE.Face3(p,f,m)),l.push([v,g,y]),h.push(new THREE.Face3(f,d,m)),l.push([g.clone(),E,y.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry,THREE.AxisHelper=function(t){t=t||1;var e=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),n=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),r=new THREE.BufferGeometry;r.addAttribute("position",new THREE.BufferAttribute(e,3)),r.addAttribute("color",new THREE.BufferAttribute(n,3));var i=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,r,i,THREE.LinePieces)},THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype),THREE.AxisHelper.prototype.constructor=THREE.AxisHelper,THREE.ArrowHelper=function(){var t=new THREE.Geometry;t.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var e=new THREE.CylinderGeometry(0,.5,1,5,1);return e.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0)),function(n,r,i,o,s,a){THREE.Object3D.call(this),void 0===o&&(o=16776960),void 0===i&&(i=1),void 0===s&&(s=.2*i),void 0===a&&(a=.2*s),this.position.copy(r),this.line=new THREE.Line(t,new THREE.LineBasicMaterial({color:o})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:o})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(n),this.setLength(i,s,a)}}(),THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper,THREE.ArrowHelper.prototype.setDirection=function(){var t,e=new THREE.Vector3;return function(n){n.y>.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),THREE.ArrowHelper.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,t-e,1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},THREE.ArrowHelper.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},THREE.BoxHelper=function(t){var e=new THREE.BufferGeometry;e.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3)),THREE.Line.call(this,e,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces),void 0!==t&&this.update(t)},THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype),THREE.BoxHelper.prototype.constructor=THREE.BoxHelper,THREE.BoxHelper.prototype.update=function(t){var e=t.geometry;null===e.boundingBox&&e.computeBoundingBox();var n=e.boundingBox.min,r=e.boundingBox.max,i=this.geometry.attributes.position.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=n.x,i[4]=r.y,i[5]=r.z,i[6]=n.x,i[7]=r.y,i[8]=r.z,i[9]=n.x,i[10]=n.y,i[11]=r.z,i[12]=n.x,i[13]=n.y,i[14]=r.z,i[15]=r.x,i[16]=n.y,i[17]=r.z,i[18]=r.x,i[19]=n.y,i[20]=r.z,i[21]=r.x,i[22]=r.y,i[23]=r.z,i[24]=r.x,i[25]=r.y,i[26]=n.z,i[27]=n.x,i[28]=r.y,i[29]=n.z,i[30]=n.x,i[31]=r.y,i[32]=n.z,i[33]=n.x,i[34]=n.y,i[35]=n.z,i[36]=n.x,i[37]=n.y,i[38]=n.z,i[39]=r.x,i[40]=n.y,i[41]=n.z,i[42]=r.x,i[43]=n.y,i[44]=n.z,i[45]=r.x,i[46]=r.y,i[47]=n.z,i[48]=r.x,i[49]=r.y,i[50]=r.z,i[51]=r.x,i[52]=r.y,i[53]=n.z,i[54]=n.x,i[55]=r.y,i[56]=r.z,i[57]=n.x,i[58]=r.y,i[59]=n.z,i[60]=n.x,i[61]=n.y,i[62]=r.z,i[63]=n.x,i[64]=n.y,i[65]=n.z,i[66]=r.x,i[67]=n.y,i[68]=r.z,i[69]=r.x,i[70]=n.y,i[71]=n.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.BoundingBoxHelper=function(t,e){var n=void 0!==e?e:8947848;this.object=t,this.box=new THREE.Box3,THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:n,wireframe:!0}))},THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype),THREE.BoundingBoxHelper.prototype.constructor=THREE.BoundingBoxHelper,THREE.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},THREE.CameraHelper=function(t){function e(t,e,r){n(t,r),n(e,r)}function n(t,e){r.vertices.push(new THREE.Vector3),r.colors.push(new THREE.Color(e)),void 0===o[t]&&(o[t]=[]),o[t].push(r.vertices.length-1)}var r=new THREE.Geometry,i=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),o={},s=16755200,a=16711680,u=43775,h=16777215,l=3355443;e("n1","n2",s),e("n2","n4",s),e("n4","n3",s),e("n3","n1",s),e("f1","f2",s),e("f2","f4",s),e("f4","f3",s),e("f3","f1",s),e("n1","f1",s),e("n2","f2",s),e("n3","f3",s),e("n4","f4",s),e("p","n1",a),e("p","n2",a),e("p","n3",a),e("p","n4",a),e("u1","u2",u),e("u2","u3",u),e("u3","u1",u),e("c","t",h),e("p","c",l),e("cn1","cn2",l),e("cn3","cn4",l),e("cf1","cf2",l),e("cf3","cf4",l),THREE.Line.call(this,r,i,THREE.LinePieces),this.camera=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()},THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype),THREE.CameraHelper.prototype.constructor=THREE.CameraHelper,THREE.CameraHelper.prototype.update=function(){var t,e,n=new THREE.Vector3,r=new THREE.Camera,i=function(i,o,s,a){n.set(o,s,a).unproject(r);var u=e[i];if(void 0!==u)for(var h=0,l=u.length;l>h;h++)t.vertices[u[h]].copy(n)};return function(){t=this.geometry,e=this.pointMap;var n=1,o=1;r.projectionMatrix.copy(this.camera.projectionMatrix),i("c",0,0,-1),i("t",0,0,1),i("n1",-n,-o,-1),i("n2",n,-o,-1),i("n3",-n,o,-1),i("n4",n,o,-1),i("f1",-n,-o,1),i("f2",n,-o,1),i("f3",-n,o,1),i("f4",n,o,1),i("u1",.7*n,1.1*o,-1),i("u2",.7*-n,1.1*o,-1),i("u3",0,2*o,-1),i("cf1",-n,0,1),i("cf2",n,0,1),i("cf3",0,-o,1),i("cf4",0,o,1),i("cn1",-n,0,-1),i("cn2",n,0,-1),i("cn3",0,-o,-1),i("cn4",0,o,-1),t.verticesNeedUpdate=!0}}(),THREE.DirectionalLightHelper=function(t,e){THREE.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,e=e||1;var n=new THREE.Geometry;n.vertices.push(new THREE.Vector3(-e,e,0),new THREE.Vector3(e,e,0),new THREE.Vector3(e,-e,0),new THREE.Vector3(-e,-e,0),new THREE.Vector3(-e,e,0));var r=new THREE.LineBasicMaterial({fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new THREE.Line(n,r),this.add(this.lightPlane),n=new THREE.Geometry,n.vertices.push(new THREE.Vector3,new THREE.Vector3),r=new THREE.LineBasicMaterial({fog:!1}),r.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new THREE.Line(n,r),this.add(this.targetLine),this.update()},THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper,THREE.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},THREE.DirectionalLightHelper.prototype.update=function(){var t=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(e,t),this.lightPlane.lookAt(n),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(n),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),THREE.EdgesHelper=function(t,e,n){var r=void 0!==e?e:16777215;n=void 0!==n?n:1;var i,o=Math.cos(THREE.Math.degToRad(n)),s=[0,0],a={},u=function(t,e){return t-e},h=["a","b","c"],l=new THREE.BufferGeometry;t.geometry instanceof THREE.BufferGeometry?(i=new THREE.Geometry,i.fromBufferGeometry(t.geometry)):i=t.geometry.clone(),i.mergeVertices(),i.computeFaceNormals();for(var c=i.vertices,p=i.faces,f=0,d=0,m=p.length;m>d;d++)for(var v=p[d],g=0;3>g;g++){s[0]=v[h[g]],s[1]=v[h[(g+1)%3]],s.sort(u);var E=s.toString();void 0===a[E]?(a[E]={vert1:s[0],vert2:s[1],face1:d,face2:void 0},f++):a[E].face2=d}var y=new Float32Array(2*f*3),_=0;for(var E in a){var b=a[E];if(void 0===b.face2||p[b.face1].normal.dot(p[b.face2].normal)<=o){var T=c[b.vert1];y[_++]=T.x,y[_++]=T.y,y[_++]=T.z,T=c[b.vert2],y[_++]=T.x,y[_++]=T.y,y[_++]=T.z}}l.addAttribute("position",new THREE.BufferAttribute(y,3)),THREE.Line.call(this,l,new THREE.LineBasicMaterial({color:r}),THREE.LinePieces),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype),THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper,THREE.FaceNormalsHelper=function(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;for(var i=void 0!==n?n:16776960,o=void 0!==r?r:1,s=new THREE.Geometry,a=this.object.geometry.faces,u=0,h=a.length;h>u;u++)s.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,s,new THREE.LineBasicMaterial({color:i,linewidth:o}),THREE.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new THREE.Matrix3,this.update()},THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype),THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper,THREE.FaceNormalsHelper.prototype.update=function(){var t=this.geometry.vertices,e=this.object,n=e.geometry.vertices,r=e.geometry.faces,i=e.matrixWorld;e.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(i);for(var o=0,s=0,a=r.length;a>o;o++,s+=2){var u=r[o];t[s].copy(n[u.a]).add(n[u.b]).add(n[u.c]).divideScalar(3).applyMatrix4(i),t[s+1].copy(u.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(t[s])}return this.geometry.verticesNeedUpdate=!0,this},THREE.GridHelper=function(t,e){var n=new THREE.Geometry,r=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924),this.color2=new THREE.Color(8947848);for(var i=-t;t>=i;i+=e){n.vertices.push(new THREE.Vector3(-t,0,i),new THREE.Vector3(t,0,i),new THREE.Vector3(i,0,-t),new THREE.Vector3(i,0,t));var o=0===i?this.color1:this.color2;n.colors.push(o,o,o,o)}THREE.Line.call(this,n,r,THREE.LinePieces)},THREE.GridHelper.prototype=Object.create(THREE.Line.prototype),THREE.GridHelper.prototype.constructor=THREE.GridHelper,THREE.GridHelper.prototype.setColors=function(t,e){this.color1.set(t),this.color2.set(e),this.geometry.colorsNeedUpdate=!0},THREE.HemisphereLightHelper=function(t,e){THREE.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new THREE.Color,new THREE.Color];var n=new THREE.SphereGeometry(e,4,2);n.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(var r=0,i=8;i>r;r++)n.faces[r].color=this.colors[4>r?0:1];var o=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(n,o),this.add(this.lightSphere),this.update()},THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.HemisphereLightHelper.prototype.constructor=THREE.HemisphereLightHelper,THREE.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},THREE.HemisphereLightHelper.prototype.update=function(){var t=new THREE.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),THREE.PointLightHelper=function(t,e){this.light=t,this.light.updateMatrixWorld();var n=new THREE.SphereGeometry(e,4,2),r=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});r.color.copy(this.light.color).multiplyScalar(this.light.intensity),THREE.Mesh.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype),THREE.PointLightHelper.prototype.constructor=THREE.PointLightHelper,THREE.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},THREE.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},THREE.SkeletonHelper=function(t){this.bones=this.getBoneList(t);for(var e=new THREE.Geometry,n=0;nu;u++)for(var l=a[u],c=0,p=l.vertexNormals.length;p>c;c++)s.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,s,new THREE.LineBasicMaterial({color:i,linewidth:o}),THREE.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new THREE.Matrix3,this.update()},THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype),THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper,THREE.VertexNormalsHelper.prototype.update=function(t){var e=new THREE.Vector3;return function(t){var n=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var r=this.geometry.vertices,i=this.object.geometry.vertices,o=this.object.geometry.faces,s=this.object.matrixWorld,a=0,u=0,h=o.length;h>u;u++)for(var l=o[u],c=0,p=l.vertexNormals.length;p>c;c++){var f=l[n[c]],d=i[f],m=l.vertexNormals[c];r[a].copy(d).applyMatrix4(s),e.copy(m).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),e.add(r[a]),a+=1,r[a].copy(e),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),THREE.VertexTangentsHelper=function(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;for(var i=void 0!==n?n:255,o=void 0!==r?r:1,s=new THREE.Geometry,a=t.geometry.faces,u=0,h=a.length;h>u;u++)for(var l=a[u],c=0,p=l.vertexTangents.length;p>c;c++)s.vertices.push(new THREE.Vector3),s.vertices.push(new THREE.Vector3);THREE.Line.call(this,s,new THREE.LineBasicMaterial({color:i,linewidth:o}),THREE.LinePieces),this.matrixAutoUpdate=!1,this.update()},THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype),THREE.VertexTangentsHelper.prototype.constructor=THREE.VertexTangentsHelper,THREE.VertexTangentsHelper.prototype.update=function(t){var e=new THREE.Vector3;return function(t){var n=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var r=this.geometry.vertices,i=this.object.geometry.vertices,o=this.object.geometry.faces,s=this.object.matrixWorld,a=0,u=0,h=o.length;h>u;u++)for(var l=o[u],c=0,p=l.vertexTangents.length;p>c;c++){var f=l[n[c]],d=i[f],m=l.vertexTangents[c];r[a].copy(d).applyMatrix4(s),e.copy(m).transformDirection(s).multiplyScalar(this.size),e.add(r[a]),a+=1,r[a].copy(e),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),THREE.WireframeHelper=function(t,e){var n=void 0!==e?e:16777215,r=[0,0],i={},o=function(t,e){return t-e},s=["a","b","c"],a=new THREE.BufferGeometry;if(t.geometry instanceof THREE.Geometry){for(var u=t.geometry.vertices,h=t.geometry.faces,l=0,c=new Uint32Array(6*h.length),p=0,f=h.length;f>p;p++)for(var d=h[p],m=0;3>m;m++){r[0]=d[s[m]],r[1]=d[s[(m+1)%3]],r.sort(o);var v=r.toString();void 0===i[v]&&(c[2*l]=r[0],c[2*l+1]=r[1],i[v]=!0,l++)}for(var g=new Float32Array(2*l*3),p=0,f=l;f>p;p++)for(var m=0;2>m;m++){var E=u[c[2*p+m]],y=6*p+3*m;g[y+0]=E.x,g[y+1]=E.y,g[y+2]=E.z}a.addAttribute("position",new THREE.BufferAttribute(g,3))}else if(t.geometry instanceof THREE.BufferGeometry)if(void 0!==t.geometry.attributes.index){var u=t.geometry.attributes.position.array,_=t.geometry.attributes.index.array,b=t.geometry.drawcalls,l=0;0===b.length&&(b=[{count:_.length,index:0,start:0}]);for(var c=new Uint32Array(2*_.length),T=0,x=b.length;x>T;++T)for(var w=b[T].start,R=b[T].count,y=b[T].index,p=w,H=w+R;H>p;p+=3)for(var m=0;3>m;m++){r[0]=y+_[p+m],r[1]=y+_[p+(m+1)%3],r.sort(o);var v=r.toString();void 0===i[v]&&(c[2*l]=r[0],c[2*l+1]=r[1],i[v]=!0,l++)}for(var g=new Float32Array(2*l*3),p=0,f=l;f>p;p++)for(var m=0;2>m;m++){var y=6*p+3*m,M=3*c[2*p+m];g[y+0]=u[M],g[y+1]=u[M+1],g[y+2]=u[M+2]}a.addAttribute("position",new THREE.BufferAttribute(g,3))}else{for(var u=t.geometry.attributes.position.array,l=u.length/3,S=l/3,g=new Float32Array(2*l*3),p=0,f=S;f>p;p++)for(var m=0;3>m;m++){var y=18*p+6*m,k=9*p+3*m;g[y+0]=u[k],g[y+1]=u[k+1],g[y+2]=u[k+2];var M=9*p+3*((m+1)%3);g[y+3]=u[M], +g[y+4]=u[M+1],g[y+5]=u[M+2]}a.addAttribute("position",new THREE.BufferAttribute(g,3))}THREE.Line.call(this,a,new THREE.LineBasicMaterial({color:n}),THREE.LinePieces),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype),THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper,THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this),this.render=function(t){}},THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype),THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject,THREE.MorphBlendMesh=function(t,e){THREE.Mesh.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,r="__default",i=0,o=n-1,s=n/1;this.createAnimation(r,i,o,s),this.setAnimationWeight(r,1)},THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh,THREE.MorphBlendMesh.prototype.createAnimation=function(t,e,n,r){var i={startFrame:e,endFrame:n,length:n-e+1,fps:r,duration:(n-e)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=i,this.animationsList.push(i)},THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(t){for(var e,n=/([a-z]+)_?(\d+)/,r={},i=this.geometry,o=0,s=i.morphTargets.length;s>o;o++){var a=i.morphTargets[o],u=a.name.match(n);if(u&&u.length>1){var h=u[1];r[h]||(r[h]={start:1/0,end:-(1/0)});var l=r[h];ol.end&&(l.end=o),e||(e=h)}}for(var h in r){var l=r[h];this.createAnimation(h,l.start,l.end,t)}this.firstAnimation=e},THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},THREE.MorphBlendMesh.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},THREE.MorphBlendMesh.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},THREE.MorphBlendMesh.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},THREE.MorphBlendMesh.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},THREE.MorphBlendMesh.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},THREE.MorphBlendMesh.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},THREE.MorphBlendMesh.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):THREE.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},THREE.MorphBlendMesh.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},THREE.MorphBlendMesh.prototype.update=function(t){for(var e=0,n=this.animationsList.length;n>e;e++){var r=this.animationsList[e];if(r.active){var i=r.duration/r.length;r.time+=r.direction*t,r.mirroredLoop?(r.time>r.duration||r.time<0)&&(r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)):(r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration));var o=r.startFrame+THREE.Math.clamp(Math.floor(r.time/i),0,r.length-1),s=r.weight;o!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*s,this.morphTargetInfluences[o]=0,r.lastFrame=r.currentFrame,r.currentFrame=o);var a=r.time%i/i;r.directionBackwards&&(a=1-a),this.morphTargetInfluences[r.currentFrame]=a*s,this.morphTargetInfluences[r.lastFrame]=(1-a)*s}}},function(){function t(t,e,n){for(var r=(n||0)-1,i=t?t.length:0;++r-1?0:-1:e?0:-1}function n(t){var e=this.cache,n=typeof t;if("boolean"==n||null==t)e[t]=!0;else{"number"!=n&&"string"!=n&&(n="object");var r="number"==n?t:g+t,i=e[n]||(e[n]={});"object"==n?(i[r]||(i[r]=[])).push(t):i[r]=!0}}function r(t){return t.charCodeAt(0)}function i(t,e){for(var n=t.criteria,r=e.criteria,i=-1,o=n.length;++ia||"undefined"==typeof s)return 1;if(a>s||"undefined"==typeof a)return-1}}return t.index-e.index}function o(t){var e=-1,r=t.length,i=t[0],o=t[r/2|0],s=t[r-1];if(i&&"object"==typeof i&&o&&"object"==typeof o&&s&&"object"==typeof s)return!1;var a=u();a["false"]=a["null"]=a["true"]=a.undefined=!1;var h=u();for(h.array=t,h.cache=a,h.push=n;++ei?0:i);++r=E&&s===t,h=[];if(u){var c=o(r);c?(s=e,r=c):u=!1}for(;++i-1:void 0});return i.pop(),o.pop(),E&&(h(i),h(o)),s}function nt(t,e,n,r,i){(Jn(e)?Kt:ur)(e,function(e,o){var s,a,u=e,h=t[o];if(e&&((a=Jn(e))||hr(e))){for(var l=r.length;l--;)if(s=r[l]==e){h=i[l];break}if(!s){var c;n&&(u=n(h,e),(c="undefined"!=typeof u)&&(h=u)),c||(h=a?Jn(h)?h:[]:hr(h)?h:{}),r.push(e),i.push(h),c||nt(h,e,n,r,i)}}else n&&(u=n(h,e),"undefined"==typeof u&&(u=e)),"undefined"!=typeof u&&(h=u);t[o]=h})}function rt(t,e){return t+Cn(Yn()*(e-t+1))}function it(n,r,i){var s=-1,u=ut(),c=n?n.length:0,p=[],f=!r&&c>=E&&u===t,d=i||f?a():p;if(f){var m=o(d);u=e,d=m}for(;++s3&&"function"==typeof e[n-2])var r=K(e[--n-1],e[n--],2);else n>2&&"function"==typeof e[n-1]&&(r=e[--n]);for(var i=c(arguments,1,n),o=-1,s=a(),u=a();++on?Wn(0,o+n):n)||0,Jn(t)?s=i(t,e,n)>-1:"number"==typeof o?s=(Ot(t)?t.indexOf(e,n):i(t,e,n))>-1:ur(t,function(t){return++r>=n?!(s=t===e):void 0}),s}function qt(t,e,n){var r=!0;e=d.createCallback(e,n,3);var i=-1,o=t?t.length:0;if("number"==typeof o)for(;++io&&(o=u)}else e=null==e&&Ot(t)?r:d.createCallback(e,n,3),Kt(t,function(t,n,r){var s=e(t,n,r);s>i&&(i=s,o=t)});return o}function ee(t,e,n){var i=1/0,o=i;if("function"!=typeof e&&n&&n[e]===t&&(e=null),null==e&&Jn(t))for(var s=-1,a=t.length;++su&&(o=u)}else e=null==e&&Ot(t)?r:d.createCallback(e,n,3),Kt(t,function(t,n,r){var s=e(t,n,r);i>s&&(i=s,o=t)});return o}function ne(t,e,n,r){if(!t)return n;var i=arguments.length<3;e=d.createCallback(e,r,4);var o=-1,s=t.length;if("number"==typeof s)for(i&&(n=t[++o]);++or?Wn(0,i+r):r||0}else if(r){var o=He(e,n);return e[o]===n?o:-1}return t(e,n,r)}function Ee(t,e,n){var r=0,i=t?t.length:0;if("number"!=typeof e&&null!=e){var o=i;for(e=d.createCallback(e,n,3);o--&&e(t[o],o,t);)r++}else r=null==e||n?1:e||r;return c(t,0,qn(Wn(0,i-r),i))}function ye(){for(var n=[],r=-1,i=arguments.length,s=a(),u=ut(),c=u===t,p=a();++r=E&&o(r?n[r]:p)))}var d=n[0],m=-1,v=d?d.length:0,g=[];t:for(;++mn?Wn(0,r+n):qn(n,r-1))+1);r--;)if(t[r]===e)return r;return-1}function Te(t){for(var e=arguments,n=0,r=e.length,i=t?t.length:0;++ni;){var s=i+o>>>1;n(t[s])1?arguments:arguments[0],e=-1,n=t?te(fr(t,"length")):0,r=dn(0>n?0:n);++e2?st(t,17,c(arguments,2),null,e):st(t,1,null,null,e)}function Oe(t){for(var e=arguments.length>1?tt(arguments,!0,!1,1):_t(t),n=-1,r=e.length;++n2?st(e,19,c(arguments,2),null,t):st(e,3,null,null,t)}function Fe(){for(var t=arguments,e=t.length;e--;)if(!kt(t[e]))throw new xn;return function(){for(var e=arguments,n=t.length;n--;)e=[t[n].apply(this,e)];return e[0]}}function Ue(t,e){return e="number"==typeof e?e:+e||t.length,st(t,4,null,null,null,e)}function Be(t,e,n){var r,i,o,s,a,u,h,l=0,c=!1,p=!0;if(!kt(t))throw new xn;if(e=Wn(0,e)||0,n===!0){var d=!0;p=!1}else At(n)&&(d=n.leading,c="maxWait"in n&&(Wn(e,n.maxWait)||0),p="trailing"in n?n.trailing:p);var m=function(){var n=e-(mr()-s);if(0>=n){i&&An(i);var c=h;i=u=h=f,c&&(l=mr(),o=t.apply(a,r),u||i||(r=a=null))}else u=Dn(m,n)},v=function(){u&&An(u),i=u=h=f,(p||c!==e)&&(l=mr(),o=t.apply(a,r),u||i||(r=a=null))};return function(){if(r=arguments,s=mr(),a=this,h=p&&(u||!d),c===!1)var n=d&&!u;else{i||d||(l=s);var f=c-(s-l),g=0>=f;g?(i&&(i=An(i)),l=s,o=t.apply(a,r)):i||(i=Dn(v,f))}return g&&u?u=An(u):u||e===c||(u=Dn(m,e)),n&&(g=!0,o=t.apply(a,r)),!g||u||i||(r=a=null),o}}function Ne(t){if(!kt(t))throw new xn;var e=c(arguments,1);return Dn(function(){t.apply(f,e)},1)}function Ve(t,e){if(!kt(t))throw new xn;var n=c(arguments,2);return Dn(function(){t.apply(f,n)},e)}function Ie(t,e){if(!kt(t))throw new xn;var n=function(){var r=n.cache,i=e?e.apply(this,arguments):g+arguments[0];return zn.call(r,i)?r[i]:r[i]=t.apply(this,arguments)};return n.cache={},n}function je(t){var e,n;if(!kt(t))throw new xn;return function(){return e?n:(e=!0,n=t.apply(this,arguments),t=null,n)}}function Ge(t){return st(t,16,c(arguments,1))}function We(t){return st(t,32,null,c(arguments,1))}function qe(t,e,n){var r=!0,i=!0;if(!kt(t))throw new xn;return n===!1?r=!1:At(n)&&(r="leading"in n?n.leading:r,i="trailing"in n?n.trailing:i),G.leading=r,G.maxWait=e,G.trailing=i,Be(t,e,G)}function Xe(t,e){return st(e,16,[t])}function Ye(t){return function(){return t}}function Ze(t,e,n){var r=typeof t;if(null==t||"function"==r)return K(t,e,n);if("object"!=r)return en(t);var i=tr(t),o=i[0],s=t[o];return 1!=i.length||s!==s||At(s)?function(e){for(var n=i.length,r=!1;n--&&(r=et(e[i[n]],t[i[n]],null,!0)););return r}:function(t){var e=t[o];return s===e&&(0!==s||1/s==1/e)}}function Ke(t){return null==t?"":Tn(t).replace(ir,at)}function Qe(t){return t}function Je(t,e,n){var r=!0,i=e&&_t(e);e&&(n||i.length)||(null==n&&(n=e),o=m,e=t,t=d,i=_t(e)),n===!1?r=!1:At(n)&&"chain"in n&&(r=n.chain);var o=t,s=kt(o);Kt(i,function(n){var i=t[n]=e[n];s&&(o.prototype[n]=function(){var e=this.__chain__,n=this.__wrapped__,s=[n];On.apply(s,arguments);var a=i.apply(t,s);if(r||e){if(n===a&&At(a))return this;a=new o(a),a.__chain__=e}return a})})}function $e(){return n._=Hn,this}function tn(){}function en(t){return function(e){return e[t]}}function nn(t,e,n){var r=null==t,i=null==e;if(null==n&&("boolean"==typeof t&&i?(n=t,t=1):i||"boolean"!=typeof e||(n=e,i=!0)),r&&i&&(e=1),t=+t||0,i?(e=t,t=0):e=+e||0,n||t%1||e%1){var o=Yn();return qn(t+o*(e-t+parseFloat("1e-"+((o+"").length-1))),e)}return rt(t,e)}function rn(t,e){if(t){var n=t[e];return kt(n)?t[e]():n}}function on(t,e,n){var r=d.templateSettings;t=Tn(t||""),n=sr({},n,r);var i,o=sr({},n.imports,r.imports),a=tr(o),u=jt(o),h=0,l=n.interpolate||k,c="__p += '",p=bn((n.escape||k).source+"|"+l.source+"|"+(l===M?w:k).source+"|"+(n.evaluate||k).source+"|$","g");t.replace(p,function(e,n,r,o,a,u){return r||(r=o),c+=t.slice(h,u).replace(C,s),n&&(c+="' +\n__e("+n+") +\n'"),a&&(i=!0,c+="';\n"+a+";\n__p += '"),r&&(c+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),h=u+e.length,e}),c+="';\n";var m=n.variable,v=m;v||(m="obj",c="with ("+m+") {\n"+c+"\n}\n"),c=(i?c.replace(b,""):c).replace(T,"$1").replace(x,"$1;"),c="function("+m+") {\n"+(v?"":m+" || ("+m+" = {});\n")+"var __t, __p = '', __e = _.escape"+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+c+"return __p\n}";var g="\n/*\n//# sourceURL="+(n.sourceURL||"/lodash/template/source["+L++ +"]")+"\n*/";try{var E=gn(a,"return "+c+g).apply(f,u)}catch(y){throw y.source=c,y}return e?E(e):(E.source=c,E)}function sn(t,e,n){t=(t=+t)>-1?t:0;var r=-1,i=dn(t);for(e=K(e,n,1);++r/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:M,variable:"",imports:{_:d}},Nn||(Z=function(){function t(){}return function(e){if(At(e)){t.prototype=e;var r=new t;t.prototype=null}return r||n.Object()}}());var Qn=Bn?function(t,e){W.value=e,Bn(t,"__bindData__",W)}:tn,Jn=Vn||function(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Mn.call(t)==O||!1},$n=function(t){var e,n=t,r=[];if(!n)return r;if(!q[typeof t])return r;for(e in n)zn.call(n,e)&&r.push(e);return r},tr=Gn?function(t){return At(t)?Gn(t):[]}:$n,er={"&":"&","<":"<",">":">",'"':""","'":"'"},nr=Tt(er),rr=bn("("+tr(nr).join("|")+")","g"),ir=bn("["+tr(er).join("")+"]","g"),or=function(t,e,n){var r,i=t,o=i;if(!i)return o;var s=arguments,a=0,u="number"==typeof n?2:s.length;if(u>3&&"function"==typeof s[u-2])var h=K(s[--u-1],s[u--],2);else u>2&&"function"==typeof s[u-1]&&(h=s[--u]);for(;++a/g,S=RegExp("^["+_+"]*0+(?=.$)"),k=/($^)/,A=/\bthis\b/,C=/['\n\r\t\u2028\u2029\\]/g,P=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"],L=0,z="[object Arguments]",O="[object Array]",D="[object Boolean]",F="[object Date]",U="[object Function]",B="[object Number]",N="[object Object]",V="[object RegExp]",I="[object String]",j={};j[U]=!1,j[z]=j[O]=j[D]=j[F]=j[B]=j[N]=j[V]=j[I]=!0;var G={leading:!1,maxWait:0,trailing:!1},W={configurable:!1,enumerable:!1,value:null,writable:!1},q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},X={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},Y=q[typeof window]&&window||this,Z=q[typeof exports]&&exports&&!exports.nodeType&&exports,K=q[typeof module]&&module&&!module.nodeType&&module,Q=K&&K.exports===Z&&Z,J=q[typeof global]&&global; +!J||J.global!==J&&J.window!==J||(Y=J);var $=p();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Y._=$,define(function(){return $})):Z&&K?Q?(K.exports=$)._=$:Z._=$:Y._=$}.call(this),THREE.Binder={bind:function(t,e){return function(n,r){r.__binds||(r.__binds=[]);var i=t;_.isArray(n)&&(i=n[0],n=n[1]);for(var o=/^([^.:]*(?:\.[^.:]+)*)?(?:\:(.*))?$/.exec(n),s=o[1].split(/\./g),a=s.pop(),u=o[2]||a,h=s.shift(),l={"this":r}[h]||e[h]||t[h]||i;l&&(n=s.shift());)l=l[n];if(l&&(l.on||l.addEventListener)){var c=function(e){r[u]&&r[u](e,t)};THREE.Binder._polyfill(l,["addEventListener","on"],function(t){l[t](a,c)});var p={target:l,name:a,callback:c};return r.__binds.push(p),c}throw"Cannot bind '"+n+"' in "+this.__name}},unbind:function(){return function(t){t.__binds&&(t.__binds.forEach(function(t){THREE.Binder._polyfill(t.target,["removeEventListener","off"],function(e){t.target[e](t.name,t.callback)})}.bind(this)),t.__binds=[])}},apply:function(t){THREE.EventDispatcher.prototype.apply(t),t.trigger=THREE.Binder._trigger,t.triggerOnce=THREE.Binder._triggerOnce,t.on=t.addEventListener,t.off=t.removeEventListener,t.dispatchEvent=t.trigger},_triggerOnce:function(t){this.trigger(t),this._listeners&&delete this._listeners[t.type]},_trigger:function(t){if(void 0!==this._listeners){var e=t.type,n=this._listeners[e];if(void 0!==n){n=n.slice();var r=n.length;t.target=this;for(var i=0;r>i;i++)n[i].call(this,t,this)}}},_polyfill:function(t,e,n){e.map(function(e){return t.method}),e.length&&n(e[0])}},THREE.Api={apply:function(t){t.set=function(t){var e=this.options||{},n=_.reduce(t,function(t,n,r){return e[r]!==n&&(t[r]=n),t},{});this.options=_.extend(e,n),this.trigger({type:"change",options:t,changes:n})},t.get=function(){return this.options},t.api=function(t,e){return t=t||{},e&&_.each(t,function(t,n,r){_.isFunction(t)&&(r[n]=_.partialRight(t,e))}),t.set=this.set.bind(this),t.get=this.get.bind(this),t}}},THREE.Bootstrap=function(t){if(t){var e=[].slice.apply(arguments);t={},e[0]instanceof Node&&(node=e[0],e=e.slice(1),t.element=node),_.isString(e[0])&&(t.plugins=e),_.isArray(e[0])&&(t.plugins=e[0]),e[0]&&(t=_.defaults(t,e[0]))}if(!(this instanceof THREE.Bootstrap))return new THREE.Bootstrap(t);var n={init:!0,element:document.body,plugins:["core"],aliases:{},plugindb:THREE.Bootstrap.Plugins||{},aliasdb:THREE.Bootstrap.Aliases||{}};this.__options=_.defaults(t||{},n),this.__inited=!1,this.__destroyed=!1,this.__installed=[];var r=this.__options.element;r===""+r&&(r=document.querySelector(r)),this.plugins={},this.element=r,this.__options.init&&this.init()},THREE.Bootstrap.prototype={init:function(){return this.__inited?void 0:(this.__inited=!0,this.install(this.__options.plugins),this)},destroy:function(){return this.__inited&&!this.__destroyed?(this.__destroyed=!0,this.trigger({type:"destroy"}),this.uninstall(),this):void 0},resolve:function(t){function e(t,n,o){if(o>=256)throw"Plug-in alias recursion detected.";return t=_.filter(t,i),_.each(t,function(t){var i=r[t];i?n=n.concat(e(i,[],o+1)):n.push(t)}),n}t=_.isArray(t)?t:[t];var n=this.__options,r=_.extend({},n.aliasdb,n.aliases),i=function(t){var e=t.split(":");return e[1]?(r[e[0]]=[e[1]],!1):!0};return t=_.filter(t,i),_.each(r,function(t,e){r[e]=_.isArray(t)?t:[t]}),e(t,[],0)},install:function(t){t=_.isArray(t)?t:[t],t=this.resolve(t),_.each(t,this.__install,this),this.__ready()},uninstall:function(t){t&&(t=_.isArray(t)?t:[t],t=this.resolve(t)),_.eachRight(t||this.__installed,this.__uninstall,this)},__install:function(t){var e=this.__options.plugindb[t];if(!e)throw"[three.install] Cannot install. '"+t+"' is not registered.";if(this.plugins[t])return console.warn("[three.install] "+t+" is already installed.");var n=e,r=new n(this.__options[t]||{},t);return this.plugins[t]=r,flag=r.install(this),this.__installed.push(r),this.trigger({type:"install",plugin:r}),flag},__uninstall:function(t,e){return plugin=_.isString(t)?this.plugins[t]:t,plugin?(t=plugin.__name,plugin.uninstall(this),this.__installed=_.without(this.__installed,plugin),delete this.plugins[t],void this.trigger({type:"uninstall",plugin:plugin})):console.warn("[three.uninstall] "+t+"' is not installed.")},__ready:function(){this.triggerOnce({type:"ready"})}},THREE.Binder.apply(THREE.Bootstrap.prototype),THREE.Bootstrap.Plugins={},THREE.Bootstrap.Aliases={},THREE.Bootstrap.Plugin=function(t){this.options=_.defaults(t||{},this.defaults)},THREE.Bootstrap.Plugin.prototype={listen:[],defaults:{},install:function(t){},uninstall:function(t){}},THREE.Binder.apply(THREE.Bootstrap.Plugin.prototype),THREE.Api.apply(THREE.Bootstrap.Plugin.prototype),THREE.Bootstrap.registerPlugin=function(t,e){var n=function(e){THREE.Bootstrap.Plugin.call(this,e),this.__name=t};n.prototype=_.extend(new THREE.Bootstrap.Plugin,e),THREE.Bootstrap.Plugins[t]=n},THREE.Bootstrap.unregisterPlugin=function(t){delete THREE.Bootstrap.Plugins[t]},THREE.Bootstrap.registerAlias=function(t,e){THREE.Bootstrap.Aliases[t]=e},THREE.Bootstrap.unregisterAlias=function(t){delete THREE.Bootstrap.Aliases[t]},THREE.Bootstrap.registerAlias("empty",["fallback","bind","renderer","size","fill","loop","time"]),THREE.Bootstrap.registerAlias("core",["empty","scene","camera","render","warmup"]),THREE.Bootstrap.registerAlias("VR",["core","cursor","fullscreen","render:vr"]),THREE.Bootstrap.registerPlugin("fallback",{defaults:{force:!1,fill:!0,begin:'
',end:"
",message:'This example requires WebGL
Visit get.webgl.org for more info'},install:function(t){var e;try{if(e=document.createElement("canvas"),gl=e.getContext("webgl")||e.getContext("experimental-webgl"),!gl||this.options.force)throw"WebGL unavailable.";t.fallback=!1}catch(n){var r=this.options.message,i=this.options.begin,o=this.options.end,s=this.options.fill,a=document.createElement("div");for(a.innerHTML=i+r+o,this.children=[];a.childNodes.length>0;)this.children.push(a.firstChild),t.element.appendChild(a.firstChild);return s&&t.install("fill"),this.div=a,t.fallback=!0,!1}},uninstall:function(t){this.children&&(this.children.forEach(function(t){t.parentNode.removeChild(t)}),this.children=null),delete t.fallback}}),THREE.Bootstrap.registerPlugin("renderer",{defaults:{klass:THREE.WebGLRenderer,parameters:{depth:!0,stencil:!0,preserveDrawingBuffer:!0,antialias:!0}},listen:["resize"],install:function(t){var e=t.renderer=new this.options.klass(this.options.parameters);t.canvas=e.domElement,t.element.appendChild(e.domElement)},uninstall:function(t){t.element.removeChild(t.renderer.domElement),delete t.renderer,delete t.canvas},resize:function(t,e){var n=e.renderer,r=n.domElement;r&&"CANVAS"==r.tagName?n.setSize(t.renderWidth,t.renderHeight,!1):(n.setRenderSize&&n.setRenderSize(t.renderWidth,t.renderHeight),n.setSize(t.viewWidth,t.viewHeight,!1))}}),THREE.Bootstrap.registerPlugin("bind",{install:function(t){var e={three:t,window:window};t.bind=THREE.Binder.bind(t,e),t.unbind=THREE.Binder.unbind(t),t.bind("install:bind",this),t.bind("uninstall:unbind",this)},uninstall:function(t){t.unbind(this),delete t.bind,delete t.unbind},bind:function(t,e){var n=t.plugin,r=n.listen;r&&r.forEach(function(t){e.bind(t,n)})},unbind:function(t,e){e.unbind(t.plugin)}}),THREE.Bootstrap.registerPlugin("size",{defaults:{width:null,height:null,aspect:null,scale:1,maxRenderWidth:1/0,maxRenderHeight:1/0,devicePixelRatio:!0},listen:["window.resize:queue","element.resize:queue","this.change:queue","ready:resize","pre:pre"],install:function(t){t.Size=this.api({renderWidth:0,renderHeight:0,viewWidth:0,viewHeight:0}),this.resized=!1},uninstall:function(t){delete t.Size},queue:function(t,e){this.resized=!0},pre:function(t,e){this.resized&&(this.resized=!1,this.resize(t,e))},resize:function(t,e){var n,r,i,o,s,a,u,h,l,c=this.options,p=e.element,f=e.renderer,d=0,m=0;n=i=void 0===c.width||null==c.width?p.offsetWidth||p.innerWidth||0:c.width,r=o=void 0===c.height||null==c.height?p.offsetHeight||p.innerHeight||0:c.height,u=n/r,c.aspect&&(c.aspect>u?(r=Math.round(n/c.aspect),m=Math.floor((o-r)/2)):(n=Math.round(r*c.aspect),d=Math.floor((i-n)/2)),u=n/r),l=1,c.devicePixelRatio&&"undefined"!=typeof window&&(l=window.devicePixelRatio||1),s=Math.min(n*l*c.scale,c.maxRenderWidth),a=Math.min(r*l*c.scale,c.maxRenderHeight),raspect=s/a,raspect>u?s=Math.round(a*u):a=Math.round(s/u),l=a/r,h=f.domElement.style,h.width=n+"px",h.height=r+"px",h.marginLeft=d+"px",h.marginTop=m+"px",_.extend(e.Size,{renderWidth:s,renderHeight:a,viewWidth:n,viewHeight:r,aspect:u,pixelRatio:l}),e.trigger({type:"resize",renderWidth:s,renderHeight:a,viewWidth:n,viewHeight:r,aspect:u,pixelRatio:l})}}),THREE.Bootstrap.registerPlugin("fill",{defaults:{block:!0,body:!0,layout:!0},install:function(t){function e(t){var e=t.style.height;return"auto"==e||""==e}function n(t){return t.style.height="100%",t.style.margin=0,t.style.padding=0,t}if(this.options.body&&t.element==document.body&&(this.applied=[t.element,document.documentElement].filter(e).map(n)),this.options.block&&t.canvas&&(t.canvas.style.display="block",this.block=!0),this.options.layout&&t.element){var r=window.getComputedStyle(t.element);"static"==r.position&&(t.element.style.position="relative",this.layout=!0)}},uninstall:function(t){function e(t){return t.style.height="",t.style.margin="",t.style.padding="",t}this.applied&&(this.applied.map(e),delete this.applied),this.block&&t.canvas&&(t.canvas.style.display="",delete this.block),this.layout&&t.element&&(t.element.style.position="",delete this.layout)},change:function(t){this.uninstall(t),this.install(t)}}),THREE.Bootstrap.registerPlugin("loop",{defaults:{start:!0},listen:["ready"],install:function(t){this.running=!1,t.Loop=this.api({start:this.start.bind(this),stop:this.stop.bind(this),running:!1},t),this.events=["pre","update","render","post"].map(function(t){return{type:t}})},uninstall:function(t){this.stop(t)},ready:function(t,e){this.options.start&&this.start(e)},start:function(t){if(!this.running){t.Loop.running=this.running=!0;var e=t.trigger.bind(t),n=function(){this.running&&requestAnimationFrame(n),this.events.map(e)}.bind(this);requestAnimationFrame(n),t.trigger({type:"start"})}},stop:function(t){this.running&&(t.Loop.running=this.running=!1,t.trigger({type:"stop"}))}}),THREE.Bootstrap.registerPlugin("time",{defaults:{speed:1,warmup:0,timeout:1},listen:["pre:tick","this.change"],now:function(){return+new Date/1e3},install:function(t){t.Time=this.api({now:this.now(),clock:0,step:1/60,frames:0,time:0,delta:1/60,average:0,fps:0}),this.last=0,this.time=0,this.clock=0,this.wait=this.options.warmup,this.clockStart=0,this.timeStart=0},tick:function(t,e){var n=this.options.speed,r=this.options.timeout,i=e.Time,o=i.now=this.now(),s=this.last,a=this.time,u=this.clock;if(s){var h=i.delta=o-s,l=i.average||h;h>r&&(h=0);var c=h*n;a+=h,u+=c,i.frames>0&&(i.average=l+.1*(h-l),i.fps=1/l),i.step=c,i.clock=u-this.clockStart,i.time=a-this.timeStart,i.frames++,this.wait-->0&&(this.clockStart=u,this.timeStart=a,i.clock=0,i.step=1e-100)}this.last=o,this.clock=u,this.time=a},uninstall:function(t){delete t.Time}}),THREE.Bootstrap.registerPlugin("scene",{install:function(t){t.scene=new THREE.Scene},uninstall:function(t){delete t.scene}}),THREE.Bootstrap.registerPlugin("camera",{defaults:{near:.01,far:1e4,type:"perspective",fov:60,aspect:null,left:-1,right:1,bottom:-1,top:1,klass:null,parameters:null},listen:["resize","this.change"],install:function(t){t.Camera=this.api(),t.camera=null,this.aspect=1,this.change({},t)},uninstall:function(t){delete t.Camera,delete t.camera},change:function(t,e){var n=this.options,r=e.camera;if(!e.camera||t.changes.type||t.changes.klass){var i=n.klass||{perspective:THREE.PerspectiveCamera,orthographic:THREE.OrthographicCamera}[n.type]||THREE.Camera;e.camera=n.parameters?new i(n.parameters):new i}_.each(n,function(t,r){e.camera.hasOwnProperty(r)&&(e.camera[r]=n[r])}.bind(this)),this.update(e),r===e.camera||e.trigger({type:"camera",camera:e.camera})},resize:function(t,e){this.aspect=t.viewWidth/Math.max(1,t.viewHeight),this.update(e)},update:function(t){t.camera.aspect=this.options.aspect||this.aspect,t.camera.updateProjectionMatrix()}}),THREE.Bootstrap.registerPlugin("render",{listen:["render"],render:function(t,e){e.scene&&e.camera&&e.renderer.render(e.scene,e.camera)}}),THREE.Bootstrap.registerPlugin("warmup",{defaults:{delay:2},listen:["ready","post"],ready:function(t,e){e.renderer.domElement.style.visibility="hidden",this.frame=0,this.hidden=!0},post:function(t,e){this.hidden&&this.frame>=this.options.delay&&(e.renderer.domElement.style.visibility="visible",this.hidden=!1),this.frame++}}),THREE.Stats=function(){var t=Date.now(),e=t,n=0,r=1/0,i=0,o=0,s=1/0,a=0,u=0,h=0,l=document.createElement("div");l.id="stats",l.addEventListener("mousedown",function(t){t.preventDefault(),E(++h%2)},!1),l.style.cssText="width:80px;opacity:0.9;cursor:pointer";var c=document.createElement("div");c.id="fps",c.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#002",l.appendChild(c);var p=document.createElement("div");p.id="fpsText",p.style.cssText="color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",p.innerHTML="FPS",c.appendChild(p);var f=document.createElement("div");for(f.id="fpsGraph",f.style.cssText="position:relative;width:74px;height:30px;background-color:#0ff",c.appendChild(f);74>f.children.length;){var d=document.createElement("span");d.style.cssText="width:1px;height:30px;float:left;background-color:#113",f.appendChild(d)}var m=document.createElement("div");m.id="ms",m.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#020;display:none",l.appendChild(m);var v=document.createElement("div");v.id="msText",v.style.cssText="color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",v.innerHTML="MS",m.appendChild(v);var g=document.createElement("div");for(g.id="msGraph",g.style.cssText="position:relative;width:74px;height:30px;background-color:#0f0",m.appendChild(g);74>g.children.length;)d=document.createElement("span"),d.style.cssText="width:1px;height:30px;float:left;background-color:#131",g.appendChild(d);var E=function(t){switch(h=t){case 0:c.style.display="block",m.style.display="none";break;case 1:c.style.display="none",m.style.display="block"}};return{REVISION:11,domElement:l,setMode:E,begin:function(){t=Date.now()},end:function(){var h=Date.now();n=h-t,r=Math.min(r,n),i=Math.max(i,n),v.textContent=n+" MS ("+r+"-"+i+")";var l=Math.min(30,30-30*(n/200));return g.appendChild(g.firstChild).style.height=l+"px",u++,h>e+1e3&&(o=Math.round(1e3*u/(h-e)),s=Math.min(s,o),a=Math.max(a,o),p.textContent=o+" FPS ("+s+"-"+a+")",l=Math.min(30,30-30*(o/100)),f.appendChild(f.firstChild).style.height=l+"px",e=h,u=0),h},update:function(){t=this.end()}}},THREE.DeviceOrientationControls=function(t){var e=this;this.object=t,this.object.rotation.reorder("YXZ"),this.freeze=!0,this.deviceOrientation={},this.screenOrientation=0;var n=function(t){e.deviceOrientation=t},r=function(){e.screenOrientation=window.orientation||0},i=function(){var t=new THREE.Vector3(0,0,1),e=new THREE.Euler,n=new THREE.Quaternion,r=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(i,o,s,a,u){e.set(s,o,-a,"YXZ"),i.setFromEuler(e),i.multiply(r),i.multiply(n.setFromAxisAngle(t,-u))}}();this.connect=function(){r(),window.addEventListener("orientationchange",r,!1),window.addEventListener("deviceorientation",n,!1),e.freeze=!1},this.disconnect=function(){e.freeze=!0,window.removeEventListener("orientationchange",r,!1),window.removeEventListener("deviceorientation",n,!1)},this.update=function(){if(!e.freeze){var t=e.deviceOrientation.gamma?THREE.Math.degToRad(e.deviceOrientation.alpha):0,n=e.deviceOrientation.beta?THREE.Math.degToRad(e.deviceOrientation.beta):0,r=e.deviceOrientation.gamma?THREE.Math.degToRad(e.deviceOrientation.gamma):0,o=e.screenOrientation?THREE.Math.degToRad(e.screenOrientation):0;i(e.object.quaternion,t,n,r,o)}}},THREE.FirstPersonControls=function(t,e){function n(t,e){return function(){e.apply(t,arguments)}}this.object=t,this.target=new THREE.Vector3(0,0,0),this.domElement=void 0!==e?e:document,this.movementSpeed=1,this.lookSpeed=.005,this.lookVertical=!0,this.autoForward=!1,this.activeLook=!0,this.heightSpeed=!1,this.heightCoef=1,this.heightMin=0,this.heightMax=1,this.constrainVertical=!1,this.verticalMin=0,this.verticalMax=Math.PI,this.autoSpeedFactor=0,this.mouseX=0,this.mouseY=0,this.lat=0,this.lon=0,this.phi=0,this.theta=0,this.moveForward=!1,this.moveBackward=!1,this.moveLeft=!1,this.moveRight=!1,this.freeze=!1,this.mouseDragOn=!1,this.viewHalfX=0,this.viewHalfY=0,this.domElement!==document&&this.domElement.setAttribute("tabindex",-1),this.handleResize=function(){this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2)},this.onMouseDown=function(t){if(this.domElement!==document&&this.domElement.focus(),t.preventDefault(),t.stopPropagation(),this.activeLook)switch(t.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0},this.onMouseUp=function(t){if(t.preventDefault(),t.stopPropagation(),this.activeLook)switch(t.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1},this.onMouseMove=function(t){this.domElement===document?(this.mouseX=t.pageX-this.viewHalfX,this.mouseY=t.pageY-this.viewHalfY):(this.mouseX=t.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=t.pageY-this.domElement.offsetTop-this.viewHalfY)},this.onKeyDown=function(t){switch(t.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}},this.onKeyUp=function(t){switch(t.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}},this.update=function(t){if(!this.freeze){if(this.heightSpeed){var e=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax),n=e-this.heightMin;this.autoSpeedFactor=t*(n*this.heightCoef)}else this.autoSpeedFactor=0;var r=t*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(r+this.autoSpeedFactor)),this.moveBackward&&this.object.translateZ(r),this.moveLeft&&this.object.translateX(-r),this.moveRight&&this.object.translateX(r),this.moveUp&&this.object.translateY(r),this.moveDown&&this.object.translateY(-r);var i=t*this.lookSpeed;this.activeLook||(i=0);var o=1;this.constrainVertical&&(o=Math.PI/(this.verticalMax-this.verticalMin)),this.lon+=this.mouseX*i,this.lookVertical&&(this.lat-=this.mouseY*i*o),this.lat=Math.max(-85,Math.min(85,this.lat)),this.phi=THREE.Math.degToRad(90-this.lat),this.theta=THREE.Math.degToRad(this.lon),this.constrainVertical&&(this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax));var s=this.target,a=this.object.position;s.x=a.x+100*Math.sin(this.phi)*Math.cos(this.theta),s.y=a.y+100*Math.cos(this.phi),s.z=a.z+100*Math.sin(this.phi)*Math.sin(this.theta),this.object.lookAt(s)}},this.domElement.addEventListener("contextmenu",function(t){t.preventDefault()},!1),this.domElement.addEventListener("mousemove",n(this,this.onMouseMove),!1),this.domElement.addEventListener("mousedown",n(this,this.onMouseDown),!1),this.domElement.addEventListener("mouseup",n(this,this.onMouseUp),!1),this.domElement.addEventListener("keydown",n(this,this.onKeyDown),!1),this.domElement.addEventListener("keyup",n(this,this.onKeyUp),!1),this.handleResize()},THREE.OrbitControls=function(t,e){function n(){return 2*Math.PI/60/60*p.autoRotateSpeed}function r(){return Math.pow(.95,p.zoomSpeed)}function i(t){if(p.enabled!==!1){if(t.preventDefault(),0===t.button){if(p.noRotate===!0)return;C=A.ROTATE,d.set(t.clientX,t.clientY)}else if(1===t.button){if(p.noZoom===!0)return;C=A.DOLLY,T.set(t.clientX,t.clientY)}else if(2===t.button){if(p.noPan===!0)return;C=A.PAN,g.set(t.clientX,t.clientY)}document.documentElement.addEventListener("mousemove",o,!1),document.documentElement.addEventListener("mouseup",s,!1),p.dispatchEvent(O)}}function o(t){if(p.enabled!==!1){t.preventDefault();var e=p.domElement===document?p.domElement.body:p.domElement;if(C===A.ROTATE){if(p.noRotate===!0)return;m.set(t.clientX,t.clientY),v.subVectors(m,d),p.rotateLeft(2*Math.PI*v.x/e.clientWidth*p.rotateSpeed),p.rotateUp(2*Math.PI*v.y/e.clientHeight*p.rotateSpeed),d.copy(m)}else if(C===A.DOLLY){if(p.noZoom===!0)return;x.set(t.clientX,t.clientY),w.subVectors(x,T),w.y>0?p.dollyIn():p.dollyOut(),T.copy(x)}else if(C===A.PAN){if(p.noPan===!0)return;E.set(t.clientX,t.clientY),y.subVectors(E,g),p.pan(y.x,y.y),g.copy(E)}p.update()}}function s(){p.enabled!==!1&&(document.documentElement.removeEventListener("mousemove",o,!1),document.documentElement.removeEventListener("mouseup",s,!1),p.dispatchEvent(D),C=A.NONE)}function a(t){if(p.enabled!==!1&&p.noZoom!==!0){t.preventDefault(),t.stopPropagation();var e=0;void 0!==t.wheelDelta?e=t.wheelDelta:void 0!==t.detail&&(e=-t.detail),e>0?p.dollyOut():p.dollyIn(),p.update(),p.dispatchEvent(O),p.dispatchEvent(D)}}function u(t){if(p.enabled!==!1&&p.noKeys!==!0&&p.noPan!==!0)switch(t.keyCode){case p.keys.UP:p.pan(0,p.keyPanSpeed),p.update();break;case p.keys.BOTTOM:p.pan(0,-p.keyPanSpeed),p.update();break;case p.keys.LEFT:p.pan(p.keyPanSpeed,0),p.update();break;case p.keys.RIGHT:p.pan(-p.keyPanSpeed,0),p.update()}}function h(t){if(p.enabled!==!1){switch(t.touches.length){case 1:if(p.noRotate===!0)return;C=A.TOUCH_ROTATE,d.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(p.noZoom===!0)return;C=A.TOUCH_DOLLY;var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);T.set(0,r);break;case 3:if(p.noPan===!0)return;C=A.TOUCH_PAN,g.set(t.touches[0].pageX,t.touches[0].pageY);break;default:C=A.NONE}p.dispatchEvent(O)}}function l(t){if(p.enabled!==!1){t.preventDefault(),t.stopPropagation();var e=p.domElement===document?p.domElement.body:p.domElement;switch(t.touches.length){case 1:if(p.noRotate===!0)return;if(C!==A.TOUCH_ROTATE)return;m.set(t.touches[0].pageX,t.touches[0].pageY),v.subVectors(m,d),p.rotateLeft(2*Math.PI*v.x/e.clientWidth*p.rotateSpeed),p.rotateUp(2*Math.PI*v.y/e.clientHeight*p.rotateSpeed),d.copy(m),p.update();break;case 2:if(p.noZoom===!0)return;if(C!==A.TOUCH_DOLLY)return;var n=t.touches[0].pageX-t.touches[1].pageX,r=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(n*n+r*r);x.set(0,i),w.subVectors(x,T),w.y>0?p.dollyOut():p.dollyIn(),T.copy(x),p.update();break;case 3:if(p.noPan===!0)return;if(C!==A.TOUCH_PAN)return;E.set(t.touches[0].pageX,t.touches[0].pageY),y.subVectors(E,g),p.pan(y.x,y.y),g.copy(E),p.update();break;default:C=A.NONE}}}function c(){p.enabled!==!1&&(p.dispatchEvent(D),C=A.NONE)}this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.target=new THREE.Vector3,this.center=this.target,this.noZoom=!1,this.zoomSpeed=1,this.minDistance=0,this.maxDistance=1/0,this.noRotate=!1,this.rotateSpeed=1,this.noPan=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.noKeys=!1,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};var p=this,f=1e-6,d=new THREE.Vector2,m=new THREE.Vector2,v=new THREE.Vector2,g=new THREE.Vector2,E=new THREE.Vector2,y=new THREE.Vector2,_=new THREE.Vector3,b=new THREE.Vector3,T=new THREE.Vector2,x=new THREE.Vector2,w=new THREE.Vector2,R=0,H=0,M=1,S=new THREE.Vector3,k=new THREE.Vector3,A={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},C=A.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone();var P=(new THREE.Quaternion).setFromUnitVectors(t.up,new THREE.Vector3(0,1,0)),L=P.clone().inverse(),z={type:"change"},O={type:"start"},D={type:"end"};this.rotateLeft=function(t){void 0===t&&(t=n()),H-=t},this.rotateUp=function(t){void 0===t&&(t=n()),R-=t},this.panLeft=function(t){var e=this.object.matrix.elements;_.set(e[0],e[1],e[2]),_.multiplyScalar(-t),S.add(_)},this.panUp=function(t){var e=this.object.matrix.elements;_.set(e[4],e[5],e[6]),_.multiplyScalar(t),S.add(_)},this.pan=function(t,e){var n=p.domElement===document?p.domElement.body:p.domElement;if(void 0!==p.object.fov){var r=p.object.position,i=r.clone().sub(p.target),o=i.length();o*=Math.tan(p.object.fov/2*Math.PI/180),p.panLeft(2*t*o/n.clientHeight),p.panUp(2*e*o/n.clientHeight)}else void 0!==p.object.top?(p.panLeft(t*(p.object.right-p.object.left)/n.clientWidth),p.panUp(e*(p.object.top-p.object.bottom)/n.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(t){void 0===t&&(t=r()),M/=t},this.dollyOut=function(t){void 0===t&&(t=r()),M*=t},this.update=function(){var t=this.object.position;b.copy(t).sub(this.target),b.applyQuaternion(P);var e=Math.atan2(b.x,b.z),r=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(n()),e+=H,r+=R,r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(f,Math.min(Math.PI-f,r));var i=b.length()*M;i=Math.max(this.minDistance,Math.min(this.maxDistance,i)),this.target.add(S),b.x=i*Math.sin(r)*Math.sin(e),b.y=i*Math.cos(r),b.z=i*Math.sin(r)*Math.cos(e),b.applyQuaternion(L),t.copy(this.target).add(b),this.object.lookAt(this.target),H=0,R=0,M=1,S.set(0,0,0),k.distanceToSquared(this.object.position)>f&&(this.dispatchEvent(z),k.copy(this.object.position))},this.reset=function(){C=A.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.update()},this.domElement.addEventListener("contextmenu",function(t){t.preventDefault()},!1),this.domElement.addEventListener("mousedown",i,!1),this.domElement.addEventListener("mousewheel",a,!1),this.domElement.addEventListener("DOMMouseScroll",a,!1),this.domElement.addEventListener("touchstart",h,!1),this.domElement.addEventListener("touchend",c,!1),this.domElement.addEventListener("touchmove",l,!1),window.addEventListener("keydown",u,!1),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.TrackballControls=function(t,e){function n(t){c.enabled!==!1&&(window.removeEventListener("keydown",n),v=m,m===p.NONE&&(t.keyCode!==c.keys[p.ROTATE]||c.noRotate?t.keyCode!==c.keys[p.ZOOM]||c.noZoom?t.keyCode!==c.keys[p.PAN]||c.noPan||(m=p.PAN):m=p.ZOOM:m=p.ROTATE))}function r(t){c.enabled!==!1&&(m=v,window.addEventListener("keydown",n,!1))}function i(t){c.enabled!==!1&&(t.preventDefault(),t.stopPropagation(),m===p.NONE&&(m=t.button),m!==p.ROTATE||c.noRotate?m!==p.ZOOM||c.noZoom?m!==p.PAN||c.noPan||(H.copy(C(t.pageX,t.pageY)),M.copy(H)):(T.copy(C(t.pageX,t.pageY)),x.copy(T)):(y.copy(P(t.pageX,t.pageY)),E.copy(y)),document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",s,!1),c.dispatchEvent(k))}function o(t){c.enabled!==!1&&(t.preventDefault(),t.stopPropagation(),m!==p.ROTATE||c.noRotate?m!==p.ZOOM||c.noZoom?m!==p.PAN||c.noPan||M.copy(C(t.pageX,t.pageY)):x.copy(C(t.pageX,t.pageY)):(E.copy(y),y.copy(P(t.pageX,t.pageY))))}function s(t){c.enabled!==!1&&(t.preventDefault(),t.stopPropagation(),m=p.NONE,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",s),c.dispatchEvent(A))}function a(t){if(c.enabled!==!1&&!c.noZoom){t.preventDefault(),t.stopPropagation();var e=0;t.wheelDelta?e=t.wheelDelta/40:t.detail&&(e=-t.detail/3),T.y+=.01*e,c.dispatchEvent(k),c.dispatchEvent(A)}}function u(t){if(c.enabled!==!1){switch(t.touches.length){case 1:m=p.TOUCH_ROTATE,y.copy(P(t.touches[0].pageX,t.touches[0].pageY)),E.copy(y);break;case 2:m=p.TOUCH_ZOOM_PAN;var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY;R=w=Math.sqrt(e*e+n*n);var r=(t.touches[0].pageX+t.touches[1].pageX)/2,i=(t.touches[0].pageY+t.touches[1].pageY)/2;H.copy(C(r,i)),M.copy(H);break;default:m=p.NONE}c.dispatchEvent(k)}}function h(t){if(c.enabled!==!1)switch(t.preventDefault(),t.stopPropagation(),t.touches.length){case 1:E.copy(y),y.copy(P(t.touches[0].pageX,t.touches[0].pageY));break;case 2:var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY;R=Math.sqrt(e*e+n*n);var r=(t.touches[0].pageX+t.touches[1].pageX)/2,i=(t.touches[0].pageY+t.touches[1].pageY)/2;M.copy(C(r,i));break;default:m=p.NONE}}function l(t){if(c.enabled!==!1){switch(t.touches.length){case 1:E.copy(y),y.copy(P(t.touches[0].pageX,t.touches[0].pageY));break;case 2:w=R=0;var e=(t.touches[0].pageX+t.touches[1].pageX)/2,n=(t.touches[0].pageY+t.touches[1].pageY)/2;M.copy(C(e,n)),H.copy(M)}m=p.NONE,c.dispatchEvent(A)}}var c=this,p={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new THREE.Vector3;var f=1e-6,d=new THREE.Vector3,m=p.NONE,v=p.NONE,g=new THREE.Vector3,E=new THREE.Vector2,y=new THREE.Vector2,_=new THREE.Vector3,b=0,T=new THREE.Vector2,x=new THREE.Vector2,w=0,R=0,H=new THREE.Vector2,M=new THREE.Vector2;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var S={type:"change"},k={type:"start"},A={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var t=this.domElement.getBoundingClientRect(),e=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-e.clientLeft,this.screen.top=t.top+window.pageYOffset-e.clientTop,this.screen.width=t.width,this.screen.height=t.height}},this.handleEvent=function(t){"function"==typeof this[t.type]&&this[t.type](t)};var C=function(){var t=new THREE.Vector2;return function(e,n){return t.set((e-c.screen.left)/c.screen.width,(n-c.screen.top)/c.screen.height),t}}(),P=function(){var t=new THREE.Vector2;return function(e,n){return t.set((e-.5*c.screen.width-c.screen.left)/(.5*c.screen.width),(c.screen.height+2*(c.screen.top-n))/c.screen.width),t}}();this.rotateCamera=function(){var t,e=new THREE.Vector3,n=new THREE.Quaternion,r=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Vector3;return function(){s.set(y.x-E.x,y.y-E.y,0),t=s.length(),t?(g.copy(c.object.position).sub(c.target),r.copy(g).normalize(),i.copy(c.object.up).normalize(),o.crossVectors(i,r).normalize(),i.setLength(y.y-E.y),o.setLength(y.x-E.x),s.copy(i.add(o)),e.crossVectors(s,g).normalize(),t*=c.rotateSpeed,n.setFromAxisAngle(e,t),g.applyQuaternion(n),c.object.up.applyQuaternion(n),_.copy(e),b=t):!c.staticMoving&&b&&(b*=Math.sqrt(1-c.dynamicDampingFactor),g.copy(c.object.position).sub(c.target),n.setFromAxisAngle(_,b),g.applyQuaternion(n),c.object.up.applyQuaternion(n)),E.copy(y)}}(),this.zoomCamera=function(){var t;m===p.TOUCH_ZOOM_PAN?(t=w/R,w=R,g.multiplyScalar(t)):(t=1+(x.y-T.y)*c.zoomSpeed,1!==t&&t>0&&(g.multiplyScalar(t),c.staticMoving?T.copy(x):T.y+=(x.y-T.y)*this.dynamicDampingFactor))},this.panCamera=function(){var t=new THREE.Vector2,e=new THREE.Vector3,n=new THREE.Vector3;return function(){t.copy(M).sub(H),t.lengthSq()&&(t.multiplyScalar(g.length()*c.panSpeed),n.copy(g).cross(c.object.up).setLength(t.x), +n.add(e.copy(c.object.up).setLength(t.y)),c.object.position.add(n),c.target.add(n),c.staticMoving?H.copy(M):H.add(t.subVectors(M,H).multiplyScalar(c.dynamicDampingFactor)))}}(),this.checkDistances=function(){c.noZoom&&c.noPan||(g.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.addVectors(c.target,g.setLength(c.maxDistance)),g.lengthSq()f&&(c.dispatchEvent(S),d.copy(c.object.position))},this.reset=function(){m=p.NONE,v=p.NONE,c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.up.copy(c.up0),g.subVectors(c.object.position,c.target),c.object.lookAt(c.target),c.dispatchEvent(S),d.copy(c.object.position)},this.domElement.addEventListener("contextmenu",function(t){t.preventDefault()},!1),this.domElement.addEventListener("mousedown",i,!1),this.domElement.addEventListener("mousewheel",a,!1),this.domElement.addEventListener("DOMMouseScroll",a,!1),this.domElement.addEventListener("touchstart",u,!1),this.domElement.addEventListener("touchend",l,!1),this.domElement.addEventListener("touchmove",h,!1),window.addEventListener("keydown",n,!1),window.addEventListener("keyup",r,!1),this.handleResize(),this.update()},THREE.TrackballControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.TrackballControls.prototype.constructor=THREE.TrackballControls,THREE.VRControls=function(t,e){var n=1e-5,r=this.dummy=new THREE.Object3D;this.object=t,this.device=new THREE.DeviceOrientationControls(r,e),this.orbit=new THREE.OrbitControls(r,e),this.orbit.target.copy(t.position),this.orbit.target.z+=n,this.orbit.rotateSpeed=-.25,this.supported=!1;var i=function(t){this.supported=t&&t.alpha==+t.alpha,window.removeEventListener("deviceorientation",i,!1)}.bind(this);window.addEventListener("deviceorientation",i,!1)},THREE.VRControls.prototype.vr=function(t){this.vrstate=t},THREE.VRControls.prototype.update=function(t){var e=!1;this.vrstate&&this.vrstate.orientation?(e=!0,this.object.quaternion.copy(this.vrstate.orientation),this.object.position.copy(this.vrstate.position),this.device.object=this.dummy,this.orbit.object=this.dummy):this.vrstate&&this.supported?(this.device.freeze&&this.device.connect(),this.device.object=this.object,this.orbit.object=this.dummy,this.device.update(t)):(e=!0,this.device.object=this.dummy,this.orbit.object=this.object,this.orbit.update(t)),e&&!this.device.freeze&&this.device.disconnect()},THREE.Bootstrap.registerPlugin("stats",{listen:["pre","post"],install:function(t){var e=this.stats=new THREE.Stats,n=e.domElement.style;n.position="absolute",n.top=n.left=0,t.element.appendChild(e.domElement),t.stats=e},uninstall:function(t){document.body.removeChild(this.stats.domElement),delete t.stats},pre:function(t,e){this.stats.begin()},post:function(t,e){this.stats.end()}}),THREE.Bootstrap.registerPlugin("controls",{listen:["update","resize","camera","this.change"],defaults:{klass:null,parameters:{}},install:function(t){if(!this.options.klass)throw"Must provide class for `controls.klass`";t.controls=null,this._camera=t.camera||new THREE.PerspectiveCamera,this.change(null,t)},uninstall:function(t){delete t.controls},change:function(t,e){this.options.klass?((!t||t.changes.klass)&&(e.controls=new this.options.klass(this._camera,e.renderer.domElement)),_.extend(e.controls,this.options.parameters)):e.controls=null},update:function(t,e){var n=e.Time&&e.Time.delta||1/60,r=e.VR&&e.VR.state;e.controls.vr&&e.controls.vr(r),e.controls.update(n)},camera:function(t,e){e.controls.object=this._camera=t.camera},resize:function(t,e){e.controls.handleResize&&e.controls.handleResize()}}),THREE.Bootstrap.registerPlugin("cursor",{listen:["update","this.change","install:change","uninstall:change","element.mousemove","vr"],defaults:{cursor:null,hide:!1,timeout:3},install:function(t){this.timeout=this.options.timeout,this.element=t.element,this.change(null,t)},uninstall:function(t){delete t.controls},change:function(t,e){this.applyCursor(e)},mousemove:function(t,e){this.options.hide&&(this.applyCursor(e),this.timeout=+this.options.timeout||0)},update:function(t,e){var n=e.Time&&e.Time.delta||1/60;this.options.hide&&(this.timeout-=n,this.timeout<0&&this.applyCursor(e,"none"))},vr:function(t,e){this.hide=t.active&&!t.hmd.fake,this.applyCursor(e)},applyCursor:function(t,e){var n=t.controls?"move":"";e=e||this.options.cursor||n,this.hide&&(e="none"),this.cursor!=e&&(this.element.style.cursor=e)}}),THREE.Bootstrap.registerPlugin("fullscreen",{defaults:{key:"f"},listen:["ready","update"],install:function(t){t.Fullscreen=this.api({active:!1,toggle:this.toggle.bind(this)},t)},uninstall:function(t){delete t.Fullscreen},ready:function(t,e){document.body.addEventListener("keypress",function(t){this.options.key&&t.charCode==this.options.key.charCodeAt(0)&&this.toggle(e)}.bind(this));var n=function(){var t=!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement);e.Fullscreen.active=this.active=t,e.trigger({type:"fullscreen",active:t})}.bind(this);document.addEventListener("fullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1)},toggle:function(t){var e=t.canvas,n=t.VR&&t.VR.active?{vrDisplay:t.VR.hmd}:{};this.active?document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen&&document.mozCancelFullScreen():e.requestFullScreen?e.requestFullScreen(n):e.msRequestFullScreen?e.msRequestFullscreen(n):e.webkitRequestFullscreen?e.webkitRequestFullscreen(n):e.mozRequestFullScreen&&e.mozRequestFullScreen(n)}}),THREE.Bootstrap.registerPlugin("vr",{defaults:{mode:"auto",device:null,fov:80},listen:["window.load","pre","render","resize","this.change"],install:function(t){t.VR=this.api({active:!1,devices:[],hmd:null,sensor:null,renderer:null,state:null},t)},uninstall:function(t){delete t.VR},mocks:function(t,e,n){var r=.03,i=function(t){return{left:{x:-r,y:0,z:0},right:{x:r,y:0,z:0}}[t]},o=function(r){var i=t.camera,o=i&&i.aspect||16/9,s=(e||i&&i.fov||n)/2,a=180*Math.atan(Math.tan(s*Math.PI/180)*o/2)/Math.PI,u=s;return{left:{rightDegrees:a,leftDegrees:a,downDegrees:u,upDegrees:u},right:{rightDegrees:a,leftDegrees:a,downDegrees:u,upDegrees:u}}[r]},s=function(){return{}};return[{fake:!0,force:1,deviceId:"emu",deviceName:"Emulated",getEyeTranslation:i,getRecommendedEyeFieldOfView:o},{force:2,getState:s}]},load:function(t,e){var n=function(t){this.callback(t,e)}.bind(this);navigator.getVRDevices?navigator.getVRDevices().then(n):navigator.mozGetVRDevices?navigator.mozGetVRDevices(n):(console.warn("No native VR support detected."),n(this.mocks(e,this.options.fov,this.defaults.fov),e))},callback:function(t,e){var n,r,i=window.HMDVRDevice||function(){},o=window.PositionSensorVRDevice||function(){};t=e.VR.devices=t||e.VR.devices;for(var s=this.options.device,a=0;a'),t.VR&&i.push(''),'
'+i.join("\n")+"
"},install:function(t){var e=this.ui=document.createElement("div");e.innerHTML=this.markup(t,this.options.theme,this.options.style),document.body.appendChild(e);var n=this.ui.fullscreen=e.querySelector("button.fullscreen");n&&t.bind([n,"click:goFullscreen"],this);var r=this.ui.vr=e.querySelector("button.vr");r&&t.VR&&(t.VR.set({mode:"2d"}),t.bind([r,"click:goVR"],this))},uninstall:function(t){document.body.removeChild(ui)},fullscreen:function(t,e){this.ui.style.display=t.active?"none":"block",t.active||e.VR&&e.VR.set({mode:"2d"})},goFullscreen:function(t,e){e.Fullscreen&&e.Fullscreen.toggle()},goVR:function(t,e){e.VR&&(e.VR.set({mode:"auto"}),e.Fullscreen.toggle())},uninstall:function(t){document.body.removeChild(this.ui)}}),THREE.VRRenderer=function(t,e){var n=this;n.initialize=function(){var t=e.getEyeTranslation("left");n.halfIPD=new THREE.Vector3(t.x,t.y,t.z).length(),n.fovLeft=e.getRecommendedEyeFieldOfView("left"),n.fovRight=e.getRecommendedEyeFieldOfView("right")},n.FovToNDCScaleOffset=function(t){var e=2/(t.leftTan+t.rightTan),n=(t.leftTan-t.rightTan)*e*.5,r=2/(t.upTan+t.downTan),i=(t.upTan-t.downTan)*r*.5;return{scale:[e,r],offset:[n,i]}},n.FovPortToProjection=function(t,e,r,i,o){r=void 0===r?!0:r,i=void 0===i?.01:i,o=void 0===o?1e4:o;var s=r?-1:1,a=t.elements,u=n.FovToNDCScaleOffset(e);a[0]=u.scale[0],a[1]=0,a[2]=u.offset[0]*s,a[3]=0,a[4]=0,a[5]=u.scale[1],a[6]=-u.offset[1]*s,a[7]=0,a[8]=0,a[9]=0,a[10]=o/(i-o)*-s,a[11]=o*i/(i-o),a[12]=0,a[13]=0,a[14]=s,a[15]=0,t.transpose()},n.FovToProjection=function(t,e,r,i,o){var s={upTan:Math.tan(e.upDegrees*Math.PI/180),downTan:Math.tan(e.downDegrees*Math.PI/180),leftTan:Math.tan(e.leftDegrees*Math.PI/180),rightTan:Math.tan(e.rightDegrees*Math.PI/180)};return n.FovPortToProjection(t,s,r,i,o)};var r=new THREE.Vector3,i=new THREE.PerspectiveCamera,o=new THREE.PerspectiveCamera;n.render=function(e,s){n.FovToProjection(i.projectionMatrix,n.fovLeft,!0,s.near,s.far),n.FovToProjection(o.projectionMatrix,n.fovRight,!0,s.near,s.far),r.set(n.halfIPD,0,0),r.applyQuaternion(s.quaternion),i.position.copy(s.position).sub(r),o.position.copy(s.position).add(r),i.quaternion.copy(s.quaternion),o.quaternion.copy(s.quaternion);var a=t.devicePixelRatio||1,u=t.domElement.width/2/a,h=t.domElement.height/a;t.enableScissorTest(!0),t.setViewport(0,0,u,h),t.setScissor(0,0,u,h),t.render(e,i),t.setViewport(u,0,u,h),t.setScissor(u,0,u,h),t.render(e,o)},n.initialize()},THREE.VRControls=function(t,e){var n=1e-5,r=this.dummy=new THREE.Object3D;this.object=t,this.device=new THREE.DeviceOrientationControls(r,e),this.orbit=new THREE.OrbitControls(r,e),this.orbit.target.copy(t.position),this.orbit.target.z+=n,this.orbit.rotateSpeed=-.25,this.supported=!1;var i=function(t){this.supported=t&&t.alpha==+t.alpha,window.removeEventListener("deviceorientation",i,!1)}.bind(this);window.addEventListener("deviceorientation",i,!1)},THREE.VRControls.prototype.vr=function(t){this.vrstate=t},THREE.VRControls.prototype.update=function(t){var e=!1;this.vrstate&&this.vrstate.orientation?(e=!0,this.object.quaternion.copy(this.vrstate.orientation),this.object.position.copy(this.vrstate.position),this.device.object=this.dummy,this.orbit.object=this.dummy):this.vrstate&&this.supported?(this.device.freeze&&this.device.connect(),this.device.object=this.object,this.orbit.object=this.dummy,this.device.update(t)):(e=!0,this.device.object=this.dummy,this.orbit.object=this.object,this.orbit.update(t)),e&&!this.device.freeze&&this.device.disconnect()},THREE.OrbitControls=function(t,e){function n(){return 2*Math.PI/60/60*p.autoRotateSpeed}function r(){return Math.pow(.95,p.zoomSpeed)}function i(t){if(p.enabled!==!1){if(t.preventDefault(),0===t.button){if(p.noRotate===!0)return;C=A.ROTATE,d.set(t.clientX,t.clientY)}else if(1===t.button){if(p.noZoom===!0)return;C=A.DOLLY,T.set(t.clientX,t.clientY)}else if(2===t.button){if(p.noPan===!0)return;C=A.PAN,g.set(t.clientX,t.clientY)}document.documentElement.addEventListener("mousemove",o,!1),document.documentElement.addEventListener("mouseup",s,!1),p.dispatchEvent(O)}}function o(t){if(p.enabled!==!1){t.preventDefault();var e=p.domElement===document?p.domElement.body:p.domElement;if(C===A.ROTATE){if(p.noRotate===!0)return;m.set(t.clientX,t.clientY),v.subVectors(m,d),p.rotateLeft(2*Math.PI*v.x/e.clientWidth*p.rotateSpeed),p.rotateUp(2*Math.PI*v.y/e.clientHeight*p.rotateSpeed),d.copy(m)}else if(C===A.DOLLY){if(p.noZoom===!0)return;x.set(t.clientX,t.clientY),w.subVectors(x,T),w.y>0?p.dollyIn():p.dollyOut(),T.copy(x)}else if(C===A.PAN){if(p.noPan===!0)return;E.set(t.clientX,t.clientY),y.subVectors(E,g),p.pan(y.x,y.y),g.copy(E)}p.update()}}function s(){p.enabled!==!1&&(document.documentElement.removeEventListener("mousemove",o,!1),document.documentElement.removeEventListener("mouseup",s,!1),p.dispatchEvent(D),C=A.NONE)}function a(t){if(p.enabled!==!1&&p.noZoom!==!0){t.preventDefault(),t.stopPropagation();var e=0;void 0!==t.wheelDelta?e=t.wheelDelta:void 0!==t.detail&&(e=-t.detail),e>0?p.dollyOut():p.dollyIn(),p.update(),p.dispatchEvent(O),p.dispatchEvent(D)}}function u(t){if(p.enabled!==!1&&p.noKeys!==!0&&p.noPan!==!0)switch(t.keyCode){case p.keys.UP:p.pan(0,p.keyPanSpeed),p.update();break;case p.keys.BOTTOM:p.pan(0,-p.keyPanSpeed),p.update();break;case p.keys.LEFT:p.pan(p.keyPanSpeed,0),p.update();break;case p.keys.RIGHT:p.pan(-p.keyPanSpeed,0),p.update()}}function h(t){if(p.enabled!==!1){switch(t.touches.length){case 1:if(p.noRotate===!0)return;C=A.TOUCH_ROTATE,d.set(t.touches[0].pageX,t.touches[0].pageY);break;case 2:if(p.noZoom===!0)return;C=A.TOUCH_DOLLY;var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);T.set(0,r);break;case 3:if(p.noPan===!0)return;C=A.TOUCH_PAN,g.set(t.touches[0].pageX,t.touches[0].pageY);break;default:C=A.NONE}p.dispatchEvent(O)}}function l(t){if(p.enabled!==!1){t.preventDefault(),t.stopPropagation();var e=p.domElement===document?p.domElement.body:p.domElement;switch(t.touches.length){case 1:if(p.noRotate===!0)return;if(C!==A.TOUCH_ROTATE)return;m.set(t.touches[0].pageX,t.touches[0].pageY),v.subVectors(m,d),p.rotateLeft(2*Math.PI*v.x/e.clientWidth*p.rotateSpeed),p.rotateUp(2*Math.PI*v.y/e.clientHeight*p.rotateSpeed),d.copy(m),p.update();break;case 2:if(p.noZoom===!0)return;if(C!==A.TOUCH_DOLLY)return;var n=t.touches[0].pageX-t.touches[1].pageX,r=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(n*n+r*r);x.set(0,i),w.subVectors(x,T),w.y>0?p.dollyOut():p.dollyIn(),T.copy(x),p.update();break;case 3:if(p.noPan===!0)return;if(C!==A.TOUCH_PAN)return;E.set(t.touches[0].pageX,t.touches[0].pageY),y.subVectors(E,g),p.pan(y.x,y.y),g.copy(E),p.update();break;default:C=A.NONE}}}function c(){p.enabled!==!1&&(p.dispatchEvent(D),C=A.NONE)}this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.target=new THREE.Vector3,this.center=this.target,this.noZoom=!1,this.zoomSpeed=1,this.minDistance=0,this.maxDistance=1/0,this.noRotate=!1,this.rotateSpeed=1,this.noPan=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.noKeys=!1,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};var p=this,f=1e-6,d=new THREE.Vector2,m=new THREE.Vector2,v=new THREE.Vector2,g=new THREE.Vector2,E=new THREE.Vector2,y=new THREE.Vector2,_=new THREE.Vector3,b=new THREE.Vector3,T=new THREE.Vector2,x=new THREE.Vector2,w=new THREE.Vector2,R=0,H=0,M=1,S=new THREE.Vector3,k=new THREE.Vector3,A={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},C=A.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone();var P=(new THREE.Quaternion).setFromUnitVectors(t.up,new THREE.Vector3(0,1,0)),L=P.clone().inverse(),z={type:"change"},O={type:"start"},D={type:"end"};this.rotateLeft=function(t){void 0===t&&(t=n()),H-=t},this.rotateUp=function(t){void 0===t&&(t=n()),R-=t},this.panLeft=function(t){var e=this.object.matrix.elements;_.set(e[0],e[1],e[2]),_.multiplyScalar(-t),S.add(_)},this.panUp=function(t){var e=this.object.matrix.elements;_.set(e[4],e[5],e[6]),_.multiplyScalar(t),S.add(_)},this.pan=function(t,e){var n=p.domElement===document?p.domElement.body:p.domElement;if(void 0!==p.object.fov){var r=p.object.position,i=r.clone().sub(p.target),o=i.length();o*=Math.tan(p.object.fov/2*Math.PI/180),p.panLeft(2*t*o/n.clientHeight),p.panUp(2*e*o/n.clientHeight)}else void 0!==p.object.top?(p.panLeft(t*(p.object.right-p.object.left)/n.clientWidth),p.panUp(e*(p.object.top-p.object.bottom)/n.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(t){void 0===t&&(t=r()),M/=t},this.dollyOut=function(t){void 0===t&&(t=r()),M*=t},this.update=function(){var t=this.object.position;b.copy(t).sub(this.target),b.applyQuaternion(P);var e=Math.atan2(b.x,b.z),r=Math.atan2(Math.sqrt(b.x*b.x+b.z*b.z),b.y);this.autoRotate&&this.rotateLeft(n()),e+=H,r+=R,r=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,r)),r=Math.max(f,Math.min(Math.PI-f,r));var i=b.length()*M;i=Math.max(this.minDistance,Math.min(this.maxDistance,i)),this.target.add(S),b.x=i*Math.sin(r)*Math.sin(e),b.y=i*Math.cos(r),b.z=i*Math.sin(r)*Math.cos(e),b.applyQuaternion(L),t.copy(this.target).add(b),this.object.lookAt(this.target),H=0,R=0,M=1,S.set(0,0,0),k.distanceToSquared(this.object.position)>f&&(this.dispatchEvent(z),k.copy(this.object.position))},this.reset=function(){C=A.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.update()},this.domElement.addEventListener("contextmenu",function(t){t.preventDefault()},!1),this.domElement.addEventListener("mousedown",i,!1),this.domElement.addEventListener("mousewheel",a,!1),this.domElement.addEventListener("DOMMouseScroll",a,!1),this.domElement.addEventListener("touchstart",h,!1),this.domElement.addEventListener("touchend",c,!1),this.domElement.addEventListener("touchmove",l,!1),window.addEventListener("keydown",u,!1),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.DeviceOrientationControls=function(t){var e=this;this.object=t,this.object.rotation.reorder("YXZ"),this.freeze=!0,this.deviceOrientation={},this.screenOrientation=0;var n=function(t){e.deviceOrientation=t},r=function(){e.screenOrientation=window.orientation||0},i=function(){var t=new THREE.Vector3(0,0,1),e=new THREE.Euler,n=new THREE.Quaternion,r=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(i,o,s,a,u){e.set(s,o,-a,"YXZ"),i.setFromEuler(e),i.multiply(r),i.multiply(n.setFromAxisAngle(t,-u))}}();this.connect=function(){r(),window.addEventListener("orientationchange",r,!1),window.addEventListener("deviceorientation",n,!1),e.freeze=!1},this.disconnect=function(){e.freeze=!0,window.removeEventListener("orientationchange",r,!1),window.removeEventListener("deviceorientation",n,!1)},this.update=function(){if(!e.freeze){var t=e.deviceOrientation.gamma?THREE.Math.degToRad(e.deviceOrientation.alpha):0,n=e.deviceOrientation.beta?THREE.Math.degToRad(e.deviceOrientation.beta):0,r=e.deviceOrientation.gamma?THREE.Math.degToRad(e.deviceOrientation.gamma):0,o=e.screenOrientation?THREE.Math.degToRad(e.screenOrientation):0;i(e.object.quaternion,t,n,r,o)}}},THREE.TrackballControls=function(t,e){function n(t){c.enabled!==!1&&(window.removeEventListener("keydown",n),v=m,m===p.NONE&&(t.keyCode!==c.keys[p.ROTATE]||c.noRotate?t.keyCode!==c.keys[p.ZOOM]||c.noZoom?t.keyCode!==c.keys[p.PAN]||c.noPan||(m=p.PAN):m=p.ZOOM:m=p.ROTATE))}function r(t){c.enabled!==!1&&(m=v,window.addEventListener("keydown",n,!1))}function i(t){c.enabled!==!1&&(t.preventDefault(),t.stopPropagation(),m===p.NONE&&(m=t.button),m!==p.ROTATE||c.noRotate?m!==p.ZOOM||c.noZoom?m!==p.PAN||c.noPan||(H.copy(C(t.pageX,t.pageY)),M.copy(H)):(T.copy(C(t.pageX,t.pageY)),x.copy(T)):(y.copy(P(t.pageX,t.pageY)),E.copy(y)),document.addEventListener("mousemove",o,!1),document.addEventListener("mouseup",s,!1),c.dispatchEvent(k))}function o(t){c.enabled!==!1&&(t.preventDefault(),t.stopPropagation(),m!==p.ROTATE||c.noRotate?m!==p.ZOOM||c.noZoom?m!==p.PAN||c.noPan||M.copy(C(t.pageX,t.pageY)):x.copy(C(t.pageX,t.pageY)):(E.copy(y),y.copy(P(t.pageX,t.pageY))))}function s(t){c.enabled!==!1&&(t.preventDefault(),t.stopPropagation(),m=p.NONE,document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",s),c.dispatchEvent(A))}function a(t){if(c.enabled!==!1&&!c.noZoom){t.preventDefault(),t.stopPropagation();var e=0;t.wheelDelta?e=t.wheelDelta/40:t.detail&&(e=-t.detail/3),T.y+=.01*e,c.dispatchEvent(k),c.dispatchEvent(A)}}function u(t){if(c.enabled!==!1){switch(t.touches.length){case 1:m=p.TOUCH_ROTATE,y.copy(P(t.touches[0].pageX,t.touches[0].pageY)),E.copy(y);break;case 2:m=p.TOUCH_ZOOM_PAN;var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY;R=w=Math.sqrt(e*e+n*n);var r=(t.touches[0].pageX+t.touches[1].pageX)/2,i=(t.touches[0].pageY+t.touches[1].pageY)/2;H.copy(C(r,i)),M.copy(H);break;default:m=p.NONE}c.dispatchEvent(k)}}function h(t){if(c.enabled!==!1)switch(t.preventDefault(),t.stopPropagation(),t.touches.length){case 1:E.copy(y),y.copy(P(t.touches[0].pageX,t.touches[0].pageY));break;case 2:var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY;R=Math.sqrt(e*e+n*n);var r=(t.touches[0].pageX+t.touches[1].pageX)/2,i=(t.touches[0].pageY+t.touches[1].pageY)/2;M.copy(C(r,i));break;default:m=p.NONE}}function l(t){if(c.enabled!==!1){switch(t.touches.length){case 1:E.copy(y),y.copy(P(t.touches[0].pageX,t.touches[0].pageY));break;case 2:w=R=0;var e=(t.touches[0].pageX+t.touches[1].pageX)/2,n=(t.touches[0].pageY+t.touches[1].pageY)/2;M.copy(C(e,n)),H.copy(M)}m=p.NONE,c.dispatchEvent(A)}}var c=this,p={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new THREE.Vector3;var f=1e-6,d=new THREE.Vector3,m=p.NONE,v=p.NONE,g=new THREE.Vector3,E=new THREE.Vector2,y=new THREE.Vector2,_=new THREE.Vector3,b=0,T=new THREE.Vector2,x=new THREE.Vector2,w=0,R=0,H=new THREE.Vector2,M=new THREE.Vector2;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone();var S={type:"change"},k={type:"start"},A={type:"end"};this.handleResize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var t=this.domElement.getBoundingClientRect(),e=this.domElement.ownerDocument.documentElement;this.screen.left=t.left+window.pageXOffset-e.clientLeft,this.screen.top=t.top+window.pageYOffset-e.clientTop,this.screen.width=t.width,this.screen.height=t.height}},this.handleEvent=function(t){"function"==typeof this[t.type]&&this[t.type](t)};var C=function(){var t=new THREE.Vector2;return function(e,n){return t.set((e-c.screen.left)/c.screen.width,(n-c.screen.top)/c.screen.height),t}}(),P=function(){var t=new THREE.Vector2;return function(e,n){return t.set((e-.5*c.screen.width-c.screen.left)/(.5*c.screen.width),(c.screen.height+2*(c.screen.top-n))/c.screen.width),t}}();this.rotateCamera=function(){var t,e=new THREE.Vector3,n=new THREE.Quaternion,r=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Vector3;return function(){s.set(y.x-E.x,y.y-E.y,0),t=s.length(),t?(g.copy(c.object.position).sub(c.target),r.copy(g).normalize(),i.copy(c.object.up).normalize(),o.crossVectors(i,r).normalize(),i.setLength(y.y-E.y),o.setLength(y.x-E.x),s.copy(i.add(o)),e.crossVectors(s,g).normalize(),t*=c.rotateSpeed,n.setFromAxisAngle(e,t),g.applyQuaternion(n),c.object.up.applyQuaternion(n),_.copy(e),b=t):!c.staticMoving&&b&&(b*=Math.sqrt(1-c.dynamicDampingFactor),g.copy(c.object.position).sub(c.target),n.setFromAxisAngle(_,b),g.applyQuaternion(n),c.object.up.applyQuaternion(n)),E.copy(y)}}(),this.zoomCamera=function(){var t;m===p.TOUCH_ZOOM_PAN?(t=w/R,w=R,g.multiplyScalar(t)):(t=1+(x.y-T.y)*c.zoomSpeed,1!==t&&t>0&&(g.multiplyScalar(t),c.staticMoving?T.copy(x):T.y+=(x.y-T.y)*this.dynamicDampingFactor))},this.panCamera=function(){var t=new THREE.Vector2,e=new THREE.Vector3,n=new THREE.Vector3;return function(){t.copy(M).sub(H),t.lengthSq()&&(t.multiplyScalar(g.length()*c.panSpeed),n.copy(g).cross(c.object.up).setLength(t.x),n.add(e.copy(c.object.up).setLength(t.y)),c.object.position.add(n),c.target.add(n),c.staticMoving?H.copy(M):H.add(t.subVectors(M,H).multiplyScalar(c.dynamicDampingFactor)))}}(),this.checkDistances=function(){c.noZoom&&c.noPan||(g.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.addVectors(c.target,g.setLength(c.maxDistance)),g.lengthSq()f&&(c.dispatchEvent(S),d.copy(c.object.position))},this.reset=function(){m=p.NONE,v=p.NONE,c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.up.copy(c.up0),g.subVectors(c.object.position,c.target),c.object.lookAt(c.target),c.dispatchEvent(S),d.copy(c.object.position)},this.domElement.addEventListener("contextmenu",function(t){t.preventDefault()},!1),this.domElement.addEventListener("mousedown",i,!1),this.domElement.addEventListener("mousewheel",a,!1),this.domElement.addEventListener("DOMMouseScroll",a,!1),this.domElement.addEventListener("touchstart",u,!1),this.domElement.addEventListener("touchend",l,!1),this.domElement.addEventListener("touchmove",h,!1),window.addEventListener("keydown",n,!1),window.addEventListener("keyup",r,!1),this.handleResize(),this.update()},THREE.TrackballControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.TrackballControls.prototype.constructor=THREE.TrackballControls,function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var h=n[s]={exports:{}};e[s][0].call(h.exports,function(t){var n=e[s][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s 0.0 ? 0.0 : 1.0; \n val = abs(val); \n float exponent = floor(log2(val)); \n float biased_exponent = exponent + 127.0; \n float fraction = ((val / exp2(exponent)) - 1.0) * 8388608.0; \n float t = biased_exponent / 2.0; \n float last_bit_of_biased_exponent = fract(t) * 2.0; \n float remaining_bits_of_biased_exponent = floor(t); \n float byte4 = extract_bits(fraction, 0.0, 8.0) / 255.0; \n float byte3 = extract_bits(fraction, 8.0, 16.0) / 255.0; \n float byte2 = (last_bit_of_biased_exponent * 128.0 + extract_bits(fraction, 16.0, 23.0)) / 255.0; \n float byte1 = (valuesign * 128.0 + remaining_bits_of_biased_exponent) / 255.0; \n return vec4(byte4, byte3, byte2, byte1); \n}\n","float.index.pack":"uniform vec4 indexModulus;\n\nvec4 getSample(vec4 xyzw);\nvec4 getIndex(vec4 xyzw);\n\nvec4 floatPackIndex(vec4 xyzw) {\n vec4 value = getSample(xyzw);\n vec4 index = getIndex(xyzw);\n\n vec4 offset = floor(index + .5) * indexModulus;\n vec2 sum2 = offset.xy + offset.zw;\n float sum = sum2.x + sum2.y;\n return vec4(value.xyz, sum);\n}","float.stretch":"vec4 getSample(vec4 xyzw);\n\nfloat floatStretch(vec4 xyzw, float channelIndex) {\n vec4 sample = getSample(xyzw);\n vec2 xy = channelIndex > 1.5 ? sample.zw : sample.xy;\n return mod(channelIndex, 2.0) > .5 ? xy.y : xy.x;\n}","fragment.clip.dashed":"varying float vClipStrokeWidth;\nvarying float vClipStrokeIndex;\nvarying vec3 vClipStrokeEven;\nvarying vec3 vClipStrokeOdd;\nvarying vec3 vClipStrokePosition;\n\nvoid clipStrokeFragment() {\n bool odd = mod(vClipStrokeIndex, 2.0) >= 1.0;\n\n vec3 tangent;\n if (odd) {\n tangent = vClipStrokeOdd;\n }\n else {\n tangent = vClipStrokeEven;\n }\n\n float travel = dot(vClipStrokePosition, normalize(tangent)) / vClipStrokeWidth;\n if (mod(travel, 16.0) > 8.0) {\n discard;\n }\n}\n","fragment.clip.dotted":"varying float vClipStrokeWidth;\nvarying float vClipStrokeIndex;\nvarying vec3 vClipStrokeEven;\nvarying vec3 vClipStrokeOdd;\nvarying vec3 vClipStrokePosition;\n\nvoid clipStrokeFragment() {\n bool odd = mod(vClipStrokeIndex, 2.0) >= 1.0;\n\n vec3 tangent;\n if (odd) {\n tangent = vClipStrokeOdd;\n }\n else {\n tangent = vClipStrokeEven;\n }\n\n float travel = dot(vClipStrokePosition, normalize(tangent)) / vClipStrokeWidth;\n if (mod(travel, 4.0) > 2.0) {\n discard;\n }\n}\n","fragment.clip.ends":"varying vec2 vClipEnds;\n\nvoid clipEndsFragment() {\n if (vClipEnds.x < 0.0 || vClipEnds.y < 0.0) discard;\n}\n","fragment.clip.proximity":"varying float vClipProximity;\n\nvoid clipProximityFragment() {\n if (vClipProximity >= 0.5) discard;\n}","fragment.color":"void setFragmentColor(vec4 color) {\n gl_FragColor = color;\n}","fragment.map.rgba":"vec4 fragmentRGBA(vec4 rgba, vec4 stpq) {\n return rgba;\n}","fragment.solid":"void setFragmentColor(vec4 color) {\n if (color.a < 1.0) discard;\n gl_FragColor = color;\n}","fragment.transparent":"void setFragmentColor(vec4 color) {\n if (color.a >= 1.0) discard;\n gl_FragColor = color;\n}","grid.position":"uniform vec4 gridPosition;\nuniform vec4 gridStep;\nuniform vec4 gridAxis;\n\nvec4 sampleData(vec2 xy);\n\nvec4 getGridPosition(vec4 xyzw) {\n vec4 onAxis = gridAxis * sampleData(vec2(xyzw.y, 0.0)).x;\n vec4 offAxis = gridStep * xyzw.x + gridPosition;\n return onAxis + offAxis;\n}\n","grow.position":"uniform float growScale;\nuniform vec4 growMask;\nuniform vec4 growAnchor;\n\nvec4 getSample(vec4 xyzw);\n\nvec4 getGrowSample(vec4 xyzw) {\n vec4 anchor = xyzw * growMask + growAnchor;\n\n vec4 position = getSample(xyzw);\n vec4 center = getSample(anchor);\n\n return mix(center, position, growScale);\n}","join.position":"uniform float joinStride;\nuniform float joinStrideInv;\n\nfloat getIndex(vec4 xyzw);\nvec4 getRest(vec4 xyzw);\nvec4 injectIndices(float a, float b);\n\nvec4 getJoinXYZW(vec4 xyzw) {\n\n float a = getIndex(xyzw);\n float b = a * joinStrideInv;\n\n float integer = floor(b);\n float fraction = b - integer;\n \n return injectIndices(fraction * joinStride, integer) + getRest(xyzw);\n}\n","label.alpha":"varying float vPixelSize;\n\nvec4 getLabelAlphaColor(vec4 color, vec4 sample) {\n float mask = clamp(sample.r * 1000.0, 0.0, 1.0);\n float alpha = (sample.r - .5) * vPixelSize + .5;\n float a = mask * alpha * color.a;\n if (a <= 0.0) discard;\n return vec4(color.xyz, a);\n}\n","label.map":"vec2 mapUV(vec4 uvwo, vec4 stpq) {\n return uvwo.xy;\n}\n","label.outline":"uniform float outlineExpand;\nuniform float outlineStep;\nuniform vec3 outlineColor;\n\nvarying float vPixelSize;\n\nconst float PIXEL_STEP = 255.0 / 16.0;\n\nvec4 getLabelOutlineColor(vec4 color, vec4 sample) {\n float ps = vPixelSize * PIXEL_STEP;\n float os = outlineStep;\n\n float sdf = sample.r - .5 + outlineExpand;\n vec2 sdfs = vec2(sdf, sdf + os);\n vec2 alpha = clamp(sdfs * ps + .5, 0.0, 1.0);\n\n if (alpha.y <= 0.0) {\n discard;\n }\n\n vec3 blend = color.xyz;\n if (alpha.y > alpha.x) {\n blend = sqrt(mix(outlineColor * outlineColor, blend * blend, alpha.x));\n }\n \n return vec4(blend, alpha.y * color.a);\n}\n","layer.position":"uniform vec4 layerScale;\nuniform vec4 layerBias;\n\nvec4 layerPosition(vec4 position, inout vec4 stpq) {\n return layerScale * position + layerBias;\n}\n","lerp.depth":"// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 lerpDepth(vec4 xyzw) {\n float x = xyzw.z;\n float i = floor(x);\n float f = x - i;\n \n vec4 xyzw1 = vec4(xyzw.xy, i, xyzw.w);\n vec4 xyzw2 = vec4(xyzw.xy, i + 1.0, xyzw.w);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, f);\n}\n","lerp.height":"// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 lerpHeight(vec4 xyzw) {\n float x = xyzw.y;\n float i = floor(x);\n float f = x - i;\n \n vec4 xyzw1 = vec4(xyzw.x, i, xyzw.zw);\n vec4 xyzw2 = vec4(xyzw.x, i + 1.0, xyzw.zw);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, f);\n}\n","lerp.items":"// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 lerpItems(vec4 xyzw) {\n float x = xyzw.w;\n float i = floor(x);\n float f = x - i;\n \n vec4 xyzw1 = vec4(xyzw.xyz, i);\n vec4 xyzw2 = vec4(xyzw.xyz, i + 1.0);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, f);\n}\n","lerp.width":"// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 lerpWidth(vec4 xyzw) {\n float x = xyzw.x;\n float i = floor(x);\n float f = x - i;\n \n vec4 xyzw1 = vec4(i, xyzw.yzw);\n vec4 xyzw2 = vec4(i + 1.0, xyzw.yzw);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, f);\n}\n","line.position":"// Units and calibration\nuniform float worldUnit;\nuniform float lineWidth;\nuniform float lineDepth;\nuniform float focusDepth;\n\n// General data index\nuniform vec4 geometryClip;\nattribute vec4 position4;\n\n// (Start/mid/end -1/0/1, top/bottom -1,1) \nattribute vec2 line;\n\n// 0...1 for round or bevel joins\n#ifdef LINE_JOIN_DETAIL\nattribute float joint;\n#else\nconst float joint = 0.0;\n#endif\n\n// Knock out excessively long line segments (e.g. for asymtpotes)\n#ifdef LINE_PROXIMITY\nuniform float lineProximity;\nvarying float vClipProximity;\n#endif\n\n// Ghetto line stroking (local only, not global)\n#ifdef LINE_STROKE\nvarying float vClipStrokeWidth;\nvarying float vClipStrokeIndex;\nvarying vec3 vClipStrokeEven;\nvarying vec3 vClipStrokeOdd;\nvarying vec3 vClipStrokePosition;\n#endif\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\n// Clip line ends for arrows / decoration\n#ifdef LINE_CLIP\nuniform float clipRange;\nuniform vec2 clipStyle;\nuniform float clipSpace;\n\nattribute vec2 strip;\n\nvarying vec2 vClipEnds;\n\nvoid clipEnds(vec4 xyzw, vec3 center, vec3 pos) {\n\n // Sample end of line strip\n vec4 xyzwE = vec4(strip.y, xyzw.yzw);\n vec3 end = getPosition(xyzwE, 0.0);\n\n // Sample start of line strip\n vec4 xyzwS = vec4(strip.x, xyzw.yzw);\n vec3 start = getPosition(xyzwS, 0.0);\n\n // Measure length\n vec3 diff = end - start;\n float l = length(diff) * clipSpace;\n\n // Arrow length (=2.5x radius)\n float arrowSize = 1.25 * clipRange * lineWidth * worldUnit;\n\n vClipEnds = vec2(1.0);\n\n if (clipStyle.y > 0.0) {\n // Depth blend end\n float depth = focusDepth;\n if (lineDepth < 1.0) {\n float z = max(0.00001, -end.z);\n depth = mix(z, focusDepth, lineDepth);\n }\n \n // Absolute arrow length\n float size = arrowSize * depth;\n\n // Adjust clip range\n // Approach linear scaling with cubic ease the smaller we get\n float mini = clamp(1.0 - l / size * .333, 0.0, 1.0);\n float scale = 1.0 - mini * mini * mini; \n float invrange = 1.0 / (size * scale);\n \n // Clip end\n diff = normalize(end - center);\n float d = dot(end - pos, diff);\n vClipEnds.x = d * invrange - 1.0;\n }\n\n if (clipStyle.x > 0.0) {\n // Depth blend start\n float depth = focusDepth;\n if (lineDepth < 1.0) {\n float z = max(0.00001, -start.z);\n depth = mix(z, focusDepth, lineDepth);\n }\n \n // Absolute arrow length\n float size = arrowSize * depth;\n\n // Adjust clip range\n // Approach linear scaling with cubic ease the smaller we get\n float mini = clamp(1.0 - l / size * .333, 0.0, 1.0);\n float scale = 1.0 - mini * mini * mini; \n float invrange = 1.0 / (size * scale);\n \n // Clip start \n diff = normalize(center - start);\n float d = dot(pos - start, diff);\n vClipEnds.y = d * invrange - 1.0;\n }\n\n\n}\n#endif\n\n// Adjust left/center/right to be inside near/far z range\nconst float epsilon = 1e-5;\nvoid fixCenter(inout vec3 left, inout vec3 center, inout vec3 right) {\n if (center.z >= 0.0) {\n if (left.z < 0.0) {\n float d = (center.z + epsilon) / (center.z - left.z);\n center = mix(center, left, d);\n }\n else if (right.z < 0.0) {\n float d = (center.z + epsilon) / (center.z - right.z);\n center = mix(center, right, d);\n }\n }\n\n if (left.z >= 0.0) {\n if (center.z < 0.0) {\n float d = (left.z + epsilon) / (left.z - center.z);\n left = mix(left, center, d);\n }\n }\n\n if (right.z >= 0.0) {\n if (center.z < 0.0) {\n float d = (right.z + epsilon) / (right.z - center.z);\n right = mix(right, center, d);\n }\n }\n}\n\n// Sample the source data in an edge-aware manner\nvoid getLineGeometry(vec4 xyzw, float edge, out vec3 left, out vec3 center, out vec3 right) {\n vec4 delta = vec4(1.0, 0.0, 0.0, 0.0);\n\n center = getPosition(xyzw, 1.0);\n left = (edge > -0.5) ? getPosition(xyzw - delta, 0.0) : center;\n right = (edge < 0.5) ? getPosition(xyzw + delta, 0.0) : center;\n}\n\n// Calculate the position for a vertex along the line, including joins\nvec3 getLineJoin(float edge, bool odd, vec3 left, vec3 center, vec3 right, float width, float offset, float joint) {\n vec2 join = vec2(1.0, 0.0);\n\n fixCenter(left, center, right);\n\n vec4 a = vec4(left.xy, right.xy);\n vec4 b = a / vec4(left.zz, right.zz);\n\n vec2 l = b.xy;\n vec2 r = b.zw;\n vec2 c = center.xy / center.z;\n\n vec4 d = vec4(l, c) - vec4(c, r);\n float l1 = dot(d.xy, d.xy);\n float l2 = dot(d.zw, d.zw);\n\n if (l1 + l2 > 0.0) {\n \n if (edge > 0.5 || l2 == 0.0) {\n vec2 nl = normalize(d.xy);\n vec2 tl = vec2(nl.y, -nl.x);\n\n#ifdef LINE_PROXIMITY\n vClipProximity = 1.0;\n#endif\n\n#ifdef LINE_STROKE\n vClipStrokeEven = vClipStrokeOdd = normalize(left - center);\n#endif\n join = tl;\n }\n else if (edge < -0.5 || l1 == 0.0) {\n vec2 nr = normalize(d.zw);\n vec2 tr = vec2(nr.y, -nr.x);\n\n#ifdef LINE_PROXIMITY\n vClipProximity = 1.0;\n#endif\n\n#ifdef LINE_STROKE\n vClipStrokeEven = vClipStrokeOdd = normalize(center - right);\n#endif\n join = tr;\n }\n else {\n // Limit join stretch for tiny segments\n float lmin2 = min(l1, l2) / (width * width);\n\n // Hide line segment if ratio of leg lengths exceeds promixity threshold\n#ifdef LINE_PROXIMITY\n float lr = l1 / l2;\n float rl = l2 / l1;\n float ratio = max(lr, rl);\n float thresh = lineProximity + 1.0;\n vClipProximity = (ratio > thresh * thresh) ? 1.0 : 0.0;\n#endif\n\n // Calculate normals/tangents\n vec2 nl = normalize(d.xy);\n vec2 nr = normalize(d.zw);\n\n // Calculate tangents\n vec2 tl = vec2(nl.y, -nl.x);\n vec2 tr = vec2(nr.y, -nr.x);\n\n#ifdef LINE_PROXIMITY\n // Mix tangents according to leg lengths\n vec2 tc = normalize(mix(tl, tr, l1/(l1+l2)));\n#else\n // Average tangent\n vec2 tc = normalize(tl + tr);\n#endif\n \n // Miter join\n float cosA = dot(nl, tc);\n float sinA = max(0.1, abs(dot(tl, tc)));\n float factor = cosA / sinA;\n float scale = sqrt(1.0 + min(lmin2, factor * factor));\n\n // Stroke normals\n#ifdef LINE_STROKE\n vec3 stroke1 = normalize(left - center);\n vec3 stroke2 = normalize(center - right);\n\n if (odd) {\n vClipStrokeEven = stroke1;\n vClipStrokeOdd = stroke2;\n }\n else {\n vClipStrokeEven = stroke2;\n vClipStrokeOdd = stroke1;\n }\n#endif\n\n#ifdef LINE_JOIN_MITER\n // Apply straight up miter\n join = tc * scale;\n#endif\n\n#ifdef LINE_JOIN_ROUND\n // Slerp bevel join into circular arc\n float dotProduct = dot(nl, nr);\n float angle = acos(dotProduct);\n float sinT = sin(angle);\n join = (sin((1.0 - joint) * angle) * tl + sin(joint * angle) * tr) / sinT;\n#endif\n\n#ifdef LINE_JOIN_BEVEL\n // Direct bevel join between two flat ends\n float dotProduct = dot(nl, nr);\n join = mix(tl, tr, joint);\n#endif\n\n#ifdef LINE_JOIN_DETAIL\n // Check if on inside or outside of joint\n float crossProduct = nl.x * nr.y - nl.y * nr.x;\n if (offset * crossProduct < 0.0) {\n // For near-180-degree bends, correct back to a miter to avoid discontinuities\n float ratio = clamp(-dotProduct * 2.0 - 1.0, 0.0, 1.0);\n // Otherwise collapse the inside vertices into one.\n join = mix(tc * scale, join, ratio * ratio * ratio);\n }\n#endif\n\n }\n return vec3(join, 0.0);\n }\n else {\n return vec3(0.0);\n }\n\n}\n\n// Calculate final line position\nvec3 getLinePosition() {\n vec3 left, center, right, join;\n\n // left/center/right\n float edge = line.x;\n // up/down\n float offset = line.y;\n\n // Clip data\n vec4 p = min(geometryClip, position4);\n edge += max(0.0, position4.x - geometryClip.x);\n\n // Get position + adjacent neighbours\n getLineGeometry(p, edge, left, center, right);\n\n#ifdef LINE_STROKE\n // Set parameters for line stroke fragment shader\n vClipStrokePosition = center;\n vClipStrokeIndex = p.x;\n bool odd = mod(p.x, 2.0) >= 1.0;\n#else\n bool odd = true;\n#endif\n\n // Divide line width up/down\n float width = lineWidth * 0.5;\n\n float depth = focusDepth;\n if (lineDepth < 1.0) {\n // Depth blending\n float z = max(0.00001, -center.z);\n depth = mix(z, focusDepth, lineDepth);\n }\n width *= depth;\n\n // Convert to world units\n width *= worldUnit;\n\n // Calculate line join\n join = getLineJoin(edge, odd, left, center, right, width, offset, joint);\n vec3 pos = center + join * offset * width;\n\n#ifdef LINE_STROKE\n vClipStrokeWidth = width;\n#endif\n\n#ifdef LINE_CLIP\n clipEnds(p, center, pos);\n#endif\n\n return pos;\n}\n","map.2d.data":"uniform vec2 dataResolution;\nuniform vec2 dataPointer;\n\nvec2 map2DData(vec2 xy) {\n return (xy + dataPointer) * dataResolution;\n}\n","map.2d.data.wrap":"uniform vec2 dataResolution;\nuniform vec2 dataPointer;\n\nvec2 map2DData(vec2 xy) {\n return fract((xy + dataPointer) * dataResolution);\n}\n","map.xyzw.2dv":"void mapXyzw2DV(vec4 xyzw, out vec2 xy, out float z) {\n xy = xyzw.xy;\n z = xyzw.z;\n}\n\n","map.xyzw.align":"vec4 alignXYZW(vec4 xyzw) {\n return floor(xyzw + .5);\n}\n\n","map.xyzw.texture":"uniform float textureItems;\nuniform float textureHeight;\n\nvec2 mapXyzwTexture(vec4 xyzw) {\n \n float x = xyzw.x;\n float y = xyzw.y;\n float z = xyzw.z;\n float i = xyzw.w;\n \n return vec2(i, y) + vec2(x, z) * vec2(textureItems, textureHeight);\n}\n\n","mesh.fragment.color":"varying vec4 vColor;\n\nvec4 getColor() {\n return vColor;\n}\n","mesh.fragment.map":"#ifdef POSITION_STPQ\nvarying vec4 vSTPQ;\n#endif\n#ifdef POSITION_U\nvarying float vU;\n#endif\n#ifdef POSITION_UV\nvarying vec2 vUV;\n#endif\n#ifdef POSITION_UVW\nvarying vec3 vUVW;\n#endif\n#ifdef POSITION_UVWO\nvarying vec4 vUVWO;\n#endif\n\nvec4 getSample(vec4 uvwo, vec4 stpq);\n\nvec4 getMapColor() {\n #ifdef POSITION_STPQ\n vec4 stpq = vSTPQ;\n #else\n vec4 stpq = vec4(0.0);\n #endif\n\n #ifdef POSITION_U\n vec4 uvwo = vec4(vU, 0.0, 0.0, 0.0);\n #endif\n #ifdef POSITION_UV\n vec4 uvwo = vec4(vUV, 0.0, 0.0);\n #endif\n #ifdef POSITION_UVW\n vec4 uvwo = vec4(vUVW, 0.0);\n #endif\n #ifdef POSITION_UVWO\n vec4 uvwo = vec4(vUVWO);\n #endif\n\n return getSample(uvwo, stpq);\n}\n","mesh.fragment.mask":"varying float vMask;\n\nfloat ease(float t) {\n t = clamp(t, 0.0, 1.0);\n return t * t * (3.0 - 2.0 * t);\n}\n\nvec4 maskColor() {\n if (vMask <= 0.0) discard;\n return vec4(vec3(1.0), ease(vMask));\n}\n","mesh.fragment.material":"#ifdef POSITION_STPQ\nvarying vec4 vSTPQ;\n#endif\n#ifdef POSITION_U\nvarying float vU;\n#endif\n#ifdef POSITION_UV\nvarying vec2 vUV;\n#endif\n#ifdef POSITION_UVW\nvarying vec3 vUVW;\n#endif\n#ifdef POSITION_UVWO\nvarying vec4 vUVWO;\n#endif\n\nvec4 getSample(vec4 rgba, vec4 stpq);\n\nvec4 getMaterialColor(vec4 rgba) {\n vec4 stpq = vec4(0.0);\n\n #ifdef POSITION_U\n stpq.x = vU;\n #endif\n #ifdef POSITION_UV\n stpq.xy = vUV;\n #endif\n #ifdef POSITION_UVW\n stpq.xyz = vUVW;\n #endif\n #ifdef POSITION_UVWO\n stpq = vUVWO;\n #endif\n\n #ifdef POSITION_STPQ\n stpq = vSTPQ;\n #endif\n\n return getSample(rgba, stpq);\n}\n","mesh.fragment.shaded":"varying vec3 vNormal;\nvarying vec3 vLight;\nvarying vec3 vPosition;\n\nvec3 offSpecular(vec3 color) {\n vec3 c = 1.0 - color;\n return 1.0 - c * c;\n}\n\nvec4 getShadedColor(vec4 rgba) {\n \n vec3 color = rgba.xyz;\n vec3 color2 = offSpecular(rgba.xyz);\n\n vec3 normal = normalize(vNormal);\n vec3 light = normalize(vLight);\n vec3 position = normalize(vPosition);\n \n float side = gl_FrontFacing ? -1.0 : 1.0;\n float cosine = side * dot(normal, light);\n float diffuse = mix(max(0.0, cosine), .5 + .5 * cosine, .1);\n \n vec3 halfLight = normalize(light + position);\n float cosineHalf = max(0.0, side * dot(normal, halfLight));\n float specular = pow(cosineHalf, 16.0);\n \n return vec4(color * (diffuse * .9 + .05) + .25 * color2 * specular, rgba.a);\n}\n","mesh.fragment.texture":"","mesh.gamma.in":"vec4 getGammaInColor(vec4 rgba) {\n return vec4(rgba.rgb * rgba.rgb, rgba.a);\n}\n","mesh.gamma.out":"vec4 getGammaOutColor(vec4 rgba) {\n return vec4(sqrt(rgba.rgb), rgba.a);\n}\n","mesh.map.uvwo":"vec4 mapUVWO(vec4 uvwo, vec4 stpq) {\n return uvwo;\n}\n","mesh.position":"uniform vec4 geometryClip;\nattribute vec4 position4;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvec3 getMeshPosition() {\n vec4 p = min(geometryClip, position4);\n return getPosition(p, 1.0);\n}\n","mesh.vertex.color":"attribute vec4 position4;\nuniform vec4 geometryClip;\nvarying vec4 vColor;\n\n// External\nvec4 getSample(vec4 xyzw);\n\nvoid vertexColor() {\n vec4 p = min(geometryClip, position4);\n vColor = getSample(p);\n}\n","mesh.vertex.mask":"attribute vec4 position4;\nuniform vec4 geometryResolution;\nuniform vec4 geometryClip;\nvarying float vMask;\n\n// External\nfloat getSample(vec4 xyzw);\n\nvoid maskLevel() {\n vec4 p = min(geometryClip, position4);\n vMask = getSample(p * geometryResolution);\n}\n","mesh.vertex.position":"uniform vec4 geometryResolution;\n\n#ifdef POSITION_STPQ\nvarying vec4 vSTPQ;\n#endif\n#ifdef POSITION_U\nvarying float vU;\n#endif\n#ifdef POSITION_UV\nvarying vec2 vUV;\n#endif\n#ifdef POSITION_UVW\nvarying vec3 vUVW;\n#endif\n#ifdef POSITION_UVWO\nvarying vec4 vUVWO;\n#endif\n\n// External\nvec3 getPosition(vec4 xyzw, in vec4 stpqIn, out vec4 stpqOut);\n\nvec3 getMeshPosition(vec4 xyzw, float canonical) {\n vec4 stpqOut, stpqIn = xyzw * geometryResolution;\n vec3 xyz = getPosition(xyzw, stpqIn, stpqOut);\n\n #ifdef POSITION_MAP\n if (canonical > 0.5) {\n #ifdef POSITION_STPQ\n vSTPQ = stpqOut;\n #endif\n #ifdef POSITION_U\n vU = stpqOut.x;\n #endif\n #ifdef POSITION_UV\n vUV = stpqOut.xy;\n #endif\n #ifdef POSITION_UVW\n vUVW = stpqOut.xyz;\n #endif\n #ifdef POSITION_UVWO\n vUVWO = stpqOut;\n #endif\n }\n #endif\n return xyz;\n}\n","move.position":"uniform float transitionEnter;\nuniform float transitionExit;\nuniform vec4 transitionScale;\nuniform vec4 transitionBias;\nuniform float transitionSkew;\nuniform float transitionActive;\n\nuniform vec4 moveFrom;\nuniform vec4 moveTo;\n\nfloat ease(float t) {\n t = clamp(t, 0.0, 1.0);\n return 1.0 - (2.0 - t) * t;\n}\n\nvec4 getTransitionPosition(vec4 xyzw, inout vec4 stpq) {\n if (transitionActive < 0.5) return xyzw;\n\n float enter = transitionEnter;\n float exit = transitionExit;\n float skew = transitionSkew;\n vec4 scale = transitionScale;\n vec4 bias = transitionBias;\n\n float factor = 1.0 + skew;\n float offset = dot(vec4(1.0), stpq * scale + bias);\n\n float a1 = ease(enter * factor - offset);\n float a2 = ease(exit * factor + offset - skew);\n\n return xyzw + a1 * moveFrom + a2 * moveTo;\n}","object.mask.default":"vec4 getMask(vec4 xyzw) {\n return vec4(1.0);\n}","point.alpha.circle":"varying float vPixelSize;\n\nfloat getDiscAlpha(float mask) {\n // Approximation: 1 - x*x is approximately linear around x = 1 with slope 2\n return vPixelSize * (1.0 - mask);\n // return vPixelSize * 2.0 * (1.0 - sqrt(mask));\n}\n","point.alpha.circle.hollow":"varying float vPixelSize;\n\nfloat getDiscHollowAlpha(float mask) {\n return vPixelSize * (0.5 - 2.0 * abs(sqrt(mask) - .75));\n}\n","point.alpha.generic":"varying float vPixelSize;\n\nfloat getGenericAlpha(float mask) {\n return vPixelSize * 2.0 * (1.0 - mask);\n}\n","point.alpha.generic.hollow":"varying float vPixelSize;\n\nfloat getGenericHollowAlpha(float mask) {\n return vPixelSize * (0.5 - 2.0 * abs(mask - .75));\n}\n","point.edge":"varying vec2 vSprite;\n\nfloat getSpriteMask(vec2 xy);\nfloat getSpriteAlpha(float mask);\n\nvoid setFragmentColorFill(vec4 color) {\n float mask = getSpriteMask(vSprite);\n if (mask > 1.0) {\n discard;\n }\n float alpha = getSpriteAlpha(mask);\n if (alpha >= 1.0) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, alpha * color.a);\n}\n","point.fill":"varying vec2 vSprite;\n\nfloat getSpriteMask(vec2 xy);\nfloat getSpriteAlpha(float mask);\n\nvoid setFragmentColorFill(vec4 color) {\n float mask = getSpriteMask(vSprite);\n if (mask > 1.0) {\n discard;\n }\n float alpha = getSpriteAlpha(mask);\n if (alpha < 1.0) {\n discard;\n }\n gl_FragColor = color;\n}\n\n","point.mask.circle":"varying float vPixelSize;\n\nfloat getCircleMask(vec2 uv) {\n return dot(uv, uv);\n}\n","point.mask.diamond":"varying float vPixelSize;\n\nfloat getDiamondMask(vec2 uv) {\n vec2 a = abs(uv);\n return a.x + a.y;\n}\n","point.mask.down":"varying float vPixelSize;\n\nfloat getTriangleDownMask(vec2 uv) {\n uv.y += .25;\n return max(uv.y, abs(uv.x) * .866 - uv.y * .5 + .6);\n}\n","point.mask.left":"varying float vPixelSize;\n\nfloat getTriangleLeftMask(vec2 uv) {\n uv.x += .25;\n return max(uv.x, abs(uv.y) * .866 - uv.x * .5 + .6);\n}\n","point.mask.right":"varying float vPixelSize;\n\nfloat getTriangleRightMask(vec2 uv) {\n uv.x -= .25;\n return max(-uv.x, abs(uv.y) * .866 + uv.x * .5 + .6);\n}\n","point.mask.square":"varying float vPixelSize;\n\nfloat getSquareMask(vec2 uv) {\n vec2 a = abs(uv);\n return max(a.x, a.y);\n}\n","point.mask.up":"varying float vPixelSize;\n\nfloat getTriangleUpMask(vec2 uv) {\n uv.y -= .25;\n return max(-uv.y, abs(uv.x) * .866 + uv.y * .5 + .6);\n}\n","point.position":"uniform float pointDepth;\n\nuniform float pixelUnit;\nuniform float renderScale;\nuniform float renderScaleInv;\nuniform float focusDepth;\n\nuniform vec4 geometryClip;\nattribute vec4 position4;\nattribute vec2 sprite;\n\nvarying vec2 vSprite;\nvarying float vPixelSize;\n\nconst float pointScale = POINT_SHAPE_SCALE;\n\n// External\nfloat getPointSize(vec4 xyzw);\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvec3 getPointPosition() {\n vec4 p = min(geometryClip, position4);\n vec3 center = getPosition(p, 1.0);\n\n // Depth blending\n // TODO: orthographic camera\n // Workaround: set depth = 0\n float z = -center.z;\n float depth = mix(z, focusDepth, pointDepth);\n \n // Match device/unit mapping \n // Sprite goes from -1..1, width = 2.\n float pointSize = getPointSize(p);\n float size = pointScale * pointSize * pixelUnit * .5;\n float depthSize = depth * size;\n \n // Pad sprite by half a pixel to make the anti-aliasing straddle the pixel edge\n // Note: pixelsize measures radius\n float pixelSize = .5 * (pointDepth > 0.0 ? depthSize / z : size);\n float paddedSize = pixelSize + 0.5;\n float padFactor = paddedSize / pixelSize;\n\n vPixelSize = paddedSize;\n vSprite = sprite;\n\n return center + vec3(sprite * depthSize * renderScaleInv * padFactor, 0.0);\n}\n","point.size.uniform":"uniform float pointSize;\n\nfloat getPointSize(vec4 xyzw) {\n return pointSize;\n}","point.size.varying":"uniform float pointSize;\n\nvec4 getSample(vec4 xyzw);\n\nfloat getPointSize(vec4 xyzw) {\n return pointSize * getSample(xyzw).x;\n}","polar.position":"uniform float polarBend;\nuniform float polarFocus;\nuniform float polarAspect;\nuniform float polarHelix;\n\nuniform mat4 viewMatrix;\n\nvec4 getPolarPosition(vec4 position, inout vec4 stpq) {\n if (polarBend > 0.0) {\n\n if (polarBend < 0.001) {\n // Factor out large addition/subtraction of polarFocus\n // to avoid numerical error\n // sin(x) ~ x\n // cos(x) ~ 1 - x * x / 2\n vec2 pb = position.xy * polarBend;\n float ppbbx = pb.x * pb.x;\n return viewMatrix * vec4(\n position.x * (1.0 - polarBend + (pb.y * polarAspect)),\n position.y * (1.0 - .5 * ppbbx) - (.5 * ppbbx) * polarFocus / polarAspect,\n position.z + position.x * polarHelix * polarBend,\n 1.0\n );\n }\n else {\n vec2 xy = position.xy * vec2(polarBend, polarAspect);\n float radius = polarFocus + xy.y;\n return viewMatrix * vec4(\n sin(xy.x) * radius,\n (cos(xy.x) * radius - polarFocus) / polarAspect,\n position.z + position.x * polarHelix * polarBend,\n 1.0\n );\n }\n }\n else {\n return viewMatrix * vec4(position.xyz, 1.0);\n }\n}","project.position":"uniform float styleZBias;\nuniform float styleZIndex;\n\nvoid setPosition(vec3 position) {\n vec4 pos = projectionMatrix * vec4(position, 1.0);\n\n // Apply relative Z bias\n float bias = (1.0 - styleZBias / 32768.0);\n pos.z *= bias;\n \n // Apply large scale Z index changes\n if (styleZIndex > 0.0) {\n float z = pos.z / pos.w;\n pos.z = ((z + 1.0) / (styleZIndex + 1.0) - 1.0) * pos.w;\n }\n \n gl_Position = pos;\n}","project.readback":"// This is three.js' global uniform, missing from fragment shaders.\nuniform mat4 projectionMatrix;\n\nvec4 readbackPosition(vec3 position, vec4 stpq) {\n vec4 pos = projectionMatrix * vec4(position, 1.0);\n vec3 final = pos.xyz / pos.w;\n if (final.z < -1.0) {\n return vec4(0.0, 0.0, 0.0, -1.0);\n }\n else {\n return vec4(final, -position.z);\n }\n}\n","raw.position.scale":"uniform vec4 geometryScale;\nattribute vec4 position4;\n\nvec4 getRawPositionScale() {\n return geometryScale * position4;\n}\n","repeat.position":"uniform vec4 repeatModulus;\n\nvec4 getRepeatXYZW(vec4 xyzw) {\n return mod(xyzw + .5, repeatModulus) - .5;\n}\n","resample.padding":"uniform vec4 resampleBias;\n\nvec4 resamplePadding(vec4 xyzw) {\n return xyzw + resampleBias;\n}","resample.relative":"uniform vec4 resampleFactor;\n\nvec4 resampleRelative(vec4 xyzw) {\n return xyzw * resampleFactor;\n}","reveal.mask":"uniform float transitionEnter;\nuniform float transitionExit;\nuniform vec4 transitionScale;\nuniform vec4 transitionBias;\nuniform float transitionSkew;\nuniform float transitionActive;\n\nfloat getTransitionSDFMask(vec4 stpq) {\n if (transitionActive < 0.5) return 1.0;\n\n float enter = transitionEnter;\n float exit = transitionExit;\n float skew = transitionSkew;\n vec4 scale = transitionScale;\n vec4 bias = transitionBias;\n\n float factor = 1.0 + skew;\n float offset = dot(vec4(1.0), stpq * scale + bias);\n\n vec2 d = vec2(enter, exit) * factor + vec2(-offset, offset - skew);\n if (exit == 1.0) return d.x;\n if (enter == 1.0) return d.y;\n return min(d.x, d.y);\n}","root.position":"vec3 getRootPosition(vec4 position, in vec4 stpqIn, out vec4 stpqOut) {\n stpqOut = stpqIn; // avoid inout confusion\n return position.xyz;\n}","sample.2d":"uniform sampler2D dataTexture;\n\nvec4 sample2D(vec2 uv) {\n return texture2D(dataTexture, uv);\n}\n","scale.position":"uniform vec4 scaleAxis;\nuniform vec4 scaleOffset;\n\nvec4 sampleData(float x);\n\nvec4 getScalePosition(vec4 xyzw) {\n return scaleAxis * sampleData(xyzw.x).x + scaleOffset;\n}\n","screen.map.stpq":"uniform vec4 remapSTPQScale;\n\nvec4 screenMapSTPQ(vec4 xyzw, out vec4 stpq) {\n stpq = xyzw * remapSTPQScale;\n return xyzw;\n}\n","screen.map.xy":"uniform vec2 remapUVScale;\n\nvec4 screenMapXY(vec4 uvwo, vec4 stpq) {\n return vec4(floor(remapUVScale * uvwo.xy), 0.0, 0.0);\n}\n","screen.map.xyzw":"uniform vec2 remapUVScale;\nuniform vec2 remapModulus;\nuniform vec2 remapModulusInv;\n\nvec4 screenMapXYZW(vec4 uvwo, vec4 stpq) {\n vec2 st = floor(remapUVScale * uvwo.xy);\n vec2 xy = st * remapModulusInv;\n vec2 ixy = floor(xy);\n vec2 fxy = xy - ixy;\n vec2 zw = fxy * remapModulus;\n return vec4(ixy.x, zw.y, ixy.y, zw.x);\n}\n","screen.pass.uv":"vec2 screenPassUV(vec4 uvwo, vec4 stpq) {\n return uvwo.xy;\n}\n","screen.position":"void setScreenPosition(vec4 position) {\n gl_Position = vec4(position.xy * 2.0 - 1.0, 0.5, 1.0);\n}\n","slice.position":"uniform vec4 sliceOffset;\n\nvec4 getSliceOffset(vec4 xyzw) {\n return xyzw + sliceOffset;\n}\n","spherical.position":"uniform float sphericalBend;\nuniform float sphericalFocus;\nuniform float sphericalAspectX;\nuniform float sphericalAspectY;\nuniform float sphericalScaleY;\n\nuniform mat4 viewMatrix;\n\nvec4 getSphericalPosition(vec4 position, inout vec4 stpq) {\n if (sphericalBend > 0.0001) {\n\n vec3 xyz = position.xyz * vec3(sphericalBend, sphericalBend / sphericalAspectY * sphericalScaleY, sphericalAspectX);\n float radius = sphericalFocus + xyz.z;\n float cosine = cos(xyz.y) * radius;\n\n return viewMatrix * vec4(\n sin(xyz.x) * cosine,\n sin(xyz.y) * radius * sphericalAspectY,\n (cos(xyz.x) * cosine - sphericalFocus) / sphericalAspectX,\n 1.0\n );\n }\n else {\n return viewMatrix * vec4(position.xyz, 1.0);\n }\n}", +"split.position":"uniform float splitStride;\n\nvec2 getIndices(vec4 xyzw);\nvec4 getRest(vec4 xyzw);\nvec4 injectIndex(float v);\n\nvec4 getSplitXYZW(vec4 xyzw) {\n vec2 uv = getIndices(xyzw);\n float offset = uv.x + uv.y * splitStride;\n return injectIndex(offset) + getRest(xyzw);\n}\n","spread.position":"uniform vec4 spreadOffset;\nuniform mat4 spreadMatrix;\n\n// External\nvec4 getSample(vec4 xyzw);\n\nvec4 getSpreadSample(vec4 xyzw) {\n vec4 sample = getSample(xyzw);\n return sample + spreadMatrix * (spreadOffset + xyzw);\n}\n","sprite.fragment":"varying vec2 vSprite;\n\nvec4 getSample(vec2 xy);\n\nvec4 getSpriteColor() {\n return getSample(vSprite);\n}","sprite.position":"uniform vec2 spriteOffset;\nuniform float spriteScale;\nuniform float spriteDepth;\nuniform float spriteSnap;\n\nuniform vec2 renderOdd;\nuniform float renderScale;\nuniform float renderScaleInv;\nuniform float pixelUnit;\nuniform float focusDepth;\n\nuniform vec4 geometryClip;\nattribute vec4 position4;\nattribute vec2 sprite;\n\nvarying float vPixelSize;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\nvec4 getSprite(vec4 xyzw);\n\nvec3 getSpritePosition() {\n // Clip points\n vec4 p = min(geometryClip, position4);\n float diff = length(position4 - p);\n if (diff > 0.0) {\n return vec3(0.0, 0.0, 1000.0);\n }\n\n // Make sprites\n vec3 center = getPosition(p, 1.0);\n vec4 atlas = getSprite(p);\n\n // Sprite goes from -1..1, width = 2.\n // -1..1 -> -0.5..0.5\n vec2 halfSprite = sprite * .5;\n vec2 halfFlipSprite = vec2(halfSprite.x, -halfSprite.y);\n\n#ifdef POSITION_UV\n // Assign UVs\n vUV = atlas.xy + atlas.zw * (halfFlipSprite + .5);\n#endif\n\n // Depth blending\n // TODO: orthographic camera\n // Workaround: set depth = 0\n float depth = focusDepth, z;\n z = -center.z;\n if (spriteDepth < 1.0) {\n depth = mix(z, focusDepth, spriteDepth);\n }\n \n // Match device/unit mapping \n float size = pixelUnit * spriteScale;\n float depthSize = depth * size;\n\n // Calculate pixelSize for anti-aliasing\n float pixelSize = (spriteDepth > 0.0 ? depthSize / z : size);\n vPixelSize = pixelSize;\n\n // Position sprite\n vec2 atlasOdd = fract(atlas.zw / 2.0);\n vec2 offset = (spriteOffset + halfSprite * atlas.zw) * depthSize;\n if (spriteSnap > 0.5) {\n // Snap to pixel (w/ epsilon shift to avoid jitter)\n return vec3(((floor(center.xy / center.z * renderScale + 0.001) + renderOdd + atlasOdd) * center.z + offset) * renderScaleInv, center.z);\n }\n else {\n // Place directly\n return center + vec3(offset * renderScaleInv, 0.0);\n }\n\n}\n","stereographic.position":"uniform float stereoBend;\n\nuniform mat4 viewMatrix;\n\nvec4 getStereoPosition(vec4 position, inout vec4 stpq) {\n if (stereoBend > 0.0001) {\n\n vec3 pos = position.xyz;\n float r = length(pos);\n float z = r + pos.z;\n vec3 project = vec3(pos.xy / z, r);\n \n vec3 lerped = mix(pos, project, stereoBend);\n\n return viewMatrix * vec4(lerped, 1.0);\n }\n else {\n return viewMatrix * vec4(position.xyz, 1.0);\n }\n}","stereographic4.position":"uniform float stereoBend;\nuniform vec4 basisScale;\nuniform vec4 basisOffset;\nuniform mat4 viewMatrix;\nuniform vec2 view4D;\n\nvec4 getStereographic4Position(vec4 position, inout vec4 stpq) {\n \n vec4 transformed;\n if (stereoBend > 0.0001) {\n\n float r = length(position);\n float w = r + position.w;\n vec4 project = vec4(position.xyz / w, r);\n \n transformed = mix(position, project, stereoBend);\n }\n else {\n transformed = position;\n }\n\n vec4 pos4 = transformed * basisScale - basisOffset;\n vec3 xyz = (viewMatrix * vec4(pos4.xyz, 1.0)).xyz;\n return vec4(xyz, pos4.w * view4D.y + view4D.x);\n}\n","stpq.sample.2d":"varying vec2 vST;\n\nvec4 getSample(vec2 st);\n\nvec4 getSTSample() {\n return getSample(vST);\n}\n","stpq.xyzw.2d":"varying vec2 vUV;\n\nvoid setRawUV(vec4 xyzw) {\n vUV = xyzw.xy;\n}\n","strip.position.normal":"uniform vec4 geometryClip;\nattribute vec4 position4;\nattribute vec3 strip;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvarying vec3 vNormal;\nvarying vec3 vLight;\nvarying vec3 vPosition;\n\nvoid getStripGeometry(vec4 xyzw, vec3 strip, out vec3 pos, out vec3 normal) {\n vec3 a, b, c;\n\n a = getPosition(xyzw, 1.0);\n b = getPosition(vec4(xyzw.xyz, strip.x), 0.0);\n c = getPosition(vec4(xyzw.xyz, strip.y), 0.0);\n\n normal = normalize(cross(c - a, b - a)) * strip.z;\n \n pos = a;\n}\n\nvec3 getStripPositionNormal() {\n vec3 center, normal;\n\n vec4 p = min(geometryClip, position4);\n\n getStripGeometry(p, strip, center, normal);\n vNormal = normal;\n vLight = normalize((viewMatrix * vec4(1.0, 2.0, 2.0, 0.0)).xyz);\n vPosition = -center;\n\n return center;\n}\n","style.color":"uniform vec3 styleColor;\nuniform float styleOpacity;\n\nvec4 getStyleColor() {\n return vec4(styleColor, styleOpacity);\n}\n","subdivide.depth":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideDepth(vec4 xyzw) {\n float x = xyzw.z;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(xyzw.xy, i + g, xyzw.w));\n}\n","subdivide.depth.lerp":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideDepthLerp(vec4 xyzw) {\n float x = xyzw.z;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(xyzw.xy, i, xyzw.w);\n vec4 xyzw2 = vec4(xyzw.xy, i + 1.0, xyzw.w);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n","subdivide.height":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideHeight(vec4 xyzw) {\n float x = xyzw.y;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(xyzw.x, i + g, xyzw.zw));\n}\n","subdivide.height.lerp":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideHeightLerp(vec4 xyzw) {\n float x = xyzw.y;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(xyzw.x, i, xyzw.zw);\n vec4 xyzw2 = vec4(xyzw.x, i + 1.0, xyzw.zw);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n","subdivide.items":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideItems(vec4 xyzw) {\n float x = xyzw.w;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(xyzw.xyz, i + g));\n}\n","subdivide.items.lerp":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideItemsLerp(vec4 xyzw) {\n float x = xyzw.w;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(xyzw.xyz, i);\n vec4 xyzw2 = vec4(xyzw.xyz, i + 1.0);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n","subdivide.width":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideWidth(vec4 xyzw) {\n float x = xyzw.x;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n return sampleData(vec4(i + g, xyzw.yzw));\n}\n","subdivide.width.lerp":"uniform float subdivideBevel;\n\n// External\nvec4 sampleData(vec4 xyzw);\n\nvec4 subdivideWidthLerp(vec4 xyzw) {\n float x = xyzw.x;\n float i = floor(x);\n float f = x - i;\n\n float minf = subdivideBevel * min(f, 1.0 - f);\n float g = (f > 0.5) ? 1.0 - minf : (f < 0.5) ? minf : 0.5;\n\n vec4 xyzw1 = vec4(i, xyzw.yzw);\n vec4 xyzw2 = vec4(i + 1.0, xyzw.yzw);\n \n vec4 a = sampleData(xyzw1);\n vec4 b = sampleData(xyzw2);\n\n return mix(a, b, g);\n}\n","surface.mask.hollow":"attribute vec4 position4;\n\nfloat getSurfaceHollowMask(vec4 xyzw) {\n vec4 df = abs(fract(position4) - .5);\n vec2 df2 = min(df.xy, df.zw);\n float df3 = min(df2.x, df2.y);\n return df3;\n}","surface.position":"uniform vec4 geometryClip;\nuniform vec4 geometryResolution;\nuniform vec4 mapSize;\n\nattribute vec4 position4;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvec3 getSurfacePosition() {\n vec4 p = min(geometryClip, position4);\n vec3 xyz = getPosition(p, 1.0);\n\n // Overwrite UVs\n#ifdef POSITION_UV\n#ifdef POSITION_UV_INT\n vUV = -.5 + (position4.xy * geometryResolution.xy) * mapSize.xy;\n#else\n vUV = position4.xy * geometryResolution.xy;\n#endif\n#endif\n\n return xyz;\n}\n","surface.position.normal":"uniform vec4 mapSize;\nuniform vec4 geometryResolution;\nuniform vec4 geometryClip;\nattribute vec4 position4;\nattribute vec2 surface;\n\n// External\nvec3 getPosition(vec4 xyzw, float canonical);\n\nvoid getSurfaceGeometry(vec4 xyzw, float edgeX, float edgeY, out vec3 left, out vec3 center, out vec3 right, out vec3 up, out vec3 down) {\n vec4 deltaX = vec4(1.0, 0.0, 0.0, 0.0);\n vec4 deltaY = vec4(0.0, 1.0, 0.0, 0.0);\n\n /*\n // high quality, 5 tap\n center = getPosition(xyzw, 1.0);\n left = (edgeX > -0.5) ? getPosition(xyzw - deltaX, 0.0) : center;\n right = (edgeX < 0.5) ? getPosition(xyzw + deltaX, 0.0) : center;\n down = (edgeY > -0.5) ? getPosition(xyzw - deltaY, 0.0) : center;\n up = (edgeY < 0.5) ? getPosition(xyzw + deltaY, 0.0) : center;\n */\n \n // low quality, 3 tap\n center = getPosition(xyzw, 1.0);\n left = center;\n down = center;\n right = (edgeX < 0.5) ? getPosition(xyzw + deltaX, 0.0) : (2.0 * center - getPosition(xyzw - deltaX, 0.0));\n up = (edgeY < 0.5) ? getPosition(xyzw + deltaY, 0.0) : (2.0 * center - getPosition(xyzw - deltaY, 0.0));\n}\n\nvec3 getSurfaceNormal(vec3 left, vec3 center, vec3 right, vec3 up, vec3 down) {\n vec3 dx = right - left;\n vec3 dy = up - down;\n vec3 n = cross(dy, dx);\n if (length(n) > 0.0) {\n return normalize(n);\n }\n return vec3(0.0, 1.0, 0.0);\n}\n\nvarying vec3 vNormal;\nvarying vec3 vLight;\nvarying vec3 vPosition;\n\nvec3 getSurfacePositionNormal() {\n vec3 left, center, right, up, down;\n\n vec4 p = min(geometryClip, position4);\n\n getSurfaceGeometry(p, surface.x, surface.y, left, center, right, up, down);\n vNormal = getSurfaceNormal(left, center, right, up, down);\n vLight = normalize((viewMatrix * vec4(1.0, 2.0, 2.0, 0.0)).xyz); // hardcoded directional light\n vPosition = -center;\n\n#ifdef POSITION_UV\n#ifdef POSITION_UV_INT\n vUV = -.5 + (position4.xy * geometryResolution.xy) * mapSize.xy;\n#else\n vUV = position4.xy * geometryResolution.xy;\n#endif\n#endif\n \n return center;\n}\n","ticks.position":"uniform float worldUnit;\nuniform float focusDepth;\nuniform float tickSize;\nuniform float tickEpsilon;\nuniform vec3 tickNormal;\nuniform vec2 tickStrip;\n\nvec4 getSample(vec4 xyzw);\n\nvec3 transformPosition(vec4 position, in vec4 stpqIn, out vec4 stpqOut);\n\nvec3 getTickPosition(vec4 xyzw, in vec4 stpqIn, out vec4 stpqOut) {\n float epsilon = tickEpsilon;\n\n // determine tick direction\n float leftX = max(tickStrip.x, xyzw.y - 1.0);\n float rightX = min(tickStrip.y, xyzw.y + 1.0);\n \n vec4 left = getSample(vec4(leftX, xyzw.zw, 0.0));\n vec4 right = getSample(vec4(rightX, xyzw.zw, 0.0));\n vec4 diff = right - left;\n\n vec3 normal = cross(normalize(diff.xyz + vec3(diff.w)), tickNormal);\n float bias = max(0.0, 1.0 - length(normal) * 2.0);\n normal = mix(normal, tickNormal.yzx, bias * bias);\n \n // transform (point) and (point + delta)\n vec4 center = getSample(vec4(xyzw.yzw, 0.0));\n vec4 delta = vec4(normal, 0.0) * epsilon;\n\n vec4 a = center;\n vec4 b = center + delta;\n\n vec4 _;\n vec3 c = transformPosition(a, stpqIn, stpqOut);\n vec3 d = transformPosition(b, stpqIn, _);\n \n // sample on either side to create line\n float line = xyzw.x - .5;\n vec3 mid = c;\n vec3 side = normalize(d - c);\n\n return mid + side * line * tickSize * worldUnit * focusDepth;\n}\n","transform3.position":"uniform mat4 transformMatrix;\n\nvec4 transformPosition(vec4 position, inout vec4 stpq) {\n return transformMatrix * vec4(position.xyz, 1.0);\n}\n","transform4.position":"uniform mat4 transformMatrix;\nuniform vec4 transformOffset;\n\nvec4 transformPosition(vec4 position, inout vec4 stpq) {\n return transformMatrix * position + transformOffset;\n}\n","view.position":"// Implicit three.js uniform\n// uniform mat4 viewMatrix;\n\nvec4 getViewPosition(vec4 position, inout vec4 stpq) {\n return (viewMatrix * vec4(position.xyz, 1.0));\n}\n"}},{}],2:[function(t,e,n){function r(t){return function(e){return s(e,i(t))}}function i(t){for(var e in t)o(t,e)&&(t[e]=Function("return function(node, attr) { return node."+t[e]+" }"),t[e]=t[e]());return t}function o(t,e){return t.hasOwnProperty(e)&&"string"==typeof t[e]}function s(t,e){function n(t){var e;return"comma"===t.type?void y.unshift(g=[]):"op"===t.type||"any-child"===t.type?(g.unshift(v[t.data]),void g.unshift(i())):(g[0]=g[0]||i(),e=g[0],"!"===t.type?void(e.subject=y[0].subject=!0):void e.push("class"===t.type?o(t.type,t.data):"attr"===t.type?s(t):":"===t.type||"::"===t.type?m(t):"*"===t.type?Boolean:h(t.type,t.data)))}function r(t,e){function n(t){for(var e;t.length;)e=t.shift(),-1===u.indexOf(e)&&u.push(e)}var r,i,o,s,u;o=t,u=[];for(var h=0,l=y.length;l>h;++h){g=y[h],r=a,i=g.length,t=o,s=[];for(var c=0;i>c&&(t=r(t,g[c],s),t);c+=2)r=g[c+1];if(c>=i){if(e)return!0;n(g.subject?s:[o])}}return e?!1:u.length?1===u.length?u[0]:u:!1}function i(){function t(e,n){for(var r=0,i=t.bits.length;i>r;++r)if(!t.bits[r](e))return!1;return t.subject&&n.push(e),!0}return t.bits=[],t.subject=!1,t.push=function(e){t.bits.push(e)},t}function o(t,n){return function(r){var i=e[t](r);return i=Array.isArray(i)?i:i?i.toString().split(/\s+/):[],i.indexOf(n)>=0}}function s(t){return t.data.lhs?c(e.attr,t.data.lhs,t.data.cmp,t.data.rhs):c(e.attr,t.data)}function h(t,n){return function(r){return e[t](r)==n}}function l(t,n,r){do t=e.parent(t);while(t&&!n(t,r));return t}function p(t,n,r){return t=e.parent(t),t&&n(t,r)?t:null}function f(t,n,r){var i,o=e.parent(t),s=0;i=e.children(o);for(var a=0,u=i.length;u>a;++a)if(i[a]===t){s=a;break}return i[s-1]&&n(i[s-1],r)?i[s-1]:null}function d(t,n,r){var i,o=e.parent(t);i=e.children(o);for(var s=0,a=i.length;a>s;++s){if(i[s]===t)return null;if(n(i[s],r))return i[s]}return null}function m(t){return u(e,t.data)}var v,g,E=T(),y=[[]];return g=y[0],v={"":l,">":p,"+":f,"~":d},E.on("data",n).end(t),r}function a(t,e,n){return e(t,n)?t:null}function u(t,e){switch(e){case"empty":return d(t);case"first-child":return p(t);case"last-child":return f(t);case"root":return m(t)}return 0===e.indexOf("contains")?v(t,e.slice(9,-1)):0===e.indexOf("any")?l(t,e.slice(4,-1)):0===e.indexOf("not")?h(t,e.slice(4,-1)):function(){return!1}}function h(t,e){function n(t){return!r(t,!0)}var r=s(e,t);return n}function l(t,e){var n=s(e,t);return n}function c(t,e,n,r){return function(i){var o=t(i,e);return n?1===n.length?o==r:void 0===o||null===o?!1:x[n.charAt(0)](o,r):!!o}}function p(t){return function(e){return t.children(t.parent(e))[0]===e}}function f(t){return function(e){var n=t.children(t.parent(e));return n[n.length-1]===e}}function d(t){return function(e){return 0===t.children(e).length}}function m(t){return function(e){return!t.parent(e)}}function v(t,e){return function(n){return-1!==t.contents(n).indexOf(e)}}function g(t,e){return t.slice(t.length-e.length)===e}function E(t,e){return t.slice(0,e.length)===e}function y(t,e){return t.indexOf(e)>-1}function _(t,e){return t.split(/\s+/).indexOf(e)>-1}function b(t,e){return t.split("-").indexOf(e)>-1}e.exports=r;var T=t("./tokenizer"),x={$:g,"^":E,"*":y,"~":_,"|":b}},{"./tokenizer":4}],3:[function(t,e,n){(function(r){function i(t,e,n){function i(){for(;h.length&&!c.paused;){var t=h.shift();if(null===t)return c.emit("end");c.emit("data",t)}}function s(){c.writable=!1,e.call(c),!c.readable&&c.autoDestroy&&c.destroy()}t=t||function(t){this.queue(t)},e=e||function(){this.queue(null)};var a=!1,u=!1,h=[],l=!1,c=new o;return c.readable=c.writable=!0,c.paused=!1,c.autoDestroy=!(n&&n.autoDestroy===!1),c.write=function(e){return t.call(this,e),!c.paused},c.queue=c.push=function(t){return l?c:(null===t&&(l=!0),h.push(t),i(),c)},c.on("end",function(){c.readable=!1,!c.writable&&c.autoDestroy&&r.nextTick(function(){c.destroy()})}),c.end=function(t){return a?void 0:(a=!0,arguments.length&&c.write(t),s(),c)},c.destroy=function(){return u?void 0:(u=!0,a=!0,h.length=0,c.writable=c.readable=!1,c.emit("close"),c)},c.pause=function(){return c.paused?void 0:(c.paused=!0,c)},c.resume=function(){return c.paused&&(c.paused=!1,c.emit("resume")),i(),c.paused||c.emit("drain"),c},c}var o=t("stream");n=e.exports=i,i.through=i}).call(this,t("1YiZ5S"))},{"1YiZ5S":10,stream:12}],4:[function(t,e,n){function r(){function t(t){for(j=j.concat(t.split("")),L=j.length;L>G&&(B=j[G++]);)switch(I){case p:n();break;case a:w();break;case f:x();break;case s:M();break;case u:S();break;case h:k();break;case c:case l:R();break;case o:H();break;case _:case E:case d:A()}j=j.slice(G)}function e(e){arguments.length&&t(e),V.length&&P.queue(C())}function n(){switch(!0){case"#"===B:I=_;break;case"."===B:I=d;break;case":"===B:I=c;break;case"["===B:I=s;break;case"!"===B:r();break;case"*"===B:b();break;case","===B:T();break;case/[>\+~]/.test(B):I=f;break;case/\s/.test(B):I=a;break;case/[\w\d\-_]/.test(B):I=E,--G}}function r(){I=g,V=["!"],P.queue(C()),I=p}function b(){I=y,V=["*"],P.queue(C()),I=p}function T(){I=m,V=[","],P.queue(C()),I=p}function x(){return/[>\+~]/.test(B)?V.push(B):void(/\s/.test(B)||(P.queue(C()),I=p,--G))}function w(){if(!/\s/.test(B)){if(/[>\+~]/.test(B))return--G,I=f;P.queue(C()),I=p,--G}}function R(){if(F=I,A(!0),I===p){if("("===B)return D=V.join(""),I=o,V.length=0,O=1,void++G;I=c,P.queue(C()),I=p}}function H(){if(0!==V.length||z||!(z=/['"]/.test(B)?B:null)){if(z)return N||B!==z?"\\"===B?void(N?V.push(B):N=!0):(N=!1,void V.push(B)):void(z=null);V.push(B),"("===B?++O:")"===B&&--O,O||(V.pop(),P.queue({type:F,data:D+"("+V.join("")+")"}),I=p,D=F=U=null,V.length=0)}}function M(){if(A(!0),I===p){if("]"===B)return I=v,P.queue(C()),void(I=p);D=V.join(""),V.length=0,I=u}}function S(){return/[=~|$^*]/.test(B)&&V.push(B),2===V.length||"="===B?(U=V.join(""),V.length=0,I=h,void(z=null)):void 0}function k(){if(V.length||z||!(z=/['"]/.test(B)?B:null)){if(z)return N||B!==z?"\\"===B?(N&&V.push(B),void(N=!N)):(N=!1,void V.push(B)):void(z=null);A(!0),I===p&&(P.queue({type:v,data:{lhs:D,rhs:V.join(""),cmp:U}}),I=p,D=F=U=null,V.length=0)}}function A(t){return/[^\d\w\-_]/.test(B)&&!N?void("\\"===B?N=!0:(!t&&P.queue(C()),I=p,--G)):(N=!1,void V.push(B))}function C(){var t=V.join("");return V.length=0,{type:I,data:t}}var P,L,z,O,D,F,U,B,N=!1,V=[],I=p,j=[],G=0;return P=i(t,e)}e.exports=r;var i=t("through"),o="pseudo-start",s="attr-start",a="any-child",u="attr-comp",h="attr-end",l="::",c=":",p="(ready)",f="op",d="class",m="comma",v="attr",g="!",E="tag",y="*",_="id"},{through:3}],5:[function(t,e,n){function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);var i=typeof t;if("base64"===e&&"string"===i)for(t=S(t);t.length%4!==0;)t+="=";var o;if("number"===i)o=A(t);else if("string"===i)o=r.byteLength(t,e);else{if("object"!==i)throw new Error("First argument needs to be a number, array or string.");o=A(t.length)}var s;r._useTypedArrays?s=r._augment(new Uint8Array(o)):(s=this,s.length=o,s._isBuffer=!0);var a;if(r._useTypedArrays&&"number"==typeof t.byteLength)s._set(t);else if(P(t))for(a=0;o>a;a++)r.isBuffer(t)?s[a]=t.readUInt8(a):s[a]=t[a];else if("string"===i)s.write(t,0,e);else if("number"===i&&!r._useTypedArrays&&!n)for(a=0;o>a;a++)s[a]=0;return s}function i(t,e,n,i){n=Number(n)||0;var o=t.length-n;i?(i=Number(i),i>o&&(i=o)):i=o;var s=e.length;j(s%2===0,"Invalid hex string"),i>s/2&&(i=s/2);for(var a=0;i>a;a++){var u=parseInt(e.substr(2*a,2),16);j(!isNaN(u),"Invalid hex string"),t[n+a]=u}return r._charsWritten=2*a,a}function o(t,e,n,i){var o=r._charsWritten=U(z(e),t,n,i);return o}function s(t,e,n,i){var o=r._charsWritten=U(O(e),t,n,i);return o}function a(t,e,n,r){return s(t,e,n,r)}function u(t,e,n,i){var o=r._charsWritten=U(F(e),t,n,i);return o}function h(t,e,n,i){var o=r._charsWritten=U(D(e),t,n,i);return o}function l(t,e,n){return 0===e&&n===t.length?G.fromByteArray(t):G.fromByteArray(t.slice(e,n))}function c(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;n>o;o++)t[o]<=127?(r+=B(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return r+B(i)}function p(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(t[i]);return r}function f(t,e,n){return p(t,e,n)}function d(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=e;n>o;o++)i+=L(t[o]);return i}function m(t,e,n){for(var r=t.slice(e,n),i="",o=0;o=i)){var o;return n?(o=t[e],i>e+1&&(o|=t[e+1]<<8)):(o=t[e]<<8,i>e+1&&(o|=t[e+1])),o}}function g(t,e,n,r){r||(j("boolean"==typeof n,"missing or invalid endian"),j(void 0!==e&&null!==e,"missing offset"),j(e+3=i)){var o;return n?(i>e+2&&(o=t[e+2]<<16),i>e+1&&(o|=t[e+1]<<8),o|=t[e],i>e+3&&(o+=t[e+3]<<24>>>0)):(i>e+1&&(o=t[e+1]<<16),i>e+2&&(o|=t[e+2]<<8),i>e+3&&(o|=t[e+3]),o+=t[e]<<24>>>0),o}}function E(t,e,n,r){r||(j("boolean"==typeof n,"missing or invalid endian"),j(void 0!==e&&null!==e,"missing offset"),j(e+1=i)){var o=v(t,e,n,!0),s=32768&o;return s?-1*(65535-o+1):o}}function y(t,e,n,r){r||(j("boolean"==typeof n,"missing or invalid endian"),j(void 0!==e&&null!==e,"missing offset"),j(e+3=i)){var o=g(t,e,n,!0),s=2147483648&o;return s?-1*(4294967295-o+1):o}}function _(t,e,n,r){return r||(j("boolean"==typeof n,"missing or invalid endian"),j(e+3=o))for(var s=0,a=Math.min(o-n,2);a>s;s++)t[n+s]=(e&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function x(t,e,n,r,i){i||(j(void 0!==e&&null!==e,"missing value"),j("boolean"==typeof r,"missing or invalid endian"),j(void 0!==n&&null!==n,"missing offset"),j(n+3=o))for(var s=0,a=Math.min(o-n,4);a>s;s++)t[n+s]=e>>>8*(r?s:3-s)&255}function w(t,e,n,r,i){i||(j(void 0!==e&&null!==e,"missing value"),j("boolean"==typeof r,"missing or invalid endian"),j(void 0!==n&&null!==n,"missing offset"),j(n+1=o||(e>=0?T(t,e,n,r,i):T(t,65535+e+1,n,r,i))}function R(t,e,n,r,i){i||(j(void 0!==e&&null!==e,"missing value"),j("boolean"==typeof r,"missing or invalid endian"),j(void 0!==n&&null!==n,"missing offset"),j(n+3=o||(e>=0?x(t,e,n,r,i):x(t,4294967295+e+1,n,r,i))}function H(t,e,n,r,i){i||(j(void 0!==e&&null!==e,"missing value"),j("boolean"==typeof r,"missing or invalid endian"),j(void 0!==n&&null!==n,"missing offset"),j(n+3=o||W.write(t,e,n,r,23,4)}function M(t,e,n,r,i){i||(j(void 0!==e&&null!==e,"missing value"),j("boolean"==typeof r,"missing or invalid endian"),j(void 0!==n&&null!==n,"missing offset"),j(n+7=o||W.write(t,e,n,r,52,8)}function S(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function k(t,e,n){return"number"!=typeof t?n:(t=~~t,t>=e?e:t>=0?t:(t+=e,t>=0?t:0))}function A(t){return t=~~Math.ceil(+t),0>t?0:t}function C(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function P(t){return C(t)||r.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function L(t){return 16>t?"0"+t.toString(16):t.toString(16)}function z(t){for(var e=[],n=0;n=r)e.push(t.charCodeAt(n));else{var i=n;r>=55296&&57343>=r&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),s=0;s>8,r=e%256,i.push(r),i.push(n);return i}function F(t){return G.toByteArray(t)}function U(t,e,n,r){for(var i=0;r>i&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function B(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function N(t,e){j("number"==typeof t,"cannot write a non-number as a number"),j(t>=0,"specified a negative value for writing an unsigned value"),j(e>=t,"value is larger than maximum value for type"),j(Math.floor(t)===t,"value has a fractional component")}function V(t,e,n){j("number"==typeof t,"cannot write a non-number as a number"),j(e>=t,"value larger than maximum allowed value"),j(t>=n,"value smaller than minimum allowed value"),j(Math.floor(t)===t,"value has a fractional component")}function I(t,e,n){j("number"==typeof t,"cannot write a non-number as a number"),j(e>=t,"value larger than maximum allowed value"),j(t>=n,"value smaller than minimum allowed value")}function j(t,e){if(!t)throw new Error(e||"Failed assertion")}var G=t("base64-js"),W=t("ieee754");n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192,r._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(n){return!1}}(),r.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.isBuffer=function(t){return!(null===t||void 0===t||!t._isBuffer)},r.byteLength=function(t,e){var n;switch(t+="",e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=z(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=F(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw new Error("Unknown encoding")}return n},r.concat=function(t,e){if(j(C(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new r(0);if(1===t.length)return t[0];var n;if("number"!=typeof e)for(e=0,n=0;nc&&(n=c)):n=c,r=String(r||"utf8").toLowerCase();var p;switch(r){case"hex":p=i(this,t,e,n);break;case"utf8":case"utf-8":p=o(this,t,e,n);break;case"ascii":p=s(this,t,e,n);break;case"binary":p=a(this,t,e,n);break;case"base64":p=u(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":p=h(this,t,e,n);break;default:throw new Error("Unknown encoding")}return p},r.prototype.toString=function(t,e,n){var r=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,n=void 0!==n?Number(n):n=r.length,n===e)return"";var i;switch(t){case"hex":i=d(r,e,n);break;case"utf8":case"utf-8":i=c(r,e,n);break;case"ascii":i=p(r,e,n);break;case"binary":i=f(r,e,n);break;case"base64":i=l(r,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=m(r,e,n);break;default:throw new Error("Unknown encoding")}return i},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.copy=function(t,e,n,i){var o=this;if(n||(n=0),i||0===i||(i=this.length),e||(e=0),i!==n&&0!==t.length&&0!==o.length){j(i>=n,"sourceEnd < sourceStart"),j(e>=0&&e=0&&n=0&&i<=o.length,"sourceEnd out of bounds"),i>this.length&&(i=this.length),t.length-es||!r._useTypedArrays)for(var a=0;s>a;a++)t[a+e]=this[a+n];else t._set(this.subarray(n,n+s),e)}},r.prototype.slice=function(t,e){var n=this.length;if(t=k(t,n,0),e=k(e,n,n),r._useTypedArrays)return r._augment(this.subarray(t,e));for(var i=e-t,o=new r(i,void 0,!0),s=0;i>s;s++)o[s]=this[s+t];return o},r.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},r.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},r.prototype.readUInt8=function(t,e){return e||(j(void 0!==t&&null!==t,"missing offset"),j(t=this.length?void 0:this[t]},r.prototype.readUInt16LE=function(t,e){return v(this,t,!0,e)},r.prototype.readUInt16BE=function(t,e){return v(this,t,!1,e)},r.prototype.readUInt32LE=function(t,e){return g(this,t,!0,e)},r.prototype.readUInt32BE=function(t,e){return g(this,t,!1,e)},r.prototype.readInt8=function(t,e){if(e||(j(void 0!==t&&null!==t,"missing offset"),j(t=this.length)){var n=128&this[t];return n?-1*(255-this[t]+1):this[t]}},r.prototype.readInt16LE=function(t,e){return E(this,t,!0,e)},r.prototype.readInt16BE=function(t,e){return E(this,t,!1,e)},r.prototype.readInt32LE=function(t,e){return y(this,t,!0,e)},r.prototype.readInt32BE=function(t,e){return y(this,t,!1,e)},r.prototype.readFloatLE=function(t,e){return _(this,t,!0,e)},r.prototype.readFloatBE=function(t,e){return _(this,t,!1,e)},r.prototype.readDoubleLE=function(t,e){return b(this,t,!0,e)},r.prototype.readDoubleBE=function(t,e){return b(this,t,!1,e)},r.prototype.writeUInt8=function(t,e,n){n||(j(void 0!==t&&null!==t,"missing value"),j(void 0!==e&&null!==e,"missing offset"),j(e=this.length||(this[e]=t)},r.prototype.writeUInt16LE=function(t,e,n){T(this,t,e,!0,n)},r.prototype.writeUInt16BE=function(t,e,n){T(this,t,e,!1,n)},r.prototype.writeUInt32LE=function(t,e,n){x(this,t,e,!0,n)},r.prototype.writeUInt32BE=function(t,e,n){x(this,t,e,!1,n)},r.prototype.writeInt8=function(t,e,n){n||(j(void 0!==t&&null!==t,"missing value"),j(void 0!==e&&null!==e,"missing offset"),j(e=this.length||(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},r.prototype.writeInt16LE=function(t,e,n){w(this,t,e,!0,n)},r.prototype.writeInt16BE=function(t,e,n){ +w(this,t,e,!1,n)},r.prototype.writeInt32LE=function(t,e,n){R(this,t,e,!0,n)},r.prototype.writeInt32BE=function(t,e,n){R(this,t,e,!1,n)},r.prototype.writeFloatLE=function(t,e,n){H(this,t,e,!0,n)},r.prototype.writeFloatBE=function(t,e,n){H(this,t,e,!1,n)},r.prototype.writeDoubleLE=function(t,e,n){M(this,t,e,!0,n)},r.prototype.writeDoubleBE=function(t,e,n){M(this,t,e,!1,n)},r.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),j("number"==typeof t&&!isNaN(t),"value is not a number"),j(n>=e,"end < start"),n!==e&&0!==this.length){j(e>=0&&e=0&&n<=this.length,"end out of bounds");for(var r=e;n>r;r++)this[r]=t}},r.prototype.inspect=function(){for(var t=[],e=this.length,r=0;e>r;r++)if(t[r]=L(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r._useTypedArrays)return new r(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;n>e;e+=1)t[e]=this[e];return t.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var q=r.prototype;r._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=q.get,t.set=q.set,t.write=q.write,t.toString=q.toString,t.toLocaleString=q.toString,t.toJSON=q.toJSON,t.copy=q.copy,t.slice=q.slice,t.readUInt8=q.readUInt8,t.readUInt16LE=q.readUInt16LE,t.readUInt16BE=q.readUInt16BE,t.readUInt32LE=q.readUInt32LE,t.readUInt32BE=q.readUInt32BE,t.readInt8=q.readInt8,t.readInt16LE=q.readInt16LE,t.readInt16BE=q.readInt16BE,t.readInt32LE=q.readInt32LE,t.readInt32BE=q.readInt32BE,t.readFloatLE=q.readFloatLE,t.readFloatBE=q.readFloatBE,t.readDoubleLE=q.readDoubleLE,t.readDoubleBE=q.readDoubleBE,t.writeUInt8=q.writeUInt8,t.writeUInt16LE=q.writeUInt16LE,t.writeUInt16BE=q.writeUInt16BE,t.writeUInt32LE=q.writeUInt32LE,t.writeUInt32BE=q.writeUInt32BE,t.writeInt8=q.writeInt8,t.writeInt16LE=q.writeInt16LE,t.writeInt16BE=q.writeInt16BE,t.writeInt32LE=q.writeInt32LE,t.writeInt32BE=q.writeInt32BE,t.writeFloatLE=q.writeFloatLE,t.writeFloatBE=q.writeFloatBE,t.writeDoubleLE=q.writeDoubleLE,t.writeDoubleBE=q.writeDoubleBE,t.fill=q.fill,t.inspect=q.inspect,t.toArrayBuffer=q.toArrayBuffer,t}},{"base64-js":6,ieee754:7}],6:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===s||e===c?62:e===a||e===p?63:u>e?-1:u+10>e?e-u+26+26:l+26>e?e-l:h+26>e?e-h+26:void 0}function n(t){function n(t){h[c++]=t}var r,i,s,a,u,h;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=t.length;u="="===t.charAt(l-2)?2:"="===t.charAt(l-1)?1:0,h=new o(3*t.length/4-u),s=u>0?t.length-4:t.length;var c=0;for(r=0,i=0;s>r;r+=4,i+=3)a=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===u?(a=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&a)):1===u&&(a=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(a>>8&255),n(255&a)),h}function i(t){function e(t){return r.charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,o,s,a=t.length%3,u="";for(i=0,s=t.length-a;s>i;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=n(o);switch(a){case 1:o=t[t.length-1],u+=e(o>>2),u+=e(o<<4&63),u+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],u+=e(o>>10),u+=e(o>>4&63),u+=e(o<<2&63),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),h="a".charCodeAt(0),l="A".charCodeAt(0),c="-".charCodeAt(0),p="_".charCodeAt(0);t.toByteArray=n,t.fromByteArray=i}("undefined"==typeof n?this.base64js={}:n)},{}],7:[function(t,e,n){n.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,l=-7,c=n?i-1:0,p=n?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+t[e+c],c+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+c],c+=p,l-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:(f?-1:1)*(1/0);s+=Math.pow(2,r),o-=h}return(f?-1:1)*s*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var s,a,u,h=8*o-i-1,l=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1,m=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),e+=s+c>=1?p/u:p*Math.pow(2,1-c),e*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=d,s/=256,h-=8);t[n+f-d]|=128*m}},{}],8:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,u,h;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],a(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),u=1;r>u;u++)o[u-1]=arguments[u];n.apply(this,o)}else if(s(n)){for(r=arguments.length,o=new Array(r-1),u=1;r>u;u++)o[u-1]=arguments[u];for(h=n.slice(),r=h.length,u=0;r>u;u++)h[u].apply(this,o)}return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?s(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,s(this._events[t])&&!this._events[t].warned){var n;n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(a=o;a-->0;)if(n[a]===e||n[a].listener&&n[a].listener===e){r=a;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.listenerCount=function(t,e){var n;return n=t._events&&t._events[e]?i(t._events[e])?1:t._events[e].length:0}},{}],9:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],10:[function(t,e,n){function r(){}var i=e.exports={};i.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=r,i.addListener=r,i.once=r,i.off=r,i.removeListener=r,i.removeAllListeners=r,i.emit=r,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],11:[function(t,e,n){function r(t){return this instanceof r?(a.call(this,t),u.call(this,t),t&&t.readable===!1&&(this.readable=!1),t&&t.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,t&&t.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(t)}function i(){if(!this.allowHalfOpen&&!this._writableState.ended){var t=this;s(function(){t.end()})}}e.exports=r;var o=t("inherits"),s=t("process/browser.js").nextTick,a=t("./readable.js"),u=t("./writable.js");o(r,a),r.prototype.write=u.prototype.write,r.prototype.end=u.prototype.end,r.prototype._write=u.prototype._write},{"./readable.js":15,"./writable.js":17,inherits:9,"process/browser.js":13}],12:[function(t,e,n){function r(){i.call(this)}e.exports=r;var i=t("events").EventEmitter,o=t("inherits");o(r,i),r.Readable=t("./readable.js"),r.Writable=t("./writable.js"),r.Duplex=t("./duplex.js"),r.Transform=t("./transform.js"),r.PassThrough=t("./passthrough.js"),r.Stream=r,r.prototype.pipe=function(t,e){function n(e){t.writable&&!1===t.write(e)&&h.pause&&h.pause()}function r(){h.readable&&h.resume&&h.resume()}function o(){l||(l=!0,t.end())}function s(){l||(l=!0,"function"==typeof t.destroy&&t.destroy())}function a(t){if(u(),0===i.listenerCount(this,"error"))throw t}function u(){h.removeListener("data",n),t.removeListener("drain",r),h.removeListener("end",o),h.removeListener("close",s),h.removeListener("error",a),t.removeListener("error",a),h.removeListener("end",u),h.removeListener("close",u),t.removeListener("close",u)}var h=this;h.on("data",n),t.on("drain",r),t._isStdio||e&&e.end===!1||(h.on("end",o),h.on("close",s));var l=!1;return h.on("error",a),t.on("error",a),h.on("end",u),h.on("close",u),t.on("close",u),t.emit("pipe",h),t}},{"./duplex.js":11,"./passthrough.js":14,"./readable.js":15,"./transform.js":16,"./writable.js":17,events:8,inherits:9}],13:[function(t,e,n){var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],14:[function(t,e,n){function r(t){return this instanceof r?void i.call(this,t):new r(t)}e.exports=r;var i=t("./transform.js"),o=t("inherits");o(r,i),r.prototype._transform=function(t,e,n){n(null,t)}},{"./transform.js":16,inherits:9}],15:[function(t,e,n){(function(n){function r(e,n){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(x||(x=t("string_decoder").StringDecoder),this.decoder=new x(e.encoding),this.encoding=e.encoding)}function i(t){return this instanceof i?(this._readableState=new r(t,this),this.readable=!0,void R.call(this)):new i(t)}function o(t,e,n,r,i){var o=h(e,n);if(o)t.emit("error",o);else if(null===n||void 0===n)e.reading=!1,e.ended||l(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!i){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&i){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else!e.decoder||i||r||(n=e.decoder.write(n)),e.length+=e.objectMode?1:n.length,i?e.buffer.unshift(n):(e.reading=!1,e.buffer.push(n)),e.needReadable&&c(t),f(t,e);else i||(e.reading=!1);return s(e)}function s(t){return!t.ended&&(t.needReadable||t.length=k)t=k;else{t--;for(var e=1;32>e;e<<=1)t|=t>>e;t++}return t}function u(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:isNaN(t)||null===t?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:0>=t?0:(t>e.highWaterMark&&(e.highWaterMark=a(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function h(t,e){var n=null;return H.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||n||(n=new TypeError("Invalid non-string/buffer chunk")),n}function l(t,e){if(e.decoder&&!e.ended){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.length>0?c(t):_(t)}function c(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,e.sync?M(function(){p(t)}):p(t))}function p(t){t.emit("readable")}function f(t,e){e.readingMore||(e.readingMore=!0,M(function(){d(t,e)}))}function d(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length0)return;return 0===r.pipesCount?(r.flowing=!1,void(w.listenerCount(t,"data")>0&&E(t))):void(r.ranOut=!0)}function g(){this._readableState.ranOut&&(this._readableState.ranOut=!1,v(this))}function E(t,e){var n=t._readableState;if(n.flowing)throw new Error("Cannot switch to old mode now.");var r=e||!1,i=!1;t.readable=!0,t.pipe=R.prototype.pipe,t.on=t.addListener=R.prototype.on,t.on("readable",function(){i=!0;for(var e;!r&&null!==(e=t.read());)t.emit("data",e);null===e&&(i=!1,t._readableState.needReadable=!0)}),t.pause=function(){r=!0,this.emit("pause")},t.resume=function(){r=!1,i?M(function(){t.emit("readable")}):this.read(0),this.emit("resume")},t.emit("readable")}function y(t,e){var n,r=e.buffer,i=e.length,o=!!e.decoder,s=!!e.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(s)n=r.shift();else if(!t||t>=i)n=o?r.join(""):H.concat(r,i),r.length=0;else if(th&&t>u;h++){var a=r[0],c=Math.min(t-u,a.length);o?n+=a.slice(0,c):a.copy(n,u,0,c),c0)throw new Error("endReadable called on non-empty stream");!e.endEmitted&&e.calledRead&&(e.ended=!0,M(function(){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}))}function b(t,e){for(var n=0,r=t.length;r>n;n++)e(t[n],n)}function T(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n]===e)return n;return-1}e.exports=i,i.ReadableState=r;var x,w=t("events").EventEmitter,R=t("./index.js"),H=t("buffer").Buffer,M=t("process/browser.js").nextTick,S=t("inherits");S(i,R),i.prototype.push=function(t,e){var n=this._readableState;return"string"!=typeof t||n.objectMode||(e=e||n.defaultEncoding,e!==n.encoding&&(t=new H(t,e),e="")),o(this,n,t,e,!1)},i.prototype.unshift=function(t){var e=this._readableState;return o(this,e,t,"",!0)},i.prototype.setEncoding=function(e){x||(x=t("string_decoder").StringDecoder),this._readableState.decoder=new x(e),this._readableState.encoding=e};var k=8388608;i.prototype.read=function(t){var e=this._readableState;e.calledRead=!0;var n=t;if(("number"!=typeof t||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c(this),null;if(t=u(t,e),0===t&&e.ended)return 0===e.length&&_(this),null;var r=e.needReadable;e.length-t<=e.highWaterMark&&(r=!0),(e.ended||e.reading)&&(r=!1),r&&(e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1),r&&!e.reading&&(t=u(n,e));var i;return i=t>0?y(t,e):null,null===i&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),e.ended&&!e.endEmitted&&0===e.length&&_(this),i},i.prototype._read=function(t){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(t,e){function r(t){t===l&&o()}function i(){t.end()}function o(){t.removeListener("close",a),t.removeListener("finish",u),t.removeListener("drain",d),t.removeListener("error",s),t.removeListener("unpipe",r),l.removeListener("end",i),l.removeListener("end",o),(!t._writableState||t._writableState.needDrain)&&d()}function s(e){h(),0===E&&0===w.listenerCount(t,"error")&&t.emit("error",e)}function a(){t.removeListener("finish",u),h()}function u(){t.removeListener("close",a),h()}function h(){l.unpipe(t)}var l=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1;var p=(!e||e.end!==!1)&&t!==n.stdout&&t!==n.stderr,f=p?i:o;c.endEmitted?M(f):l.once("end",f),t.on("unpipe",r);var d=m(l);t.on("drain",d);var E=w.listenerCount(t,"error");return t.once("error",s),t.once("close",a),t.once("finish",u),t.emit("pipe",l),c.flowing||(this.on("readable",g),c.flowing=!0,M(function(){v(l)})),t},i.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,this.removeListener("readable",g),e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,this.removeListener("readable",g),e.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=T(e.pipes,t);return-1===i?this:(e.pipes.splice(i,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},i.prototype.on=function(t,e){var n=R.prototype.on.call(this,t,e);if("data"!==t||this._readableState.flowing||E(this),"readable"===t&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&c(this,r):this.read(0))}return n},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){E(this),this.read(0),this.emit("resume")},i.prototype.pause=function(){E(this,!0),this.emit("pause")},i.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;t.on("end",function(){if(e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)}),t.on("data",function(i){if(e.decoder&&(i=e.decoder.write(i)),i&&(e.objectMode||i.length)){var o=r.push(i);o||(n=!0,t.pause())}});for(var i in t)"function"==typeof t[i]&&"undefined"==typeof this[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return b(o,function(e){t.on(e,function(t){return r.emit.apply(r,e,t)})}),r._read=function(e){n&&(n=!1,t.resume())},r},i._fromList=y}).call(this,t("1YiZ5S"))},{"./index.js":12,"1YiZ5S":10,buffer:5,events:8,inherits:9,"process/browser.js":13,string_decoder:18}],16:[function(t,e,n){function r(t,e){this.afterTransform=function(t,n){return i(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!==n&&void 0!==n&&t.push(n),i&&i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,n,r),this.charReceived+=r-n,n=r,this.charReceived=55296&&56319>=i)){if(this.charReceived=this.charLength=0,r==t.length)return e;t=t.slice(r,t.length);break}this.charLength+=this.surrogateSize,e=""}var o=this.detectIncompleteChar(t),s=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-o,s),this.charReceived=o,s-=o),e+=t.toString(this.encoding,0,s);var s=e.length-1,i=e.charCodeAt(s);if(i>=55296&&56319>=i){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(e.charAt(e.length-1),this.encoding),e.substring(0,s)}return e},u.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(2>=e&&n>>4==14){this.charLength=3;break}if(3>=e&&n>>3==30){this.charLength=4;break}}return e},u.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},{buffer:5}],19:[function(t,e,n){var r=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};n.setOrigin=function(t,e,n){var i,o,s,a;return+e===e&&(e=[e]),o=r.call(e,1)>=0?0:n.x,s=r.call(e,2)>=0?0:n.y,a=r.call(e,3)>=0?0:n.z,i=r.call(e,4)>=0?0:n.w,t.set(o,s,a,i)},n.addOrigin=function(){var t;return t=new THREE.Vector4,function(e,r,i){return n.setOrigin(t,r,i),e.add(t)}}(),n.setDimension=function(t,e){var n,r,i,o;return r=1===e?1:0,i=2===e?1:0,o=3===e?1:0,n=4===e?1:0,t.set(r,i,o,n)},n.setDimensionNormal=function(t,e){var n,r,i,o;return r=1===e?1:0,i=2===e?1:0,o=3===e?1:0,n=4===e?1:0,t.set(i,o+r,n,0)},n.recenterAxis=function(){var t;return t=[0,0],function(e,n,r,i){var o,s,a,u,h,l;return null==i&&(i=0),r>0&&(h=e,l=e+n,o=Math.max(Math.abs(h),Math.abs(l)),s=o*i,u=Math.min(h,l),a=Math.max(h,l),e=u+(-o+s-u)*r,n=a+(o+s-a)*r-e),t[0]=e,t[1]=n,t}}()},{}],20:[function(t,e,n){var r;n.getSizes=r=function(t){var e,n;for(n=[],e=t;"string"!=typeof e&&null!=(null!=e?e.length:void 0);)n.push(e.length),e=e[0];return n},n.getDimensions=function(t,e){var n,i,o,s,a,u,h,l,c,p,f,d,m,v,g;return null==e&&(e={}),a=e.items,n=e.channels,g=e.width,s=e.height,i=e.depth,o={},t&&t.length?(v=r(t),l=v.length,o.channels=1!==n&&v.length>1?v.pop():n,o.items=1!==a&&v.length>1?v.pop():a,o.width=1!==g&&v.length>1?v.pop():g,o.height=1!==s&&v.length>1?v.pop():s,o.depth=1!==i&&v.length>1?v.pop():i,u=l,1===n&&u++,1===a&&u>1&&u++,1===g&&u>2&&u++,1===s&&u>3&&u++,h=null!=(c=v.pop())?c:1,1>=u&&(h/=null!=(p=o.channels)?p:1),2>=u&&(h/=null!=(f=o.items)?f:1),3>=u&&(h/=null!=(d=o.width)?d:1),4>=u&&(h/=null!=(m=o.height)?m:1),h=Math.floor(h),null==o.width&&(o.width=h,h=1),null==o.height&&(o.height=h,h=1),null==o.depth&&(o.depth=h,h=1),o):{items:a,channels:n,width:null!=g?g:0,height:null!=s?s:0,depth:null!=i?i:0}},n.repeatCall=function(t,e){switch(e){case 0:return function(){return!0};case 1:return function(){return t()};case 2:return function(){return t(),t()};case 3:return function(){return t(),t(),t(),t()};case 4:return function(){return t(),t(),t(),t()};case 6:return function(){return t(),t(),t(),t(),t(),t()};case 8:return function(){return t(),t(),t(),t(),t(),t()}}},n.makeEmitter=function(t,e,n){var r,i,o,s;for(r=function(){switch(n){case 0:return function(){return!0};case 1:return function(e){return e(t())};case 2:return function(e){return e(t(),t())};case 3:return function(e){return e(t(),t(),t())};case 4:return function(e){return e(t(),t(),t(),t())};case 6:return function(e){return e(t(),t(),t(),t(),t(),t())};case 8:return function(e){return e(t(),t(),t(),t(),t(),t(),t(),t())}}}(),o=null;e>0;)i=Math.min(e,8),s=function(){switch(i){case 1:return function(t){return r(t)};case 2:return function(t){return r(t),r(t)};case 3:return function(t){return r(t),r(t),r(t)};case 4:return function(t){return r(t),r(t),r(t),r(t)};case 5:return function(t){return r(t),r(t),r(t),r(t),r(t)};case 6:return function(t){return r(t),r(t),r(t),r(t),r(t),r(t)};case 7:return function(t){return r(t),r(t),r(t),r(t),r(t),r(t),r(t)};case 8:return function(t){return r(t),r(t),r(t),r(t),r(t),r(t),r(t),r(t)}}}(),o=null!=o?function(t,e){return function(n){return t(n),e(n)}}(s,o):s,e-=i;return s=null!=o?o:function(){return!0},s.reset=t.reset,s.rebind=t.rebind,s},n.getThunk=function(t){var e,n,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S;switch(H=r(t),d=H.length,e=H.pop(),n=H.pop(),i=H.pop(),o=H.pop(),s=!1,d){case 0:S=function(){return 0},S.reset=function(){};break;case 1:h=0,S=function(){return t[h++]},S.reset=function(){return h=0};break;case 2:h=l=0,a=null!=(m=t[l])?m:[],S=function(){var n,r;return r=a[h++],h===e&&(h=0,l++,a=null!=(n=t[l])?n:[]),r},S.reset=function(){var e;h=l=0,a=null!=(e=t[l])?e:[]};break;case 3:h=l=c=0,R=null!=(v=t[c])?v:[],a=null!=(g=R[l])?g:[],S=function(){var r,i,o;return o=a[h++],h===e&&(h=0,l++,l===n&&(l=0,c++,R=null!=(r=t[c])?r:[]), +a=null!=(i=R[l])?i:[]),o},S.reset=function(){var e,n;h=l=c=0,R=null!=(e=t[c])?e:[],a=null!=(n=R[l])?n:[]};break;case 4:h=l=c=p=0,M=null!=(E=t[p])?E:[],R=null!=(y=M[c])?y:[],a=null!=(_=R[l])?_:[],S=function(){var r,o,s,u;return u=a[h++],h===e&&(h=0,l++,l===n&&(l=0,c++,c===i&&(c=0,p++,M=null!=(r=t[p])?r:[]),R=null!=(o=M[c])?o:[]),a=null!=(s=R[l])?s:[]),u},S.reset=function(){var e,n,r;h=l=c=p=0,M=null!=(e=t[p])?e:[],R=null!=(n=M[c])?n:[],a=null!=(r=R[l])?r:[]};break;case 5:h=l=c=p=f=0,u=null!=(b=t[f])?b:[],M=null!=(T=u[p])?T:[],R=null!=(x=M[c])?x:[],a=null!=(w=R[l])?w:[],S=function(){var r,s,d,m,v;return v=a[h++],h===e&&(h=0,l++,l===n&&(l=0,c++,c===i&&(c=0,p++,p===o&&(p=0,f++,u=null!=(r=t[f])?r:[]),M=null!=(s=u[p])?s:[]),R=null!=(d=M[c])?d:[]),a=null!=(m=R[l])?m:[]),v},S.reset=function(){var e,n,r,i;h=l=c=p=f=0,u=null!=(e=t[f])?e:[],M=null!=(n=u[p])?n:[],R=null!=(r=M[c])?r:[],a=null!=(i=R[l])?i:[]}}return S.rebind=function(o){return t=o,H=r(t),H.length&&(e=H.pop()),H.length&&(n=H.pop()),H.length&&(i=H.pop()),H.length?o=H.pop():void 0},S},n.getStreamer=function(t,e,n,r){var i,o,s,a,u,h,l,c,p;return l=u=h=0,c=function(){return l=e*n*r,u=h=0},o=function(){return h},s=function(){return 0>=l-u},p=function(){switch(n){case 1:return function(t){u+=t,h+=t};case 2:return function(t){u+=2*t,h+=t};case 3:return function(t){u+=3*t,h+=t};case 4:return function(t){u+=4*t,h+=t}}}(),i=function(){switch(n){case 1:return function(e){e(t[u++]),++h};case 2:return function(e){e(t[u++],t[u++]),++h};case 3:return function(e){e(t[u++],t[u++],t[u++]),++h};case 4:return function(e){e(t[u++],t[u++],t[u++],t[u++]),++h}}}(),a=function(){switch(n){case 1:return function(e){t[u++]=e,++h};case 2:return function(e,n){t[u++]=e,t[u++]=n,++h};case 3:return function(e,n,r){t[u++]=e,t[u++]=n,t[u++]=r,++h};case 4:return function(e,n,r,i){t[u++]=e,t[u++]=n,t[u++]=r,t[u++]=i,++h}}}(),i.reset=c,a.reset=c,c(),{emit:a,consume:i,skip:p,count:o,done:s,reset:c}},n.getLerpEmitter=function(t,e){var n,r,i,o,s,a,u,h,l,c,p;return p=new Float32Array(4096),s=a=.5,u=h=l=c=0,r=function(t,e,n,r){return l++,p[u++]=t*s,p[u++]=e*s,p[u++]=n*s,p[u++]=r*s},i=function(t,e,n,r){return c++,p[h++]+=t*a,p[h++]+=e*a,p[h++]+=n*a,p[h++]+=r*a},n=Math.max(t.length,e.length),o=3>=n?function(n,o,s){var a,f,d,m,v,g;for(u=h=l=c=0,t(r,o,s),e(i,o,s),d=Math.min(l,c),f=0,g=[],a=m=0,v=d;v>=0?v>m:m>v;a=v>=0?++m:--m)g.push(n(p[f++],p[f++],p[f++],p[f++]));return g}:5>=n?function(n,o,s,a,f){var d,m,v,g,E,y;for(u=h=l=c=0,t(r,o,s,a,f),e(i,o,s,a,f),v=Math.min(l,c),m=0,y=[],d=g=0,E=v;E>=0?E>g:g>E;d=E>=0?++g:--g)y.push(n(p[m++],p[m++],p[m++],p[m++]));return y}:7>=n?function(n,o,s,a,f,d,m){var v,g,E,y,_;for(u=h=l=c=0,t(r,o,s,a,f,d,m),e(i,o,s,a,f,d,m),g=Math.min(l,c),v=0,_=[],m=E=0,y=g;y>=0?y>E:E>y;m=y>=0?++E:--E)_.push(n(p[v++],p[v++],p[v++],p[v++]));return _}:9>=n?function(n,o,s,a,f,d,m,v,g){var E,y,_,b;for(u=h=l=c=0,t(r,o,s,a,f,d,m,v,g),e(i,o,s,a,f,d,m,v,g),E=Math.min(l,c),g=0,b=[],v=y=0,_=E;_>=0?_>y:y>_;v=_>=0?++y:--y)b.push(n(p[g++],p[g++],p[g++],p[g++]));return b}:function(n,o,s,a,f,d,m,v,g,E,y){var _,b,T,x;for(u=h=0,t(r,o,s,a,f,d,m,v,g,E,y),e(i,o,s,a,f,d,m,v,g,E,y),_=Math.min(l,c),g=0,x=[],v=b=0,T=_;T>=0?T>b:b>T;v=T>=0?++b:--b)x.push(n(p[g++],p[g++],p[g++],p[g++]));return x},o.lerp=function(t){var e;return e=[1-t,t],s=e[0],a=e[1],e},o},n.getLerpThunk=function(t,e){var r,i,o,s,a,u;return i=n.getSizes(t).reduce(function(t,e){return t*e}),o=n.getSizes(e).reduce(function(t,e){return t*e}),r=Math.min(i,o),a=n.getThunk(t),u=n.getThunk(e),s=new Float32Array(r),s.lerp=function(t){var e,n,i,o;for(a.reset(),u.reset(),i=0,o=[];r>i;)e=a(),n=u(),o.push(s[i++]=e+(n-e)*t);return o},s}},{}],21:[function(t,e,n){var r,i;i=Math.PI,r={clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},cosine:function(t){return.5-.5*Math.cos(r.clamp(t,0,1)*i)},binary:function(t){return+(t>=.5)},hold:function(t){return+(t>=1)}},e.exports=r},{}],22:[function(t,e,n){var r,i,o,s,a,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i="xyzw".split(""),r={0:-1,x:0,y:1,z:2,w:3},o=function(t){return t===""+t&&(t=t.split("")),t===+t&&(t=[t]),t},a=function(t){return t===+t&&(t="vec"+t),"vec1"===t&&(t="float"),t},s=function(t){return t=""+t,t.indexOf(".")<0?t+=".0":void 0},n.mapByte2FloatOffset=function(t){var e;return null==t&&(t=4),e=s(t),"vec4 float2ByteIndex(vec4 xyzw, out float channelIndex) {\n float relative = xyzw.w / "+e+";\n float w = floor(relative);\n channelIndex = (relative - w) * "+e+";\n return vec4(xyzw.xyz, w);\n}"},n.sample2DArray=function(t){var e,n;return n=function(t,e){var r,i;return t===e?i="return texture2D(dataTextures["+t+"], uv);":(r=Math.ceil(t+(e-t)/2),i="if (z < "+(r-.5)+") {\n "+n(t,r-1)+"\n}\nelse {\n "+n(r,e)+"\n}"),i=i.replace(/\n/g,"\n ")},e=n(0,t-1),"uniform sampler2D dataTextures["+t+"];\n\nvec4 sample2DArray(vec2 uv, float z) {\n "+e+"\n}"},n.binaryOperator=function(t,e,n){return t=a(t),null!=n?t+" binaryOperator("+t+" a) {\n return a "+e+" "+n+";\n}":t+" binaryOperator("+t+" a, "+t+" b) {\n return a "+e+" b;\n}"},n.extendVec=function(t,e,r){var i,o,u,h;return null==r&&(r=0),t>e?n.truncateVec(t,e):(o=e-t,t=a(t),e=a(e),r=s(r),u=function(){h=[];for(var t=0;o>=0?o>=t:t>=o;o>=0?t++:t--)h.push(t);return h}.apply(this).map(function(t){return t?r:"v"}),i=u.join(","),e+" extendVec("+t+" v) { return "+e+"("+i+"); }")},n.truncateVec=function(t,e){var r;return e>t?n.extendVec(t,e):(r="."+"xyzw".substr(0,e),t=a(t),e=a(e),e+" truncateVec("+t+" v) { return v"+r+"; }")},n.injectVec4=function(t){var e,n,i,s,a,u,h;for(h=["0.0","0.0","0.0","0.0"],t=o(t),t=t.map(function(t){return t===""+t?r[t]:t}),i=s=0,a=t.length;a>s;i=++s)n=t[i],h[n]=["a","b","c","d"][i];return u=h.slice(0,4).join(", "),e=["float a","float b","float c","float d"].slice(0,t.length),"vec4 inject("+e+") {\n return vec4("+u+");\n}"},n.swizzleVec4=function(t,e){var n,i;for(null==e&&(e=null),n=["0.0","xyzw.x","xyzw.y","xyzw.z","xyzw.w"],null==e&&(e=t.length),t=o(t),t=t.map(function(t){var e;return e=+t,u.call([0,1,2,3,4],e)>=0&&(t=+t),t===""+t&&(t=r[t]+1),n[t]});t.lengths;e=++s)u=t[e],l=i[e],n=r[u],c[n]="xyzw."+l;return h=c.join(", "),"vec4 invertSwizzle(vec4 xyzw) {\n return vec4("+h+");\n}"},n.identity=function(t){var e;return e=[].slice.call(arguments),e.length>1?(e=e.map(function(t,e){return["inout",t,String.fromCharCode(97+e)].join(" ")}),e=e.join(", "),"void identity("+e+") { }"):t+" identity("+t+" x) {\n return x;\n}"},n.constant=function(t,e){return t+" constant() {\n return "+e+";\n}"},n.toType=a},{}],23:[function(t,e,n){n.Axis=t("./axis"),n.Data=t("./data"),n.Ease=t("./ease"),n.GLSL=t("./glsl"),n.JS=t("./js"),n.Pretty=t("./pretty"),n.Three=t("./three"),n.Ticks=t("./ticks"),n.VDOM=t("./vdom")},{"./axis":19,"./data":20,"./ease":21,"./glsl":22,"./js":24,"./pretty":25,"./three":26,"./ticks":27,"./vdom":28}],24:[function(t,e,n){n.merge=function(){var t,e,n,r,i,o;for(o={},t=0,n=arguments.length;n>t;t++){r=arguments[t];for(e in r)i=r[e],o[e]=i}return o},n.clone=function(t){return JSON.parse(JSON.serialize(t))},n.parseQuoted=function(t){var e,n,r,i,o,s,a,u,h,l;for(e="",l=function(t){return t=t.replace(/\\/g,"")},a=function(t){return e.length&&s.push(l(e)),e=null!=t?t:""},t=t.split(/(?=(?:\\.|["' ,]))/g),u=!1,s=[],i=0,o=t.length;o>i;i++)switch(r=t[i],n=r[0],h=r.slice(1),n){case'"':case"'":if(u)u===n?(u=!1,a(h)):e+=r;else{if(""!==e)throw new Error("ParseError: String `"+t+"` does not contain comma-separated quoted tokens.");u=n,e+=h}break;case" ":case",":u?e+=r:a(h);break;default:e+=r}return a(),s}},{}],25:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E;r=5,i=1e-4,o=function(t,e){return Math.abs(t/e-Math.round(t/e))i?"-":"",i+=n):"1"!==n&&(i+=r?""+n:"*"+n),i+"/"+e},u=[{1:1},{1:1,"τ":2*Math.PI},{1:1,"π":Math.PI},{1:1,"τ":2*Math.PI,"π":Math.PI},{1:1,e:Math.E},{1:1,"τ":2*Math.PI,e:Math.E},{1:1,"π":Math.PI,e:Math.E},{1:1,"τ":2*Math.PI,"π":Math.PI,e:Math.E}],c=[[420,[2,3,5,7]],[88200,[2,3,5,7]],[60060,[2,3,5,7,11,13]],[861764,[2,17,19,23,29]],[65536,[2]],[1e6,[2,5]]],g=function(t){var e,n,o,a,p,f,d,m,v,g;return t&&(e=t.cache,o=t.compact,v=t.tau,d=t.pi,a=t.e,g=t.threshold,m=t.precision),o=+!!(null!=o?o:!0),v=+!!(null!=v?v:!0),d=+!!(null!=d?d:!0),a=+!!(null!=a?a:!0),e=+!!(null!=e?e:!0),g=+(null!=g?g:i),m=+(null!=m?m:r),p=v+2*d+4*a,n=p+g+m,f=e?{}:null,function(t){var e,n,i,a,d,m,v,g,E,y,_,b,T,x,w,R,H,M;if(null!=f){if(null!=(n=f[t]))return n;if(t===Math.round(t))return f[t]=""+t}w=""+t,e=w.length+w.indexOf(".")+2,b=function(t){var n;return n=t.length,e>=n?(w=""+t,e=n):void 0},H=u[p];for(g in H)if(d=H[g],s(t/d))b(""+l(t/d,1,g,o));else for(m=0,E=c.length;E>m;m++)if(M=c[m],a=M[0],_=M[1],x=t/d*a,s(x)){for(v=0,y=_.length;y>v;v++)for(R=_[v];s(T=x/R)&&s(i=a/R);)x=T,a=i;b(""+h(t/d,a,g,o));break}return(""+t).length>r&&b(""+t.toPrecision(r)),null!=f&&(f[t]=w),w}},E=function(t,e){return null==e&&(e="info"),t=v(t),console[e].apply(console,t)},v=function(t){var e,n,r,i,o,s,a,u;return a="color:rgb(128,0,128)",n="color:rgb(144,64,0)",s="color:rgb(0,0,192)",i="color:rgb(0,70,156)",u="color:inherit",o=!1,r=0,e=[],t=t.replace(/(\\[<={}> "'])|(=>|[<={}> "'])/g,function(t,h,l){var c;return(null!=h?h.length:void 0)?h:o&&'"'!==l&&"'"!==l?l:r&&'"'!==l&&"'"!==l&&"{"!==l&&"}"!==l?l:c=function(){switch(l){case"<":return e.push(a),"%c<";case">":return e.push(a),e.push(u),"%c>%c";case" ":return e.push(n)," %c";case"=":case"=>":return e.push(a),"%c"+l;case'"':case"'":return o=!o,o?(e.push(r?n:s),l+"%c"):(e.push(r?i:a),"%c"+l);case"{":return 0===r++?(e.push(i),"%c"+l):l;case"}":return 0===--r?(e.push(a),l+"%c"):l;default:return l}}()}),[t].concat(e)},m=function(t,e){return d(t,e,"=")},f=function(t,e){return d(t,e,"=>")},d=function(){var t;return t=g({compact:!1}),function(e,n,r){var i,o,s;return i=function(t){return t===""+ +t||t.match(/^[A-Za-z_][A-Za-z0-9]*$/)?t:JSON.stringify(t)},s=function(t){return t.match('\n*"')?t:"{"+t+"}"},o=function(e){var n,r;if(e instanceof Array)return"["+e.map(o).join(", ")+"]";switch(typeof e){case"string":return e.match("\n")?'"\n'+e+'"\n':'"'+e+'"';case"function":return e=""+e,e.match("\n"),e=e.replace(/^function (\([^)]+\))/,"$1 =>"),e=e.replace(/^(\([^)]+\)) =>\s*{\s*return\s*([^}]+)\s*;\s*}/,"$1 => $2");case"number":return t(e);default:return null!=e&&e!==!!e?null!=e._up?o(e.map(function(t){return t})):e.toMarkup?e.toString():"{"+function(){var t;t=[];for(n in e)r=e[n],e.hasOwnProperty(n)&&t.push(i(n)+": "+o(r));return t}().join(", ")+"}":""+JSON.stringify(e)}},[e,r,s(o(n))].join("")}}(),a=function(t){return t=t.replace(/&/g,"&"),t=t.replace(/",t=a(t),r=0,i=n.length;i>r;r++)e=n[r],t=t.replace(/%([a-z])/,function(t,e){var r;switch(r=n.shift(),e){case"c":return'';default:return a(r)}});return o+=t,o+=""},e.exports={markup:v,number:g,print:E,format:p,JSX:{prop:m,bind:f}}},{}],26:[function(t,e,n){n.paramToGL=function(t,e){return e===THREE.RepeatWrapping?t.REPEAT:e===THREE.ClampToEdgeWrapping?t.CLAMP_TO_EDGE:e===THREE.MirroredRepeatWrapping?t.MIRRORED_REPEAT:e===THREE.NearestFilter?t.NEAREST:e===THREE.NearestMipMapNearestFilter?t.NEAREST_MIPMAP_NEAREST:e===THREE.NearestMipMapLinearFilter?t.NEAREST_MIPMAP_LINEAR:e===THREE.LinearFilter?t.LINEAR:e===THREE.LinearMipMapNearestFilter?t.LINEAR_MIPMAP_NEAREST:e===THREE.LinearMipMapLinearFilter?t.LINEAR_MIPMAP_LINEAR:e===THREE.UnsignedByteType?t.UNSIGNED_BYTE:e===THREE.UnsignedShort4444Type?t.UNSIGNED_SHORT_4_4_4_4:e===THREE.UnsignedShort5551Type?t.UNSIGNED_SHORT_5_5_5_1:e===THREE.UnsignedShort565Type?t.UNSIGNED_SHORT_5_6_5:e===THREE.ByteType?t.BYTE:e===THREE.ShortType?t.SHORT:e===THREE.UnsignedShortType?t.UNSIGNED_SHORT:e===THREE.IntType?t.INT:e===THREE.UnsignedIntType?t.UNSIGNED_INT:e===THREE.FloatType?t.FLOAT:e===THREE.AlphaFormat?t.ALPHA:e===THREE.RGBFormat?t.RGB:e===THREE.RGBAFormat?t.RGBA:e===THREE.LuminanceFormat?t.LUMINANCE:e===THREE.LuminanceAlphaFormat?t.LUMINANCE_ALPHA:e===THREE.AddEquation?t.FUNC_ADD:e===THREE.SubtractEquation?t.FUNC_SUBTRACT:e===THREE.ReverseSubtractEquation?t.FUNC_REVERSE_SUBTRACT:e===THREE.ZeroFactor?t.ZERO:e===THREE.OneFactor?t.ONE:e===THREE.SrcColorFactor?t.SRC_COLOR:e===THREE.OneMinusSrcColorFactor?t.ONE_MINUS_SRC_COLOR:e===THREE.SrcAlphaFactor?t.SRC_ALPHA:e===THREE.OneMinusSrcAlphaFactor?t.ONE_MINUS_SRC_ALPHA:e===THREE.DstAlphaFactor?t.DST_ALPHA:e===THREE.OneMinusDstAlphaFactor?t.ONE_MINUS_DST_ALPHA:e===THREE.DstColorFactor?t.DST_COLOR:e===THREE.OneMinusDstColorFactor?t.ONE_MINUS_DST_COLOR:e===THREE.SrcAlphaSaturateFactor?t.SRC_ALPHA_SATURATE:0},n.paramToArrayStorage=function(t){switch(t){case THREE.UnsignedByteType:return Uint8Array;case THREE.ByteType:return Int8Array;case THREE.ShortType:return Int16Array;case THREE.UnsignedShortType:return Uint16Array;case THREE.IntType:return Int32Array;case THREE.UnsignedIntType:return Uint32Array;case THREE.FloatType:return Float32Array}},n.swizzleToEulerOrder=function(t){return t.map(function(t){return["","X","Y","Z"][t]}).join("")},n.transformComposer=function(){var t,e,r,i,o;return t=new THREE.Euler,r=new THREE.Quaternion,e=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Matrix4,function(s,a,u,h,l,c){return null==c&&(c="XYZ"),null!=a?(c instanceof Array&&(c=n.swizzleToEulerOrder(c)),t.setFromVector3(a,c),r.setFromEuler(t)):r.set(0,0,0,1),null!=u&&r.multiply(u),null!=s?e.copy(s):e.set(0,0,0),null!=h?i.copy(h):i.set(1,1,1),o.compose(e,r,i),null!=l&&o.multiplyMatrices(o,l),o}}},{}],27:[function(t,e,n){var r,i,o,s,a;o=function(t,e,n,r,i,o,s,a,u,h){var l,c,p,f,d,m,v,g,E,y;return null==h&&(h=!0),n||(n=10),r||(r=1),i||(i=10),o||(o=1),v=e-t,d=v/n,h?(r||(r=1),i||(i=10),m=r*Math.pow(i,Math.floor(Math.log(d/r)/Math.log(i))),p=i%2===0?[i/2,1,.5]:i%3===0?[i/3,1,1/3]:[1],E=function(){var t,e,n;for(n=[],t=0,e=p.length;e>t;t++)c=p[t],n.push(m*c);return n}(),l=1/0,g=E.reduce(function(t,e){var n;return c=e/d,n=Math.max(c,1/c),l>n?(l=n,e):t},m),g*=o,t=Math.ceil(t/g+ +!s)*g,e=(Math.floor(e/g)-+!a)*g,n=Math.ceil((e-t)/g),y=function(){var e,r,i;for(i=[],f=e=0,r=n;r>=0?r>=e:e>=r;f=r>=0?++e:--e)i.push(t+f*g);return i}(),u||(y=y.filter(function(t){return 0!==t})),y):(y=function(){var e,r,i;for(i=[],f=e=0,r=n;r>=0?r>=e:e>=r;f=r>=0?++e:--e)i.push(t+f*d);return i}(),s||y.shift(),a||y.pop(),u||(y=y.filter(function(t){return 0!==t})),y)},s=function(t,e,n,r,i,o,s,a,u,h){throw new Error("Log ticks not yet implemented.")},r=0,i=1,a=function(t,e,n,a,u,h,l,c,p,f,d){switch(t){case r:return o(e,n,a,u,h,l,c,p,f,d);case i:return s(e,n,a,u,h,l,c,p,f,d)}},n.make=a,n.linear=o,n.log=s},{}],28:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;for(r=[],l=0,i={},a=function(){return{id:l++,type:null,props:null,children:null,rendered:null,instance:null}},h=function(t){var e,n,i,o;for(t*=2,t=Math.max(0,r.length-t),o=[],e=n=0,i=t;i>=0?i>n:n>i;e=i>=0?++n:--n)o.push(r.push(a()));return o},u=function(t,e,n){var i;return i=r.length?r.pop():a(),i.type=null!=t?t:"div",i.props=null!=e?e:null,i.children=null!=n?n:null,i},g=function(t){var e,n,i,o;if(t.type&&(n=t.children,t.type=t.props=t.children=t.instance=null,r.push(t),null!=n))for(i=0,o=n.length;o>i;i++)e=n[i],g(e)},o=function(t,e,n,r,s){var a,h,l,c,p,f,d,v,g,E,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V;if(null!=t){if(null==e)return m(t,r,s);if(t instanceof Node){if(F=t===e)return}else F=typeof t==typeof e&&null!==e&&null!==t&&t.type===e.type;if(F){if(t.instance=e.instance,B=(null!=(P=t.type)?P.isComponentClass:void 0)?t.type:i[t.type],A=null!=e?e.props:void 0,H=t.props,c=null!=(L=null!=e?e.children:void 0)?L:null,R=t.children,null!=H&&(H.children=R),null!=B){if(f=n._COMPONENT_DIRTY,null!=A!=(null!=H)&&(f=!0),c!==R&&(f=!0),null!=A&&null!=H){if(!f)for(E in A)H.hasOwnProperty(E)||(f=!0);if(!f)for(E in H)V=H[E],(C=A[E])!==V&&(f=!0)}if(f){p=e.instance,null==t.props&&(t.props={}),z=p.defaultProps;for(g in z)N=z[g],null==(a=t.props)[g]&&(a[g]=N);t.props.children=t.children,"function"==typeof p.willReceiveProps&&p.willReceiveProps(t.props),U=n._COMPONENT_FORCE||(null!=(O="function"==typeof p.shouldUpdate?p.shouldUpdate(t.props):void 0)?O:!0),U&&(M=p.getNextState(),"function"==typeof p.willUpdate&&p.willUpdate(t.props,M)),S=p.props,k=p.applyNextState(),p.props=t.props,p.children=t.children,U&&(t=t.rendered="function"==typeof p.render?p.render(u,t.props,t.children):void 0,o(t,e.rendered,n,r,s),"function"==typeof p.didUpdate&&p.didUpdate(S,k))}return}if(null!=A)for(E in A)H.hasOwnProperty(E)||b(n,E,A[E]);if(null!=H)for(E in H)V=H[E],(C=A[E])!==V&&"children"!==E&&y(n,E,V,C);if(null!=R)if("string"==(D=typeof R)||"number"===D)R!==c&&(n.textContent=R);else if(null!=R.type)o(R,c,n.childNodes[0],n,0);else if(l=n.childNodes,null!=c)for(d=v=0,x=R.length;x>v;d=++v)h=R[d],o(h,c[d],l[d],n,d);else for(d=T=0,w=R.length;w>T;d=++T)h=R[d],o(h,null,l[d],n,d);else null!=c&&(_(null,n),n.innerHTML="");return}return _(e.instance,n),n.remove(),m(t,r,s)}return null!=e?(_(e.instance,n),e.node.remove()):void 0},m=function(t,e,n){var r,o,s,a,h,l,c,p,f,d,v,g,E,_,b,T,x,w,R,H;if(null==n&&(n=0),w=(null!=(g=t.type)?g.isComponentClass:void 0)?t.type:i[t.type],t instanceof Node)v=t;else{if(null!=w){if(h=(null!=(E=t.type)?E.isComponentClass:void 0)?t.type:i[t.type],!h)return t=t.rendered=u("noscript"),v=m(t,e,n);t.instance=a=new h(e),null==t.props&&(t.props={}),_=a.defaultProps;for(p in _)R=_[p],null==(r=t.props)[p]&&(r[p]=R);return t.props.children=t.children,a.props=t.props,a.children=t.children,a.setState("function"==typeof a.getInitialState?a.getInitialState():void 0),"function"==typeof a.willMount&&a.willMount(),t=t.rendered="function"==typeof a.render?a.render(u,t.props,t.children):void 0,v=m(t,e,n),"function"==typeof a.didMount&&a.didMount(t),v._COMPONENT=a,v}if("string"==(b=typeof t)||"number"===b)v=document.createTextNode(t);else{v=document.createElement(t.type),T=t.props;for(f in T)H=T[f],y(v,f,H)}if(s=t.children,null!=s)if("string"==(x=typeof s)||"number"===x)v.textContent=s;else if(null!=s.type)m(s,v,0);else for(l=c=0,d=s.length;d>c;l=++c)o=s[l],m(o,v,l)}return e.insertBefore(v,e.childNodes[n]),v},_=function(t,e){var n,r,i,o,s,a;if(t){"function"==typeof t.willUnmount&&t.willUnmount();for(i in t)delete t[i]}for(s=e.childNodes,a=[],r=0,o=s.length;o>r;r++)n=s[r],_(n._COMPONENT,n),a.push(delete n._COMPONENT);return a},v=function(t){var e,n,r,i;if("undefined"==typeof document)return!0;if(null!=document.documentElement.style[t])return t;for(t=t[0].toUpperCase()+t.slice(1),i=["webkit","moz","ms","o"],e=0,n=i.length;n>e;e++)if(r=i[e],null!=document.documentElement.style[r+t])return r+t},d={},E=["transform"],c=0,f=E.length;f>c;c++)p=E[c],d[p]=v(p);y=function(t,e,n,r){var i,o,s;{if("style"!==e)return null!=t[e]?void(t[e]=n):void(t instanceof Node&&t.setAttribute(e,n));for(i in n)s=n[i],(null!=r?r[i]:void 0)!==s&&(t.style[null!=(o=d[i])?o:i]=s)}},b=function(t,e,n){var r,i,o;if("style"!==e)null!=t[e]&&(t[e]=void 0),t instanceof Node&&t.removeAttribute(e);else for(r in n)o=n[r],t.style[null!=(i=d[r])?i:r]=""},s=function(t){var e,n,r,i,o;r={willMount:"componentWillMount",didMount:"componentDidMount",willReceiveProps:"componentWillReceiveProps",shouldUpdate:"shouldComponentUpdate",willUpdate:"componentWillUpdate",didUpdate:"componentDidUpdate",willUnmount:"componentWillUnmount"};for(n in r)i=r[n],null==t[n]&&(t[n]=t[i]);return e=function(){function e(e,n,r,i){var o,s,a,u;this.props=null!=n?n:{},this.state=null!=r?r:null,this.children=null!=i?i:null,o=function(t,e){return"function"==typeof t?t.bind(e):t};for(s in t)u=t[s],this[s]=o(u,this);a=null,this.setState=function(t){null==a&&(a=t?null!=a?a:{}:null);for(s in t)u=t[s],a[s]=u;e._COMPONENT_DIRTY=!0},this.forceUpdate=function(){var t,n;for(e._COMPONENT_FORCE=e._COMPONENT_DIRTY=!0,t=e,n=[];t=t.parentNode;)t._COMPONENT?n.push(t._COMPONENT_FORCE=!0):n.push(void 0);return n},this.getNextState=function(){return a},this.applyNextState=function(){var t,n;return e._COMPONENT_FORCE=e._COMPONENT_DIRTY=!1,t=this.state,n=[null,a],a=n[0],this.state=n[1],t}}return e}(),e.isComponentClass=!0,e.prototype.defaultProps=null!=(o="function"==typeof t.getDefaultProps?t.getDefaultProps():void 0)?o:{},e},e.exports={element:u,recycle:g,apply:o,hint:h,Types:i,createClass:s}},{}],29:[function(t,e,n){var r,i,o,s,a,u,h,l;i=t("./model"),o=t("./overlay"),s=t("./primitives"),a=t("./render"),u=t("./shaders"),h=t("./stage"),l=t("./util"),r=function(){function t(t,e,n){var r;null==e&&(e=null),null==n&&(n=null),this.canvas=r=t.domElement,this.element=null,this.shaders=new u.Factory(u.Snippets),this.renderables=new a.Factory(a.Classes,t,this.shaders),this.overlays=new o.Factory(o.Classes,r),this.scene=this.renderables.make("scene",{scene:e}),this.camera=this.defaultCamera=null!=n?n:new THREE.PerspectiveCamera,this.attributes=new i.Attributes(s.Types,this),this.primitives=new s.Factory(s.Types,this),this.root=this.primitives.make("root"),this.model=new i.Model(this.root),this.guard=new i.Guard,this.controller=new h.Controller(this.model,this.primitives),this.animator=new h.Animator(this),this.api=new h.API(this),this.speed=1,this.time={now:+new Date/1e3,time:0,delta:0,clock:0,step:0}}return t.Namespace={Model:i,Overlay:o,Primitives:s,Render:a,Shaders:u,Stage:h,Util:l,DOM:l.VDOM},t.prototype.init=function(){return this.scene.inject(),this.overlays.inject(),this},t.prototype.destroy=function(){return this.scene.unject(),this.overlays.unject(),this},t.prototype.resize=function(t){return null==t&&(t={}),null==t.renderWidth&&(t.renderWidth=null!=t.viewWidth?t.viewWidth:t.viewWidth=1280),null==t.renderHeight&&(t.renderHeight=null!=t.viewHeight?t.viewHeight:t.viewHeight=720),null==t.pixelRatio&&(t.pixelRatio=t.renderWidth/Math.max(1e-6,t.viewWidth)),null==t.aspect&&(t.aspect=t.viewWidth/Math.max(1e-6,t.viewHeight)),this.root.controller.resize(t),this},t.prototype.frame=function(t){return this.pre(t),this.update(),this.render(),this.post(),this},t.prototype.pre=function(t){var e;return t||(t={now:+new Date/1e3,time:0,delta:0,clock:0,step:0},t.delta=null!=this.time.now?t.now-this.time.now:0,t.delta>1&&(t.delta=1/60),t.step=t.delta*this.speed,t.time=this.time.time+t.delta,t.clock=this.time.clock+t.step),this.time=t,"function"==typeof(e=this.root.controller).pre&&e.pre(),this},t.prototype.update=function(){var t;return this.animator.update(),this.attributes.compute(),this.guard.iterate({step:function(t){return function(){var e;return e=t.attributes.digest(),e||(e=t.model.digest())}}(this),last:function(){return{attribute:this.attributes.getLastTrigger(),model:this.model.getLastTrigger()}}}),"function"==typeof(t=this.root.controller).update&&t.update(),this.camera=this.root.controller.getCamera(),this.speed=this.root.controller.getSpeed(),this},t.prototype.render=function(){var t;return"function"==typeof(t=this.root.controller).render&&t.render(),this.scene.render(),this},t.prototype.post=function(){var t;return"function"==typeof(t=this.root.controller).post&&t.post(),this},t.prototype.setWarmup=function(t){return this.scene.warmup(t),this},t.prototype.getPending=function(){return this.scene.pending.length},t}(),e.exports=r},{"./model":34,"./overlay":40,"./primitives":43,"./render":149,"./shaders":164,"./stage":169,"./util":175}],30:[function(t,e,n){var r,i,o,s,a;o=function(t){var e,n;return n=THREE.Bootstrap(t),n.fallback||(n.Time||n.install("time"),n.MathBox||n.install(["mathbox","splash"])),null!=(e=n.mathbox)?e:n},window.π=Math.PI,window.τ=2*π,window.e=Math.E,window.MathBox=n,window.mathBox=n.mathBox=o,n.version="0.0.5",n.Context=r=t("./context"),s=r.Namespace;for(i in s)a=s[i],n[i]=a;t("./splash"),THREE.Bootstrap.registerPlugin("mathbox",{defaults:{init:!0,warmup:2,inspect:!0,splash:!0},listen:["ready","pre","update","post","resize"],install:function(t){var e;return e=!1,this.first=!0,t.MathBox={init:function(n){return function(i){var o,s;if(!e)return e=!0,s=(null!=i?i.scene:void 0)||n.options.scene||t.scene,o=(null!=i?i.camera:void 0)||n.options.camera||t.camera,n.context=new r(t.renderer,s,o),n.context.api.three=t.three=t,n.context.api.mathbox=t.mathbox=n.context.api,n.context.api.start=function(){return t.Loop.start()},n.context.api.stop=function(){return t.Loop.stop()},n.context.init(),n.context.resize(t.Size),n.context.setWarmup(n.options.warmup),n.pending=0,n.warm=!n.options.warmup,console.log("MathBox²",MathBox.version),t.trigger({type:"mathbox/init",version:MathBox.version,context:n.context})}}(this),destroy:function(n){return function(){return e?(e=!1,t.trigger({type:"mathbox/destroy",context:n.context}),n.context.destroy(),delete t.mathbox,delete n.context.api.three,delete n.context):void 0}}(this),object:function(t){return function(){var e;return null!=(e=t.context)?e.scene.root:void 0}}(this)}},uninstall:function(t){return t.MathBox.destroy(),delete t.MathBox},ready:function(t,e){return this.options.init?(e.MathBox.init(),setTimeout(function(t){return function(){return t.options.inspect?t.inspect(e):void 0}}(this))):void 0},inspect:function(t){return this.context.api.inspect(),this.options.warmup?void 0:this.info(t)},info:function(t){var e,n;return e=function(t){var e;for(e=[];t>=1e3;)e.unshift(("000"+t%1e3).slice(-3)),t=Math.floor(t/1e3);return e.unshift(t),e.join(",")},n=t.renderer.info.render,console.log("Geometry ",e(n.faces)+" faces ",e(n.vertices)+" vertices ",e(n.calls)+" draw calls ")},resize:function(t,e){var n;return null!=(n=this.context)?n.resize(e.Size):void 0},pre:function(t,e){var n;return null!=(n=this.context)?n.pre(e.Time):void 0},update:function(t,e){var n,r,i,o;return null!=(r=this.context)&&r.update(),(n=null!=(i=this.context)?i.camera:void 0)&&n!==e.camera&&(e.camera=n),e.Time.set({speed:this.context.speed}),this.progress(this.context.getPending(),e),null!=(o=this.context)?o.render():void 0},post:function(t,e){var n;return null!=(n=this.context)?n.post():void 0},progress:function(t,e){var n,r,i;if(t||this.pending)return r=Math.max(t+this.options.warmup,this.pending),n=r-t,i=r,e.trigger({type:"mathbox/progress",current:r-t,total:r}),0===t&&(r=0),this.pending=r,n===i&&!this.warm&&(this.warm=!0,this.options.inspect)?this.info(e):void 0}})},{"./context":29,"./splash":165}],31:[function(t,e,n){var r,i,o;r=function(){function t(t,e){this.context=e,this.traits=t.Traits,this.types=t.Types,this.pending=[],this.bound=[],this.last=null}return t.prototype.make=function(t){return{"enum":"function"==typeof t["enum"]?t["enum"]():void 0,type:"function"==typeof t.uniform?t.uniform():void 0,value:t.make()}},t.prototype.apply=function(t,e){return new i(t,e,this)},t.prototype.bind=function(t){return this.bound.push(t)},t.prototype.unbind=function(t){var e;return this.bound=function(){var n,r,i,o;for(i=this.bound,o=[],n=0,r=i.length;r>n;n++)e=i[n],e!==t&&o.push(e);return o}.call(this)},t.prototype.queue=function(t,e,n,r){return this.lastObject=e,this.lastKey=n,this.lastValue=r,this.pending.push(t)},t.prototype.invoke=function(t){return t(this.context.time.clock,this.context.time.step)},t.prototype.compute=function(){var t,e,n,r;if(this.bound.length)for(r=this.bound,e=0,n=r.length;n>e;e++)t=r[e],this.invoke(t)},t.prototype.digest=function(){var t,e,n,r,i;if(!this.pending.length)return!1;for(i=[this.pending,[]],e=i[0],this.pending=i[1],n=0,r=e.length;r>n;n++)(t=e[n])();return!0},t.prototype.getTrait=function(t){return this.traits[t]},t.prototype.getLastTrigger=function(){return this.lastObject.toString()+" - "+this.lastKey+"=`"+this.lastValue+"`"},t}(),o=function(t){var e,n,r;n={};for(e in t)r=t[e],n[e]=r;return n},i=function(){function t(t,e,n){var r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V,I,j,G,W,q,X,Y,Z,K,Q,J,$,tt,et,nt,rt,it;for(J=e.traits,I=e.props,w=e.finals,H=e.freeform,m=this,null!=t.props&&null!=t.expr&&null!=t.orig&&null!=t.computed&&null!=t.attributes&&(N=o(t.props),U=o(t.expr),B=t.orig(),F=t.computed(),null!=(j=t.attributes)&&j.dispose()),R={},V={},z={},Y=function(t){var e;return null!=(e=z[t])?e:t},v=function(e,n){if(z[n])throw new Error(t.toString()+" - Duplicate property `"+n+"`");return z[n]=e},M=function(t){var e,n,r;return null!=(e=null!=(n=m[t])?n.value:void 0)?e:null!=(r=m[Y(t)])?r.value:void 0},W=function(e,n,r,o){var s,h,l,p,f;if(e=Y(e),null==(s=m[e])){if(!H)throw new Error(t.toString()+" - Setting unknown property `"+e+"={"+n+"}`");s=m[e]={"short":e,type:null,last:null,value:null},nt[e]=function(t){return t}}if(!r){if(a[e])throw new Error(t.toString()+" - Can't set bound property `"+e+"={"+n+"}`");if(i[e])throw new Error(t.toString()+" - Can't set computed property `"+e+"={"+n+"}`");if(u[e])throw new Error(t.toString()+" - Can't set final property `"+e+"={"+n+"}`")}return p=!0,f=et(e,n,s.last,function(){return p=!1,null}),p&&(h=[f,s.value],s.value=h[0],s.last=h[1],l=s["short"],R[l]=f,r||(V[l]=n),o||_(e,s.value,s.last)||c(e,n)),p},d=function(t,e,n){return t=Y(t),W(t,e,!0,n),u[t]=!0},x={},r={},s={},a={},i={},u={},l=function(e,o,h){var l,c;if(null==h&&(h=!1),e=Y(e),"function"!=typeof o)throw new Error(t.toString()+" - Expression `"+e+"=>{"+x+"}` is not a function");if(a[e])throw new Error(t.toString()+" - Property `"+e+"=>{"+x+"}` is already bound");if(i[e])throw new Error(t.toString()+" - Property `"+e+"` is computed");if(u[e])throw new Error(t.toString()+" - Property `"+e+"` is final");return l=h?i:a,l[e]=o,c=null!=m[e]?m[e]["short"]:e,h||(x[c]=o),s[e]=o,o=o.bind(t),r[e]=function(n,r){var i,s;return(i=null!=(s=t.clock)?s.getTime():void 0)&&(n=i.clock,r=i.step),t.set(e,o(n,r),!0)},n.bind(r[e])},$=function(t,e){var o;return null==e&&(e=!1),t=Y(t),o=e?i:a,o[t]?(n.unbind(r[t]),delete r[t],delete o[t],null!=m[t]&&(t=m[t]["short"]),delete x[t]):void 0},b=function(t,e){var n;return t=Y(t),null!=(n="function"==typeof s[t]?s[t](e,0):void 0)?n:m[t].value},t.expr=x,t.props=R,t.evaluate=function(t,e){var n;if(null!=t)return b(t,e);n={};for(t in I)n[t]=b(t,e);return n},t.get=function(t){return null!=t?M(t):R},t.set=function(t,e,n,r){var i;if("string"==typeof t)W(t,e,n,r);else{r=n,n=e,i=t;for(t in i)e=i[t],W(t,e,n,r)}},t.bind=function(t,e,n){var r;if("string"==typeof t)l(t,e,n);else{n=e,r=t;for(t in r)e=r[t],l(t,e,n)}},t.unbind=function(t,e){var n;if("string"==typeof t)$(t,e);else{e=x,n=t;for(t in n)$(t,e)}},t.attribute=function(t){return null!=t?m[Y(t)]:m},t.orig=function(t){return null!=t?V[Y(t)]:o(V)},t.computed=function(t){return null!=t?i[Y(t)]:o(i)},L={},nt={},y={},_=function(t,e,n){return y[t](e,n)},et=function(t,e,n,r){return nt[t](e,n,r)},t.validate=function(e,n){var r,i;return e=Y(e),r=L[e],null!=r&&(i=r()),i=et(e,n,i,function(){throw new Error(t.toString()+" - Invalid value `"+e+"={"+n+"}`")})},E=!1,f={},K={},p={},Z={},S=function(t){return t.split(".")[0]},c=function(e,r){var i;return E||(E=!0,n.queue(g,t,e,r)),i=S(e),f[e]=!0,K[i]=!0},T={type:"change",changed:null,touched:null},g=function(){var e,n,r;T.changed=f,T.touched=K,f=p,K=Z,p=T.changed,Z=T.touched,E=!1;for(e in f)f[e]=!1;for(e in K)K[e]=!1;T.type="change",t.trigger(T),n=[];for(r in T.touched)T.type="change:"+r,n.push(t.trigger(T));return n},q=function(t){var e,n;return e=t.split(/\./g),n=e.pop(),e.pop(),e.unshift(n),e.reduce(function(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)})},h=function(t,e){var n,r,i,o,s,a,u,h;s=[];for(r in e)u=e[r],r=[t,r].join("."),a=q(r),m[r]=n={T:u,ns:t,"short":a,"enum":"function"==typeof u["enum"]?u["enum"]():void 0,type:"function"==typeof u.uniform?u.uniform():void 0,last:u.make(),value:h=u.make()},v(r,a),R[a]=h,L[r]=u.make,nt[r]=null!=(i=u.validate)?i:function(t){return t; +},s.push(y[r]=null!=(o=u.equals)?o:function(t,e){return t===e});return s},P=[],it={},k=0,C=J.length;C>k;k++)Q=J[k],G=Q.split(":"),Q=G[0],D=G[1],O=D?[D,Q].join("."):Q,X=n.getTrait(Q),P.push(Q),null!=X&&h(O,X);if(null!=I)for(D in I)X=I[D],h(D,X);if(tt=P.filter(function(t,e){return P.indexOf(t)===e}),t.traits=tt,null!=N&&t.set(N,!0,!0),null!=w)for(A in w)rt=w[A],d(A,rt,!0);null!=B&&t.set(B,!1,!0),null!=F&&t.bind(F,!0),null!=U&&t.bind(U,!1),this.dispose=function(){for(A in i)$(A,!0);for(A in a)$(A,!1);return I={},delete t.attributes,delete t.get,delete t.set}}return t}(),e.exports=r},{}],32:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./node"),r=function(t){function e(t,n,r,i,o,s){e.__super__.constructor.call(this,t,n,r,i,o,s),this.children=[],this.on("reindex",function(t){return function(e){var n,r,i,o,s;for(o=t.children,s=[],r=0,i=o.length;i>r;r++)n=o[r],s.push(n.trigger(e));return s}}(this))}return o(e,t),e.prototype.add=function(t){var e;return null!=(e=t.parent)&&e.remove(t),t._index(this.children.length,this),this.children.push(t),t._added(this)},e.prototype.remove=function(t){var e,n,r,i,o,s;if((null!=(o=t.children)?o.length:void 0)&&t.empty(),n=this.children.indexOf(t),-1!==n)for(this.children.splice(n,1),t._index(null),t._removed(this),s=this.children,e=r=0,i=s.length;i>r;e=++r)t=s[e],e>=n&&t._index(e)},e.prototype.empty=function(){var t,e,n,r;for(t=this.children.slice().reverse(),e=0,n=t.length;n>e;e++)r=t[e],this.remove(r)},e}(i),e.exports=r},{"./node":36}],33:[function(t,e,n){var r;r=function(){function t(t){this.limit=null!=t?t:10}return t.prototype.iterate=function(t){var e,n,r,i;for(i=t.step,e=t.last,n=this.limit;r=i();)if(!--n)throw console.warn("Last iteration","function"==typeof e?e():void 0),new Error("Exceeded iteration limit.");return null},t}(),e.exports=r},{}],34:[function(t,e,n){n.Attributes=t("./attributes"),n.Group=t("./group"),n.Guard=t("./guard"),n.Model=t("./model"),n.Node=t("./node")},{"./attributes":31,"./group":32,"./guard":33,"./model":35,"./node":36}],35:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};l=t("cssauron"),r="*",s=/^#([A-Za-z0-9_])$/,o=/^\.([A-Za-z0-9_]+)$/,u=/^\[([A-Za-z0-9_]+)\]$/,h=/^[A-Za-z0-9_]+$/,i=/^<([0-9]+|<*)$/,c=null,a=function(){function t(t){var e,n,r,i,o,s,a,u,h,p,f,d,m,v,g,E,y,_,b,T,x,w;this.root=t,this.root.model=this,this.root.root=this.root,this.ids={},this.classes={},this.traits={},this.types={},this.nodes=[],this.watchers=[],this.fire=!1,this.lastNode=null,this.event={type:"update"},null==c&&(c=l({tag:"type",id:"id","class":"classes.join(' ')",parent:"parent",children:"children",attr:"traits.hash[attr]"})),e=function(t){return function(t){return u(t.node)}}(this),v=function(t){return function(t){return p(t.node)}}(this),this.root.on("add",e),this.root.on("remove",v),u=function(t){return function(t){return i(t),a(t),s(t),t.on("change:node",w),w(null,t,!0),f(t)}}(this),p=function(t){return function(t){return y(t),T(t),b(t),E(t.id,t),g(t.classes,t),t.off("change:node",w),f(t)}}(this),m=function(t){return function(e){var n,r,i,o;for(i=t.watchers,n=0,r=i.length;r>n;n++)o=i[n],o.match=o.matcher(e);return null}}(this),h=function(t){return function(e){var n,r,i,o,s;for(o=t.watchers,r=0,i=o.length;i>r;r++)s=o[r],n=s.fire||(s.fire=s.match!==s.matcher(e)),n&&(t.lastNode=e),t.fire||(t.fire=n);return null}}(this),f=function(t){return function(e){var n,r,i,o,s;for(o=t.watchers,r=0,i=o.length;i>r;r++)s=o[r],n=s.fire||(s.fire=s.matcher(e)),n&&(t.lastNode=e),t.fire||(t.fire=n);return null}}(this),this.digest=function(t){return function(){var e,n,r,i;if(!t.fire)return!1;for(r=t.watchers.slice(),e=0,n=r.length;n>e;e++)i=r[e],i.fire&&(i.fire=!1,i.handler());return t.fire=!1,!0}}(this),w=function(t){return function(t,e,i){var o,s,a,u,l,c,p,f;return o=i||t.changed["node.id"],s=i||t.changed["node.classes"],c=!1,o&&(u=e.get("node.id"),u!==e.id&&(i||m(e),c=!0,null!=e.id&&E(e.id,e),r(u,e))),s&&(a=null!=(p=e.get("node.classes"))?p:[],l=a.join(","),l!==(null!=(f=e.classes)?f.klass:void 0)&&(a=a.slice(),i||c||m(e),c=!0,null!=e.classes&&g(e.classes,e),n(a,e),e.classes=a,e.classes.klass=l)),!i&&c&&h(e),null}}(this),o=function(t,e,n){var r,i,o,s,a;if(null!=e){for(r=0,o=e.length;o>r;r++)i=e[r],s=null!=(a=t[i])?a:[],s.push(n),t[i]=s;return null}},_=function(t,e,n){var r,i,o,s,a;if(null!=e){for(r=0,s=e.length;s>r;r++)o=e[r],a=t[o],i=a.indexOf(n),i>=0&&a.splice(i,1),0===a.length&&delete t[o];return null}},d=function(t){var e,n,r,i,o;if(t.length>0){for(e=t.hash={},o=[],n=0,i=t.length;i>n;n++)r=t[n],o.push(e[r]=!0);return o}},x=function(t){return delete t.hash},r=function(t){return function(e,n){if(t.ids[e])throw new Error("Duplicate node id `"+e+"`");return null!=e&&(t.ids[e]=[n]),n.id=null!=e?e:n._id}}(this),E=function(t){return function(e,n){return null!=e&&delete t.ids[e],n.id=n._id}}(this),n=function(t){return function(e,n){return o(t.classes,e,n),null!=e?d(e):void 0}}(this),g=function(t){return function(e,n){return _(t.classes,e,n),null!=e?x(e):void 0}}(this),i=function(t){return function(e){return t.nodes.push(e)}}(this),y=function(t){return function(e){return t.nodes.splice(t.nodes.indexOf(e),1)}}(this),a=function(t){return function(e){return o(t.types,[e.type],e)}}(this),T=function(t){return function(e){return _(t.types,[e.type],e)}}(this),s=function(t){return function(e){return o(t.traits,e.traits,e),d(e.traits)}}(this),b=function(t){return function(e){return _(t.traits,e.traits,e),x(e.traits)}}(this),u(this.root),this.root.trigger({type:"added"})}return t.prototype.filter=function(t,e){var n,r,i,o,s;for(i=this._matcher(e),s=[],n=0,r=t.length;r>n;n++)o=t[n],i(o)&&s.push(o);return s},t.prototype.ancestry=function(t,e){var n,r,i,o,s;for(o=[],n=0,r=t.length;r>n;n++)for(i=t[n],s=i.parent;null!=s;){if(p.call(e,s)>=0){o.push(i);break}s=s.parent}return o},t.prototype.select=function(t,e){var n;return n=this._select(t),null!=e&&(n=this.ancestry(n,e)),n.sort(function(t,e){return e.order-t.order}),n},t.prototype.watch=function(t,e){var n;return e.unwatch=function(t){return function(){return t.unwatch(e)}}(this),e.watcher=n={selector:t,handler:e,matcher:this._matcher(t),match:!1,fire:!1},this.watchers.push(n),this.select(t)},t.prototype.unwatch=function(t){var e;return e=t.watcher,null!=e?(this.watchers.splice(this.watchers.indexOf(e),1),delete t.unwatch,delete t.watcher):void 0},t.prototype._simplify=function(t){var e,n,a,l,c,p,f,d,m,v,g,E;return t=t.replace(/^\s+/,""),t=t.replace(/\s+$/,""),a=e=t===r,a||(a=l=null!=(p=t.match(s))?p[1]:void 0),a||(a=c=null!=(f=t.match(o))?f[1]:void 0),a||(a=g=null!=(d=t.match(u))?d[1]:void 0),a||(a=E=null!=(m=t.match(h))?m[0]:void 0),a||(a=n=null!=(v=t.match(i))?v[0]:void 0),[e,l,c,g,E,n]},t.prototype._matcher=function(t){var e,n,r,i,o,s,a;if(o=this._simplify(t),e=o[0],r=o[1],i=o[2],s=o[3],a=o[4],n=o[5],e)return function(t){return!0};if(r)return function(t){return t.id===r};if(i)return function(t){var e,n;return null!=(e=t.classes)&&null!=(n=e.hash)?n[i]:void 0};if(s)return function(t){var e,n;return null!=(e=t.traits)&&null!=(n=e.hash)?n[s]:void 0};if(a)return function(t){return t.type===a};if(n)throw"Auto-link matcher unsupported";return c(t)},t.prototype._select=function(t){var e,n,r,i,o,s,a,u,h,l;return i=this._simplify(t),e=i[0],n=i[1],r=i[2],h=i[3],l=i[4],e?this.nodes:n?null!=(o=this.ids[n])?o:[]:r?null!=(s=this.classes[r])?s:[]:h?null!=(a=this.traits[h])?a:[]:l?null!=(u=this.types[l])?u:[]:this.filter(this.nodes,t)},t.prototype.getRoot=function(){return this.root},t.prototype.getLastTrigger=function(){return this.lastNode.toString()},t}(),e.exports=a},{cssauron:2}],36:[function(t,e,n){var r,i,o,s;o=t("../util"),s=0,i=function(){function t(t,e,n,r,i,o){this.type=t,this._id=(++s).toString(),this.configure(i,o),this.parent=this.root=this.path=this.index=null,this.set(e,!0,!0),this.set(n,!1,!0),this.bind(r,!1)}return t.prototype.configure=function(t,e){var n,r,i,o,s,a,u,h,l,c,p,f;return f=t.traits,i=t.props,n=t.finals,r=t.freeform,null==f&&(f=null!=(o=null!=(s=this._config)?s.traits:void 0)?o:[]),null==i&&(i=null!=(a=null!=(u=this._config)?u.props:void 0)?a:{}),null==n&&(n=null!=(h=null!=(l=this._config)?l.finals:void 0)?h:{}),null==r&&(r=null!=(c=null!=(p=this._config)?p.freeform:void 0)?c:!1),this._config={traits:f,props:i,finals:n,freeform:r},this.attributes=e.apply(this,this._config)},t.prototype.dispose=function(){return this.attributes.dispose(),this.attributes=null},t.prototype._added=function(t){var e;return this.parent=t,this.root=t.root,e={type:"add",node:this,parent:this.parent},this.root&&this.root.trigger(e),e.type="added",this.trigger(e)},t.prototype._removed=function(){var t;return t={type:"remove",node:this},this.root&&this.root.trigger(t),t.type="removed",this.trigger(t),this.root=this.parent=null},t.prototype._index=function(t,e){var n,r;return null==e&&(e=this.parent),this.index=t,this.path=n=null!=t?(null!=(r=null!=e?e.path:void 0)?r:[]).concat([t]):null,this.order=null!=n?this._encode(n):1/0,null!=this.root?this.trigger({type:"reindex"}):void 0},t.prototype._encode=function(t){var e,n,r,i,o,s,a,u,h,l,c;for(a=3,l=function(t){return a/(t+a)},h=function(t){return n+(e-n)*t},e=1+1/a,n=0,o=0,u=t.length;u>o;o++)s=t[o],r=l(s+1),i=l(s+2),c=[h(r),h(i)],e=c[0],n=c[1];return e},t.prototype.toString=function(){var t,e,n,r,i,o,s;return t=null!=(r=this.id)?r:this._id,s=null!=(i=this.type)?i:"node",n=s,n+="#"+t,(null!=(o=this.classes)?o.length:void 0)&&(n+="."+this.classes.join(".")),null!=this.children?(e=this.children.length)?"<"+n+">…("+e+")…":"<"+n+">":"<"+n+" />"},t.prototype.toMarkup=function(t,e){var n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E;null==t&&(t=null),null==e&&(e=""),t&&"function"!=typeof t&&(t=null!=(f=null!=(d=this.root)?d.model._matcher(t):void 0)?f:function(){return!0}),g=null!=(m=this.type)?m:"node",a=this.expr,l={id:this._id},v="function"==typeof this.orig?this.orig():void 0;for(u in v)E=v[u],l[u]=E;return c=function(){var t;t=[];for(u in l)E=l[u],this.expr[u]||t.push(o.Pretty.JSX.prop(u,E));return t}.call(this),a=function(){var t;t=[];for(u in a)E=a[u],t.push(o.Pretty.JSX.bind(u,E));return t}(),n=[""],c.length&&(n=n.concat(c)),a.length&&(n=n.concat(a)),n=n.join(" "),r=e,p=function(e){return function(){var n,i;return(null!=(i=e.children)?i.length:void 0)?n=e.children.map(function(e){return e.toMarkup(t,r)}).filter(function(t){return null!=t&&t.length}).join("\n"):""}}(this),t&&!t(this)?p():null!=this.children?(h="<"+g+n+">",s="",r=e+" ",i=p(),i.length&&(i="\n"+i+"\n"+e),null==i&&(i=""),e+h+i+s):e+"<"+g+n+" />"},t.prototype.print=function(t,e){return o.Pretty.print(this.toMarkup(t),e)},t}(),r=t("../util/binder"),r.apply(i.prototype),e.exports=i},{"../util":175,"../util/binder":171}],37:[function(t,e,n){var r;r={dom:t("./dom")},e.exports=r},{"./dom":38}],38:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./overlay"),o=t("../util").VDOM,r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.el=o.element,e.prototype.hint=o.hint,e.prototype.apply=o.apply,e.prototype.recycle=o.recycle,e.prototype.init=function(t){return this.last=null},e.prototype.dispose=function(){return this.unmount(),e.__super__.dispose.apply(this,arguments)},e.prototype.mount=function(){var t;return t=document.createElement("div"),t.classList.add("mathbox-overlay"),this.element.appendChild(t),this.overlay=t},e.prototype.unmount=function(t){return this.overlay.parentNode&&this.element.removeChild(this.overlay),this.overlay=null},e.prototype.render=function(t){var e,n,r,i,o,s;this.overlay||this.mount(),("string"==(s=typeof t)||"number"===s)&&(t=this.el("div",null,t)),t instanceof Array&&(t=this.el("div",null,t)),n="div"===t.type,e=this.last,i=this.overlay,r=n?i:i.childNodes[0],o=n?i.parentNode:i,!e&&r&&(e=this.el("div")),this.apply(t,e,r,o,0),this.last=t,null!=e&&this.recycle(e)},e}(i),e.exports=r},{"../util":175,"./overlay":41}],39:[function(t,e,n){var r;r=function(){function t(t,e){var n;this.classes=t,this.canvas=e,n=document.createElement("div"),n.classList.add("mathbox-overlays"),this.div=n}return t.prototype.inject=function(){var t;if(t=this.canvas.parentNode,!t)throw new Error("Canvas not inserted into document.");return t.insertBefore(this.div,this.canvas)},t.prototype.unject=function(){var t;return t=this.div.parentNode,t.removeChild(this.div)},t.prototype.getTypes=function(){return Object.keys(this.classes)},t.prototype.make=function(t,e){return new this.classes[t](this.div,e)},t}(),e.exports=r},{}],40:[function(t,e,n){n.Factory=t("./factory"),n.Classes=t("./classes"),n.Overlay=t("./overlay")},{"./classes":37,"./factory":39,"./overlay":41}],41:[function(t,e,n){var r;r=function(){function t(t,e){this.element=t,"function"==typeof this.init&&this.init(e)}return t.prototype.dispose=function(){},t}(),e.exports=r},{}],42:[function(t,e,n){var r,i;i=t("../util"),r=function(){function t(t,e){this.context=e,this.classes=t.Classes,this.helpers=t.Helpers}return t.prototype.getTypes=function(){return Object.keys(this.classes)},t.prototype.make=function(t,e,n){var r,i,o;if(null==e&&(e={}),null==n&&(n=null),r=this.classes[t],null==r)throw new Error("Unknown primitive class `"+t+"`");return i=new r.model(t,r.defaults,e,n,r,this.context.attributes),o=new r(i,this.context,this.helpers),i},t}(),e.exports=r},{"../util":175}],43:[function(t,e,n){n.Factory=t("./factory"),n.Primitive=t("./primitive"),n.Types=t("./types")},{"./factory":42,"./primitive":44,"./types":72}],44:[function(t,e,n){var r,i,o,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i=t("../model"),o=function(){function t(t,e,n){this.node=t,this._context=e,this._renderables=this._context.renderables,this._attributes=this._context.attributes,this._shaders=this._context.shaders,this._overlays=this._context.overlays,this._animator=this._context.animator,this._types=this._attributes.types,this.node.controller=this,this.node.on("added",function(t){return function(e){return t._added()}}(this)),this.node.on("removed",function(t){return function(e){return t._removed()}}(this)),this.node.on("change",function(t){return function(e){return t._root?t.change(e.changed,e.touched):void 0}}(this)),this.reconfigure(),this._get=this.node.get.bind(this.node),this._helpers=n(this,this.node.traits),this._handlers={inherit:{},listen:[],watch:[],compute:[]},this._root=this._parent=null,this.init()}return t.Node=i.Node,t.Group=i.Group,t.model=t.Node,t.defaults=null,t.traits=null,t.props=null,t.finals=null,t.freeform=!1,t.prototype.is=function(t){return this.traits.hash[t]},t.prototype.init=function(){},t.prototype.make=function(){},t.prototype.made=function(){},t.prototype.unmake=function(t){},t.prototype.unmade=function(){},t.prototype.change=function(t,e,n){},t.prototype.refresh=function(){return this.change({},{},!0)},t.prototype.rebuild=function(){return this._root?(this._removed(!0),this._added()):void 0},t.prototype.reconfigure=function(t){return null!=t&&this.node.configure(t,this._attributes),this.traits=this.node.traits,this.props=this.node.props},t.prototype._added=function(){var t,e,n,r,i,o;this._parent=null!=(r=this.node.parent)?r.controller:void 0,this._root=null!=(i=this.node.root)?i.controller:void 0,this.node.clock=null!=(o=this._inherit("clock"))?o:this._root;try{try{return this.make(),this.refresh(),this.made()}catch(e){throw t=e,this.node.print("warn"),console.error(t),t}}catch(n){t=n;try{return this._removed()}catch(s){}}},t.prototype._removed=function(t){return null==t&&(t=!1),this.unmake(t),this._unlisten(),this._unattach(),this._uncompute(),this._root=null,this._parent=null,this.unmade(t)},t.prototype._listen=function(t,e,n,r){var i,o,s;if(null==r&&(r=this),t instanceof Array)for(i=0,o=t.length;o>i;i++)return s=t[i],this.__listen(s,e,n,r);return this.__listen(t,e,n,r)},t.prototype.__listen=function(t,e,n,r){var i;return null==r&&(r=this),"string"==typeof t&&(t=this._inherit(t)),null!=t&&(i=n.bind(r),i.node=this.node,t.on(e,i),this._handlers.listen.push([t,e,i])),t},t.prototype._unlisten=function(){var t,e,n,r,i,o,s;if(this._handlers.listen.length){for(i=this._handlers.listen,e=0,n=i.length;n>e;e++)o=i[e],r=o[0],s=o[1],t=o[2],r.off(s,t);return this._handlers.listen=[]}},t.prototype._inherit=function(t){var e,n;return e=this._handlers.inherit[t],void 0!==e?e:this._handlers.inherit[t]=null!=(n=this._parent)?n._find(null!=t?t:null):void 0},t.prototype._find=function(t){var e;return this.is(t)?this:null!=(e=this._parent)?e._find(t):void 0},t.prototype._uninherit=function(){return this._handlers.inherit={}},t.prototype._attach=function(t,e,n,r,o,a,u){var h,l,c,p,f;return null==r&&(r=this),null==o&&(o=this),null==a&&(a=!1),null==u&&(u=!1),h=function(t){return null!=t&&s.call(t.traits,e)>=0?t:void 0},c=function(t){return null!=t?t.controller:void 0},l=function(t){var e,n,r,i;if(null==t)return t;for(r=[],e=0,n=t.length;n>e;e++)i=t[e],i instanceof Array?r=r.concat(i):r.push(i);return r},f=function(t){return function(s){var c,p,d,m,v,g,E,y;if("object"==typeof s){if(d=s,null!=d?d._up:void 0)return s=u?d._targets:[d[0]];if(d instanceof Array)return s=u?l(d.map(f)):f(d[0]);if(d instanceof i.Node)return[d]}else if("string"==typeof s&&"<"===s[0]){for(c=0,(p=s.match(/^<([0-9])+$/))&&(c=+p[1]-1),s.match(/^<+$/)&&(c=+s.length-1),m=[],g=o.node;g&&(v=g.parent);)if(g=v.children[g.index-1],g||m.length||(g=v),d=null,h(g)&&(d=g),null!=d&&c--<=0&&m.push(d),!u&&m.length)return m;if(u&&m.length)return m}else if("string"==typeof s)if(y=n.bind(r),t._handlers.watch.push(y),E=t._root.watch(s,y),u){if(m=E.filter(h),m.length)return m}else if(h(E[0])&&(d=E[0]),null!=d)return[d];if(!a)throw console.warn(t.node.toMarkup()),new Error(t.node.toString()+" - Could not find "+e+" `"+s+"`");return u?[]:null}}(this),p=l(f(t)),u?null!=p?p.map(c):null:null!=p?c(p[0]):null},t.prototype._unattach=function(){var t,e,n,r;if(this._handlers.watch.length){for(n=this._handlers.watch,t=0,e=n.length;e>t;t++)r=n[t],null!=r&&r.unwatch();return this._handlers.watch=[]}},t.prototype._compute=function(t,e){return this._handlers.compute.push(t),this.node.bind(t,e,!0)},t.prototype._uncompute=function(){var t,e,n,r;if(this._handlers.compute.length){for(r=this._handlers.compute,t=0,n=r.length;n>t;t++)e=r[t],this.node.unbind(e,!0);return this._handlers.compute=[]}},t}(),r=t("../util/binder"),r.apply(o.prototype),e.exports=o},{"../model":34,"../util/binder":171}],45:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./parent"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","object","entity","visible","active"],e.prototype.make=function(){return this._helpers.visible.make(),this._helpers.active.make()},e.prototype.unmake=function(){return this._helpers.visible.unmake(),this._helpers.active.unmake()},e}(i),e.exports=r},{"./parent":47}],46:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty,a=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i=t("./parent"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","bind"],e.prototype.make=function(){return this._helpers.bind.make([{to:"inherit.source",trait:"node"}])},e.prototype.unmake=function(){return this._helpers.bind.unmake()},e.prototype._find=function(t){return this.bind.source&&a.call(this.props.traits,t)>=0?this.bind.source._inherit(t):e.__super__._find.apply(this,arguments)},e}(i),e.exports=r},{"./parent":47}],47:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("../../primitive"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.model=i.Group,e.traits=["node"],e}(i),e.exports=r},{"../../primitive":44}],48:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./parent"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","root","clock","scene","vertex","unit"],e.prototype.init=function(){return this.size=null,this.cameraEvent={type:"root.camera"},this.preEvent={type:"root.pre"},this.updateEvent={type:"root.update"},this.renderEvent={type:"root.render"},this.postEvent={type:"root.post"},this.clockEvent={type:"clock.tick"},this.camera=null},e.prototype.make=function(){return this._helpers.unit.make()},e.prototype.unmake=function(){return this._helpers.unit.unmake()},e.prototype.change=function(t,e,n){return t["root.camera"]||n?(this._unattach(),this._attach(this.props.camera,"camera",this.setCamera,this,this,!0),this.setCamera()):void 0},e.prototype.adopt=function(t){var e,n,r,i,o;for(i=t.renders,o=[],e=0,n=i.length;n>e;e++)r=i[e],o.push(this._context.scene.add(r));return o},e.prototype.unadopt=function(t){var e,n,r,i,o;for(i=t.renders,o=[],e=0,n=i.length;n>e;e++)r=i[e],o.push(this._context.scene.remove(r));return o},e.prototype.select=function(t){return this.node.model.select(t)},e.prototype.watch=function(t,e){return this.node.model.watch(t,e)},e.prototype.unwatch=function(t){return this.node.model.unwatch(t)},e.prototype.resize=function(t){return this.size=t,this.trigger({type:"root.resize",size:t})},e.prototype.getSize=function(){return this.size},e.prototype.getSpeed=function(){return this.props.speed},e.prototype.getUnit=function(){return this._helpers.unit.get()},e.prototype.getUnitUniforms=function(){return this._helpers.unit.uniforms()},e.prototype.pre=function(){return this.getCamera().updateProjectionMatrix(),this.trigger(this.clockEvent),this.trigger(this.preEvent)},e.prototype.update=function(){return this.trigger(this.updateEvent)},e.prototype.render=function(){return this.trigger(this.renderEvent)},e.prototype.post=function(){return this.trigger(this.postEvent)},e.prototype.setCamera=function(){var t,e;return t=null!=(e=this.select(this.props.camera)[0])?e.controller:void 0,this.camera!==t?(this.camera=t,this.trigger({type:"root.camera"})):void 0},e.prototype.getCamera=function(){var t,e;return null!=(t=null!=(e=this.camera)?e.getCamera():void 0)?t:this._context.defaultCamera},e.prototype.getTime=function(){return this._context.time},e.prototype.vertex=function(t,e){return 2===e?t.pipe("view.position"):3===e?t.pipe("root.position"):t},e}(r),e.exports=i},{"../../../util":175,"./parent":47}],49:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","source","index"],e.prototype.made=function(){return this.trigger({type:"source.rebuild"})},e.prototype.indexShader=function(t){return t.pipe(o.GLSL.identity("vec4"))},e.prototype.sourceShader=function(t){return t.pipe(o.GLSL.identity("vec4"))},e.prototype.getDimensions=function(){return{items:1,width:1,height:1,depth:1}},e.prototype.getActiveDimensions=function(){return this.getDimensions()},e.prototype.getIndexDimensions=function(){return this.getActiveDimensions()},e.prototype.getFutureDimensions=function(){return this.getActiveDimensions()},e}(r),e.exports=i},{"../../../util":175,"../../primitive":44}],50:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./parent"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","unit"],e.prototype.make=function(){return this._helpers.unit.make()},e.prototype.unmake=function(){return this._helpers.unit.unmake()},e.prototype.getUnit=function(){return this._helpers.unit.get()},e.prototype.getUnitUniforms=function(){return this._helpers.unit.uniforms()},e}(r),e.exports=i},{"../../../util":175,"./parent":47}],51:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","camera"],e.prototype.init=function(){},e.prototype.make=function(){var t;return t=this._context.defaultCamera,this.camera=this.props.proxy?t:t.clone(),this.euler=new THREE.Euler,this.quat=new THREE.Quaternion},e.prototype.unmake=function(){},e.prototype.getCamera=function(){return this.camera},e.prototype.change=function(t,e,n){var r,i,s,a,u,h,l,c;return t["camera.position"]||t["camera.quaternion"]||t["camera.rotation"]||t["camera.lookAt"]||t["camera.up"]||t["camera.fov"]||n?(h=this.props,a=h.position,u=h.quaternion,l=h.rotation,s=h.lookAt,c=h.up,i=h.fov,r=h.aspect,null!=a&&this.camera.position.copy(a),(null!=u||null!=l||null!=s)&&(null!=s?this.camera.lookAt(s):this.camera.quaternion.set(0,0,0,1),null!=l&&(this.euler.setFromVector3(l,o.Three.swizzleToEulerOrder(this.props.eulerOrder)),this.quat.setFromEuler(this.euler),this.camera.quaternion.multiply(this.quat)),null!=u&&this.camera.quaternion.multiply(u)),null!=i&&null!=this.camera.fov&&(this.camera.fov=i),null!=c&&this.camera.up.copy(c),this.camera.updateMatrix()):void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],52:[function(t,e,n){var r;r={axis:t("./draw/axis"),face:t("./draw/face"),grid:t("./draw/grid"),line:t("./draw/line"),point:t("./draw/point"),strip:t("./draw/strip"),surface:t("./draw/surface"),ticks:t("./draw/ticks"),vector:t("./draw/vector"),view:t("./view/view"),cartesian:t("./view/cartesian"),cartesian4:t("./view/cartesian4"),polar:t("./view/polar"),spherical:t("./view/spherical"),stereographic:t("./view/stereographic"),stereographic4:t("./view/stereographic4"),transform:t("./transform/transform3"),transform4:t("./transform/transform4"),vertex:t("./transform/vertex"),fragment:t("./transform/fragment"),layer:t("./transform/layer"),mask:t("./transform/mask"),array:t("./data/array"),interval:t("./data/interval"),matrix:t("./data/matrix"),area:t("./data/area"),voxel:t("./data/voxel"),volume:t("./data/volume"),scale:t("./data/scale"),html:t("./overlay/html"),dom:t("./overlay/dom"),text:t("./text/text"),format:t("./text/format"),label:t("./text/label"),retext:t("./text/retext"),clamp:t("./operator/clamp"),grow:t("./operator/grow"),join:t("./operator/join"),lerp:t("./operator/lerp"),memo:t("./operator/memo"),readback:t("./operator/readback"),resample:t("./operator/resample"),repeat:t("./operator/repeat"),swizzle:t("./operator/swizzle"),spread:t("./operator/spread"),split:t("./operator/split"),slice:t("./operator/slice"),subdivide:t("./operator/subdivide"),transpose:t("./operator/transpose"),group:t("./base/group"),inherit:t("./base/inherit"),root:t("./base/root"),unit:t("./base/unit"),shader:t("./shader/shader"),camera:t("./camera/camera"),rtt:t("./rtt/rtt"),compose:t("./rtt/compose"),clock:t("./time/clock"),now:t("./time/now"),move:t("./present/move"),play:t("./present/play"),present:t("./present/present"),reveal:t("./present/reveal"),slide:t("./present/slide"),step:t("./present/step")},e.exports=r},{"./base/group":45,"./base/inherit":46,"./base/root":48,"./base/unit":50,"./camera/camera":51,"./data/area":53,"./data/array":54,"./data/interval":57,"./data/matrix":58,"./data/scale":59,"./data/volume":60,"./data/voxel":61,"./draw/axis":62,"./draw/face":63,"./draw/grid":64,"./draw/line":65,"./draw/point":66,"./draw/strip":67,"./draw/surface":68,"./draw/ticks":69,"./draw/vector":70,"./operator/clamp":73,"./operator/grow":74,"./operator/join":75,"./operator/lerp":76,"./operator/memo":77,"./operator/readback":79,"./operator/repeat":80,"./operator/resample":81,"./operator/slice":82,"./operator/split":83,"./operator/spread":84,"./operator/subdivide":85,"./operator/swizzle":86,"./operator/transpose":87,"./overlay/dom":88,"./overlay/html":89,"./present/move":90,"./present/play":91,"./present/present":92,"./present/reveal":93,"./present/slide":94,"./present/step":95,"./rtt/compose":98,"./rtt/rtt":99,"./shader/shader":100,"./text/format":101,"./text/label":102,"./text/retext":103,"./text/text":104,"./time/clock":105,"./time/now":106,"./transform/fragment":108,"./transform/layer":109,"./transform/mask":110,"./transform/transform3":112,"./transform/transform4":113,"./transform/vertex":114,"./view/cartesian":116,"./view/cartesian4":117,"./view/polar":118,"./view/spherical":119,"./view/stereographic":120,"./view/stereographic4":121,"./view/view":122}],53:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./matrix"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","source","index","matrix","texture","raw","span:x","span:y","area","sampler:x","sampler:y"],e.prototype.updateSpan=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p;return n=this.props.axes,p=this.props.width,r=this.props.height,t=this.props.centeredX,e=this.props.centeredY,s=this.props.paddingX,a=this.props.paddingY,u=this._helpers.span.get("x.",n[0]),h=this._helpers.span.get("y.",n[1]),this.aX=u.x,this.aY=h.x,l=u.y-u.x,c=h.y-h.x,p+=2*s,r+=2*a,t?(i=1/Math.max(1,p),this.aX+=l*i/2):i=1/Math.max(1,p-1),e?(o=1/Math.max(1,r),this.aY+=c*o/2):o=1/Math.max(1,r-1),this.bX=l*i,this.bY=c*o,this.aX+=s*this.bX,this.aY+=a*this.bY},e.prototype.callback=function(t){return this.updateSpan(),this.last===t?this._callback:(this.last=t,t.length<=5?this._callback=function(e){return function(n,r,i){var o,s;return o=e.aX+e.bX*r,s=e.aY+e.bY*i,t(n,o,s,r,i)}}(this):this._callback=function(e){return function(n,r,i){var o,s;return o=e.aX+e.bX*r,s=e.aY+e.bY*i,t(n,o,s,r,i,e.bufferClock,e.bufferStep)}}(this))},e.prototype.make=function(){return e.__super__.make.apply(this,arguments),this._helpers.span.make(),this._listen(this,"span.range",this.updateSpan)},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this._helpers.span.unmake()},e}(i),e.exports=r},{"../../../util":175,"./matrix":58}],54:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./buffer"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","source","index","array","texture","raw"],e.prototype.init=function(){return this.buffer=this.spec=null,this.space={width:0,history:0},this.used={width:0},this.storage="arrayBuffer",this.passthrough=function(t,e){return t(e,0,0,0)},e.__super__.init.apply(this,arguments)},e.prototype.sourceShader=function(t){ +var e;return e=this.getDimensions(),this.alignShader(e,t),this.buffer.shader(t)},e.prototype.getDimensions=function(){return{items:this.items,width:this.space.width,height:this.space.history,depth:1}},e.prototype.getActiveDimensions=function(){return{items:this.items,width:this.used.width,height:this.buffer.getFilled(),depth:1}},e.prototype.getFutureDimensions=function(){return{items:this.items,width:this.used.width,height:this.space.history,depth:1}},e.prototype.getRawDimensions=function(){return{items:this.items,width:space.width,height:1,depth:1}},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d,m;return e.__super__.make.apply(this,arguments),u=null!=(h=this.minFilter)?h:this.props.minFilter,a=null!=(l=this.magFilter)?l:this.props.magFilter,d=null!=(c=this.type)?c:this.props.type,m=this.props.width,i=this.props.history,p=this.props.bufferWidth,t=this.props.channels,s=this.props.items,r=this.spec={channels:t,items:s,width:m},this.items=r.items,this.channels=r.channels,n=this.props.data,r=o.Data.getDimensions(n,r),f=this.space,f.width=Math.max(p,r.width||1),f.history=i,this.buffer=this._renderables.make(this.storage,{width:f.width,history:f.history,channels:t,items:s,minFilter:u,magFilter:a,type:d})},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.buffer?(this.buffer.dispose(),this.buffer=this.spec=null):void 0},e.prototype.change=function(t,e,n){var r;if(e.texture||t["history.history"]||t["buffer.channels"]||t["buffer.items"]||t["array.bufferWidth"])return this.rebuild();if(this.buffer)return t["array.width"]&&(r=this.props.width,r>this.space.width)?this.rebuild():t["data.map"]||t["data.data"]||t["data.resolve"]||t["data.expr"]||n?this.buffer.setCallback(this.emitter()):void 0},e.prototype.callback=function(t){return t.length<=2?t:function(e){return function(n,r){return t(n,r,e.bufferClock,e.bufferStep)}}(this)},e.prototype.update=function(){var t,e,n,r,i;if(this.buffer)return t=this.props.data,r=this.space,i=this.used,n=i.width,e=this.buffer.getFilled(),this.syncBuffer(function(e){return function(n){var s,a,u;return null!=t?(a=o.Data.getDimensions(t,e.spec),a.width>r.width?(n(),e.rebuild()):(i.width=a.width,e.buffer.setActive(i.width),"function"==typeof(s=e.buffer.callback).rebind&&s.rebind(t),e.buffer.update())):(u=e.spec.width||1,e.buffer.setActive(u),u=e.buffer.update(),i.width=u)}}(this)),i.width!==n||e!==this.buffer.getFilled()?this.trigger({type:"source.resize"}):void 0},e}(i),e.exports=r},{"../../../util":175,"./buffer":55}],55:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./data"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","source","index","texture"],e.prototype.init=function(){return this.bufferSlack=0,this.bufferFrames=0,this.bufferTime=0,this.bufferDelta=0,this.bufferClock=0,this.bufferStep=0,e.__super__.init.apply(this,arguments)},e.prototype.make=function(){return e.__super__.make.apply(this,arguments),this.clockParent=this._inherit("clock")},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.rawBuffer=function(){return this.buffer},e.prototype.emitter=function(){var t,n,r;return r=this.props,t=r.channels,n=r.items,e.__super__.emitter.call(this,t,n)},e.prototype.change=function(t,e,n){var r;return t["buffer.fps"]||n?(r=this.props.fps,this.bufferSlack=r?.5/r:0):void 0},e.prototype.syncBuffer=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;if(this.buffer&&(d=this.props,c=d.live,i=d.fps,a=d.hurry,l=d.limit,f=d.realtime,p=d.observe,r=this.buffer.getFilled(),!r||c)){if(b=this.clockParent.getTime(),null!=i){for(g=this.bufferSlack,E=b.step/b.delta,n=f?b.delta:b.step,o=1/i,y=f&&p?E*o:o,this.bufferSlack=Math.min(l/i,g+n),this.bufferDelta=n,this.bufferStep=y,s=Math.min(a,Math.floor(g*i)),r||(s=Math.max(1,s)),_=!1,e=function(){return _=!0},v=[],u=h=0,m=s;(m>=0?m>h:h>m)&&(this.bufferTime+=n,this.bufferClock+=y,!_);u=m>=0?++h:--h)t(e,this.bufferFrames++,u,s),v.push(this.bufferSlack-=o);return v}return this.bufferTime=b.time,this.bufferDelta=b.delta,this.bufferClock=b.clock,this.bufferStep=b.step,t(function(){},this.bufferFrames++,0,1)}},e.prototype.alignShader=function(t,e){var n,r,i,o,s,a;return a=this.props,i=a.minFilter,r=a.magFilter,n=a.aligned,o=t.items>1&&t.width>1||t.height>1&&t.depth>1,!n&&o?(s=i===this.node.attributes["texture.minFilter"]["enum"].nearest&&r===this.node.attributes["texture.magFilter"]["enum"].nearest,s||console.warn(this.node.toString()+" - Cannot use linear min/magFilter with 3D/4D sampling"),e.pipe("map.xyzw.align")):void 0},e}(i),e.exports=r},{"../../../util":175,"./data":56}],56:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../base/source"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","data","source","index","entity","active"],e.prototype.init=function(){return this.dataEmitter=null,this.dataSizes=null},e.prototype.emitter=function(t,e){var n,r,i,s,a,u,h,l;return r=this.props.data,n=this.props.bind,s=this.props.expr,null!=r?(a=this.dataSizes,h=o.Data.getSizes(r),a&&a.length===h.length||(l=o.Data.getThunk(r),this.dataEmitter=this.callback(o.Data.makeEmitter(l,e,t)),this.dataSizes=h),i=this.dataEmitter):"undefined"!=typeof u&&null!==u?(u=this._inherit("resolve"),i=this.callback(u.callback(n))):i=null!=s?this.callback(s):this.callback(this.passthrough),i},e.prototype.callback=function(t){return null!=t?t:function(){}},e.prototype.update=function(){},e.prototype.make=function(){return this._helpers.active.make(),this.first=!0,this._listen("root","root.update",function(t){return function(){return(t.isActive||t.first)&&t.update(),t.first=!1}}(this))},e.prototype.unmake=function(){return this._helpers.active.unmake(),this.dataEmitter=null,this.dataSizes=null},e}(i),e.exports=r},{"../../../util":175,"../base/source":49}],57:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("./array"),i=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","source","index","texture","array","span","interval","sampler","raw"],e.prototype.updateSpan=function(){var t,e,n,r,i,o,s;return e=this.props.axis,s=this.props.width,t=this.props.centered,r=this.props.padding,i=this._helpers.span.get("",e),s+=2*r,this.a=i.x,o=i.y-i.x,t?(n=1/Math.max(1,s),this.a+=o*n/2):n=1/Math.max(1,s-1),this.b=o*n,this.a+=r*this.b},e.prototype.callback=function(t){return this.updateSpan(),this.last===t?this._callback:(this.last=t,t.length<=3?this._callback=function(e){return function(n,r){var i;return i=e.a+e.b*r,t(n,i,r)}}(this):this._callback=function(e){return function(n,r){var i;return i=e.a+e.b*r,t(n,i,r,e.bufferClock,e.bufferStep)}}(this))},e.prototype.make=function(){return e.__super__.make.apply(this,arguments),this._helpers.span.make(),this._listen(this,"span.range",this.updateSpan)},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this._helpers.span.unmake()},e}(o),e.exports=r},{"../../../util":175,"./array":54}],58:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./buffer"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","source","index","texture","matrix","raw"],e.prototype.init=function(){return this.buffer=this.spec=null,this.space={width:0,height:0,history:0},this.used={width:0,height:0},this.storage="matrixBuffer",this.passthrough=function(t,e,n){return t(e,n,0,0)},e.__super__.init.apply(this,arguments)},e.prototype.sourceShader=function(t){var e;return e=this.getDimensions(),this.alignShader(e,t),this.buffer.shader(t)},e.prototype.getDimensions=function(){return{items:this.items,width:this.space.width,height:this.space.height,depth:this.space.history}},e.prototype.getActiveDimensions=function(){return{items:this.items,width:this.used.width,height:this.used.height,depth:this.buffer.getFilled()}},e.prototype.getFutureDimensions=function(){return{items:this.items,width:this.used.width,height:this.used.height,depth:this.space.history}},e.prototype.getRawDimensions=function(){return{items:this.items,width:this.space.width,height:this.space.height,depth:1}},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g;return e.__super__.make.apply(this,arguments),h=null!=(l=this.minFilter)?l:this.props.minFilter,u=null!=(c=this.magFilter)?c:this.props.magFilter,v=null!=(p=this.type)?p:this.props.type,g=this.props.width,i=this.props.height,s=this.props.history,f=this.props.bufferWidth,d=this.props.bufferHeight,t=this.props.channels,a=this.props.items,r=this.spec={channels:t,items:a,width:g,height:i},this.items=r.items,this.channels=r.channels,n=this.props.data,r=o.Data.getDimensions(n,r),m=this.space,m.width=Math.max(f,r.width||1),m.height=Math.max(d,r.height||1),m.history=s,this.buffer=this._renderables.make(this.storage,{width:m.width,height:m.height,history:m.history,channels:t,items:a,minFilter:h,magFilter:u,type:v})},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.buffer?(this.buffer.dispose(),this.buffer=this.spec=null):void 0},e.prototype.change=function(t,e,n){var r,i;if(e.texture||t["matrix.history"]||t["buffer.channels"]||t["buffer.items"]||t["matrix.bufferWidth"]||t["matrix.bufferHeight"])return this.rebuild();if(this.buffer)return t["matrix.width"]&&(i=this.props.width,i>this.space.width)?this.rebuild():t["matrix.height"]&&(r=this.props.height,r>this.space.height)?this.rebuild():t["data.map"]||t["data.data"]||t["data.resolve"]||t["data.expr"]||n?this.buffer.setCallback(this.emitter()):void 0},e.prototype.callback=function(t){return t.length<=3?t:function(e){return function(n,r,i){return t(n,r,i,e.bufferClock,e.bufferStep)}}(this)},e.prototype.update=function(){var t,e,n,r,i,s;if(this.buffer)return t=this.props.data,r=this.space,i=this.used,s=i.width,n=i.height,e=this.buffer.getFilled(),this.syncBuffer(function(e){return function(n){var s,a,u,h,l,c;return null!=t?(u=o.Data.getDimensions(t,e.spec),u.width>r.width||u.height>r.height?(n(),e.rebuild()):(i.width=u.width,i.height=u.height,e.buffer.setActive(i.width,i.height),"function"==typeof(a=e.buffer.callback).rebind&&a.rebind(t),e.buffer.update())):(c=e.spec.width||1,h=e.spec.height||1,e.buffer.setActive(c,h),l=e.buffer.update(),i.width=s=c,i.height=Math.ceil(l/s),1===i.height?i.width=l:void 0)}}(this)),i.width!==s||i.height!==n||e!==this.buffer.getFilled()?this.trigger({type:"source.resize"}):void 0},e}(r),e.exports=i},{"../../../util":175,"./buffer":55}],59:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../base/source"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","source","index","interval","span","scale","raw","origin"],e.prototype.init=function(){return this.used=this.space=this.scaleAxis=this.sampler=null},e.prototype.rawBuffer=function(){return this.buffer},e.prototype.sourceShader=function(t){return t.pipe(this.sampler)},e.prototype.getDimensions=function(){return{items:1,width:this.space,height:1,depth:1}},e.prototype.getActiveDimensions=function(){return{items:1,width:this.used,height:this.buffer.getFilled(),depth:1}},e.prototype.getRawDimensions=function(){return this.getDimensions()},e.prototype.make=function(){var t,e,n;return this.space=n=this._helpers.scale.divide(""),this.buffer=this._renderables.make("dataBuffer",{width:n,channels:1,items:1}),e={scaleAxis:this._attributes.make(this._types.vec4()),scaleOffset:this._attributes.make(this._types.vec4())},this.scaleAxis=e.scaleAxis.value,this.scaleOffset=e.scaleOffset.value,t=this.sampler=this._shaders.shader(),t.require(this.buffer.shader(this._shaders.shader(),1)),t.pipe("scale.position",e),this._helpers.span.make(),this._listen(this,"span.range",this.updateRanges)},e.prototype.unmake=function(){return this.scaleAxis=null,this._helpers.span.unmake()},e.prototype.change=function(t,e,n){return t["scale.divide"]?this.rebuild():e.view||e.interval||e.span||e.scale||n?this.updateRanges():void 0},e.prototype.updateRanges=function(){var t,e,n,r,i,s,a,u;return u=this.used,s=this.props,t=s.axis,r=s.origin,i=this._helpers.span.get("",t),n=i.x,e=i.y,a=this._helpers.scale.generate("",this.buffer,n,e),o.Axis.setDimension(this.scaleAxis,t),o.Axis.setOrigin(this.scaleOffset,t,r),this.used=a.length,this.used!==u?this.trigger({type:"source.resize"}):void 0},e}(i),e.exports=r},{"../../../util":175,"../base/source":49}],60:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("./voxel"),r=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","source","index","texture","voxel","span:x","span:y","span:z","volume","sampler:x","sampler:y","sampler:z","raw"],e.prototype.updateSpan=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E;return i=this.props.axes,E=this.props.width,o=this.props.height,r=this.props.depth,t=this.props.centeredX,e=this.props.centeredY,n=this.props.centeredZ,h=this.props.paddingX,l=this.props.paddingY,c=this.props.paddingZ,p=this._helpers.span.get("x.",i[0]),f=this._helpers.span.get("y.",i[1]),d=this._helpers.span.get("z.",i[2]),this.aX=p.x,this.aY=f.x,this.aZ=d.x,m=p.y-p.x,v=f.y-f.x,g=d.y-d.x,E+=2*h,o+=2*l,r+=2*c,t?(s=1/Math.max(1,E),this.aX+=m*s/2):s=1/Math.max(1,E-1),e?(a=1/Math.max(1,o),this.aY+=v*a/2):a=1/Math.max(1,o-1),n?(u=1/Math.max(1,r),this.aZ+=g*u/2):u=1/Math.max(1,r-1),this.bX=m*s,this.bY=v*a,this.bZ=g*u,this.aX+=this.bX*h,this.aY+=this.bY*l,this.aZ+=this.bZ*l},e.prototype.callback=function(t){return this.updateSpan(),this.last===t?this._callback:(this.last=t,t.length<=7?this._callback=function(e){return function(n,r,i,o){var s,a,u;return s=e.aX+e.bX*r,a=e.aY+e.bY*i,u=e.aZ+e.bZ*o,t(n,s,a,u,r,i,o)}}(this):this._callback=function(e){return function(n,r,i,o){var s,a,u;return s=e.aX+e.bX*r,a=e.aY+e.bY*i,u=e.aZ+e.bZ*o,t(n,s,a,u,r,i,o,e.bufferClock,e.bufferStep)}}(this))},e.prototype.make=function(){return e.__super__.make.apply(this,arguments),this._helpers.span.make(),this._listen(this,"span.range",this.updateSpan)},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this._helpers.span.unmake()},e}(o),e.exports=i},{"../../../util":175,"./voxel":61}],61:[function(t,e,n){var r,i,o,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("./buffer"),i=t("../../../util"),o=function(t){function e(){return this.update=s(this.update,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.traits=["node","buffer","active","data","source","index","texture","voxel","raw"],e.prototype.init=function(){return this.buffer=this.spec=null,this.space={width:0,height:0,depth:0},this.used={width:0,height:0,depth:0},this.storage="voxelBuffer",this.passthrough=function(t,e,n,r){return t(e,n,r,0)},e.__super__.init.apply(this,arguments)},e.prototype.sourceShader=function(t){var e;return e=this.getDimensions(),this.alignShader(e,t),this.buffer.shader(t)},e.prototype.getDimensions=function(){return{items:this.items,width:this.space.width,height:this.space.height,depth:this.space.depth}},e.prototype.getActiveDimensions=function(){return{items:this.items,width:this.used.width,height:this.used.height,depth:this.used.depth*this.buffer.getFilled()}},e.prototype.getRawDimensions=function(){return this.getDimensions()},e.prototype.make=function(){var t,n,r,o,s,a,u,h,l,c,p,f,d,m,v,g,E;return e.__super__.make.apply(this,arguments),h=null!=(l=this.minFilter)?l:this.props.minFilter,u=null!=(c=this.magFilter)?c:this.props.magFilter,g=null!=(p=this.type)?p:this.props.type,E=this.props.width,s=this.props.height,r=this.props.depth,f=this.props.bufferWidth,d=this.props.bufferHeight,m=this.props.bufferDepth,t=this.props.channels,a=this.props.items,o=this.spec={channels:t,items:a,width:E,height:s,depth:r},this.items=o.items,this.channels=o.channels,n=this.props.data,o=i.Data.getDimensions(n,o),v=this.space,v.width=Math.max(f,o.width||1),v.height=Math.max(d,o.height||1),v.depth=Math.max(m,o.depth||1),this.buffer=this._renderables.make(this.storage,{width:v.width,height:v.height,depth:v.depth,channels:t,items:a,minFilter:h,magFilter:u,type:g})},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.buffer?(this.buffer.dispose(),this.buffer=this.spec=null):void 0},e.prototype.change=function(t,e,n){var r,i,o;if(e.texture||t["buffer.channels"]||t["buffer.items"]||t["voxel.bufferWidth"]||t["voxel.bufferHeight"]||t["voxel.bufferDepth"])return this.rebuild();if(this.buffer)return t["voxel.width"]&&(o=this.props.width,o>this.space.width)?this.rebuild():t["voxel.height"]&&(i=this.props.height,i>this.space.height)?this.rebuild():t["voxel.depth"]&&(r=this.props.depth,r>this.space.depth)?this.rebuild():t["data.map"]||t["data.data"]||t["data.resolve"]||t["data.expr"]||n?this.buffer.setCallback(this.emitter()):void 0},e.prototype.callback=function(t){return t.length<=4?t:function(e){return function(n,r,i,o){return t(n,r,i,o,e.bufferClock,e.bufferStep)}}(this)},e.prototype.update=function(){var t,e,n,r,o,s,a;if(this.buffer)return e=this.props.data,o=this.space,s=this.used,a=s.width,r=s.height,t=s.depth,n=this.buffer.getFilled(),this.syncBuffer(function(t){return function(n){var r,a,u,h,l,c,p,f;return null!=e?(l=i.Data.getDimensions(e,t.spec),l.width>o.width||l.height>o.height||l.depth>o.depth?(n(),t.rebuild()):(s.width=l.width,s.height=l.height,s.depth=l.depth,t.buffer.setActive(s.width,s.height,s.depth),"function"==typeof(u=t.buffer.callback).rebind&&u.rebind(e),t.buffer.update())):(f=t.spec.width||1,c=t.spec.height||1,h=t.spec.depth||1,t.buffer.setActive(f,c,h),p=t.buffer.update(),s.width=a=f,s.height=r=c,s.depth=Math.ceil(p/a/r),1===s.depth&&(s.height=Math.ceil(p/a),1===s.height)?s.width=p:void 0)}}(this)),s.width!==a||s.height!==r||s.depth!==t||n!==this.buffer.getFilled()?this.trigger({type:"source.resize"}):void 0},e}(r),e.exports=o},{"../../../util":175,"./buffer":55}],62:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.axisPosition=this.axisStep=this.resolution=this.line=this.arrows=null}return s(e,t),e.traits=["node","object","visible","style","line","axis","span","interval","arrow","position","origin","shade"],e.defaults={end:!0,zBias:-1},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;return c={axisPosition:this._attributes.make(this._types.vec4()),axisStep:this._attributes.make(this._types.vec4())},this.axisPosition=c.axisPosition.value,this.axisStep=c.axisStep.value,l=this._shaders.shader(),l.pipe("axis.position",c),l=this._helpers.position.pipeline(l),E=this._helpers.style.uniforms(),a=this._helpers.line.uniforms(),t=this._helpers.arrow.uniforms(),b=this._inherit("unit").getUnitUniforms(),r=this.props.detail,m=r+1,this.resolution=1/r,p=this.props,v=p.start,i=p.end,f=this.props,g=f.stroke,s=f.join,u=this._helpers.object.mask(),h=this._helpers.shade.pipeline()||!1,d=this.props,n=d.crossed,e=d.axis,!n&&null!=u&&e>1&&(y=["x000","y000","z000","w000"][e],u=this._helpers.position.swizzle(u,y)),_=o.JS.merge(t,a,E,b),this.line=this._renderables.make("line",{uniforms:_,samples:m,position:l,clip:v||i,stroke:g,join:s,mask:u,material:h}),this.arrows=[],v&&this.arrows.push(this._renderables.make("arrow",{uniforms:_,flip:!0,samples:m,position:l,mask:u,material:h})),i&&this.arrows.push(this._renderables.make("arrow",{uniforms:_,samples:m,position:l,mask:u,material:h})),this._helpers.visible.make(),this._helpers.object.make(this.arrows.concat([this.line])),this._helpers.span.make(),this._listen(this,"span.range",this.updateRanges)},e.prototype.unmake=function(){return this._helpers.visible.unmake(),this._helpers.object.unmake(),this._helpers.span.unmake()},e.prototype.change=function(t,e,n){return t["axis.detail"]||t["line.stroke"]||t["line.join"]||t["axis.crossed"]||t["interval.axis"]&&this.props.crossed?this.rebuild():e.interval||e.span||e.view||n?this.updateRanges():void 0},e.prototype.updateRanges=function(){var t,e,n,r,i,s;return s=this.props,t=s.axis,r=s.origin,i=this._helpers.span.get("",t),n=i.x,e=i.y,o.Axis.setDimension(this.axisPosition,t).multiplyScalar(n),o.Axis.setDimension(this.axisStep,t).multiplyScalar((e-n)*this.resolution),o.Axis.addOrigin(this.axisPosition,t,r)},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],63:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.face=null}return s(e,t),e.traits=["node","object","visible","style","line","mesh","face","geometry","position","bind","shade"],e.prototype.resize=function(){var t,e,n,r,i,o;if(null!=this.bind.points)return e=this.bind.points.getActiveDimensions(),r=e.items,o=e.width,n=e.height,t=e.depth,this.face&&this.face.geometry.clip(o,n,t,r),this.line&&this.line.geometry.clip(r,o,n,t),null!=this.bind.map&&(i=this.bind.map.getActiveDimensions(),this.face)?this.face.geometry.map(i.width,i.height,i.depth,i.items):void 0},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"},{to:"mesh.map",trait:"source"}]),null!=this.bind.points?(v=this.bind.points.sourceShader(this._shaders.shader()),v=this._helpers.position.pipeline(v),b=this._helpers.style.uniforms(),c=this._helpers.line.uniforms(),w=this._inherit("unit").getUnitUniforms(),H={},H.styleZBias=this._attributes.make(this._types.number()),this.wireZBias=H.styleZBias,n=this.bind.points.getDimensions(),a=n.items,R=n.width,s=n.height,e=n.depth,g=this.props,h=g.line,y=g.shaded,i=g.fill,_=g.stroke,u=g.join,this.bind.colors&&(t=this._shaders.shader(),this.bind.colors.sourceShader(t)),f=this._helpers.object.mask(),p=this._helpers.shade.map(null!=(E=this.bind.map)?E.sourceShader(this._shaders.shader()):void 0),d=this._helpers.shade.pipeline(),r=d||y,l=d||!1,m=[],h&&(T=this._shaders.shader(),T.pipe(o.GLSL.swizzleVec4("yzwx")),T.pipe(v),x=o.JS.merge(w,c,b,H),this.line=this._renderables.make("line",{uniforms:x,samples:a,strips:R,ribbons:s,layers:e,position:T,color:t,stroke:_,join:u,material:l,mask:f,closed:!0}),m.push(this.line)),i&&(x=o.JS.merge(w,b,{}),this.face=this._renderables.make("face",{uniforms:x,width:R,height:s,depth:e,items:a,position:v,color:t,material:r,mask:f,map:p}),m.push(this.face)),this._helpers.visible.make(),this._helpers.object.make(m)):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.face=this.line=null},e.prototype.change=function(t,e,n){var r,i,o,s;return t["geometry.points"]||e.mesh?this.rebuild():t["style.zBias"]||t["mesh.lineBias"]||n?(o=this.props,r=o.fill,s=o.zBias,i=o.lineBias,this.wireZBias.value=s+(r?i:0)):void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],64:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.axes=null}return s(e,t),e.traits=["node","object","visible","style","line","grid","area","position","origin","shade","axis:x","axis:y","scale:x","scale:y","span:x","span:y"],e.defaults={width:1,zBias:-2},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f;return u=this._helpers.object.mask(),h=this._helpers.shade.pipeline()||!1,e=function(t){return function(e,n,i){var s,a,l,c,f,d,m,v,g,E,y,_,b,T;return a=t._get(e+"axis.detail"),g=a+1,v=1/a,E=t._helpers.scale.divide(n),s=t._renderables.make("dataBuffer",{width:E,channels:1}),m={gridPosition:t._attributes.make(t._types.vec4()),gridStep:t._attributes.make(t._types.vec4()),gridAxis:t._attributes.make(t._types.vec4())},T={gridPosition:m.gridPosition.value,gridStep:m.gridStep.value,gridAxis:m.gridAxis.value},f=d=t._shaders.shader(),null!=i&&null!=u&&(u=t._helpers.position.swizzle(u,i)),f.require(s.shader(t._shaders.shader(),2)),f.pipe("grid.position",m),d=t._helpers.position.pipeline(f),y=t._helpers.style.uniforms(),c=t._helpers.line.uniforms(),b=t._inherit("unit").getUnitUniforms(),_=o.JS.merge(c,y,b),l=t._renderables.make("line",{uniforms:_,samples:g,strips:E,position:d,stroke:p,join:r,mask:u,material:h}),{first:e,second:n,resolution:v,samples:g,line:l,buffer:s,values:T}}}(this),l=this.props,i=l.lineX,s=l.lineY,n=l.crossed,t=l.axes,f=["0000","x000","y000","z000","w000"][t[1]],c=this.props,p=c.stroke,r=c.join,this.axes=[],i&&this.axes.push(e("x.","y.",null)),s&&this.axes.push(e("y.","x.",n?null:f)),a=function(){var t,n,r,i;for(r=this.axes,i=[],t=0,n=r.length;n>t;t++)e=r[t],i.push(e.line);return i}.call(this),this._helpers.visible.make(),this._helpers.object.make(a),this._helpers.span.make(),this._listen(this,"span.range",this.updateRanges)},e.prototype.unmake=function(){var t,e,n,r;for(this._helpers.visible.unmake(),this._helpers.object.unmake(),this._helpers.span.unmake(),r=this.axes,e=0,n=r.length;n>e;e++)t=r[e],t.buffer.dispose();return this.axes=null},e.prototype.change=function(t,e,n){return t["x.axis.detail"]||t["y.axis.detail"]||t["x.axis.factor"]||t["y.axis.factor"]||t["grid.lineX"]||t["grid.lineY"]||t["line.stroke"]||t["line.join"]||t["grid.crossed"]||t["grid.axes"]&&this.props.crossed?this.rebuild():e.x||e.y||e.area||e.grid||e.view||n?this.updateRanges():void 0},e.prototype.updateRanges=function(){var t,e,n,r,i,s,a,u,h;return e=function(e){return function(n,r,s,a,u){var h,l,c,p,f,d,m,v,g,E,y;return l=u.first,g=u.second,m=u.resolution,v=u.samples,c=u.line,h=u.buffer,y=u.values,f=s.x,p=s.y,o.Axis.setDimension(y.gridPosition,n).multiplyScalar(f),o.Axis.setDimension(y.gridStep,n).multiplyScalar((p-f)*m),o.Axis.addOrigin(y.gridPosition,t,i),f=a.x,p=a.y,E=e._helpers.scale.generate(g,h,f,p),o.Axis.setDimension(y.gridAxis,r),d=E.length,c.geometry.clip(v,d,1,1)}}(this),u=this.props,t=u.axes,i=u.origin,s=this._helpers.span.get("x.",t[0]),a=this._helpers.span.get("y.",t[1]),h=this.props,n=h.lineX,r=h.lineY,n&&e(t[0],t[1],s,a,this.axes[0]),r?e(t[1],t[0],a,s,this.axes[+n]):void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],65:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.line=this.arrows=null}return s(e,t),e.traits=["node","object","visible","style","line","arrow","geometry","position","bind","shade"],e.prototype.resize=function(){var t,e,n,r,i,o,s,a,u,h;if(null!=this.bind.points){for(e=this.bind.points.getActiveDimensions(),u=e.width,h=e.height,a=e.depth,r=e.items,this.line.geometry.clip(u,h,a,r),o=this.arrows,s=[],n=0,i=o.length;i>n;n++)t=o[n],s.push(t.geometry.clip(u,h,a,r));return s}},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"}]),null!=this.bind.points?(l=this._shaders.shader(),l=this.bind.points.sourceShader(l),l=this._helpers.position.pipeline(l),y=this._helpers.style.uniforms(),a=this._helpers.line.uniforms(),t=this._helpers.arrow.uniforms(),b=this._inherit("unit").getUnitUniforms(),p=this.props,v=p.start,r=p.end,f=this.props,E=f.stroke,i=f.join,c=f.proximity,this.proximity=c,n=this.bind.points.getDimensions(),m=n.width,g=n.height,d=n.depth,s=n.items,this.bind.colors&&(e=this._shaders.shader(),this.bind.colors.sourceShader(e)),u=this._helpers.object.mask(),h=this._helpers.shade.pipeline()||!1,_=o.JS.merge(t,a,y,b),this.line=this._renderables.make("line",{uniforms:_,samples:m,strips:g,ribbons:d,layers:s,position:l,color:e,clip:v||r,stroke:E,join:i,proximity:c,mask:u,material:h}),this.arrows=[],v&&this.arrows.push(this._renderables.make("arrow",{uniforms:_,flip:!0,samples:m,strips:g,ribbons:d,layers:s,position:l,color:e,mask:u,material:h})),r&&this.arrows.push(this._renderables.make("arrow",{uniforms:_,samples:m,strips:g,ribbons:d,layers:s,position:l,color:e,mask:u,material:h})),this._helpers.visible.make(),this._helpers.object.make(this.arrows.concat([this.line]))):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.line=this.arrows=null},e.prototype.change=function(t,e,n){return t["geometry.points"]||t["line.stroke"]||t["line.join"]||t["arrow.start"]||t["arrow.end"]?this.rebuild():t["line.proximity"]&&null!=this.proximity!=(null!=this.props.proximity)?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],66:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.point=null}return s(e,t),e.traits=["node","object","visible","style","point","geometry","position","bind","shade"],e.prototype.resize=function(){var t,e,n,r,i;if(null!=this.bind.points)return e=this.bind.points.getActiveDimensions(),r=e.items,i=e.width,n=e.height,t=e.depth,this.point.geometry.clip(i,n,t,r)},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"},{to:"point.sizes",trait:"source"}]),null!=this.bind.points?(c=this._shaders.shader(),c=this.bind.points.sourceShader(c),c=this._helpers.position.pipeline(c),n=this.bind.points.getDimensions(),s=n.items,g=n.width,i=n.height,e=n.depth,d=this._helpers.style.uniforms(),l=this._helpers.point.uniforms(),v=this._inherit("unit").getUnitUniforms(),this.bind.colors&&(t=this._shaders.shader(),this.bind.colors.sourceShader(t)),this.bind.sizes&&(f=this._shaders.shader(),this.bind.sizes.sourceShader(f)), +a=this._helpers.object.mask(),u=this._helpers.shade.pipeline()||!1,p=this.props.shape,r=this.props.fill,h=this.props.optical,m=o.JS.merge(v,l,d),this.point=this._renderables.make("point",{uniforms:m,width:g,height:i,depth:e,items:s,position:c,color:t,size:f,shape:p,optical:h,fill:r,mask:a,material:u}),this._helpers.visible.make(),this._helpers.object.make([this.point])):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.point=null},e.prototype.change=function(t,e,n){return t["geometry.points"]||t["point.shape"]||t["point.fill"]?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],67:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),o=t("../../../util"),i=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.strip=null}return s(e,t),e.traits=["node","object","visible","style","line","mesh","strip","geometry","position","bind","shade"],e.prototype.resize=function(){var t,e,n,r,i,o;if(null!=this.bind.points)return e=this.bind.points.getActiveDimensions(),r=e.items,o=e.width,n=e.height,t=e.depth,this.strip&&this.strip.geometry.clip(o,n,t,r),this.line&&this.line.geometry.clip(r,o,n,t),null!=this.bind.map&&(i=this.bind.map.getActiveDimensions(),this.strip)?this.strip.geometry.map(i.width,i.height,i.depth,i.items):void 0},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"},{to:"mesh.map",trait:"source"}]),null!=this.bind.points?(v=this._shaders.shader(),v=this.bind.points.sourceShader(v),v=this._helpers.position.pipeline(v),b=this._helpers.style.uniforms(),c=this._helpers.line.uniforms(),w=this._inherit("unit").getUnitUniforms(),h=this.props.line,y=this.props.shaded,i=this.props.fill,H={},H.styleZBias=this._attributes.make(this._types.number()),this.wireZBias=H.styleZBias,n=this.bind.points.getDimensions(),a=n.items,R=n.width,s=n.height,e=n.depth,g=this.props,h=g.line,y=g.shaded,i=g.fill,_=g.stroke,u=g.join,this.bind.colors&&(t=this._shaders.shader(),t=this.bind.colors.sourceShader(t)),f=this._helpers.object.mask(),p=this._helpers.shade.map(null!=(E=this.bind.map)?E.sourceShader(this._shaders.shader()):void 0),d=this._helpers.shade.pipeline(),r=d||y,l=d||!1,m=[],h&&(T=this._shaders.shader(),T.pipe(o.GLSL.swizzleVec4("yzwx")),T.pipe(v),x=o.JS.merge(w,c,b,H),this.line=this._renderables.make("line",{uniforms:x,samples:a,strips:R,ribbons:s,layers:e,position:T,color:t,stroke:_,join:u,mask:f,material:l}),m.push(this.line)),i&&(x=o.JS.merge(b,{}),this.strip=this._renderables.make("strip",{uniforms:x,width:R,height:s,depth:e,items:a,position:v,color:t,material:r}),m.push(this.strip)),this._helpers.visible.make(),this._helpers.object.make(m)):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.strip=null},e.prototype.change=function(t,e,n){var r,i,o,s;return t["geometry.points"]||e.mesh?this.rebuild():t["style.zBias"]||t["mesh.lineBias"]||n?(o=this.props,r=o.fill,s=o.zBias,i=o.lineBias,this.wireZBias.value=s+(r?i:0)):void 0},e}(r),e.exports=i},{"../../../util":175,"../../primitive":44}],68:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),o=t("../../../util"),i=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.lineX=this.lineY=this.surface=null}return s(e,t),e.traits=["node","object","visible","style","line","mesh","geometry","surface","position","grid","bind","shade"],e.defaults={lineX:!1,lineY:!1},e.prototype.resize=function(){var t,e,n,r,i,o;if(null!=this.bind.points)return e=this.bind.points.getActiveDimensions(),o=e.width,n=e.height,t=e.depth,r=e.items,this.surface&&this.surface.geometry.clip(o,n,t,r),this.lineX&&this.lineX.geometry.clip(o,n,t,r),this.lineY&&this.lineY.geometry.clip(n,o,t,r),null!=this.bind.map&&(i=this.bind.map.getActiveDimensions(),this.surface)?this.surface.geometry.map(i.width,i.height,i.depth,i.items):void 0},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"},{to:"mesh.map",trait:"source"}]),null!=this.bind.points?(_=this._shaders.shader(),_=this.bind.points.sourceShader(_),_=this._helpers.position.pipeline(_),M=this._helpers.style.uniforms(),z=this._helpers.style.uniforms(),f=this._helpers.line.uniforms(),S=this._helpers.surface.uniforms(),P=this._inherit("unit").getUnitUniforms(),z.styleColor=this._attributes.make(this._types.color()),z.styleZBias=this._attributes.make(this._types.number()),this.wireColor=z.styleColor.value,this.wireZBias=z.styleZBias,this.wireScratch=new THREE.Color,s=this.bind.points.getDimensions(),L=s.width,h=s.height,i=s.depth,l=s.items,T=this.props,R=T.shaded,u=T.fill,d=T.lineX,m=T.lineY,t=T.closedX,e=T.closedY,H=T.stroke,c=T.join,b=T.proximity,r=T.crossed,y=[],this.proximity=b,this.bind.colors&&(n=this._shaders.shader(),this.bind.colors.sourceShader(n)),g=this._helpers.object.mask(),v=this._helpers.shade.map(null!=(x=this.bind.map)?x.sourceShader(this._shaders.shader()):void 0),E=this._helpers.shade.pipeline(),a=E||R,p=E||!1,w=this._helpers.position,k=w.swizzle,A=w.swizzle2,C=o.JS.merge(P,f,M,z),O=d||m?-50:0,d&&(this.lineX=this._renderables.make("line",{uniforms:C,samples:L,strips:h,ribbons:i,layers:l,position:_,color:n,zUnits:-O,stroke:H,join:c,mask:g,material:p,proximity:b,closed:t||closed}),y.push(this.lineX)),m&&(this.lineY=this._renderables.make("line",{uniforms:C,samples:h,strips:L,ribbons:i,layers:l,position:A(_,"yxzw","yxzw"),color:k(n,"yxzw"),zUnits:-O,stroke:H,join:c,mask:k(g,r?"xyzw":"yxzw"),material:p,proximity:b,closed:e||closed}),y.push(this.lineY)),u&&(C=o.JS.merge(P,S,M),this.surface=this._renderables.make("surface",{uniforms:C,width:L,height:h,surfaces:i,layers:l,position:_,color:n,zUnits:O,stroke:H,material:a,mask:g,map:v,intUV:!0,closedX:t||closed,closedY:e||closed}),y.push(this.surface)),this._helpers.visible.make(),this._helpers.object.make(y)):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.lineX=this.lineY=this.surface=null},e.prototype.change=function(t,e,n){var r,i,o,s,a,u;return t["geometry.points"]||t["mesh.shaded"]||t["mesh.fill"]||t["line.stroke"]||t["line.join"]||e.grid?this.rebuild():((t["style.color"]||t["style.zBias"]||t["mesh.fill"]||t["mesh.lineBias"]||n)&&(a=this.props,o=a.fill,i=a.color,u=a.zBias,s=a.lineBias,this.wireZBias.value=u+(o?s:0),this.wireColor.copy(i),o&&(r=this.wireScratch,r.setRGB(i.x,i.y,i.z),r.convertGammaToLinear().multiplyScalar(.75).convertLinearToGamma(),this.wireColor.x=r.r,this.wireColor.y=r.g,this.wireColor.z=r.b)),t["line.proximity"]&&null!=this.proximity!=(null!=this.props.proximity)?this.rebuild():void 0)},e}(r),e.exports=i},{"../../../util":175,"../../primitive":44}],69:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","object","visible","style","line","ticks","geometry","position","bind","shade"],e.prototype.init=function(){return this.tickStrip=this.line=null},e.prototype.resize=function(){var t,e,n,r,i;if(null!=this.bind.points)return e=this.bind.points.getActiveDimensions(),t=+(e.items>0),i=e.width*t,r=e.height*t,n=e.depth*t,this.line.geometry.clip(2,i,r,n),this.tickStrip.set(0,i-1)},e.prototype.make=function(){var t,e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"}]),null!=this.bind.points?(v=this._helpers.style.uniforms(),i=this._helpers.line.uniforms(),_=this._inherit("unit").getUnitUniforms(),y=o.JS.merge(i,v,_),l={tickEpsilon:this.node.attributes["ticks.epsilon"],tickSize:this.node.attributes["ticks.size"],tickNormal:this.node.attributes["ticks.normal"],tickStrip:this._attributes.make(this._types.vec2(0,0)),worldUnit:y.worldUnit,focusDepth:y.focusDepth},this.tickStrip=l.tickStrip.value,u=h=this._shaders.shader(),u.require(this.bind.points.sourceShader(this._shaders.shader())),u.require(this._helpers.position.pipeline(this._shaders.shader())),u.pipe("ticks.position",l),c=this.props,m=c.stroke,n=c.join,e=this.bind.points.getDimensions(),d=e.width,f=e.height,r=e.depth,this.bind.colors&&(t=this._shaders.shader(),this.bind.colors.sourceShader(t)),s=this._helpers.object.mask(),a=this._helpers.shade.pipeline()||!1,p=this._helpers.position,g=p.swizzle,E=p.swizzle2,this.line=this._renderables.make("line",{uniforms:y,samples:2,strips:d,ribbons:f,layers:r,position:h,color:t,stroke:m,join:n,mask:g(s,"yzwx"),material:a}),this._helpers.visible.make(),this._helpers.object.make([this.line])):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this.line=null,this._helpers.visible.unmake(),this._helpers.object.unmake()},e.prototype.change=function(t,e,n){return t["geometry.points"]||t["line.stroke"]||t["line.join"]?this.rebuild():void 0},e}(r),e.exports=i},{"../../../util":175,"../../primitive":44}],70:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),i=t("../../../util"),o=function(t){function e(t,n,r){e.__super__.constructor.call(this,t,n,r),this.line=this.arrows=null}return s(e,t),e.traits=["node","object","visible","style","line","arrow","geometry","position","bind","shade"],e.prototype.resize=function(){var t,e,n,r,i,o,s,a,u,h;if(null!=this.bind.points){for(e=this.bind.points.getActiveDimensions(),u=e.items,h=e.width,a=e.height,r=e.depth,this.line.geometry.clip(u,h,a,r),o=this.arrows,s=[],n=0,i=o.length;i>n;n++)t=o[n],s.push(t.geometry.clip(u,h,a,r));return s}},e.prototype.make=function(){var t,e,n,r,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w;return this._helpers.bind.make([{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"}]),null!=this.bind.points?(l=this._shaders.shader(),this.bind.points.sourceShader(l),this._helpers.position.pipeline(l),_=this._helpers.style.uniforms(),a=this._helpers.line.uniforms(),t=this._helpers.arrow.uniforms(),w=this._inherit("unit").getUnitUniforms(),p=this.props,g=p.start,r=p.end,f=this.props,y=f.stroke,o=f.join,c=f.proximity,this.proximity=c,n=this.bind.points.getDimensions(),v=n.items,E=n.width,m=n.height,s=n.depth,this.bind.colors&&(e=this._shaders.shader(),this.bind.colors.sourceShader(e)),u=this._helpers.object.mask(),h=this._helpers.shade.pipeline()||!1,d=this._helpers.position,b=d.swizzle,T=d.swizzle2,l=T(l,"yzwx","yzwx"),e=b(e,"yzwx"),u=b(u,"yzwx"),h=b(h,"yzwx"),x=i.JS.merge(t,a,_,w),this.line=this._renderables.make("line",{uniforms:x,samples:v,ribbons:m,strips:E,layers:s,position:l,color:e,clip:g||r,stroke:y,join:o,proximity:c,mask:u,material:h}),this.arrows=[],g&&this.arrows.push(this._renderables.make("arrow",{uniforms:x,flip:!0,samples:v,ribbons:m,strips:E,layers:s,position:l,color:e,mask:u,material:h})),r&&this.arrows.push(this._renderables.make("arrow",{uniforms:x,samples:v,ribbons:m,strips:E,layers:s,position:l,color:e,mask:u,material:h})),this._helpers.visible.make(),this._helpers.object.make(this.arrows.concat([this.line]))):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.line=this.arrows=null},e.prototype.change=function(t,e,n){return t["geometry.points"]||t["line.stroke"]||t["line.join"]||t["arrow.start"]||t["arrow.end"]?this.rebuild():t["line.proximity"]&&null!=this.proximity!=(null!=this.props.proximity)?this.rebuild():void 0},e}(r),e.exports=o},{"../../../util":175,"../../primitive":44}],71:[function(t,e,n){var r,i,o,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};r=t("../../util"),i=t("./view/view"),o={bind:{make:function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E;for(null==this.bind&&(this.bind={}),null==this.bound&&(this.bound=[]),r=0,s=t.length;s>r;r++){if(f=t[r],v=f.to,g=f.trait,l=f.optional,E=f.unique,u=f.multiple,e=f.callback,null==e&&(e=this.rebuild),h=v.split(/\./g).pop(),p=this._get(v),d=null,null!=p)for(m=this,n=!1;!n;)m=d=this._attach(p,g,e,this,m,l,u),i=E&&(null==d||this.bound.indexOf(d)<0),n=u||l||!E||i;if(null!=d)if(null!=this.resize&&this._listen(d,"source.resize",this.resize),e&&this._listen(d,"source.rebuild",e),u)for(o=0,a=d.length;a>o;o++)c=d[o],this.bound.push(c);else this.bound.push(d);this.bind[h]=d}return null},unmake:function(){return this.bind?(delete this.bind,delete this.bound):void 0}},span:{make:function(){return this.spanView=this._inherit("view"),this._listen("view","view.range",function(t){return function(){return t.trigger({type:"span.range"})}}(this))},unmake:function(){return delete this.spanView},get:function(){var t;return t=new THREE.Vector2(-1,1),function(e,n){var r,i,o;return r=this._get(e+"span.range"),null!=r?r:null!=(i=null!=(o=this.spanView)?o.axis(n):void 0)?i:t}}()},scale:{divide:function(t){var e,n;return e=this._get(t+"scale.divide"),n=this._get(t+"scale.factor"),Math.round(2.5*e/n)},generate:function(t,e,n,i){var o,s,a,u,h,l,c,p,f,d;return h=this._get(t+"scale.mode"),s=this._get(t+"scale.divide"),f=this._get(t+"scale.unit"),o=this._get(t+"scale.base"),u=this._get(t+"scale.factor"),c=this._get(t+"scale.start"),a=this._get(t+"scale.end"),d=this._get(t+"scale.zero"),l=this._get(t+"scale.nice"),p=r.Ticks.make(h,n,i,s,f,o,u,c,a,d,l),e.copy(p),p}},style:{uniforms:function(){return{styleColor:this.node.attributes["style.color"],styleOpacity:this.node.attributes["style.opacity"],styleZBias:this.node.attributes["style.zBias"],styleZIndex:this.node.attributes["style.zIndex"]}}},arrow:{uniforms:function(){var t,e,n,r,i;return r=this.props.start,t=this.props.end,n=this._attributes.make(this._types.number(1.25/(r+t))),i=this._attributes.make(this._types.vec2(+r,+t)),e=this.node.attributes["arrow.size"],{clipStyle:i,clipRange:e,clipSpace:n,arrowSpace:n,arrowSize:e}}},point:{uniforms:function(){return{pointSize:this.node.attributes["point.size"],pointDepth:this.node.attributes["point.depth"]}}},line:{uniforms:function(){return{lineWidth:this.node.attributes["line.width"],lineDepth:this.node.attributes["line.depth"],lineProximity:this.node.attributes["line.proximity"]}}},surface:{uniforms:function(){return{}}},shade:{pipeline:function(t){var e,n,r;if(!this._inherit("fragment"))return t;for(null==t&&(t=this._shaders.shader()),n=e=0;2>=e;n=++e)t=null!=(r=this._inherit("fragment"))?r.fragment(t,n):void 0;return t.pipe("fragment.map.rgba"),t},map:function(t){return t?t=this._shaders.shader().pipe("mesh.map.uvwo").pipe(t):t}},position:{pipeline:function(t){var e,n,r;if(!this._inherit("vertex"))return t;for(null==t&&(t=this._shaders.shader()),n=e=0;3>=e;n=++e)t=null!=(r=this._inherit("vertex"))?r.vertex(t,n):void 0;return t},swizzle:function(t,e){return t?this._shaders.shader().pipe(r.GLSL.swizzleVec4(e)).pipe(t):void 0},swizzle2:function(t,e,n){return t?this._shaders.shader().split().pipe(r.GLSL.swizzleVec4(e)).next().pipe(r.GLSL.swizzleVec4(n)).join().pipe(t):void 0}},visible:{make:function(){var t,e,n,r;return t={type:"visible.change"},n=null,this.setVisible=function(t){return null!=t&&(n=t),e()},e=function(e){return function(){var i,o,s;return i=e.isVisible,s=null!=(o=null!=n?n:e._get("object.visible"))?o:!0,"undefined"!=typeof r&&null!==r&&s&&(s=r.isVisible),e.isVisible=s,i!==e.isVisible?e.trigger(t):void 0}}(this),r=this._inherit("visible"),r&&this._listen(r,"visible.change",e),this.is("object")&&this._listen(this.node,"change:object",e),e()},unmake:function(){return delete this.isVisible}},active:{make:function(){var t,e,n,r;return n={type:"active.change"},t=null,this.setActive=function(e){return null!=e&&(t=e),r()},r=function(r){return function(){var i,o,s;return i=r.isActive,s=null!=(o=null!=t?t:r._get("entity.active"))?o:!0,"undefined"!=typeof e&&null!==e&&s&&(s=e.isActive),r.isActive=s,i!==r.isActive?r.trigger(n):void 0}}(this),e=this._inherit("active"),e&&this._listen(e,"active.change",r),this.is("entity")&&this._listen(this.node,"change:entity",r),r()},unmake:function(){return delete this.isActive}},object:{make:function(t){var e,n,r,i,o,a,u,h,l,c,p,f,d,m;for(this.objects=null!=t?t:[],this.renders=this.objects.reduce(function(t,e){return t.concat(e.renders)},[]),u=this._inherit("scene"),c=e=f=null,n=s.call(this.traits,"style")>=0,c=1,e=THREE.NormalBlending,m=!0,d=!0,n&&(c=this.props.opacity,e=this.props.blending,f=this.props.zOrder,m=this.props.zWrite,d=this.props.zTest),h=function(t){return function(n){var r,i;return r=n.changed,i=null,r["style.opacity"]&&(i=c=t.props.opacity),r["style.blending"]&&(i=e=t.props.blending),r["style.zOrder"]&&(i=f=t.props.zOrder),r["style.zWrite"]&&(i=m=t.props.zWrite),r["style.zTest"]&&(i=d=t.props.zTest),null!=i?l():void 0}}(this),i=null,l=function(t){return function(){var r,i,o,s,a,u,h,l,p,v,g,E,y,_,b,T;if(l=null!=f?-f:t.node.order,T=(null!=(p=t.isVisible)?p:!0)&&c>0){if(n){for(v=t.objects,y=[],r=0,s=v.length;s>r;r++)h=v[r],h.show(1>c,e,l),y.push(h.depth(m,d));return y}for(g=t.objects,_=[],i=0,a=g.length;a>i;i++)h=g[i],_.push(h.show(!0,e,l));return _}for(E=t.objects,b=[],o=0,u=E.length;u>o;o++)h=E[o],b.push(h.hide());return b}}(this),this._listen(this.node,"change:style",h),this._listen(this.node,"reindex",l),this._listen(this,"visible.change",l),p=this.objects,r=0,o=p.length;o>r;r++)a=p[r],u.adopt(a);return l()},unmake:function(t){var e,n,r,i,o,s,a,u,h;if(null==t&&(t=!0),this.objects){for(s=this._inherit("scene"),a=this.objects,e=0,r=a.length;r>e;e++)o=a[e],s.unadopt(o);if(t){for(u=this.objects,h=[],n=0,i=u.length;i>n;n++)o=u[n],h.push(o.dispose());return h}}},mask:function(){var t,e;if(t=this._inherit("mask"))return e=t.mask(e)}},unit:{make:function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v;return v=Math.PI,this.unitUniforms={renderScaleInv:h=this._attributes.make(this._types.number(1)),renderScale:u=this._attributes.make(this._types.number(1)),renderAspect:o=this._attributes.make(this._types.number(1)),renderWidth:l=this._attributes.make(this._types.number(0)),renderHeight:s=this._attributes.make(this._types.number(0)),viewWidth:d=this._attributes.make(this._types.number(0)),viewHeight:f=this._attributes.make(this._types.number(0)),pixelRatio:r=this._attributes.make(this._types.number(1)),pixelUnit:i=this._attributes.make(this._types.number(1)),worldUnit:m=this._attributes.make(this._types.number(1)),focusDepth:e=this._attributes.make(this._types.number(1)),renderOdd:a=this._attributes.make(this._types.vec2())},p=new THREE.Vector3,t=new THREE.Vector3,n=function(n){return function(){var g,E,y,_,b,T,x,w,R,H,M,S,k,A;if(null!=(k="undefined"!=typeof c&&null!==c?c.getSize():void 0))return v=Math.PI,S=n.props.scale,_=n.props.fov,y=null!=(H=n.props.focus)?H:n.inherit("unit").props.focus,T=null===S,w=1,(g="undefined"!=typeof c&&null!==c?c.getCamera():void 0)&&(x=g.projectionMatrix,p.set(0,-.5,1).applyProjection(x),t.set(0,.5,1).applyProjection(x),p.sub(t),w=p.y),E=k.renderHeight/k.viewHeight,b=null!=_?w*Math.tan(_*v/360):1,R=T?E:k.renderHeight/S*b,M=k.renderHeight*w/2,A=R/M,d.value=k.viewWidth,f.value=k.viewHeight,l.value=k.renderWidth,s.value=k.renderHeight,o.value=k.aspect,u.value=M,h.value=1/M,r.value=E,i.value=R,m.value=A,e.value=y,a.value.set(k.renderWidth%2,k.renderHeight%2).multiplyScalar(.5)}}(this),c=this.is("root")?this:this._inherit("root"),this._listen(c,"root.update",n),n()},unmake:function(){return delete this.unitUniforms},get:function(){var t,e,n,r;n={},e=this.unitUniforms;for(t in e)r=e[t],n[t]=r.value;return n},uniforms:function(){return this.unitUniforms}}},e.exports=function(t,e){var n,r,i,s,a,u,h;for(n={},r=0,s=e.length;s>r;r++)if(h=e[r],u=o[h]){n[h]={};for(i in u)a=u[i],n[h][i]=a.bind(t)}return n}},{"../../util":175,"./view/view":122}],72:[function(t,e,n){var r;r=t("../../model"),n.Classes=t("./classes"),n.Types=t("./types"),n.Traits=t("./traits"),n.Helpers=t("./helpers")},{"../../model":34,"./classes":52,"./helpers":71,"./traits":107,"./types":115}],73:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./operator"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","bind","operator","source","index","clamp"],e.prototype.indexShader=function(t){return t.pipe(this.operator),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator),e.__super__.sourceShader.call(this,t)},e.prototype.make=function(){var t,n;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(n={clampLimit:this._attributes.make(this._types.vec4())},this.clampLimit=n.clampLimit,t=this._shaders.shader(),t.pipe("clamp.position",n),this.operator=t):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.resize=function(){var t;return null!=this.bind.source&&(t=this.bind.source.getActiveDimensions(),this.clampLimit.value.set(t.width-1,t.height-1,t.depth-1,t.items-1)),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.operator||e.clamp?this.rebuild():void 0},e}(i),e.exports=r},{"./operator":78}],74:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./operator"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","bind","operator","source","index","grow"],e.prototype.sourceShader=function(t){return t.pipe(this.operator)},e.prototype.make=function(){var t,n;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(n={growScale:this.node.attributes["grow.scale"],growMask:this._attributes.make(this._types.vec4()),growAnchor:this._attributes.make(this._types.vec4())},this.growMask=n.growMask.value,this.growAnchor=n.growAnchor.value,t=this._shaders.shader(),t.require(this.bind.source.sourceShader(this._shaders.shader())),t.pipe("grow.position",n),this.operator=t):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.resize=function(){return this.update(),e.__super__.resize.apply(this,arguments)},e.prototype.update=function(){var t,e,n,r,i,o,s,a,u;for(e=this.bind.source.getFutureDimensions(),a=["width","height","depth","items"],s=function(t,e){return((t||1)-1)*(.5-.5*e)},u=[],n=r=0,o=a.length;o>r;n=++r)i=a[n],t=this.props[i],this.growMask.setComponent(n,+(null==t)),u.push(this.growAnchor.setComponent(n,null!=t?s(e[i],t):0));return u},e.prototype.change=function(t,e,n){return e.operator?this.rebuild():e.grow?this.update():void 0},e}(i),e.exports=r},{"./operator":78}],75:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./operator"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","join"],e.prototype.indexShader=function(t){return t.pipe(this.operator),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator),e.__super__.sourceShader.call(this,t)},e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype._resample=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v;for(l=this.order,e=this.axis,p=this.overlap,u=this.length,v=this.stride,s=["width","height","depth","items"],h=l.map(function(t){return s[t-1]}),i=l.indexOf(e),m=function(){var e,r,i;for(i=[],e=0,r=h.length;r>e;e++)n=h[e],i.push(t[n]);return i}(),f=(null!=(d=m[i+1])?d:1)*v,m.splice(i,2,f),m=m.slice(0,3),m.push(1),c={},r=o=0,a=h.length;a>o;r=++o)n=h[r],c[n]=m[r];return c},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(u=this.props.order,t=this.props.axis,h=this.props.overlap,l=u.join(""),null==t&&(t=u[0]),r=l.indexOf(t),c=l.replace(t,"00").substring(0,4),i=[null,"width","height","depth","items"],a=i[t],n=this.bind.source.getDimensions(),s=n[a],h=Math.min(s-1,h),p=s-h,d={joinStride:this._attributes.make(this._types.number(p)),joinStrideInv:this._attributes.make(this._types.number(1/p))},f=this._shaders.shader(),f.require(o.GLSL.swizzleVec4(t,1)),f.require(o.GLSL.swizzleVec4(c,4)),f.require(o.GLSL.injectVec4([r,r+1])),f.pipe("join.position",d),f.pipe(o.GLSL.invertSwizzleVec4(u)),this.operator=f,this.order=u,this.axis=t,this.overlap=h,this.length=s,this.stride=p):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.join||e.operator?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"./operator":78}],76:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./operator"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","lerp","sampler:x","sampler:y","sampler:z","sampler:w"],e.prototype.indexShader=function(t){return t.pipe(this.indexer),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator)},e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype._resample=function(t){var e,n,r;return r=this.resampled,e=this.centered,n=this.padding,this.relativeSize?(e.items||t.items--,e.width||t.width--,e.height||t.height--,e.depth||t.depth--,null!=r.items&&(t.items*=r.items),null!=r.width&&(t.width*=r.width),null!=r.height&&(t.height*=r.height),null!=r.depth&&(t.depth*=r.depth),e.items||t.items++,e.width||t.width++,e.height||t.height++,e.depth||t.depth++,t.items-=2*n.items,t.width-=2*n.width,t.height-=2*n.height,t.depth-=2*n.depth):(null!=r.items&&(t.items=r.items),null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),null!=r.depth&&(t.depth=r.depth)),t.items=Math.max(0,Math.floor(t.items)),t.width=Math.max(0,Math.floor(t.width)),t.height=Math.max(0,Math.floor(t.height)),t.depth=Math.max(0,Math.floor(t.depth)),t},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R;if(e.__super__.make.apply(this,arguments),null!=this.bind.source){for(v=this.props,T=v.size,h=v.items,R=v.width,i=v.height,r=v.depth,y=T===this.node.attributes["lerp.size"]["enum"].relative,this.resampled={},null!=h&&(this.resampled.items=h),null!=R&&(this.resampled.width=R),null!=i&&(this.resampled.height=i),null!=r&&(this.resampled.depth=r),this.centered={},this.centered.items=this.props.centeredW,this.centered.width=this.props.centeredX,this.centered.height=this.props.centeredY,this.centered.depth=this.props.centeredZ,this.padding={},this.padding.items=this.props.paddingW,this.padding.width=this.props.paddingX,this.padding.height=this.props.paddingY,this.padding.depth=this.props.paddingZ,m=this._shaders.shader(),u=this._shaders.shader(),x={resampleFactor:this._attributes.make(this._types.vec4(0,0,0,0)),resampleBias:this._attributes.make(this._types.vec4(0,0,0,0))},this.resampleFactor=x.resampleFactor,this.resampleBias=x.resampleBias,_=null!=h||null!=R||null!=i||null!=r,m.pipe("resample.padding",x),w=[],t=!1,g=["width","height","depth","items"],s=l=0,f=g.length;f>l;s=++l)p=g[s],n=this.centered[p],t||(t=n),w[s]=n?"0.5":"0.0";for(t&&_&&(w="vec4("+w+")",m.pipe(o.GLSL.binaryOperator(4,"+",vec4)),u.pipe(o.GLSL.binaryOperator(4,"+",vec4))),_?(m.pipe("resample.relative",x),u.pipe("resample.relative",x)):(m.pipe(o.GLSL.identity("vec4")),u.pipe(o.GLSL.identity("vec4"))),t&&_&&(m.pipe(o.GLSL.binaryOperator(4,"-",w)),u.pipe(o.GLSL.binaryOperator(4,"-",w))),b=this.bind.source.sourceShader(this._shaders.shader()),E=["width","height","depth","items"],s=c=0,d=E.length;d>c;s=++c)p=E[s],a="lerp."+p,null!=this.props[p]&&(b=this._shaders.shader().require(b),b.pipe(a,x));return m.pipe(b),this.operator=m,this.indexer=u,this.relativeSize=y}},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.operator=null},e.prototype.resize=function(){var t,n,r,i,o,s,a,u,h,l,c,p,f,d,m;if(null!=this.bind.source)return s=this.bind.source.getActiveDimensions(),m=this.getActiveDimensions(),t=function(t){return function(e){var n,r,i;return n=t.centered[e],r=t.padding[e],m[e]+=2*r,i=n?s[e]/Math.max(1,m[e]):Math.max(1,s[e]-1)/Math.max(1,m[e]-1),[i,r]}}(this),u=t("width"),d=u[0],o=u[1],h=t("height"),p=h[0],r=h[1],l=t("depth"),a=l[0],n=l[1],c=t("items"),f=c[0],i=c[1],this.resampleFactor.value.set(d,p,a,f),this.resampleBias.value.set(o,r,n,i),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.operator||e.lerp||e.sampler?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"./operator":78}],77:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./operator"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","active","operator","source","index","texture","memo"],e.prototype.sourceShader=function(t){return this.memo.shaderAbsolute(t,1)},e.prototype.make=function(){var t,n,r,i,o,s,a,u,h,l;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(this._helpers.active.make(),this._listen("root","root.update",function(t){return function(){return t.isActive?t.update():void 0}}(this)),u=this.props,s=u.minFilter,o=u.magFilter,h=u.type,n=this.bind.source.getDimensions(),i=n.items,l=n.width,r=n.height,t=n.depth,this.memo=this._renderables.make("memo",{items:i,width:l,height:r,depth:t,minFilter:s,magFilter:o,type:h}),a=this._shaders.shader(),this.bind.source.sourceShader(a),this.compose=this._renderables.make("memoScreen",{map:a,items:i,width:l, +height:r,depth:t}),this.memo.adopt(this.compose),this.objects=[this.compose],this.renders=this.compose.renders):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),null!=this.bind.source?(this._helpers.active.unmake(),this.memo.unadopt(this.compose),this.memo.dispose(),this.memo=this.compose=null):void 0},e.prototype.update=function(){var t;return null!=(t=this.memo)?t.render():void 0},e.prototype.resize=function(){var t,n,r,i;if(null!=this.bind.source)return n=this.bind.source.getActiveDimensions(),i=n.width,r=n.height,t=n.depth,this.compose.cover(i,r,t),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.texture||e.operator?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"./operator":78}],78:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("../base/source"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","bind","operator","source","index"],e.prototype.indexShader=function(t){var e;return null!=(e=this.bind.source)&&"function"==typeof e.indexShader?e.indexShader(t):void 0},e.prototype.sourceShader=function(t){var e;return null!=(e=this.bind.source)&&"function"==typeof e.sourceShader?e.sourceShader(t):void 0},e.prototype.getDimensions=function(){return this.bind.source.getDimensions()},e.prototype.getFutureDimensions=function(){return this.bind.source.getFutureDimensions()},e.prototype.getActiveDimensions=function(){return this.bind.source.getActiveDimensions()},e.prototype.getIndexDimensions=function(){return this.bind.source.getIndexDimensions()},e.prototype.init=function(){return this.sourceSpec=[{to:"operator.source",trait:"source"}]},e.prototype.make=function(){return e.__super__.make.apply(this,arguments),this._helpers.bind.make(this.sourceSpec)},e.prototype.made=function(){return this.resize(),e.__super__.made.apply(this,arguments)},e.prototype.unmake=function(){return this._helpers.bind.unmake()},e.prototype.resize=function(t){return this.trigger({type:"source.resize"})},e}(i),e.exports=r},{"../base/source":49}],79:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","readback","entity","active"],e.finals={channels:4},e.prototype.init=function(){return this.emitter=this.root=null,this.active={}},e.prototype.make=function(){var t,n,r,i,o,s,a,u,h,l;return e.__super__.make.apply(this,arguments),this._compute("readback.data",function(t){return function(){var e;return null!=(e=t.readback)?e.data:void 0}}(this)),this._compute("readback.items",function(t){return function(){var e;return null!=(e=t.readback)?e.items:void 0}}(this)),this._compute("readback.width",function(t){return function(){var e;return null!=(e=t.readback)?e.width:void 0}}(this)),this._compute("readback.height",function(t){return function(){var e;return null!=(e=t.readback)?e.height:void 0}}(this)),this._compute("readback.depth",function(t){return function(){var e;return null!=(e=t.readback)?e.depth:void 0}}(this)),this._helpers.bind.make([{to:"operator.source",trait:"source"}]),null!=this.bind.source?(s=this.props,h=s.type,t=s.channels,r=s.expr,this.root=this._inherit("root"),this._listen("root","root.update",this.update),a=this.bind.source.getDimensions(),o=a.items,l=a.width,i=a.height,n=a.depth,u=this.bind.source.sourceShader(this._shaders.shader()),this.readback=this._renderables.make("readback",{map:u,items:o,width:l,height:i,depth:n,channels:t,type:h}),null!=r&&this.readback.setCallback(r),this._helpers.active.make()):void 0},e.prototype.unmake=function(){return null!=this.readback&&(this.readback.dispose(),this.readback=null,this.root=null,this.emitter=null,this.active={}),this._helpers.active.unmake(),this._helpers.bind.unmake()},e.prototype.update=function(){var t;if(null!=this.readback)return this.isActive&&(this.readback.update(null!=(t=this.root)?t.getCamera():void 0),this.readback.post(),null!=this.props.expr)?this.readback.iterate():void 0},e.prototype.resize=function(){var t,e,n,r,i,o,s,a;if(null!=this.readback)return r=this.bind.source.getActiveDimensions(),n=r.items,a=r.width,e=r.height,t=r.depth,this.readback.setActive(n,a,e,t),this.strideI=i=n,this.strideJ=o=i*a,this.strideK=s=o*e},e.prototype.change=function(t,e,n){return t["readback.type"]?this.rebuild():t["readback.expr"]&&this.readback?this.readback.setCallback(this.props.expr):void 0},e}(r),e.exports=i},{"../../../util":175,"../../primitive":44}],80:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./operator"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","bind","operator","source","index","repeat"],e.prototype.indexShader=function(t){return t.pipe(this.operator),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator),e.__super__.sourceShader.call(this,t)},e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype._resample=function(t){var e;return e=this.resample,{items:e.items*t.items,width:e.width*t.width,height:e.height*t.height,depth:e.depth*t.depth}},e.prototype.make=function(){var t,n;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(this.resample={},n={repeatModulus:this._attributes.make(this._types.vec4())},this.repeatModulus=n.repeatModulus,t=this._shaders.shader(),t.pipe("repeat.position",n),this.operator=t):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.resize=function(){var t;return null!=this.bind.source&&(t=this.bind.source.getActiveDimensions(),this.repeatModulus.value.set(t.width,t.height,t.depth,t.items)),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){var r,i,o,s,a;if(e.operator||e.repeat)return this.rebuild();if(n){for(s=["items","width","height","depth"],a=[],r=0,o=s.length;o>r;r++)i=s[r],a.push(this.resample[i]=this.props[i]);return a}},e}(r),e.exports=i},{"./operator":78}],81:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./operator"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","resample","sampler:x","sampler:y","sampler:z","sampler:w","include"],e.prototype.indexShader=function(t){return t.pipe(this.indexer),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator)},e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype._resample=function(t){var e,n,r;return r=this.resampled,e=this.centered,n=this.padding,this.relativeSize?(e.items||t.items--,e.width||t.width--,e.height||t.height--,e.depth||t.depth--,null!=r.items&&(t.items*=r.items),null!=r.width&&(t.width*=r.width),null!=r.height&&(t.height*=r.height),null!=r.depth&&(t.depth*=r.depth),e.items||t.items++,e.width||t.width++,e.height||t.height++,e.depth||t.depth++,t.items-=2*n.items,t.width-=2*n.width,t.height-=2*n.height,t.depth-=2*n.depth):(null!=r.items&&(t.items=r.items),null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),null!=r.depth&&(t.depth=r.depth)),t.items=Math.max(0,Math.floor(t.items)),t.width=Math.max(0,Math.floor(t.width)),t.height=Math.max(0,Math.floor(t.height)),t.depth=Math.max(0,Math.floor(t.depth)),t},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M;if(e.__super__.make.apply(this,arguments),null!=this.bind.source){for(this._helpers.bind.make([{to:"include.shader",trait:"shader",optional:!0}]),m=this.props,h=m.indices,r=m.channels,T=this.bind.shader,v=this.props,b=v.sample,x=v.size,l=v.items,M=v.width,s=v.height,i=v.depth,E=b===this.node.attributes["resample.sample"]["enum"].relative,y=x===this.node.attributes["resample.size"]["enum"].relative,this.resampled={},null!=l&&(this.resampled.items=l),null!=M&&(this.resampled.width=M),null!=s&&(this.resampled.height=s),null!=i&&(this.resampled.depth=i),this.centered={},this.centered.items=this.props.centeredW,this.centered.width=this.props.centeredX,this.centered.height=this.props.centeredY,this.centered.depth=this.props.centeredZ,this.padding={},this.padding.items=this.props.paddingW,this.padding.width=this.props.paddingX,this.padding.height=this.props.paddingY,this.padding.depth=this.props.paddingZ,d=this._shaders.shader(),u=this._shaders.shader(),w=[null,this._types.number,this._types.vec2,this._types.vec3,this._types.vec4][h],R={dataSize:this._attributes.make(w(0,0,0,0)),dataResolution:this._attributes.make(w(0,0,0,0)),targetSize:this._attributes.make(w(0,0,0,0)),targetResolution:this._attributes.make(w(0,0,0,0)),resampleFactor:this._attributes.make(this._types.vec4(0,0,0,0)),resampleBias:this._attributes.make(this._types.vec4(0,0,0,0))},this.dataResolution=R.dataResolution,this.dataSize=R.dataSize,this.targetResolution=R.targetResolution,this.targetSize=R.targetSize,this.resampleFactor=R.resampleFactor,this.resampleBias=R.resampleBias,_=null!=l||null!=M||null!=s||null!=i,d.pipe("resample.padding",R),H=[],t=!1,g=["width","height","depth","items"],a=c=0,f=g.length;f>c;a=++c)p=g[a],n=this.centered[p],t||(t=n),H[a]=n?"0.5":"0.0";return t&&(H="vec4("+H+")",d.pipe(o.GLSL.binaryOperator(4,"+",vec4)),_&&u.pipe(o.GLSL.binaryOperator(4,"+",vec4))),E&&(_?(d.pipe("resample.relative",R),u.pipe("resample.relative",R)):u.pipe(o.GLSL.identity("vec4"))),null!=T?(4!==h&&d.pipe(o.GLSL.truncateVec(4,h)),d.callback(),4!==h&&d.pipe(o.GLSL.extendVec(h,4)),t&&d.pipe(o.GLSL.binaryOperator(4,"-",H)),d.pipe(this.bind.source.sourceShader(this._shaders.shader())),4!==r&&d.pipe(o.GLSL.truncateVec(4,r)),d.join(),null!=this.bind.shader&&d.pipe(this.bind.shader.shaderBind(R)),4!==r&&d.pipe(o.GLSL.extendVec(r,4))):(t&&d.pipe(o.GLSL.binaryOperator(4,"-",H)),d.pipe(this.bind.source.sourceShader(this._shaders.shader()))),t&&_&&u.pipe(o.GLSL.binaryOperator(4,"-",H)),this.operator=d,this.indexer=u,this.indices=h,this.relativeSample=E,this.relativeSize=y}},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.operator=null},e.prototype.resize=function(){var t,n,r,i,o,s,a,u,h,l,c,p,f,d,m;if(null!=this.bind.source)return s=this.bind.source.getActiveDimensions(),m=this.getActiveDimensions(),t=function(t){return function(e){var n,r,i;return n=t.centered[e],r=t.padding[e],m[e]+=2*r,i=n?s[e]/Math.max(1,m[e]):Math.max(1,s[e]-1)/Math.max(1,m[e]-1),[i,r]}}(this),u=t("width"),d=u[0],o=u[1],h=t("height"),p=h[0],r=h[1],l=t("depth"),a=l[0],n=l[1],c=t("items"),f=c[0],i=c[1],1===this.indices?(this.dataResolution.value=1/s.width,this.targetResolution.value=1/m.width,this.dataSize.value=s.width,this.targetSize.value=m.width):(this.dataResolution.value.set(1/s.width,1/s.height,1/s.depth,1/s.items),this.targetResolution.value.set(1/m.width,1/m.height,1/m.depth,1/m.items),this.dataSize.value.set(s.width,s.height,s.depth,s.items),this.targetSize.value.set(m.width,m.height,m.depth,m.items)),this.resampleFactor.value.set(d,p,a,f),this.resampleBias.value.set(o,r,n,i),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.operator||e.resample||e.sampler||e.include?this.rebuild():void 0},e}(r),e.exports=i},{"../../../util":175,"./operator":78}],82:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./operator"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","slice"],e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype.sourceShader=function(t){return t.pipe("slice.position",this.uniforms),this.bind.source.sourceShader(t)},e.prototype._resolve=function(t,e){var n,r,i,o,s;return o=this.props[t],n=e[t],null==o?[0,n]:(i=function(t,e){return 0>t?e+t:t},s=i(Math.round(o.x),n),r=i(Math.round(o.y),n),r=Math.max(s,r),[s,r-s])},e.prototype._resample=function(t){return t.width=this._resolve("width",t)[1],t.height=this._resolve("height",t)[1],t.depth=this._resolve("depth",t)[1],t.items=this._resolve("items",t)[1],t},e.prototype.make=function(){return e.__super__.make.apply(this,arguments),null!=this.bind.source?this.uniforms={sliceOffset:this._attributes.make(this._types.vec4())}:void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.resize=function(){var t;if(null!=this.bind.source)return t=this.bind.source.getActiveDimensions(),this.uniforms.sliceOffset.value.set(this._resolve("width",t)[0],this._resolve("height",t)[0],this._resolve("depth",t)[0],this._resolve("items",t)[0]),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.operator?this.rebuild():e.slice?this.resize():void 0},e}(r),e.exports=i},{"../../../util":175,"./operator":78}],83:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./operator"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","split"],e.prototype.indexShader=function(t){return t.pipe(this.operator),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator),e.__super__.sourceShader.call(this,t)},e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype._resample=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m;for(l=this.order,e=this.axis,p=this.overlap,u=this.length,m=this.stride,s=["width","height","depth","items"],h=l.map(function(t){return s[t-1]}),i=l.indexOf(e),d=function(){var e,r,i;for(i=[],e=0,r=h.length;r>e;e++)n=h[e],i.push(t[n]);return i}(),f=Math.floor((d[i]-p)/m),d.splice(i,1,u,f),d=d.slice(0,4),c={},r=o=0,a=h.length;a>o;r=++o)n=h[r],c[n]=d[r];return c},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(i=this.props.order,t=this.props.axis,s=this.props.overlap,r=this.props.length,a=i.join(""),null==t&&(t=i[0]),n=a.indexOf(t),l=a[n]+(null!=(u=a[n+1])?u:0),h=a.replace(l[1],"").replace(l[0],"0")+"0",s=Math.min(r-1,s),c=r-s,f={splitStride:this._attributes.make(this._types.number(c))},p=this._shaders.shader(),p.require(o.GLSL.swizzleVec4(l,2)),p.require(o.GLSL.swizzleVec4(h,4)),p.require(o.GLSL.injectVec4(n)),p.pipe("split.position",f),p.pipe(o.GLSL.invertSwizzleVec4(i)),this.operator=p,this.order=i,this.axis=t,this.overlap=s,this.length=r,this.stride=c):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.change=function(t,e,n){return t["split.axis"]||t["split.order"]||e.operator?this.rebuild():void 0},e}(r),e.exports=i},{"../../../util":175,"./operator":78}],84:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./operator"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","bind","operator","source","index","spread"],e.prototype.sourceShader=function(t){return t.pipe(this.operator)},e.prototype.make=function(){var t,n;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(n={spreadMatrix:this._attributes.make(this._types.mat4()),spreadOffset:this._attributes.make(this._types.vec4())},this.spreadMatrix=n.spreadMatrix,this.spreadOffset=n.spreadOffset,t=this._shaders.shader(),t.require(this.bind.source.sourceShader(this._shaders.shader())),t.pipe("spread.position",n),this.operator=t):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments)},e.prototype.resize=function(){return this.update(),e.__super__.resize.apply(this,arguments)},e.prototype.update=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y;for(r=this.bind.source.getFutureDimensions(),c=this.spreadMatrix.value,i=c.elements,f=["width","height","depth","items"],t=["alignWidth","alignHeight","alignDepth","alignItems"],g=this.props.unit,E=this.node.attributes["spread.unit"]["enum"],l=function(){switch(g){case E.relative:return function(t,e,n,o){return i[4*e+n]=o/Math.max(1,r[t]-1)};case E.absolute:return function(t,e,n,r){return i[4*e+n]=r}}}(),m=[],o=s=0,h=f.length;h>s;o=++s)u=f[o],v=this.props[u],e=this.props[t[o]],null!=v?(n=null!=(d=r[u])?d:1,p=-(n-1)*(.5-.5*e)):p=0,this.spreadOffset.value.setComponent(o,p),m.push(function(){var t,e,n;for(n=[],a=t=0;3>=t;a=++t)y=null!=(e=null!=v?v.getComponent(a):void 0)?e:0,n.push(i[4*o+a]=l(u,o,a,y));return n}());return m},e.prototype.change=function(t,e,n){return e.operator?this.rebuild():e.spread?this.update():void 0},e}(r),e.exports=i},{"./operator":78}],85:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./operator"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","subdivide"],e.prototype.indexShader=function(t){return t.pipe(this.indexer),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return t.pipe(this.operator)},e.prototype.getDimensions=function(){return this._resample(this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._resample(this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._resample(this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._resample(this.bind.source.getIndexDimensions())},e.prototype._resample=function(t){var e;return e=this.resampled,t.items--,t.width--,t.height--,t.depth--,null!=e.items&&(t.items*=e.items),null!=e.width&&(t.width*=e.width),null!=e.height&&(t.height*=e.height),null!=e.depth&&(t.depth*=e.depth),t.items++,t.width++,t.height++,t.depth++,t},e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y;if(e.__super__.make.apply(this,arguments),null!=this.bind.source){for(f=this.props,g=f.size,a=f.items,y=f.width,n=f.height,t=f.depth,c=f.lerp,this.resampled={},null!=a&&(this.resampled.items=a),null!=y&&(this.resampled.width=y),null!=n&&(this.resampled.height=n),null!=t&&(this.resampled.depth=t),p=this._shaders.shader(),s=this._shaders.shader(),E={resampleFactor:this._attributes.make(this._types.vec4(0,0,0,0)),subdivideBevel:this.node.attributes["subdivide.bevel"]},this.resampleFactor=E.resampleFactor,this.resampleBias=E.resampleBias,m=null!=a||null!=y||null!=n||null!=t,m?(p.pipe("resample.relative",E),s.pipe("resample.relative",E)):(p.pipe(o.GLSL.identity("vec4")),s.pipe(o.GLSL.identity("vec4"))),v=this.bind.source.sourceShader(this._shaders.shader()),c=c?".lerp":"",d=["width","height","depth","items"],r=u=0,l=d.length;l>u;r=++u)h=d[r],i="subdivide."+h+c,null!=this.props[h]&&(v=this._shaders.shader().require(v),v.pipe(i,E));return p.pipe(v),this.operator=p,this.indexer=s}},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.operator=null},e.prototype.resize=function(){var t,n,r,i,o,s,a;if(null!=this.bind.source)return n=this.bind.source.getActiveDimensions(),a=this.getActiveDimensions(),t=function(t){return Math.max(1,n[t]-1)/Math.max(1,a[t]-1)},s=t("width"),i=t("height"),r=t("depth"),o=t("items"),this.resampleFactor.value.set(s,i,r,o),e.__super__.resize.apply(this,arguments)},e.prototype.change=function(t,e,n){return e.operator||e.subdivide?this.rebuild():void 0},e}(r),e.exports=i},{"../../../util":175,"./operator":78}],86:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./operator"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","source","index","swizzle"],e.prototype.sourceShader=function(t){return t=e.__super__.sourceShader.call(this,t),this.swizzler&&t.pipe(this.swizzler),t},e.prototype.make=function(){var t;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(t=this.props.order,"1234"!==t.join()?this.swizzler=o.GLSL.swizzleVec4(t,4):void 0):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.swizzler=null},e.prototype.change=function(t,e,n){return e.swizzle||e.operator?this.rebuild():void 0},e}(r),e.exports=i},{"../../../util":175,"./operator":78}],87:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("./operator"),o=t("../../../util"),s={1:"width",2:"height",3:"depth",4:"items"},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.traits=["node","bind","operator","source","index","transpose"],e.prototype.indexShader=function(t){return this.swizzler&&t.pipe(this.swizzler),e.__super__.indexShader.call(this,t)},e.prototype.sourceShader=function(t){return this.swizzler&&t.pipe(this.swizzler),e.__super__.sourceShader.call(this,t)},e.prototype.getDimensions=function(){return this._remap(this.transpose,this.bind.source.getDimensions())},e.prototype.getActiveDimensions=function(){return this._remap(this.transpose,this.bind.source.getActiveDimensions())},e.prototype.getFutureDimensions=function(){return this._remap(this.transpose,this.bind.source.getFutureDimensions())},e.prototype.getIndexDimensions=function(){return this._remap(this.transpose,this.bind.source.getIndexDimensions())},e.prototype._remap=function(t,e){var n,r,i,o,a,u;for(o={},r=i=0;3>=i;r=++i)n=s[r+1],u=s[t[r]],o[n]=null!=(a=e[u])?a:1;return o},e.prototype.make=function(){var t;return e.__super__.make.apply(this,arguments),null!=this.bind.source?(t=this.props.order,"1234"!==t.join()&&(this.swizzler=o.GLSL.invertSwizzleVec4(t)),this.transpose=t,this.trigger({type:"source.rebuild"})):void 0},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.swizzler=null},e.prototype.change=function(t,e,n){return e.transpose||e.operator?this.rebuild():void 0},e}(r),e.exports=i},{"../../../util":175,"./operator":78}],88:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","object","visible","overlay","dom","attach","position"],e.prototype.init=function(){return this.emitter=this.root=null,this.active={}},e.prototype.make=function(){var t,n,r,i,o,s,a,u,h;return e.__super__.make.apply(this,arguments),this._helpers.bind.make([{to:"dom.html",trait:"html"},{to:"dom.points",trait:"source"}]),null!=this.bind.points&&null!=this.bind.html?(this.root=this._inherit("root"),this._listen("root","root.update",this.update),this._listen("root","root.post",this.post),s=this.bind.points.getDimensions(),r=this.bind.html.getDimensions(),o=Math.min(s.items,r.items),h=Math.min(s.width,r.width),n=Math.min(s.height,r.height),t=Math.min(s.depth,r.depth),a=this.bind.points.sourceShader(this._shaders.shader()),a=this._helpers.position.pipeline(a),u=this._shaders.shader({globals:["projectionMatrix"]}),u.pipe("project.readback"),a.pipe(u),i=this._shaders.shader(),this.readback=this._renderables.make("readback",{map:a,indexer:i,items:o,width:h,height:n,depth:t,channels:4,stpq:!0}),this.dom=this._overlays.make("dom"),this.dom.hint(o*h*n*t*2),this.readback.setCallback(this.emitter=this.callback(this.bind.html.nodes())),this._helpers.visible.make()):void 0},e.prototype.unmake=function(){return null!=this.readback&&(this.readback.dispose(),this.dom.dispose(),this.readback=this.dom=null,this.root=null,this.emitter=null,this.active={}),this._helpers.bind.unmake(),this._helpers.visible.unmake()},e.prototype.update=function(){var t;if(null!=this.readback)return this.props.visible?(this.readback.update(null!=(t=this.root)?t.getCamera():void 0),this.readback.post(),this.readback.iterate()):void 0},e.prototype.post=function(){return null!=this.readback?this.dom.render(this.isVisible?this.emitter.nodes():[]):void 0},e.prototype.callback=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x;return _=this._inherit("unit").getUnitUniforms(),b=_.viewWidth,u=_.viewHeight,e=this.node.attributes["dom.attributes"],d=this.node.attributes["dom.size"],x=this.node.attributes["dom.zoom"],r=this.node.attributes["dom.color"],p=this.node.attributes["dom.outline"],f=this.node.attributes["dom.pointerEvents"],c=this.node.attributes["overlay.opacity"],T=this.node.attributes["overlay.zIndex"],l=this.node.attributes["attach.offset"],o=this.node.attributes["attach.depth"],m=this.node.attributes["attach.snap"],s=this.dom.el,h=[],y=null,n=null,v=g=E=0,i="",a=function(r,i,a,p,f,d,_,T){var w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B;k=T+v*f+g*d+E*_,H=t[k],M=0>p,A=1/p,S=1+(A-1)*o.value,D=M?0:S,C=+l.value.x*D,P=+l.value.y*D,U=(r+1)*b.value*.5+C,B=(i-1)*u.value*.5+P,U/=x.value,B/=x.value,m.value&&(U=Math.round(U),B=Math.round(B)),R=Math.min(.999,M?0:c.value),L={className:n,style:{transform:"translate3d("+U+"px, "+-B+"px, "+(1-p)+"px) translate(-50%, -50%) scale("+D+","+D+")",opacity:R}};for(_ in y)F=y[_],L.style[_]=F;if(w=e.value,null!=w){O=w.style;for(_ in w)F=w[_],"style"!==_&&"className"!==_&&(L[_]=F);if(null!=O)for(_ in O)F=O[_],L.style[_]=F}return L.className+=" "+(null!=(z=null!=w?w.className:void 0)?z:"mathbox-label"),h.push(s("div",L,H))},a.reset=function(t){return function(){var e,o,s;return h=[],s=[t.strideI,t.strideJ,t.strideK],v=s[0],g=s[1],E=s[2],e=r.value,o=function(t){return Math.floor(255*t)},i=e?"rgb("+[o(e.x),o(e.y),o(e.z)]+")":"",n="mathbox-outline-"+Math.round(p.value),y={},e&&(y.color=i),y.fontSize=d.value+"px",1!==x.value&&(y.zoom=x.value),T.value>0&&(y.zIndex=T.value),f.value?y.pointerEvents="auto":void 0}}(this),a.nodes=function(){return h},a},e.prototype.resize=function(){var t,e,n,r,i,o,s,a,u;if(null!=this.readback)return i=this.bind.points.getActiveDimensions(),n=this.bind.html.getActiveDimensions(),r=Math.min(i.items,n.items),u=Math.min(i.width,n.width),e=Math.min(i.height,n.height),t=Math.min(i.depth,n.depth),this.readback.setActive(r,u,e,t),this.strideI=o=n.items,this.strideJ=s=o*n.width,this.strideK=a=s*n.height},e.prototype.change=function(t,e,n){return t["dom.html"]||t["dom.points"]?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],89:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("../data/voxel"),i=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","buffer","active","data","voxel","html"],e.finals={channels:1},e.prototype.init=function(){return e.__super__.init.apply(this,arguments),this.storage="pushBuffer"},e.prototype.make=function(){var t,n,r,i,o;return e.__super__.make.apply(this,arguments),i=this.getDimensions(),r=i.items,o=i.width,n=i.height,t=i.depth,this.dom=this._overlays.make("dom"),this.dom.hint(r*o*n*t)},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),null!=this.dom?(this.dom.dispose(),this.dom=null):void 0},e.prototype.update=function(){return e.__super__.update.apply(this,arguments)},e.prototype.change=function(t,n,r){return n.html?this.rebuild():e.__super__.change.call(this,t,n,r)},e.prototype.nodes=function(){return this.buffer.read()},e.prototype.callback=function(t){var e;return e=this.dom.el,t.length<=6?function(n,r,i,o,s){return t(n,e,r,i,o,s)}:function(n){return function(r,i,o,s,a){return t(r,e,i,o,s,a,n.bufferClock,n.bufferStep)}}(this)},e}(o),e.exports=r},{"../../../util":175,"../data/voxel":61}],90:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./transition"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","transition","vertex","move","visible","active"],e.prototype.make=function(){var t,n,r;e.__super__.make.apply(this,arguments),n={moveFrom:this.node.attributes["move.from"],moveTo:this.node.attributes["move.to"]};for(t in n)r=n[t],this.uniforms[t]=r},e.prototype.vertex=function(t,e){var n,r;return e===this.props.pass&&t.pipe("move.position",this.uniforms),null!=(n=null!=(r=this._inherit("vertex"))?r.vertex(t,e):void 0)?n:t},e}(i),e.exports=r},{"./transition":97}],91:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./track"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","track","trigger","play","bind"],e.prototype.init=function(){return e.__super__.init.apply(this,arguments),this.skew=null,this.start=null},e.prototype.reset=function(t){return null==t&&(t=!0),this.skew=t?0:null,this.start=null},e.prototype.make=function(){var t;return e.__super__.make.apply(this,arguments), +this._listen("slide","slide.step",function(t){return function(e){var n;return n=t.props.trigger,null!=n&&e.index===n?t.reset():null!=n&&0===e.index?t.reset(!1):void 0}}(this)),this.props.trigger&&null!=this._inherit("slide")||this.reset(),t=this._inherit("clock"),this._listen(t,"clock.tick",function(e){return function(){var n,r,i,o,s,a,u,h,l,c,p,f;return l=e.props,i=l.from,f=l.to,c=l.speed,a=l.pace,n=l.delay,h=l.realtime,p=t.getTime(),null!=e.skew?(o=h?p.time:p.clock,r=h?p.delta:p.step,u=c/a,null==e.start&&(e.start=o),e.skew+=r*(u-1),s=Math.max(0,o-e.start+e.skew-n*u),e.props.loop&&(s%=f-i),e.playhead=Math.min(f,i+s)):e.playhead=0,e.update()}}(this))},e.prototype.update=function(){return e.__super__.update.apply(this,arguments)},e.prototype.change=function(t,n,r){return t["trigger.trigger"]||t["play.realtime"]?this.rebuild():e.__super__.change.call(this,t,n,r)},e}(i),e.exports=r},{"./track":96}],92:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../base/parent"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","present"],e.prototype.init=function(){},e.prototype.make=function(){return this.nodes=[],this.steps=[],this.length=0,this.last=[],this.index=0,this.dirty=[],this._listen("root","root.update",this.update),this._compute("present.length",function(t){return function(){return t.length}}(this))},e.prototype.adopt=function(t){var e;return e=t.node,this.nodes.indexOf(t)<0&&this.nodes.push(e),this.dirty.push(t)},e.prototype.unadopt=function(t){var e;return e=t.node,this.nodes=this.nodes.filter(function(e){return e!==t}),this.dirty.push(t)},e.prototype.update=function(){var t,e,n,r,i;if(this.dirty.length){for(r=this.dirty,e=0,n=r.length;n>e;e++)t=r[e],this.slideReset(t);return i=this.process(this.nodes),this.steps=i[0],this.indices=i[1],this.length=this.steps.length,this.index=null,this.go(this.props.index),this.dirty=[]}},e.prototype.slideLatch=function(t,e,n){return t.slideLatch(e,n)},e.prototype.slideStep=function(t,e,n){return t.slideStep(this.mapIndex(t,e),n)},e.prototype.slideRelease=function(t,e){return t.slideRelease()},e.prototype.slideReset=function(t){return t.slideReset()},e.prototype.mapIndex=function(t,e){return e-this.indices[t.node._id]},e.prototype.process=function(t){var e,n,r,i,o,s,a,u,h,l,c,p;return h=function(t){var e,n,r,i;for(i=[],n=0,r=t.length;r>n;n++)e=t[n],i.push(a(e).filter(o));return i},p=function(t){return function(e){var n,r,i;for(i=[];e&&(r=[t(e),e],e=r[0],n=r[1],r);)i.push(n);return i}},a=p(function(t){return t.parent.traits.hash.present?null:t.parent}),o=function(e){return t.indexOf(e)>=0},i=function(t,e){var n,r,i,o,s,a;if(n=t.length,r=e.length,i=n-r,0!==i)return!1;for(i=Math.min(n,r),o=s=a=i-1;0>=a?0>s:s>0;o=0>=a?++s:--s)if(t[o]!==e[o])return!1;return!0},s=function(t){return t.sort(function(t,e){var n,r,i,o,s,a,u,h,l,c;for(n=t.length,r=e.length,i=Math.min(n,r),a=u=1,c=i;c>=1?c>=u:u>=c;a=c>=1?++u:--u){if(h=t[n-a],l=e[r-a],o=h.props.order,s=l.props.order,null!=o||null!=s){if(null!=o&&null!=s&&0!==(i=o-s))return i;if(null!=o)return-1;if(null!=s)return 1}if(l.order!==h.order)return l.order-h.order}return i=n-r,0!==i?i:0})},l=function(t){var e,n,r,i,o,s;for(o=[],e=[],n=0,r=t.length;r>n;n++)s=t[n],(null!=(i=s[0]).props.steps?o:e).push(s);return[o,e]},n=function(t){var n,i,o,s,a,u,h,l,c,p,f,d;for(c=t[0],n=t[1],l=100,o={},d=[],p=function(t,e){var n,r,i,s,a,u,h,c,p,f,m,v;for(p=(u=t[0]).props,h=t[1],c=null!=h?o[h._id]:0,n=e,r=null!=p.from?c+p.from:n-p.early,v=null!=p.to?c+p.to:n+p.steps+p.late,r=Math.max(0,r),v=Math.min(l,v),null==o[a=u._id]&&(o[a]=r),i=s=f=r,m=v;m>=f?m>s:s>m;i=m>=f?++s:--s)d[i]=(null!=d[i]?d[i]:d[i]=[]).concat(t);return p.steps},i=0,s=0,u=c.length;u>s;s++)f=c[s],i+=p(f,i);for(a=0,h=n.length;h>a;a++)f=n[a],p(f,0);return d=function(){var t,n,i;for(i=[],t=0,n=d.length;n>t;t++)f=d[t],i.push(r(e(f)));return i}(),[d,o]},e=function(t){var e,n,r,i,o;if(t){for(o=[],e=n=0,r=t.length;r>n;e=++n)i=t[e],t.indexOf(i)===e&&o.push(i);return o}return[]},r=function(t){return t.sort(function(t,e){return t.order-e.order})},u=h(t),c=s(u),n(l(c))},e.prototype.go=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O;for(t=Math.max(0,Math.min(this.length+1,+t||0)),h=this.last,e=null!=(H=this.steps[t-1])?H:[],z=this.props.directed?t-this.index:1,this.index=t,i=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)b=e[t],this.last.indexOf(b)<0&&r.push(b);return r}.call(this),o=function(){var t,n,r,i;for(r=this.last,i=[],t=0,n=r.length;n>t;t++)b=r[t],e.indexOf(b)<0&&i.push(b);return i}.call(this),L=function(){var t,n,r;for(r=[],t=0,n=e.length;n>t;t++)b=e[t],i.indexOf(b)<0&&o.indexOf(b)<0&&r.push(b);return r}(),n=function(t){return t.sort(function(t,e){return t.order-e.order})},r=function(t){return t.sort(function(t,e){return e.order-t.order})},O=function(t){return t.toString()},M=n(i),s=0,l=M.length;l>s;s++)b=M[s],this.slideLatch(b.controller,!0,z);for(S=n(L),a=0,c=S.length;c>a;a++)b=S[a],this.slideLatch(b.controller,null,z);for(k=n(o),u=0,p=k.length;p>u;u++)b=k[u],this.slideLatch(b.controller,!1,z);for(y=0,f=i.length;f>y;y++)b=i[y],this.slideStep(b.controller,t,z);for(_=0,d=L.length;d>_;_++)b=L[_],this.slideStep(b.controller,t,z);for(T=0,m=o.length;m>T;T++)b=o[T],this.slideStep(b.controller,t,z);for(A=r(i),x=0,v=A.length;v>x;x++)b=A[x],this.slideRelease(b.controller);for(C=r(L),w=0,g=C.length;g>w;w++)b=C[w],this.slideRelease(b.controller);for(P=r(o),R=0,E=P.length;E>R;R++)b=P[R],this.slideRelease(b.controller);this.last=e},e.prototype.change=function(t,e,n){return t["present.index"]||n?this.go(this.props.index):void 0},e}(r),e.exports=i},{"../../../util":175,"../base/parent":47}],93:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./transition"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","transition","mask","visible","active"],e.prototype.mask=function(t){var e,n,r;return t?(r=this._shaders.shader(),r.pipe(o.GLSL.identity("vec4")),r.fan(),r.pipe(t,this.uniforms),r.next(),r.pipe("reveal.mask",this.uniforms),r.end(),r.pipe("float combine(float a, float b) { return min(a, b); }")):(r=this._shaders.shader(),r.pipe("reveal.mask",this.uniforms)),null!=(e=null!=(n=this._inherit("mask"))?n.mask(r):void 0)?e:r},e}(i),e.exports=r},{"../../../util":175,"./transition":97}],94:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("../base/parent"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","slide","visible","active"],e.prototype.make=function(){if(this._helpers.visible.make(),this._helpers.active.make(),!this._inherit("present"))throw new Error(this.node.toString()+" must be placed inside ");return this._inherit("present").adopt(this)},e.prototype.unmake=function(){return this._helpers.visible.unmake(),this._helpers.active.unmake(),this._inherit("present")(unadopt(this))},e.prototype.change=function(t,e,n){return t["slide.early"]||t["slide.late"]||t["slide.steps"]||t["slide.from"]||t["slide.to"]?this.rebuild():void 0},e.prototype.slideLatch=function(t,e){return this.trigger({type:"transition.latch",step:e}),null!=t?this._instant(t):void 0},e.prototype.slideStep=function(t,e){return this.trigger({type:"slide.step",index:t,step:e})},e.prototype.slideRelease=function(){return this.trigger({type:"transition.release"})},e.prototype.slideReset=function(){return this._instant(!1),this.trigger({type:"slide.reset"})},e.prototype._instant=function(t){return this.setVisible(t),this.setActive(t)},e}(r),e.exports=i},{"../base/parent":47}],95:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./track"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","track","step","trigger","bind"],e.prototype.make=function(){var t,n,r;return e.__super__.make.apply(this,arguments),t=this._inherit("clock"),null==this.actualIndex&&(this.actualIndex=null),this.animateIndex=this._animator.make(this._types.number(0),{clock:t,realtime:this.props.realtime,step:function(t){return function(e){return t.actualIndex=e}}(this)}),null==this.lastIndex&&(this.lastIndex=null),this.animateStep=this._animator.make(this._types.number(0),{clock:t,realtime:this.props.realtime,step:function(t){return function(e){return t.playhead=e,t.update()}}(this)}),this.stops=null!=(n=this.props.stops)?n:function(){r=[];for(var t=0,e=this.script.length;e>=0?e>t:t>e;e>=0?t++:t--)r.push(t);return r}.apply(this),this._listen("slide","slide.reset",function(t){return function(e){return t.lastIndex=null}}(this)),this._listen("slide","slide.step",function(t){return function(e){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x;if(f=t.props,n=f.delay,r=f.duration,c=f.pace,y=f.speed,p=f.playback,v=f.rewind,g=f.skip,x=f.trigger,a=Math.max(0,Math.min(t.stops.length-1,e.index-x)),s=t.playhead,T=t.stops[a],null==t.lastIndex&&x)return t.lastIndex=a,t.animateStep.set(T),void t.animateIndex.set(a);for(h=null!=(d=null!=(m=t.actualIndex)?m:t.lastIndex)?d:0,_=a-h,E=t.stops.slice(Math.min(h,a),Math.max(h,a)),o=0,h=E.shift(),u=0,l=E.length;l>u;u++)b=E[u],h===b&&o++,h=b;return t.lastIndex=a,i=y*(e.step>=0?1:v),i*=g?Math.max(1,Math.abs(_)-o):1,r+=Math.abs(T-s)*c/i,s!==T?(t.animateIndex.immediate(a,{delay:n,duration:r,ease:p}),t.animateStep.immediate(T,{delay:n,duration:r,ease:p})):void 0}}(this))},e.prototype.made=function(){return this.update()},e.prototype.unmake=function(){return this.animateIndex.dispose(),this.animateStep.dispose(),this.animateIndex=this.animateStep=null,e.__super__.unmake.apply(this,arguments)},e.prototype.change=function(t,n,r){return t["step.stops"]||t["step.realtime"]?this.rebuild():e.__super__.change.call(this,t,n,r)},e}(i),e.exports=r},{"./track":96}],96:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("../../primitive"),r=t("../../../util").Ease,s=function(t){var e,n,r;n={};for(e in t)r=t[e],r instanceof Array?n[e]=r.slice():null!=r&&"object"==typeof r?n[e]=s(r):n[e]=r;return n},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.traits=["node","track","seek","bind"],e.prototype.init=function(){return this.handlers={},this.script=null,this.values=null,this.playhead=0,this.velocity=null,this.section=null,this.expr=null},e.prototype.make=function(){var t,e,n;return this._helpers.bind.make([{to:"track.target",trait:"node",callback:null}]),n=this.props.script,t=this.bind.target.node,this.targetNode=t,e=this._process(t,n),this.script=e[0],this.values=e[1],this.start=e[2],this.end=e[3],e},e.prototype.unmake=function(){return this.unbindExpr(),this._helpers.bind.unmake(),this.script=this.values=this.start=this.end=this.section=this.expr=null,this.playhead=0},e.prototype.bindExpr=function(t){var e;return this.unbindExpr(),this.expr=t,this.targetNode.bind(t,!0),e=this.targetNode.clock,this._attributes.bind(this.measure=function(){var t;return t=null,function(n){return function(){var r;return r=e.getTime().step,null!=t&&(n.velocity=(n.playhead-t)/r),t=n.playhead}}(this)}())},e.prototype.unbindExpr=function(){return null!=this.expr&&this.targetNode.unbind(this.expr,!0),null!=this.measure&&this._attributes.unbind(this.measure),this.expr=this.measure=null},e.prototype._process=function(t,e){var n,r,i,o,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T;if(e instanceof Array){for(E={},r=i=0,l=e.length;l>i;r=++i)_=e[r],E[r]=_;e=E}E=[];for(a in e)_=e[a],null==_&&(_=[]),_ instanceof Array?_={key:+a,props:null!=_[0]?s(_[0]):{},expr:null!=_[1]?s(_[1]):{}}:(_=null!=_.key||_.props||_.expr?s(_):{props:s(_)},_.key=null!=_.key?+_.key:+a,null==_.props&&(_.props={}),null==_.expr&&(_.expr={})),E.push(_);if(e=E,!e.length)return[[],{},0,0];e.sort(function(t,e){return t.key-e.key}),y=e[0].key,n=e[e.length-1].key;for(a in e)_=e[a],"undefined"!=typeof h&&null!==h&&(h.next=_),h=_;h.next=h,e=E,f={},T={};for(a in e){_=e[a],d=_.props;for(o in d)b=d[o],f[o]=!0}for(a in e){_=e[a],m=_.expr;for(o in m)b=m[o],f[o]=!0}for(o in f)f[o]=t.get(o);try{for(o in f)T[o]=[t.attribute(o).T.make(),t.attribute(o).T.make(),t.attribute(o).T.make()]}catch(x){throw console.warn(this.node.toMarkup()),p=this.node.toString()+" - Target "+t+" has no `"+o+"` property",new Error(p)}for(g=[],u=0,c=e.length;c>u;u++){_=e[u];for(o in f)if(b=f[o],b=t.validate(o,null!=(v=_.props[o])?v:b),f[o]=_.props[o]=b,null!=_.expr[o]&&"function"!=typeof _.expr[o])throw console.warn(this.node.toMarkup()),p=this.node.toString()+" - Expression `"+_.expr[o]+"` on property `"+o+"` is not a function",new Error(p);g.push(_)}return[g,T,y,n]},e.prototype.update=function(){var t,e,n,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y;if(f=this.playhead,m=this.script,d=this.props,e=d.ease,g=d.seek,p=this.targetNode,null!=g&&(f=g),m.length){if(s=function(){var t,e,n,r,i;for(n=m[0],t=e=0,r=m.length;r>e&&(i=m[t],!(i.key>f));t=++e)n=i;return n},v=this.section,(!v||fv.next.key)&&(v=s(m,f)),v===this.section)return;this.section=v,a=v,y=v.next,E=a.key,i=y.key,n=function(){switch(e){case"linear":case 0:return r.clamp;case"cosine":case 1:return r.cosine;case"binary":case 2:return r.binary;case"hold":case 3:return r.hold;default:return r.cosine}}(),t=p.clock,h=function(e){return function(n){var r;return null==e.velocity?e.playhead:(r=t.getTime(),e.playhead+e.velocity*(n-r.time))}}(this),u=function(){var t;return t=1/Math.max(1e-4,i-E),function(e){return n((h(e)-E)*t,0,1)}}(),c=function(t){return function(e){var n,r,i,o,s,h,l,c;return i=a.expr[e],h=y.expr[e],o=a.props[e],l=y.props[e],s=function(){throw console.warn(p.toMarkup()),new Error(this.node.toString()+" - Invalid expression result on track `"+e+"`")},r=p.attribute(e),c=t.values[e],n=t._animator,i&&h?function(t,e,o){return function(e,o){var a,l;return t[0]=a=r.T.validate(i(e,o),t[0],s),t[1]=l=r.T.validate(h(e,o),t[1],s),t[2]=n.lerp(r.T,a,l,u(e),t[2])}}(c,a,y):i?function(t,e,o){return function(e,o){var a;return t[0]=a=r.T.validate(i(e,o),t[0],s),t[1]=n.lerp(r.T,a,l,u(e),t[1])}}(c,a,y):h?function(t,e,i){return function(e,i){var a;return t[0]=a=r.T.validate(h(e,i),t[0],s),t[1]=n.lerp(r.T,o,a,u(e),t[1])}}(c,a,y):function(t,e,i){return function(e,i){return t[0]=n.lerp(r.T,o,l,u(e),t[0])}}(c,a,y)}}(this),o={};for(l in a.expr)null==o[l]&&(o[l]=c(l));for(l in y.expr)null==o[l]&&(o[l]=c(l));for(l in a.props)null==o[l]&&(o[l]=c(l));for(l in y.props)null==o[l]&&(o[l]=c(l));return this.bindExpr(o)}},e.prototype.change=function(t,e,n){return t["track.target"]||t["track.script"]||t["track.mode"]?this.rebuild():t["seek.seek"]||n?this.update():void 0},e}(i),e.exports=o},{"../../../util":175,"../../primitive":44}],97:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../base/parent"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","transition","transform","mask","visible","active"],e.prototype.init=function(){return this.animate=null,this.uniforms=null,this.state={isVisible:!0,isActive:!0,enter:1,exit:1},this.latched=null,this.locked=null},e.prototype.make=function(){var t,e,n;return this.uniforms={transitionFrom:this._attributes.make(this._types.vec4()),transitionTo:this._attributes.make(this._types.vec4()),transitionActive:this._attributes.make(this._types.bool()),transitionScale:this._attributes.make(this._types.vec4()),transitionBias:this._attributes.make(this._types.vec4()),transitionEnter:this._attributes.make(this._types.number()),transitionExit:this._attributes.make(this._types.number()),transitionSkew:this._attributes.make(this._types.number())},e=this._inherit("slide"),n=this._inherit("visible"),t=this._inherit("active"),this._listen(e,"transition.latch",function(t){return function(e){return t.latch(e.step)}}(this)),this._listen(e,"transition.release",function(t){return function(){return t.release()}}(this)),this._listen(n,"visible.change",function(t){return function(){return t.update(t.state.isVisible=n.isVisible)}}(this)),this._listen(t,"active.change",function(e){return function(){return e.update(e.state.isActive=t.isActive)}}(this)),this.animate=this._animator.make(this._types.vec2(1,1),{step:function(t){return function(e){return t.state.enter=e.x,t.state.exit=e.y,t.update()}}(this),complete:function(t){return function(e){return t.complete(e)}}(this)}),this.move=null!=this.props.from||null!=this.props.to},e.prototype.unmake=function(){return this.animate.dispose()},e.prototype.latch=function(t){var e,n,r,i,o,s;return this.locked=null,this.latched=i={isVisible:this.state.isVisible,isActive:this.state.isActive,step:t},s=this.isVisible,s?void 0:(r=i.step>=0,o=r?[0,1]:[1,0],e=o[0],n=o[1],this.animate.set(e,n))},e.prototype.release=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d;return h=this.latched,f=this.state,this.latched=null,h.isVisible!==f.isVisible&&(u=h.step>=0,d=f.isVisible,l=d?[1,1]:u?[1,0]:[0,1],s=l[0],a=l[1],c=this.props,r=c.duration,i=c.durationEnter,o=c.durationExit,null==i&&(i=r),null==o&&(o=r),r=d*i+!d*o,p=this.props,t=p.delay,e=p.delayEnter,n=p.delayExit,null==e&&(e=t),null==n&&(n=t),t=d*e+!d*n,this.animate.immediate({x:s,y:a},{duration:r,delay:t,ease:"linear"}),this.locked={isVisible:!0,isActive:h.isActive||f.isActive}),this.update()},e.prototype.complete=function(t){return t?(this.locked=null,this.update()):void 0},e.prototype.update=function(){var t,e,n,r,i,o,s,a;if(null==this.latched)return o=this.props,e=o.enter,n=o.exit,null==e&&(e=this.state.enter),null==n&&(n=this.state.exit),r=e*n,a=r>0,i=1>r,this.uniforms.transitionEnter.value=e,this.uniforms.transitionExit.value=n,this.uniforms.transitionActive.value=i,a&&(a=!!this.state.isVisible),null!=this.locked&&(a=this.locked.isVisible),this.isVisible!==a&&(this.isVisible=a,this.trigger({type:"visible.change"})),t=!!(this.state.isActive||(null!=(s=this.locked)?s.isActive:void 0)),this.isActive!==t?(this.isActive=t,this.trigger({type:"active.change"})):void 0},e.prototype.change=function(t,e,n){var r,i,o,s,a,u,h,l,c;return(t["transition.enter"]||t["transition.exit"]||n)&&this.update(),t["transition.stagger"]||n?(a=this.props.stagger,i=a.x<0,o=a.y<0,s=a.z<0,r=a.w<0,h=Math.abs(a.x),l=Math.abs(a.y),c=Math.abs(a.z),u=Math.abs(a.w),this.uniforms.transitionSkew.value=h+l+c+u,this.uniforms.transitionScale.value.set((1-2*i)*h,(1-2*o)*l,(1-2*s)*c,(1-2*r)*u),this.uniforms.transitionBias.value.set(i*h,o*l,s*c,r*u)):void 0},e}(r),e.exports=i},{"../../../util":175,"../base/parent":47}],98:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","object","visible","operator","style","compose"],e.defaults={zWrite:!1,zTest:!1,color:"#ffffff"},e.prototype.init=function(){return this.compose=null},e.prototype.resize=function(){var t,e,n,r,i;if(this.compose&&this.bind.source)return e=this.bind.source.getActiveDimensions(),i=e.width,n=e.height,t=e.depth,r=e.items,this.remapUVScale.set(i,n)},e.prototype.make=function(){var t,e,n,r;return this._helpers.bind.make([{to:"operator.source",trait:"source"}]),null!=this.bind.source?(r={remapUVScale:this._attributes.make(this._types.vec2())},this.remapUVScale=r.remapUVScale.value,n=this._shaders.shader(),t=this.props.alpha,this.bind.source.is("image")?(n.pipe("screen.pass.uv",r),n=this.bind.source.imageShader(n)):(n.pipe("screen.map.xy",r),n=this.bind.source.sourceShader(n)),t||n.pipe("color.opaque"),e=this._helpers.style.uniforms(),this.compose=this._renderables.make("screen",{map:n,uniforms:e,linear:!0}),this._helpers.visible.make(),this._helpers.object.make([this.compose])):void 0},e.prototype.made=function(){return this.resize()},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake()},e.prototype.change=function(t,e,n){return t["operator.source"]||t["compose.alpha"]?this.rebuild():void 0},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],99:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../base/parent"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","root","scene","vertex","texture","rtt","source","index","image"],e.defaults={minFilter:"linear",magFilter:"linear",type:"unsignedByte"},e.prototype.init=function(){return this.rtt=this.scene=this.camera=this.width=this.height=this.history=this.rootSize=this.size=null},e.prototype.indexShader=function(t){return t},e.prototype.imageShader=function(t){return this.rtt.shaderRelative(t)},e.prototype.sourceShader=function(t){return this.rtt.shaderAbsolute(t,this.history)},e.prototype.getDimensions=function(){return{items:1,width:this.width,height:this.height,depth:this.history}},e.prototype.getActiveDimensions=function(){return this.getDimensions()},e.prototype.make=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d;return this.parentRoot=this._inherit("root"),this.rootSize=this.parentRoot.getSize(),this._listen(this.parentRoot,"root.pre",this.pre),this._listen(this.parentRoot,"root.update",this.update),this._listen(this.parentRoot,"root.render",this.render),this._listen(this.parentRoot,"root.post",this.post),this._listen(this.parentRoot,"root.camera",this.setCamera),this._listen(this.parentRoot,"root.resize",function(t){return this.resize(t.size)}),null!=this.rootSize?(s=this.props,o=s.minFilter,i=s.magFilter,l=s.type,a=this.props,f=a.width,e=a.height,r=a.history,h=a.size,u=h===this.node.attributes["rtt.size"]["enum"].relative,d=u?this.rootSize.renderWidth:1,n=u?this.rootSize.renderHeight:1,this.width=Math.round(null!=f?f*d:this.rootSize.renderWidth),this.height=Math.round(null!=e?e*n:this.rootSize.renderHeight),this.history=r,this.aspect=t=this.width/this.height,null==this.scene&&(this.scene=this._renderables.make("scene")),this.rtt=this._renderables.make("renderToTexture",{scene:this.scene,camera:this._context.defaultCamera,width:this.width,height:this.height,frames:this.history,minFilter:o,magFilter:i,type:l}),t=f||e?t:this.rootSize.aspect,p=null!=f?f:this.rootSize.viewWidth,c=null!=e?e:this.rootSize.viewHeight,this.size={renderWidth:this.width,renderHeight:this.height,aspect:t,viewWidth:p,viewHeight:c,pixelRatio:this.height/c}):void 0},e.prototype.made=function(){return this.trigger({type:"source.rebuild"}),this.size?this.trigger({type:"root.resize",size:this.size}):void 0},e.prototype.unmake=function(t){return null!=this.rtt?(this.rtt.dispose(),t||this.scene.dispose(),this.rtt=this.width=this.height=this.history=null):void 0},e.prototype.change=function(t,e,n){return e.texture||t["rtt.width"]||t["rtt.height"]?this.rebuild():t["root.camera"]||n?(this._unattach(),this._attach(this.props.camera,"camera",this.setCamera,this,this,!0),this.setCamera()):void 0},e.prototype.adopt=function(t){var e,n,r,i,o;for(i=t.renders,o=[],e=0,n=i.length;n>e;e++)r=i[e],o.push(this.scene.add(r));return o},e.prototype.unadopt=function(t){var e,n,r,i,o;for(i=t.renders,o=[],e=0,n=i.length;n>e;e++)r=i[e],o.push(this.scene.remove(r));return o},e.prototype.resize=function(t){var e,n,r,i;return this.rootSize=t,n=this.props,i=n.width,e=n.height,t=n.size,r=t===this.node.attributes["rtt.size"]["enum"].relative,!this.rtt||null==i||null==e||r?this.rebuild():void 0},e.prototype.select=function(t){return this._root.node.model.select(t,[this.node])},e.prototype.watch=function(t,e){return this._root.node.model.watch(t,e)},e.prototype.unwatch=function(t){return this._root.node.model.unwatch(t)},e.prototype.pre=function(t){return this.trigger(t)},e.prototype.update=function(t){var e;return null!=(e=this.getOwnCamera())&&(e.aspect=this.aspect||1,e.updateProjectionMatrix()),this.trigger(t)},e.prototype.render=function(t){var e;return this.trigger(t),null!=(e=this.rtt)?e.render(this.getCamera()):void 0},e.prototype.post=function(t){return this.trigger(t)},e.prototype.setCamera=function(){var t,e;return t=null!=(e=this.select(this.props.camera)[0])?e.controller:void 0,this.camera!==t?(this.camera=t,this.rtt.camera=this.getCamera(),this.trigger({type:"root.camera"})):this.camera?void 0:this.trigger({type:"root.camera"})},e.prototype.getOwnCamera=function(){var t;return null!=(t=this.camera)?t.getCamera():void 0},e.prototype.getCamera=function(){var t;return null!=(t=this.getOwnCamera())?t:this._inherit("root").getCamera()},e.prototype.vertex=function(t,e){return 2===e?t.pipe("view.position"):3===e?t.pipe("root.position"):t},e}(r),e.exports=i},{"../../../util":175,"../base/parent":47}],100:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../../primitive"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","shader"],e.freeform=!0,e.prototype.init=function(){return this.shader=null},e.prototype.make=function(){var t,e,n,r,i,o,s,a,u,h,l,c;if(s=this.props,r=s.language,t=s.code,"glsl"!==r)throw new Error("GLSL required");for(this._helpers.bind.make([{to:"shader.sources",trait:"source",multiple:!0}]),u=this._shaders.fetch(t),l=this._types,c={},o=function(t){return function(t){var e;switch(t){case"i":return l["int"]();case"f":return l.number();case"v2":return l.vec2();case"v3":return l.vec3();case"v4":return l.vec4();case"m3":return l.mat3();case"m4":return l.mat4();case"t":return l.object();default:return e=t.split(""),"v"===e.pop()?l.array(o(e.join(""))):null}}}(this),a=u._signatures.uniform,n=0,i=a.length;i>n;n++)e=a[n],(h=o(e.type))&&(c[e.name]=h);return this.reconfigure({props:{uniform:c}})},e.prototype.made=function(){return this.trigger({type:"source.rebuild"})},e.prototype.unmake=function(){return this.shader=null},e.prototype.change=function(t,e,n){return t["shader.uniforms"]||t["shader.code"]||t["shader.language"]?this.rebuild():void 0},e.prototype.shaderBind=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f;null==t&&(t={}),a=this.props,i=a.language,e=a.code,u=this.node.attributes;for(r in u)f=u[r],null!=f.type&&null!=f["short"]&&"uniform"===f.ns&&null==t[s=f["short"]]&&(t[s]=f);if(null!=(p=this.props.uniforms))for(r in p)f=p[r],t[r]=f;if(l=this._shaders.shader(),null!=this.bind.sources)for(h=this.bind.sources,n=0,o=h.length;o>n;n++)c=h[n],l.require(c.sourceShader(this._shaders.shader()));return l.pipe(e,t)},e}(r),e.exports=i},{"../../../util":175,"../../primitive":44}],101:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../operator/operator"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","texture","text","format","font"],e.defaults={minFilter:"linear",magFilter:"linear"},e.prototype.init=function(){return e.__super__.init.apply(this,arguments),this.atlas=this.buffer=this.used=this.time=null,this.filled=!1},e.prototype.sourceShader=function(t){return this.buffer.shader(t)},e.prototype.textShader=function(t){return this.atlas.shader(t)},e.prototype.textIsSDF=function(){return this.props.sdf>0},e.prototype.textHeight=function(){return this.props.detail},e.prototype.make=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g;return this._helpers.bind.make([{to:"operator.source",trait:"raw"}]),l=this.props,h=l.minFilter,u=l.magFilter,d=l.type,c=this.props,o=c.font,f=c.style,m=c.variant,v=c.weight,n=c.detail,p=c.sdf,this.atlas=this._renderables.make("textAtlas",{font:o,size:n,style:f,variant:m,weight:v,outline:p,minFilter:h,magFilter:u,type:d}),h=THREE.NearestFilter,u=THREE.NearestFilter,d=THREE.FloatType,r=this.bind.source.getDimensions(),a=r.items,g=r.width,s=r.height,e=r.depth,this.buffer=this._renderables.make("voxelBuffer",{width:g,height:s,depth:e,channels:4,items:a,minFilter:h,magFilter:u,type:d}),t=this.atlas,i=this.buffer.streamer.emit,this.buffer.streamer.emit=function(e){return t.map(e,i)},this.clockParent=this._inherit("clock"),this._listen("root","root.update",this.update)},e.prototype.made=function(){return e.__super__.made.apply(this,arguments),this.resize()},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.buffer&&(this.buffer.dispose(),this.buffer=null),this.atlas?(this.atlas.dispose(),this.atlas=null):void 0},e.prototype.update=function(){var t,e,n;return e=this.bind.source.rawBuffer(),t=this.buffer,this.filled&&!this.props.live||!this.through?void 0:(this.time=this.clockParent.getTime(),n=this.used,this.atlas.begin(),this.used=this.through(),this.buffer.write(this.used),this.atlas.end(),this.filled=!0,n!==this.used?this.trigger({type:"source.resize"}):void 0)},e.prototype.change=function(t,e,n){var r,i,o,s,a,u;return e.font?this.rebuild():t["format.expr"]||t["format.digits"]||t["format.data"]||n?(u=this.props,i=u.digits,o=u.expr,r=u.data,null==o&&(o=null!=r?function(t,e,n,i,o){return r[o]}:function(t){return t}),s=o.length,null!=i&&(o=function(t){return function(e,n,r,o,s,a,u,h,l,c){return+t(e,n,r,o,s,a,u,h,l,c).toPrecision(i)}}(o)),a=s>8?function(t){return function(e,n,r,i,s,a,u,h,l,c,p){return e(o(n,r,i,s,a,u,h,l,t.time.clock,t.time.step))}}(this):function(t){return function(t,e,n,r,i,s,a,u,h){return t(o(e,n,r,i,s,a,u,h))}}(this),this.through=this.bind.source.rawBuffer().through(a,this.buffer)):void 0},e}(i),e.exports=r},{"../../../util":175,"../operator/operator":78}],102:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../primitive"),o=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","object","visible","style","label","attach","geometry","position"],e.prototype.make=function(){var t,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y;return e.__super__.make.apply(this,arguments),this._helpers.bind.make([{to:"label.text",trait:"text"},{to:"geometry.points",trait:"source"},{to:"geometry.colors",trait:"source"}]),null!=this.bind.points&&null!=this.bind.text?(l=this.bind.points.getDimensions(),m=this.bind.text.getDimensions(),v=this.bind.text.textIsSDF(),s=Math.min(l.items,m.items),y=Math.min(l.width,m.width),i=Math.min(l.height,m.height),r=Math.min(l.depth,m.depth),c=this.bind.points.sourceShader(this._shaders.shader()),c=this._helpers.position.pipeline(c),f=this.bind.text.sourceShader(this._shaders.shader()),u=this._shaders.shader().pipe("label.map"),u.pipe(this.bind.text.textShader(this._shaders.shader())), +a={spriteDepth:this.node.attributes["attach.depth"],spriteOffset:this.node.attributes["attach.offset"],spriteSnap:this.node.attributes["attach.snap"],spriteScale:this._attributes.make(this._types.number()),outlineStep:this._attributes.make(this._types.number()),outlineExpand:this._attributes.make(this._types.number()),outlineColor:this.node.attributes["label.background"]},this.spriteScale=a.spriteScale,this.outlineStep=a.outlineStep,this.outlineExpand=a.outlineExpand,p=v?"label.outline":"label.alpha",n=this._shaders.shader().pipe(p,a),this.bind.colors&&(t=this._shaders.shader(),this.bind.colors.sourceShader(t)),h=this._helpers.object.mask(),d=this._helpers.style.uniforms(),E=this._inherit("unit").getUnitUniforms(),g=o.JS.merge(E,d,a),this.sprite=this._renderables.make("sprite",{uniforms:g,width:y,height:i,depth:r,items:s,position:c,sprite:f,map:u,combine:n,color:t,mask:h,linear:!0}),this._helpers.visible.make(),this._helpers.object.make([this.sprite])):void 0},e.prototype.unmake=function(){return this._helpers.bind.unmake(),this._helpers.visible.unmake(),this._helpers.object.unmake(),this.sprite=null},e.prototype.resize=function(){var t,e,n,r,i,o;return r=this.bind.points.getActiveDimensions(),i=this.bind.text.getActiveDimensions(),n=Math.min(r.items,i.items),o=Math.min(r.width,i.width),e=Math.min(r.height,i.height),t=Math.min(r.depth,i.depth),this.sprite.geometry.clip(o,e,t,n)},e.prototype.change=function(t,e,n){var r,i,o,s,a;if(e.geometry||t["label.text"])return this.rebuild();if(null!=this.bind.points)return a=this.props.size,o=this.props.outline,r=this.props.expand,i=this.bind.text.textHeight(),s=a/i,this.outlineExpand.value=r/s*16/255,this.outlineStep.value=o/s*16/255,this.spriteScale.value=s},e}(i),e.exports=r},{"../../../util":175,"../../primitive":44}],103:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("../operator/resample"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","bind","operator","resample","sampler:x","sampler:y","sampler:z","sampler:w","include","text"],e.prototype.init=function(){return this.sourceSpec=[{to:"operator.source",trait:"text"}]},e.prototype.textShader=function(t){return this.bind.source.textShader(t)},e.prototype.textIsSDF=function(){var t;return(null!=(t=this.bind.source)?t.props.sdf:void 0)>0},e.prototype.textHeight=function(){var t;return null!=(t=this.bind.source)?t.props.detail:void 0},e}(r),e.exports=i},{"../../../util":175,"../operator/resample":81}],104:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("../data/buffer"),s=t("../data/voxel"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.traits=["node","buffer","active","data","texture","voxel","text","font"],e.defaults={minFilter:"linear",magFilter:"linear"},e.finals={channels:1},e.prototype.init=function(){return e.__super__.init.apply(this,arguments),this.atlas=null},e.prototype.textShader=function(t){return this.atlas.shader(t)},e.prototype.textIsSDF=function(){return this.props.sdf>0},e.prototype.textHeight=function(){return this.props.detail},e.prototype.make=function(){var t,e,n,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S;return d=this.props,f=d.minFilter,p=d.magFilter,R=d.type,m=this.props,h=m.font,w=m.style,H=m.variant,M=m.weight,s=m.detail,T=m.sdf,this.atlas=this._renderables.make("textAtlas",{font:h,size:s,style:w,variant:H,weight:M,outline:T,minFilter:f,magFilter:p,type:R}),this.minFilter=THREE.NearestFilter,this.magFilter=THREE.NearestFilter,this.type=THREE.FloatType,r.prototype.make.call(this),f=null!=(v=this.minFilter)?v:this.props.minFilter,p=null!=(g=this.magFilter)?g:this.props.magFilter,R=null!=(E=this.type)?E:this.props.type,S=this.props.width,l=this.props.height,i=this.props.depth,y=this.props.bufferWidth,_=this.props.bufferHeight,b=this.props.bufferDepth,e=this.props.channels,c=this.props.items,a=this.spec={channels:e,items:c,width:S,height:l,depth:i},this.items=a.items,this.channels=a.channels,n=this.props.data,a=o.Data.getDimensions(n,a),x=this.space,x.width=Math.max(y,a.width||1),x.height=Math.max(_,a.height||1),x.depth=Math.max(b,a.depth||1),this.buffer=this._renderables.make(this.storage,{width:x.width,height:x.height,depth:x.depth,channels:4,items:c,minFilter:f,magFilter:p,type:R}),t=this.atlas,u=this.buffer.streamer.emit,this.buffer.streamer.emit=function(e){return t.map(e,u)}},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),this.atlas?(this.atlas.dispose(),this.atlas=null):void 0},e.prototype.update=function(){return this.atlas.begin(),e.__super__.update.apply(this,arguments),this.atlas.end()},e.prototype.change=function(t,n,r){return n.font?this.rebuild():e.__super__.change.call(this,t,n,r)},e}(s),e.exports=i},{"../../../util":175,"../data/buffer":55,"../data/voxel":61}],105:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("../base/parent"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","clock","seek","play"],e.prototype.init=function(){return this.skew=0,this.last=0,this.time={now:+new Date/1e3,time:0,delta:0,clock:0,step:0}},e.prototype.make=function(){return this._listen("clock","clock.tick",this.tick)},e.prototype.reset=function(){return this.skew=0},e.prototype.tick=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f;return h=this.props,i=h.from,f=h.to,c=h.speed,l=h.seek,o=h.pace,n=h.delay,u=h.realtime,s=this._inherit("clock").getTime(),p=u?s.time:s.clock,r=u?s.delta:s.step,a=c/o,this.skew+=r*(a-1),this.last>p&&(this.skew=0),this.time.now=s.now+this.skew,this.time.time=s.time,this.time.delta=s.delta,e=null!=l?l:s.clock+this.skew,this.time.clock=Math.min(f,i+Math.max(0,e-n*a)),this.time.step=r*a,this.last=p,this.trigger(t)},e.prototype.getTime=function(){return this.time},e}(i),e.exports=r},{"../base/parent":47}],106:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("../base/parent"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","clock","now"],e.prototype.init=function(){var t;return this.now=t=+new Date/1e3,this.skew=0,this.time={now:t,time:0,delta:0,clock:0,step:0}},e.prototype.make=function(){return this.clockParent=this._inherit("clock"),this._listen("clock","clock.tick",this.tick)},e.prototype.unmake=function(){return this.clockParent=null},e.prototype.change=function(t,e,n){return t["date.now"]?this.skew=0:void 0},e.prototype.tick=function(t){var e,n,r,i,o,s,a;return i=this.props,e=i.now,s=i.seek,n=i.pace,a=i.speed,r=this.clockParent.getTime(),this.skew+=r.step*n/a,null!=s&&(this.skew=s),this.time.now=this.time.time=this.time.clock=(null!=(o=this.props.now)?o:this.now)+this.skew,this.time.delta=this.time.step=r.delta,this.trigger(t)},e.prototype.getTime=function(){return this.time},e}(i),e.exports=r},{"../base/parent":47}],107:[function(t,e,n){var r,i;i=t("./types"),r={node:{id:i.nullable(i.string()),classes:i.classes()},entity:{active:i.bool(!0)},object:{visible:i.bool(!0)},unit:{scale:i.nullable(i.number()),fov:i.nullable(i.number()),focus:i.nullable(i.number(1),!0)},span:{range:i.nullable(i.vec2(-1,1))},view:{range:i.array(i.vec2(-1,1),4)},view3:{position:i.vec3(),quaternion:i.quat(),rotation:i.vec3(),scale:i.vec3(1,1,1),eulerOrder:i.swizzle("xyz")},view4:{position:i.vec4(),scale:i.vec4(1,1,1,1)},layer:{depth:i.number(1),fit:i.fit("y")},vertex:{pass:i.vertexPass()},fragment:{pass:i.fragmentPass(),gamma:i.bool(!1)},transform3:{position:i.vec3(),quaternion:i.quat(),rotation:i.vec3(),eulerOrder:i.swizzle("xyz"),scale:i.vec3(1,1,1),matrix:i.mat4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},transform4:{position:i.vec4(),scale:i.vec4(1,1,1,1),matrix:i.mat4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},camera:{proxy:i.bool(!1),position:i.nullable(i.vec3()),quaternion:i.nullable(i.quat()),rotation:i.nullable(i.vec3()),lookAt:i.nullable(i.vec3()),up:i.nullable(i.vec3()),eulerOrder:i.swizzle("xyz"),fov:i.nullable(i.number(1))},polar:{bend:i.number(1),helix:i.number(0)},spherical:{bend:i.number(1)},stereographic:{bend:i.number(1)},interval:{axis:i.axis()},area:{axes:i.swizzle([1,2],2)},volume:{axes:i.swizzle([1,2,3],3)},origin:{origin:i.vec4()},scale:{divide:i.number(10),unit:i.number(1),base:i.number(10),mode:i.scale(),start:i.bool(!0),end:i.bool(!0),zero:i.bool(!0),factor:i.positive(i.number(1)),nice:i.bool(!0)},grid:{lineX:i.bool(!0),lineY:i.bool(!0),crossed:i.bool(!1),closedX:i.bool(!1),closedY:i.bool(!1)},axis:{detail:i["int"](1),crossed:i.bool(!1)},data:{data:i.nullable(i.data()),expr:i.nullable(i.emitter()),bind:i.nullable(i.func()),live:i.bool(!0)},buffer:{channels:i["enum"](4,[1,2,3,4]),items:i["int"](1),fps:i.nullable(i["int"](60)),hurry:i["int"](5),limit:i["int"](60),realtime:i.bool(!1),observe:i.bool(!1),aligned:i.bool(!1)},sampler:{centered:i.bool(!1),padding:i.number(0)},array:{width:i.nullable(i.positive(i["int"](1),!0)),bufferWidth:i["int"](1),history:i["int"](1)},matrix:{width:i.nullable(i.positive(i["int"](1),!0)),height:i.nullable(i.positive(i["int"](1),!0)),history:i["int"](1),bufferWidth:i["int"](1),bufferHeight:i["int"](1)},voxel:{width:i.nullable(i.positive(i["int"](1),!0)),height:i.nullable(i.positive(i["int"](1),!0)),depth:i.nullable(i.positive(i["int"](1),!0)),bufferWidth:i["int"](1),bufferHeight:i["int"](1),bufferDepth:i["int"](1)},resolve:{expr:i.nullable(i.func()),items:i["int"](1)},style:{opacity:i.positive(i.number(1)),color:i.color(),blending:i.blending(),zWrite:i.bool(!0),zTest:i.bool(!0),zIndex:i.positive(i.round()),zBias:i.number(0),zOrder:i.nullable(i["int"]())},geometry:{points:i.select(),colors:i.nullable(i.select())},point:{size:i.positive(i.number(4)),sizes:i.nullable(i.select()),shape:i.shape(),optical:i.bool(!0),fill:i.bool(!0),depth:i.number(1)},line:{width:i.positive(i.number(2)),depth:i.positive(i.number(1)),join:i.join(),stroke:i.stroke(),proximity:i.nullable(i.number(1/0)),closed:i.bool(!1)},mesh:{fill:i.bool(!0),shaded:i.bool(!1),map:i.nullable(i.select()),lineBias:i.number(5)},strip:{line:i.bool(!1)},face:{line:i.bool(!1)},arrow:{size:i.number(3),start:i.bool(!1),end:i.bool(!1)},ticks:{normal:i.vec3(0,0,1),size:i.positive(i.number(10)),epsilon:i.positive(i.number(.001))},attach:{offset:i.vec2(0,-20),snap:i.bool(!1),depth:i.number(0)},format:{digits:i.nullable(i.positive(i.number(3))),data:i.nullable(i.data()),expr:i.nullable(i.func()),live:i.bool(!0)},font:{font:i.font("sans-serif"),style:i.string(),variant:i.string(),weight:i.string(),detail:i.number(24),sdf:i.number(5)},label:{text:i.select(),size:i.number(16),outline:i.number(2),expand:i.number(0),background:i.color(1,1,1)},overlay:{opacity:i.number(1),zIndex:i.positive(i.round(0))},dom:{points:i.select(),html:i.select(),size:i.number(16),outline:i.number(2),zoom:i.number(1),color:i.nullable(i.color()),attributes:i.nullable(i.object()),pointerEvents:i.bool(!1)},texture:{minFilter:i.filter("nearest"),magFilter:i.filter("nearest"),type:i.type("float")},shader:{sources:i.nullable(i.select()),language:i.string("glsl"),code:i.string(),uniforms:i.nullable(i.object())},include:{shader:i.select()},operator:{source:i.select()},spread:{unit:i.mapping(),items:i.nullable(i.vec4()),width:i.nullable(i.vec4()),height:i.nullable(i.vec4()),depth:i.nullable(i.vec4()),alignItems:i.anchor(),alignWidth:i.anchor(),alignHeight:i.anchor(),alignDepth:i.anchor()},grow:{scale:i.number(1),items:i.nullable(i.anchor()),width:i.nullable(i.anchor()),height:i.nullable(i.anchor()),depth:i.nullable(i.anchor())},split:{order:i.transpose("wxyz"),axis:i.nullable(i.axis()),length:i["int"](1),overlap:i["int"](0)},join:{order:i.transpose("wxyz"),axis:i.nullable(i.axis()),overlap:i["int"](0)},swizzle:{order:i.swizzle()},transpose:{order:i.transpose()},repeat:{items:i.number(1),width:i.number(1),height:i.number(1),depth:i.number(1)},slice:{items:i.nullable(i.vec2()),width:i.nullable(i.vec2()),height:i.nullable(i.vec2()),depth:i.nullable(i.vec2())},lerp:{size:i.mapping("absolute"),items:i.nullable(i.number()),width:i.nullable(i.number()),height:i.nullable(i.number()),depth:i.nullable(i.number())},subdivide:{items:i.nullable(i.positive(i["int"](),!0)),width:i.nullable(i.positive(i["int"](),!0)),height:i.nullable(i.positive(i["int"](),!0)),depth:i.nullable(i.positive(i["int"](),!0)),bevel:i.number(1),lerp:i.bool(!0)},resample:{indices:i.number(4),channels:i.number(4),sample:i.mapping(),size:i.mapping("absolute"),items:i.nullable(i.number()),width:i.nullable(i.number()),height:i.nullable(i.number()),depth:i.nullable(i.number())},readback:{type:i.type("float"),expr:i.nullable(i.func()),data:i.data(),channels:i["enum"](4,[1,2,3,4]),items:i.nullable(i["int"]()),width:i.nullable(i["int"]()),height:i.nullable(i["int"]()),depth:i.nullable(i["int"]())},root:{speed:i.number(1),camera:i.select("[camera]")},inherit:{source:i.select(),traits:i.array(i.string())},rtt:{size:i.mapping("absolute"),width:i.nullable(i.number()),height:i.nullable(i.number()),history:i["int"](1)},compose:{alpha:i.bool(!1)},present:{index:i["int"](1),directed:i.bool(!0),length:i.number(0)},slide:{order:i.nullable(i["int"](0)),steps:i.number(1),early:i["int"](0),late:i["int"](0),from:i.nullable(i["int"](0)),to:i.nullable(i["int"](1))},transition:{stagger:i.vec4(),enter:i.nullable(i.number(1)),exit:i.nullable(i.number(1)),delay:i.number(0),delayEnter:i.nullable(i.number(0)),delayExit:i.nullable(i.number(0)),duration:i.number(.3),durationEnter:i.nullable(i.number(0)),durationExit:i.nullable(i.number(0))},move:{from:i.vec4(),to:i.vec4()},seek:{seek:i.nullable(i.number(0))},track:{target:i.select(),script:i.object({}),ease:i.ease("cosine")},trigger:{trigger:i.nullable(i["int"](1),!0)},step:{playback:i.ease("linear"),stops:i.nullable(i.array(i.number())),delay:i.number(0),duration:i.number(.3),pace:i.number(0),speed:i.number(1),rewind:i.number(2),skip:i.bool(!0),realtime:i.bool(!1)},play:{delay:i.number(0),pace:i.number(1),speed:i.number(1),from:i.number(0),to:i.number(1/0),realtime:i.bool(!1),loop:i.bool(!1)},now:{now:i.nullable(i.timestamp()),seek:i.nullable(i.number(0)),pace:i.number(1),speed:i.number(1)}},e.exports=r},{"./types":115}],108:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./transform"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","include","fragment","bind"],e.prototype.make=function(){return this._helpers.bind.make([{to:"include.shader",trait:"shader",optional:!0}])},e.prototype.unmake=function(){return this._helpers.bind.unmake()},e.prototype.change=function(t,e,n){return e.include||t["fragment.gamma"]?this.rebuild():void 0},e.prototype.fragment=function(t,n){return null!=this.bind.shader&&n===this.props.pass&&(this.props.gamma&&t.pipe("mesh.gamma.out"),t.pipe(this.bind.shader.shaderBind()),t.split(),this.props.gamma&&t.pipe("mesh.gamma.in"),t.pass()),e.__super__.fragment.call(this,t,n)},e}(i),e.exports=r},{"./transform":111}],109:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./transform"),o=Math.PI,r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","vertex","layer"],e.prototype.make=function(){return this._listen("root","root.resize",this.update),this.uniforms={layerScale:this._attributes.make(this._types.vec4()),layerBias:this._attributes.make(this._types.vec4())}},e.prototype.update=function(){var t,e,n,r,i,s,a,u,h,l,c,p;switch(n=this._inherit("root").getCamera(),p=this._inherit("root").getSize(),e=null!=(u=n.aspect)?u:1,s=null!=(h=n.fov)?h:1,a=Math.tan(s*o/360),t=this.node.attributes["layer.fit"]["enum"],l=this.props,i=l.fit,r=l.depth,c=l.scale,i){case t.contain:i=e>1?t.y:t.x;break;case t.cover:i=e>1?t.x:t.y}switch(i){case t.x:this.uniforms.layerScale.value.set(a*e,a*e);break;case t.y:this.uniforms.layerScale.value.set(a,a)}return this.uniforms.layerBias.value.set(0,0,-r,0)},e.prototype.change=function(t,e,n){return t["layer.fit"]||t["layer.depth"]||n?this.update():void 0},e.prototype.vertex=function(t,e){return 2===e?t.pipe("layer.position",this.uniforms):3===e?t.pipe("root.position"):t},e}(i),e.exports=r},{"./transform":111}],110:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("../base/parent"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","include","mask","bind"],e.prototype.make=function(){return this._helpers.bind.make([{to:"include.shader",trait:"shader",optional:!0}])},e.prototype.unmake=function(){return this._helpers.bind.unmake()},e.prototype.change=function(t,e,n){return e.include?this.rebuild():void 0},e.prototype.mask=function(t){var e,n,r;return null!=this.bind.shader?t?(r=this._shaders.shader(),r.pipe(Util.GLSL.identity("vec4")),r.fan(),r.pipe(t),r.next(),r.pipe(this.bind.shader.shaderBind()),r.end(),r.pipe("float combine(float a, float b) { return min(a, b); }")):(r=this._shaders.shader(),r.pipe(this.bind.shader.shaderBind())):r=t,null!=(e=null!=(n=this._inherit("mask"))?n.mask(r):void 0)?e:r},e}(i),e.exports=r},{"../base/parent":47}],111:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("../base/parent"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","vertex","fragment"],e.prototype.vertex=function(t,e){var n,r;return null!=(n=null!=(r=this._inherit("vertex"))?r.vertex(t,e):void 0)?n:t},e.prototype.fragment=function(t,e){var n,r;return null!=(n=null!=(r=this._inherit("fragment"))?r.fragment(t,e):void 0)?n:t},e}(r),e.exports=i},{"../base/parent":47}],112:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./transform"),o=t("../../../util"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","vertex","transform3"],e.prototype.make=function(){return this.uniforms={transformMatrix:this._attributes.make(this._types.mat4())},this.composer=o.Three.transformComposer()},e.prototype.unmake=function(){return delete this.uniforms},e.prototype.change=function(t,e,n){var r,i,o,s,a,u;if(t["transform3.pass"])return this.rebuild();if(e.transform3||n)return o=this.props.position,s=this.props.quaternion,a=this.props.rotation,u=this.props.scale,i=this.props.matrix,r=this.props.eulerOrder,this.uniforms.transformMatrix.value=this.composer(o,a,s,u,i,r)},e.prototype.vertex=function(t,n){return n===this.props.pass&&t.pipe("transform3.position",this.uniforms),e.__super__.vertex.call(this,t,n)},e}(r),e.exports=i},{"../../../util":175,"./transform":111}],113:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./transform"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","vertex","transform4"],e.prototype.make=function(){return this.uniforms={transformMatrix:this._attributes.make(this._types.mat4()),transformOffset:this.node.attributes["transform4.position"]},this.transformMatrix=this.uniforms.transformMatrix.value},e.prototype.unmake=function(){return delete this.uniforms},e.prototype.change=function(t,e,n){var r,i,o;if(t["transform4.pass"])return this.rebuild();if(e.transform4||n)return i=this.props.scale,r=this.props.matrix,o=this.transformMatrix,o.copy(r),o.scale(i)},e.prototype.vertex=function(t,n){return n===this.props.pass&&t.pipe("transform4.position",this.uniforms),e.__super__.vertex.call(this,t,n)},e}(r),e.exports=i},{"./transform":111}],114:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./transform"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","include","vertex","bind"],e.prototype.make=function(){return this._helpers.bind.make([{to:"include.shader",trait:"shader",optional:!0}])},e.prototype.unmake=function(){return this._helpers.bind.unmake()},e.prototype.change=function(t,e,n){return e.include?this.rebuild():void 0},e.prototype.vertex=function(t,n){return null!=this.bind.shader&&n===this.props.pass&&t.pipe(this.bind.shader.shaderBind()),e.__super__.vertex.call(this,t,n)},e}(r),e.exports=i},{"./transform":111}],115:[function(t,e,n){var r,i,o,s=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i=t("../../util"),r={array:function(t,e,n){var r,i;return null==n&&(n=null),r=t.lerp?function(e,n,r,i){var o,s,a,u;for(a=Math.min(e.length,n.length),o=s=0,u=a;u>=0?u>s:s>u;o=u>=0?++s:--s)r[o]=t.lerp(e[o],n[o],r[o],i);return r}:void 0,i=t.op?function(e,n,r,i){var o,s,a,u;for(a=Math.min(e.length,n.length),o=s=0,u=a;u>=0?u>s:s>u;o=u>=0?++s:--s)r[o]=t.op(e[o],n[o],r[o],i);return r}:void 0,null==n||n instanceof Array||(n=[n]),{uniform:function(){return t.uniform?t.uniform()+"v":void 0},make:function(){var r,i,o,s;if(null!=n)return n.slice();if(!e)return[];for(s=[],r=i=0,o=e;o>=0?o>i:i>o;r=o>=0?++i:--i)s.push(t.make());return s},validate:function(n,r,i){var o,s,a,u,h,l;for(n instanceof Array||(n=[n]),u=r.length=e?e:n.length,o=a=0,h=u;h>=0?h>a:a>h;o=h>=0?++a:--a)s=null!=(l=n[o])?l:t.make(),r[o]=t.validate(s,r[o],i);return r},equals:function(e,n){var r,i,o,s,a,u;if(r=e.length,i=n.length,r!==i)return!1;for(a=Math.min(r,i),o=s=0,u=a;u>=0?u>s:s>u;o=u>=0?++s:--s)if(!("function"==typeof t.equals?t.equals(e[o],n[o]):void 0))return!1;return!0},lerp:r,op:i,clone:function(e){var n,r,i,o;for(i=[],n=0,r=e.length;r>n;n++)o=e[n],i.push(t.clone(o));return i}}},letters:function(t,e,n){var i,o,s,a,u;if(null==n&&(n=null),null!=n)for(n===""+n&&(n=n.split("")),o=s=0,a=n.length;a>s;o=++s)u=n[o],n[o]=t.validate(u,u);return i=r.array(t,e,n),{uniform:function(){return i.uniform()},make:function(){return i.make()},validate:function(t,e,n){return t===""+t&&(t=t.split("")),i.validate(t,e,n)},equals:function(t,e){return i.equals(t,e)},clone:i.clone}},nullable:function(t,e){var n,r,i,o;return null==e&&(e=!1),o=e?t.make():null,n=t.emitter?function(e,n){return null==n?e:null==e?n:t.emitter(e,n)}:void 0,r=t.lerp?function(e,n,r,i){return null===e||null===n?.5>i?e:n:(null==r&&(r=t.make()),o=t.lerp(e,n,r,i),r)}:void 0,i=t.op?function(e,n,r,i){return null===e||null===n?null:(null==r&&(r=t.make()),o=t.op(e,n,r,i))}:void 0,{make:function(){return o},validate:function(e,n,r){return null===e?e:(null===n&&(n=t.make()),t.validate(e,n,r))},uniform:function(){return"function"==typeof t.uniform?t.uniform():void 0},equals:function(e,n){var r,i,o;return r=null===e,i=null===n,r&&i?!0:r^i?!1:null!=(o="function"==typeof t.equals?t.equals(e,n):void 0)?o:e===n},lerp:r,op:i,emitter:n}},"enum":function(t,e,n){var r,i,o,s,a,u,h;for(null==e&&(e=[]),null==n&&(n={}),r=0,h={},i=0,s=e.length;s>i;i++)o=e[i],o!==+o&&null==n[o]&&(n[o]=r++);for(u=0,a=e.length;a>u;u++)o=e[u],o===+o&&(h[o]=o);for(o in n)r=n[o],h[r]=!0;return null==h[t]&&(t=n[t]),{"enum":function(){return n},make:function(){return t},validate:function(t,e,r){var i;return i=h[t]?t:n[t],null!=i?i:r()}}},enumber:function(t,e,n){var i;return null==n&&(n={}),i=r["enum"](t,e,n),{"enum":i["enum"],uniform:function(){return"f"},make:function(){var e;return null!=(e=i.make())?e:+t},validate:function(t,e,n){return t===+t?t:i.validate(t,e,n)},op:function(t,e,n,r){return r(t,e)}}},select:function(t){return null==t&&(t="<"),{make:function(){return t},validate:function(t,e,n){return"string"==typeof t?t:"object"==typeof t?t:n()}}},bool:function(t){return t=!!t,{uniform:function(){return"f"},make:function(){return t},validate:function(t,e,n){return!!t}}},"int":function(t){return null==t&&(t=0),t=+Math.round(t),{uniform:function(){return"i"},make:function(){return t},validate:function(t,e,n){var r;return t!==(r=+t)?n():Math.round(r)||0},op:function(t,e,n,r){return r(t,e)}}},round:function(t){return null==t&&(t=0),t=+Math.round(t),{uniform:function(){return"f"},make:function(){return t},validate:function(t,e,n){var r;return t!==(r=+t)?n():Math.round(r)||0},op:function(t,e,n,r){return r(t,e)}}},number:function(t){return null==t&&(t=0),{uniform:function(){return"f"},make:function(){return+t},validate:function(t,e,n){var r;return t!==(r=+t)?n():r||0},op:function(t,e,n,r){return r(t,e)}}},positive:function(t,e){return null==e&&(e=!1),{uniform:t.uniform,make:t.make,validate:function(n,r,i){return n=t.validate(n,r,i),0>n||e&&0>=n?i():n},op:function(t,e,n,r){return r(t,e)}}},string:function(t){return null==t&&(t=""),{make:function(){return""+t},validate:function(t,e,n){var r;return t!==(r=""+t)?n():r}}},func:function(){return{make:function(){return function(){}},validate:function(t,e,n){return"function"==typeof t?t:n()}}},emitter:function(){return{make:function(){return function(t){return t(1,1,1,1)}},validate:function(t,e,n){return"function"==typeof t?t:n()},emitter:function(t,e){return i.Data.getLerpEmitter(t,e)}}},object:function(t){return{make:function(){return null!=t?t:{}},validate:function(t,e,n){return"object"==typeof t?t:n()},clone:function(t){return JSON.parse(JSON.stringify(t))}}},timestamp:function(t){return null==t&&(t=null),"string"==typeof t&&(t=Date.parse(t)),{uniform:function(){return"f"},make:function(){return null!=t?t:+new Date},validate:function(t,e,n){var r;return t=Date.parse(t),t!==(r=+t)?n():t},op:function(t,e,n,r){return r(t,e)}}},vec2:function(t,e){var n;return null==t&&(t=0),null==e&&(e=0),n=[t,e],{uniform:function(){return"v2"},make:function(){return new THREE.Vector2(t,e)},validate:function(r,i,o){var s,a,u,h;if(r===+r&&(r=[r]),r instanceof THREE.Vector2)i.copy(r);else if(r instanceof Array)r=r.concat(n.slice(r.length)),i.set.apply(i,r);else{if(null==r)return o();u=null!=(s=r.x)?s:t,h=null!=(a=r.y)?a:e,i.set(u,h)}return i},equals:function(t,e){return t.x===e.x&&t.y===e.y},op:function(t,e,n,r){return n.x=r(t.x,e.x),n.y=r(t.y,e.y),n}}},ivec2:function(t,e){var n,i;return null==t&&(t=0),null==e&&(e=0),i=r.vec2(t,e),n=i.validate,i.validate=function(t,e,r){return n(t,e,r),e.x=Math.round(e.x),e.y=Math.round(e.y),e},i},vec3:function(t,e,n){var r;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),r=[t,e,n],{uniform:function(){return"v3"},make:function(){return new THREE.Vector3(t,e,n)},validate:function(i,o,s){var a,u,h,l,c,p;if(i===+i&&(i=[i]),i instanceof THREE.Vector3)o.copy(i);else if(i instanceof Array)i=i.concat(r.slice(i.length)),o.set.apply(o,i);else{if(null==i)return s();l=null!=(a=i.x)?a:t,c=null!=(u=i.y)?u:e,p=null!=(h=i.z)?h:n,o.set(l,c,p)}return o},equals:function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},op:function(t,e,n,r){return n.x=r(t.x,e.x),n.y=r(t.y,e.y),n.z=r(t.z,e.z),n}}},ivec3:function(t,e,n){var i,o;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),o=r.vec3(t,e,n),i=o.validate,o.validate=function(t,e){return i(t,e,invalid),e.x=Math.round(e.x),e.y=Math.round(e.y),e.z=Math.round(e.z),e},o},vec4:function(t,e,n,r){var i;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),null==r&&(r=0),i=[t,e,n,r],{uniform:function(){return"v4"},make:function(){return new THREE.Vector4(t,e,n,r)},validate:function(o,s,a){var u,h,l,c,p,f,d,m;if(o===+o&&(o=[o]),o instanceof THREE.Vector4)s.copy(o);else if(o instanceof Array)o=o.concat(i.slice(o.length)),s.set.apply(s,o);else{if(null==o)return a();f=null!=(u=o.x)?u:t,d=null!=(h=o.y)?h:e,m=null!=(l=o.z)?l:n,p=null!=(c=o.w)?c:r,s.set(f,d,m,p)}return s},equals:function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},op:function(t,e,n,r){return n.x=r(t.x,e.x),n.y=r(t.y,e.y),n.z=r(t.z,e.z),n.w=r(t.w,e.w),n}}},ivec4:function(t,e,n,i){var o,s;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),null==i&&(i=0),s=r.vec4(t,e,n,i),o=s.validate,s.validate=function(t,e){return o(t,e,invalid),e.x=Math.round(e.x),e.y=Math.round(e.y),e.z=Math.round(e.z),e.w=Math.round(e.w),e},s},mat3:function(t,e,n,r,i,o,s,a,u){var h;return null==t&&(t=1),null==e&&(e=0),null==n&&(n=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=0),null==s&&(s=0),null==a&&(a=0),null==u&&(u=1),h=[t,e,n,r,i,o,s,a,u],{uniform:function(){return"m4"},make:function(){var h;return h=new THREE.Matrix3,h.set(t,e,n,r,i,o,s,a,u),h},validate:function(t,e,n){if(t instanceof THREE.Matrix3)e.copy(t);else{if(!(t instanceof Array))return n();t=t.concat(h.slice(t.length)),e.set.apply(e,t)}return e}}},mat4:function(t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m){var v;return null==t&&(t=1),null==e&&(e=0),null==n&&(n=0),null==r&&(r=0),null==i&&(i=0),null==o&&(o=1),null==s&&(s=0),null==a&&(a=0),null==u&&(u=0),null==h&&(h=0),null==l&&(l=1),null==c&&(c=0),null==p&&(p=0),null==f&&(f=0),null==d&&(d=0),null==m&&(m=1),v=[t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m],{uniform:function(){return"m4"},make:function(){var v;return v=new THREE.Matrix4,v.set(t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m),v},validate:function(t,e,n){if(t instanceof THREE.Matrix4)e.copy(t);else{if(!(t instanceof Array))return n();t=t.concat(v.slice(t.length)),e.set.apply(e,t)}return e}}},quat:function(t,e,n,i){var o;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),null==i&&(i=1),o=r.vec4(t,e,n,i),{uniform:function(){return"v4"},make:function(){return new THREE.Quaternion},validate:function(t,e,n){return t instanceof THREE.Quaternion?e.copy(t):e=o.validate(t,e,n),e.normalize(),e},equals:function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},op:function(t,e,n,r){return n.x=r(t.x,e.x),n.y=r(t.y,e.y),n.z=r(t.z,e.z),n.w=r(t.w,e.w),n.normalize(),n},lerp:function(t,e,n,r){return THREE.Quaternion.slerp(t,e,n,r),n}}},color:function(t,e,n){var r;return null==t&&(t=.5),null==e&&(e=.5),null==n&&(n=.5),r=[t,e,n],{uniform:function(){return"c"},make:function(){return new THREE.Color(t,e,n)},validate:function(i,o,s){var a,u,h,l,c,p;if(i===""+i?i=(new THREE.Color).setStyle(i):i===+i&&(i=new THREE.Color(i)),i instanceof THREE.Color)o.copy(i);else if(i instanceof Array)i=i.concat(r.slice(i.length)),o.setRGB.apply(o,i);else{if(null==i)return s();p=null!=(h=i.r)?h:t,u=null!=(l=i.g)?l:e,a=null!=(c=i.b)?c:n,o.set(p,u,a)}return o},equals:function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b},op:function(t,e,n,r){return n.r=r(t.r,e.r),n.g=r(t.g,e.g),n.b=r(t.b,e.b),n}}},axis:function(t,e){var n,r,i;return null==t&&(t=1),null==e&&(e=!1),n={x:1,y:2,z:3,w:4,W:1,H:2,D:3,I:4,zero:0,"null":0,width:1,height:2,depth:3,items:4},r=e?[0,1,2,3,4]:[1,2,3,4],null!=(i=n[t])&&(t=i),{make:function(){return t},validate:function(t,e,o){var a;return null!=(i=n[t])&&(t=i),t=null!=(a=Math.round(t))?a:0,s.call(r,t)>=0?t:o()}}},transpose:function(t){var e,n;return null==t&&(t=[1,2,3,4]),n=r.letters(r.axis(null,!1),0,t), +e=r.letters(r.axis(null,!1),4,t),{make:function(){return e.make()},validate:function(t,r,i){var o,s,a,u,h;return u=[1,2,3,4],n.validate(t,u,i),u.length<4&&(a=[1,2,3,4].filter(function(t){return-1===u.indexOf(t)}),u=u.concat(a)),h=function(){var t,e,n;for(n=[],o=t=0,e=u.length;e>t;o=++t)s=u[o],n.push(u.indexOf(s)===o);return n}(),h.indexOf(!1)<0?e.validate(u,r,i):i()},equals:e.equals,clone:e.clone}},swizzle:function(t,e){var n,i;return null==t&&(t=[1,2,3,4]),null==e&&(e=null),null==e&&(e=t.length),t=t.slice(0,e),i=r.letters(r.axis(null,!1),0,t),n=r.letters(r.axis(null,!0),e,t),{make:function(){return n.make()},validate:function(r,o,s){var a;return a=t.slice(),i.validate(r,a,s),a.length0?1/s-1:0,v=this.props.position,_=this.props.scale,g=this.props.quaternion,E=this.props.rotation,f=this.props.range,l=this.props.eulerOrder,M=f[0].x,S=f[1].x,k=f[2].x,a=f[0].y-M||1,u=f[1].y-S||1,h=f[2].y-k||1,x=_.x,w=_.y,R=_.z,m=a>0?1:-1,y=i.Axis.recenterAxis(S,u,s),S=y[0],u=y[1],r=Math.abs(u),c=a+(r*m-a)*s,b=c/x,T=u/w,this.aspect=o=Math.abs(b/T),this.uniforms.polarFocus.value=p,this.uniforms.polarAspect.value=o,this.viewMatrix.set(2/c,0,0,-(2*M+a)/a,0,2/u,0,-(2*S+u)/u,0,0,2/h,-(2*k+h)/h,0,0,0,1),H=this.composer(v,E,g,_,null,l),this.viewMatrix.multiplyMatrices(H,this.viewMatrix),t["view.range"]||e.polar?this.trigger({type:"view.range"}):void 0},e.prototype.vertex=function(t,n){return 1===n&&t.pipe("polar.position",this.uniforms),e.__super__.vertex.call(this,t,n)},e.prototype.axis=function(t){var e,n,r;return r=this.props.range[t-1],n=r.x,e=r.y,2===t&&this.bend>0&&(e=Math.max(Math.abs(e),Math.abs(n)),n=Math.max(-this.focus/this.aspect,n)),new THREE.Vector2(n,e)},e}(o),e.exports=r},{"../../../util":175,"./view":122}],119:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("./view"),i=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","object","visible","view","view3","spherical","vertex"],e.prototype.make=function(){var t;return e.__super__.make.apply(this,arguments),t=this._attributes.types,this.uniforms={sphericalBend:this.node.attributes["spherical.bend"],sphericalFocus:this._attributes.make(this._types.number()),sphericalAspectX:this._attributes.make(this._types.number()),sphericalAspectY:this._attributes.make(this._types.number()),sphericalScaleY:this._attributes.make(this._types.number()),viewMatrix:this._attributes.make(this._types.mat4())},this.viewMatrix=this.uniforms.viewMatrix.value,this.composer=i.Three.transformComposer(),this.aspectX=1,this.aspectY=1},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),delete this.viewMatrix,delete this.objectMatrix,delete this.aspectX,delete this.aspectY,delete this.uniforms},e.prototype.change=function(t,e,n){var r,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O;if(e.view||e.view3||e.spherical||n)return this.bend=u=this.props.bend,this.focus=m=u>0?1/u-1:0,y=this.props.position,w=this.props.scale,_=this.props.quaternion,b=this.props.rotation,v=this.props.range,p=this.props.eulerOrder,L=v[0].x,z=v[1].x,O=v[2].x,h=v[0].y-L||1,l=v[1].y-z||1,c=v[2].y-O||1,k=w.x,A=w.y,C=w.z,T=i.Axis.recenterAxis(z,l,u),z=T[0],l=T[1],x=i.Axis.recenterAxis(O,c,u),O=x[0],c=x[1],g=h>0?1:-1,E=l>0?1:-1,r=Math.abs(c),f=h+(r*g-h)*u,d=l+(r*E-l)*u,H=f/k,M=d/A,S=c/C,this.aspectX=o=Math.abs(H/S),this.aspectY=s=Math.abs(M/S/o),a=l/h*k/A*2,this.scaleY=R=Math.min(s/u,1+(a-1)*u),this.uniforms.sphericalBend.value=u,this.uniforms.sphericalFocus.value=m,this.uniforms.sphericalAspectX.value=o,this.uniforms.sphericalAspectY.value=s,this.uniforms.sphericalScaleY.value=R,this.viewMatrix.set(2/f,0,0,-(2*L+h)/h,0,2/d,0,-(2*z+l)/l,0,0,2/c,-(2*O+c)/c,0,0,0,1),P=this.composer(y,b,_,w,null,p),this.viewMatrix.multiplyMatrices(P,this.viewMatrix),t["view.range"]||e.spherical?this.trigger({type:"view.range"}):void 0},e.prototype.vertex=function(t,n){return 1===n&&t.pipe("spherical.position",this.uniforms),e.__super__.vertex.call(this,t,n)},e.prototype.axis=function(t){var e,n,r;return r=this.props.range[t-1],n=r.x,e=r.y,3===t&&this.bend>0&&(e=Math.max(Math.abs(e),Math.abs(n)),n=Math.max(-this.focus/this.aspectX+.001,n)),new THREE.Vector2(n,e)},e}(o),e.exports=r},{"../../../util":175,"./view":122}],120:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("./view"),i=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","object","visible","view","view3","stereographic","vertex"],e.prototype.make=function(){var t;return e.__super__.make.apply(this,arguments),t=this._attributes.types,this.uniforms={stereoBend:this.node.attributes["stereographic.bend"],viewMatrix:this._attributes.make(this._types.mat4())},this.viewMatrix=this.uniforms.viewMatrix.value,this.composer=i.Three.transformComposer()},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),delete this.viewMatrix,delete this.rotationMatrix,delete this.uniforms},e.prototype.change=function(t,e,n){var r,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;if(e.view||e.view3||e.stereographic||n)return this.bend=r=this.props.bend,l=this.props.position,d=this.props.scale,c=this.props.quaternion,p=this.props.rotation,h=this.props.range,u=this.props.eulerOrder,y=h[0].x,_=h[1].x,b=h[2].x,o=h[0].y-y||1,s=h[1].y-_||1,a=h[2].y-b||1,m=d.x,v=d.y,g=d.z,f=i.Axis.recenterAxis(b,a,r,1),b=f[0],a=f[1],this.uniforms.stereoBend.value=r,this.viewMatrix.set(2/o,0,0,-(2*y+o)/o,0,2/s,0,-(2*_+s)/s,0,0,2/a,-(2*b+a)/a,0,0,0,1),E=this.composer(l,p,c,d,null,u),this.viewMatrix.multiplyMatrices(E,this.viewMatrix),t["view.range"]||e.stereographic?this.trigger({type:"view.range"}):void 0},e.prototype.vertex=function(t,n){return 1===n&&t.pipe("stereographic.position",this.uniforms),e.__super__.vertex.call(this,t,n)},e}(o),e.exports=r},{"../../../util":175,"./view":122}],121:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("./view"),i=t("../../../util"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.traits=["node","object","visible","view","view4","stereographic","vertex"],e.prototype.make=function(){return e.__super__.make.apply(this,arguments),this.uniforms={basisOffset:this._attributes.make(this._types.vec4()),basisScale:this._attributes.make(this._types.vec4()),stereoBend:this.node.attributes["stereographic.bend"]},this.basisScale=this.uniforms.basisScale.value,this.basisOffset=this.uniforms.basisOffset.value},e.prototype.unmake=function(){return e.__super__.unmake.apply(this,arguments),delete this.basisScale,delete this.basisOffset,delete this.uniforms},e.prototype.change=function(t,e,n){var r,o,s,a,u,h,l,c,p,f,d,m,v,g;if(e.view||e.view4||e.stereographic||n)return this.bend=r=this.props.bend,c=this.props.position,f=this.props.scale,h=this.props.range,m=h[0].x,v=h[1].x,g=h[2].x,d=h[3].x,s=h[0].y-m||1,a=h[1].y-v||1,u=h[2].y-g||1,o=h[3].y-d||1,l=function(t,e){return t.x*=e.x,t.y*=e.y,t.z*=e.z,t.w*=e.w},p=i.Axis.recenterAxis(d,o,r,1),d=p[0],o=p[1],this.basisScale.set(2/s,2/a,2/u,2/o),this.basisOffset.set(-(2*m+s)/s,-(2*v+a)/a,-(2*g+u)/u,-(2*d+o)/o),l(this.basisScale,f),l(this.basisOffset,f),this.basisOffset.add(c),t["view.range"]||e.stereographic?this.trigger({type:"view.range"}):void 0},e.prototype.vertex=function(t,n){return 1===n&&t.pipe("stereographic4.position",this.uniforms),e.__super__.vertex.call(this,t,n)},e}(o),e.exports=r},{"../../../util":175,"./view":122}],122:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("../transform/transform"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.traits=["node","object","visible","view","vertex"],e.prototype.make=function(){return this._helpers.visible.make()},e.prototype.unmake=function(){return this._helpers.visible.unmake()},e.prototype.axis=function(t){return this.props.range[t-1]},e}(r),e.exports=i},{"../transform/transform":111}],123:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./databuffer"),o=t("../../util"),r=function(t){function e(t,n,r){this.width=r.width||1,this.history=r.history||1,this.samples=this.width,this.wrap=this.history>1,r.width=this.width,r.height=this.history,r.depth=1,e.__super__.constructor.call(this,t,n,r)}return s(e,t),e.prototype.build=function(t){return e.__super__.build.apply(this,arguments),this.index=0,this.pad=0,this.streamer=this.generate(this.data)},e.prototype.setActive=function(t){return this.pad=Math.max(0,this.width-t)},e.prototype.fill=function(){var t,e,n,r,i,o,s,a,u;for(t=this.callback,"function"==typeof t.reset&&t.reset(),s=this.streamer,r=s.emit,u=s.skip,e=s.count,n=s.done,a=s.reset,a(),o=this.samples-this.pad,i=0;!n()&&o>i&&t(r,i++)!==!1;);return Math.floor(e()/this.items)},e.prototype.write=function(t){return null==t&&(t=this.samples),t*=this.items,this.texture.write(this.data,0,this.index,t,1),this.dataPointer.set(.5,this.index+.5),this.index=(this.index+this.history-1)%this.history,this.filled=Math.min(this.history,this.filled+1)},e.prototype.through=function(t,e){var n,r,i,s,a,u,h,l;return h=l=this.streamer,n=h.consume,r=h.done,s=(i=e.streamer).emit,a=0,u=function(){return n(function(e,n,r,i){return t(s,e,n,r,i,a)})},u=o.Data.repeatCall(u,this.items),function(t){return function(){var e;for(l.reset(),i.reset(),e=t.samples-t.pad,a=0;!r()&&e>a;)u(),a++;return l.count()}}(this)},e}(i),e.exports=r},{"../../util":175,"./databuffer":126}],124:[function(t,e,n){var r,i,o,s,a,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("../renderable"),u=t("../../util"),o=t("./texture/datatexture"),i=t("./texture/backedtexture"),r=function(t){function e(t,n,r){null==this.width&&(this.width=r.width||512),null==this.height&&(this.height=r.height||512),null==this.channels&&(this.channels=r.channels||4),null==this.backed&&(this.backed=r.backed||!1),this.samples=this.width*this.height,e.__super__.constructor.call(this,t,n),this.build(r)}return h(e,t),e.prototype.shader=function(t){return t.pipe("map.2d.data",this.uniforms),t.pipe("sample.2d",this.uniforms),this.channels<4&&t.pipe(u.GLSL.swizzleVec4(["0000","x000","xw00","xyz0"][this.channels])),t},e.prototype.build=function(t){var e;return this.klass=e=this.backed?i:o,this.texture=new e(this.gl,this.width,this.height,this.channels,t),this.uniforms={dataPointer:{type:"v2",value:new THREE.Vector2(0,0)}},this._adopt(this.texture.uniforms),this.reset()},e.prototype.reset=function(){return this.rows=[],this.bottom=0},e.prototype.resize=function(t,e){if(!this.backed)throw new Error("Cannot resize unbacked texture atlas");return t>2048&&e>2048?console.warn("Giant text atlas "+t+"x"+e+"."):console.info("Resizing text atlas "+t+"x"+e+"."),this.texture.resize(t,e),this.width=t,this.height=e,this.samples=t*e},e.prototype.collapse=function(t){var e,n,r;return r=this.rows,r.splice(r.indexOf(t),1),this.bottom=null!=(e=null!=(n=r[r.length-1])?n.bottom:void 0)?e:0,this.last===t?this.last=null:void 0},e.prototype.allocate=function(t,e,n,r){var i,o,s,u,h,l,c,p,f,d,m,v;if(v=this.width,s=this.height,p=2*n,e>v)return this.resize(2*v,2*s),this.last=null,this.allocate(t,e,n,r);if(d=this.last,null!=d&&d.height>=n&&d.heightl;u=++l)if(d=f[u],o=d.top-i,o>=n&&0>h&&(h=u,m=i),i=d.bottom,d.height>=n&&d.height=0)d=new a(m,n),this.rows.splice(h,0,d);else{if(m=i,i+=n,i>=s)return this.resize(2*v,2*s),this.last=null,this.allocate(t,e,n,r);d=new a(m,n),this.rows.push(d),this.bottom=i}d.append(t,e,n,r),this.last=d},e.prototype.read=function(){return this.texture.textureObject},e.prototype.write=function(t,e,n,r,i){return this.texture.write(t,e,n,r,i)},e.prototype.dispose=function(){return this.texture.dispose(),this.data=null,e.__super__.dispose.apply(this,arguments)},e}(s),a=function(){function t(t,e){this.top=t,this.bottom=t+e,this.width=0,this.height=e,this.alive=0,this.keys=[]}return t.prototype.append=function(t,e,n,r){var i,o;return i=this.width,o=this.top,this.alive++,this.width+=e,this.keys.push(t),r(this,i,o)},t}(),e.exports=r},{"../../util":175,"../renderable":161,"./texture/backedtexture":133,"./texture/datatexture":134}],125:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../renderable"),o=t("../../util"),r=function(t){function e(t,n,r){null==this.items&&(this.items=r.items||1),null==this.samples&&(this.samples=r.samples||1),null==this.channels&&(this.channels=r.channels||4),null==this.callback&&(this.callback=r.callback||function(){}),e.__super__.constructor.call(this,t,n)}return s(e,t),e.prototype.dispose=function(){return e.__super__.dispose.apply(this,arguments)},e.prototype.update=function(){var t;return t=this.fill(),this.write(t),t},e.prototype.setActive=function(t,e,n,r){},e.prototype.setCallback=function(t){this.callback=t},e.prototype.write=function(){},e.prototype.fill=function(){},e.prototype.generate=function(t){return o.Data.getStreamer(t,this.samples,this.channels,this.items)},e}(i),e.exports=r},{"../../util":175,"../renderable":161}],126:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("./buffer"),o=t("./texture/datatexture"),s=t("../../util"),i=function(t){function e(t,n,r){this.width=r.width||1,this.height=r.height||1,this.depth=r.depth||1,null==this.samples&&(this.samples=this.width*this.height*this.depth),e.__super__.constructor.call(this,t,n,r),this.build(r)}return a(e,t),e.prototype.shader=function(t,e){var n;return null==e&&(e=4),this.items>1||this.depth>1?(4!==e&&t.pipe(s.GLSL.extendVec(e,4)),t.pipe("map.xyzw.texture",this.uniforms)):2!==e&&t.pipe(s.GLSL.truncateVec(e,2)),n=this.wrap?".wrap":"",t.pipe("map.2d.data"+n,this.uniforms),t.pipe("sample.2d",this.uniforms),this.channels<4&&t.pipe(s.GLSL.swizzleVec4(["0000","x000","xw00","xyz0"][this.channels])),t},e.prototype.build=function(t){return this.data=new Float32Array(this.samples*this.channels*this.items),this.texture=new o(this.gl,this.items*this.width,this.height*this.depth,this.channels,t),this.filled=0,this.used=0,this._adopt(this.texture.uniforms),this._adopt({dataPointer:{type:"v2",value:new THREE.Vector2},textureItems:{type:"f",value:this.items},textureHeight:{type:"f",value:this.height}}),this.dataPointer=this.uniforms.dataPointer.value,this.streamer=this.generate(this.data)},e.prototype.dispose=function(){return this.data=null,this.texture.dispose(),e.__super__.dispose.apply(this,arguments)},e.prototype.getFilled=function(){return this.filled},e.prototype.setCallback=function(t){return this.callback=t,this.filled=0},e.prototype.copy=function(t){var e,n,r,i,o;for(i=Math.min(t.length,this.samples*this.channels*this.items),e=this.data,n=r=0,o=i;o>=0?o>r:r>o;n=o>=0?++r:--r)e[n]=t[n];return this.write(Math.ceil(i/this.channels/this.items))},e.prototype.write=function(t){var e,n;return null==t&&(t=this.samples),e=t/this.width,t*=this.items,n=1>e?t:this.items*this.width,e=Math.ceil(e),this.texture.write(this.data,0,0,n,e),this.dataPointer.set(.5,.5),this.filled=1,this.used=t},e.prototype.through=function(t,e){var n,r,i,o,a,u,h,l;return h=l=this.streamer,n=h.consume,r=h.done,o=(i=e.streamer).emit,a=0,u=function(){return n(function(e,n,r,i){return t(o,e,n,r,i,a)})},u=s.Data.repeatCall(u,this.items),function(t){return function(){var e;for(l.reset(),i.reset(),e=t.used,a=0;!r()&&e>a;)u(),a++;return l.count()}}(this)},e}(r),e.exports=i},{"../../util":175,"./buffer":125,"./texture/datatexture":134}],127:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./databuffer"),o=t("../../util"),i=function(t){function e(t,n,r){this.width=r.width||1,this.height=r.height||1,this.history=r.history||1,this.samples=this.width*this.height,this.wrap=this.history>1,r.depth=this.history,e.__super__.constructor.call(this,t,n,r)}return s(e,t),e.prototype.build=function(t){return e.__super__.build.apply(this,arguments),this.index=0,this.pad={x:0,y:0},this.streamer=this.generate(this.data)},e.prototype.getFilled=function(){return this.filled},e.prototype.setActive=function(t,e){var n;return n=[Math.max(0,this.width-t),Math.max(0,this.height-e)],this.pad.x=n[0],this.pad.y=n[1],n},e.prototype.fill=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f;if(t=this.callback,"function"==typeof t.reset&&t.reset(),l=this.streamer,r=l.emit,f=l.skip,e=l.count,n=l.done,p=l.reset,p(),u=this.width,h=this.pad.x,a=this.samples-this.pad.y*u,i=o=s=0,h)for(;!n()&&a>s&&(s++,c=t(r,i,o),++i===u-h&&(f(h),i=0,o++),c!==!1););else for(;!n()&&a>s&&(s++,c=t(r,i,o),++i===u&&(i=0,o++),c!==!1););return Math.floor(e()/this.items)},e.prototype.write=function(t){var e,n;return null==t&&(t=this.samples),t*=this.items,n=this.width*this.items,e=Math.ceil(t/n),this.texture.write(this.data,0,this.index*this.height,n,e),this.dataPointer.set(.5,this.index*this.height+.5),this.index=(this.index+this.history-1)%this.history,this.filled=Math.min(this.history,this.filled+1)},e.prototype.through=function(t,e){var n,r,i,s,a,u,h,l,c;return l=c=this.streamer,n=l.consume,r=l.done,s=(i=e.streamer).emit,a=u=0,h=function(){return n(function(e,n,r,i){return t(s,e,n,r,i,a,u)})},h=o.Data.repeatCall(h,this.items),function(t){return function(){var e,n,o,s;if(c.reset(),i.reset(),o=t.width,s=t.pad.x,n=t.samples-t.pad.y*o,a=u=e=0,s)for(;!r()&&n>e;)e++,h(),++a===o-s&&(skip(s),a=0,u++);else for(;!r()&&n>e;)e++,h(),++a===o&&(a=0,u++);return c.count()}}(this)},e}(r),e.exports=i},{"../../util":175,"./databuffer":126}],128:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=t("../renderable"),i=t("./rendertotexture"),s=t("../../util"),r=function(t){function e(t,n,r){null==this.items&&(this.items=r.items||1),null==this.channels&&(this.channels=r.channels||4),null==this.width&&(this.width=r.width||1),null==this.height&&(this.height=r.height||1),null==this.depth&&(this.depth=r.depth||1),r.format=THREE.RGBAFormat,r.width=this._width=this.items*this.width,r.height=this._height=this.height*this.depth,r.frames=1,delete r.items,delete r.depth,delete r.channels,e.__super__.constructor.call(this,t,n,r),this._adopt({textureItems:{type:"f",value:this.items},textureHeight:{type:"f",value:this.height}})}return a(e,t),e.prototype.shaderAbsolute=function(t){return null==t&&(t=this.shaders.shader()),t.pipe("map.xyzw.texture",this.uniforms),e.__super__.shaderAbsolute.call(this,t,1,2)},e}(i),e.exports=r},{"../../util":175,"../renderable":161,"./rendertotexture":131}],129:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./buffer"),o=t("../../util"),i=function(t){function e(t,n,r){this.width=r.width||1,this.height=r.height||1,this.depth=r.depth||1,null==this.samples&&(this.samples=this.width*this.height*this.depth),e.__super__.constructor.call(this,t,n,r),this.build(r)}return s(e,t),e.prototype.build=function(t){return this.data=[],this.data.length=this.samples,this.filled=0,this.pad={x:0,y:0,z:0},this.streamer=this.generate(this.data)},e.prototype.dispose=function(){return this.data=null,e.__super__.dispose.apply(this,arguments)},e.prototype.getFilled=function(){return this.filled},e.prototype.setActive=function(t,e,n){var r;return r=[this.width-t,this.height-e,this.depth-n],this.pad.x=r[0],this.pad.y=r[1],this.pad.z=r[2],r},e.prototype.read=function(){return this.data},e.prototype.copy=function(t){var e,n,r,i,o,s;for(r=Math.min(t.length,this.samples),e=this.data,s=[],n=i=0,o=r;o>=0?o>i:i>o;n=o>=0?++i:--i)s.push(e[n]=t[n]);return s},e.prototype.fill=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g;if(t=this.callback,"function"==typeof t.reset&&t.reset(),d=this.streamer,r=d.emit,g=d.skip,e=d.count,n=d.done,v=d.reset,v(),l=this.width,h=this.height,c=this.depth,p=this.pad.x,f=this.pad.y,u=this.samples-this.pad.z*l*h,i=o=s=a=0,p>0||f>0)for(;!n()&&u>a&&(a++,m=t(r,i,o,s),++i===l-p&&(g(p),i=0,++o===h-f&&(g(l*f),o=0,s++)),m!==!1););else for(;!n()&&u>a&&(a++,m=t(r,i,o,s),++i===l&&(i=0,++o===h&&(o=0,s++)),m!==!1););return this.filled=1,e()},e}(r),e.exports=i},{"../../util":175,"./buffer":125}],130:[function(t,e,n){var r,i,o,s,a,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;a=t("../renderable"),r=t("./buffer"),i=t("./memo"),o=t("../meshes/memoscreen"),u=t("../../util"),s=function(t){function e(t,n,r){null==this.items&&(this.items=r.items||1),null==this.channels&&(this.channels=r.channels||4),null==this.width&&(this.width=r.width||1),null==this.height&&(this.height=r.height||1),null==this.depth&&(this.depth=r.depth||1),null==this.type&&(this.type=r.type||THREE.FloatType),null==this.stpq&&(this.stpq=r.stpq||!1),this.isFloat=this.type===THREE.FloatType,this.active=this.sampled=this.rect=this.pad=null,e.__super__.constructor.call(this,t,n),this.build(r)}return h(e,t),e.prototype.build=function(t){var e,n,r,s,a,h,l,c,p,f,d,m,v,g;return p=t.map,h=t.indexer,l=null!=h&&!h.empty(),c=this.items,g=this.width,a=this.height,n=this.depth,d=this.stpq,f=p,l&&(this._adopt({indexModulus:{type:"v4",value:new THREE.Vector4(c,c*g,c*g*a,1)}}),f=this.shaders.shader(),f.require(p),f.require(h),f.pipe("float.index.pack",this.uniforms)),this.isFloat&&this.channels>1&&(this.floatMemo=new i(this.renderer,this.shaders,{items:c,channels:4,width:g,height:a,depth:n,history:0,type:THREE.FloatType}),this.floatCompose=new o(this.renderer,this.shaders,{map:f,items:c,width:g,height:a,depth:n,stpq:d}),this.floatMemo.adopt(this.floatCompose),d=!1,f=this.shaders.shader(),this.floatMemo.shaderAbsolute(f)),this.isFloat?(m=this.channels,e=4):(m=1,e=this.channels),m>1?(r=this.shaders.shader(),r.pipe(u.GLSL.mapByte2FloatOffset(m)),r.require(f),r.pipe("float.stretch"),r.pipe("float.encode"),f=r):this.isFloat&&(r=this.shaders.shader(),r.pipe(f),r.pipe(u.GLSL.truncateVec4(4,1)),r.pipe("float.encode"),f=r),this.byteMemo=new i(this.renderer,this.shaders,{items:c*m,channels:4,width:g,height:a,depth:n,history:0,type:THREE.UnsignedByteType}),this.byteCompose=new o(this.renderer,this.shaders,{map:f,items:c*m,width:g,height:a,depth:n,stpq:d}),this.byteMemo.adopt(this.byteCompose),v=c*g*m,s=a*n,this.samples=this.width*this.height*this.depth,this.bytes=new Uint8Array(v*s*4),this.isFloat&&(this.floats=new Float32Array(this.bytes.buffer)),this.data=this.isFloat?this.floats:this.bytes,this.streamer=this.generate(this.data),this.active={items:0,width:0,height:0,depth:0},this.sampled={items:0,width:0,height:0,depth:0},this.rect={w:0,h:0},this.pad={x:0,y:0,z:0,w:0},this.stretch=m,this.isIndexed=l,this.setActive(c,g,a,n)},e.prototype.generate=function(t){return u.Data.getStreamer(t,this.samples,4,this.items)},e.prototype.setActive=function(t,e,n,r){var i,o,s,a,u,h,l,c;if(t!==this.active.items||e!==this.active.width||n!==this.active.height||r!==this.active.depth)return o=[t,e,n,r],this.active.items=o[0], +this.active.width=o[1],this.active.height=o[2],this.active.depth=o[3],null!=(s=this.floatCompose)&&s.cover(e,n,r),null!=(a=this.byteCompose)&&a.cover(e*this.stretch,n,r),t=this.items,e=this.active.width,n=1===this.depth?this.active.height:this.height,r=this.active.depth,c=t*e*this.stretch,i=n*r,u=[t,e,n,r],this.sampled.items=u[0],this.sampled.width=u[1],this.sampled.height=u[2],this.sampled.depth=u[3],h=[c,i],this.rect.w=h[0],this.rect.h=h[1],l=[this.sampled.width-this.active.width,this.sampled.height-this.active.height,this.sampled.depth-this.active.depth,this.sampled.items-this.active.items],this.pad.x=l[0],this.pad.y=l[1],this.pad.z=l[2],this.pad.w=l[3],l},e.prototype.update=function(t){var e,n;return null!=(e=this.floatMemo)&&e.render(t),null!=(n=this.byteMemo)?n.render(t):void 0},e.prototype.post=function(){return this.renderer.setRenderTarget(this.byteMemo.target.write),this.gl.readPixels(0,0,this.rect.w,this.rect.h,gl.RGBA,gl.UNSIGNED_BYTE,this.bytes)},e.prototype.readFloat=function(t){var e;return null!=(e=this.floatMemo)?e.read(t):void 0},e.prototype.readByte=function(t){var e;return null!=(e=this.byteMemo)?e.read(t):void 0},e.prototype.setCallback=function(t){return this.emitter=this.callback(t)},e.prototype.callback=function(t){var e,n,r,i,o;return this.isIndexed?(r=this.width,n=this.height,i=this.depth,o=this.items,e=function(e,i,s,a){var u,h,l,c,p;return u=a,p=u%o,u=(u-p)/o,h=u%r,u=(u-h)/r,l=u%n,u=(u-l)/n,c=u,t(e,i,s,a,h,l,c,p)},e.reset=function(){return"function"==typeof t.reset?t.reset():void 0},e):t},e.prototype.iterate=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;for(i=this.emitter,"function"==typeof i.reset&&i.reset(),E=this.streamer,e=E.consume,b=E.skip,n=E.count,r=E.done,_=E.reset,_(),c=0|this.sampled.width,l=0|this.sampled.height,p=0|this.sampled.depth,f=0|this.sampled.items,m=0|this.pad.x,v=0|this.pad.y,g=0|this.pad.z,d=0|this.pad.w,h=c*l*f*(p-g),this.isIndexed||(t=i,i=function(e,n,r,i){return t(e,n,r,i,o,s,a,u)}),o=s=a=u=l=0;!r()&&h>l&&(l++,y=e(i),++u===f-d&&(b(m),u=0,++o===c-m&&(b(f*m),o=0,++s===l-v&&(b(f*c*v),s=0,a++))),y!==!1););return Math.floor(n()/f)},e.prototype.dispose=function(){var t,e,n,r,i,o;return null!=(t=this.floatMemo)&&t.unadopt(this.floatCompose),null!=(e=this.floatMemo)&&e.dispose(),null!=(n=this.floatCompose)&&n.dispose(),null!=(r=this.byteMemo)&&r.unadopt(this.byteCompose),null!=(i=this.byteMemo)&&i.dispose(),null!=(o=this.byteCompose)&&o.dispose(),this.floatMemo=this.byteMemo=this.floatCompose=this.byteCompose=null},e}(a),e.exports=s},{"../../util":175,"../meshes/memoscreen":155,"../renderable":161,"./buffer":125,"./memo":128}],131:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=t("../renderable"),r=t("./texture/rendertarget"),s=t("../../util"),i=function(t){function e(t,n,r){var i;this.scene=null!=(i=r.scene)?i:new THREE.Scene,this.camera=r.camera,e.__super__.constructor.call(this,t,n),this.build(r)}return a(e,t),e.prototype.shaderRelative=function(t){return null==t&&(t=this.shaders.shader()),t.pipe("sample.2d",this.uniforms)},e.prototype.shaderAbsolute=function(t,e,n){var r;return null==e&&(e=1),null==n&&(n=4),null==t&&(t=this.shaders.shader()),1>=e?(n>2&&t.pipe(s.GLSL.truncateVec(n,2)),t.pipe("map.2d.data",this.uniforms),t.pipe("sample.2d",this.uniforms)):(r=s.GLSL.sample2DArray(Math.min(e,this.target.frames)),4>n&&t.pipe(s.GLSL.extendVec(n,4)),t.pipe("map.xyzw.2dv"),t.split(),t.pipe("map.2d.data",this.uniforms),t.pass(),t.pipe(r,this.uniforms))},e.prototype.build=function(t){var e;return this.camera||(this.camera=new THREE.PerspectiveCamera,this.camera.position.set(0,0,3),this.camera.lookAt(new THREE.Vector3)),"function"==typeof(e=this.scene).inject&&e.inject(),this.target=new r(this.gl,t.width,t.height,t.frames,t),this.target.warmup(function(t){return function(e){return t.renderer.setRenderTarget(e)}}(this)),this.renderer.setRenderTarget(null),this._adopt(this.target.uniforms),this._adopt({dataPointer:{type:"v2",value:new THREE.Vector2(.5,.5)}}),this.filled=0},e.prototype.adopt=function(t){var e,n,r,i,o;for(i=t.renders,o=[],e=0,n=i.length;n>e;e++)r=i[e],o.push(this.scene.add(r));return o},e.prototype.unadopt=function(t){var e,n,r,i,o;for(i=t.renders,o=[],e=0,n=i.length;n>e;e++)r=i[e],o.push(this.scene.remove(r));return o},e.prototype.render=function(t){var e;return null==t&&(t=this.camera),this.renderer.render(null!=(e=this.scene.scene)?e:this.scene,t,this.target.write),this.target.cycle(),this.filled=0?d>l:l>d;h=d>=0?++l:--l)u=("00"+Math.max(0,8*-h+128-8*!h).toString(16)).slice(-2),r.push("#"+u+u+u);return m=new Uint8Array(p*c*2),this.canvas=n,this.context=o,this.lineHeight=c,this.maxWidth=p,this.colors=r,this.scratch=m,this._allocate=this.allocate.bind(this),this._write=this.write.bind(this)},e.prototype.reset=function(){return e.__super__.reset.apply(this,arguments),this.mapped={}},e.prototype.begin=function(){var t,e,n,r,i;for(n=this.rows,r=[],t=0,e=n.length;e>t;t++)i=n[t],r.push(i.alive=0);return r},e.prototype.end=function(){var t,e,n,r,i,o,s,a,u;for(o=this.mapped,s=this.rows.slice(),t=0,r=s.length;r>t;t++)if(u=s[t],0===u.alive){for(a=u.keys,n=0,i=a.length;i>n;n++)e=a[n],delete o[e];this.collapse(u)}},e.prototype.map=function(t,e){var n,r,i,o,s,a,u;return s=this.mapped,r=s[t],null!=r?(r.row.alive++,e(r.x,r.y,r.w,r.h)):(this.draw(t),i=this.scratch,a=this.scratchW,o=this.scratchH,n=this._allocate,u=this._write,n(t,a,o,function(n,r,h){return s[t]={x:r,y:h,w:a,h:o,row:n},u(i,r,h,a,o),e(r,h,a,o)}))},e.prototype.draw=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R;if(x=this.width,h=this.lineHeight,y=this.outline,o=this.context,a=this.scratch,g=this.maxWidth,i=this.colors,w=y+1,R=Math.round(1.05*h-1),m=o.measureText(t),x=Math.min(g,Math.ceil(m.width+2*w+1)),o.clearRect(0,0,x,h),0===this.outline){for(o.fillText(t,w,R),s=(c=o.getImageData(0,0,x,h)).data,p=3,l=f=0,_=s.length/4;_>=0?_>f:f>_;l=_>=0?++f:--f)a[l]=s[p],p+=4;return this.scratchW=x,this.scratchH=h}for(o.globalCompositeOperation="source-over",l=d=b=y+1;1>=b?1>=d:d>=1;l=1>=b?++d:--d)p=l>1?2*l-2:l,o.strokeStyle=i[p-1],o.lineWidth=p,o.strokeText(t,w,R);for(o.globalCompositeOperation="multiply",o.fillText(t,w,R),s=(c=o.getImageData(0,0,x,h)).data,p=0,u=this.gamma,l=E=0,T=s.length/4;T>=0?T>E:E>T;l=T>=0?++E:--E)e=s[p],v=e?s[p+1]/e:1,.5===u&&(v=Math.sqrt(v)),v=Math.min(1,Math.max(0,v)),n=256-e,r=n+(e-n)*v,a[l]=Math.max(0,Math.min(255,r+2)),p+=4;return this.scratchW=x,this.scratchH=h},e}(r),e.exports=o},{"./atlas":124}],133:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("../../../Util"),i=t("./datatexture"),r=function(t){function e(t,n,r,i,o){e.__super__.constructor.call(this,t,n,r,i,o),this.data=new this.ctor(this.n)}return s(e,t),e.prototype.resize=function(t,e){var n,r,i,o;return r=this.data,o=this.width,i=this.height,this.width=t,this.height=e,this.n=t*e*this.channels,this.data=new this.ctor(this.n),n=this.gl,n.bindTexture(n.TEXTURE_2D,this.texture),n.pixelStorei(n.UNPACK_ALIGNMENT,1),n.texImage2D(n.TEXTURE_2D,0,this.format,t,e,0,this.format,this.type,this.data),this.uniforms.dataResolution.value.set(1/t,1/e),this.write(r,0,0,o,i)},e.prototype.write=function(t,n,r,i,o){var s,a,u,h,l,c,p,f,d,m,v,g;if(f=this.width,a=this.data,s=this.channels,u=0,f===i&&0===n)for(h=r*i*s,c=i*o*s;c>u;)a[h++]=t[u++];else for(p=f*s,d=i*s,m=n*s,g=r,v=r+o;v>g;){for(l=0,h=m+g*p;l++=0?r>n:n>r;t=r>=0?++n:--n)i.push(e());return i}.call(this),this.reads=function(){var n,r,i;for(i=[],t=n=0,r=this.buffers;r>=0?r>n:n>r;t=r>=0?++n:--n)i.push(e());return i}.call(this),this.write=e(),this.index=0,this.uniforms={dataResolution:{type:"v2",value:new THREE.Vector2(1/this.width,1/this.height)},dataTexture:{type:"t",value:this.reads[0]},dataTextures:{type:"tv",value:this.reads}}},t.prototype.cycle=function(){var t,e,n,r,i,o,s,a,u;for(o=["__webglTexture","__webglFramebuffer","__webglRenderbuffer"],e=this.buffers,n=function(t,e){var n,r,i;for(n=0,i=o.length;i>n;n++)r=o[n],e[r]=t[r];return null},t=function(t,n){return(t+n+2*e)%e},n(this.write,this.targets[this.index]),u=this.reads,r=i=0,s=u.length;s>i;r=++i)a=u[r],n(this.targets[t(this.index,-r)],a);return this.index=t(this.index,1),n(this.targets[this.index],this.write)},t.prototype.warmup=function(t){var e,n,r,i;for(i=[],e=n=0,r=this.buffers;r>=0?r>n:n>r;e=r>=0?++n:--n)t(this.write),i.push(this.cycle());return i},t.prototype.dispose=function(){var t,e,n,r;for(n=this.targets,t=0,e=n.length;e>t;t++)r=n[t],r.dispose();return this.targets=this.reads=this.write=null},t}(),e.exports=r},{}],136:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./databuffer"),i=t("../../util"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.build=function(t){return e.__super__.build.apply(this,arguments),this.pad={x:0,y:0,z:0},this.streamer=this.generate(this.data)},e.prototype.setActive=function(t,e,n){var r;return r=[Math.max(0,this.width-t),Math.max(0,this.height-e),Math.max(0,this.depth-n)],this.pad.x=r[0],this.pad.y=r[1],this.pad.z=r[2],r},e.prototype.fill=function(){var t,e,n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g;if(t=this.callback,"function"==typeof t.reset&&t.reset(),d=this.streamer,r=d.emit,g=d.skip,e=d.count,n=d.done,v=d.reset,v(),l=this.width,h=this.height,c=this.depth,p=this.pad.x,f=this.pad.y,u=this.samples-this.pad.z*l*h,i=o=s=a=0,p>0||f>0)for(;!n()&&u>a&&(a++,m=t(r,i,o,s),++i===l-p&&(g(p),i=0,++o===h-f&&(g(l*f),o=0,s++)),m!==!1););else for(;!n()&&u>a&&(a++,m=t(r,i,o,s),++i===l&&(i=0,++o===h&&(o=0,s++)),m!==!1););return Math.floor(e()/this.items)},e.prototype.through=function(t,e){var n,r,o,s,a,u,h,l,c,p;return c=p=this.streamer,n=c.consume,r=c.done,s=(o=e.streamer).emit,a=u=h=0,l=function(){return n(function(e,n,r,i){return t(s,e,n,r,i,a,u,h)})},l=i.Data.repeatCall(l,this.items),function(t){return function(){var e,n,i,s,c,f,d;if(p.reset(),o.reset(),s=t.width,i=t.height,c=t.depth,f=t.pad.x,d=t.pad.y,n=t.samples-t.pad.z*s*i,a=u=h=e=0,f>0||d>0)for(;!r()&&n>e;)e++,l(),++a===s-f&&(skip(f),a=0,++u===i-d&&(skip(s*d),u=0,h++));else for(;!r()&&n>e;)e++,l(),++a===s&&(a=0,++u===i&&(u=0,h++));return p.count()}}(this)},e}(r),e.exports=o},{"../../util":175,"./databuffer":126}],137:[function(t,e,n){var r;r={sprite:t("./meshes/sprite"),point:t("./meshes/point"),line:t("./meshes/line"),surface:t("./meshes/surface"),face:t("./meshes/face"),strip:t("./meshes/strip"),arrow:t("./meshes/arrow"),screen:t("./meshes/screen"),memoScreen:t("./meshes/memoscreen"),debug:t("./meshes/debug"),dataBuffer:t("./buffer/databuffer"),arrayBuffer:t("./buffer/arraybuffer"),matrixBuffer:t("./buffer/matrixbuffer"),voxelBuffer:t("./buffer/voxelbuffer"),pushBuffer:t("./buffer/pushbuffer"),renderToTexture:t("./buffer/rendertotexture"),memo:t("./buffer/memo"),readback:t("./buffer/readback"),atlas:t("./buffer/atlas"),textAtlas:t("./buffer/textatlas"),scene:t("./scene")},e.exports=r},{"./buffer/arraybuffer":123,"./buffer/atlas":124,"./buffer/databuffer":126,"./buffer/matrixbuffer":127,"./buffer/memo":128,"./buffer/pushbuffer":129,"./buffer/readback":130,"./buffer/rendertotexture":131,"./buffer/textatlas":132,"./buffer/voxelbuffer":136,"./meshes/arrow":150,"./meshes/debug":152,"./meshes/face":153,"./meshes/line":154,"./meshes/memoscreen":155,"./meshes/point":156,"./meshes/screen":157,"./meshes/sprite":158,"./meshes/strip":159,"./meshes/surface":160,"./scene":162}],138:[function(t,e,n){var r;r=function(){function t(t,e,n){this.classes=t,this.renderer=e,this.shaders=n}return t.prototype.getTypes=function(){return Object.keys(this.classes)},t.prototype.make=function(t,e){return new this.classes[t](this.renderer,this.shaders,e)},t}(),e.exports=r},{}],139:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./clipgeometry"),r=function(t){function e(t){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V,I,j,G,W,q,X,Y;for(e.__super__.constructor.call(this,t),this._clipUniforms(),this.sides=V=+t.sides||12,this.samples=N=+t.samples||2,this.strips=j=+t.strips||1,this.ribbons=B=+t.ribbons||1,this.layers=_=+t.layers||1,this.flip=d=null!=(A=t.flip)?A:!1,this.anchor=r=null!=(C=t.anchor)?C:d?0:N-1,s=j*B*_,H=(V+2)*s,W=2*V*s,this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(3*W),1)),this.addAttribute("position4",new THREE.BufferAttribute(new Float32Array(4*H),4)),this.addAttribute("arrow",new THREE.BufferAttribute(new Float32Array(3*H),3)),this.addAttribute("attach",new THREE.BufferAttribute(new Float32Array(2*H),2)),this._autochunk(),v=this._emitter("index"),M=this._emitter("position4"),o=this._emitter("arrow"),a=this._emitter("attach"),p=[],E=g=0,P=V;P>=0?P>g:g>P;E=P>=0?++g:--g)i=E/V*τ,p.push([Math.cos(i),Math.sin(i),1]);for(l=0,m=b=0,L=s;L>=0?L>b:b>L;m=L>=0?++b:--b){for(G=l++,h=G+V+1,E=T=0,z=V;z>=0?z>T:T>z;E=z>=0?++T:--T)n=l+E%V,u=l+(E+1)%V,v(G),v(n),v(u),v(u),v(n),v(h);l+=V+1}for(I=d?1:-1,f=d?N-1:0,x=r+I,q=r,y=w=0,O=_;O>=0?O>w:w>O;y=O>=0?++w:--w)for(Y=R=0,D=B;D>=0?D>R:R>D;Y=D>=0?++R:--R)for(X=S=0,F=j;F>=0?F>S:S>F;X=F>=0?++S:--S){for(M(q,X,Y,y),o(0,0,0),a(x,f),E=k=0,U=V;U>=0?U>k:k>U;E=U>=0?++k:--k)M(q,X,Y,y),c=p[E],o(c[0],c[1],c[2]),a(x,f);M(q,X,Y,y),o(0,0,1),a(x,f)}this._finalize(),this.clip()}return o(e,t),e.prototype.clip=function(t,e,n,r){var i,o,s,a;return null==t&&(t=this.samples),null==e&&(e=this.strips),null==n&&(n=this.ribbons),null==r&&(r=this.layers),a=Math.max(0,t-1),this._clipGeometry(t,e,n,r),t>this.anchor?(i=[r,n,e],o=[this.layers,this.ribbons,this.strips],s=this.sides*this._reduce(i,o)):s=0,this._offsets([{start:0,count:6*s}])},e}(i),e.exports=r},{"./clipgeometry":140}],140:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("./geometry"),o=!1,s=function(){var t;return t=+new Date,function(e){var n;return n=+new Date-t,console.log(e,n+" ms"),n}},r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._clipUniforms=function(){return this.geometryClip=new THREE.Vector4(1e10,1e10,1e10,1e10),this.geometryResolution=new THREE.Vector4,this.mapSize=new THREE.Vector4,null==this.uniforms&&(this.uniforms={}),this.uniforms.geometryClip={type:"v4",value:this.geometryClip},this.uniforms.geometryResolution={type:"v4",value:this.geometryResolution},this.uniforms.mapSize={type:"v4",value:this.mapSize}},e.prototype._clipGeometry=function(t,e,n,r){var i,o;return i=function(t){return Math.max(0,t-1)},o=function(t){return 1/Math.max(1,t-1)},this.geometryClip.set(i(t),i(e),i(n),i(r)),this.geometryResolution.set(o(t),o(e),o(n),o(r))},e.prototype._clipMap=function(t,e,n,r){return this.mapSize.set(t,e,n,r)},e.prototype._clipOffsets=function(t,e,n,r,i,o,s,a,u){var h,l,c;return h=[r,n,e,i],c=[a,s,o,u],l=this._reduce(h,c),this._offsets([{start:0,count:l*t}])},e}(i),e.exports=r},{"./geometry":142}],141:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./clipgeometry"),i=function(t){function e(t){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A;for(e.__super__.constructor.call(this,t),this._clipUniforms(),this.items=a=+t.items||2,this.width=M=+t.width||1,this.height=i=+t.height||1,this.depth=r=+t.depth||1,this.sides=R=Math.max(0,a-2),w=M*i*r,m=a*w,H=R*w,this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(3*H),1)),this.addAttribute("position4",new THREE.BufferAttribute(new Float32Array(4*m),4)),this._autochunk(),s=this._emitter("index"),v=this._emitter("position4"),n=0,o=h=0,E=w;E>=0?E>h:h>E;o=E>=0?++h:--h){for(u=c=0,y=R;y>=0?y>c:c>y;u=y>=0?++c:--c)s(n),s(n+u+1),s(n+u+2);n+=a}for(A=p=0,_=r;_>=0?_>p:p>_;A=_>=0?++p:--p)for(k=f=0,b=i;b>=0?b>f:f>b;k=b>=0?++f:--f)for(S=d=0,T=M;T>=0?T>d:d>T;S=T>=0?++d:--d)for(l=g=0,x=a;x>=0?x>g:g>x;l=x>=0?++g:--g)v(S,k,A,l);this._finalize(),this.clip()}return o(e,t),e.prototype.clip=function(t,e,n,r){var i;return null==t&&(t=this.width),null==e&&(e=this.height),null==n&&(n=this.depth),null==r&&(r=this.items),i=Math.max(0,r-2),this._clipGeometry(t,e,n,r),this._clipOffsets(3,t,e,n,i,this.width,this.height,this.depth,this.sides)},e}(r),e.exports=i},{"./clipgeometry":140}],142:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=!1,o=function(){var t;return t=+new Date,function(e){var n;return n=+new Date-t,console.log(e,n+" ms"),n}},r=function(t){function e(){THREE.BufferGeometry.call(this),null==this.uniforms&&(this.uniforms={}),null==this.offsets&&(this.offsets=[]),i&&(this.tock=o()),this.chunked=!1,this.limit=65535}return s(e,t),e.prototype._reduce=function(t,e){var n,r,i,o,s,a,u;for(a=!1,r=i=0,o=t.length;o>i;r=++i)n=t[r],s=e[r],a&&(t[r]=s),n>1&&(a=!0);return u=t.reduce(function(t,e){return t*e})},e.prototype._emitter=function(t){var e,n,r,i,o,s,a,u;return n=this.attributes[t],r=n.itemSize,e=n.array,o=0,s=function(t){return e[o++]=t},u=function(t,n){return e[o++]=t,e[o++]=n},a=function(t,n,r){return e[o++]=t,e[o++]=n,e[o++]=r},i=function(t,n,r,i){return e[o++]=t,e[o++]=n,e[o++]=r,e[o++]=i},[null,s,u,a,i][r]},e.prototype._autochunk=function(){var t,e,n,r,i,o;n=this.attributes.index,o=this.attributes;for(r in o)if(e=o[r],"index"!==r&&n){i=e.array.length/e.itemSize,i>this.limit&&(this.chunked=!0);break}return this.chunked&&!n.u16?(n.u16=t=n.array,n.array=new Uint32Array(t.length)):void 0},e.prototype._finalize=function(){var t;if(this.chunked)return t=this.attributes.index,this.chunks=this._chunks(t.array,this.limit),this._chunkify(t,this.chunks),i?this.tock(this.constructor.name):void 0},e.prototype._chunks=function(t,e){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E;for(i=[],f=0,E=t[0],o=t[0],v=function(t){var e,n,r;return r=3*f,n=3*t,e=n-r,i.push({index:E,start:r,count:e,end:n})},d=Math.floor(t.length/3),m=0,s=a=0,g=d;g>=0?g>a:a>g;s=g>=0?++a:--a)u=t[m++],h=t[m++],l=t[m++],p=Math.min(u,h,l),c=Math.max(u,h,l),n=Math.min(E,p),r=Math.max(o,c),r-n>e&&(v(s),n=p,r=c,f=s),E=n,o=r;return v(d),i},e.prototype._chunkify=function(t,e){var n,r,i,o,s,a,u,h,l,c;if(t.u16){for(r=t.array,c=t.u16,o=0,a=e.length;a>o;o++)for(n=e[o],u=n.index,i=s=h=n.start,l=n.end;l>=h?l>s:s>l;i=l>=h?++s:--s)c[i]=r[i]-u;return t.array=t.u16,delete t.u16}},e.prototype._offsets=function(t){var e,n,r,i,o,s,a,u,h,l,c,p;if(this.chunked)for(i=this.chunks,c=this.offsets,c.length=null,s=0,u=t.length;u>s;s++)for(l=t[s],p=l.start,o=l.count-p,a=0,h=i.length;h>a;a++)r=i[a],n=r.start,e=r.end,(n>=p&&o>n||e>p&&o>=e||p>n&&e>o)&&(n=Math.max(p,n),e=Math.min(o,e),c.push({index:r.index,start:n,count:e-n}));else this.offsets=t;return null},e}(THREE.BufferGeometry),e.exports=r},{}],143:[function(t,e,n){n.Geometry=t("./geometry"),n.ArrowGeometry=t("./arrowgeometry"),n.FaceGeometry=t("./facegeometry"),n.LineGeometry=t("./linegeometry"),n.ScreenGeometry=t("./screengeometry"),n.SpriteGeometry=t("./spritegeometry"),n.StripGeometry=t("./stripgeometry"),n.SurfaceGeometry=t("./surfacegeometry")},{"./arrowgeometry":139,"./facegeometry":141,"./geometry":142,"./linegeometry":144,"./screengeometry":145,"./spritegeometry":146,"./stripgeometry":147,"./surfacegeometry":148}],144:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./clipgeometry"),i=function(t){function e(t){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V,I,j,G,W,q,X,Y,Z,K,Q,J,$,tt,et;for(e.__super__.constructor.call(this,t),this._clipUniforms(),this.closed=o=t.closed||!1,this.samples=I=(+t.samples||2)+(o?1:0),this.strips=W=+t.strips||1,this.ribbons=N=+t.ribbons||1,this.layers=v=+t.layers||1,this.detail=s=+t.detail||1,E=I-1,this.joints=f=s-1,this.vertices=K=(E-1)*f+I,this.segments=j=(E-1)*f+E,J=I-(o?1:0),x=K*W*N*v*2,H=j*W*N*v,X=2*H,this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(3*X),1)),this.addAttribute("position4",new THREE.BufferAttribute(new Float32Array(4*x),4)),this.addAttribute("line",new THREE.BufferAttribute(new Float32Array(2*x),2)),this.addAttribute("strip",new THREE.BufferAttribute(new Float32Array(2*x),2)),s>1&&this.addAttribute("joint",new THREE.BufferAttribute(new Float32Array(x),1)),this._autochunk(),l=this._emitter("index"),w=this._emitter("position4"),g=this._emitter("line"),G=this._emitter("strip"),s>1&&(p=this._emitter("joint")),i=0,h=_=0,S=N*v;S>=0?S>_:_>S;h=S>=0?++_:--_)for(c=b=0,k=W;k>=0?k>b:b>k;c=k>=0?++b:--b){for(d=T=0,P=j;P>=0?P>T:T>P;d=P>=0?++T:--T)l(i),l(i+1),l(i+2),l(i+2),l(i+1),l(i+3),i+=2;i+=2}if(u=o?function(){return 0}:function(t){return 0===t?-1:t===I-1?1:0},s>1)for(m=R=0,L=v;L>=0?L>R:R>L;m=L>=0?++R:--R)for(et=M=0,z=N;z>=0?z>M:M>z;et=z>=0?++M:--M)for(tt=V=0,O=W;O>=0?O>V:V>O;tt=O>=0?++V:--V)for($=q=0,D=I;D>=0?D>q:q>D;$=D>=0?++q:--q)if(o&&($%=J),a=u($),0!==a)w($,tt,et,m),w($,tt,et,m),g(a,1),g(a,-1),G(0,j),G(0,j),p(.5),p(.5);else for(y=Y=0,F=s;F>=0?F>Y:Y>F;y=F>=0?++Y:--Y)w($,tt,et,m),w($,tt,et,m),g(a,1),g(a,-1),G(0,j),G(0,j),p(y/f),p(y/f);else for(m=Z=0,U=v;U>=0?U>Z:Z>U;m=U>=0?++Z:--Z)for(et=Q=0,B=N;B>=0?B>Q:Q>B;et=B>=0?++Q:--Q)for(tt=n=0,A=W;A>=0?A>n:n>A;tt=A>=0?++n:--n)for($=r=0,C=I;C>=0?C>r:r>C;$=C>=0?++r:--r)o&&($%=J),a=u($),w($,tt,et,m),w($,tt,et,m),g(a,1),g(a,-1),G(0,j),G(0,j);this._finalize(),this.clip()}return o(e,t),e.prototype.clip=function(t,e,n,r){var i,o;return null==t&&(t=this.samples-this.closed),null==e&&(e=this.strips),null==n&&(n=this.ribbons),null==r&&(r=this.layers),i=Math.max(0,t-(this.closed?0:1)),o=t+(t-2)*this.joints,i=o-1,this._clipGeometry(o,e,n,r),this._clipOffsets(6,i,e,n,r,this.segments,this.strips,this.ribbons,this.layers)},e}(r),e.exports=i},{"./clipgeometry":140}],145:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;i=t("./surfacegeometry"),r=function(t){function e(t){var n,r;null==this.uniforms&&(this.uniforms={}),this.uniforms.geometryScale={type:"v4",value:new THREE.Vector4},t.width=Math.max(2,null!=(n=+t.width)?n:2),t.height=Math.max(2,null!=(r=+t.height)?r:2),this.cover(),e.__super__.constructor.call(this,t)}return o(e,t),e.prototype.cover=function(t,e,n,r){this.scaleX=null!=t?t:1,this.scaleY=null!=e?e:1,this.scaleZ=null!=n?n:1,this.scaleW=null!=r?r:1},e.prototype.clip=function(t,n,r,i){var o;return null==t&&(t=this.width),null==n&&(n=this.height),null==r&&(r=this.surfaces),null==i&&(i=this.layers),e.__super__.clip.call(this,t,n,r,i),o=function(t){return 1/Math.max(1,t-1)},this.uniforms.geometryScale.value.set(o(t)*this.scaleX,o(n)*this.scaleY,o(r)*this.scaleZ,o(i)*this.scaleW)},e}(i),e.exports=r},{"./surfacegeometry":148}],146:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./clipgeometry"),i=function(t){function e(t){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C;for(e.__super__.constructor.call(this,t),this._clipUniforms(),this.items=a=+t.items||2,this.width=S=+t.width||1,this.height=i=+t.height||1,this.depth=r=+t.depth||1,w=a*S*i*r,v=4*w,H=2*w,this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(3*H),1)),this.addAttribute("position4",new THREE.BufferAttribute(new Float32Array(4*v),4)),this.addAttribute("sprite",new THREE.BufferAttribute(new Float32Array(2*v),2)),this._autochunk(),s=this._emitter("index"),g=this._emitter("position4"),R=this._emitter("sprite"),E=[[-1,-1],[-1,1],[1,-1],[1,1]],n=0,o=u=0,y=w;y>=0?y>u:u>y;o=y>=0?++u:--u)s(n),s(n+1),s(n+2),s(n+1),s(n+2),s(n+3),n+=4;for(C=h=0,_=r;_>=0?_>h:h>_;C=_>=0?++h:--h)for(A=p=0,b=i;b>=0?b>p:p>b;A=b>=0?++p:--p)for(k=f=0,T=S;T>=0?T>f:f>T;k=T>=0?++f:--f)for(l=d=0,x=a;x>=0?x>d:d>x;l=x>=0?++d:--d)for(m=0,c=E.length;c>m;m++)M=E[m],g(k,A,C,l),R(M[0],M[1]);this._finalize(),this.clip()}return o(e,t),e.prototype.clip=function(t,e,n,r){return null==t&&(t=this.width),null==e&&(e=this.height),null==n&&(n=this.depth),null==r&&(r=this.items),this._clipGeometry(t,e,n,r),this._clipOffsets(6,t,e,n,r,this.width,this.height,this.depth,this.items)},e}(r),e.exports=i},{"./clipgeometry":140}],147:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./clipgeometry"),i=function(t){function e(t){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z;for(e.__super__.constructor.call(this,t),this._clipUniforms(),this.items=u=+t.items||2,this.width=C=+t.width||1,this.height=o=+t.height||1,this.depth=r=+t.depth||1,this.sides=S=Math.max(0,u-2),M=C*o*r,g=u*M,A=S*M,this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(3*A),1)),this.addAttribute("position4",new THREE.BufferAttribute(new Float32Array(4*g),4)),this.addAttribute("strip",new THREE.BufferAttribute(new Float32Array(3*g),3)),this._autochunk(),a=this._emitter("index"),E=this._emitter("position4"),k=this._emitter("strip"),n=0,s=l=0,b=M;b>=0?b>l:l>b;s=b>=0?++l:--l){for(m=n,h=f=0,T=S;T>=0?T>f:f>T;h=T>=0?++f:--f)1&h?(a(m+1),a(m),a(m+2)):(a(m),a(m+1),a(m+2)),m++;n+=u}for(p=u-1,z=d=0,x=r;x>=0?x>d:d>x;z=x>=0?++d:--d)for(L=v=0,w=o;w>=0?w>v:v>w;L=w>=0?++v:--v)for(P=y=0,R=C;R>=0?R>y:y>R;P=R>=0?++y:--y){for(i=1,E(P,L,z,0),k(1,2,i),c=_=1,H=p;H>=1?H>_:_>H;c=H>=1?++_:--_)E(P,L,z,c),k(c-1,c+1,i=-i);E(P,L,z,p),k(p-2,p-1,-i)}this._finalize(),this.clip()}return o(e,t),e.prototype.clip=function(t,e,n,r){var i;return null==t&&(t=this.width),null==e&&(e=this.height),null==n&&(n=this.depth),null==r&&(r=this.items),i=Math.max(0,r-2),this._clipGeometry(t,e,n,r),this._clipOffsets(3,t,e,n,i,this.width,this.height,this.depth,this.sides)},e}(r),e.exports=i},{"./clipgeometry":140}],148:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./clipgeometry"),i=function(t){function e(t){var n,r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V,I,j; +for(e.__super__.constructor.call(this,t),this._clipUniforms(),this.closedX=r=t.closedX||!1,this.closedY=i=t.closedY||!1,this.width=U=(+t.width||2)+(r?1:0),this.height=h=(+t.height||2)+(i?1:0),this.surfaces=D=+t.surfaces||1,this.layers=m=+t.layers||1,B=U-(r?1:0),N=h-(i?1:0),this.segmentsX=L=Math.max(0,U-1),this.segmentsY=z=Math.max(0,h-1),_=U*h*D*m,x=L*z*D*m,F=2*x,this.addAttribute("index",new THREE.BufferAttribute(new Uint16Array(3*F),1)),this.addAttribute("position4",new THREE.BufferAttribute(new Float32Array(4*_),4)),this.addAttribute("surface",new THREE.BufferAttribute(new Float32Array(2*_),2)),this._autochunk(),c=this._emitter("index"),b=this._emitter("position4"),O=this._emitter("surface"),n=0,l=v=0,R=D*m;R>=0?R>v:v>R;l=R>=0?++v:--v){for(p=g=0,H=z;H>=0?H>g:g>H;p=H>=0?++g:--g){for(f=E=0,M=L;M>=0?M>E:E>M;f=M>=0?++E:--E)c(n),c(n+1),c(n+U),c(n+U),c(n+1),c(n+U+1),n++;n++}n+=U}for(a=r?function(){return 0}:function(t){return 0===t?-1:t===L?1:0},u=i?function(){return 0}:function(t){return 0===t?-1:t===z?1:0},d=y=0,S=m;S>=0?S>y:y>S;d=S>=0?++y:--y)for(j=T=0,k=D;k>=0?k>T:T>k;j=k>=0?++T:--T)for(I=w=0,A=h;A>=0?A>w:w>A;I=A>=0?++w:--w)for(i&&(I%=N),s=u(I),V=P=0,C=U;C>=0?C>P:P>C;V=C>=0?++P:--P)r&&(V%=B),o=a(V),b(V,I,j,d),O(o,s);this._finalize(),this.clip()}return o(e,t),e.prototype.clip=function(t,e,n,r){var i,o;return null==t&&(t=this.width),null==e&&(e=this.height),null==n&&(n=this.surfaces),null==r&&(r=this.layers),i=Math.max(0,t-1),o=Math.max(0,e-1),this._clipGeometry(t,e,n,r),this._clipOffsets(6,i,o,n,r,this.segmentsX,this.segmentsY,this.surfaces,this.layers)},e.prototype.map=function(t,e,n,r){return null==t&&(t=this.width),null==e&&(e=this.height),null==n&&(n=this.surfaces),null==r&&(r=this.layers),this._clipMap(t,e,n,r)},e}(r),e.exports=i},{"./clipgeometry":140}],149:[function(t,e,n){n.Scene=t("./scene"),n.Factory=t("./factory"),n.Renderable=t("./scene"),n.Classes=t("./classes")},{"./classes":137,"./factory":138,"./scene":162}],150:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("./base"),i=t("../geometry").ArrowGeometry,r=function(t){function e(t,n,r){var o,s,a,u,h,l,c,p,f,d,m,v,g,E;e.__super__.constructor.call(this,t,n,r),g=r.uniforms,f=r.material,m=r.position,o=r.color,p=r.mask,c=r.map,s=r.combine,v=r.stpq,l=r.linear,null==g&&(g={}),h=null!=g.styleColor,this.geometry=new i({sides:r.sides,samples:r.samples,strips:r.strips,ribbons:r.ribbons,layers:r.layers,anchor:r.anchor,flip:r.flip}),this._adopt(g),this._adopt(this.geometry.uniforms),u=n.material(),E=u.vertex,E.pipe(this._vertexColor(o,p)),E.require(this._vertexPosition(m,f,c,1,v)),E.pipe("arrow.position",this.uniforms),E.pipe("project.position",this.uniforms),u.fragment=a=this._fragmentColor(h,f,o,p,c,1,v,s,l),a.pipe("fragment.color",this.uniforms),this.material=this._material(u.link({})),d=new THREE.Mesh(this.geometry,this.material),d.frustumCulled=!1,d.matrixAutoUpdate=!1,this._raw(d),this.renders=[d]}return s(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.renders=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(o),e.exports=r},{"../geometry":143,"./base":151}],151:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../renderable"),o=t("../../util"),r=function(t){function e(t,n,r){var i;e.__super__.constructor.call(this,t,n,r),this.zUnits=null!=(i=r.zUnits)?i:0}return s(e,t),e.prototype.raw=function(){var t,e,n,r;for(r=this.renders,t=0,e=r.length;e>t;t++)n=r[t],this._raw(n);return null},e.prototype.depth=function(t,e){var n,r,i,o;for(o=this.renders,n=0,r=o.length;r>n;n++)i=o[n],this._depth(i,t,e);return null},e.prototype.polygonOffset=function(t,e){var n,r,i,o;for(o=this.renders,n=0,r=o.length;r>n;n++)i=o[n],this._polygonOffset(i,t,e);return null},e.prototype.show=function(t,e,n){var r,i,o,s,a;for(s=this.renders,a=[],r=0,i=s.length;i>r;r++)o=s[r],a.push(this._show(o,t,e,n));return a},e.prototype.hide=function(){var t,e,n,r;for(r=this.renders,t=0,e=r.length;e>t;t++)n=r[t],this._hide(n);return null},e.prototype._material=function(t){var e,n,r,i,o,s,a,u;for(s=this.renderer.getPrecision(),u=" precision "+s+" float;\n precision "+s+" int;\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;",e=" precision "+s+" float;\n precision "+s+" int;\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;",o=new THREE.RawShaderMaterial(t),a=["vertexGraph","fragmentGraph"],n=0,i=a.length;i>n;n++)r=a[n],o[r]=t[r];return o.vertexShader=[u,o.vertexShader].join("\n"),o.fragmentShader=[e,o.fragmentShader].join("\n"),o},e.prototype._raw=function(t){return t.rotationAutoUpdate=!1,t.frustumCulled=!1,t.matrixAutoUpdate=!1,t.material.defaultAttributeValues=void 0},e.prototype._depth=function(t,e,n){var r;return r=t.material,r.depthWrite=e,r.depthTest=n},e.prototype._polygonOffset=function(t,e,n){var r,i;return n-=this.zUnits,r=0!==n,i=t.material,i.polygonOffset=r,r?(i.polygonOffsetFactor=e,i.polygonOffsetUnits=n):void 0},e.prototype._show=function(t,e,n,r){var i;return e=!0,i=t.material,t.renderOrder=-r,t.visible=!0,i.transparent=e,i.blending=n,null},e.prototype._hide=function(t){return t.visible=!1},e.prototype._vertexColor=function(t,e){var n;if(t||e)return n=this.shaders.shader(),t&&(n.require(t),n.pipe("mesh.vertex.color",this.uniforms)),e&&(n.require(e),n.pipe("mesh.vertex.mask",this.uniforms)),n},e.prototype._vertexPosition=function(t,e,n,r,i){var o,s;return s=this.shaders.shader(),(n||e&&e!==!0)&&(o={},(r>0||i)&&(o.POSITION_MAP=""),r>0&&(o[["POSITION_U","POSITION_UV","POSITION_UVW","POSITION_UVWO"][r-1]]=""),i&&(o.POSITION_STPQ="")),s.require(t),s.pipe("mesh.vertex.position",this.uniforms,o)},e.prototype._fragmentColor=function(t,e,n,r,i,s,a,u,h){var l,c,p,f;return c=this.shaders.shader(),f=!1,p=!1,l={},s>0&&(l[["POSITION_U","POSITION_UV","POSITION_UVW","POSITION_UVWO"][s-1]]=""),a&&(l.POSITION_STPQ=""),t&&(c.pipe("style.color",this.uniforms),f=!0,(n||i||e)&&((!h||n)&&c.pipe("mesh.gamma.in"),p=!0)),n&&(c.isolate(),c.pipe("mesh.fragment.color",this.uniforms),(!h||f)&&c.pipe("mesh.gamma.in"),c.end(),f&&c.pipe(o.GLSL.binaryOperator("vec4","*")),h&&f&&c.pipe("mesh.gamma.out"),f=!0,p=!0),i&&(!f&&u&&c.pipe(o.GLSL.constant("vec4","vec4(1.0)")),c.isolate(),c.require(i),c.pipe("mesh.fragment.map",this.uniforms,l),h||c.pipe("mesh.gamma.in"),c.end(),u?c.pipe(u):f&&c.pipe(o.GLSL.binaryOperator("vec4","*")),f=!0,p=!0),e&&(f||c.pipe(o.GLSL.constant("vec4","vec4(1.0)")),e===!0?c.pipe("mesh.fragment.shaded",this.uniforms):(c.require(e),c.pipe("mesh.fragment.material",this.uniforms,l)),p=!0),p&&!h&&c.pipe("mesh.gamma.out"),r&&(c.pipe("mesh.fragment.mask",this.uniforms),f&&c.pipe(o.GLSL.binaryOperator("vec4","*"))),c},e}(i),e.exports=r},{"../../util":175,"../renderable":161}],152:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./base"),i=function(t){function e(t,n,r){var i;e.__super__.constructor.call(this,t,n,r),this.geometry=new THREE.PlaneGeometry(1,1),this.material=new THREE.MeshBasicMaterial({map:r.map}),this.material.side=THREE.DoubleSide,i=new THREE.Mesh(this.geometry,this.material),i.position.x+=r.x||0,i.position.y+=r.y||0,i.frustumCulled=!1,i.scale.set(2,2,2),i.__debug=!0,this.objects=[i]}return o(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.objects=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"./base":151}],153:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./base"),o=t("../geometry").FaceGeometry,i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d,m,v,g,E;e.__super__.constructor.call(this,t,n,r),g=r.uniforms,f=r.material,m=r.position,i=r.color,p=r.mask,c=r.map,s=r.combine,v=r.stpq,l=r.linear,null==g&&(g={}),null==f&&(f=!0),h=null!=g.styleColor,this.geometry=new o({items:r.items,width:r.width,height:r.height,depth:r.depth}),this._adopt(g),this._adopt(this.geometry.uniforms),u=n.material(),E=u.vertex,E.pipe(this._vertexColor(i,p)),E.require(this._vertexPosition(m,f,c,2,v)),f||E.pipe("face.position",this.uniforms),f&&E.pipe("face.position.normal",this.uniforms),E.pipe("project.position",this.uniforms),u.fragment=a=this._fragmentColor(h,f,i,p,c,2,v,s,l),a.pipe("fragment.color",this.uniforms),this.material=this._material(u.link({side:THREE.DoubleSide})),d=new THREE.Mesh(this.geometry,this.material),this._raw(d),this.renders=[d]}return s(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.renders=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../geometry":143,"./base":151}],154:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./base"),o=t("../geometry").LineGeometry,i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R;e.__super__.constructor.call(this,t,n,r),w=r.uniforms,g=r.material,y=r.position,s=r.color,v=r.mask,m=r.map,a=r.combine,T=r.stpq,d=r.linear,i=r.clip,x=r.stroke,f=r.join,_=r.proximity,null==w&&(w={}),x=[null,"dotted","dashed"][x],p=null!=w.styleColor,f=null!=(b=["miter","round","bevel"][f])?b:"miter",h={miter:1,round:4,bevel:2}[f],this.geometry=new o({samples:r.samples,strips:r.strips,ribbons:r.ribbons,layers:r.layers,anchor:r.anchor,closed:r.closed,detail:h}),this._adopt(w),this._adopt(this.geometry.uniforms),c=n.material(),u={},x&&(u.LINE_STROKE=""),i&&(u.LINE_CLIP=""),null!=_&&(u.LINE_PROXIMITY=""),u["LINE_JOIN_"+f.toUpperCase()]="",h>1&&(u.LINE_JOIN_DETAIL=h),R=c.vertex,R.pipe(this._vertexColor(s,v)),R.require(this._vertexPosition(y,g,m,2,T)),R.pipe("line.position",this.uniforms,u),R.pipe("project.position",this.uniforms),l=c.fragment,x&&l.pipe("fragment.clip."+x,this.uniforms),i&&l.pipe("fragment.clip.ends",this.uniforms),null!=_&&l.pipe("fragment.clip.proximity",this.uniforms),l.pipe(this._fragmentColor(p,g,s,v,m,2,T,a,d)),l.pipe("fragment.color",this.uniforms),this.material=this._material(c.link({side:THREE.DoubleSide})),E=new THREE.Mesh(this.geometry,this.material),this._raw(E),this.renders=[E]}return s(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.renders=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../geometry":143,"./base":151}],155:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("./screen"),o=t("../../util"),r=function(t){function e(t,n,r){var i,o,s,a,u,h,l,c,p,f,d,m;for(this.memo=(h=r.items,m=r.width,o=r.height,i=r.depth,d=r.stpq,r),a=function(t){return 1/Math.max(1,t)},u=function(t){return 1/Math.max(1,t-1)},this.uniforms={remapUVScale:{type:"v2",value:new THREE.Vector2(h*m,o*i)},remapModulus:{type:"v2",value:new THREE.Vector2(h,o)},remapModulusInv:{type:"v2",value:new THREE.Vector2(a(h),a(o))},remapSTPQScale:{type:"v4",value:new THREE.Vector4(u(m),u(o),u(i),u(h))}},c=n.shader(),c.pipe("screen.map.xyzw",this.uniforms),null!=r.map&&(d&&c.pipe("screen.map.stpq",this.uniforms),c.pipe(r.map)),e.__super__.constructor.call(this,t,n,{map:c,linear:!0}),f=this.renders,s=0,l=f.length;l>s;s++)p=f[s],p.transparent=!1}return s(e,t),e.prototype.cover=function(t,e,n,r){var i,o,s;return null==t&&(t=this.memo.width),null==e&&(e=this.memo.height),null==n&&(n=this.memo.depth),null==r&&(r=this.memo.items),i=function(t){return 1/Math.max(1,t-1)},this.uniforms.remapSTPQScale.value.set(i(t),i(e),i(n),i(r)),o=t/this.memo.width,s=n/this.memo.depth,1===this.memo.depth&&(s=e/this.memo.height),this.geometry.cover(o,s)},e}(i),e.exports=r},{"../../util":175,"./screen":157}],156:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./base"),o=t("../geometry").SpriteGeometry,i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O;e.__super__.constructor.call(this,t,n,r),z=r.uniforms,_=r.material,w=r.position,u=r.color,P=r.size,y=r.mask,E=r.map,h=r.combine,g=r.linear,A=r.shape,b=r.optical,d=r.fill,L=r.stpq,null==z&&(z={}),A=null!=(R=+A)?R:0,null==d&&(d=!0),v=null!=z.styleColor,C=["circle","square","diamond","up","down","left","right"],x=["circle","generic","generic","generic","generic","generic","generic"],k=[1.2,1,1.414,1.16,1.16,1.16,1.16],T=null!=(H=x[A])?H:x[0],s=null!=(M=C[A])?M:C[0],i=null!=(S=b&&k[A])?S:1,a=d?T:T+".hollow",this.geometry=new o({items:r.items,width:r.width,height:r.height,depth:r.depth}),this._adopt(z),this._adopt(this.geometry.uniforms),l={POINT_SHAPE_SCALE:+(i+1e-5)},f=n.material(),O=f.vertex,O.pipe(this._vertexColor(u,y)),P?(O.isolate(),O.require(P),O.require("point.size.varying",this.uniforms),O.end()):O.require("point.size.uniform",this.uniforms),O.require(this._vertexPosition(w,_,E,2,L)),O.pipe("point.position",this.uniforms,l),O.pipe("project.position",this.uniforms),f.fragment=p=this._fragmentColor(v,_,u,y,E,2,L,h,g),c=n.material(),c.vertex.pipe(O),p=c.fragment.pipe(f.fragment),p.require("point.mask."+s,this.uniforms),p.require("point.alpha."+a,this.uniforms),p.pipe("point.edge",this.uniforms),m=n.material(),m.vertex.pipe(O),p=m.fragment.pipe(f.fragment),p.require("point.mask."+s,this.uniforms),p.require("point.alpha."+a,this.uniforms),p.pipe("point.fill",this.uniforms),this.fillMaterial=this._material(m.link({side:THREE.DoubleSide})),this.edgeMaterial=this._material(c.link({side:THREE.DoubleSide})),this.fillObject=new THREE.Mesh(this.geometry,this.fillMaterial),this.edgeObject=new THREE.Mesh(this.geometry,this.edgeMaterial),this._raw(this.fillObject),this._raw(this.edgeObject),this.renders=[this.fillObject,this.edgeObject]}return s(e,t),e.prototype.show=function(t,e,n,r){return this._show(this.edgeObject,!0,e,n,r),this._show(this.fillObject,t,e,n,r)},e.prototype.dispose=function(){return this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.renders=this.edgeObject=this.fillObject=this.geometry=this.edgeMaterial=this.fillMaterial=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../geometry":143,"./base":151}],157:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("./base"),o=t("../geometry").ScreenGeometry,s=t("../../util"),i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d;e.__super__.constructor.call(this,t,n,r),f=r.uniforms,l=r.map,i=r.combine,p=r.stpq,h=r.linear,null==f&&(f={}),u=null!=f.styleColor,this.geometry=new o({width:r.width,height:r.height}),this._adopt(f),this._adopt(this.geometry.uniforms),a=n.material(),d=a.vertex,d.pipe("raw.position.scale",this.uniforms),d.fan(),d.pipe("stpq.xyzw.2d",this.uniforms),d.next(),d.pipe("screen.position",this.uniforms),d.join(),a.fragment=s=this._fragmentColor(u,!1,null,null,l,2,p,i,h),s.pipe("fragment.color",this.uniforms),this.material=this._material(a.link({side:THREE.DoubleSide})),c=new THREE.Mesh(this.geometry,this.material),c.frustumCulled=!1,this._raw(c),this.renders=[c]}return a(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.renders=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../../util":175,"../geometry":143,"./base":151}],158:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./base"),o=t("../geometry").SpriteGeometry,i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_;e.__super__.constructor.call(this,t,n,r),y=r.uniforms,m=r.material,v=r.position,g=r.sprite,f=r.map,s=r.combine,p=r.linear,i=r.color,d=r.mask,E=r.stpq,null==y&&(y={}),c=null!=y.styleColor,this.geometry=new o({items:r.items,width:r.width,height:r.height,depth:r.depth}),this._adopt(y),this._adopt(this.geometry.uniforms),h=n.material(),_=h.vertex,_.pipe(this._vertexColor(i,d)),_.require(this._vertexPosition(v,m,f,2,E)),_.require(g),_.pipe("sprite.position",this.uniforms),_.pipe("project.position",this.uniforms),h.fragment=u=this._fragmentColor(c,m,i,d,f,2,E,s,p),a=n.material(),a.vertex.pipe(_),a.fragment.pipe(u),a.fragment.pipe("fragment.transparent",this.uniforms),l=n.material(),l.vertex.pipe(_),l.fragment.pipe(u),l.fragment.pipe("fragment.solid",this.uniforms),this.fillMaterial=this._material(l.link({side:THREE.DoubleSide})),this.edgeMaterial=this._material(a.link({side:THREE.DoubleSide})),this.fillObject=new THREE.Mesh(this.geometry,this.fillMaterial),this.edgeObject=new THREE.Mesh(this.geometry,this.edgeMaterial),this._raw(this.fillObject),this._raw(this.edgeObject),this.renders=[this.fillObject,this.edgeObject]}return s(e,t),e.prototype.show=function(t,e,n,r){return this._show(this.edgeObject,!0,e,n,r),this._show(this.fillObject,t,e,n,r)},e.prototype.dispose=function(){return this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.nreders=this.geometry=this.edgeMaterial=this.fillMaterial=this.edgeObject=this.fillObject=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../geometry":143,"./base":151}],159:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./base"),o=t("../geometry").StripGeometry,i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d,m,v,g,E;e.__super__.constructor.call(this,t,n,r),g=r.uniforms,f=r.material,m=r.position,i=r.color,p=r.mask,c=r.map,s=r.combine,l=r.linear,v=r.stpq,null==g&&(g={}),null==f&&(f=!0),h=null!=g.styleColor,this.geometry=new o({items:r.items,width:r.width,height:r.height,depth:r.depth}),this._adopt(g),this._adopt(this.geometry.uniforms),u=n.material(),E=u.vertex,E.pipe(this._vertexColor(i,p)),E.require(this._vertexPosition(m,f,c,2,v)),f||E.pipe("mesh.position",this.uniforms),f&&E.pipe("strip.position.normal",this.uniforms),E.pipe("project.position",this.uniforms),u.fragment=a=this._fragmentColor(h,f,i,p,c,2,v,s,l),a.pipe("fragment.color",this.uniforms),this.material=this._material(u.link({side:THREE.DoubleSide})),d=new THREE.Mesh(this.geometry,this.material),this._raw(d),this.renders=[d]}return s(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.renders=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../geometry":143,"./base":151}],160:[function(t,e,n){var r,i,o,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("./base"),o=t("../geometry").SurfaceGeometry,s=t("../../util"),i=function(t){function e(t,n,r){var i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;e.__super__.constructor.call(this,t,n,r),_=r.uniforms,v=r.material,E=r.position,i=r.color,m=r.mask,d=r.map,s=r.combine,f=r.linear,y=r.stpq,p=r.intUV,null==_&&(_={}),null==v&&(v=!0),c=null!=_.styleColor,l=null!=_.surfaceHollow,this.geometry=new o({width:r.width,height:r.height,surfaces:r.surfaces,layers:r.layers,closedX:r.closedX,closedY:r.closedY}),this._adopt(_),this._adopt(this.geometry.uniforms),h=n.material(),b=h.vertex,p&&(a={POSITION_UV_INT:""}),b.pipe(this._vertexColor(i,m)),b.require(this._vertexPosition(E,v,d,2,y)),v||b.pipe("surface.position",this.uniforms,a),v&&b.pipe("surface.position.normal",this.uniforms,a),b.pipe("project.position",this.uniforms),h.fragment=u=this._fragmentColor(c,v,i,m,d,2,y,s,f),u.pipe("fragment.color",this.uniforms),this.material=this._material(h.link({side:THREE.DoubleSide})),g=new THREE.Mesh(this.geometry,this.material),this._raw(g),this.renders=[g]}return a(e,t),e.prototype.dispose=function(){return this.geometry.dispose(),this.material.dispose(),this.renders=this.geometry=this.material=null,e.__super__.dispose.apply(this,arguments)},e}(r),e.exports=i},{"../../util":175,"../geometry":143,"./base":151}],161:[function(t,e,n){var r;r=function(){function t(t,e){this.renderer=t,this.shaders=e,this.gl=this.renderer.context,null==this.uniforms&&(this.uniforms={})}return t.prototype.dispose=function(){return this.uniforms=null},t.prototype._adopt=function(t){var e,n;for(e in t)n=t[e],this.uniforms[e]=n},t.prototype._set=function(t){var e,n;for(e in t)n=t[e],null!=this.uniforms[e]&&(this.uniforms[e].value=n)},t}(),e.exports=r},{}],162:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i=t("./renderable"),r=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.rotationAutoUpdate=!1,this.frustumCulled=!1,this.matrixAutoUpdate=!1}return s(e,t),e}(THREE.Object3D),o=function(t){function e(t,n,i){e.__super__.constructor.call(this,t,n,i),this.root=new r,null!=(null!=i?i.scene:void 0)&&(this.scene=i.scene),null==this.scene&&(this.scene=new THREE.Scene),this.pending=[],this.async=0,this.scratch=new THREE.WebGLRenderTarget(1,1),this.camera=new THREE.PerspectiveCamera}return s(e,t),e.prototype.inject=function(t){return null!=t&&(this.scene=t),this.scene.add(this.root)},e.prototype.unject=function(){var t;return null!=(t=this.scene)?t.remove(this.root):void 0},e.prototype.add=function(t){return this.async?this.pending.push(t):this._add(t)},e.prototype.remove=function(t){return this.pending=this.pending.filter(function(e){return e!==t}),null!=t.parent?this._remove(t):void 0},e.prototype._add=function(t){return this.root.add(t)},e.prototype._remove=function(t){return this.root.remove(t)},e.prototype.dispose=function(){return null!=this.root.parent?this.unject():void 0},e.prototype.warmup=function(t){return this.async=+t||0},e.prototype.render=function(){var t,e,n,r,i,o,s;if(this.pending.length){for(e=this.root.children,t=[],n=r=0,o=this.async;(o>=0?o>r:r>o)&&(i=this.pending.shift(),i);n=o>=0?++r:--r)this._add(i),t.push(t);return s=e.map(function(t){var e;return e=t.visible}),e.map(function(e){return e.visible=u.call(t,e)<0}),this.renderer.render(this.scene,this.camera,this.scratch),e.map(function(t,e){return t.visible=s[e]})}},e.prototype.toJSON=function(){return this.root.toJSON()},e}(i),e.exports=o},{"./renderable":161}],163:[function(t,e,n){var r,i;i=t("../../vendor/shadergraph/src"),r=function(t){var e;return e=function(e){var n,r,i,o,s;if(o=t[e],null!=o)return o;if(r="#"===(i=e[0])||"."===i||":"===i||"["===i,s=r?e:"#"+e,n=document.querySelector(s),null!=n&&"SCRIPT"===n.tagName)return n.textContent||n.innerText;throw new Error("Unknown shader `"+e+"`")},new i(e,{autoInspect:!0})},e.exports=r},{"../../vendor/shadergraph/src":208}],164:[function(t,e,n){n.Factory=t("./factory"),n.Snippets=t("../../build/shaders")},{"../../build/shaders":1,"./factory":163}],165:[function(t,e,n){THREE.Bootstrap.registerPlugin("splash",{defaults:{color:"mono",fancy:!0},listen:["ready","mathbox/init:init","mathbox/progress:progress","mathbox/destroy:destroy"],uninstall:function(){return this.destroy()},ready:function(t,e){return e.MathBox&&!this.div?init(t,e):void 0},init:function(t,e){var n,r,i,o,s,a,u;return this.destroy(),n=this.options.color,i='
\n \n
\n
',this.div=r=document.createElement("div"),r.innerHTML=i,e.element.appendChild(r),s=2*Math.random()-1,a=2*Math.random()-1,u=2*Math.random()-1,o=1/Math.sqrt(s*s+a*a+u*u),this.loader=r.querySelector(".mathbox-loader"),this.bar=r.querySelector(".mathbox-progress > div"),this.gyro=r.querySelectorAll(".mathbox-logo > div"),this.transforms=["rotateZ(22deg) rotateX(24deg) rotateY(30deg)","rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(.6, .6, .6)"],this.random=[s*o,a*o,u*o],this.start=e.Time.now,this.timer=null},progress:function(t,e){var n,r,i,o,s,a,u,h,l,c,p,f,d,m;if(this.div&&(n=t.current,p=t.total,f=p>n,clearTimeout(this.timer),f?(this.loader.classList.remove("mathbox-exit"),this.loader.style.display="block"):(this.loader.classList.add("mathbox-exit"),this.timer=setTimeout(function(t){return function(){return t.loader.style.display="none"}}(this),150)),m=p>n?.1*Math.round(1e3*n/p)+"%":"100%",this.bar.style.width=m,this.options.fancy)){for(d=this.random,i=Math.max(0,Math.min(1,e.Time.now-this.start)),s=function(t,n){return null==n&&(n=0),t.replace(/(-?[0-9.e]+)deg/g,function(t,r){return+r+d[n++]*i*e.Time.step*60+"deg"})},h=this.gyro,l=[],o=a=0,u=h.length;u>a;o=++a)r=h[o],this.transforms[o]=c=s(this.transforms[o]),l.push(r.style.transform=r.style.WebkitTransform=c);return l}},destroy:function(){var t;return null!=(t=this.div)&&t.remove(),this.div=null}})},{}],166:[function(t,e,n){var r,i,o;o=t("../util").Ease,i=function(){function t(t){this.context=t,this.anims=[]}return t.prototype.make=function(t,e){var n;return n=new r(this,this.context.time,t,e),this.anims.push(n),n},t.prototype.unmake=function(t){var e;return this.anims=function(){var n,r,i,o;for(i=this.anims,o=[],n=0,r=i.length;r>n;n++)e=i[n],e!==t&&o.push(e);return o}.call(this)},t.prototype.update=function(){var t,e;return e=this.context.time,this.anims=function(){var n,r,i,o;for(i=this.anims,o=[],n=0,r=i.length;r>n;n++)t=i[n],t.update(e)!==!1&&o.push(t);return o}.call(this)},t.prototype.lerp=function(t,e,n,r,i){var o,s,a,u;if(null==i&&(i=t.make()),t.lerp)i=t.lerp(e,n,i,r);else if(t.emitter){if(s=e.emitterFrom,u=n.emitterTo,null!=s&&null!=u&&s===u)return s.lerp(r),s;o=t.emitter(e,n),e.emitterFrom=o,n.emitterTo=o}else t.op?(a=function(t,e){return t===+t&&e===+e?t+(e-t)*r:r>.5?e:t},i=t.op(e,n,i,a)):i=r>.5?n:e;return i},t}(),r=function(){function t(t,e,n,r){this.animator=t,this.time=e,this.type=n,this.options=r,this.value=this.type.make(),this.target=this.type.make(),this.queue=[]}return t.prototype.dispose=function(){return this.animator.unmake(this)},t.prototype.set=function(){var t,e,n;return e=this.target,n=arguments.length>1?[].slice.call(arguments):arguments[0],t=!1,n=this.type.validate(n,e,function(){return t=!0}),t||(e=n),this.cancel(),this.target=this.value,this.value=e,this.notify()},t.prototype.getTime=function(){var t,e;return t=this.options.clock,e=t?t.getTime():this.time,this.options.realtime?e.time:e.clock},t.prototype.cancel=function(t){var e,n,r,i,o,s;for(null==t&&(t=this.getTime()),o=this.queue,n=function(){var e,n,r;for(r=[],e=0,n=o.length;n>e;e++)s=o[e],s.end>=t&&r.push(s);return r}(),this.queue=function(){var e,n,r;for(r=[],e=0,n=o.length;n>e;e++)s=o[e],s.endr;r++)s=n[r],"function"==typeof s.complete&&s.complete(!1);"function"==typeof(e=this.options).complete&&e.complete(!1)},t.prototype.notify=function(){var t;return"function"==typeof(t=this.options).step?t.step(this.value):void 0},t.prototype.immediate=function(t,e){var n,r,i,o,s,a,u,h,l,c;return i=e.duration,r=e.delay,o=e.ease,h=e.step,n=e.complete,c=this.getTime(),u=c+r,s=u+i,a=!1,l=this.type.make(),t=this.type.validate(t,l,function(){return a=!0,null}),void 0!==t&&(l=t),this.cancel(u),this.queue.push({from:null,to:l,start:u,end:s,ease:o,step:h,complete:n})},t.prototype.update=function(t){var e,n,r,i,s,a,u,h,l,c,p,f,d,m,v,g;if(this.time=t,0===this.queue.length)return!0;for(r=this.getTime(),g=this.value,c=this.queue,e=!1;!e;){if(p=f=c[0],h=p.from,v=p.to,d=p.start,a=p.end,m=p.step,i=p.complete,s=p.ease,null==h&&(h=f.from=this.type.clone(this.value)),u=o.clamp((r-d)/Math.max(1e-5,a-d)||0,0,1),0===u)return;if(l=function(){switch(s){case"linear":case 0:return null;case"cosine":case 1:return o.cosine;case"binary":case 2:return o.binary;case"hold":case 3:return o.hold;default:return o.cosine}}(),null!=l&&(u=l(u)),e=1>u,g=e?this.animator.lerp(this.type,h,v,u,g):v,"function"==typeof m&&m(g),!e&&("function"==typeof i&&i(!0),"function"==typeof(n=this.options).complete&&n.complete(!0),c.shift(),0===c.length))break}return this.value=g,this.notify()},t}(),e.exports=i},{"../util":175}],167:[function(t,e,n){var r,i;i=t("../util"),r=function(){function t(t,e,n){var r,i,o,s,a,u,h,l,c,p;for(this._context=t,this._up=e,this._targets=n,l=this._context.controller.getRoot(),null==this._targets&&(this._targets=[l]),this.isRoot=1===this._targets.length&&this._targets[0]===l,this.isLeaf=1===this._targets.length&&null==this._targets[0].children,u=this._targets,r=i=0,s=u.length;s>i;r=++i)c=u[r],this[r]=c;for(this.length=this._targets.length,h=this._context.controller.getTypes(),o=0,a=h.length;a>o;o++)p=h[o],"root"!==p&&!function(t){return function(e){return t[e]=function(n,r){return t.add(e,n,r)}}}(this)(p)}return t.prototype.v2=function(){return this},t.prototype.select=function(t){var e;return e=this._context.model.select(t,this.isRoot?null:this._targets),this._push(e)},t.prototype.eq=function(t){return this._targets.length>t?this._push([this._targets[t]]):this._push([])},t.prototype.filter=function(t){var e;return"string"==typeof t&&(e=this._context.model._matcher(t),t=function(t){return e(t)}),this._push(this._targets.filter(t))},t.prototype.map=function(t){var e,n,r,i;for(i=[],e=n=0,r=this.length;r>=0?r>n:n>r;e=r>=0?++n:--n)i.push(t(this[e],e,this));return i},t.prototype.each=function(t){var e,n,r;for(e=n=0,r=this.length;r>=0?r>n:n>r;e=r>=0?++n:--n)t(this[e],e,this);return this},t.prototype.add=function(t,e,n){var r,i,o,s,a,u,h;if(r=this._context.controller,this.isLeaf)return this._pop().add(t,e,n);for(a=[],u=this._targets,i=0,o=u.length;o>i;i++)h=u[i],s=r.make(t,e,n),r.add(s,h),a.push(s);return this._push(a)},t.prototype.remove=function(t){var e,n,r,i;if(t)return this.select(t).remove();for(r=this._targets.slice().reverse(),e=0,n=r.length;n>e;e++)i=r[e],this._context.controller.remove(i);return this._pop()},t.prototype.set=function(t,e){var n,r,i,o;for(i=this._targets,n=0,r=i.length;r>n;n++)o=i[n],this._context.controller.set(o,t,e);return this},t.prototype.getAll=function(t){var e,n,r,i,o;for(r=this._targets,i=[],e=0,n=r.length;n>e;e++)o=r[e],i.push(this._context.controller.get(o,t));return i},t.prototype.get=function(t){var e;return null!=(e=this._targets[0])?e.get(t):void 0},t.prototype.evaluate=function(t,e){var n;return null!=(n=this._targets[0])?n.evaluate(t,e):void 0},t.prototype.bind=function(t,e){var n,r,i,o;for(i=this._targets,n=0,r=i.length;r>n;n++)o=i[n],this._context.controller.bind(o,t,e);return this},t.prototype.unbind=function(t){var e,n,r,i;for(r=this._targets,e=0,n=r.length;n>e;e++)i=r[e],this._context.controller.unbind(i,t);return this},t.prototype.end=function(){return(this.isLeaf?this._pop():this)._pop()},t.prototype._push=function(e){return new t(this._context,this,e); +},t.prototype._pop=function(){var t;return null!=(t=this._up)?t:this},t.prototype._reset=function(){var t,e;return null!=(t=null!=(e=this._up)?e.reset():void 0)?t:this},t.prototype.map=function(t){return this._targets.map(t)},t.prototype.on=function(){var t;return t=arguments,this._targets.map(function(e){return e.on.apply(e,t)}),this},t.prototype.off=function(){var t;return t=arguments,this._targets.map(function(e){return e.on.apply(e,t)}),this},t.prototype.toString=function(){var t;return t=this._targets.map(function(t){return t.toString()}),this._targets.length>1?"["+t.join(", ")+"]":t[0]},t.prototype.toMarkup=function(){var t;return t=this._targets.map(function(t){return t.toMarkup()}),t.join("\n\n")},t.prototype.print=function(){return i.Pretty.print(this._targets.map(function(t){return t.toMarkup()}).join("\n\n")),this},t.prototype.debug=function(){var t,e,n,r,i,o,s,a;for(e=this.inspect(),console.log("Renderables: ",e.renderables),console.log("Renders: ",e.renders),console.log("Shaders: ",e.shaders),t=function(t){return t.constructor.toString().match("function +([^(]*)")[1]},a=[],o=e.shaders,n=0,r=o.length;r>n;n++)s=o[n],i=t(s.owner),a.push(i+" - Vertex"),a.push(s.vertex),a.push(i+" - Fragment"),a.push(s.fragment);return ShaderGraph.inspect(a)},t.prototype.inspect=function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m;for("boolean"==typeof e&&(n=e,e=null),null==n&&(n=!0),l=function(t){var e,n;return null!=(e=null!=(n=t.controller)?n.objects:void 0)?e:[]},c=d=function(t,n){var r,i,o,s;if(null==n&&(n=[]),(!e||t.traits.hash[e])&&n.push(l(t)),null!=t.children)for(s=t.children,i=0,o=s.length;o>i;i++)r=s[i],d(r,n);return n},i=function(t){return t=t.reduce(function(t,e){return t.concat(e)},[]),t=t.filter(function(e,n){return null!=e&&t.indexOf(e)===n})},h=function(t,e){var n;return n={},n.owner=t,n.geometry=e.geometry,n.material=e.material,n.vertex=e.material.vertexGraph,n.fragment=e.material.fragmentGraph,n},o={nodes:this._targets.slice(),renderables:[],renders:[],shaders:[]},p=this._targets,s=0,u=p.length;u>s;s++){m=p[s],n&&m.print(t,"info"),r={renderables:f=i(c(m)),renders:i(f.map(function(t){return t.renders})),shaders:i(f.map(function(t){var e;return null!=(e=t.renders)?e.map(function(e){return h(t,e)}):void 0}))};for(a in r)o[a]=o[a].concat(r[a])}return o},t}(),e.exports=r},{"../util":175}],168:[function(t,e,n){var r,i;i=t("../util"),r=function(){function t(t,e){this.model=t,this.primitives=e}return t.prototype.getRoot=function(){return this.model.getRoot()},t.prototype.getTypes=function(){return this.primitives.getTypes()},t.prototype.make=function(t,e,n){return this.primitives.make(t,e,n)},t.prototype.get=function(t,e){return t.get(e)},t.prototype.set=function(t,e,n){var r,i;try{return t.set(e,n)}catch(i){return r=i,t.print(null,"warn"),console.error(r)}},t.prototype.bind=function(t,e,n){var r,i;try{return t.bind(e,n)}catch(i){return r=i,t.print(null,"warn"),console.error(r)}},t.prototype.unbind=function(t,e){var n,r;try{return t.unbind(e)}catch(r){return n=r,t.print(null,"warn"),console.error(n)}},t.prototype.add=function(t,e){return null==e&&(e=this.model.getRoot()),e.add(t)},t.prototype.remove=function(t){var e;return e=t.parent,e?e.remove(t):void 0},t}(),e.exports=r},{"../util":175}],169:[function(t,e,n){n.Animator=t("./animator"),n.API=t("./api"),n.Controller=t("./controller")},{"./animator":166,"./api":167,"./controller":168}],170:[function(t,e,n){var r=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};n.setOrigin=function(t,e,n){var i,o,s,a;return+e===e&&(e=[e]),o=r.call(e,1)>=0?0:n.x,s=r.call(e,2)>=0?0:n.y,a=r.call(e,3)>=0?0:n.z,i=r.call(e,4)>=0?0:n.w,t.set(o,s,a,i)},n.addOrigin=function(){var t;return t=new THREE.Vector4,function(e,r,i){return n.setOrigin(t,r,i),e.add(t)}}(),n.setDimension=function(t,e){var n,r,i,o;return r=1===e?1:0,i=2===e?1:0,o=3===e?1:0,n=4===e?1:0,t.set(r,i,o,n)},n.setDimensionNormal=function(t,e){var n,r,i,o;return r=1===e?1:0,i=2===e?1:0,o=3===e?1:0,n=4===e?1:0,t.set(i,o+r,n,0)},n.recenterAxis=function(){var t;return t=[0,0],function(e,n,r,i){var o,s,a,u,h,l;return null==i&&(i=0),r>0&&(h=e,l=e+n,o=Math.max(Math.abs(h),Math.abs(l)),s=o*i,u=Math.min(h,l),a=Math.max(h,l),e=u+(-o+s-u)*r,n=a+(o+s-a)*r-e),t[0]=e,t[1]=n,t}}()},{}],171:[function(t,e,n){e.exports=self={bind:function(t,e){return function(n,r){r.__binds||(r.__binds=[]);var i=t;_.isArray(n)&&(i=n[0],n=n[1]);for(var o=/^([^.:]*(?:\.[^.:]+)*)?(?:\:(.*))?$/.exec(n),s=o[1].split(/\./g),a=s.pop(),u=o[2]||a,h=s.shift(),l={"this":r}[h]||e[h]||t[h]||i;l&&(n=s.shift());)l=l[n];if(l&&(l.on||l.addEventListener)){var c=function(e){r[u]&&r[u](e,t)};self._polyfill(l,["addEventListener","on"],function(t){l[t](a,c)});var p={target:l,name:a,callback:c};return r.__binds.push(p),c}throw"Cannot bind '"+n+"' in "+this.__name}},unbind:function(){return function(t){t.__binds&&(t.__binds.forEach(function(t){self._polyfill(t.target,["removeEventListener","off"],function(e){t.target[e](t.name,t.callback)})}.bind(this)),t.__binds=[])}},apply:function(t){THREE.EventDispatcher.prototype.apply(t),t.trigger=self._trigger,t.triggerOnce=self._triggerOnce,t.on=t.addEventListener,t.off=t.removeEventListener,t.dispatchEvent=t.trigger},_triggerOnce:function(t){this.trigger(t),this._listeners&&delete this._listeners[t.type]},_trigger:function(t){if(void 0!==this._listeners){var e=t.type,n=this._listeners[e];if(void 0!==n){n=n.slice();var r=n.length;t.target=this;for(var i=0;r>i;i++)n[i].call(this,t,this)}}},_polyfill:function(t,e,n){e.map(function(e){return t.method}),e.length&&n(e[0])}}},{}],172:[function(t,e,n){var r;n.getSizes=r=function(t){var e,n;for(n=[],e=t;"string"!=typeof e&&null!=(null!=e?e.length:void 0);)n.push(e.length),e=e[0];return n},n.getDimensions=function(t,e){var n,i,o,s,a,u,h,l,c,p,f,d,m,v,g;return null==e&&(e={}),a=e.items,n=e.channels,g=e.width,s=e.height,i=e.depth,o={},t&&t.length?(v=r(t),l=v.length,o.channels=1!==n&&v.length>1?v.pop():n,o.items=1!==a&&v.length>1?v.pop():a,o.width=1!==g&&v.length>1?v.pop():g,o.height=1!==s&&v.length>1?v.pop():s,o.depth=1!==i&&v.length>1?v.pop():i,u=l,1===n&&u++,1===a&&u>1&&u++,1===g&&u>2&&u++,1===s&&u>3&&u++,h=null!=(c=v.pop())?c:1,1>=u&&(h/=null!=(p=o.channels)?p:1),2>=u&&(h/=null!=(f=o.items)?f:1),3>=u&&(h/=null!=(d=o.width)?d:1),4>=u&&(h/=null!=(m=o.height)?m:1),h=Math.floor(h),null==o.width&&(o.width=h,h=1),null==o.height&&(o.height=h,h=1),null==o.depth&&(o.depth=h,h=1),o):{items:a,channels:n,width:null!=g?g:0,height:null!=s?s:0,depth:null!=i?i:0}},n.repeatCall=function(t,e){switch(e){case 0:return function(){return!0};case 1:return function(){return t()};case 2:return function(){return t(),t()};case 3:return function(){return t(),t(),t(),t()};case 4:return function(){return t(),t(),t(),t()};case 6:return function(){return t(),t(),t(),t(),t(),t()};case 8:return function(){return t(),t(),t(),t(),t(),t()}}},n.makeEmitter=function(t,e,n){var r,i,o,s;for(r=function(){switch(n){case 0:return function(){return!0};case 1:return function(e){return e(t())};case 2:return function(e){return e(t(),t())};case 3:return function(e){return e(t(),t(),t())};case 4:return function(e){return e(t(),t(),t(),t())};case 6:return function(e){return e(t(),t(),t(),t(),t(),t())};case 8:return function(e){return e(t(),t(),t(),t(),t(),t(),t(),t())}}}(),o=null;e>0;)i=Math.min(e,8),s=function(){switch(i){case 1:return function(t){return r(t)};case 2:return function(t){return r(t),r(t)};case 3:return function(t){return r(t),r(t),r(t)};case 4:return function(t){return r(t),r(t),r(t),r(t)};case 5:return function(t){return r(t),r(t),r(t),r(t),r(t)};case 6:return function(t){return r(t),r(t),r(t),r(t),r(t),r(t)};case 7:return function(t){return r(t),r(t),r(t),r(t),r(t),r(t),r(t)};case 8:return function(t){return r(t),r(t),r(t),r(t),r(t),r(t),r(t),r(t)}}}(),o=null!=o?function(t,e){return function(n){return t(n),e(n)}}(s,o):s,e-=i;return s=null!=o?o:function(){return!0},s.reset=t.reset,s.rebind=t.rebind,s},n.getThunk=function(t){var e,n,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S;switch(H=r(t),d=H.length,e=H.pop(),n=H.pop(),i=H.pop(),o=H.pop(),s=!1,d){case 0:S=function(){return 0},S.reset=function(){};break;case 1:h=0,S=function(){return t[h++]},S.reset=function(){return h=0};break;case 2:h=l=0,a=null!=(m=t[l])?m:[],S=function(){var n,r;return r=a[h++],h===e&&(h=0,l++,a=null!=(n=t[l])?n:[]),r},S.reset=function(){var e;h=l=0,a=null!=(e=t[l])?e:[]};break;case 3:h=l=c=0,R=null!=(v=t[c])?v:[],a=null!=(g=R[l])?g:[],S=function(){var r,i,o;return o=a[h++],h===e&&(h=0,l++,l===n&&(l=0,c++,R=null!=(r=t[c])?r:[]),a=null!=(i=R[l])?i:[]),o},S.reset=function(){var e,n;h=l=c=0,R=null!=(e=t[c])?e:[],a=null!=(n=R[l])?n:[]};break;case 4:h=l=c=p=0,M=null!=(E=t[p])?E:[],R=null!=(y=M[c])?y:[],a=null!=(_=R[l])?_:[],S=function(){var r,o,s,u;return u=a[h++],h===e&&(h=0,l++,l===n&&(l=0,c++,c===i&&(c=0,p++,M=null!=(r=t[p])?r:[]),R=null!=(o=M[c])?o:[]),a=null!=(s=R[l])?s:[]),u},S.reset=function(){var e,n,r;h=l=c=p=0,M=null!=(e=t[p])?e:[],R=null!=(n=M[c])?n:[],a=null!=(r=R[l])?r:[]};break;case 5:h=l=c=p=f=0,u=null!=(b=t[f])?b:[],M=null!=(T=u[p])?T:[],R=null!=(x=M[c])?x:[],a=null!=(w=R[l])?w:[],S=function(){var r,s,d,m,v;return v=a[h++],h===e&&(h=0,l++,l===n&&(l=0,c++,c===i&&(c=0,p++,p===o&&(p=0,f++,u=null!=(r=t[f])?r:[]),M=null!=(s=u[p])?s:[]),R=null!=(d=M[c])?d:[]),a=null!=(m=R[l])?m:[]),v},S.reset=function(){var e,n,r,i;h=l=c=p=f=0,u=null!=(e=t[f])?e:[],M=null!=(n=u[p])?n:[],R=null!=(r=M[c])?r:[],a=null!=(i=R[l])?i:[]}}return S.rebind=function(o){return t=o,H=r(t),H.length&&(e=H.pop()),H.length&&(n=H.pop()),H.length&&(i=H.pop()),H.length?o=H.pop():void 0},S},n.getStreamer=function(t,e,n,r){var i,o,s,a,u,h,l,c,p;return l=u=h=0,c=function(){return l=e*n*r,u=h=0},o=function(){return h},s=function(){return 0>=l-u},p=function(){switch(n){case 1:return function(t){u+=t,h+=t};case 2:return function(t){u+=2*t,h+=t};case 3:return function(t){u+=3*t,h+=t};case 4:return function(t){u+=4*t,h+=t}}}(),i=function(){switch(n){case 1:return function(e){e(t[u++]),++h};case 2:return function(e){e(t[u++],t[u++]),++h};case 3:return function(e){e(t[u++],t[u++],t[u++]),++h};case 4:return function(e){e(t[u++],t[u++],t[u++],t[u++]),++h}}}(),a=function(){switch(n){case 1:return function(e){t[u++]=e,++h};case 2:return function(e,n){t[u++]=e,t[u++]=n,++h};case 3:return function(e,n,r){t[u++]=e,t[u++]=n,t[u++]=r,++h};case 4:return function(e,n,r,i){t[u++]=e,t[u++]=n,t[u++]=r,t[u++]=i,++h}}}(),i.reset=c,a.reset=c,c(),{emit:a,consume:i,skip:p,count:o,done:s,reset:c}},n.getLerpEmitter=function(t,e){var n,r,i,o,s,a,u,h,l,c,p;return p=new Float32Array(4096),s=a=.5,u=h=l=c=0,r=function(t,e,n,r){return l++,p[u++]=t*s,p[u++]=e*s,p[u++]=n*s,p[u++]=r*s},i=function(t,e,n,r){return c++,p[h++]+=t*a,p[h++]+=e*a,p[h++]+=n*a,p[h++]+=r*a},n=Math.max(t.length,e.length),o=3>=n?function(n,o,s){var a,f,d,m,v,g;for(u=h=l=c=0,t(r,o,s),e(i,o,s),d=Math.min(l,c),f=0,g=[],a=m=0,v=d;v>=0?v>m:m>v;a=v>=0?++m:--m)g.push(n(p[f++],p[f++],p[f++],p[f++]));return g}:5>=n?function(n,o,s,a,f){var d,m,v,g,E,y;for(u=h=l=c=0,t(r,o,s,a,f),e(i,o,s,a,f),v=Math.min(l,c),m=0,y=[],d=g=0,E=v;E>=0?E>g:g>E;d=E>=0?++g:--g)y.push(n(p[m++],p[m++],p[m++],p[m++]));return y}:7>=n?function(n,o,s,a,f,d,m){var v,g,E,y,_;for(u=h=l=c=0,t(r,o,s,a,f,d,m),e(i,o,s,a,f,d,m),g=Math.min(l,c),v=0,_=[],m=E=0,y=g;y>=0?y>E:E>y;m=y>=0?++E:--E)_.push(n(p[v++],p[v++],p[v++],p[v++]));return _}:9>=n?function(n,o,s,a,f,d,m,v,g){var E,y,_,b;for(u=h=l=c=0,t(r,o,s,a,f,d,m,v,g),e(i,o,s,a,f,d,m,v,g),E=Math.min(l,c),g=0,b=[],v=y=0,_=E;_>=0?_>y:y>_;v=_>=0?++y:--y)b.push(n(p[g++],p[g++],p[g++],p[g++]));return b}:function(n,o,s,a,f,d,m,v,g,E,y){var _,b,T,x;for(u=h=0,t(r,o,s,a,f,d,m,v,g,E,y),e(i,o,s,a,f,d,m,v,g,E,y),_=Math.min(l,c),g=0,x=[],v=b=0,T=_;T>=0?T>b:b>T;v=T>=0?++b:--b)x.push(n(p[g++],p[g++],p[g++],p[g++]));return x},o.lerp=function(t){var e;return e=[1-t,t],s=e[0],a=e[1],e},o},n.getLerpThunk=function(t,e){var r,i,o,s,a,u;return i=n.getSizes(t).reduce(function(t,e){return t*e}),o=n.getSizes(e).reduce(function(t,e){return t*e}),r=Math.min(i,o),a=n.getThunk(t),u=n.getThunk(e),s=new Float32Array(r),s.lerp=function(t){var e,n,i,o;for(a.reset(),u.reset(),i=0,o=[];r>i;)e=a(),n=u(),o.push(s[i++]=e+(n-e)*t);return o},s}},{}],173:[function(t,e,n){var r,i;i=Math.PI,r={clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},cosine:function(t){return.5-.5*Math.cos(r.clamp(t,0,1)*i)},binary:function(t){return+(t>=.5)},hold:function(t){return+(t>=1)}},e.exports=r},{}],174:[function(t,e,n){var r,i,o,s,a,u=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};i="xyzw".split(""),r={0:-1,x:0,y:1,z:2,w:3},o=function(t){return t===""+t&&(t=t.split("")),t===+t&&(t=[t]),t},a=function(t){return t===+t&&(t="vec"+t),"vec1"===t&&(t="float"),t},s=function(t){return t=""+t,t.indexOf(".")<0?t+=".0":void 0},n.mapByte2FloatOffset=function(t){var e;return null==t&&(t=4),e=s(t),"vec4 float2ByteIndex(vec4 xyzw, out float channelIndex) {\n float relative = xyzw.w / "+e+";\n float w = floor(relative);\n channelIndex = (relative - w) * "+e+";\n return vec4(xyzw.xyz, w);\n}"},n.sample2DArray=function(t){var e,n;return n=function(t,e){var r,i;return t===e?i="return texture2D(dataTextures["+t+"], uv);":(r=Math.ceil(t+(e-t)/2),i="if (z < "+(r-.5)+") {\n "+n(t,r-1)+"\n}\nelse {\n "+n(r,e)+"\n}"),i=i.replace(/\n/g,"\n ")},e=n(0,t-1),"uniform sampler2D dataTextures["+t+"];\n\nvec4 sample2DArray(vec2 uv, float z) {\n "+e+"\n}"},n.binaryOperator=function(t,e,n){return t=a(t),null!=n?t+" binaryOperator("+t+" a) {\n return a "+e+" "+n+";\n}":t+" binaryOperator("+t+" a, "+t+" b) {\n return a "+e+" b;\n}"},n.extendVec=function(t,e,r){var i,o,u,h;return null==r&&(r=0),t>e?n.truncateVec(t,e):(o=e-t,t=a(t),e=a(e),r=s(r),u=function(){h=[];for(var t=0;o>=0?o>=t:t>=o;o>=0?t++:t--)h.push(t);return h}.apply(this).map(function(t){return t?r:"v"}),i=u.join(","),e+" extendVec("+t+" v) { return "+e+"("+i+"); }")},n.truncateVec=function(t,e){var r;return e>t?n.extendVec(t,e):(r="."+"xyzw".substr(0,e),t=a(t),e=a(e),e+" truncateVec("+t+" v) { return v"+r+"; }")},n.injectVec4=function(t){var e,n,i,s,a,u,h;for(h=["0.0","0.0","0.0","0.0"],t=o(t),t=t.map(function(t){return t===""+t?r[t]:t}),i=s=0,a=t.length;a>s;i=++s)n=t[i],h[n]=["a","b","c","d"][i];return u=h.slice(0,4).join(", "),e=["float a","float b","float c","float d"].slice(0,t.length),"vec4 inject("+e+") {\n return vec4("+u+");\n}"},n.swizzleVec4=function(t,e){var n,i;for(null==e&&(e=null),n=["0.0","xyzw.x","xyzw.y","xyzw.z","xyzw.w"],null==e&&(e=t.length),t=o(t),t=t.map(function(t){var e;return e=+t,u.call([0,1,2,3,4],e)>=0&&(t=+t),t===""+t&&(t=r[t]+1),n[t]});t.lengths;e=++s)u=t[e],l=i[e],n=r[u],c[n]="xyzw."+l;return h=c.join(", "),"vec4 invertSwizzle(vec4 xyzw) {\n return vec4("+h+");\n}"},n.identity=function(t){var e;return e=[].slice.call(arguments),e.length>1?(e=e.map(function(t,e){return["inout",t,String.fromCharCode(97+e)].join(" ")}),e=e.join(", "),"void identity("+e+") { }"):t+" identity("+t+" x) {\n return x;\n}"},n.constant=function(t,e){return t+" constant() {\n return "+e+";\n}"},n.toType=a},{}],175:[function(t,e,n){n.Axis=t("./axis"),n.Data=t("./data"),n.Ease=t("./ease"),n.GLSL=t("./glsl"),n.JS=t("./js"),n.Pretty=t("./pretty"),n.Three=t("./three"),n.Ticks=t("./ticks"),n.VDOM=t("./vdom")},{"./axis":170,"./data":172,"./ease":173,"./glsl":174,"./js":176,"./pretty":177,"./three":178,"./ticks":179,"./vdom":180}],176:[function(t,e,n){n.merge=function(){var t,e,n,r,i,o;for(o={},t=0,n=arguments.length;n>t;t++){r=arguments[t];for(e in r)i=r[e],o[e]=i}return o},n.clone=function(t){return JSON.parse(JSON.serialize(t))},n.parseQuoted=function(t){var e,n,r,i,o,s,a,u,h,l;for(e="",l=function(t){return t=t.replace(/\\/g,"")},a=function(t){return e.length&&s.push(l(e)),e=null!=t?t:""},t=t.split(/(?=(?:\\.|["' ,]))/g),u=!1,s=[],i=0,o=t.length;o>i;i++)switch(r=t[i],n=r[0],h=r.slice(1),n){case'"':case"'":if(u)u===n?(u=!1,a(h)):e+=r;else{if(""!==e)throw new Error("ParseError: String `"+t+"` does not contain comma-separated quoted tokens.");u=n,e+=h}break;case" ":case",":u?e+=r:a(h);break;default:e+=r}return a(),s}},{}],177:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E;r=5,i=1e-4,o=function(t,e){return Math.abs(t/e-Math.round(t/e))i?"-":"",i+=n):"1"!==n&&(i+=r?""+n:"*"+n),i+"/"+e},u=[{1:1},{1:1,"τ":2*Math.PI},{1:1,"π":Math.PI},{1:1,"τ":2*Math.PI,"π":Math.PI},{1:1,e:Math.E},{1:1,"τ":2*Math.PI,e:Math.E},{1:1,"π":Math.PI,e:Math.E},{1:1,"τ":2*Math.PI,"π":Math.PI,e:Math.E}],c=[[420,[2,3,5,7]],[88200,[2,3,5,7]],[60060,[2,3,5,7,11,13]],[861764,[2,17,19,23,29]],[65536,[2]],[1e6,[2,5]]],g=function(t){var e,n,o,a,p,f,d,m,v,g;return t&&(e=t.cache,o=t.compact,v=t.tau,d=t.pi,a=t.e,g=t.threshold,m=t.precision),o=+!!(null!=o?o:!0),v=+!!(null!=v?v:!0),d=+!!(null!=d?d:!0),a=+!!(null!=a?a:!0),e=+!!(null!=e?e:!0),g=+(null!=g?g:i),m=+(null!=m?m:r),p=v+2*d+4*a,n=p+g+m,f=e?{}:null,function(t){var e,n,i,a,d,m,v,g,E,y,_,b,T,x,w,R,H,M;if(null!=f){if(null!=(n=f[t]))return n;if(t===Math.round(t))return f[t]=""+t}w=""+t,e=w.length+w.indexOf(".")+2,b=function(t){var n;return n=t.length,e>=n?(w=""+t,e=n):void 0},H=u[p];for(g in H)if(d=H[g],s(t/d))b(""+l(t/d,1,g,o));else for(m=0,E=c.length;E>m;m++)if(M=c[m],a=M[0],_=M[1],x=t/d*a,s(x)){for(v=0,y=_.length;y>v;v++)for(R=_[v];s(T=x/R)&&s(i=a/R);)x=T,a=i;b(""+h(t/d,a,g,o));break}return(""+t).length>r&&b(""+t.toPrecision(r)),null!=f&&(f[t]=w),w}},E=function(t,e){return null==e&&(e="info"),t=v(t),console[e].apply(console,t)},v=function(t){var e,n,r,i,o,s,a,u;return a="color:rgb(128,0,128)",n="color:rgb(144,64,0)",s="color:rgb(0,0,192)",i="color:rgb(0,70,156)",u="color:inherit",o=!1,r=0,e=[],t=t.replace(/(\\[<={}> "'])|(=>|[<={}> "'])/g,function(t,h,l){var c;return(null!=h?h.length:void 0)?h:o&&'"'!==l&&"'"!==l?l:r&&'"'!==l&&"'"!==l&&"{"!==l&&"}"!==l?l:c=function(){switch(l){case"<":return e.push(a),"%c<";case">":return e.push(a),e.push(u),"%c>%c";case" ":return e.push(n)," %c";case"=":case"=>":return e.push(a),"%c"+l;case'"':case"'":return o=!o,o?(e.push(r?n:s),l+"%c"):(e.push(r?i:a),"%c"+l);case"{":return 0===r++?(e.push(i),"%c"+l):l;case"}":return 0===--r?(e.push(a),l+"%c"):l;default:return l}}()}),[t].concat(e)},m=function(t,e){return d(t,e,"=")},f=function(t,e){return d(t,e,"=>")},d=function(){var t;return t=g({compact:!1}),function(e,n,r){var i,o,s;return i=function(t){return t===""+ +t||t.match(/^[A-Za-z_][A-Za-z0-9]*$/)?t:JSON.stringify(t)},s=function(t){return t.match('\n*"')?t:"{"+t+"}"},o=function(e){var n,r;if(e instanceof Array)return"["+e.map(o).join(", ")+"]";switch(typeof e){case"string":return e.match("\n")?'"\n'+e+'"\n':'"'+e+'"';case"function":return e=""+e,e.match("\n"),e=e.replace(/^function (\([^)]+\))/,"$1 =>"),e=e.replace(/^(\([^)]+\)) =>\s*{\s*return\s*([^}]+)\s*;\s*}/,"$1 => $2");case"number":return t(e);default:return null!=e&&e!==!!e?null!=e._up?o(e.map(function(t){return t})):e.toMarkup?e.toString():"{"+function(){var t;t=[];for(n in e)r=e[n],e.hasOwnProperty(n)&&t.push(i(n)+": "+o(r));return t}().join(", ")+"}":""+JSON.stringify(e)}},[e,r,s(o(n))].join("")}}(),a=function(t){return t=t.replace(/&/g,"&"),t=t.replace(/",t=a(t),r=0,i=n.length;i>r;r++)e=n[r],t=t.replace(/%([a-z])/,function(t,e){var r;switch(r=n.shift(),e){case"c":return'';default:return a(r)}});return o+=t,o+=""},e.exports={markup:v,number:g,print:E,format:p,JSX:{prop:m,bind:f}}},{}],178:[function(t,e,n){n.paramToGL=function(t,e){return e===THREE.RepeatWrapping?t.REPEAT:e===THREE.ClampToEdgeWrapping?t.CLAMP_TO_EDGE:e===THREE.MirroredRepeatWrapping?t.MIRRORED_REPEAT:e===THREE.NearestFilter?t.NEAREST:e===THREE.NearestMipMapNearestFilter?t.NEAREST_MIPMAP_NEAREST:e===THREE.NearestMipMapLinearFilter?t.NEAREST_MIPMAP_LINEAR:e===THREE.LinearFilter?t.LINEAR:e===THREE.LinearMipMapNearestFilter?t.LINEAR_MIPMAP_NEAREST:e===THREE.LinearMipMapLinearFilter?t.LINEAR_MIPMAP_LINEAR:e===THREE.UnsignedByteType?t.UNSIGNED_BYTE:e===THREE.UnsignedShort4444Type?t.UNSIGNED_SHORT_4_4_4_4:e===THREE.UnsignedShort5551Type?t.UNSIGNED_SHORT_5_5_5_1:e===THREE.UnsignedShort565Type?t.UNSIGNED_SHORT_5_6_5:e===THREE.ByteType?t.BYTE:e===THREE.ShortType?t.SHORT:e===THREE.UnsignedShortType?t.UNSIGNED_SHORT:e===THREE.IntType?t.INT:e===THREE.UnsignedIntType?t.UNSIGNED_INT:e===THREE.FloatType?t.FLOAT:e===THREE.AlphaFormat?t.ALPHA:e===THREE.RGBFormat?t.RGB:e===THREE.RGBAFormat?t.RGBA:e===THREE.LuminanceFormat?t.LUMINANCE:e===THREE.LuminanceAlphaFormat?t.LUMINANCE_ALPHA:e===THREE.AddEquation?t.FUNC_ADD:e===THREE.SubtractEquation?t.FUNC_SUBTRACT:e===THREE.ReverseSubtractEquation?t.FUNC_REVERSE_SUBTRACT:e===THREE.ZeroFactor?t.ZERO:e===THREE.OneFactor?t.ONE:e===THREE.SrcColorFactor?t.SRC_COLOR:e===THREE.OneMinusSrcColorFactor?t.ONE_MINUS_SRC_COLOR:e===THREE.SrcAlphaFactor?t.SRC_ALPHA:e===THREE.OneMinusSrcAlphaFactor?t.ONE_MINUS_SRC_ALPHA:e===THREE.DstAlphaFactor?t.DST_ALPHA:e===THREE.OneMinusDstAlphaFactor?t.ONE_MINUS_DST_ALPHA:e===THREE.DstColorFactor?t.DST_COLOR:e===THREE.OneMinusDstColorFactor?t.ONE_MINUS_DST_COLOR:e===THREE.SrcAlphaSaturateFactor?t.SRC_ALPHA_SATURATE:0},n.paramToArrayStorage=function(t){switch(t){case THREE.UnsignedByteType:return Uint8Array;case THREE.ByteType:return Int8Array;case THREE.ShortType:return Int16Array;case THREE.UnsignedShortType:return Uint16Array;case THREE.IntType:return Int32Array;case THREE.UnsignedIntType:return Uint32Array;case THREE.FloatType:return Float32Array}},n.swizzleToEulerOrder=function(t){return t.map(function(t){return["","X","Y","Z"][t]}).join("")},n.transformComposer=function(){var t,e,r,i,o;return t=new THREE.Euler,r=new THREE.Quaternion,e=new THREE.Vector3,i=new THREE.Vector3,o=new THREE.Matrix4,function(s,a,u,h,l,c){return null==c&&(c="XYZ"),null!=a?(c instanceof Array&&(c=n.swizzleToEulerOrder(c)),t.setFromVector3(a,c),r.setFromEuler(t)):r.set(0,0,0,1),null!=u&&r.multiply(u),null!=s?e.copy(s):e.set(0,0,0),null!=h?i.copy(h):i.set(1,1,1),o.compose(e,r,i),null!=l&&o.multiplyMatrices(o,l),o}}},{}],179:[function(t,e,n){var r,i,o,s,a;o=function(t,e,n,r,i,o,s,a,u,h){var l,c,p,f,d,m,v,g,E,y;return null==h&&(h=!0),n||(n=10),r||(r=1),i||(i=10),o||(o=1),v=e-t,d=v/n,h?(r||(r=1),i||(i=10),m=r*Math.pow(i,Math.floor(Math.log(d/r)/Math.log(i))),p=i%2===0?[i/2,1,.5]:i%3===0?[i/3,1,1/3]:[1],E=function(){var t,e,n;for(n=[],t=0,e=p.length;e>t;t++)c=p[t],n.push(m*c);return n}(),l=1/0,g=E.reduce(function(t,e){var n;return c=e/d,n=Math.max(c,1/c),l>n?(l=n,e):t},m),g*=o,t=Math.ceil(t/g+ +!s)*g,e=(Math.floor(e/g)-+!a)*g,n=Math.ceil((e-t)/g),y=function(){var e,r,i;for(i=[],f=e=0,r=n;r>=0?r>=e:e>=r;f=r>=0?++e:--e)i.push(t+f*g);return i}(),u||(y=y.filter(function(t){return 0!==t})),y):(y=function(){var e,r,i;for(i=[],f=e=0,r=n;r>=0?r>=e:e>=r;f=r>=0?++e:--e)i.push(t+f*d);return i}(),s||y.shift(),a||y.pop(),u||(y=y.filter(function(t){return 0!==t})),y)},s=function(t,e,n,r,i,o,s,a,u,h){throw new Error("Log ticks not yet implemented.")},r=0,i=1,a=function(t,e,n,a,u,h,l,c,p,f,d){switch(t){case r:return o(e,n,a,u,h,l,c,p,f,d);case i:return s(e,n,a,u,h,l,c,p,f,d)}},n.make=a,n.linear=o,n.log=s},{}],180:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;for(r=[],l=0,i={},a=function(){return{id:l++,type:null,props:null,children:null,rendered:null,instance:null}},h=function(t){var e,n,i,o;for(t*=2,t=Math.max(0,r.length-t),o=[],e=n=0,i=t;i>=0?i>n:n>i;e=i>=0?++n:--n)o.push(r.push(a()));return o},u=function(t,e,n){var i;return i=r.length?r.pop():a(),i.type=null!=t?t:"div",i.props=null!=e?e:null,i.children=null!=n?n:null,i},g=function(t){var e,n,i,o;if(t.type&&(n=t.children,t.type=t.props=t.children=t.instance=null,r.push(t),null!=n))for(i=0,o=n.length;o>i;i++)e=n[i],g(e)},o=function(t,e,n,r,s){var a,h,l,c,p,f,d,v,g,E,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V;if(null!=t){if(null==e)return m(t,r,s);if(t instanceof Node){if(F=t===e)return}else F=typeof t==typeof e&&null!==e&&null!==t&&t.type===e.type;if(F){if(t.instance=e.instance,B=(null!=(P=t.type)?P.isComponentClass:void 0)?t.type:i[t.type],A=null!=e?e.props:void 0,H=t.props,c=null!=(L=null!=e?e.children:void 0)?L:null,R=t.children,null!=H&&(H.children=R),null!=B){if(f=n._COMPONENT_DIRTY,null!=A!=(null!=H)&&(f=!0),c!==R&&(f=!0),null!=A&&null!=H){if(!f)for(E in A)H.hasOwnProperty(E)||(f=!0);if(!f)for(E in H)V=H[E],(C=A[E])!==V&&(f=!0)}if(f){p=e.instance,null==t.props&&(t.props={}),z=p.defaultProps;for(g in z)N=z[g],null==(a=t.props)[g]&&(a[g]=N);t.props.children=t.children,"function"==typeof p.willReceiveProps&&p.willReceiveProps(t.props),U=n._COMPONENT_FORCE||(null!=(O="function"==typeof p.shouldUpdate?p.shouldUpdate(t.props):void 0)?O:!0),U&&(M=p.getNextState(),"function"==typeof p.willUpdate&&p.willUpdate(t.props,M)),S=p.props,k=p.applyNextState(),p.props=t.props,p.children=t.children,U&&(t=t.rendered="function"==typeof p.render?p.render(u,t.props,t.children):void 0,o(t,e.rendered,n,r,s),"function"==typeof p.didUpdate&&p.didUpdate(S,k))}return}if(null!=A)for(E in A)H.hasOwnProperty(E)||b(n,E,A[E]);if(null!=H)for(E in H)V=H[E],(C=A[E])!==V&&"children"!==E&&y(n,E,V,C);if(null!=R)if("string"==(D=typeof R)||"number"===D)R!==c&&(n.textContent=R);else if(null!=R.type)o(R,c,n.childNodes[0],n,0);else if(l=n.childNodes,null!=c)for(d=v=0,x=R.length;x>v;d=++v)h=R[d],o(h,c[d],l[d],n,d);else for(d=T=0,w=R.length;w>T;d=++T)h=R[d],o(h,null,l[d],n,d);else null!=c&&(_(null,n),n.innerHTML="");return}return _(e.instance,n),n.remove(),m(t,r,s)}return null!=e?(_(e.instance,n),e.node.remove()):void 0},m=function(t,e,n){var r,o,s,a,h,l,c,p,f,d,v,g,E,_,b,T,x,w,R,H;if(null==n&&(n=0),w=(null!=(g=t.type)?g.isComponentClass:void 0)?t.type:i[t.type],t instanceof Node)v=t;else{if(null!=w){if(h=(null!=(E=t.type)?E.isComponentClass:void 0)?t.type:i[t.type],!h)return t=t.rendered=u("noscript"),v=m(t,e,n);t.instance=a=new h(e),null==t.props&&(t.props={}),_=a.defaultProps;for(p in _)R=_[p],null==(r=t.props)[p]&&(r[p]=R);return t.props.children=t.children,a.props=t.props,a.children=t.children,a.setState("function"==typeof a.getInitialState?a.getInitialState():void 0),"function"==typeof a.willMount&&a.willMount(),t=t.rendered="function"==typeof a.render?a.render(u,t.props,t.children):void 0,v=m(t,e,n),"function"==typeof a.didMount&&a.didMount(t),v._COMPONENT=a,v}if("string"==(b=typeof t)||"number"===b)v=document.createTextNode(t);else{v=document.createElement(t.type),T=t.props;for(f in T)H=T[f],y(v,f,H)}if(s=t.children,null!=s)if("string"==(x=typeof s)||"number"===x)v.textContent=s;else if(null!=s.type)m(s,v,0);else for(l=c=0,d=s.length;d>c;l=++c)o=s[l],m(o,v,l)}return e.insertBefore(v,e.childNodes[n]),v},_=function(t,e){var n,r,i,o,s,a;if(t){"function"==typeof t.willUnmount&&t.willUnmount();for(i in t)delete t[i]}for(s=e.childNodes,a=[],r=0,o=s.length;o>r;r++)n=s[r],_(n._COMPONENT,n),a.push(delete n._COMPONENT);return a},v=function(t){var e,n,r,i;if("undefined"==typeof document)return!0;if(null!=document.documentElement.style[t])return t;for(t=t[0].toUpperCase()+t.slice(1),i=["webkit","moz","ms","o"],e=0,n=i.length;n>e;e++)if(r=i[e],null!=document.documentElement.style[r+t])return r+t},d={},E=["transform"],c=0,f=E.length;f>c;c++)p=E[c],d[p]=v(p);y=function(t,e,n,r){var i,o,s;{if("style"!==e)return null!=t[e]?void(t[e]=n):void(t instanceof Node&&t.setAttribute(e,n));for(i in n)s=n[i],(null!=r?r[i]:void 0)!==s&&(t.style[null!=(o=d[i])?o:i]=s)}},b=function(t,e,n){var r,i,o;if("style"!==e)null!=t[e]&&(t[e]=void 0),t instanceof Node&&t.removeAttribute(e);else for(r in n)o=n[r],t.style[null!=(i=d[r])?i:r]=""},s=function(t){var e,n,r,i,o;r={willMount:"componentWillMount",didMount:"componentDidMount",willReceiveProps:"componentWillReceiveProps",shouldUpdate:"shouldComponentUpdate",willUpdate:"componentWillUpdate",didUpdate:"componentDidUpdate",willUnmount:"componentWillUnmount"};for(n in r)i=r[n],null==t[n]&&(t[n]=t[i]);return e=function(){function e(e,n,r,i){var o,s,a,u;this.props=null!=n?n:{},this.state=null!=r?r:null,this.children=null!=i?i:null,o=function(t,e){return"function"==typeof t?t.bind(e):t};for(s in t)u=t[s],this[s]=o(u,this);a=null,this.setState=function(t){null==a&&(a=t?null!=a?a:{}:null);for(s in t)u=t[s],a[s]=u;e._COMPONENT_DIRTY=!0},this.forceUpdate=function(){var t,n;for(e._COMPONENT_FORCE=e._COMPONENT_DIRTY=!0,t=e,n=[];t=t.parentNode;)t._COMPONENT?n.push(t._COMPONENT_FORCE=!0):n.push(void 0);return n},this.getNextState=function(){return a},this.applyNextState=function(){var t,n;return e._COMPONENT_FORCE=e._COMPONENT_DIRTY=!1,t=this.state,n=[null,a],a=n[0],this.state=n[1],t}}return e}(),e.isComponentClass=!0,e.prototype.defaultProps=null!=(o="function"==typeof t.getDefaultProps?t.getDefaultProps():void 0)?o:{},e},e.exports={element:u,recycle:g,apply:o,hint:h,Types:i,createClass:s}},{}],181:[function(t,e,n){var r;r=function(){function t(e,n){this.parent=null!=n?n:null,this.id=t.id(),this.nodes=[],e&&this.add(e)}return t.index=0,t.id=function(e){return++t.index},t.IN=0,t.OUT=1,t.prototype.inputs=function(){var t,e,n,r,i,o,s,a,u;for(e=[],a=this.nodes,t=0,r=a.length;r>t;t++)for(o=a[t],u=o.inputs,n=0,i=u.length;i>n;n++)s=u[n],null===s.input&&e.push(s);return e},t.prototype.outputs=function(){var t,e,n,r,i,o,s,a,u;for(s=[],a=this.nodes,t=0,n=a.length;n>t;t++)for(i=a[t],u=i.outputs,e=0,r=u.length;r>e;e++)o=u[e],0===o.output.length&&s.push(o);return s},t.prototype.getIn=function(t){var e;return function(){var n,r,i,o;for(i=this.inputs(),o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.getOut=function(t){var e;return function(){var n,r,i,o;for(i=this.outputs(),o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.add=function(t,e){var n,r,i;{if(!t.length){if(t.graph&&!e)throw new Error("Adding node to two graphs at once");return t.graph=this,this.nodes.push(t)}for(r=0,i=t.length;i>r;r++)n=t[r],this.add(n)}},t.prototype.remove=function(t,e){var n,r,i;{if(!t.length){if(t.graph!==this)throw new Error("Removing node from wrong graph.");return e||t.disconnect(),this.nodes.splice(this.nodes.indexOf(t),1),t.graph=null}for(r=0,i=t.length;i>r;r++)n=t[r],this.remove(n)}},t.prototype.adopt=function(t){var e,n,r;{if(!t.length)return t.graph.remove(t,!0),this.add(t,!0);for(n=0,r=t.length;r>n;n++)e=t[n],this.adopt(e)}},t}(),e.exports=r},{}],182:[function(t,e,n){n.Graph=t("./graph"),n.Node=t("./node"),n.Outlet=t("./outlet"),n.IN=n.Graph.IN,n.OUT=n.Graph.OUT},{"./graph":181,"./node":183,"./outlet":184}],183:[function(t,e,n){var r,i,o;r=t("./graph"),o=t("./outlet"),i=function(){function t(e,n){this.owner=e,this.graph=null,this.inputs=[],this.outputs=[],this.all=[],this.outlets=null,this.id=t.id(),this.setOutlets(n)}return t.index=0,t.id=function(e){return++t.index},t.prototype.getIn=function(t){var e;return function(){var n,r,i,o;for(i=this.inputs,o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.getOut=function(t){var e;return function(){var n,r,i,o;for(i=this.outputs,o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.get=function(t){return this.getIn(t)||this.getOut(t)},t.prototype.setOutlets=function(t){var e,n,r,i,s,a,u,h,l,c,p,f;if(null!=t){if(null==this.outlets){for(this.outlets={},r=0,u=t.length;u>r;r++)p=t[r],p instanceof o||(p=o.make(p)),this._add(p);return}for(n=function(t){return[t.name,t.inout,t.type].join("-")},c={},i=0,h=t.length;h>i;i++)p=t[i], +c[n(p)]=!0;f=this.outlets;for(a in f)p=f[a],a=n(p),c[a]?c[a]=p:this._remove(p);for(s=0,l=t.length;l>s;s++)p=t[s],e=c[n(p)],e instanceof o?this._morph(e,p):(p instanceof o||(p=o.make(p)),this._add(p))}return this.outlets},t.prototype.connect=function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;for(d={},s={},b=function(t){return _+"/"+t.hint},m=t.inputs,a=0,l=m.length;l>a;a++)r=m[a],(n||!r.input)&&(_=r.type,o=b(r),s[o]||(s[o]=r),d[_]=f=d[_]||[],f.push(r));for(y=this.outputs,y=y.filter(function(t){return!(e&&t.output.length)}),v=y.slice(),u=0,c=v.length;c>u;u++)E=v[u],_=E.type,o=b(E),i=d[_],(r=s[o])&&(E.connect(r),delete s[o],i.splice(i.indexOf(r),1),y.splice(y.indexOf(E),1));if(!y.length)return this;for(g=y.slice(),h=0,p=g.length;p>h;h++)E=g[h],_=E.type,i=d[_],i&&i.length&&E.connect(i.shift());return this},t.prototype.disconnect=function(t){var e,n,r,i,o,s,a;for(s=this.inputs,e=0,r=s.length;r>e;e++)o=s[e],o.disconnect();for(a=this.outputs,n=0,i=a.length;i>n;n++)o=a[n],o.disconnect();return this},t.prototype._key=function(t){return[t.name,t.inout].join("-")},t.prototype._add=function(t){var e;if(e=this._key(t),t.node)throw new Error("Adding outlet to two nodes at once.");if(this.outlets[e])throw new Error("Adding two identical outlets to same node. ("+e+")");return t.node=this,t.inout===r.IN&&this.inputs.push(t),t.inout===r.OUT&&this.outputs.push(t),this.all.push(t),this.outlets[e]=t},t.prototype._morph=function(t,e){var n;return n=this._key(e),delete this.outlets[n],t.morph(e),n=this._key(e),this.outlets[n]=e},t.prototype._remove=function(t){var e,n;if(n=this._key(t),e=t.inout,t.node!==this)throw new Error("Removing outlet from wrong node.");return t.disconnect(),t.node=null,delete this.outlets[n],t.inout===r.IN&&this.inputs.splice(this.inputs.indexOf(t),1),t.inout===r.OUT&&this.outputs.splice(this.outputs.indexOf(t),1),this.all.splice(this.all.indexOf(t),1),this},t}(),e.exports=i},{"./graph":181,"./outlet":184}],184:[function(t,e,n){var r,i;r=t("./graph"),i=function(){function t(e,n,r,i,o,s){this.inout=e,this.name=n,this.hint=r,this.type=i,this.meta=null!=o?o:{},this.id=s,null==this.hint&&(this.hint=t.hint(this.name)),this.node=null,this.input=null,this.output=[],null==this.id&&(this.id=t.id(this.hint))}return t.make=function(e,n){var r,i,o,s;if(null==n&&(n={}),i=n,null!=e.meta){o=e.meta;for(r in o)s=o[r],i[r]=s}return new t(e.inout,e.name,e.hint,e.type,i)},t.index=0,t.id=function(e){return"_io_"+ ++t.index+"_"+e},t.hint=function(t){return t=t.replace(/^_io_[0-9]+_/,""),t=t.replace(/_i_o$/,""),t=t.replace(/(In|Out|Inout|InOut)$/,"")},t.prototype.morph=function(t){return this.inout=t.inout,this.name=t.name,this.hint=t.hint,this.type=t.type,this.meta=t.meta},t.prototype.dupe=function(e){var n;return null==e&&(e=this.id),n=t.make(this),n.name=e,n},t.prototype.connect=function(t){if(this.inout===r.IN&&t.inout===r.OUT)return t.connect(this);if(this.inout!==r.OUT||t.inout!==r.IN)throw new Error("Can only connect out to in.");if(t.input!==this)return t.disconnect(),t.input=this,this.output.push(t)},t.prototype.disconnect=function(t){var e,n,r,i;if(this.input&&this.input.disconnect(this),this.output.length){if(!t){for(i=this.output,e=0,r=i.length;r>e;e++)t=i[e],t.input=null;return this.output=[]}if(n=this.output.indexOf(t),n>=0)return this.output.splice(n,1),t.input=null}},t}(),e.exports=i},{"./graph":181}],185:[function(t,e,n){var r,i,o,s,a,u;i=t("../graph"),a=t("../linker").Program,o=t("../linker").Layout,u=!1,r=function(){function t(){var t;null==this.namespace&&(this.namespace=a.entry()),this.node=new i.Node(this,null!=(t="function"==typeof this.makeOutlets?this.makeOutlets():void 0)?t:{})}return t.previous=function(t){var e;return null!=(e=t.input)?e.node.owner:void 0},t.prototype.refresh=function(){var t;return this.node.setOutlets(null!=(t="function"==typeof this.makeOutlets?this.makeOutlets():void 0)?t:{})},t.prototype.clone=function(){return new t},t.prototype.compile=function(t,e){var n;return n=new a(t,null!=e?e:a.entry(),this.node.graph),this.call(n,0),n.assemble()},t.prototype.link=function(t,e){var n,r;return r=this.compile(t,e),n=new o(t,this.node.graph),this._include(r,n,0),this["export"](n,0),n.link(r)},t.prototype.call=function(t,e){},t.prototype.callback=function(t,e,n,r,i){},t.prototype["export"]=function(t,e){},t.prototype._info=function(t){var e,n,r;return r=null!=(e=null!=(n=this.node.owner.snippet)?n._name:void 0)?e:this.node.owner.namespace,null!=t?r+="."+t:void 0},t.prototype._outlet=function(t,e){var n;return n=i.Outlet.make(t,e),n.meta.def=t,n},t.prototype._call=function(t,e,n){return e.call(this.node,t,n)},t.prototype._require=function(t,e){return e.require(this.node,t)},t.prototype._inputs=function(e,n,r){var i,o,s,a,u,h,l;for(u=e.main.signature,l=[],o=0,s=u.length;s>o;o++)i=u[o],a=this.node.get(i.name),l.push(null!=(h=t.previous(a))?h.call(n,r+1):void 0);return l},t.prototype._callback=function(t,e,n,r,i,o){return e.callback(this.node,t,n,r,i,o)},t.prototype._include=function(t,e,n){return e.include(this.node,t,n)},t.prototype._link=function(e,n,r){var i,o,a,h,l,c,p,f,d,m,v,g;for(u&&console.log("block::_link",this.toString(),e.namespace),d=e.symbols,g=[],a=0,l=d.length;l>a;a++){if(h=d[a],o=e.externals[h],p=this.node.get(o.name),!p)throw new s("External not found on "+this._info(o.name));if(null==p.meta.child){for(m=[p,p,null],c=m[0],f=m[1],i=m[2];!i&&f;)v=[p.meta.parent,f],f=v[0],p=v[1];if(i=t.previous(p),!i)throw new s("Missing connection on "+this._info(o.name));u&&console.log("callback -> ",this.toString(),o.name,p),i.callback(n,r+1,h,o,p.input),g.push(null!=i?i["export"](n,r+1):void 0)}}return g},t.prototype._trace=function(e,n,r){var i,o,s,a,h,l,c;for(u&&console.log("block::_trace",this.toString(),e.namespace),h=e.main.signature,c=[],o=0,s=h.length;s>o;o++)i=h[o],a=this.node.get(i.name),c.push(null!=(l=t.previous(a))?l["export"](n,r+1):void 0);return c},t}(),s=function(t){var e;return e=new Error(t),e.name="OutletError",e},s.prototype=new Error,e.exports=r},{"../graph":205,"../linker":210}],186:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./block"),i=function(t){function e(t){this.snippet=t,this.namespace=this.snippet.namespace,e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.clone=function(){return new e(this.snippet)},e.prototype.makeOutlets=function(){var t,e,n,r,i,o,s;return r=this.snippet.main.signature,e=this.snippet.externals,s=this.snippet.symbols,o=function(){var t,e,n;for(n=[],t=0,e=r.length;e>t;t++)i=r[t],n.push(this._outlet(i,{callback:!1}));return n}.call(this),t=function(){var t,r,i;for(i=[],t=0,r=s.length;r>t;t++)n=s[t],i.push(this._outlet(e[n],{callback:!0}));return i}.call(this),o.concat(t)},e.prototype.call=function(t,e){return this._call(this.snippet,t,e),this._inputs(this.snippet,t,e)},e.prototype["export"]=function(t,e){return t.visit(this.namespace,e)?(this._link(this.snippet,t,e),this._trace(this.snippet,t,e)):void 0},e}(r),e.exports=i},{"./block":185}],187:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("../graph"),r=t("./block"),i=function(t){function e(t){this.graph=t,e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.refresh=function(){return e.__super__.refresh.apply(this,arguments),delete this.subroutine},e.prototype.clone=function(){return new e(this.graph)},e.prototype.makeOutlets=function(){var t,e,n,r,i,s,a,u,h,l,c,p;for(this.make(),u=[],n=[],h=[],t=function(t){return function(t,e){var n,r;return t.meta.callback?t.inout===o.IN?(r=t.dupe(),null==(n=r.meta).child&&(n.child=t),t.meta.parent=r,u.push(r)):void 0:e.push(t.type)}}(this),l=this.graph.inputs(),e=0,i=l.length;i>e;e++)a=l[e],t(a,n);for(c=this.graph.outputs(),r=0,s=c.length;s>r;r++)a=c[r],t(a,h);return n=n.join(","),h=h.join(","),p="("+n+")("+h+")",u.push({name:"callback",type:p,inout:o.OUT,meta:{callback:!0,def:this.subroutine.main}}),u},e.prototype.make=function(){return this.subroutine=this.graph.compile(this.namespace)},e.prototype["export"]=function(t,e){return t.visit(this.namespace,e)?(this._link(this.subroutine,t,e),this.graph["export"](t,e)):void 0},e.prototype.call=function(t,e){return this._require(this.subroutine,t,e)},e.prototype.callback=function(t,e,n,r,i){return this._include(this.subroutine,t,e),this._callback(this.subroutine,t,e,n,r,i)},e}(r),e.exports=i},{"../graph":205,"./block":185}],188:[function(t,e,n){n.Block=t("./block"),n.Call=t("./call"),n.Callback=t("./callback"),n.Isolate=t("./isolate"),n.Join=t("./join")},{"./block":185,"./call":186,"./callback":187,"./isolate":189,"./join":190}],189:[function(t,e,n){var r,i,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../graph"),r=t("./block"),o=function(t){function e(t){this.graph=t,e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.refresh=function(){return e.__super__.refresh.apply(this,arguments),delete this.subroutine},e.prototype.clone=function(){return new e(this.graph)},e.prototype.makeOutlets=function(){var t,e,n,r,o,s,a,u,h,l,c,p,f,d,m;for(this.make(),l=[],d={},e={},c=["inputs","outputs"],r=0,s=c.length;s>r;r++)for(m=c[r],p=this.graph[m](),o=0,a=p.length;a>o;o++)h=p[o],u=void 0,"return"!==(f=h.hint)&&"callback"!==f||h.inout!==i.OUT||(u=h.hint),null!=d[u]&&(u=void 0),n=h.dupe(u),null==(t=n.meta).child&&(t.child=h),h.meta.parent=n,null!=u&&(d[u]=!0),e[h.name]=n,l.push(n);return l},e.prototype.make=function(){return this.subroutine=this.graph.compile(this.namespace)},e.prototype.call=function(t,e){return this._call(this.subroutine,t,e),this._inputs(this.subroutine,t,e)},e.prototype["export"]=function(t,e){return t.visit(this.namespace,e)?(this._link(this.subroutine,t,e),this._trace(this.subroutine,t,e),this.graph["export"](t,e)):void 0},e.prototype.callback=function(t,e,n,r,i){return i=i.meta.child,i.node.owner.callback(t,e,n,r,i)},e}(r),e.exports=o},{"../graph":205,"./block":185}],190:[function(t,e,n){var r,i,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./block"),i=function(t){function e(t){this.nodes=t,e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.clone=function(){return new e(this.nodes)},e.prototype.makeOutlets=function(){return[]},e.prototype.call=function(t,e){var n,r,i,o,s,a;for(s=this.nodes,a=[],r=0,i=s.length;i>r;r++)o=s[r],n=o.owner,a.push(n.call(t,e));return a},e.prototype["export"]=function(t,e){var n,r,i,o,s,a;for(s=this.nodes,a=[],r=0,i=s.length;i>r;r++)o=s[r],n=o.owner,a.push(n["export"](t,e));return a},e}(r),e.exports=i},{"./block":185}],191:[function(t,e,n){var r,i,o;o=t("./queue"),i=t("./hash"),r=function(t){var e,n;return e={},n=o(100),function(r){var o,s;return s=r.length>32?"##"+i(r).toString(16):r,o=n(s),null!=o&&delete e[o],null==e[s]&&(e[s]=t(r)),e[s].clone()}},e.exports=r},{"./hash":193,"./queue":197}],192:[function(t,e,n){var r,i,o,s,a;o=t("../graph").Graph,r=t("../block"),a=t("../visualize"),i=function(){function t(t,e,n){this.language=t,this.fetch=e,this.config=n,this.graph()}return t.prototype.pipe=function(e,n,r,i){return e instanceof t?this._concat(e):null!=e&&this._call(e,n,r,i),this},t.prototype.call=function(t,e,n,r){return this.pipe(t,e,n,r)},t.prototype.require=function(e,n,r,i){return e instanceof t?this._import(e):null!=e&&(this.callback(),this._call(e,n,r,i),this.end()),this},t.prototype["import"]=function(t,e,n,r){return this.require(t,e,n,r)},t.prototype.split=function(){return this._group("_combine",!0),this},t.prototype.fan=function(){return this._group("_combine",!1),this},t.prototype.isolate=function(){return this._group("_isolate"),this},t.prototype.callback=function(){return this._group("_callback"),this},t.prototype.next=function(){return this._next(),this},t.prototype.pass=function(){var t;return t=this._stack[2].end,this.end(),this._state.end=this._state.end.concat(t),this},t.prototype.end=function(){var t,e,n,r;return n=this._exit(),r=n[0],t=n[1],e=r.op,this[e]&&this[e](r,t),this},t.prototype.join=function(){return this.end()},t.prototype.graph=function(){for(var t,e;(null!=(e=this._stack)?e.length:void 0)>1;)this.end();return this._graph&&this._tail(this._state,this._graph),t=this._graph,this._graph=new o,this._state=new s,this._stack=[this._state],t},t.prototype.compile=function(t){return null==t&&(t="main"),this.graph().compile(t)},t.prototype.link=function(t){return null==t&&(t="main"),this.graph().link(t)},t.prototype.serialize=function(){return a.serialize(this._graph)},t.prototype.empty=function(){return 0===this._graph.nodes.length},t.prototype._concat=function(t){var e,n,i;if(0===t._state.nodes.length)return this;this._tail(t._state,t._graph);try{e=new r.Isolate(t._graph)}catch(i){throw n=i,this.config.autoInspect&&a.inspect(n,this._graph,t),n}return this._auto(e),this},t.prototype._import=function(t){var e,n,i;if(0===t._state.nodes.length)throw"Can't import empty callback";this._tail(t._state,t._graph);try{e=new r.Callback(t._graph)}catch(i){throw n=i,this.config.autoInspect&&a.inspect(n,this._graph,t),n}return this._auto(e),this},t.prototype._combine=function(t,e){var n,r,i,o,s,a,u,h;for(a=t.start,r=0,o=a.length;o>r;r++)for(h=a[r],u=e.end,i=0,s=u.length;s>i;i++)n=u[i],n.connect(h,t.multi);return e.end=t.end,e.nodes=e.nodes.concat(t.nodes)},t.prototype._isolate=function(t,e){var n,i,o,s;if(t.nodes.length){s=this._subgraph(t),this._tail(t,s);try{n=new r.Isolate(s)}catch(o){throw i=o,this.config.autoInspect&&a.inspect(i,this._graph,s),i}return this._auto(n)}},t.prototype._callback=function(t,e){var n,i,o,s;if(t.nodes.length){s=this._subgraph(t),this._tail(t,s);try{n=new r.Callback(s)}catch(o){throw i=o,this.config.autoInspect&&a.inspect(i,this._graph,s),i}return this._auto(n)}},t.prototype._call=function(t,e,n,i){var o,s;return s=this.fetch(t),s.bind(this.config,e,n,i),o=new r.Call(s),this._auto(o)},t.prototype._subgraph=function(t){var e;return e=new o(null,this._graph),e.adopt(t.nodes),e},t.prototype._tail=function(t,e){var n;if(n=t.end.concat(t.tail),n=n.filter(function(t,e){return n.indexOf(t)===e}),n.length>1&&(n=new r.Join(n),n=[n.node],this._graph.add(n)),e.tail=n[0],t.end=n,t.tail=[],!e.tail)throw new Error("Cannot finalize empty graph");return e.compile=function(t){return function(n){var r,i;null==n&&(n="main");try{return e.tail.owner.compile(t.language,n)}catch(i){throw r=i,t.config.autoInspect&&e.inspect(r),r}}}(this),e.link=function(t){return function(n){var r,i;null==n&&(n="main");try{return e.tail.owner.link(t.language,n)}catch(i){throw r=i,t.config.autoInspect&&e.inspect(r),r}}}(this),e["export"]=function(t){return function(t,n){return e.tail.owner["export"](t,n)}}(this),e.inspect=function(t){return null==t&&(t=null),a.inspect(t,e)}},t.prototype._group=function(t,e){return this._push(t,e),this._push(),this},t.prototype._next=function(){var t;return t=this._pop(),this._state.start=this._state.start.concat(t.start),this._state.end=this._state.end.concat(t.end),this._state.nodes=this._state.nodes.concat(t.nodes),this._state.tail=this._state.tail.concat(t.tail),this._push()},t.prototype._exit=function(){return this._next(),this._pop(),[this._pop(),this._state]},t.prototype._push=function(t,e){return this._stack.unshift(new s(t,e)),this._state=this._stack[0]},t.prototype._pop=function(){var t;return this._state=this._stack[1],null==this._state&&(this._state=new s),null!=(t=this._stack.shift())?t:new s},t.prototype._auto=function(t){return t.node.inputs.length?this._append(t):this._insert(t)},t.prototype._append=function(t){var e,n,r,i,o;for(i=t.node,this._graph.add(i),o=this._state.end,n=0,r=o.length;r>n;n++)e=o[n],e.connect(i);return this._state.start.length||(this._state.start=[i]),this._state.end=[i],this._state.nodes.push(i),i.outputs.length?void 0:this._state.tail.push(i)},t.prototype._prepend=function(t){var e,n,r,i,o;for(r=t.node,this._graph.add(r),i=this._state.start,e=0,n=i.length;n>e;e++)o=i[e],r.connect(o);return this._state.end.length||(this._state.end=[r]),this._state.start=[r],this._state.nodes.push(r),r.outputs.length?void 0:this._state.tail.push(r)},t.prototype._insert=function(t){var e;return e=t.node,this._graph.add(e),this._state.start.push(e),this._state.end.push(e),this._state.nodes.push(e),e.outputs.length?void 0:this._state.tail.push(e)},t}(),s=function(){function t(t,e,n,r,i,o){this.op=null!=t?t:null,this.multi=null!=e?e:!1,this.start=null!=n?n:[],this.end=null!=r?r:[],this.nodes=null!=i?i:[],this.tail=null!=o?o:[]}return t}(),e.exports=i},{"../block":188,"../graph":205,"../visualize":216}],193:[function(t,e,n){var r,i,o,s,a,u,h,l;r=3432918353,i=461845907,o=3864292196,s=2246822507,a=3266489909,h=function(t,e){var n,r,i,o;return n=t>>>16&65535,r=65535&t,i=e>>>16&65535,o=65535&e,r*o+(n*o+r*i<<16>>>0)|0},null!=Math.imul&&(l=Math.imul(4294967295,5),-5===l&&(h=Math.imul)),u=function(t){var e,n,u,l,c,p;for(c=t.length,l=Math.floor(c/2),u=e=0,p=function(){return t.charCodeAt(u++)},n=function(t,n){var s;return s=t|n<<16,s^=s<<9,s=h(s,r),s=s<<15|s>>>17,s=h(s,i),e^=s,e=e<<13|e>>>19,e=h(e,5),e=e+o|0};l--;)n(p(),p());return 1&c&&n(p(),0),e^=c,e^=e>>>16,e=h(e,s),e^=e>>>13,e=h(e,a),e^=e>>>16},e.exports=u},{}],194:[function(t,e,n){n.Factory=t("./factory"),n.Material=t("./material"),n.library=t("./library"),n.cache=t("./cache"),n.queue=t("./queue"),n.hash=t("./hash")},{"./cache":191,"./factory":192,"./hash":193,"./library":195,"./material":196,"./queue":197}],195:[function(t,e,n){var r;r=function(t,e,n){var r,i,o,s;return r=null,s={},null!=e&&("function"==typeof e?r=function(r){return n(t,r,e(r))}:"object"==typeof e&&(r=function(r){if(null==e[r])throw new Error("Unknown snippet `"+r+"`");return n(t,r,e[r])})),o=function(e){return n(t,"",e)},null==r?o:(i=function(t){return t.match(/[{;]/)?o(t):(s[t]=!0,r(t))},i.used=function(t){return null==t&&(t=s),s=t},i)},e.exports=r},{}],196:[function(t,e,n){var r,i,o,s;o=!1,i=t("../visualize"),s=function(){var t;return t=+new Date,function(e){var n;return n=+new Date-t,console.log(e,n+" ms"),n}},r=function(){function t(t,e){this.vertex=t,this.fragment=e,o&&(this.tock=s())}return t.prototype.build=function(t){return this.link(t)},t.prototype.link=function(t){var e,n,r,s,a,u,h,l,c,p,f,d,m,v;for(null==t&&(t={}),f={},m={},e={},v=this.vertex.link("main"),n=this.fragment.link("main"),u=[v,n],r=0,a=u.length;a>r;r++){p=u[r],h=p.uniforms;for(s in h)d=h[s],f[s]=d;l=p.varyings;for(s in l)d=l[s],m[s]=d;c=p.attributes;for(s in c)d=c[s],e[s]=d}return t.vertexShader=v.code,t.vertexGraph=v.graph,t.fragmentShader=n.code,t.fragmentGraph=n.graph,t.attributes=e,t.uniforms=f,t.varyings=m,t.inspect=function(){return i.inspect("Vertex Shader",v,"Fragment Shader",n.graph)},o&&this.tock("Material build"),t},t.prototype.inspect=function(){return i.inspect("Vertex Shader",this.vertex,"Fragment Shader",this.fragment.graph)},t}(),e.exports=r},{"../visualize":216}],197:[function(t,e,n){var r;r=function(t){var e,n,r,i,o,s;return null==t&&(t=100),i={},r=null,s=null,n=0,e=function(t){return t.prev=null,t.next=r,null!=r&&(r.prev=t),r=t,null==s?s=t:void 0},o=function(t){var e,n;return n=t.prev,e=t.next,null!=n&&(n.next=e),null!=e&&(e.prev=n),r===t&&(r=e),s===t?s=n:void 0},function(a){var u,h;return(h=i[a]&&h!==r)?(o(h),e(h)):(n===t?(u=s.key,o(s),delete i[u]):n++,h={next:r,prev:null,key:a},e(h),i[a]=h),u}},e.exports=r},{}],198:[function(t,e,n){var r,i,o,s;r=function(t){var e,n,r,s,a;return n=t.ast,r=t.code,a=t.signatures,s=i(a),e=o(r,s),[a,e]},s=function(){var t;return t=+new Date,function(e){var n;return n=+new Date-t,console.log(e,n+" ms"),n}},i=function(t){var e,n,r,i,o,s,a,u,h,l;for(s={},h=function(t){return s[t.name]=!0},h(t.main),a=["external","internal","varying","uniform","attribute"],e=0,i=a.length;i>e;e++)for(r=a[e],u=t[r],n=0,o=u.length;o>n;n++)l=u[n],h(l);return s},o=function(t,e){var n,r;return r=new RegExp("\\b("+function(){var t;t=[];for(n in e)t.push(n);return t}().join("|")+")\\b","g"),t=t.replace(/\/\/[^\n]*/g,""),t=t.replace(/\/\*([^*]|\*[^\/])*\*\//g,""),function(i,o,s){var a,u,h,l;null==i&&(i=""),null==o&&(o={}),null==s&&(s={}),h={};for(n in e)h[n]=null!=o[n]?n:i+n;return a=t.replace(r,function(t){return h[t]}),u=function(){var t;t=[];for(n in s)l=s[n],t.push("#define "+n+" "+l);return t}(),u.length&&u.push(""),u.join("\n")+a}},e.exports=r},{}],199:[function(t,e,n){e.exports={SHADOW_ARG:"_i_o",RETURN_ARG:"return"}},{}],200:[function(t,e,n){var r,i,o,s,a,u,h;e.exports=i={},i["in"]=0,i.out=1,i.inout=2,s=function(t){return t.token.data},i.node=function(t){var e,n;return"function"===(null!=(e=t.children[5])?e.type:void 0)?i["function"](t):"keyword"===(null!=(n=t.token)?n.type:void 0)?i.external(t):void 0},i.external=function(t){var e,n,r,i,o,a,u,h,l,c,p,f,d;for(e=t.children,p=s(e[1]),f=s(e[3]),d=s(e[4]),a=e[5],"attribute"!==p&&"uniform"!==p&&"varying"!==p&&(p="global"),h=[],c=a.children,n=i=0,o=c.length;o>i;n=++i)e=c[n],"ident"===e.type&&(r=s(e),u=a.children[n+1],l="quantifier"===(null!=u?u.type:void 0),h.push({decl:"external",storage:p,type:d,ident:r,quant:!!l,count:l}));return h},i["function"]=function(t){var e,n,r,o,a,u,h,l,c,p;return r=t.children,l=s(r[1]),c=s(r[3]),p=s(r[4]),u=r[5],h=s(u.children[0]),e=u.children[1],n=u.children[2],a=function(){var t,n,r,s;for(r=e.children,s=[],t=0,n=r.length;n>t;t++)o=r[t],s.push(i.argument(o));return s}(),[{decl:"function",storage:l,type:p,ident:h,body:!!n,args:a}]},i.argument=function(t){var e,n,r,i,o,a,u,h;return e=t.children,u=s(e[1]),i=s(e[2]),h=s(e[4]),o=e[5],r=s(o.children[0]),a=o.children[1],n=a?a.children[0].token.data:void 0,{decl:"argument",storage:u,inout:i,type:h,ident:r,quant:!!a,count:n}},i.param=function(t,e,n,r,o){var s,a,u;return a=[],null!=e&&a.push(e),null!=n&&a.push(n),a.push(""),a=a.join(" "),u=r?"["+o+"]":"",""!==t&&(t+=" "),s=function(e,n){return(n?t:"")+(""+a+e+u)},s.split=function(t){return i.param(t,e,n,r,o)},s},h="undefined"!=typeof window,u=h&&!!window.THREE,o={"int":0,"float":0,vec2:u?THREE.Vector2:null,vec3:u?THREE.Vector3:null,vec4:u?THREE.Vector4:null,mat2:null,mat3:u?THREE.Matrix3:null,mat4:u?THREE.Matrix4:null,sampler2D:0,samplerCube:0},a={"int":"i","float":"f",vec2:"v2",vec3:"v3",vec4:"v4",mat2:"m2",mat3:"m3",mat4:"m4",sampler2D:"t",samplerCube:"t"},i.type=function(t,e,n,s,u,h){var l,c,p,f,d,m,v;return l={"in":i["in"],out:i.out,inout:i.inout},d={"const":"const"},m=a[e],n&&(m+="v"),v=o[e],(null!=v?v.call:void 0)&&(v=new v),n&&(v=[v]),c=null!=(f=l[u])?f:l["in"],h=d[h],p=i.param(u,h,e,n,s),new r(t,m,e,p,v,c)},r=function(){function t(t,e,n,r,i,o,s){this.name=t,this.type=e,this.spec=n,this.param=r,this.value=i,this.inout=o,this.meta=s}return t.prototype.split=function(){var e,n,r,o;return r=null!=this.meta.shadowed,e=r?"in":"out",n=r?i["in"]:i.out,o=this.param.split(e),new t(this.name,this.type,this.spec,o,this.value,n)},t.prototype.copy=function(e,n){var r;return r=new t(null!=e?e:this.name,this.type,this.spec,this.param,this.value,this.inout,n)},t}()},{}],201:[function(t,e,n){var r,i,o;i=t("../graph"),r=t("./constants"),e.exports=o={unshadow:function(t){var e;return e=t.replace(r.SHADOW_ARG,""),e!==t?e:null},lines:function(t){return t.join("\n")},list:function(t){return t.join(", ")},statements:function(t){return t.join(";\n")},body:function(t){return{entry:t,type:"void",params:[],signature:[],"return":"",vars:{},calls:[],post:[],chain:{}}},define:function(t,e){return"#define "+t+" "+e},"function":function(t,e,n,r,i){return t+" "+e+"("+n+") {\n"+r+i+"}"},invoke:function(t,e,n){return t=t?t+" = ":"",n=o.list(n)," "+t+e+"("+n+")"},same:function(t,e){var n,i,o,s,a;for(o=s=0,a=t.length;a>s;o=++s){if(n=t[o],i=e[o],!i)return!1;if(n.type!==i.type)return!1;if(n.name===r.RETURN_ARG!=(i.name===r.RETURN_ARG))return!1}return!0},call:function(t,e,n,i,s){var a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w;for(u=[],T="",x=1,f=0,d=i.length;d>f;f++){if(a=i[f],v=a.name,h=l=t(v),y=null,m=null,g=!1,c=a.inout,p=v===r.RETURN_ARG,(w=null!=(_=a.meta)?_.shadowed:void 0)&&(y=t(w),y&&(s.vars[y]=" "+a.param(y),s.calls.push(" "+y+" = "+l),e(w)?m={shadowed:y}:a=a.split())),(w=null!=(b=a.meta)?b.shadow:void 0)&&(y=t(w))){if(e(w)){m={shadow:y};continue}a=a.split(),g=!0}p?T=l:g||u.push(null!=y?y:l),e(v)?(E="push",p?""===s["return"]?(E="unshift",h=v,s.type=a.spec,s["return"]=" return "+l,s.vars[l]=" "+a.param(l)):(s.vars[l]=" "+a.param(l),s.params.push(a.param(l,!0))):s.params.push(a.param(l,!0)),a=a.copy(h,m),s.signature[E](a)):s.vars[l]=" "+a.param(l)}return s.calls.push(o.invoke(T,n,u))},build:function(t,e){var n,r,i,s,a,u,h,l,c,p,f;return a=t.entry,i=null,e&&1===e.length&&"main"!==a&&(n=t,r=e[0].module,o.same(t.signature,r.main.signature)&&(i=o.define(a,r.entry))),null==i&&(f=function(){var e,n;e=t.vars,n=[];for(p in e)s=e[p],n.push(s);return n}(),e=t.calls,h=t.post,u=t.params,c=t.type,l=t["return"],e=e.concat(h),""!==l&&e.push(l),e.push(""),f.length?(f.push(""),f=o.statements(f)+"\n"):f="",e=o.statements(e),u=o.list(u),i=o["function"](c,a,u,f,e)),{signature:t.signature,code:i,name:a}},links:function(t){var e,n,r,i;for(i={defs:[],bodies:[]},e=0,r=t.length;r>e;e++)n=t[e],o.link(n,i);return i.defs=o.lines(i.defs),i.bodies=o.statements(i.bodies),""===i.defs&&delete i.defs,""===i.bodies&&delete i.bodies,i},link:function(t){return function(t,e){var n,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S;if(y=t.module,b=t.name,l=t.external,g=y.main,h=y.entry,o.same(g.signature,l.signature))return e.defs.push(o.define(b,h));for(p=[],w=[],E={},M=[y.namespace,r.RETURN_ARG].join(""),R=l.signature,f=0,d=R.length;d>f;f++)u=R[f],v=u.inout===i.IN?p:w,v.push(u);for(H=g.signature,_=0,m=H.length;m>_;_++)u=H[_],v=u.inout===i.IN?p:w,T=v.shift(),a=T.name,a===r.RETURN_ARG&&(a=M),E[u.name]=a;return s=function(t){return E[t]},n=function(){return!0},c=o.body(),o.call(s,n,h,g.signature,c),c.entry=h,E={"return":M},s=function(t){var e;return null!=(e=E[t])?e:t},x=o.body(),S=o.call(s,n,h,l.signature,x),x.calls=c.calls,x.entry=b,e.bodies.push(o.build(c).code.split(" {")[0]),e.bodies.push(o.build(x).code)}}(this),defuse:function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m;for(f=/([A-Za-z0-9_]+\s+)?[A-Za-z0-9_]+\s+[A-Za-z0-9_]+\s*\([^)]*\)\s*;\s*/gm,m=function(t){return t.replace(f,function(t){return""})},n=t.split(/(?=[{}])/g),l=0,o=a=0,u=n.length;u>a;o=++a){switch(e=n[o],e[0]){case"{":l++;break;case"}":l--}if(0===l){for(r=e.split(/^[ \t]*#/m),s=p=0,h=r.length;h>p;s=++p)c=r[s],s>0?(c=c.split(/\n/),i=c.shift(),d=c.join("\n"),r[s]=[i,m(d)].join("\n")):r[s]=m(c);n[o]=r.join("#")}}return t=n.join("")},dedupe:function(t){var e,n;return e={},n=/((attribute|uniform|varying)\s+)[A-Za-z0-9_]+\s+([A-Za-z0-9_]+)\s*(\[[^\]]*\]\s*)?;\s*/gm,t.replace(n,function(t,n,r,i,o){return e[i]?"":(e[i]=!0,t)})},hoist:function(t){var e,n,r,i,o,s,a,u;for(u=/^#define ([^ ]+ _pg_[0-9]+_|_pg_[0-9]+_ [^ ]+)$/,o=t.split(/\n/g),e=[],a=[],n=0,r=o.length;r>n;n++)i=o[n],s=i.match(u)?e:a,s.push(i);return e.concat(a).join("\n")}}},{"../graph":205,"./constants":199}],202:[function(t,e,n){var r,i,o,s,a;for(n.compile=t("./compile"),n.parse=t("./parse"),n.generate=t("./generate"),s=t("./constants"),a=r=0,o=s.length;o>r;a=++r)i=s[a],n[i]=a},{"./compile":198,"./constants":199,"./generate":201,"./parse":203}],203:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v;m=t("../../vendor/glsl-tokenizer"),c=t("../../vendor/glsl-parser"),s=t("./decl"),r=t("./constants"),o=!1,h=function(t,e){var n,r;return n=l(t,e),r=p(n,e)},l=function(t,e){var n,r,i,s,a,u,h,l,p,f,v;o&&(v=d());try{p=m().process(c(),e),f=p[0],n=f[0],a=p[1]}catch(s){r=s,a=[{message:r}]}if(o&&v("GLSL Tokenize & Parse"),u=function(t){var e,n;return t=t.split("\n"),e=(""+t.length).length,n=function(t){return(t=""+t).lengthh;h++)i=a[h],console.error(t+" -",i.message);throw new Error("GLSL parse error")}return n},p=function(t,e){var n,r,s,h,l,c,p;return o&&(p=d()),c=[],v(u,i(c),t,""),h=f(c),s=h[0],r=h[1],n=h[2],l=a(s,r,n),o&&p("GLSL AST"),{ast:t,code:e,signatures:l}},u=function(t,e){switch(t.type){case"decl":return e(s.node(t)),!1}return!0},i=function(t){return function(e){var n,r,i,o;if(null!=e){for(o=[],n=0,r=e.length;r>n;n++)i=e[n],o.push(t.push(i));return o}}},f=function(t){var e,n,r,i,o,s,a,u,h;for(a=null,i=[],n=[],u={},r=!1,o=0,s=t.length;s>o;o++)h=t[o],h.body?(u[h.ident]&&(n=function(){var t,r,i;for(i=[],t=0,r=n.length;r>t;t++)e=n[t],e.ident!==h.ident&&i.push(e);return i}(),delete u[h.ident]),i.push(h),"main"===h.ident?(a=h,r=!0):r||(a=h)):"global"===h.storage?i.push(h):(n.push(h),u[h.ident]=!0);return[a,i,n]},a=function(t,e,n){var i,o,a,u,h,l,c,p,f;for(p={uniform:[],attribute:[],varying:[],external:[],internal:[],global:[],main:null},o=function(t){return s.type(t.ident,t.type,t.quant,t.count,t.inout,t.storage)},a=function(t,e){var n,i,a,u,h,l,c,p,f,d,m;for(d=function(){var e,n,r,s;for(r=t.args,s=[],e=0,n=r.length;n>e;e++)i=r[e],s.push(o(i));return s}(),c=0,p=d.length;p>c;c++)u=d[c],u.inout===s.inout&&(n=u,a=u.copy(),n.inout=s["in"],a.inout=s.out,a.meta={shadow:n.name},a.name+=r.SHADOW_ARG,n.meta={shadowed:a.name},d.push(a));return"void"!==t.type&&d.unshift(s.type(r.RETURN_ARG,t.type,!1,"","out")),l=function(){var t,e,n;for(n=[],t=0,e=d.length;e>t;t++)u=d[t],u.inout===s["in"]&&n.push(u.type);return n}().join(","),f=function(){var t,e,n;for(n=[],t=0,e=d.length;e>t;t++)u=d[t],u.inout===s.out&&n.push(u.type);return n}().join(","),m="("+l+")("+f+")",h={name:t.ident,type:m,signature:d,inout:e,spec:t.type}},p.main=a(t,s.out),u=0,l=e.length;l>u;u++)f=e[u],p.internal.push({name:f.ident});for(h=0,c=n.length;c>h;h++)switch(f=n[h],f.decl){case"external":i=o(f),p[f.storage].push(i);break;case"function":i=a(f,s["in"]),p.external.push(i)}return p},o=!1,v=function(t,e,n,r){var i,s,a,u,h,l,c,p;if(o&&console.log(r,n.type,null!=(l=n.token)?l.data:void 0,null!=(c=n.token)?c.type:void 0),h=t(n,e))for(p=n.children,s=a=0,u=p.length;u>a;s=++a)i=p[s],v(t,e,i,r+" ",o);return null},d=function(){var t;return t=+new Date,function(e){var n;return n=+new Date-t,console.log(e,n+" ms"),n}},e.exports=v,e.exports=h},{"../../vendor/glsl-parser":219,"../../vendor/glsl-tokenizer":223,"./constants":199,"./decl":200}],204:[function(t,e,n){var r;r=function(){function t(e,n){this.parent=null!=n?n:null,this.id=t.id(),this.nodes=[],e&&this.add(e)}return t.index=0,t.id=function(e){return++t.index},t.IN=0,t.OUT=1,t.prototype.inputs=function(){var t,e,n,r,i,o,s,a,u;for(e=[],a=this.nodes,t=0,r=a.length;r>t;t++)for(o=a[t],u=o.inputs,n=0,i=u.length;i>n;n++)s=u[n],null===s.input&&e.push(s);return e},t.prototype.outputs=function(){var t,e,n,r,i,o,s,a,u;for(s=[],a=this.nodes,t=0,n=a.length;n>t;t++)for(i=a[t],u=i.outputs,e=0,r=u.length;r>e;e++)o=u[e],0===o.output.length&&s.push(o);return s},t.prototype.getIn=function(t){var e;return function(){var n,r,i,o;for(i=this.inputs(),o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.getOut=function(t){var e;return function(){var n,r,i,o;for(i=this.outputs(),o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.add=function(t,e){var n,r,i;{if(!t.length){if(t.graph&&!e)throw new Error("Adding node to two graphs at once");return t.graph=this,this.nodes.push(t)}for(r=0,i=t.length;i>r;r++)n=t[r],this.add(n)}},t.prototype.remove=function(t,e){var n,r,i;{if(!t.length){if(t.graph!==this)throw new Error("Removing node from wrong graph.");return e||t.disconnect(),this.nodes.splice(this.nodes.indexOf(t),1),t.graph=null}for(r=0,i=t.length;i>r;r++)n=t[r],this.remove(n)} +},t.prototype.adopt=function(t){var e,n,r;{if(!t.length)return t.graph.remove(t,!0),this.add(t,!0);for(n=0,r=t.length;r>n;n++)e=t[n],this.adopt(e)}},t}(),e.exports=r},{}],205:[function(t,e,n){n.Graph=t("./graph"),n.Node=t("./node"),n.Outlet=t("./outlet"),n.IN=n.Graph.IN,n.OUT=n.Graph.OUT},{"./graph":204,"./node":206,"./outlet":207}],206:[function(t,e,n){var r,i,o;r=t("./graph"),o=t("./outlet"),i=function(){function t(e,n){this.owner=e,this.graph=null,this.inputs=[],this.outputs=[],this.all=[],this.outlets=null,this.id=t.id(),this.setOutlets(n)}return t.index=0,t.id=function(e){return++t.index},t.prototype.getIn=function(t){var e;return function(){var n,r,i,o;for(i=this.inputs,o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.getOut=function(t){var e;return function(){var n,r,i,o;for(i=this.outputs,o=[],n=0,r=i.length;r>n;n++)e=i[n],e.name===t&&o.push(e);return o}.call(this)[0]},t.prototype.get=function(t){return this.getIn(t)||this.getOut(t)},t.prototype.setOutlets=function(t){var e,n,r,i,s,a,u,h,l,c,p,f;if(null!=t){if(null==this.outlets){for(this.outlets={},r=0,u=t.length;u>r;r++)p=t[r],p instanceof o||(p=o.make(p)),this._add(p);return}for(n=function(t){return[t.name,t.inout,t.type].join("-")},c={},i=0,h=t.length;h>i;i++)p=t[i],c[n(p)]=!0;f=this.outlets;for(a in f)p=f[a],a=n(p),c[a]?c[a]=p:this._remove(p);for(s=0,l=t.length;l>s;s++)p=t[s],e=c[n(p)],e instanceof o?this._morph(e,p):(p instanceof o||(p=o.make(p)),this._add(p))}return this.outlets},t.prototype.connect=function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b;for(d={},s={},b=function(t){return _+"/"+t.hint},m=t.inputs,a=0,l=m.length;l>a;a++)r=m[a],(n||!r.input)&&(_=r.type,o=b(r),s[o]||(s[o]=r),d[_]=f=d[_]||[],f.push(r));for(y=this.outputs,y=y.filter(function(t){return!(e&&t.output.length)}),v=y.slice(),u=0,c=v.length;c>u;u++)E=v[u],_=E.type,o=b(E),i=d[_],(r=s[o])&&(E.connect(r),delete s[o],i.splice(i.indexOf(r),1),y.splice(y.indexOf(E),1));if(!y.length)return this;for(g=y.slice(),h=0,p=g.length;p>h;h++)E=g[h],_=E.type,i=d[_],i&&i.length&&E.connect(i.shift());return this},t.prototype.disconnect=function(t){var e,n,r,i,o,s,a;for(s=this.inputs,e=0,r=s.length;r>e;e++)o=s[e],o.disconnect();for(a=this.outputs,n=0,i=a.length;i>n;n++)o=a[n],o.disconnect();return this},t.prototype._key=function(t){return[t.name,t.inout].join("-")},t.prototype._add=function(t){var e;if(e=this._key(t),t.node)throw new Error("Adding outlet to two nodes at once.");if(this.outlets[e])throw new Error("Adding two identical outlets to same node. ("+e+")");return t.node=this,t.inout===r.IN&&this.inputs.push(t),t.inout===r.OUT&&this.outputs.push(t),this.all.push(t),this.outlets[e]=t},t.prototype._morph=function(t,e){var n;return n=this._key(e),delete this.outlets[n],t.morph(e),n=this._key(e),this.outlets[n]=e},t.prototype._remove=function(t){var e,n;if(n=this._key(t),e=t.inout,t.node!==this)throw new Error("Removing outlet from wrong node.");return t.disconnect(),t.node=null,delete this.outlets[n],t.inout===r.IN&&this.inputs.splice(this.inputs.indexOf(t),1),t.inout===r.OUT&&this.outputs.splice(this.outputs.indexOf(t),1),this.all.splice(this.all.indexOf(t),1),this},t}(),e.exports=i},{"./graph":204,"./outlet":207}],207:[function(t,e,n){var r,i;r=t("./graph"),i=function(){function t(e,n,r,i,o,s){this.inout=e,this.name=n,this.hint=r,this.type=i,this.meta=null!=o?o:{},this.id=s,null==this.hint&&(this.hint=t.hint(this.name)),this.node=null,this.input=null,this.output=[],null==this.id&&(this.id=t.id(this.hint))}return t.make=function(e,n){var r,i,o,s;if(null==n&&(n={}),i=n,null!=e.meta){o=e.meta;for(r in o)s=o[r],i[r]=s}return new t(e.inout,e.name,e.hint,e.type,i)},t.index=0,t.id=function(e){return"_io_"+ ++t.index+"_"+e},t.hint=function(t){return t=t.replace(/^_io_[0-9]+_/,""),t=t.replace(/_i_o$/,""),t=t.replace(/(In|Out|Inout|InOut)$/,"")},t.prototype.morph=function(t){return this.inout=t.inout,this.name=t.name,this.hint=t.hint,this.type=t.type,this.meta=t.meta},t.prototype.dupe=function(e){var n;return null==e&&(e=this.id),n=t.make(this),n.name=e,n},t.prototype.connect=function(t){if(this.inout===r.IN&&t.inout===r.OUT)return t.connect(this);if(this.inout!==r.OUT||t.inout!==r.IN)throw new Error("Can only connect out to in.");if(t.input!==this)return t.disconnect(),t.input=this,this.output.push(t)},t.prototype.disconnect=function(t){var e,n,r,i;if(this.input&&this.input.disconnect(this),this.output.length){if(!t){for(i=this.output,e=0,r=i.length;r>e;e++)t=i[e],t.input=null;return this.output=[]}if(n=this.output.indexOf(t),n>=0)return this.output.splice(n,1),t.input=null}},t}(),e.exports=i},{"./graph":204}],208:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m;r=t("./block"),i=t("./factory"),o=t("./glsl"),s=t("./graph"),a=t("./linker"),l=t("./visualize"),f=i.library,c=i.cache,m=l.visualize,p=l.inspect,h=a.Snippet,d=function(t,e){var n,r,i,o;null==e&&(e={}),r={};for(n in t)o=t[n],r[n]=null!=(i=e[n])?i:t[n];return r},u=function(){function t(e,n){var r;return this instanceof t?(r={globalUniforms:!1,globalVaryings:!0,globalAttributes:!0,globals:[],autoInspect:!1},this.config=d(r,n),void(this.fetch=c(f(o,e,h.load)))):new t(e,n)}return t.prototype.shader=function(t){var e;return null==t&&(t={}),e=d(this.config,t),new i.Factory(o,this.fetch,e)},t.prototype.material=function(t){return new i.Material(this.shader(t),this.shader(t))},t.prototype.inspect=function(e){return t.inspect(e)},t.prototype.visualize=function(e){return t.visualize(e)},t.Block=r,t.Factory=i,t.GLSL=o,t.Graph=s,t.Linker=a,t.Visualize=l,t.inspect=function(t){return p(t)},t.visualize=function(t){return m(t)},t}(),e.exports=u,"undefined"!=typeof window&&(window.ShaderGraph=u)},{"./block":188,"./factory":194,"./glsl":202,"./graph":205,"./linker":210,"./visualize":216}],209:[function(t,e,n){var r,i,o;r=t("../graph"),i=t("./priority"),o=function(t,e,n,o){var s,a,u,h,l,c,p,f,d,m,v,g,E,y;return h=t.generate,u={},g=[],E={},y={},a={},f={},m=function(){var t,r,s,c,p,d,m,_,b;for(d in o)m=o[d],v(m.node,m.module);return _=l(n),t=_[0],n=_[1],null!=e&&(t.entry=e),p=h.build(t,n),b=function(){var t;t=[];for(d in f)c=f[d],t.push(c);return t}().sort(function(t,e){return i.compare(t.priority,e.priority)}),s=b.map(function(t){return t.code}),s.push(p.code),r=h.lines(s),{namespace:p.name,library:f,body:p.code,code:r,main:p,entry:p.name,symbols:g,externals:u,uniforms:E,varyings:y,attributes:a}},l=function(t){return function(t){var e,n,r,i,o,s;for(t=function(){var e;e=[];for(s in t)n=t[s],e.push(n);return e}(),t.sort(function(t,e){return e.priority-t.priority}),r=function(t,n,r){var i,o,s,a;return c(t,n,r),a=n.main,s=n.entry,o=function(e){return d(t,e)},i=function(e){return p(t,e)},h.call(o,i,s,a.signature,e)},e=h.body(),i=0,o=t.length;o>i;i++)n=t[i],r(n.node,n.module,n.priority);return[e,t]}}(this),s=function(t,e,n){var r;return r=f[t],null!=r?r.priority=i.max(r.priority,n):f[t]={code:e,priority:n}},c=function(t,e,n){var r,o,u,h,l,c,p,f;n=i.make(n),l=e.library;for(h in l)u=l[h],s(h,u.code,i.nest(n,u.priority));s(e.namespace,e.body,n),c=e.uniforms;for(o in c)r=c[o],E[o]=r;p=e.varyings;for(o in p)r=p[o],y[o]=r;f=e.attributes;for(o in f)r=f[o],a[o]=r;return v(t,e)},v=function(t,e){var n,r,i,o,s,a,h,l,c;for(h=e.symbols,l=[],i=0,a=h.length;a>i;i++)if(s=h[i],r=e.externals[s],p(t,r.name)){n={};for(o in r)c=r[o],n[o]=c;n.name=d(t,r.name),u[s]=n,l.push(g.push(s))}else l.push(void 0);return l},p=function(t,e){var n;return n=t.get(e),n.inout===r.IN?null===n.input:n.inout===r.OUT?0===n.output.length:void 0},d=function(t,e){var n;return(n=t.get(e))?(n.input&&(n=n.input),e=n.name,n.id):null},m()},e.exports=o},{"../graph":205,"./priority":213}],210:[function(t,e,n){n.Snippet=t("./snippet"),n.Program=t("./program"),n.Layout=t("./layout"),n.assemble=t("./assemble"),n.link=t("./link"),n.priority=t("./priority"),n.load=n.Snippet.load},{"./assemble":209,"./layout":211,"./link":212,"./priority":213,"./program":214,"./snippet":215}],211:[function(t,e,n){var r,i,o,s;i=t("./snippet"),s=t("./link"),o=!1,r=function(){function t(t,e){this.language=t,this.graph=e,this.links=[],this.includes=[],this.modules={},this.visits={}}return t.prototype.callback=function(t,e,n,r,i){return this.links.push({node:t,module:e,priority:n,name:r,external:i})},t.prototype.include=function(t,e,n){var r;return null!=(r=this.modules[e.namespace])?r.priority=Math.max(n,r.priority):(this.modules[e.namespace]=!0,this.includes.push({node:t,module:e,priority:n}))},t.prototype.visit=function(t){return o&&console.log("Visit",t,!this.visits[t]),this.visits[t]?!1:this.visits[t]=!0},t.prototype.link=function(t){var e,n,r;e=s(this.language,this.links,this.includes,t),r=new i;for(n in e)r[n]=e[n];return r.graph=this.graph,r},t}(),e.exports=r},{"./link":212,"./snippet":215}],212:[function(t,e,n){var r,i,o;r=t("../graph"),i=t("./priority"),o=function(t,e,n,o){var s,a,u,h,l,c,p,f,d,m,v,g;return h=t.generate,c=[],m=[],u={},v={},a={},g={},f={},d=function(){var t,r,s,p,d,m,E,y,_,b;for(s=h.links(e),p=[],null!=s.defs&&p.push(s.defs),null!=s.bodies&&p.push(s.bodies),d=0,m=n.length;m>d;d++)y=n[d],l(y.node,y.module,y.priority);return b=function(){var t;t=[];for(_ in f)E=f[_],t.push(E);return t}().sort(function(t,e){return i.compare(t.priority,e.priority)}),c=b.map(function(t){return t.code}),t=h.lines(c),t=h.defuse(t),p.length&&(t=[h.lines(p),t].join("\n")),t=h.hoist(t),t=h.dedupe(t),r=o,{namespace:r.main.name,code:t,main:r.main,entry:r.main.name,externals:u,uniforms:v,attributes:a,varyings:g}},s=function(t,e,n){var r;return r=f[t],null!=r?r.priority=i.max(r.priority,n):f[t]={code:e,priority:n}},l=function(t,e,n){var r,o,h,l,c,f,d,E,y,_,b,T,x;n=i.make(n),E=e.library;for(d in E)f=E[d],s(d,f.code,i.nest(n,f.priority));s(e.namespace,e.body,n),y=e.uniforms;for(l in y)r=y[l],v[l]=r;_=e.varyings;for(l in _)r=_[l],g[l]=r;b=e.attributes;for(l in b)r=b[l],a[l]=r;for(T=e.symbols,x=[],h=0,c=T.length;c>h;h++)l=T[h],o=e.externals[l],p(t,o.name)?(u[l]=o,x.push(m.push(l))):x.push(void 0);return x},p=function(t,e){var n,i,o,s;if(i=t.get(e),!i)throw n=null!=(o=null!=(s=t.owner.snippet)?s._name:void 0)?o:t.owner.namespace,new Error("Unable to link program. Unlinked callback `"+e+"` on `"+n+"`");return i.inout===r.IN?null===i.input:i.inout===r.OUT?0===i.output.length:void 0},d()},e.exports=o},{"../graph":205,"./priority":213}],213:[function(t,e,n){n.make=function(t){var e;return null==t&&(t=[]),t instanceof Array||(t=[null!=(e=+t)?e:0]),t},n.nest=function(t,e){return t.concat(e)},n.compare=function(t,e){var n,r,i,o,s,a;for(i=Math.min(t.length,e.length),n=r=0,a=i;a>=0?a>r:r>a;n=a>=0?++r:--r){if(o=t[n],s=e[n],o>s)return-1;if(s>o)return 1}return t=t.length,e=e.length,t>e?-1:e>t?1:0},n.max=function(t,e){return n.compare(t,e)>0?e:t}},{}],214:[function(t,e,n){var r,i,o;i=t("./snippet"),o=t("./assemble"),r=function(){function t(t,e,n){this.language=t,this.namespace=e,this.graph=n,this.calls={},this.requires={}}return t.index=0,t.entry=function(){return"_pg_"+ ++t.index+"_"},t.prototype.call=function(t,e,n){var r,i;return i=e.namespace,(r=this.calls[i])?r.priority=Math.max(r.priority,n):this.calls[i]={node:t,module:e,priority:n},this},t.prototype.require=function(t,e){var n;return n=e.namespace,this.requires[n]={node:t,module:e}},t.prototype.assemble=function(){var e,n,r,s;e=o(this.language,null!=(r=this.namespace)?r:t.entry,this.calls,this.requires),s=new i;for(n in e)s[n]=e[n];return s.graph=this.graph,s},t}(),e.exports=r},{"./assemble":209,"./snippet":215}],215:[function(t,e,n){var r;r=function(){function t(t,e,n,r,i){var o;this.language=t,this._signatures=e,this._compiler=n,this._name=r,this._original=i,this.namespace=null,this.code=null,this.main=null,this.entry=null,this.uniforms=null,this.externals=null,this.symbols=null,this.attributes=null,this.varyings=null,this.language||delete this.language,this._signatures||delete this._signatures,this._compiler||delete this._compiler,this._original||delete this._original,this._name||(this._name=null!=(o=this._signatures)?o.main.name:void 0)}return t.index=0,t.namespace=function(){return"_sn_"+ ++t.index+"_"},t.load=function(e,n,r){var i,o,s,a;return o=e.parse(n,r),s=e.compile(o),a=s[0],i=s[1],new t(e,a,i,n,r)},t.prototype.clone=function(){return new t(this.language,this._signatures,this._compiler,this._name,this._original)},t.prototype.bind=function(e,n,r,i){var o,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P,L,z,O,D,F,U,B,N,V,I,j,G;if(n===""+n?(L=[n,null!=r?r:{},null!=i?i:{}],r=L[0],n=L[1],i=L[2]):r!==""+r&&(z=[null!=r?r:{},void 0],i=z[0],r=z[1]),this.main=this._signatures.main,this.namespace=null!=(O=null!=r?r:this.namespace)?O:t.namespace(),this.entry=this.namespace+this.main.name,this.uniforms={},this.varyings={},this.attributes={},this.externals={},this.symbols=[],d={},f={},m=function(t){return f[t]=!0,t},M=function(t){return function(e){return t.namespace+e}}(this),e.globals)for(D=e.globals,v=0,b=D.length;b>v;v++)y=D[v],m(y);for(a=e.globalUniforms?m:M,u=e.globalVaryings?m:M,o=e.globalAttributes?m:M,s=M,G=function(t){return function(t){return d[t.name]=!0}}(this),I=function(t){return function(e,n){return t.uniforms[a(null!=n?n:e.name)]=e}}(this),j=function(t){return function(e){return t.varyings[u(e.name)]=e}}(this),h=function(t){return function(e){return t.attributes[o(e.name)]=e}}(this),p=function(t){return function(e){var n;return n=s(e.name),t.externals[n]=e,t.symbols.push(n)}}(this),P=function(t){return{type:t.type,name:t.name,value:t.value}},F=this._signatures.uniform,g=0,T=F.length;T>g;g++)l=F[g],G(l);for(U=this._signatures.uniform,_=0,x=U.length;x>_;_++)l=U[_],I(P(l));for(B=this._signatures.varying,S=0,w=B.length;w>S;S++)l=B[S],j(P(l));for(N=this._signatures.external,k=0,R=N.length;R>k;k++)l=N[k],p(l);for(V=this._signatures.attribute,C=0,H=V.length;H>C;C++)l=V[C],h(P(l));for(A in n)l=n[A],d[A]&&I(l,A);return this.body=this.code=this._compiler(this.namespace,f,i),i&&(c=function(){var t;t=[];for(E in i)j=i[E],t.push("#define "+E+" "+j);return t}().join("\n"),c.length&&(this._original=[c,"//----------------------------------------",this._original].join("\n"))),null},t}(),e.exports=r},{}],216:[function(t,e,n){var r,i,o,s,a,u;r=t("../Graph").Graph,n.serialize=a=t("./serialize"),n.markup=i=t("./markup"),u=function(t){var e;if(t)return t.nodes?(e=a(t),i.process(e)):t},s=function(t){return null==t?t:t instanceof Array?t.map(s):null!=t.vertex&&null!=t.fragment?[s(t.vertex,s(t.fragment))]:null!=t._graph?t._graph:null!=t.graph?t.graph:t},o=function(t){var e,n,r,i;for(i=[],n=0,r=t.length;r>n;n++)e=t[n],e instanceof Array?i=i.concat(o(e)):null!=e&&i.push(e);return i},n.visualize=function(){var t,e;return e=o(s([].slice.call(arguments))),i.merge(function(){var n,r,i;for(i=[],n=0,r=e.length;r>n;n++)t=e[n],t&&i.push(u(t));return i}())},n.inspect=function(){var t,e,r,o,s,a;for(t=n.visualize.apply(null,arguments),r=i.overlay(t),a=document.querySelectorAll(".shadergraph-overlay"),o=0,s=a.length;s>o;o++)e=a[o],e.remove();return document.body.appendChild(r),t.update(),r}},{"../Graph":182,"./markup":217,"./serialize":218}],217:[function(t,e,n){var r,i,o,s,a,u,h,l,c,p,f,d,m,v,g,E;h=t("../factory/hash"),g=function(t){return(""+t).replace(/^\s+|\s+$/g,"")},a=function(t,e,n,r){return"rgba("+[t,e,n,r].join(", ")+")"},l=function(t,e){var n,r,i,o,s,u,l;return null==e&&(e=1),r=1193046^h(t),l=255&r,i=r>>>8&255,n=r>>>16&255,o=Math.max(l,i,n),u=140/o,s=Math.round(o/3),l=Math.min(255,Math.round(u*Math.max(l,s))),i=Math.min(255,Math.round(u*Math.max(i,s))),n=Math.min(255,Math.round(u*Math.max(n,s))),a(l,i,n,e)},u=function(t){return t=null!=t?t:"",t.replace(/&/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},m=function(t){var e,n;return n=[],e=i(t,n),e.update=function(){return s(e,n)},r(e),e},r=function(t){var e,n,r,i,o;for(n=t.querySelectorAll(".shadergraph-code"),o=[],r=0,i=n.length;i>r;r++)e=n[r],o.push(function(){var t;return t=e,t.parentNode.classList.add("shadergraph-has-code"),t.parentNode.addEventListener("click",function(e){return t.style.display={block:"none",none:"block"}[t.style.display||"none"]})}());return o},o=function(t){var e,n,r,i,o,s,a,u,h,l,c,p,f,d,m;for(c={},u={},f=t.nodes,e=0,i=f.length;i>e;e++)l=f[e],c[l.id]=l;for(d=t.links,n=0,o=d.length;o>n;n++)a=d[n],null==u[h=a.from]&&(u[h]=[]),u[a.from].push(a);for(p=function(t,e){var n,r,i,o;if(null==e&&(e=0),t.depth=Math.max(null!=(o=t.depth)?o:0,e),i=u[t.id])for(n=0,r=i.length;r>n;n++)a=i[n],p(c[a.to],e+1);return null},m=t.nodes,r=0,s=m.length;s>r;r++)l=m[r],null==l.depth&&p(l);return null},i=function(t,e){var n,r,s,a,h,c,p,f,d,m,v,E,y,_,b,T,x,w,R,H,M,S,k,A,C,P;for(o(t),P=document.createElement("div"),P.classList.add("shadergraph-graph"),c=[],M={},S=t.nodes,f=0,E=S.length;E>f;f++){for(R=S[f],r=document.createElement("div"),r.classList.add("shadergraph-node"),r.classList.add("shadergraph-node-"+R.type),r.innerHTML='
'+u(R.name)+"
",n=function(t,e){var n,i;return n=l(t.type),i=document.createElement("div"),i.classList.add("shadergraph-outlet"),i.classList.add("shadergraph-outlet-"+e),i.innerHTML='
\n
'+u(t.type)+'
\n
'+u(t.name)+"
",r.appendChild(i),M[t.id]=i.querySelector(".shadergraph-point")},k=R.inputs,d=0,y=k.length;y>d;d++)H=k[d],n(H,"in");for(A=R.outputs,m=0,_=A.length;_>m;m++)H=A[m],n(H,"out");null!=R.graph?r.appendChild(i(R.graph,e)):(s=document.createElement("div"),s.classList.add("shadergraph-clear"),r.appendChild(s)),null!=R.code&&(p=document.createElement("div"),p.classList.add("shadergraph-code"),p.innerHTML=u(g(R.code)),r.appendChild(p)),h=c[R.depth],null==h&&(h=document.createElement("div"),h.classList.add("shadergraph-column"),c[R.depth]=h),h.appendChild(r)}for(v=0,b=c.length;b>v;v++)h=c[v],null!=h&&P.appendChild(h);for(C=t.links,w=0,T=C.length;T>w;w++)x=C[w],a=l(x.type),e.push({color:a,out:M[x.out],"in":M[x["in"]]});return P},v=function(t){return t*t},d=function(t,e,n,r){var i,o,s,a,u,h,l,c;return o=n-t,s=r-e,i=Math.sqrt(v(o)+v(s)),c=Math.abs(s)>Math.abs(o),c?(h=(t+n)/2,l=(e+r)/2,a=s>0?.3:-.3,u=Math.min(Math.abs(o)/2,20+i/8),["M",t,e,"C",t+u,e+",",h,l-i*a,h,l,"C",h,l+i*a,n-u,r+",",n,r].join(" ")):(u=Math.min(Math.abs(o)/2.5,20+i/4),["M",t,e,"C",t+u,e+",",n-u,r+",",n,r].join(" "))},c=function(t){return null==t&&(t="svg"),document.createElementNS("http://www.w3.org/2000/svg",t)},s=function(t,e){var n,r,i,o,s,a,u,h,l,p,f,m;if(null!=t.parentNode){for(f=t.getBoundingClientRect(),s=0,u=e.length;u>s;s++)p=e[s],n=p.out.getBoundingClientRect(),r=p["in"].getBoundingClientRect(),p.coords={x1:(n.left+n.right)/2-f.left,y1:(n.top+n.bottom)/2-f.top,x2:(r.left+r.right)/2-f.left,y2:(r.top+r.bottom)/2-f.top};for(m=t.querySelector("svg"),null!=m&&t.removeChild(m),i=t;i.parentNode&&0===i.offsetHeight;)i=i.parentNode;for(m=c(),m.setAttribute("width",i.offsetWidth),m.setAttribute("height",i.offsetHeight),a=0,h=e.length;h>a;a++)p=e[a],o=p.coords,l=c("path"),l.setAttribute("d",d(o.x1,o.y1,o.x2,o.y2)),l.setAttribute("stroke",p.color),l.setAttribute("stroke-width",3),l.setAttribute("fill","transparent"),m.appendChild(l);return t.appendChild(m)}},f=function(t){var e,n,r,i;return n=document.createElement("div"),n.setAttribute("class","shadergraph-overlay"),e=document.createElement("div"),e.setAttribute("class","shadergraph-close"),e.innerHTML="×",i=document.createElement("div"),i.setAttribute("class","shadergraph-view"),r=document.createElement("div"),r.setAttribute("class","shadergraph-inside"),r.appendChild(t),i.appendChild(r),n.appendChild(i),n.appendChild(e),e.addEventListener("click",function(){return n.parentNode.removeChild(n)}),n},E=function(t){var e;return t instanceof Node?t:(e=document.createElement("span"),e.innerText=null!=t?t:"",e)},p=function(t){var e,n,r,i;if(1!==t.length){for(e=document.createElement("div"),r=0,i=t.length;i>r;r++)n=t[r],e.appendChild(E(n));return e.update=function(){var e,r,i;for(i=[],e=0,r=t.length;r>e;e++)n=t[e],i.push("function"==typeof n.update?n.update():void 0);return i},e}return E(t[0])},e.exports={process:m,merge:p,overlay:f}},{"../factory/hash":193}],218:[function(t,e,n){var r,i,o;r=t("../block"),i=function(t){return"("===t.type[0]},o=function(t){var e,n,i,s,a,u,h,l,c,p,f,d,m,v,g,E,y,_,b,T,x,w,R;for(v=[],d=[],b=t.nodes,i=0,l=b.length;l>i;i++){for(m=b[i],_={id:m.id,name:null,type:null,depth:null,graph:null,inputs:[],outputs:[]},v.push(_),s=_.inputs,y=_.outputs,e=m.owner,e instanceof r.Call?(_.name=e.snippet._name,_.type="call",_.code=e.snippet._original):e instanceof r.Callback?(_.name="Callback",_.type="callback",_.graph=o(e.graph)):e instanceof r.Isolate?(_.name="Isolate",_.type="isolate",_.graph=o(e.graph)):e instanceof r.Join?(_.name="Join",_.type="join"):null!=e&&(null==_.name&&(_.name=null!=(T=e.name)?T:e.type),null==_.type&&(_.type=e.type),null==_.code&&(_.code=e.code),null!=e.graph&&(_.graph=o(e.graph))),n=function(t){return t=t.replace(")(",")→("),t=t.replace("()","")},x=m.inputs,a=0,c=x.length;c>a;a++)E=x[a],s.push({id:E.id,name:E.name,type:n(E.type),open:null==E.input});for(w=m.outputs,u=0,p=w.length;p>u;u++)for(E=w[u],y.push({id:E.id,name:E.name,type:n(E.type),open:!E.output.length}),R=E.output,h=0,f=R.length;f>h;h++)g=R[h],d.push({from:m.id,out:E.id,to:g.node.id,"in":g.id,type:n(E.type)})}return{nodes:v,links:d}},e.exports=o},{"../block":188}],219:[function(t,e,n){e.exports=t("./lib/index")},{"./lib/index":221}],220:[function(t,e,n){function r(){return this}function i(t,e){var n=E[t];return e=e||0,n?e>n.lbp&&(n.lbp=e):(n=Object.create(g),n.id=t,n.lbp=e,E[t]=n),n}function o(t){var e,n=d;for(c(),e=n.nud();t=m.length)return void(d=E["(end)"]);if(e=m[v++],n=e.data,i=e.type,"ident"===i)o=f.scope.find(n)||f.create_node(),i=o.type;else if("builtin"===i)o=E["(builtin)"];else if("keyword"===i)o=E["(keyword)"];else if("operator"===i){if(o=E[n],!o)return f.unexpected("unknown operator `"+n+"`")}else{if("float"!==i&&"integer"!==i)return f.unexpected("unexpected token.");i="literal",o=E["(literal)"]}return o&&(o.nud||(o.nud=r),o.children||(o.children=[])),o=Object.create(o),o.token=e,o.type=i,o.data||(o.data=n),d=o}function p(t){return function(){return f.unexpected(t)}}var f,d,m,v,g={nud:function(){return this.children&&this.children.length?this:p("unexpected")()},led:p("missing operator")},E={};i("(ident)").nud=r,i("(keyword)").nud=r,i("(builtin)").nud=r,i("(literal)").nud=r,i("(end)"),i(":"),i(";"),i(","),i(")"),i("]"),i("}"),a("&&",30),a("||",30),s("|",43),s("^",44),s("&",45),s("==",46),s("!=",46),s("<",47),s("<=",47),s(">",47),s(">=",47),s(">>",48),s("<<",48),s("+",50),s("-",50),s("*",60),s("/",60),s("%",60),s("?",20,function(t){return this.children=[t,o(0),(c(":"),o(0))],this.type="ternary",this}),s(".",80,function(t){return d.type="literal",f.fake(d),this.children=[t,d],c(),this}),s("[",80,function(t){return this.children=[t,o(0)],this.type="binary",c("]"),this}),s("(",80,function(t){if(this.children=[t],this.type="call",")"!==d.data)for(;;){if(this.children.push(o(0)),","!==d.data)break;c(",")}return c(")"),this}),u("-"),u("+"),u("!"),u("~"),u("defined"),u("(",function(){return this.type="group",this.children=[o(0)],c(")"),this}),u("++"),u("--"),h("++"),h("--"),l("="),l("+="),l("-="),l("*="),l("/="),l("%="),l("&="),l("|="),l("^="),l(">>="),l("<<="),e.exports=function(t,e){function n(t){f.unshift(t,!1);for(var e=0,r=t.children.length;r>e;++e)n(t.children[e]);f.shift()}f=t,m=e,v=0;var r;if(m.length){if(c(),r=o(0),r.parent=f[0],n(r),v1?void ht("unexpected EOF"):void qt.emit("end")}function n(){return Qt||!Yt.length?!1:(Ct=Zt[0])&&!qt.paused}function r(t){Yt.unshift(t),Yt.shift()}function f(t,e){t.parent=Yt[0];var n=[].unshift.call(this,t);if(e=void 0===e?!0:e,p){for(var r="",i=0,o=this.length-1;o>i;++i)r+=" |";console.log(r,"\\"+t.type,t.token.data)}return e&&Pt!==t&&Pt.children.push(t),Pt=t,n}function M(){var t=[].shift.call(this),e=Xt[this.length],n=!1;if(p){for(var r="",i=0,o=this.length;o>i;++i)r+=" |";console.log(r,"/"+t.type)}return Xt.length?"function"==typeof Xt[0]?n=Xt[0](t):void 0!==e&&(n=e.test?e.test(t.type):e===t.type):n=!0,n&&qt.emit("data",t),Pt=t.parent,t}function S(){function t(){if(Ct.data===Yt[0].expecting)return Yt.scope.exit(),Yt.shift();switch(Ct.type){case"preprocessor":return Yt.fake(it()),void Zt.shift();default:return void Yt.unshift(zt())}}return pt(function(){return Yt.scope.enter(),c},t)()}function N(){if(Yt[0].brace)return"}"!==Ct.data?ht("expected `}`, got "+Ct.data):(Yt[0].brace=!1,Zt.shift(),Yt.shift());switch(Ct.type){case"eof":return Yt.shift();case"keyword":switch(Ct.data){case"for":return Yt.unshift(Nt());case"if":return Yt.unshift(Vt());case"while":return Yt.unshift(It());case"do":return Yt.unshift(Gt());case"break":return Yt.fake(i(P,Ct)),Zt.shift();case"continue":return Yt.fake(i(L,Ct)),Zt.shift();case"discard":return Yt.fake(i(z,Ct)),Zt.shift();case"return":return Yt.unshift(jt());case"precision":return Yt.unshift(Dt())}return Yt.unshift(ot(W));case"ident":var t;if(t=Yt.scope.find(Ct.data))return"struct"===t.parent.type?Yt.unshift(ot(W)):Yt.unshift(at(";"));case"operator":if("{"===Ct.data){Yt[0].brace=!0;var e=Lt();return e.expecting="}",Zt.shift(),Yt.unshift(e)}if(";"===Ct.data)return Zt.shift(),Yt.shift();default:return Yt.unshift(at(";"))}}function Q(){function t(){return"invariant"===Ct.data?d.flags&V?(Yt.unshift(ut()),c):ht("`invariant` is not allowed here"):(Yt.fake(i(D,{data:"",position:Ct.position})),c)}function e(){return o(Ct)?d.flags&I?(Yt.unshift(ut()),c):ht("storage is not allowed here"):(Yt.fake(i(D,{data:"",position:Ct.position})),c)}function n(){return s(Ct)?d.flags&j?ht("parameter is not allowed here"):(Yt.unshift(ut()),c):(Yt.fake(i(D,{data:"",position:Ct.position})),c)}function r(){return a(Ct)?(Yt.unshift(ut()),c):(Yt.fake(i(D,{data:"",position:Ct.position})),c)}function u(){if("struct"===Ct.data)return d.flags&G?(Yt.unshift(st()),c):ht("cannot nest structs");if("keyword"===Ct.type)return Yt.unshift(ut()),c;var t=Yt.scope.find(Ct.data);return t?(Yt.fake(Object.create(t)),Zt.shift(),c):ht("expected user defined type, struct or keyword, got "+Ct.data)}function h(){return","!==Ct.data||d.flags&B?"["===Ct.data?void Yt.unshift(Wt()):")"===Ct.data?Yt.shift():";"===Ct.data?d.stage+3:"ident"!==Ct.type?(console.log(Ct),ht("expected identifier, got "+Ct.data)):(d.collected_name=Zt.shift(),c):Yt.shift()}function l(){return"("===Ct.data?(Zt.unshift(d.collected_name),delete d.collected_name,Yt.unshift(Ut()),d.stage+2):c}function p(){return Zt.unshift(d.collected_name),delete d.collected_name,Yt.unshift(Ot()),c}function f(){return Yt.shift()}var d=Yt[0];return pt(t,e,n,r,u,h,l,p,f)()}function J(){if("ident"===Ct.type){var t=Ct.data;return Yt.unshift(Ft()),void Yt.scope.define(t)}if("operator"===Ct.type){if(","===Ct.data)return Yt[1].flags&B?Zt.shift():Yt.shift();if("="===Ct.data)return Yt[1].flags&U?(Zt.shift(),void Yt.unshift(at(",",";"))):ht("`=` is not allowed here.");if("["===Ct.data)return void Yt.unshift(Wt())}return Yt.shift()}function $(){return"keyword"===Ct.type?(Yt[0].type="keyword",void(Yt[0].mode=k)):"ident"===Ct.type?(Yt[0].type="ident",void(Yt[0].mode=d)):ht("expected keyword or user-defined name, got "+Ct.data)}function tt(){return"keyword"!==Ct.type?ht("expected keyword, got "+Ct.data):(Yt.shift(),Zt.shift())}function et(){return"ident"!==Ct.type?ht("expected user-defined name, got "+Ct.data):(Yt[0].data=Ct.data,Yt.shift(),Zt.shift())}function nt(){function t(t){return h(Yt,t),Yt.shift()}var e=Yt[0].expecting;if(Yt[0].tokens=Yt[0].tokens||[],void 0===Yt[0].parenlevel&&(Yt[0].parenlevel=0,Yt[0].bracelevel=0),Yt[0].parenlevel<1&&e.indexOf(Ct.data)>-1)return t(Yt[0].tokens);switch("("===Ct.data?++Yt[0].parenlevel:")"===Ct.data&&--Yt[0].parenlevel,Ct.data){case"{":++Yt[0].bracelevel;break;case"}":--Yt[0].bracelevel;break;case"(":++Yt[0].parenlevel;break;case")":--Yt[0].parenlevel}return Yt[0].parenlevel<0?ht("unexpected `)`"):Yt[0].bracelevel<0?ht("unexpected `}`"):void Yt[0].tokens.push(Zt.shift())}function rt(t){return function(){return i(t,Ct)}}function it(){return i(K[Ct.type],Ct,Pt)}function ot(t){var e=i(_,Ct,Pt);return e.flags=t,e}function st(t,e){var n=i(g,Ct,Pt);return n.allow_assign=void 0===t?!0:t,n.allow_comma=void 0===e?!0:e,n}function at(){var t=i(R,Ct,Pt);return t.expecting=[].slice.call(arguments),t}function ut(t){var e=Ct;return t&&(e={type:"(implied)",data:"(default)",position:e.position}),i(k,e,Pt)}function ht(t){Qt=!0,qt.emit("error",new Error((t||"unexpected "+Yt)+" at line "+Yt[0].token.line))}function lt(t,e){return ct(t,Ct.type)&&ct(e,Ct.data)}function ct(t,e){switch(typeof t){case"string":return e!==t&&ht("expected `"+t+"`, got "+e+"\n"+Ct.data),!Qt;case"object":return t&&-1===t.indexOf(e)&&ht("expected one of `"+t.join("`, `")+"`, got "+e),!Qt}return!0}function pt(){var t,e,n=[].slice.call(arguments);return function(){var r=Yt[0];return r.stage||(r.stage=0),(t=n[r.stage])?(e=t(),e===c?++r.stage:void(void 0!==e&&(r.stage=e))):ht("parser in undefined state!")}}function ft(t,e){return e=e||"operator",function(){if(lt(e,t)){var n=Zt.shift(),r=Yt[0].children,i=r[r.length-1];return i&&i.token&&n.preceding&&(i.token.succeeding=i.token.succeeding||[],i.token.succeeding=i.token.succeeding.concat(n.preceding)),c}}}function dt(t){return function(){return Yt.unshift(at(t)),c}}function mt(t){return t?function(){var t=Ct.data;return lt("ident")&&(Yt.unshift(Ft()),Yt.scope.define(t),c)}:function(){if(lt("ident")){var t=Object.create(Yt.scope.find(Ct.data));return t.token=Ct,Zt.shift(),c}}}function vt(){return function(){var t=Lt();return t.expecting="}",Yt.unshift(t),c}}function gt(t){return function(){var e=Yt[0].stage;return"{"!==Ct.data?(Yt.unshift(zt()),e+t):(Zt.shift(),c)}}function Et(){return function(){return Yt.shift(),Yt.shift()}}function yt(){_t=pt(ft("struct","keyword"),function(){return"{"===Ct.data?(Yt.fake(i(d,{data:"",position:Ct.position,type:"ident"})),c):mt(!0)()},function(){return Yt.scope.enter(),c},ft("{"),function(){return"}"===Ct.data?(Yt.scope.exit(),Zt.shift(),Yt.shift()):";"===Ct.data?void Zt.shift():void Yt.unshift(ot(X))}),bt=pt(function(){return Zt.shift(),c},function(){return lt("keyword",["lowp","mediump","highp"])&&(Yt.unshift(ut()),c)},function(){return Yt.unshift(ut()),c},function(){return Yt.shift()}),Tt=pt(ft("["),dt("]"),ft("]"),function(){return Yt.shift()}),xt=pt(ft("for","keyword"),ft("("),function(){var t;if("ident"===Ct.type){if((t=Yt.scope.find(Ct.data))||(t=Yt.create_node()),"struct"===t.parent.type)return Yt.unshift(ot(W)), +c}else if("builtin"===Ct.type||"keyword"===Ct.type)return Yt.unshift(ot(W)),c;return dt(";")()},ft(";"),dt(";"),ft(";"),dt(")"),ft(")"),gt(3),vt(),ft("}"),Et()),wt=pt(ft("if","keyword"),ft("("),dt(")"),ft(")"),gt(3),vt(),ft("}"),function(){return"else"===Ct.data?(Zt.shift(),Yt.unshift(zt()),c):Et()()},Et()),Rt=pt(ft("return","keyword"),function(){return";"===Ct.data?c:(Yt.unshift(at(";")),c)},function(){Zt.shift(),Et()()}),Ht=pt(ft("while","keyword"),ft("("),dt(")"),ft(")"),gt(3),vt(),ft("}"),Et()),Mt=pt(ft("do","keyword"),gt(3),vt(),ft("}"),ft("while","keyword"),ft("("),dt(")"),ft(")"),Et()),St=pt(function(){for(var t=1,e=Yt.length;e>t;++t)if(Yt[t].mode===E)return ht("function definition is not allowed within another function");return c},function(){if(lt("ident")){var t=Ct.data,e=Yt.scope.find(t);return Yt.unshift(Ft()),Yt.scope.define(t),Yt.scope.enter(e?e.scope:null),c}},ft("("),function(){return Yt.unshift(Bt()),c},ft(")"),function(){return";"===Ct.data?(Yt.scope.exit(),Yt.shift(),Yt.shift()):c},ft("{"),vt(),ft("}"),function(){return Yt.scope.exit(),c},function(){return Yt.shift(),Yt.shift(),Yt.shift()}),kt=pt(function(){return"void"===Ct.data?(Yt.fake(ut()),Zt.shift(),c):")"===Ct.data?void Yt.shift():"struct"===Ct.data?(Yt.unshift(st(Y,Z)),c):(Yt.unshift(ot(q)),c)},function(){return","===Ct.data?(Zt.shift(),0):")"===Ct.data?void Yt.shift():void ht("expected one of `,` or `)`, got "+Ct.data)})}var _t,bt,Tt,xt,wt,Rt,Ht,Mt,St,kt,At,Ct,Pt,Lt=rt(v),zt=rt(m),Ot=rt(b),Dt=rt(H),Ft=rt(d),Ut=(rt(A),rt(E)),Bt=rt(y),Nt=rt(T),Vt=rt(w),It=rt(x),jt=rt(C),Gt=rt(O),Wt=rt(F),qt=u(t,e),Xt=arguments.length?[].slice.call(arguments):[],Yt=[],Zt=[],Kt=[],Qt=!1;return Yt.shift=M,Yt.unshift=f,Yt.fake=r,Yt.unexpected=ht,Yt.scope=new l(Yt),Yt.create_node=function(){var t=i(d,Ct);return t.parent=qt.program,t},yt(),Pt=Lt(),Pt.expecting="(eof)",Pt.mode=v,Pt.token={type:"(program)",data:"(program)"},At=Pt,qt.program=At,qt.scope=function(t){return 1===arguments.length&&(Yt.scope=t),Yt.scope},Yt.unshift(Pt),qt}function i(t,e){return{mode:t,token:e,children:[],type:Q[t]}}function o(t){return"const"===t.data||"attribute"===t.data||"uniform"===t.data||"varying"===t.data}function s(t){return"in"===t.data||"inout"===t.data||"out"===t.data}function a(t){return"highp"===t.data||"mediump"===t.data||"lowp"===t.data}e.exports=r;var u=t("../../through"),h=t("./expr"),l=t("./scope"),c=new Object,p=!1,f=0,d=f++,m=f++,v=f++,g=f++,E=f++,y=f++,_=f++,b=f++,T=f++,x=f++,w=f++,R=f++,H=f++,M=f++,S=f++,k=f++,A=f++,C=f++,P=f++,L=f++,z=f++,O=f++,D=f++,F=f++,U=1,B=2,N=4,V=8,I=16,j=32,G=64,W=255,q=W&~(U|B|j|V|N),X=W&~(U|V|I|G),Y=!1,Z=!1,K={"block-comment":M,"line-comment":M,preprocessor:S},Q=f=["ident","stmt","stmtlist","struct","function","functionargs","decl","decllist","forloop","whileloop","if","expr","precision","comment","preprocessor","keyword","keyword_or_ident","return","break","continue","discard","do-while","placeholder","quantifier"]},{"../../through":227,"./expr":220,"./scope":222}],222:[function(t,e,n){function r(t){return this.constructor!==r?new r(t):(this.state=t,this.scopes=[],void(this.current=null))}e.exports=r;var i=r,o=i.prototype;o.enter=function(t){this.scopes.push(this.current=this.state[0].scope=t||{})},o.exit=function(){this.scopes.pop(),this.current=this.scopes[this.scopes.length-1]},o.define=function(t){this.current[t]=this.state[0]},o.find=function(t,e){for(var n=this.scopes.length-1;n>-1;--n)if(this.scopes[n].hasOwnProperty(t))return this.scopes[n][t];return null}},{}],223:[function(t,e,n){function r(){function t(t){t.length&&D.queue({type:T[B],data:t,position:I,line:V})}function e(t){for(F=0,W+=t.toString(),O=W.length;L=W[F],O>F;)switch(B){case l:F=H();break;case c:F=R();break;case p:F=w();break;case f:F=M();break;case d:F=A();break;case b:F=k();break;case m:F=C();break;case h:F=P();break;case y:F=x();break;case u:F=r()}U+=F,W=W.slice(F)}function n(e){N.length&&t(N.join("")),B=_,t("(eof)"),D.queue(null)}function r(){return N=N.length?[]:N,"/"===z&&"*"===L?(I=U+F-1,B=l,z=L,F+1):"/"===z&&"/"===L?(I=U+F-1,B=c,z=L,F+1):"#"===L?(B=p,I=U+F,F):/\s/.test(L)?(B=y,I=U+F,F):(j=/\d/.test(L),G=/[^\w_]/.test(L),I=U+F,B=j?d:G?f:h,F)}function x(){return"\n"===L&&++V,/[^\s]/g.test(L)?(t(N.join("")),B=u,F):(N.push(L),z=L,F+1)}function w(){return"\n"===L&&++V,"\n"===L&&"\\"!==z?(t(N.join("")),B=u,F):(N.push(L),z=L,F+1)}function R(){return w()}function H(){return"/"===L&&"*"===z?(N.push(L),t(N.join("")),B=u,F+1):("\n"===L&&++V,N.push(L),z=L,F+1)}function M(){if("."===z&&/\d/.test(L))return B=m,F;if("/"===z&&"*"===L)return B=l,F;if("/"===z&&"/"===L)return B=c,F;if("."===L&&N.length){for(;S(N););return B=m,F}if(";"===L){if(N.length)for(;S(N););return t(L),B=u,F+1}var e=2===N.length&&"="!==L;if(/[\w_\d\s]/.test(L)||e){for(;S(N););return B=u,F}return N.push(L),z=L,F+1}function S(e){for(var n,r=0,i=e.length;;){n=s.indexOf(e.slice(0,e.length+r).join(""));{if(-1!==n)return t(s[n]),I+=s[n].length,N=N.slice(s[n].length),N.length;if(r-=1,i-=1,0>i)return 0}}}function k(){return/[^a-fA-F0-9]/.test(L)?(t(N.join("")),B=u,F):(N.push(L),z=L,F+1)}function A(){return"."===L?(N.push(L),B=m,z=L,F+1):/[eE]/.test(L)?(N.push(L),B=m,z=L,F+1):"x"===L&&1===N.length&&"0"===N[0]?(B=b,N.push(L),z=L,F+1):/[^\d]/.test(L)?(t(N.join("")),B=u,F):(N.push(L),z=L,F+1)}function C(){return"f"===L&&(N.push(L),z=L,F+=1),/[eE]/.test(L)?(N.push(L),z=L,F+1):/[^\d]/.test(L)?(t(N.join("")),B=u,F):(N.push(L),z=L,F+1)}function P(){if(/[^\d\w_]/.test(L)){var e=N.join("");return B=o.indexOf(e)>-1?E:a.indexOf(e)>-1?g:v,t(N.join("")),B=u,F}return N.push(L),z=L,F+1}var L,z,O,D=i(e,n),F=0,U=0,B=u,N=[],V=1,I=0,j=!1,G=!1,W="";return D}e.exports=r;var i=t("../through"),o=t("./lib/literals"),s=t("./lib/operators"),a=t("./lib/builtins"),u=999,h=9999,l=0,c=1,p=2,f=3,d=4,m=5,v=6,g=7,E=8,y=9,_=10,b=11,T=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"../through":227,"./lib/builtins":224,"./lib/literals":225,"./lib/operators":226}],224:[function(t,e,n){e.exports=["gl_Position","gl_PointSize","gl_ClipVertex","gl_FragCoord","gl_FrontFacing","gl_FragColor","gl_FragData","gl_FragDepth","gl_Color","gl_SecondaryColor","gl_Normal","gl_Vertex","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_FogCoord","gl_MaxLights","gl_MaxClipPlanes","gl_MaxTextureUnits","gl_MaxTextureCoords","gl_MaxVertexAttribs","gl_MaxVertexUniformComponents","gl_MaxVaryingFloats","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformComponents","gl_MaxDrawBuffers","gl_ModelViewMatrix","gl_ProjectionMatrix","gl_ModelViewProjectionMatrix","gl_TextureMatrix","gl_NormalMatrix","gl_ModelViewMatrixInverse","gl_ProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverse","gl_TextureMatrixInverse","gl_ModelViewMatrixTranspose","gl_ProjectionMatrixTranspose","gl_ModelViewProjectionMatrixTranspose","gl_TextureMatrixTranspose","gl_ModelViewMatrixInverseTranspose","gl_ProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixInverseTranspose","gl_TextureMatrixInverseTranspose","gl_NormalScale","gl_DepthRangeParameters","gl_DepthRange","gl_ClipPlane","gl_PointParameters","gl_Point","gl_MaterialParameters","gl_FrontMaterial","gl_BackMaterial","gl_LightSourceParameters","gl_LightSource","gl_LightModelParameters","gl_LightModel","gl_LightModelProducts","gl_FrontLightModelProduct","gl_BackLightModelProduct","gl_LightProducts","gl_FrontLightProduct","gl_BackLightProduct","gl_FogParameters","gl_Fog","gl_TextureEnvColor","gl_EyePlaneS","gl_EyePlaneT","gl_EyePlaneR","gl_EyePlaneQ","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_ObjectPlaneR","gl_ObjectPlaneQ","gl_FrontColor","gl_BackColor","gl_FrontSecondaryColor","gl_BackSecondaryColor","gl_TexCoord","gl_FogFragCoord","gl_Color","gl_SecondaryColor","gl_TexCoord","gl_FogFragCoord","gl_PointCoord","radians","degrees","sin","cos","tan","asin","acos","atan","pow","exp","log","exp2","log2","sqrt","inversesqrt","abs","sign","floor","ceil","fract","mod","min","max","clamp","mix","step","smoothstep","length","distance","dot","cross","normalize","faceforward","reflect","refract","matrixCompMult","lessThan","lessThanEqual","greaterThan","greaterThanEqual","equal","notEqual","any","all","not","texture2D","texture2DProj","texture2DLod","texture2DProjLod","textureCube","textureCubeLod"]},{}],225:[function(t,e,n){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],226:[function(t,e,n){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],227:[function(t,e,n){var r;r=function(t,e){var n,r;return r=[],n=[],{output:r,parser:null,write:t,end:e,process:function(e,n){return this.parser=e,t(n),this.flush(),this.parser.flush()},flush:function(){return e(),[r,n]},queue:function(t){var e;return null!=t&&null!=(e=this.parser)?e.write(t):void 0},emit:function(t,e){return"data"===t&&null==e.parent&&r.push(e),"error"===t?n.push(e):void 0}}},e.exports=r},{}]},{},[30]); \ No newline at end of file diff --git a/htdocs/mathbox.css b/htdocs/mathbox.css new file mode 100644 index 0000000..dd93e59 --- /dev/null +++ b/htdocs/mathbox.css @@ -0,0 +1,461 @@ +.shadergraph-graph { + font: 12px sans-serif; + line-height: 25px; + position: relative; +} +.shadergraph-graph:after { + content: ' '; + display: block; + height: 0; + font-size: 0; + clear: both; +} +.shadergraph-graph svg { + pointer-events: none; +} +.shadergraph-clear { + clear: both; +} +.shadergraph-graph svg { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + width: auto; + height: auto; +} +.shadergraph-column { + float: left; +} +.shadergraph-node .shadergraph-graph { + float: left; + clear: both; + overflow: visible; +} +.shadergraph-node .shadergraph-graph .shadergraph-node { + margin: 5px 15px 15px; +} +.shadergraph-node { + margin: 5px 15px 25px; + background: rgba(0, 0, 0, .1); + border-radius: 5px; + box-shadow: 0 1px 2px rgba(0, 0, 0, .2), + 0 1px 10px rgba(0, 0, 0, .2); + min-height: 35px; + float: left; + clear: left; + position: relative; +} +.shadergraph-type { + font-weight: bold; +} +.shadergraph-header { + font-weight: bold; + text-align: center; + height: 25px; + background: rgba(0, 0, 0, .3); + text-shadow: 0 1px 2px rgba(0, 0, 0, .25); + color: #fff; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + margin-bottom: 5px; + padding: 0 10px; +} +.shadergraph-outlet div { +} +.shadergraph-outlet-in .shadergraph-name { + margin-right: 7px; +} +.shadergraph-outlet-out .shadergraph-name { + margin-left: 7px; +} + +.shadergraph-name { + margin: 0 4px; +} +.shadergraph-point { + margin: 6px; + width: 11px; + height: 11px; + border-radius: 7.5px; + background: rgba(255, 255, 255, 1); +} +.shadergraph-outlet-in { + float: left; + clear: left; +} +.shadergraph-outlet-in div { + float: left; +} +.shadergraph-outlet-out { + float: right; + clear: right; +} +.shadergraph-outlet-out div { + float: right; +} + +.shadergraph-node-callback { + background: rgba(205, 209, 221, .5); + box-shadow: 0 1px 2px rgba(0, 10, 40, .2), + 0 1px 10px rgba(0, 10, 40, .2); +} +.shadergraph-node-callback > .shadergraph-header { + background: rgba(0, 20, 80, .3); +} +.shadergraph-graph .shadergraph-graph .shadergraph-node-callback { + background: rgba(0, 20, 80, .1); +} + +.shadergraph-node-call { + background: rgba(209, 221, 205, .5); + box-shadow: 0 1px 2px rgba(10, 40, 0, .2), + 0 1px 10px rgba(10, 40, 0, .2); +} +.shadergraph-node-call > .shadergraph-header { + background: rgba(20, 80, 0, .3); +} +.shadergraph-graph .shadergraph-graph .shadergraph-node-call { + background: rgba(20, 80, 0, .1); +} + +.shadergraph-node-isolate { + background: rgba(221, 205, 209, .5); + box-shadow: 0 1px 2px rgba(40, 0, 10, .2), + 0 1px 10px rgba(40, 0, 10, .2); +} +.shadergraph-node-isolate > .shadergraph-header { + background: rgba(80, 0, 20, .3); +} +.shadergraph-graph .shadergraph-graph .shadergraph-node-isolate { + background: rgba(80, 0, 20, .1); +} + +.shadergraph-node.shadergraph-has-code { + cursor: pointer; +} +.shadergraph-node.shadergraph-has-code::before { + position: absolute; + content: ' '; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: none; + border: 2px solid rgba(0, 0, 0, .25); + border-radius: 5px; +} +.shadergraph-node.shadergraph-has-code:hover::before { + display: block; +} +.shadergraph-code { + z-index: 10000; + display: none; + position: absolute; + background: #fff; + color: #000; + white-space: pre; + padding: 10px; + border-radius: 5px; + box-shadow: 0 1px 2px rgba(0, 0, 0, .2), + 0 1px 10px rgba(0, 0, 0, .2); + font-family: monospace; + font-size: 10px; + line-height: 12px; +} + +.shadergraph-overlay { + position: fixed; + top: 50%; + left: 0; + right: 0; + bottom: 0; + background: #fff; + border-top: 1px solid #CCC; +} +.shadergraph-overlay .shadergraph-view { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + overflow: auto; +} +.shadergraph-overlay .shadergraph-inside { + width: 4000px; + min-height: 100%; + box-sizing: border-box; +} +.shadergraph-overlay .shadergraph-close { + position: absolute; + top: 5px; + right: 5px; + padding: 4px; + border-radius: 16px; + background: rgba(255,255,255,.3); + color: rgba(0, 0, 0, .3); + cursor: pointer; + font-size: 24px; + line-height: 24px; + width: 24px; + text-align: center; + vertical-align: middle; +} +.shadergraph-overlay .shadergraph-close:hover { + background: rgba(255,255,255,1); + color: rgba(0, 0, 0, 1); +} +.shadergraph-overlay .shadergraph-graph { + padding-top: 10px; + overflow: visible; + min-height: 100%; +} +.shadergraph-overlay span { + display: block; + padding: 5px 15px; + margin: 0; + background: rgba(0, 0, 0, .1); + font-weight: bold; + font-family: sans-serif; +} +.mathbox-loader { + position: absolute; + top: 50%; + left: 50%; + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + padding: 10px; + border-radius: 50%; + background: #fff; +} + +.mathbox-loader.mathbox-exit { + opacity: 0; + -webkit-transition: + opacity .15s ease-in-out; + transition: + opacity .15s ease-in-out; +} + +.mathbox-progress { + height: 10px; + border-radius: 5px; + width: 80px; + margin: 0 auto 20px; + box-shadow: + 1px 1px 1px rgba(255, 255, 255, .2), + 1px -1px 1px rgba(255, 255, 255, .2), + -1px 1px 1px rgba(255, 255, 255, .2), + -1px -1px 1px rgba(255, 255, 255, .2); + background: #ccc; + overflow: hidden; +} + +.mathbox-progress > div { + display: block; + width: 0px; + height: 10px; + background: #888; +} + +.mathbox-logo { + position: relative; + width: 140px; + height: 100px; + margin: 0 auto 10px; + -webkit-perspective: 200px; + perspective: 200px; +} + +.mathbox-logo > div { + position: absolute; + left: 0; + top: 0; + bottom: 0; + right: 0; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; +} + +.mathbox-logo > :nth-child(1) { + -webkit-transform: rotateZ(22deg) rotateX(24deg) rotateY(30deg); + transform: rotateZ(22deg) rotateX(24deg) rotateY(30deg); +} + +.mathbox-logo > :nth-child(2) { + -webkit-transform: rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(.6, .6, .6); + transform: rotateZ(11deg) rotateX(12deg) rotateY(15deg) scale3d(.6, .6, .6); +} + +.mathbox-logo > div > div { + position: absolute; + top: 50%; + left: 50%; + margin-left: -100px; + margin-top: -100px; + width: 200px; + height: 200px; + box-sizing: border-box; + border-radius: 50%; +} + +.mathbox-logo > div > :nth-child(1) { + -webkit-transform: scale(0.5, 0.5); + transform: rotateX(30deg) scale(0.5, 0.5); +} + +.mathbox-logo > div > :nth-child(2) { + -webkit-transform: rotateX(90deg) scale(0.42, 0.42); + transform: rotateX(90deg) scale(0.42, 0.42); +} + +.mathbox-logo > div > :nth-child(3) { + -webkit-transform: rotateY(90deg) scale(0.35, 0.35); + transform: rotateY(90deg) scale(0.35, 0.35); +} + +.mathbox-logo > :nth-child(1) > :nth-child(1) { + border: 16px solid #808080; +} +.mathbox-logo > :nth-child(1) > :nth-child(2) { + border: 19px solid #A0A0A0; +} +.mathbox-logo > :nth-child(1) > :nth-child(3) { + border: 23px solid #C0C0C0; +} +.mathbox-logo > :nth-child(2) > :nth-child(1) { + border: 27px solid #808080; +} +.mathbox-logo > :nth-child(2) > :nth-child(2) { + border: 32px solid #A0A0A0; +} +.mathbox-logo > :nth-child(2) > :nth-child(3) { + border: 38px solid #C0C0C0; +} + +.mathbox-splash-blue .mathbox-progress { + background: #def; +} +.mathbox-splash-blue .mathbox-progress > div { + background: #1979e7; +} +.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(1) { + border-color: #1979e7; +} +.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(2) { + border-color: #33b0ff; +} +.mathbox-splash-blue .mathbox-logo > :nth-child(1) > :nth-child(3) { + border-color: #75eaff; +} +.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(1) { + border-color: #18487F; +} +.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(2) { + border-color: #33b0ff; +} +.mathbox-splash-blue .mathbox-logo > :nth-child(2) > :nth-child(3) { + border-color: #75eaff; +} + + + + +.mathbox-overlays { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + pointer-events: none; + transform-style: preserve-3d; + overflow: hidden; +} +.mathbox-overlays > div { + transform-style: preserve-3d; +} +.mathbox-overlay > div { + position: absolute; + will-change: transform, opacity; +} +.mathbox-label { + font-family: sans-serif; +} +.mathbox-outline-1 { + text-shadow: + -1px -1px 0px rgb(255, 255, 255), + 1px 1px 0px rgb(255, 255, 255), + -1px 1px 0px rgb(255, 255, 255), + 1px -1px 0px rgb(255, 255, 255), + 1px 0px 1px rgb(255, 255, 255), + -1px 0px 1px rgb(255, 255, 255), + 0px -1px 1px rgb(255, 255, 255), + 0px 1px 1px rgb(255, 255, 255); +} +.mathbox-outline-2 { + text-shadow: + 0px -2px 0px rgb(255, 255, 255), + 0px 2px 0px rgb(255, 255, 255), + -2px 0px 0px rgb(255, 255, 255), + 2px 0px 0px rgb(255, 255, 255), + -1px -2px 0px rgb(255, 255, 255), + -2px -1px 0px rgb(255, 255, 255), + -1px 2px 0px rgb(255, 255, 255), + -2px 1px 0px rgb(255, 255, 255), + 1px 2px 0px rgb(255, 255, 255), + 2px 1px 0px rgb(255, 255, 255), + 1px -2px 0px rgb(255, 255, 255), + 2px -1px 0px rgb(255, 255, 255); +} +.mathbox-outline-3 { + text-shadow: + 3px 0px 0px rgb(255, 255, 255), + -3px 0px 0px rgb(255, 255, 255), + 0px 3px 0px rgb(255, 255, 255), + 0px -3px 0px rgb(255, 255, 255), + + -2px -2px 0px rgb(255, 255, 255), + -2px 2px 0px rgb(255, 255, 255), + 2px 2px 0px rgb(255, 255, 255), + 2px -2px 0px rgb(255, 255, 255), + + -1px -2px 1px rgb(255, 255, 255), + -2px -1px 1px rgb(255, 255, 255), + -1px 2px 1px rgb(255, 255, 255), + -2px 1px 1px rgb(255, 255, 255), + 1px 2px 1px rgb(255, 255, 255), + 2px 1px 1px rgb(255, 255, 255), + 1px -2px 1px rgb(255, 255, 255), + 2px -1px 1px rgb(255, 255, 255); +} +.mathbox-outline-4 { + text-shadow: + 4px 0px 0px rgb(255, 255, 255), + -4px 0px 0px rgb(255, 255, 255), + 0px 4px 0px rgb(255, 255, 255), + 0px -4px 0px rgb(255, 255, 255), + + -3px -2px 0px rgb(255, 255, 255), + -3px 2px 0px rgb(255, 255, 255), + 3px 2px 0px rgb(255, 255, 255), + 3px -2px 0px rgb(255, 255, 255), + + -2px -3px 0px rgb(255, 255, 255), + -2px 3px 0px rgb(255, 255, 255), + 2px 3px 0px rgb(255, 255, 255), + 2px -3px 0px rgb(255, 255, 255), + + -1px -2px 1px rgb(255, 255, 255), + -2px -1px 1px rgb(255, 255, 255), + -1px 2px 1px rgb(255, 255, 255), + -2px 1px 1px rgb(255, 255, 255), + 1px 2px 1px rgb(255, 255, 255), + 2px 1px 1px rgb(255, 255, 255), + 1px -2px 1px rgb(255, 255, 255), + 2px -1px 1px rgb(255, 255, 255); + +} +.mathbox-outline-fill, .mathbox-outline-fill * { + color: #fff !important; +} diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 1d59446..3c84bb9 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1940,28 +1940,16 @@ function mathbox_init() view.axis({ axis: 1, width: 3, - }); + }); view.axis({ axis: 2, width: 3, - }); + }); view.axis({ axis: 3, width: 3, - }); + }); - view.grid({ - width: 2, - opacity: 0.5, - axes: [1, 2], - zOrder: 1, - }); - view.grid({ - width: 2, - opacity: 0.5, - axes: [2, 3], - zOrder: 1, - }); view.grid({ width: 2, opacity: 0.5, @@ -2009,8 +1997,8 @@ function mathbox_init() view.surface({ fill: false, - lineX: true, - lineY: true, + lineX: false, + lineY: false, points: '<<', colors: '<', color: 0xFFFFFF,