Tackling gender and hermaphrodites with an interactive WebGL animation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1
  1. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.v3d=e.v3d||{})}(this,function(e){"use strict";function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:0<e?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}),void 0===Object.values&&(Object.values=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}),Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}});var n,r,u,h,i,a,o,s,l,c,d,p,f,m,v,g,y,x,_,b,w,Ae="2.9.1",H=0,Y=1,q=2,G=1,V=2,I=0,Me=1,ne=2,A=0,M=2,Q=0,Z=1,K=2,J=3,$=4,ee=5,te=100,T=101,S=102,E=103,L=104,C=200,P=201,N=202,R=203,F=204,O=205,D=206,U=207,B=208,z=209,k=210,re=0,ie=1,ae=2,oe=3,se=4,le=5,ce=6,ue=7,j=0,X=1,W=2,he=0,Te=1,de=2,pe=3,fe=4,me=301,ve=302,ge=303,ye=304,xe=305,_e=306,be=307,we=1e3,Se=1001,Ee=1002,Le=1003,Ce=1004,Pe=1005,Ne=1006,Re=1007,Fe=1008,Oe=1009,Ie=1010,De=1011,Ue=1012,Be=1013,ze=1014,ke=1015,Ge=1016,Ve=1017,je=1018,Xe=1019,We=1020,He=1021,Ye=1022,qe=1023,Qe=1024,Ze=1025,Ke=qe,Je=1026,$e=1027,et=1028,tt=33776,nt=33777,rt=33778,it=33779,at=35840,ot=35841,st=35842,lt=35843,ct=36196,ut=37808,ht=37809,dt=37810,pt=37811,ft=37812,mt=37813,vt=37814,gt=37815,yt=37816,xt=37817,_t=37818,bt=37819,wt=37820,At=37821,Mt=2300,Tt=2301,St=2302,Et=2400,Lt=2401,Ct=2402,Pt=0,Nt=1,Rt=2,Ft=3e3,Ot=3001,It=3007,Dt=3002,Ut=3004,Bt=3005,zt=3006,kt=3200,Gt=3201,Vt=0,jt=1,Xt="__V3DL__0000000000",Wt=5,Ht=0,Yt={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var i=[],e=0;e<256;e++)i[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(i[255&e]+i[e>>8&255]+i[e>>16&255]+i[e>>24&255]+"-"+i[255&t]+i[t>>8&255]+"-"+i[t>>16&15|64]+i[t>>24&255]+"-"+i[63&n|128]+i[n>>8&255]+"-"+i[n>>16&255]+i[n>>24&255]+i[255&r]+i[r>>8&255]+i[r>>16&255]+i[r>>24&255]).toUpperCase()}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Yt.DEG2RAD},radToDeg:function(e){return e*Yt.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},hashString:function(e){for(var t=5381,n=e.length;n;)t=33*t^e.charCodeAt(--n);return t>>>0},expAverage:function(e,t,n,r){var i=Math.exp(-n/r);return e*i+(1-i)*t},angleToRange_0_2Pi:function(e){return this.clamp(e-2*Math.PI*Math.floor(e/(2*Math.PI)),0,2*Math.PI)},clampAngle:function(e,t,n){var r=this.angleToRange_0_2Pi(e-t),i=this.angleToRange_0_2Pi(n-t);return i<r&&(r=r<i/2+Math.PI?i:0),r+t}};function qt(e,t){this.x=e||0,this.y=t||0}function Qt(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("v3d.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Zt(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}function Kt(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function Jt(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("v3d.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(qt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(qt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector2: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector2: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(n=new qt,r=new qt,function(e,t){return n.set(e,e),r.set(t,t),this.clamp(n,r)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}}),Object.assign(Qt.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Qt).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:(d=new Kt,function(e){var t=this.elements,n=e.elements,r=1/d.setFromMatrixColumn(e,0).length(),i=1/d.setFromMatrixColumn(e,1).length(),a=1/d.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("v3d.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=p*l-d,t[8]=h*l+f,t[1]=s*u,t[5]=f*l+h,t[9]=d*l-p,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,_=a*l,b=o*s,w=o*l;t[0]=s*c,t[4]=w-x*u,t[8]=b*u+_,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=_*u+b,t[10]=x-w*u}else if("XZY"===e.order){x=a*s,_=a*l,b=o*s,w=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=x*u+w,t[5]=a*c,t[9]=_*u-b,t[2]=b*u-_,t[6]=o*c,t[10]=w*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:(l=new Kt(0,0,0),c=new Kt(1,1,1),function(e){return this.compose(l,e,c)}),lookAt:(a=new Kt,o=new Kt,s=new Kt,function(e,t,n){var r=this.elements;return s.subVectors(e,t),0===s.lengthSq()&&(s.z=1),s.normalize(),a.crossVectors(n,s),0===a.lengthSq()&&(1===Math.abs(n.z)?s.x+=1e-4:s.z+=1e-4,s.normalize(),a.crossVectors(n,s)),a.normalize(),o.crossVectors(s,a),r[0]=a.x,r[4]=o.x,r[8]=s.x,r[1]=a.y,r[5]=o.y,r[9]=s.y,r[2]=a.z,r[6]=o.z,r[10]=s.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("v3d.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices(a, b) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],A=r[8],M=r[12],T=r[1],S=r[5],E=r[9],L=r[13],C=r[2],P=r[6],N=r[10],R=r[14],F=r[3],O=r[7],I=r[11],D=r[15];return i[0]=a*b+o*T+s*C+l*F,i[4]=a*w+o*S+s*P+l*O,i[8]=a*A+o*E+s*N+l*I,i[12]=a*M+o*L+s*R+l*D,i[1]=c*b+u*T+h*C+d*F,i[5]=c*w+u*S+h*P+d*O,i[9]=c*A+u*E+h*N+d*I,i[13]=c*M+u*L+h*R+d*D,i[2]=p*b+f*T+m*C+v*F,i[6]=p*w+f*S+m*P+v*O,i[10]=p*A+f*E+m*N+v*I,i[14]=p*M+f*L+m*R+v*D,i[3]=g*b+y*T+x*C+_*F,i[7]=g*w+y*S+x*P+_*O,i[11]=g*A+y*E+x*N+_*I,i[15]=g*M+y*L+x*R+_*D,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:(i=new Kt,function(e){for(var t=0,n=e.count;t<n;t++)i.x=e.getX(t),i.y=e.getY(t),i.z=e.getZ(t),i.applyMatrix4(this),e.setXYZ(t,i.x,i.y,i.z);return e}),determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+i*s*u-r*l*u-i*o*h+n*l*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-r*a*d+r*l*c-i*s*c)+e[11]*(+t*l*u-t*o*d-i*a*u+n*a*d+i*o*c-n*l*c)+e[15]*(-r*o*c-t*s*u+t*o*h+r*a*u-n*a*h+n*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],c=r[5],u=r[6],h=r[7],d=r[8],p=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],_=p*y*h-g*f*h+g*u*m-c*y*m-p*u*x+c*f*x,b=v*f*h-d*y*h-v*u*m+l*y*m+d*u*x-l*f*x,w=d*g*h-v*p*h+v*c*m-l*g*m-d*c*x+l*p*x,A=v*p*u-d*g*u-v*c*f+l*g*f+d*c*y-l*p*y,M=i*_+a*b+o*w+s*A;if(0===M){if(!0===t)throw new Error("v3d.Matrix4: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var T=1/M;return n[0]=_*T,n[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*x-a*f*x)*T,n[2]=(c*y*s-g*u*s+g*o*h-a*y*h-c*o*x+a*u*x)*T,n[3]=(p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*m)*T,n[4]=b*T,n[5]=(d*y*s-v*f*s+v*o*m-i*y*m-d*o*x+i*f*x)*T,n[6]=(v*u*s-l*y*s-v*o*h+i*y*h+l*o*x-i*u*x)*T,n[7]=(l*f*s-d*u*s+d*o*h-i*f*h-l*o*m+i*u*m)*T,n[8]=w*T,n[9]=(v*p*s-d*g*s-v*a*m+i*g*m+d*a*x-i*p*x)*T,n[10]=(l*g*s-v*c*s+v*a*h-i*g*h-l*a*x+i*c*x)*T,n[11]=(d*c*s-l*p*s-d*a*h+i*p*h+l*a*m-i*c*m)*T,n[12]=A*T,n[13]=(d*g*o-v*p*o+v*a*f-i*g*f-d*a*y+i*p*y)*T,n[14]=(v*c*o-l*g*o-v*a*u+i*g*u+l*a*y-i*c*y)*T,n[15]=(l*p*o-d*c*o+d*a*u-i*p*u-l*a*f+i*c*f)*T,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,l=i*a,c=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,c*o+n,c*s-r*a,0,l*s-r*o,c*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,c=a+a,u=o+o,h=i*l,d=i*c,p=i*u,f=a*c,m=a*u,v=o*u,g=s*l,y=s*c,x=s*u,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+v))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+v))*b,r[6]=(m+g)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-g)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:(u=new Kt,h=new Qt,function(e,t,n){var r=this.elements,i=u.set(r[0],r[1],r[2]).length(),a=u.set(r[4],r[5],r[6]).length(),o=u.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],h.copy(this);var s=1/i,l=1/a,c=1/o;return h.elements[0]*=s,h.elements[1]*=s,h.elements[2]*=s,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=c,h.elements[9]*=c,h.elements[10]*=c,t.setFromRotationMatrix(h),n.x=i,n.y=a,n.z=o,this}),makePerspective:function(e,t,n,r,i,a){void 0===a&&console.warn("v3d.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),c=1/(a-i),u=(t+e)*s,h=(n+r)*l,d=(a+i)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Object.assign(Zt,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(u!==f||s!==h||l!==d||c!==p){var m=1-o,v=s*h+l*d+c*p+u*f,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+h*b,l=l*m+d*b,c=c*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}}),Object.defineProperties(Zt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(Zt.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("v3d.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);return"XYZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"YXZ"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"ZXY"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"ZYX"===a?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"YZX"===a?(this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p):"XZY"===a&&(this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],d=r+s+h;return this._z=0<d?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-l)*t,this._y=(a-c)*t,(o-i)*t):s<r&&h<r?(t=2*Math.sqrt(1+r-s-h),this._w=(u-l)/t,this._x=.25*t,this._y=(i+o)/t,(a+c)/t):h<s?(t=2*Math.sqrt(1+s-r-h),this._w=(a-c)/t,this._x=(i+o)/t,this._y=.25*t,(l+u)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-i)/t,this._x=(a+c)/t,this._y=(l+u)/t,.25*t),this.onChangeCallback(),this},setFromUnitVectors:(f=new Kt,function(e,t){return void 0===f&&(f=new Kt),(p=e.dot(t)+1)<1e-6?(p=0,Math.abs(e.x)>Math.abs(e.z)?f.set(-e.y,e.x,0):f.set(0,-e.z,e.y)):f.crossVectors(e,t),this._x=f.x,this._y=f.y,this._z=f.z,this._w=p,this.normalize()}),angleTo:function(e){return 2*Math.acos(Math.abs(Yt.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return this._w=0===e?(this._x=0,this._y=0,this._z=0,1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("v3d.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions(a, b) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+r*l-i*s,this._y=r*c+a*s+i*o-n*l,this._z=i*c+a*l+n*s-r*o,this._w=a*c-n*o-r*s-i*l,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize()}var c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Kt.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors(a, b) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(b=new Zt,function(e){return e&&e.isEuler||console.error("v3d.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(b.setFromEuler(e))}),applyAxisAngle:(_=new Zt,function(e,t){return this.applyQuaternion(_.setFromAxisAngle(e,t))}),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,c=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=l*s+h*-i+c*-o-u*-a,this.y=c*s+h*-a+u*-i-l*-o,this.z=u*s+h*-o+l*-a-c*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:(x=new Qt,function(e){return this.applyMatrix4(x.getInverse(e.projectionMatrix)).applyMatrix4(e.matrixWorld)}),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:(g=new Kt,y=new Kt,function(e,t){return g.set(e,e,e),y.set(t,t,t),this.clamp(g,y)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("v3d.Vector3: .cross() now only accepts one argument. Use .crossVectors(a, b) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:(v=new Kt,function(e){return v.copy(this).projectOnVector(e),this.sub(v)}),reflect:(m=new Kt,function(e){return this.sub(m.copy(e).multiplyScalar(2*this.dot(e)))}),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Yt.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(Jt.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=r,c[2]=o,c[3]=t,c[4]=i,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:(w=new Kt,function(e){for(var t=0,n=e.count;t<n;t++)w.x=e.getX(t),w.y=e.getY(t),w.z=e.getZ(t),w.applyMatrix3(this),e.setXYZ(t,w.x,w.y,w.z);return e}),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*m+o*y+s*b,i[6]=a*v+o*x+s*w,i[1]=l*f+c*g+u*_,i[4]=l*m+c*y+u*b,i[7]=l*v+c*x+u*w,i[2]=h*f+d*g+p*_,i[5]=h*m+d*y+p*b,i[8]=h*v+d*x+p*w,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*i*c+n*o*s+r*i*l-r*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("v3d.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],p=d*l-c*h,f=c*u-d*s,m=h*s-l*u,v=i*p+a*f+o*m;if(0===v){if(!0===t)throw new Error("v3d.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var g=1/v;return r[0]=p*g,r[1]=(o*h-d*a)*g,r[2]=(c*a-o*l)*g,r[3]=f*g,r[4]=(d*i-o*u)*g,r[5]=(o*s-c*i)*g,r[6]=m*g,r[7]=(a*u-h*i)*g,r[8]=(l*i-a*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],c=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*c,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var $t,en,tn,nn,rn,an,on,sn,ln,cn,un,hn,dn,pn,fn,mn,vn={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=e.width,t.height=e.height;var n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height)}return 2048<t.width||2048<t.height?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},gn=0;function yn(e,t,n,r,i,a,o,s,l,c){Object.defineProperty(this,"id",{value:gn++}),this.uuid=Yt.generateUUID(),this.name="",this.image=void 0!==e?e:yn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:yn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Se,this.wrapT=void 0!==r?r:Se,this.magFilter=void 0!==i?i:Ne,this.minFilter=void 0!==a?a:Fe,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:qe,this.type=void 0!==s?s:Oe,this.offset=new qt(0,0),this.repeat=new qt(1,1),this.center=new qt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Jt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:Ft,this.version=0,this.onUpdate=null}function xn(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function _n(e,t,n){this.width=e,this.height=t,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),void 0===(n=n||{}).minFilter&&(n.minFilter=Ne),this.texture=new yn(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.generateMipmaps=void 0===n.generateMipmaps||n.generateMipmaps,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function bn(e,t,n){_n.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function wn(e,t,n,r,i,a,o,s,l,c,u,h){yn.call(this,null,a,o,s,l,c,r,i,u,h),this.image={data:e,width:t,height:n},this.magFilter=void 0!==l?l:Le,this.minFilter=void 0!==c?c:Le,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function An(e,t){this.min=void 0!==e?e:new Kt(1/0,1/0,1/0),this.max=void 0!==t?t:new Kt(-1/0,-1/0,-1/0)}function Mn(e,t){this.center=void 0!==e?e:new Kt,this.radius=void 0!==t?t:0}function Tn(e,t){this.normal=void 0!==e?e:new Kt(1,0,0),this.constant=void 0!==t?t:0}function Sn(e,t,n,r,i,a){this.planes=[void 0!==e?e:new Tn,void 0!==t?t:new Tn,void 0!==n?n:new Tn,void 0!==r?r:new Tn,void 0!==i?i:new Tn,void 0!==a?a:new Tn]}yn.DEFAULT_IMAGE=void 0,yn.DEFAULT_MAPPING=300,yn.prototype=Object.assign(Object.create(t.prototype),{constructor:yn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=Yt.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(vn.getDataURL(r[a]))}else i=vn.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case we:e.x=e.x-Math.floor(e.x);break;case Se:e.x=e.x<0?0:1;break;case Ee:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case we:e.y=e.y-Math.floor(e.y);break;case Se:e.y=e.y<0?0:1;break;case Ee:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(yn.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(xn.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("v3d.Vector4: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("v3d.Vector4: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return this.z=t<1e-4?(this.x=1,this.y=0):(this.x=e.x/t,this.y=e.y/t,e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+c)/4,x=(l+d)/4,_=(h+p)/4;return v<m&&g<m?i=m<.01?(n=0,r=.707106781):(r=y/(n=Math.sqrt(m)),x/n):g<v?i=v<.01?(r=0,n=.707106781):(n=y/(r=Math.sqrt(v)),_/r):g<.01?(r=n=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=_/i),this.set(n,r,i,t),this}var b=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(c-s)*(c-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(l-d)/b,this.z=(c-s)/b,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return void 0===$t&&($t=new xn,en=new xn),$t.set(e,e,e,e),en.set(t,t,t,t),this.clamp($t,en)},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("v3d.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),_n.prototype=Object.assign(Object.create(t.prototype),{constructor:_n,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((bn.prototype=Object.create(_n.prototype)).constructor=bn).prototype.isWebGLRenderTargetCube=!0,((wn.prototype=Object.create(yn.prototype)).constructor=wn).prototype.isDataTexture=!0,Object.assign(An.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],u=e[s+1],h=e[s+2];c<t&&(t=c),u<n&&(n=u),h<r&&(r=h),i<c&&(i=c),a<u&&(a=u),o<h&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),u=e.getY(s),h=e.getZ(s);c<t&&(t=c),u<n&&(n=u),h<r&&(r=h),i<c&&(i=c),a<u&&(a=u),o<h&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(on=new Kt,function(e,t){var n=on.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("v3d.Box3: .getCenter() target is now required"),e=new Kt),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("v3d.Box3: .getSize() target is now required"),e=new Kt),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(){var i,a,o,s=new Kt;function t(e){var t=e.geometry;if(void 0!==t)if(t.isGeometry){var n=t.vertices;for(a=0,o=n.length;a<o;a++)s.copy(n[a]),s.applyMatrix4(e.matrixWorld),i.expandByPoint(s)}else if(t.isBufferGeometry){var r=t.attributes.position;if(void 0!==r)for(a=0,o=r.count;a<o;a++)s.fromBufferAttribute(r,a).applyMatrix4(e.matrixWorld),i.expandByPoint(s)}}return function(e){return i=this,e.updateMatrixWorld(!0),e.traverse(t),this}}(),containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("v3d.Box3: .getParameter() target is now required"),t=new Kt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:(an=new Kt,function(e){return this.clampPoint(e.center,an),an.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,n;return n=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(){var s=new Kt,l=new Kt,c=new Kt,n=new Kt,r=new Kt,i=new Kt,u=new Kt,a=new Kt,h=new Kt,o=new Kt;function d(e){var t,n;for(t=0,n=e.length-3;t<=n;t+=3){u.fromArray(e,t);var r=h.x*Math.abs(u.x)+h.y*Math.abs(u.y)+h.z*Math.abs(u.z),i=s.dot(u),a=l.dot(u),o=c.dot(u);if(Math.max(-Math.max(i,a,o),Math.min(i,a,o))>r)return!1}return!0}return function(e){if(this.isEmpty())return!1;this.getCenter(a),h.subVectors(this.max,a),s.subVectors(e.a,a),l.subVectors(e.b,a),c.subVectors(e.c,a),n.subVectors(l,s),r.subVectors(c,l),i.subVectors(s,c);var t=[0,-n.z,n.y,0,-r.z,r.y,0,-i.z,i.y,n.z,0,-n.x,r.z,0,-r.x,i.z,0,-i.x,-n.y,n.x,0,-r.y,r.x,0,-i.y,i.x,0];return!!d(t)&&(!!d(t=[1,0,0,0,1,0,0,0,1])&&(o.crossVectors(n,r),d(t=[o.x,o.y,o.z])))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("v3d.Box3: .clampPoint() target is now required"),t=new Kt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(rn=new Kt,function(e){return rn.copy(e).clamp(this.min,this.max).sub(e).length()}),getBoundingSphere:(nn=new Kt,function(e){return void 0===e&&(console.warn("v3d.Box3: .getBoundingSphere() target is now required"),e=new Mn),this.getCenter(e.center),e.radius=.5*this.getSize(nn).length(),e}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(tn=[new Kt,new Kt,new Kt,new Kt,new Kt,new Kt,new Kt,new Kt],function(e){return this.isEmpty()||(tn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),tn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),tn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),tn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),tn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),tn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),tn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),tn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(tn)),this}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(Mn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(sn=new An,function(e,t){var n=this.center;void 0!==t?n.copy(t):sn.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("v3d.Sphere: .clampPoint() target is now required"),t=new Kt),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("v3d.Sphere: .getBoundingBox() target is now required"),e=new An),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(Tn.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:(hn=new Kt,dn=new Kt,function(e,t,n){var r=hn.subVectors(n,t).cross(dn.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("v3d.Plane: .projectPoint() target is now required"),t=new Kt),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:(un=new Kt,function(e,t){void 0===t&&(console.warn("v3d.Plane: .intersectLine() target is now required"),t=new Kt);var n=e.delta(un),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||1<i?void 0:t.copy(n).multiplyScalar(i).add(e.start)}),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&0<n||n<0&&0<t},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("v3d.Plane: .coplanarPoint() target is now required"),e=new Kt),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:(ln=new Kt,cn=new Jt,function(e,t){var n=t||cn.getNormalMatrix(e),r=this.coplanarPoint(ln).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(Sn.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,u-s,f-h,y-m).normalize(),t[1].setComponents(o+r,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+l,f+d,y+v).normalize(),t[3].setComponents(o-i,u-l,f-d,y-v).normalize(),t[4].setComponents(o-a,u-c,f-p,y-g).normalize(),t[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this},intersectsObject:(mn=new Mn,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),mn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(mn)}),intersectsSprite:(fn=new Mn,function(e){return fn.center.set(0,0,0),fn.radius=.7071067811865476,fn.applyMatrix4(e.matrixWorld),this.intersectsSphere(fn)}),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:(pn=new Kt,function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(pn.x=0<r.normal.x?e.max.x:e.min.x,pn.y=0<r.normal.y?e.max.y:e.min.y,pn.z=0<r.normal.z?e.max.z:e.min.z,r.distanceToPoint(pn)<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var En,Ln,Cn,Pn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D(alphaMap, vUv).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n if (diffuseColor.a < ALPHATEST)\n discard;\n else\n diffuseColor.a = 1.0;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n \n float ambientOcclusion = (texture2D(aoMap, vUv2).r - 1.0) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined(USE_ENVMAP) && defined(PHYSICAL)\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n reflectedLight.indirectSpecular *= computeSpecularOcclusion(dotNV, ambientOcclusion, material.specularRoughness);\n #endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3(position);\n",beginnormal_vertex:"\nvec3 objectNormal = vec3(normal);\n",bsdfs:"float punctualLightIntensityToIrradianceFactor(float lightDistance, const in float cutoffDistance, const in float decayExponent) {\n#if defined (PHYSICALLY_CORRECT_LIGHTS)\n \n \n \n \n \n lightDistance = UNITS_SCALE_FACTOR * lightDistance;\n float distanceFalloff = 1.0 / max(pow(lightDistance, decayExponent), 0.01);\n if(cutoffDistance > 0.0) {\n distanceFalloff *= pow2(saturate(1.0 - pow4(lightDistance / cutoffDistance)));\n }\n return distanceFalloff;\n#elif defined(BLENDER_LIGHTS)\n return cutoffDistance / (cutoffDistance + pow2(lightDistance));\n#else\n if(cutoffDistance > 0.0) {\n return pow(saturate(-lightDistance / cutoffDistance + 1.0), decayExponent);\n }\n return 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n} \nvec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\n \n \n \n \n float fresnel = exp2((-5.55473 * dotLH - 6.98316) * dotLH);\n return (1.0 - specularColor) * fresnel + specularColor;\n} \nfloat G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\n \n \n float a2 = pow2(alpha);\n float gl = dotNL + sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n float gv = dotNV + sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n return 1.0 / (gl * gv);\n} \nfloat G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n \n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; \n return RECIPROCAL_PI * a2 / pow2(denom);\n}\nvec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness) {\n float alpha = pow2(roughness); \n vec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\n float dotNL = saturate(dot(geometry.normal, incidentLight.direction));\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n float dotNH = saturate(dot(geometry.normal, halfDir));\n float dotLH = saturate(dot(incidentLight.direction, halfDir));\n vec3 F = F_Schlick(specularColor, dotLH);\n float G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (G * D);\n} \n#if NUM_RECT_AREA_LIGHTS > 0\nvec2 LTC_Uv(const in vec3 N, const in vec3 V, const in float roughness) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = (LUT_SIZE - 1.0) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate(dot(N, V));\n \n vec2 uv = vec2(roughness, sqrt(1.0 - dotNV));\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor(const in vec3 f) {\n \n \n float l = length(f);\n return max((l * l + f.z) / (l + 1.0), 0.0);\n}\nvec3 LTC_EdgeVectorFormFactor(const in vec3 v1, const in vec3 v2) {\n float x = dot(v1, v2);\n float y = abs(x);\n \n float a = 0.8543985 + (0.4965155 + 0.0145206 * y) * y;\n float b = 3.4175940 + (4.1616724 + y) * y;\n float v = a / b;\n float theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt(max(1.0 - x * x, 1e-7)) - v;\n return cross(v1, v2) * theta_sintheta;\n}\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\n \n \n vec3 v1 = rectCoords[1] - rectCoords[0];\n vec3 v2 = rectCoords[3] - rectCoords[0];\n vec3 lightNormal = cross(v1, v2);\n if(dot(lightNormal, P - rectCoords[0]) < 0.0) return vec3(0.0);\n \n vec3 T1, T2;\n T1 = normalize(V - N * dot(V, N));\n T2 = - cross(N, T1); \n \n mat3 mat = mInv * transposeMat3(mat3(T1, T2, N));\n \n vec3 coords[4];\n coords[0] = mat * (rectCoords[0] - P);\n coords[1] = mat * (rectCoords[1] - P);\n coords[2] = mat * (rectCoords[2] - P);\n coords[3] = mat * (rectCoords[3] - P);\n \n coords[0] = normalize(coords[0]);\n coords[1] = normalize(coords[1]);\n coords[2] = normalize(coords[2]);\n coords[3] = normalize(coords[3]);\n \n vec3 vectorFormFactor = vec3(0.0);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\n vectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\n \n float result = LTC_ClippedSphereFormFactor(vectorFormFactor);\n return vec3(result);\n}\n#endif\nvec3 BRDF_Specular_GGX_Environment(const in GeometricContext geometry, const in vec3 specularColor, const in float roughness) {\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n const vec4 c0 = vec4(- 1, - 0.0275, - 0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, - 0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(- 9.28 * dotNV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n} \nfloat G_BlinnPhong_Implicit() {\n \n return 0.25;\n}\nfloat D_BlinnPhong(const in float shininess, const in float dotNH) {\n return RECIPROCAL_PI * (shininess * 0.5 + 1.0) * pow(dotNH, shininess);\n}\nvec3 BRDF_Specular_BlinnPhong(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess) {\n vec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\n \n \n float dotNH = saturate(dot(geometry.normal, halfDir));\n float dotLH = saturate(dot(incidentLight.direction, halfDir));\n vec3 F = F_Schlick(specularColor, dotLH);\n float G = G_BlinnPhong_Implicit();\n float D = D_BlinnPhong(shininess, dotNH);\n return F * (G * D);\n} \nfloat GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\n return (2.0 / pow2(ggxRoughness + 0.0001) - 2.0);\n}\nfloat BlinnExponentToGGXRoughness(const in float blinnExponent) {\n return sqrt(2.0 / (blinnExponent + 2.0));\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n \n \n \n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx(vUv);\n vec2 dSTdy = dFdy(vUv);\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 return vec2(dBx, dBy);\n }\n vec3 perturbNormalArb(vec3 surf_pos, vec3 surf_norm, vec2 dHdxy) {\n \n vec3 vSigmaX = vec3(dFdx(surf_pos.x), dFdx(surf_pos.y), dFdx(surf_pos.z));\n vec3 vSigmaY = vec3(dFdy(surf_pos.x), dFdy(surf_pos.y), dFdy(surf_pos.z));\n vec3 vN = surf_norm; \n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n float fDet = dot(vSigmaX, R1);\n fDet *= (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\n return normalize(abs(fDet) * surf_norm - vGrad);\n }\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop\n for (int i = 0; i < UNION_CLIPPING_PLANES; i++) {\n plane = clippingPlanes[i];\n if (dot(vViewPosition, plane.xyz) > plane.w) discard;\n }\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop\n for (int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i++) {\n plane = clippingPlanes[i];\n clipped = (dot(vViewPosition, plane.xyz) > plane.w) && clipped;\n }\n if (clipped) discard;\n #endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n #if !defined(PHYSICAL) && !defined(PHONG) && !defined(MATCAP)&& !defined(NODE)\n varying vec3 vViewPosition;\n #endif\n uniform vec4 clippingPlanes[NUM_CLIPPING_PLANES];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && !defined(PHYSICAL) && !defined(PHONG) && !defined(MATCAP) && !defined(NODE)\n varying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && !defined(PHYSICAL) && !defined(PHONG) && !defined(MATCAP) && !defined(NODE)\n vViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n varying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n varying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n vColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp(a, 0.0, 1.0)\n#define whiteCompliment(a) (1.0 - saturate(a))\n#define RECIPROCAL_3 0.333333333333\nfloat pow2(const in float x) { return x*x; }\nfloat pow3(const in float x) { return x*x*x; }\nfloat pow4(const in float x) { float x2 = x*x; return x2*x2; }\nfloat average(const in vec3 color) { return dot(color, vec3(0.3333)); }\nhighp float rand(const in vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, PI);\n return fract(sin(sn) * c);\n}\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nvec3 transformDirection(in vec3 dir, in mat4 matrix) {\n return normalize((matrix * vec4(dir, 0.0)).xyz);\n}\nvec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {\n return normalize((vec4(dir, 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 - distance * planeNormal + point;\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 lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nmat3 transposeMat3(const in mat3 m) {\n mat3 tmp;\n tmp[0] = vec3(m[0].x, m[1].x, m[2].x);\n tmp[1] = vec3(m[0].y, m[1].y, m[2].y);\n tmp[2] = vec3(m[0].z, m[1].z, m[2].z);\n return tmp;\n}\nfloat linearToRelativeLuminance(const in vec3 color) {\n vec3 weights = vec3(0.2126, 0.7152, 0.0722);\n return dot(weights, color.rgb);\n}\nfloat powCompat(const in float val, const in float power) {\n if (power == 0.0)\n return 1.0;\n else if (val < 0.0) {\n if (mod(-power, 2.0) == 0.0)\n return pow(-val, power);\n else\n return -pow(-val, power);\n } else if (val == 0.0)\n return 0.0;\n return pow(val, power);\n}\nfloat maxFromRGB(vec3 rgb) {\n return max(max(rgb.r, rgb.g), rgb.b);\n}\nbool isOrtho(const in mat4 m) {\n if (m[3][3] != 0.0)\n return true;\n else\n return false;\n}\nvec3 swizzleUpZ(const vec3 vec) {\n return vec3(vec[0], -vec[2], vec[1]);\n}\nvec3 swizzleUpY(const vec3 vec) {\n return vec3(vec[0], vec[2], -vec[1]);\n}\nvec3 xyz_to_sRGB(vec3 xyz) {\n \n mat3 convMat = mat3(\n 3.2406, -0.9689, 0.0557,\n -1.5372, 1.8758, -0.2040,\n -0.4986, 0.0415, 1.0570\n );\n return convMat * xyz;\n}\nvec3 xyY_to_XYZ(float x, float y, float Y) {\n \n float X = 0.0;\n float Z = 0.0;\n if (y != 0.0) {\n X = (Y / y) * x;\n Z = (Y / y) * (1.0 - x - y);\n }\n return vec3(X, Y, Z);\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\n#define cubeUV_faceSize (cubeUV_textureSize * 0.25)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo(vec3 dir, float roughnessLevel) {\n \n \n \n dir = normalize(dir) * (sqrt(3.0) + 1.0) / 2.0;\n vec3 dx = dFdx(dir);\n vec3 dy = dFdy(dir);\n \n \n \n float derivCoeff = cubeUV_faceSize / exp2(roughnessLevel) / 2.0;\n dx *= derivCoeff;\n dy *= derivCoeff;\n float d = max(dot(dx, dx), dot(dy, dy));\n d = clamp(d, 1.0, cubeUV_rangeClamp);\n float mipLevel = 0.5 * log2(d);\n return vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_faceSize) - 2.0)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n float a = 16.0 * cubeUV_rcpTextureSize;\n vec2 exp2_packed = exp2(vec2(roughnessLevel, mipLevel));\n vec2 rcp_exp2_packed = vec2(1.0) / exp2_packed;\n \n float powScale = exp2_packed.x * exp2_packed.y;\n \n float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n \n float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n bool bRes = mipLevel == 0.0;\n scale = bRes && (scale < a) ? a : scale;\n vec3 absDir = abs(direction);\n float maxAbsVal = max(max(absDir.x, absDir.y), absDir.z);\n bool Xy = absDir.x >= absDir.y, Xz = absDir.x >= absDir.z, Yz = absDir.y >= absDir.z;\n \n \n \n \n vec3 projMax = vec3(Xy && Xz, !Xy && Yz, !Xz && !Yz); \n \n \n mat3 vecToUV = mat3(\n projMax.y + projMax.z * sign(direction.z), 0.0, projMax.x,\n 0.0, projMax.x + projMax.z, projMax.y,\n sign(-direction.x) * projMax.x, sign(direction.y) * projMax.y, projMax.z\n );\n vec2 uv = (vecToUV * (direction / maxAbsVal)).xy;\n uv = (uv + vec2(1.0)) * 0.5;\n \n \n \n \n float offCoeffX = dot(projMax, vec3(0.0, 1.0, 2.0));\n \n float rowBottomOrTop = (sign(dot(projMax, direction)) + 1.0) / 2.0;\n float offCoeffY = 0.5 + 0.25 * rowBottomOrTop;\n float zeroMipCoeff = a * rowBottomOrTop;\n vec2 offset = vec2(offCoeffX * scale + mipOffset, offCoeffY / powScale);\n offset.y = bRes && (offset.y < 2.0 * a) ? zeroMipCoeff : offset.y;\n float texelOffset = 0.5 * cubeUV_rcpTextureSize;\n vec2 base = offset + vec2(texelOffset);\n return base + uv * (scale - 2.0 * texelOffset);\n}\n#define cubeUV_maxLods3 (log2(cubeUV_faceSize) - 3.0)\nvec4 textureCubeUV(sampler2D envMap, vec3 reflectedDirection, float roughness) {\n float roughnessVal = roughness * cubeUV_maxLods3;\n float r0 = floor(roughnessVal);\n float r1 = r0 + 1.0;\n float rfactor = fract(roughnessVal);\n vec2 mipInfo = MipLevelInfo(reflectedDirection, r0);\n float l0 = mipInfo.x;\n float l1 = min(l0 + 1.0, 5.0);\n float lfactor = mipInfo.y;\n vec2 uv_r0_l0 = getCubeUV(reflectedDirection, r0, l0);\n vec2 uv_r0_l1 = getCubeUV(reflectedDirection, r0, l1);\n vec2 uv_r1_l0 = getCubeUV(reflectedDirection, r1, l0);\n vec2 uv_r1_l1 = getCubeUV(reflectedDirection, r1, l1);\n vec4 color_r0_l0 = envMapTexelToLinear(texture2D(envMap, uv_r0_l0));\n vec4 color_r0_l1 = envMapTexelToLinear(texture2D(envMap, uv_r0_l1));\n vec4 color_r1_l0 = envMapTexelToLinear(texture2D(envMap, uv_r1_l0));\n vec4 color_r1_l1 = envMapTexelToLinear(texture2D(envMap, uv_r1_l1));\n \n vec4 color_r0 = mix(color_r0_l0, color_r0_l1, lfactor);\n vec4 color_r1 = mix(color_r1_l0, color_r1_l1, lfactor);\n vec4 result = mix(color_r0, color_r1, rfactor);\n return vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize(objectNormal) * (texture2D(displacementMap, uv).x * displacementScale + displacementBias);\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D(emissiveMap, vUv);\n emissiveColor.rgb = emissiveMapTexelToLinear(emissiveColor).rgb;\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel(gl_FragColor);\n",encodings_pars_fragment:"\nvec4 LinearToLinear(in vec4 value) {\n return value;\n}\nvec4 GammaToLinear(in vec4 value, in float gammaFactor) {\n return vec4(pow(value.rgb, vec3(gammaFactor)), value.a);\n}\nvec4 LinearToGamma(in vec4 value, in float gammaFactor) {\n return vec4(pow(value.rgb, vec3(1.0 / gammaFactor)), value.a);\n}\nvec4 sRGBToLinear(in vec4 value) {\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.a);\n}\nvec4 LinearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.a);\n}\nvec4 RGBEToLinear(in vec4 value) {\n return vec4(value.rgb * exp2(value.a * 255.0 - 128.0), 1.0);\n}\nvec4 LinearToRGBE(in vec4 value) {\n float maxComponent = max(max(value.r, value.g), value.b);\n float fExp = clamp(ceil(log2(maxComponent)), -128.0, 127.0);\n return vec4(value.rgb / exp2(fExp), (fExp + 128.0) / 255.0);\n}\nvec4 RGBMToLinear(in vec4 value, in float maxRange) {\n return vec4(value.rgb * value.a * maxRange, 1.0);\n}\nvec4 LinearToRGBM(in vec4 value, in float maxRange) {\n float maxRGB = max(value.r, max(value.g, value.b));\n float M = clamp(maxRGB / maxRange, 0.0, 1.0);\n M = ceil(M * 255.0) / 255.0;\n return vec4(value.rgb / (M * maxRange), M);\n}\nvec4 RGBDToLinear(in vec4 value, in float maxRange) {\n return vec4(value.rgb * ((maxRange / 255.0) / value.a), 1.0);\n}\nvec4 LinearToRGBD(in vec4 value, in float maxRange) {\n float maxRGB = max(value.r, max(value.g, value.b));\n float D = max(maxRange / maxRGB, 1.0);\n D = min(floor(D) / 255.0, 1.0);\n return vec4(value.rgb * (D * (255.0 / maxRange)), D);\n}\nconst mat3 cLogLuvM = mat3(0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969);\nvec4 LinearToLogLuv(in vec4 value) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w * 255.0)) / 255.0) / 255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3(6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268);\nvec4 LogLuvToLinear(in vec4 value) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4(max(vRGB, 0.0), 1.0);\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE)\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n \n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect(cameraToVertex, worldNormal);\n #else\n vec3 reflectVec = refract(cameraToVertex, worldNormal, refractionRatio);\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec2 sampleUV;\n reflectVec = normalize(reflectVec);\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D(envMap, sampleUV);\n #elif defined(ENVMAP_TYPE_SPHERE)\n reflectVec = normalize(reflectVec);\n vec3 reflectView = 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 #else\n vec4 envColor = vec4(0.0);\n #endif\n envColor = envMapTexelToLinear(envColor);\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix(outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity);\n #elif defined(ENVMAP_BLENDING_MIX)\n outgoingLight = mix(outgoingLight, envColor.xyz, specularStrength * reflectivity);\n #elif defined(ENVMAP_BLENDING_ADD)\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif\n",envmap_pars_fragment:"#if defined(USE_ENVMAP) || defined(PHYSICAL)\n uniform float reflectivity;\n uniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n #if !defined(PHYSICAL) && (defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG))\n varying vec3 vWorldPosition;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n uniform int maxMipLevel;\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE) || defined(PHYSICAL)\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE)\n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif\n",envmap_physical_pars_fragment:"#if defined(USE_ENVMAP) && defined(PHYSICAL)\n vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel) {\n vec3 worldNormal = inverseTransformDirection(geometry.normal, viewMatrix);\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n \n \n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT(envMap, queryVec, float(maxMIPLevel));\n #else\n \n vec4 envMapColor = textureCube(envMap, queryVec, float(maxMIPLevel));\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_CUBE_UV)\n vec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n vec4 envMapColor = textureCubeUV(envMap, queryVec, 1.0);\n #else\n vec4 envMapColor = vec4(0.0);\n #endif\n return PI * envMapColor.rgb * envMapIntensity;\n }\n \n float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\n \n \n float maxMIPLevelScalar = float(maxMIPLevel);\n float desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2(pow2(blinnShininessExponent) + 1.0);\n \n return clamp(desiredMIPLevel, 0.0, maxMIPLevelScalar);\n }\n vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel) {\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect(-geometry.viewDir, geometry.normal);\n #else\n vec3 reflectVec = refract(-geometry.viewDir, geometry.normal, refractionRatio);\n #endif\n reflectVec = inverseTransformDirection(reflectVec, viewMatrix);\n float specularMIPLevel = getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\n #ifdef ENVMAP_TYPE_CUBE\n vec3 queryReflectVec = vec3(flipEnvMap * reflectVec.x, reflectVec.yz);\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = textureCubeLodEXT(envMap, queryReflectVec, specularMIPLevel);\n #else\n vec4 envMapColor = textureCube(envMap, queryReflectVec, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_CUBE_UV)\n vec3 queryReflectVec = vec3(flipEnvMap * reflectVec.x, reflectVec.yz);\n vec4 envMapColor = textureCubeUV(envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n #elif defined(ENVMAP_TYPE_EQUIREC)\n vec2 sampleUV;\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, sampleUV, specularMIPLevel);\n #else\n vec4 envMapColor = texture2D(envMap, sampleUV, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #elif defined(ENVMAP_TYPE_SPHERE)\n vec3 reflectView = normalize((viewMatrix * vec4(reflectVec, 0.0)).xyz + vec3(0.0,0.0,1.0));\n #ifdef TEXTURE_LOD_EXT\n vec4 envMapColor = texture2DLodEXT(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n #else\n vec4 envMapColor = texture2D(envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel);\n #endif\n envMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n #endif\n return envMapColor.rgb * envMapIntensity;\n }\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n #if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG) || defined(NODE)\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex = normalize(worldPosition.xyz - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(transformedNormal, viewMatrix);\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect(cameraToVertex, worldNormal);\n #else\n vReflect = refract(cameraToVertex, worldNormal, refractionRatio);\n #endif\n #endif\n#endif\n",fog_vertex:"#ifdef USE_FOG\n fogDepth = -mvPosition.z;\n#endif\n",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = whiteCompliment(exp2(- fogDensity * fogDensity * fogDepth * fogDepth * LOG2));\n #else\n float fogFactor = smoothstep(fogNear, fogFar, fogDepth);\n #endif\n gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float fogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n uniform sampler2D gradientMap;\n vec3 getGradientIrradiance(vec3 normal, vec3 lightDirection) {\n \n float dotNL = dot(normal, lightDirection);\n vec2 coord = vec2(dotNL * 0.5 + 0.5, 0.0);\n #ifdef USE_GRADIENTMAP\n return texture2D(gradientMap, coord).rgb;\n #else\n return (coord.x < 0.7) ? vec3(0.7) : vec3(1.0);\n #endif\n }\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += PI * texture2D(lightMap, vUv2).xyz * lightMapIntensity; \n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3(1.0);\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize(transformedNormal);\ngeometry.viewDir = normalize(-mvPosition.xyz);\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3(0.0);\n#ifdef DOUBLE_SIDED\n vLightBack = vec3(0.0);\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n getPointDirectLightIrradiance(pointLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n getSpotDirectLightIrradiance(spotLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n getDirectionalDirectLightIrradiance(directionalLights[i], geometry, directLight);\n dotNL = dot(geometry.normal, directLight.direction);\n directLightColor_Diffuse = PI * directLight.color;\n vLightFront += saturate(dotNL) * directLightColor_Diffuse;\n #ifdef DOUBLE_SIDED\n vLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n #endif\n }\n#endif\n#if NUM_HEMI_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_HEMI_LIGHTS; i++) {\n vLightFront += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n #ifdef DOUBLE_SIDED\n vLightBack += getHemisphereLightIrradiance(hemisphereLights[i], backGeometry);\n #endif\n }\n#endif\n",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance(const in vec3 ambientLightColor) {\n vec3 irradiance = ambientLightColor;\n \n #if defined(BLENDER_LIGHTS) || !defined(PHYSICALLY_CORRECT_LIGHTS)\n irradiance *= PI;\n #endif\n return irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];\n void getDirectionalDirectLightIrradiance(const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight) {\n directLight.color = directionalLight.color;\n directLight.direction = directionalLight.direction;\n directLight.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLight pointLights[NUM_POINT_LIGHTS];\n \n void getPointDirectLightIrradiance(const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight) {\n vec3 lVector = pointLight.position - geometry.position;\n directLight.direction = normalize(lVector);\n float lightDistance = length(lVector);\n directLight.color = pointLight.color;\n directLight.color *= punctualLightIntensityToIrradianceFactor(lightDistance, pointLight.distance, pointLight.decay);\n directLight.visible = (directLight.color != vec3(0.0));\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n int shadow;\n float shadowBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLight spotLights[NUM_SPOT_LIGHTS];\n \n void getSpotDirectLightIrradiance(const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight) {\n vec3 lVector = spotLight.position - geometry.position;\n directLight.direction = normalize(lVector);\n float lightDistance = length(lVector);\n float angleCos = dot(directLight.direction, spotLight.direction);\n if (angleCos > spotLight.coneCos) {\n float spotEffect = smoothstep(spotLight.coneCos, spotLight.penumbraCos, angleCos);\n directLight.color = spotLight.color;\n directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor(lightDistance, spotLight.distance, spotLight.decay);\n directLight.visible = true;\n } else {\n directLight.color = vec3(0.0);\n directLight.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n \n \n uniform sampler2D ltc_1; \n uniform sampler2D ltc_2; \n uniform RectAreaLight rectAreaLights[NUM_RECT_AREA_LIGHTS];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[NUM_HEMI_LIGHTS];\n vec3 getHemisphereLightIrradiance(const in HemisphereLight hemiLight, const in GeometricContext geometry) {\n float dotNL = dot(geometry.normal, hemiLight.direction);\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix(hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight);\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI;\n #endif\n return irradiance;\n }\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong(const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef TOON\n vec3 irradiance = getGradientIrradiance(geometry.normal, directLight.direction) * directLight.color;\n #else\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #endif\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI; \n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong(directLight, geometry, material.specularColor, material.specularShininess) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong(const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD(material) (0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * (1.0 - metalnessFactor);\nmaterial.specularRoughness = clamp(roughnessFactor, 0.04, 1.0);\n#ifdef STANDARD\n material.specularColor = mix(vec3(DEFAULT_SPECULAR_COEFFICIENT), diffuseColor.rgb, metalnessFactor);\n#else\n material.specularColor = mix(vec3(MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity)), diffuseColor.rgb, metalnessFactor);\n material.clearCoat = saturate(clearCoat); \n material.clearCoatRoughness = clamp(clearCoatRoughness, 0.04, 1.0);\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float specularRoughness;\n vec3 specularColor;\n #ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\n #endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox(const in float roughness, const in float dotNL) {\n return DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical(const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[4];\n rectCoords[0] = lightPos - halfWidth - halfHeight; \n rectCoords[1] = lightPos + halfWidth - halfHeight;\n rectCoords[2] = lightPos + halfWidth + halfHeight;\n rectCoords[3] = lightPos - halfWidth + halfHeight;\n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(ltc_1, uv);\n vec4 t2 = texture2D(ltc_2, uv);\n mat3 mInv = mat3(\n vec3(t1.x, 0, t1.y),\n vec3( 0, 1, 0),\n vec3(t1.z, 0, t1.w)\n );\n \n \n vec3 fresnel = (material.specularColor * t2.x + (vec3(1.0) - material.specularColor) * t2.y);\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords);\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords);\n }\n#endif\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI; \n #endif\n #ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.directSpecular += (1.0 - clearCoatDHR) * irradiance * BRDF_Specular_GGX(directLight, geometry, material.specularColor, material.specularRoughness);\n reflectedLight.directDiffuse += (1.0 - clearCoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n #ifndef STANDARD\n reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX(directLight, geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n}\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectSpecular_Physical(const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifndef STANDARD\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n float dotNL = dotNV;\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.indirectSpecular += (1.0 - clearCoatDHR) * radiance * BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\n #ifndef STANDARD\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment(geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearCoatRoughness)\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness) {\n return saturate(pow(dotNV + ambientOcclusion, exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}\n",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize(vViewPosition);\nIncidentLight directLight;\n#if (NUM_POINT_LIGHTS > 0) && defined(RE_Direct)\n PointLight pointLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n pointLight = pointLights[i];\n getPointDirectLightIrradiance(pointLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(pointLight.shadow, directLight.visible)) ? getPointShadow(pointShadowMap[i], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[i], pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_SPOT_LIGHTS > 0) && defined(RE_Direct)\n SpotLight spotLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n spotLight = spotLights[i];\n getSpotDirectLightIrradiance(spotLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(spotLight.shadow, directLight.visible)) ? getShadow(spotShadowMap[i], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[i]) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_DIR_LIGHTS > 0) && defined(RE_Direct)\n DirectionalLight directionalLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n directionalLight = directionalLights[i];\n getDirectionalDirectLightIrradiance(directionalLight, geometry, directLight);\n #ifdef USE_SHADOWMAP\n directLight.color *= all(bvec2(directionalLight.shadow, directLight.visible)) ? getShadow(directionalShadowMap[i], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[i]) : 1.0;\n #endif\n RE_Direct(directLight, geometry, material, reflectedLight);\n }\n#endif\n#if (NUM_RECT_AREA_LIGHTS > 0) && defined(RE_Direct_RectArea)\n RectAreaLight rectAreaLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_RECT_AREA_LIGHTS; i++) {\n rectAreaLight = rectAreaLights[i];\n RE_Direct_RectArea(rectAreaLight, geometry, material, reflectedLight);\n }\n#endif\n#if defined(RE_IndirectDiffuse)\n vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n #if (NUM_HEMI_LIGHTS > 0)\n #pragma unroll_loop\n for (int i = 0; i < NUM_HEMI_LIGHTS; i++) {\n irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n #if defined(BLENDER_LIGHTS) && !defined(PHYSICAL)\n RE_HemiSpec_Blender(hemisphereLights[i], geometry, material, reflectedLight);\n #endif\n }\n #endif\n#endif\n#if defined(RE_IndirectSpecular)\n vec3 radiance = vec3(0.0);\n vec3 clearCoatRadiance = vec3(0.0);\n#endif\n",lights_fragment_maps:"#if defined(RE_IndirectDiffuse)\n #ifdef USE_LIGHTMAP\n vec3 lightMapIrradiance = texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI; \n #endif\n irradiance += lightMapIrradiance;\n #endif\n #if defined(USE_ENVMAP) && defined(PHYSICAL) && defined(ENVMAP_TYPE_CUBE_UV)\n irradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel);\n #endif\n#endif\n#if defined(USE_ENVMAP) && defined(RE_IndirectSpecular)\n radiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent(material), maxMipLevel);\n #ifndef STANDARD\n clearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent(material), maxMipLevel);\n #endif\n#endif\n",lights_fragment_end:"#if defined(RE_IndirectDiffuse)\n RE_IndirectDiffuse(irradiance, geometry, material, reflectedLight);\n#endif\n#if defined(RE_IndirectSpecular)\n RE_IndirectSpecular(radiance, clearCoatRadiance, geometry, material, reflectedLight);\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n uniform float logDepthBufFC;\n varying float vFragDepth;\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif\n",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n #else\n gl_Position.z = log2(max(EPSILON, gl_Position.w + 1.0)) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n #endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n vec4 texelColor = texture2D(map, vUv);\n texelColor = mapTexelToLinear(texelColor);\n diffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n vec2 uv = (uvTransform * vec3(gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1)).xy;\n vec4 mapTexel = texture2D(map, uv);\n diffuseColor *= mapTexelToLinear(mapTexel);\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n uniform mat3 uvTransform;\n uniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D(metalnessMap, vUv);\n \n metalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal += (morphNormal0 - normal) * morphTargetInfluences[0];\n objectNormal += (morphNormal1 - normal) * morphTargetInfluences[1];\n objectNormal += (morphNormal2 - normal) * morphTargetInfluences[2];\n objectNormal += (morphNormal3 - normal) * morphTargetInfluences[3];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[8];\n #else\n uniform float morphTargetInfluences[4];\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed += (morphTarget0 - position) * morphTargetInfluences[0];\n transformed += (morphTarget1 - position) * morphTargetInfluences[1];\n transformed += (morphTarget2 - position) * morphTargetInfluences[2];\n transformed += (morphTarget3 - position) * morphTargetInfluences[3];\n #ifndef USE_MORPHNORMALS\n transformed += (morphTarget4 - position) * morphTargetInfluences[4];\n transformed += (morphTarget5 - position) * morphTargetInfluences[5];\n transformed += (morphTarget6 - position) * morphTargetInfluences[6];\n transformed += (morphTarget7 - position) * morphTargetInfluences[7];\n #endif\n#endif\n",normal_fragment_begin:"#ifdef FLAT_SHADED\n \n vec3 fdx = vec3(dFdx(vViewPosition.x), dFdx(vViewPosition.y), dFdx(vViewPosition.z));\n vec3 fdy = vec3(dFdy(vViewPosition.x), dFdy(vViewPosition.y), dFdy(vViewPosition.z));\n vec3 normal = normalize(cross(fdx, fdy));\n#else\n vec3 normal = normalize(vNormal);\n #ifdef DOUBLE_SIDED\n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n #endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n #ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D(normalMap, vUv).xyz * 2.0 - 1.0; \n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n #endif\n normal = normalize(normalMatrix * normal);\n \n #elif defined(USE_NORMALMAP_TANGENTS)\n \n \n normal = perturbNormalTang(vNormal);\n #else\n normal = perturbNormal2Arb(-vViewPosition, normal);\n #endif\n#elif defined(USE_BUMPMAP)\n normal = perturbNormalArb(-vViewPosition, normal, dHdxy_fwd());\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n #ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n #elif defined(USE_NORMALMAP_TANGENTS)\n \n uniform mat4 modelViewMatrix;\n varying vec4 vTangent;\n vec3 perturbNormalTang(vec3 normal) {\n vec3 normalTex = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n normalTex.xy *= normalScale;\n normalTex = normalize(normalTex);\n \n vec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(vTangent.xyz, 0.0)).xyz), vTangent.w);\n vec3 bitangent = -viewTangent.w * cross(normal, viewTangent.xyz);\n vec3 normalOut = normalTex.x * (viewTangent.xyz) + normalTex.y * bitangent \n + normalTex.z * normal;\n normalOut = normalize(normalOut);\n return normalOut;\n }\n #else\n \n \n vec3 perturbNormal2Arb(vec3 eye_pos, vec3 surf_norm) {\n \n vec3 q0 = vec3(dFdx(eye_pos.x), dFdx(eye_pos.y), dFdx(eye_pos.z));\n vec3 q1 = vec3(dFdy(eye_pos.x), dFdy(eye_pos.y), dFdy(eye_pos.z));\n vec2 st0 = dFdx(vUv.st);\n vec2 st1 = dFdy(vUv.st);\n float scale = sign(st1.t * st0.s - st0.t * st1.s); \n vec3 S = normalize((q0 * st1.t - q1 * st0.t) * scale);\n vec3 T = normalize((- q0 * st1.s + q1 * st0.s) * scale);\n vec3 N = normalize(surf_norm);\n mat3 tsn = mat3(S, T, N);\n vec3 mapN = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n mapN.xy *= (float(gl_FrontFacing) * 2.0 - 1.0);\n return normalize(tsn * mapN);\n }\n #endif\n#endif\n",packing:"vec3 packNormalToRGB(const in vec3 normal) {\n return normalize(normal) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal(const in vec3 rgb) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.; \nconst float UnpackDownscale = 255. / 256.; \nconst vec3 PackFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.);\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; \n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\nfloat viewZToOrthographicDepth(const in float viewZ, const in float near, const in float far) {\n return (viewZ + near) / (near - far);\n}\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\nfloat viewZToPerspectiveDepth(const in float viewZ, const in float near, const in float far) {\n return ((near + viewZ) * far) / ((far - near) * viewZ);\n}\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n \n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4(transformed, 1.0);\ngl_Position = projectionMatrix * mvPosition;\n#if defined(BACKGROUND_DEPTH)\n gl_Position.z = gl_Position.w;\n#endif\n",dithering_fragment:"#if defined(DITHERING)\n gl_FragColor.rgb = dithering(gl_FragColor.rgb);\n#endif\n",dithering_pars_fragment:"#if defined(DITHERING)\n \n vec3 dithering(vec3 color) {\n \n float grid_position = rand(gl_FragCoord.xy);\n \n vec3 dither_shift_RGB = vec3(0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0);\n \n dither_shift_RGB = mix(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position);\n \n return color + dither_shift_RGB;\n }\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D(roughnessMap, vUv);\n \n roughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform sampler2D directionalShadowMap[NUM_DIR_LIGHTS];\n varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHTS];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform sampler2D spotShadowMap[NUM_SPOT_LIGHTS];\n varying vec4 vSpotShadowCoord[NUM_SPOT_LIGHTS];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform sampler2D pointShadowMap[NUM_POINT_LIGHTS];\n varying vec4 vPointShadowCoord[NUM_POINT_LIGHTS];\n #endif\n \n float texture2DCompare(sampler2D depths, vec2 uv, float compare) {\n return step(compare, unpackRGBAToDepth(texture2D(depths, uv)));\n }\n float texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare) {\n const vec2 offset = vec2(0.0, 1.0);\n vec2 texelSize = vec2(1.0) / size;\n vec2 centroidUV = floor(uv * size + 0.5) / size;\n float lb = texture2DCompare(depths, centroidUV + texelSize * offset.xx, compare);\n float lt = texture2DCompare(depths, centroidUV + texelSize * offset.xy, compare);\n float rb = texture2DCompare(depths, centroidUV + texelSize * offset.yx, compare);\n float rt = texture2DCompare(depths, centroidUV + texelSize * offset.yy, compare);\n vec2 f = fract(uv * size + 0.5);\n float a = mix(lb, lt, f.y);\n float b = mix(rb, rt, f.y);\n float c = mix(a, b, f.x);\n return c;\n }\n float getShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n \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 bvec2 frustumTestVec = bvec2(inFrustum, shadowCoord.z <= 1.0);\n bool frustumTest = all(frustumTestVec);\n if (frustumTest) {\n #if defined(SHADOWMAP_TYPE_PCF)\n vec2 texelSize = vec2(1.0) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n shadow = (\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n texture2DCompare(shadowMap, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n ) * (1.0 / 9.0);\n #elif defined(SHADOWMAP_TYPE_PCF_SOFT)\n vec2 texelSize = vec2(1.0) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n shadow = (\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, 0.0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, 0.0), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx0, dy1), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(0.0, dy1), shadowCoord.z) +\n texture2DShadowLerp(shadowMap, shadowMapSize, shadowCoord.xy + vec2(dx1, dy1), shadowCoord.z)\n ) * (1.0 / 9.0);\n #else \n shadow = texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z);\n #endif\n }\n return shadow;\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n vec2 cubeToUV(vec3 v, float texelSizeY) {\n \n vec3 absV = abs(v);\n \n float scaleToCube = 1.0 / max(absV.x, max(absV.y, absV.z));\n absV *= scaleToCube;\n \n \n v *= scaleToCube * (1.0 - 2.0 * texelSizeY);\n \n \n \n \n \n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if (absV.z >= almostOne) {\n if (v.z > 0.0)\n planar.x = 4.0 - v.x;\n } else if (absV.x >= almostOne) {\n float signX = sign(v.x);\n planar.x = v.z * signX + 2.0 * signX;\n } else if (absV.y >= almostOne) {\n float signY = sign(v.y);\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n \n \n \n return vec2(0.125, 0.25) * planar + vec2(0.375, 0.75);\n }\n float getPointShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar) {\n vec2 texelSize = vec2(1.0) / (shadowMapSize * vec2(4.0, 2.0));\n \n \n vec3 lightToPosition = shadowCoord.xyz;\n \n float dp = (length(lightToPosition) - shadowCameraNear) / (shadowCameraFar - shadowCameraNear); \n dp += shadowBias;\n \n vec3 bd3D = normalize(lightToPosition);\n #if defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT)\n vec2 offset = vec2(- 1, 1) * shadowRadius * texelSize.y;\n return (\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xyy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yyy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xyx, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yyx, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xxy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yxy, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.xxx, texelSize.y), dp) +\n texture2DCompare(shadowMap, cubeToUV(bd3D + offset.yxx, texelSize.y), dp)\n ) * (1.0 / 9.0);\n #else \n return texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp);\n #endif\n }\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n uniform mat4 directionalShadowMatrix[NUM_DIR_LIGHTS];\n varying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHTS];\n #endif\n #if NUM_SPOT_LIGHTS > 0\n uniform mat4 spotShadowMatrix[NUM_SPOT_LIGHTS];\n varying vec4 vSpotShadowCoord[NUM_SPOT_LIGHTS];\n #endif\n #if NUM_POINT_LIGHTS > 0\n uniform mat4 pointShadowMatrix[NUM_POINT_LIGHTS];\n varying vec4 vPointShadowCoord[NUM_POINT_LIGHTS];\n #endif\n \n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n vDirectionalShadowCoord[i] = directionalShadowMatrix[i] * worldPosition;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n vSpotShadowCoord[i] = spotShadowMatrix[i] * worldPosition;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n vPointShadowCoord[i] = pointShadowMatrix[i] * worldPosition;\n }\n #endif\n \n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_DIR_LIGHTS; i++) {\n directionalLight = directionalLights[i];\n shadow *= bool(directionalLight.shadow) ? getShadow(directionalShadowMap[i], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[i]) : 1.0;\n }\n #endif\n #if NUM_SPOT_LIGHTS > 0\n SpotLight spotLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n spotLight = spotLights[i];\n shadow *= bool(spotLight.shadow) ? getShadow(spotShadowMap[i], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[i]) : 1.0;\n }\n #endif\n #if NUM_POINT_LIGHTS > 0\n PointLight pointLight;\n #pragma unroll_loop\n for (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n pointLight = pointLights[i];\n shadow *= bool(pointLight.shadow) ? getPointShadow(pointShadowMap[i], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[i], pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;\n }\n #endif\n \n #endif\n return shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\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#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n #ifdef BONE_TEXTURE\n uniform sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix(const in float i) {\n float j = i * 4.0;\n float x = mod(j, float(boneTextureSize));\n float y = floor(j / float(boneTextureSize));\n float dx = 1.0 / float(boneTextureSize);\n float dy = 1.0 / float(boneTextureSize);\n y = dy * (y + 0.5);\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 mat4 bone = mat4(v1, v2, v3, v4);\n return bone;\n }\n #else\n uniform mat4 boneMatrices[MAX_BONES];\n mat4 getBoneMatrix(const in float i) {\n mat4 bone = boneMatrices[int(i)];\n return bone;\n }\n #endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4(transformed, 1.0);\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 transformed = (bindMatrixInverse * skinned).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\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 objectNormal = vec4(skinMatrix * vec4(objectNormal, 0.0)).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D(specularMap, vUv);\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined(TONE_MAPPING)\n gl_FragColor.rgb = toneMapping(gl_FragColor.rgb);\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n #define saturate(a) clamp(a, 0.0, 1.0)\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping(vec3 color) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping(vec3 color) {\n color *= toneMappingExposure;\n return saturate(color / (vec3(1.0) + color));\n}\n#define Uncharted2Helper(x) max(((x * (0.15 * x + 0.10 * 0.50) + 0.20 * 0.02) / (x * (0.15 * x + 0.50) + 0.20 * 0.30)) - 0.02 / 0.30, vec3(0.0))\nvec3 Uncharted2ToneMapping(vec3 color) {\n \n color *= toneMappingExposure;\n return saturate(Uncharted2Helper(color) / Uncharted2Helper(vec3(toneMappingWhitePoint)));\n}\nvec3 OptimizedCineonToneMapping(vec3 color) {\n \n color *= toneMappingExposure;\n color = max(vec3(0.0), color - 0.004);\n return pow((color * (6.2 * color + 0.5)) / (color * (6.2 * color + 1.7) + 0.06), vec3(2.2));\n}\nvec3 LogarithmicToneMapping(vec3 color) {\n return log(color + 1.0) / log(toneMappingExposure + 1.0);\n}\n",uv_pars_fragment:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n varying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined(USE_MAP) || defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(USE_SPECULARMAP) || defined(USE_ALPHAMAP) || defined(USE_EMISSIVEMAP) || defined(USE_ROUGHNESSMAP) || defined(USE_METALNESSMAP)\n vUv = (uvTransform * vec3(uv, 1)).xy;\n#endif",uv2_pars_fragment:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n varying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n attribute vec2 uv2;\n varying vec2 vUv2;\n#endif",uv2_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\n vUv2 = uv2;\n#endif",worldpos_vertex:"#if defined(USE_ENVMAP) || defined(DISTANCE) || defined (USE_SHADOWMAP) || defined(MASK) || defined(NODE)\n vec4 worldPosition = modelMatrix * vec4(transformed, 1.0);\n#endif\n",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(t2D, vUv);\n}\n",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = (uvTransform * vec3(uv, 1)).xy;\n gl_Position = vec4(position, 1.0);\n gl_Position.z = 1.0;\n}\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n gl_FragColor = envMapTexelToLinear(textureCube(tCube,\n vec3(tFlip * vWorldDirection.x, vWorldDirection.yz)));\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}\n",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection(position, modelMatrix);\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w; \n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(1.0);\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4(vec3(1.0 - gl_FragCoord.z), opacity);\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(1.0);\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length(vWorldPosition - referencePosition);\n dist = (dist - nearDistance) / (farDistance - nearDistance);\n dist = saturate(dist); \n gl_FragColor = packDepthToRGBA(dist);\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize(vWorldDirection);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n \n if (invertU) {\n sampleUV.x = 1.0 - sampleUV.x;\n }\n \n sampleUV.x += offsetU;\n gl_FragColor = texture2D(tEquirect, sampleUV);\n}\n",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection(position, modelMatrix);\n #include <begin_vertex>\n #include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if (mod(vLineDistance, totalSize) > dashSize) {\n discard;\n }\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb; \n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n \n #ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += texture2D(lightMap, vUv2).xyz * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3(1.0);\n #endif\n \n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <skinbase_vertex>\n #ifdef USE_ENVMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <emissivemap_fragment>\n \n reflectedLight.indirectDiffuse = getAmbientLightIrradiance(ambientLightColor);\n #include <lightmap_fragment>\n reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb);\n #ifdef DOUBLE_SIDED\n reflectedLight.directDiffuse = (gl_FrontFacing) ? vLightFront : vLightBack;\n #else\n reflectedLight.directDiffuse = vLightFront;\n #endif\n reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb) * getShadowMask();\n \n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n varying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <lights_lambert_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize(vViewPosition);\n vec3 x = normalize(vec3(viewDir.z, 0.0, - viewDir.x));\n vec3 y = cross(viewDir, x);\n vec2 uv = vec2(dot(x, normal), dot(y, normal)) * 0.495 + 0.5; \n vec4 matcapColor = texture2D(matcap, uv);\n matcapColor = matcapTexelToLinear(matcapColor);\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n \n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n \n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#include <normalmap_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <normalmap_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n uniform float clearCoat;\n uniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n \n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n \n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#include <normalmap_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <normalmap_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || (defined(USE_NORMALMAP) && !defined(OBJECTSPACE_NORMALMAP))\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4(packNormalToRGB(normal), opacity);\n}\n",normal_vert:"#define NORMAL\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || (defined(USE_NORMALMAP) && !defined(OBJECTSPACE_NORMALMAP))\n varying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <normalmap_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <normalmap_vertex>\n #include <logdepthbuf_vertex>\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || (defined(USE_NORMALMAP) && !defined(OBJECTSPACE_NORMALMAP))\n vViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <premultiplied_alpha_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = (projectionMatrix[2][3] == - 1.0);\n if (isPerspective) gl_PointSize *= (scale / - mvPosition.z);\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n gl_FragColor = vec4(color, opacity * (1.0 - getShadowMask()));\n #include <fog_fragment>\n}\n",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <begin_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}\n",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3(0.0);\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n vec2 scale;\n scale.x = length(vec3(modelMatrix[0].x, modelMatrix[0].y, modelMatrix[0].z));\n scale.y = length(vec3(modelMatrix[1].x, modelMatrix[1].y, modelMatrix[1].z));\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = (projectionMatrix[2][3] == - 1.0);\n if (isPerspective) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = (position.xy - (center - vec2(0.5))) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos(rotation) * alignedPosition.x - sin(rotation) * alignedPosition.y;\n rotatedPosition.y = sin(rotation) * alignedPosition.x + cos(rotation) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}\n",equicube_frag:"uniform sampler2D tEquirect;\nuniform int faceIndex;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec2 vUv;\n#include <common>\nvoid main() {\n vec3 direction;\n vec2 uv = vUv * 2.0 - 1.0;\n if (faceIndex==0) {\n direction = vec3(1.0, -uv.y, -uv.x);\n } else if (faceIndex==1) {\n direction = vec3(-1.0, -uv.y, uv.x);\n } else if (faceIndex==2) {\n direction = vec3(uv.x, 1.0, uv.y);\n } else if (faceIndex==3) {\n direction = vec3(uv.x, -1.0, -uv.y);\n } else if (faceIndex==4) {\n direction = vec3(uv.x, -uv.y, 1.0);\n } else {\n direction = vec3(-uv.x, -uv.y, -1.0);\n }\n direction = normalize(direction);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n sampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n if (invertU) {\n sampleUV.x = 1.0 - sampleUV.x;\n }\n \n sampleUV.x += offsetU;\n gl_FragColor = texture2D(tEquirect, sampleUV);\n}\n",equicube_vert:"varying vec2 vUv;\n#include <common>\nvoid main() {\n vUv = uv;\n #include <begin_vertex>\n #include <project_vertex>\n}\n",mask_frag:"#define MASK\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nuniform mat4 projectionMatrix;\nuniform float opacity;\nuniform sampler2D depthTexture;\nuniform vec2 cameraNearFar;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(1.0);\n diffuseColor.a = opacity;\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float depth = unpackRGBAToDepth(texture2DProj(depthTexture, projTexCoord));\n float viewZ;\n if (isOrtho(projectionMatrix))\n viewZ = -orthographicDepthToViewZ(depth,\n cameraNearFar.x, cameraNearFar.y);\n else\n viewZ = -perspectiveDepthToViewZ(depth,\n cameraNearFar.x, cameraNearFar.y);\n float depthTest = (vViewPosition.z > viewZ) ? 1.0 : 0.0;\n gl_FragColor = vec4(0.0, depthTest, 1.0, 0.0);\n}\n",mask_vert:"#define MASK\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nuniform mat4 textureMatrix;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n#ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n vViewPosition = -mvPosition.xyz;\n #include <worldpos_vertex>\n projTexCoord = textureMatrix * worldPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n}\n",meshnode_frag:"#define NODE\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_node_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n#if defined(NODE_GEOMETRY) || defined(NODE_NEW_GEOMETRY) || defined(NODE_VECT_TRANSFORM) || defined(NODE_TEX_COORD) || defined(NODE_MATERIAL) || defined(NODE_MATERIAL_EXT) || defined(NODE_NORMAL_MAP) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FRESNEL) || defined(NODE_BUMP)\nuniform mat4 invViewMatrix;\n#endif\n#if defined(NODE_GEOMETRY) || defined(NODE_NEW_GEOMETRY) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FRESNEL)\nuniform mat4 projectionMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM) || defined(NODE_TEX_COORD)\nuniform mat4 modelMatrix;\nuniform mat4 invModelMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM) || defined(NODE_NORMAL_MAP) || defined(NODE_NORMAL_BUMP_MAX)\nuniform mat4 modelViewMatrix;\n#endif\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_BUMP)\nvarying vec3 vWorldPosition;\n#endif\n#include <node_common_frag>\n#include <node_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n vec4 outgoingLight = vec4(0.0);\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n \n #include <node_fragment>\n #ifdef ALPHATEST\n if (outgoingLight.a < ALPHATEST)\n discard;\n else\n outgoingLight.a = 1.0;\n #endif\n gl_FragColor = vec4(outgoingLight);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n",meshnode_vert:"#define NODE\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_BUMP)\nvarying vec3 vWorldPosition;\n#endif\n#include <node_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n#ifndef FLAT_SHADED \n vNormal = normalize(transformedNormal);\n#endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX) || defined(NODE_BUMP)\n vWorldPosition = worldPosition.xyz;\n#endif\n #include <node_vertex>\n}\n",normalmap_pars_vertex:"#if defined(USE_NORMALMAP) || defined(USE_NORMALMAP_TANGENTS)\nattribute vec4 tangent;\nvarying vec4 vTangent;\n#endif",normalmap_vertex:"#if defined(USE_NORMALMAP) || defined(USE_NORMALMAP_TANGENTS)\n vTangent = tangent;\n#endif",lights_node_pars_fragment:"\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\nstruct NodeMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n #ifdef PHYSICAL\n float specularRoughness;\n #ifndef STANDARD\n float clearCoat;\n float clearCoatRoughness;\n #endif\n #else\n float diffuseIntensity;\n float specularIntensity;\n float specularHardness;\n #endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\n#define BLENDER_SPECULAR_COEFFICIENT 0.08\nfloat shadeSpecPhong(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\n float specFac;\n vec3 h = normalize(lightDir + viewDir);\n float rslt = max(dot(h, normal), 0.0);\n specFac = pow(rslt, hard);\n return specFac;\n}\nfloat shadeSpecHemi(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\n float specFac;\n vec3 h = normalize(lightDir + viewDir);\n float rslt = 0.5 * max(dot(h, normal), 0.0) + 0.5;\n specFac = pow(rslt, hard);\n return specFac;\n}\nfloat clearCoatDHRApprox(const in float roughness, const in float dotNL) {\n return DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Node(const in RectAreaLight rectAreaLight,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.specularRoughness;\n vec3 rectCoords[4];\n rectCoords[0] = lightPos - halfWidth - halfHeight; \n rectCoords[1] = lightPos + halfWidth - halfHeight;\n rectCoords[2] = lightPos + halfWidth + halfHeight;\n rectCoords[3] = lightPos - halfWidth + halfHeight;\n vec2 uv = LTC_Uv(normal, viewDir, roughness);\n vec4 t1 = texture2D(ltc_1, uv);\n vec4 t2 = texture2D(ltc_2, uv);\n mat3 mInv = mat3(\n vec3(t1.x, 0, t1.y),\n vec3( 0, 1, 0),\n vec3(t1.z, 0, t1.w)\n );\n \n \n vec3 fresnel = (material.specularColor * t2.x + (vec3(1.0) - material.specularColor) * t2.y);\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords);\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords);\n }\n#endif\nvoid RE_Direct_Node(const in IncidentLight directLight,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n irradiance *= PI; \n #endif\n #ifdef PHYSICAL\n #ifndef STANDARD\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.directSpecular += (1.0 - clearCoatDHR) * irradiance * BRDF_Specular_GGX(directLight, geometry, material.specularColor, material.specularRoughness);\n reflectedLight.directDiffuse += (1.0 - clearCoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n #ifndef STANDARD\n reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX(directLight, geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n #else\n reflectedLight.directDiffuse += irradiance * material.diffuseIntensity * BRDF_Diffuse_Lambert(material.diffuseColor);\n \n reflectedLight.directSpecular += material.specularIntensity *\n shadeSpecPhong(geometry.normal, directLight.direction,\n geometry.viewDir, material.specularHardness) *\n directLight.color * material.specularColor;\n #endif\n}\nvoid RE_IndirectDiffuse_Node(const in vec3 irradiance, const in\n GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#ifdef PHYSICAL\n void RE_IndirectSpecular_Node(const in vec3 radiance, const in vec3 clearCoatRadiance,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight) {\n #ifndef STANDARD\n float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n float dotNL = dotNV;\n float clearCoatDHR = material.clearCoat * clearCoatDHRApprox(material.clearCoatRoughness, dotNL);\n #else\n float clearCoatDHR = 0.0;\n #endif\n reflectedLight.indirectSpecular += (1.0 - clearCoatDHR) * radiance * BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);\n #ifndef STANDARD\n reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment(geometry, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearCoatRoughness);\n #endif\n }\n#else\n #if defined(BLENDER_LIGHTS) && NUM_HEMI_LIGHTS > 0\n void RE_HemiSpec_Blender(const in HemisphereLight hemiLight,\n const in GeometricContext geometry, const in NodeMaterial material,\n inout ReflectedLight reflectedLight)\n {\n reflectedLight.indirectSpecular += material.specularIntensity *\n shadeSpecHemi(geometry.normal, hemiLight.direction,\n geometry.viewDir, material.specularHardness) *\n hemiLight.skyColor * material.specularColor;\n }\n #endif\n#endif\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearCoatRoughness)\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness) {\n return saturate(pow(dotNV + ambientOcclusion, exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}\n#define RE_Direct RE_Direct_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_Direct_RectArea RE_Direct_RectArea_Node\n#ifdef PHYSICAL\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#endif\n",node_common_frag:"\n#define WATT_PER_CANDELA 683.0\nvec4 nodeTexelToLinear(in vec4 color, in int sourceType) {\n if (sourceType == 1)\n return sRGBToLinear(color);\n else if (sourceType == 2)\n return RGBEToLinear(color);\n else\n return color;\n}\n#if defined(NODE_COMBHSV) || defined(NODE_SEPHSV) || defined(NODE_HUE_SAT) || defined(NODE_MIX_RGB_HSV) || defined(NODE_COLOR_CORRECTION_MAX) || defined(NODE_COMPOSITE_LAYER_MAX)\nvoid hsvToRGB(vec4 hsv, out vec4 outCol)\n{\n float i, f, p, q, t, h, s, v;\n vec3 rgb;\n h = hsv[0];\n s = hsv[1];\n v = hsv[2];\n if (s == 0.0)\n rgb = vec3(v, v, v);\n else {\n if (h == 1.0)\n h = 0.0;\n h *= 6.0;\n i = floor(h);\n f = h - i;\n rgb = vec3(f, f, f);\n p = v * (1.0 - s);\n q = v * (1.0 - (s * f));\n t = v * (1.0 - (s * (1.0 - f)));\n if (i == 0.0)\n rgb = vec3(v, t, p);\n else if (i == 1.0)\n rgb = vec3(q, v, p);\n else if (i == 2.0)\n rgb = vec3(p, v, t);\n else if (i == 3.0)\n rgb = vec3(p, q, v);\n else if (i == 4.0)\n rgb = vec3(t, p, v);\n else\n rgb = vec3(v, p, q);\n }\n outCol = vec4(rgb, hsv.w);\n}\nvoid rgbToHSV(vec4 rgb, out vec4 outCol)\n{\n float cmax, cmin, h, s, v, cdelta;\n vec3 c;\n cmax = max(rgb[0], max(rgb[1], rgb[2]));\n cmin = min(rgb[0], min(rgb[1], rgb[2]));\n cdelta = cmax - cmin;\n v = cmax;\n if (cmax != 0.0)\n s = cdelta / cmax;\n else {\n s = 0.0;\n h = 0.0;\n }\n if (s == 0.0)\n h = 0.0;\n else {\n c = (vec3(cmax, cmax, cmax) - rgb.xyz) / cdelta;\n if (rgb.x == cmax) h = c[2] - c[1];\n else if (rgb.y == cmax) h = 2.0 + c[0] - c[2];\n else h = 4.0 + c[1] - c[0];\n h /= 6.0;\n if (h < 0.0)\n h += 1.0;\n }\n outCol = vec4(h, s, v, rgb.w);\n}\n#endif \nbool isPerspective(const mat4 projMatrix)\n{\n return (projMatrix[3][3] == 0.0);\n}\n#if defined(NODE_REFLECT_REFRACT_MAX) || defined(NODE_BITMAP_ENV_MAX)\nvec4 sampleEquirectangular(sampler2D map, vec3 reflectVec, mat3 uvTransform, int encoding)\n{\n reflectVec = normalize(reflectVec);\n vec2 sampleUV;\n sampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n \n sampleUV.x = atan(reflectVec.x, reflectVec.z) * RECIPROCAL_PI2 + 0.5;\n \n sampleUV.y *= -1.0;\n \n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n float seam = max(0.0, 1.0 - abs (reflectVec.x) / seamWidth) *\n clamp (1.0 - reflectVec.z / seamWidth, 0.0, 1.0);\n sampleUV = (uvTransform * vec3(sampleUV, 1.0)).xy;\n vec4 color = texture2D(map, sampleUV, seamBiasFactor * seam);\n color = nodeTexelToLinear(color, encoding);\n return color;\n}\n#endif\n#if defined(NODE_FRESNEL) || defined(NODE_LAYER_WEIGHT) || defined(NODE_FALLOFF_MAX)\nfloat fresnelReflection(const vec3 dir, const vec3 normal, const float ior)\n{\n float cos1 = clamp(abs(dot(dir, normal)), -1.0, 1.0);\n float sin2 = 1.0 / ior * sqrt(max(0.0, 1.0 - cos1 * cos1));\n if (sin2 >= 1.0) {\n return 1.0;\n } else {\n float cos2 = sqrt(max(0.0, 1.0 - sin2 * sin2));\n cos1 = abs(cos1);\n float Rs = ((ior * cos1) - cos2) / ((ior * cos1) + cos2);\n float Rp = (cos1 - (ior * cos2)) / (cos1 + (ior * cos2));\n return (Rs * Rs + Rp * Rp) / 2.0;\n }\n}\n#endif\n#if defined(NODE_BITMAP_MAX) || defined(NODE_BITMAP_ENV_MAX)\nmat3 calcUvTransform(float uOffset, float vOffset, float uTiling, float vTiling, float wAngle)\n{\n \n if (abs(uOffset) < EPSILON && abs(vOffset) < EPSILON &&\n (abs(uTiling - 1.0)) < EPSILON && (abs(vTiling - 1.0)) < EPSILON &&\n abs(wAngle) < EPSILON)\n return mat3(1.0);\n \n vOffset = -vOffset;\n float sx = uTiling;\n float sy = vTiling;\n float tx = -uOffset;\n float ty = -vOffset;\n float cx = uOffset + 0.5;\n float cy = vOffset + 0.5;\n \n float c = cos(wAngle);\n float s = sin(wAngle);\n return mat3(sx * c, -sy * s, 0.0, \n sx * s, sy * c, 0.0,\n -sx * (c * cx + s * cy) + cx + tx, -sy * (- s * cx + c * cy) + cy + ty, 1.0);\n}\n#endif\n",node_add_shader_frag:"void node_add_shader(vec4 color1, vec4 color2, out vec4 outColor) {\n outColor.rgb = color1.rgb + color2.rgb;\n outColor.a = clamp(color1.a + color2.a, 0.0, 1.0);\n}\n",node_ambient_occlusion_frag:"void node_ambient_occlusion(vec4 color, out vec4 outColor)\n{\n outColor = color;\n}\n",node_attribute_frag:"void node_attribute(\n vec3 paramAttr,\n out vec4 outColor, out vec3 outVector, out float outFac)\n{\n outColor = vec4(paramAttr, 1.0);\n outVector = paramAttr;\n outFac = average(paramAttr);\n}\n",node_background_frag:"void node_background(vec4 color, float strength, out vec4 outColor)\n{\n outColor = strength * color;\n}\n",node_blackbody_frag:"void node_blackbody(float temp, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_brightcontrast_frag:"\nvoid node_brightcontrast(vec4 color, float bright, float contrast, out vec4 outColor)\n{\n float bminc = bright - contrast * 0.5;\n outColor.r = max((1.0 + contrast) * color.r + bminc, 0.0);\n outColor.g = max((1.0 + contrast) * color.g + bminc, 0.0);\n outColor.b = max((1.0 + contrast) * color.b + bminc, 0.0);\n outColor.a = color.a;\n}\n",node_bsdf_anisotropic_frag:"void node_bsdf_anisotropic(\n vec4 color, float roughness, float anisotropy, float rotation, vec3 normal, vec3 tangent,\n out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_diffuse_frag:"\nvoid node_bsdf_diffuse(\n const int normalBlendWorld,\n vec4 color, float roughness, vec3 normal,\n out vec4 outColor)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n NodeMaterial material;\n material.diffuseColor = color.rgb;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n outColor = vec4(saturate(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse), 1.0);\n}\n",node_bsdf_glass_frag:"void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_glossy_frag:"\nvoid node_bsdf_glossy(\n const int normalBlendWorld,\n vec4 color, float roughness, vec3 normal,\n out vec4 outColor)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = normalize((viewMatrix * vec4(normal.xyz, 0.0)).xyz);\n }\n NodeMaterial material;\n material.specularColor = color.rgb;\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n outColor = vec4(saturate(reflectedLight.directSpecular + reflectedLight.indirectSpecular), 1.0);\n}\n",node_bsdf_hair_frag:"void node_bsdf_hair(vec4 color, float offset, float roughnessU, float roughnessV, vec3 tangent, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_principled_frag:"\nvec3 tintFromColor(vec3 color) {\n\tfloat lum = dot(color, vec3(0.3, 0.6, 0.1));\n\treturn lum > 0.0 ? color / lum : vec3(1.0);\n}\nvoid node_bsdf_principled(\n const int normalBlendWorld,\n vec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\n float metallic, float specular, float specularTint, float roughness,\n float anisotropic, float anisotropicRotation, float sheen, float sheenTint,\n float clearcoat, float clearcoatRoughness, float ior,\n float transmission, float transmissionRoughness,\n vec3 normal, vec3 clearcoatNormal, vec3 tangent, \n out vec4 outColor)\n{\n metallic = clamp(metallic, 0.0, 1.0);\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n NodeMaterial material;\n float dielectric = 1.0 - metallic;\n material.diffuseColor = baseColor.rgb * dielectric;\n #ifdef STANDARD\n float dielReflCoeff = BLENDER_SPECULAR_COEFFICIENT;\n #else\n float dielReflCoeff = MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity);\n material.clearCoat = saturate(clearcoat); \n material.clearCoatRoughness = clamp(clearcoatRoughness, 0.04, 1.0);\n #endif\n vec3 dielRefl = dielReflCoeff * specular \n * mix(vec3(1.0), tintFromColor(baseColor.rgb), specularTint);\n material.specularColor = mix(dielRefl, baseColor.rgb, metallic);\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 outColor3 = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n outColor = vec4(saturate(outColor3), saturate(1.0-transmission));\n}\n",node_bsdf_refraction_frag:"void node_bsdf_refraction(\n vec4 color, float roughness, float ior, vec3 normal, \n out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_toon_frag:"void node_bsdf_toon(\n vec4 color, float size, float smooth, vec3 normal, \n out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_translucent_frag:"void node_bsdf_translucent(vec4 color, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bsdf_transparent_frag:"\nvoid node_bsdf_transparent(vec4 color, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_bsdf_velvet_frag:"void node_bsdf_velvet(vec4 color, float sigma, vec3 normal, out vec4 outColor)\n{\n outColor = color;\n}\n",node_bump_frag:"\nvoid node_bump(\n const int invert,\n float strength, float bumpDist, float height, vec3 normal,\n out vec3 outNormal)\n{\n \n vec3 position = swizzleUpZ(vWorldPosition);\n if (invert == 1)\n bumpDist *= -1.0;\n vec3 dPdx = dFdx(position);\n vec3 dPdy = dFdy(position);\n float dHdx = dFdx(height);\n float dHdy = dFdy(height);\n vec3 tanX = cross(dPdy, normal);\n vec3 tanY = cross(normal, dPdx);\n vec3 surfaceGrad = dHdx * tanX + dHdy * tanY;\n float dotPosTanX = dot(dPdx, tanX);\n outNormal = normalize(normal * abs(dotPosTanX) - surfaceGrad * bumpDist * sign(dotPosTanX));\n outNormal = normalize(mix(normal, outNormal, max(0.0, strength)));\n}\n",node_camera_frag:"\nvoid node_camera(\n vec3 viewPos, const int invCamZ,\n out vec3 outViewVector, out float outViewZDepth, out float outViewDistance)\n{\n \n viewPos = -viewPos;\n if (invCamZ == 1)\n viewPos.z = -viewPos.z;\n outViewVector = normalize(viewPos);\n outViewZDepth = abs(viewPos.z);\n outViewDistance = length(viewPos);\n}\n",node_combhsv_frag:"\nvoid node_combhsv(float h, float s, float v, out vec4 col)\n{\n hsvToRGB(vec4(h, s, v, 1.0), col);\n}\n",node_combrgb_frag:"\nvoid node_combrgb(float r, float g, float b, out vec4 col)\n{\n col = vec4(r, g, b, 1.0);\n}\n",node_combxyz_frag:"void node_combxyz(float x, float y, float z, out vec3 outVector)\n{\n outVector = vec3(x, y, z);\n}\n",node_curve_rgb_frag:"\nvoid node_curve_rgb(sampler2D curveData, float fac, vec4 col, out vec4 outCol)\n{\n outCol.r = texture2D(curveData, vec2(texture2D(curveData, vec2(col.r, 0.0)).a, 0.0)).r;\n outCol.g = texture2D(curveData, vec2(texture2D(curveData, vec2(col.g, 0.0)).a, 0.0)).g;\n outCol.b = texture2D(curveData, vec2(texture2D(curveData, vec2(col.b, 0.0)).a, 0.0)).b;\n outCol = mix(col, outCol, fac);\n outCol.a = col.a;\n}\n",node_curve_vec_frag:"\nvoid node_curve_vec(sampler2D curveData, float fac, vec3 vec, out vec3 outVec)\n{\n outVec.x = texture2D(curveData, vec2((vec.x + 1.0) * 0.5, 0.0)).x;\n outVec.y = texture2D(curveData, vec2((vec.y + 1.0) * 0.5, 0.0)).y;\n outVec.z = texture2D(curveData, vec2((vec.z + 1.0) * 0.5, 0.0)).z;\n outVec = mix(vec, outVec * 2.0 - vec3(1.0), fac);\n}\n",node_emission_frag:"\nvoid node_emission(vec4 color, float strength, out vec4 outColor)\n{\n outColor = strength * color;\n}\n",node_fresnel_frag:"\nvoid node_fresnel(vec3 viewPos, float IOR, vec3 normal, out float fac)\n{\n vec3 worldDir;\n if (isPerspective(projectionMatrix))\n worldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\n else\n worldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n \n worldDir = normalize(swizzleUpZ(worldDir));\n float eta = max(IOR, 0.00001);\n fac = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n}\n",node_gamma_frag:"\nvoid node_gamma(vec4 col, float gamma, out vec4 outCol)\n{\n outCol = col;\n if (col.r > 0.0)\n outCol.r = powCompat(col.r, gamma);\n if (col.g > 0.0)\n outCol.g = powCompat(col.g, gamma);\n if (col.b > 0.0)\n outCol.b = powCompat(col.b, gamma);\n}\n",node_geometry_frag:"\nvoid node_geometry(\n vec3 viewPos, vec3 viewNorm, vec3 orcoIn, vec2 uvIn, vec4 vcolIn,\n out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv,\n out vec3 normal, out vec4 vcol, out float vcolAlpha, out float frontBack)\n{\n \n local = -viewPos;\n \n view = (projectionMatrix[3][3] == 0.0) ? normalize(local) : vec3(0.0, 0.0, -1.0);\n global = (invViewMatrix * vec4(local, 1.0)).xyz;\n global = swizzleUpZ(global);\n \n \n orco = global;\n \n uvIn.y = 1.0 - uvIn.y;\n uv = vec3(uvIn * 2.0 - vec2(1.0, 1.0), 0.0);\n normal = normalize(invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n normal = swizzleUpZ(normal);\n vcol = sRGBToLinear(vec4(vcolIn.rgb, 1.0));\n vcolAlpha = vcolIn.a;\n frontBack = (gl_FrontFacing) ? 1.0 : 0.0;\n}\n",node_hair_info_frag:"void node_hair_info(\n out float isStrand, out float intercept, out float thickness, out vec3 tangentNormal)\n{\n isStrand = 0.0;\n intercept = 0.0;\n thickness = 0.0;\n tangentNormal = vec3(0.0);\n}\n",node_holdout_frag:"void node_holdout(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_hue_sat_frag:"\nvoid node_hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 outCol)\n{\n vec4 hsv;\n rgbToHSV(col, hsv);\n hsv[0] += (hue - 0.5);\n if (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;\n hsv[1] *= sat;\n if (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;\n hsv[2] *= value;\n if (hsv[2] > 1.0) hsv[2] = 1.0; else if (hsv[2] < 0.0) hsv[2] = 0.0;\n hsvToRGB(hsv, outCol);\n outCol = mix(col, outCol, fac);\n}\n",node_invert_frag:"\nvoid node_invert(float fac, vec4 col, out vec4 outCol)\n{\n outCol.xyz = mix(col.xyz, vec3(1.0, 1.0, 1.0) - col.xyz, fac);\n outCol.w = col.w;\n}\n",node_lamp_frag:"\nvoid node_lamp(out vec4 outCol, out vec3 outLv, out float outDist, out vec4 outShadow, out float outVisibility)\n{\n outCol = vec4(0.0);\n outLv = vec3(0.0);\n outDist = 0.0;\n outShadow = vec4(0.0);\n outVisibility = 1.0;\n}\n",node_layer_weight_frag:"\nvoid node_layer_weight(vec3 viewPos, float blend, vec3 normal, out float fresnel, out float facing)\n{\n vec3 worldDir;\n if (isPerspective(projectionMatrix))\n worldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\n else\n worldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n \n worldDir = normalize(swizzleUpZ(worldDir));\n float eta = max(1.0 - blend, EPSILON);\n fresnel = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? 1.0 / eta : eta);\n facing = abs(dot(worldDir, normal));\n if (blend != 0.5) {\n blend = clamp(blend, 0.0, 1.0 - EPSILON);\n blend = (blend < 0.5) ? blend * 2.0 : 0.5 / (1.0 - blend);\n facing = pow(facing, blend);\n }\n facing = 1.0 - facing;\n}\n",node_light_falloff_frag:"void node_light_falloff(\n float strength, float smooth,\n out float quadratic, out float linear, out float constant)\n{\n quadratic = 1.0;\n linear = 1.0;\n constant = 1.0;\n}\n",node_light_path_frag:"void node_light_path(\n out float isCameraRay, out float isShadowRay, out float isDiffuseRay, \n out float isGlossyRay, out float isSingularRay, out float isReflectionRay,\n out float isTransmissionRay, out float rayLength, out float rayDepth, \n out float diffuseDepth, out float glossyDepth, out float transparentDepth, \n out float transmissionDepth)\n{\n #if LIGHT_PATH_IS_CAM_RAY\n isCameraRay = 1.0;\n #else\n isCameraRay = 0.0;\n #endif\n isShadowRay = 0.0;\n isDiffuseRay = 0.0;\n isGlossyRay = 0.0;\n isSingularRay = 0.0;\n isReflectionRay = 0.0;\n isTransmissionRay = 0.0;\n rayLength = 1.0;\n rayDepth = 1.0;\n diffuseDepth = 1.0;\n glossyDepth = 1.0;\n transparentDepth = 1.0; \n transmissionDepth = 1.0;\n}\n",node_mapping_frag:"\nvoid node_mapping(mat4 mat, vec3 minVec, vec3 maxVec, int useMin, int useMax, vec3 vec, out vec3 outVec)\n{\n outVec = (mat * vec4(vec, 1.0)).xyz;\n if (useMin == 1)\n outVec = max(outVec, minVec);\n if (useMax == 1)\n outVec = min(outVec, maxVec);\n}\n",node_material_ext_frag:"\nvoid node_material_ext(\n const int useDiffuse, const int useSpec, const int invertNormal,\n const float specularIntensity, const float specularHardness,\n const int useShadeless, const int normalBlendWorld,\n const vec4 diffuseColor, const vec4 specularColor, const float diffuseIntensity,\n vec3 normal, const vec4 mirror, const float ambient, \n const float emit, const float specularAlpha, const float reflectivity,\n const float alpha, const float translucency,\n \n out vec4 outColor, out float outAlpha, out vec3 outNormal, out vec4 outDiffuse,\n out vec4 outSpec, out vec4 outAO)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n vec3 diffuse, specular;\n if (useShadeless == 0) {\n NodeMaterial material;\n if (useDiffuse == 1)\n material.diffuseColor = diffuseColor.rgb;\n else\n material.diffuseColor = vec3(0.0);\n if (useSpec == 1)\n material.specularColor = specularColor.rgb;\n else\n material.specularColor = vec3(0.0);\n material.diffuseIntensity = diffuseIntensity;\n material.specularHardness = specularHardness;\n material.specularIntensity = specularIntensity;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 totalEmissiveRadiance = emit * material.diffuseColor;\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n } else {\n diffuse = diffuseColor.rgb;\n specular = vec3(0.0);\n }\n outColor = vec4(saturate(diffuse + specular), 1.0);\n outAlpha = alpha - saturate(maxFromRGB(specular) * specularAlpha) * (alpha - 1.0);\n outNormal = normal;\n outDiffuse = vec4(diffuse, 1.0);\n outSpec = vec4(specular, 1.0);\n \n outAO = vec4(1.0, 1.0, 1.0, 1.0);\n}\n",node_material_frag:"\nvoid node_material(\n const int useDiffuse, const int useSpec, const int invertNormal,\n const float specularIntensity, const float specularHardness, \n const float ambient, const float emit, const float alpha,\n const int useShadeless, const int normalBlendWorld,\n const vec4 diffuseColor, const vec4 specularColor, const float diffuseIntensity,\n vec3 normal,\n out vec4 outColor, out float outAlpha, out vec3 outNormal)\n{\n if (normalBlendWorld == 1) {\n normal = vec3(normal[0], normal[2], -normal[1]);\n normal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\n }\n vec3 diffuse, specular;\n if (useShadeless == 0) {\n NodeMaterial material;\n if (useDiffuse == 1)\n material.diffuseColor = diffuseColor.rgb;\n else\n material.diffuseColor = vec3(0.0);\n if (useSpec == 1)\n material.specularColor = specularColor.rgb;\n else\n material.specularColor = vec3(0.0);\n material.diffuseIntensity = diffuseIntensity;\n material.specularHardness = specularHardness;\n material.specularIntensity = specularIntensity;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 totalEmissiveRadiance = emit * material.diffuseColor;\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n } else {\n diffuse = diffuseColor.rgb;\n specular = vec3(0.0);\n }\n outColor = vec4(saturate(diffuse + specular), 1.0);\n \n outAlpha = alpha;\n \n outNormal = normalize(invViewMatrix * vec4(normal, 0.0)).rgb;\n outNormal = swizzleUpZ(outNormal);\n}\n",node_math_frag:"\nvoid node_math_add(float val1, float val2, out float outVal)\n{\n outVal = val1 + val2;\n}\nvoid node_math_subtract(float val1, float val2, out float outVal)\n{\n outVal = val1 - val2;\n}\nvoid node_math_multiply(float val1, float val2, out float outVal)\n{\n outVal = val1 * val2;\n}\nvoid node_math_divide(float val1, float val2, out float outVal)\n{\n if (val2 == 0.0)\n outVal = 0.0;\n else\n outVal = val1 / val2;\n}\nvoid node_math_sine(float val, float val2, out float outVal)\n{\n outVal = sin(val);\n}\nvoid node_math_cosine(float val, float val2, out float outVal)\n{\n outVal = cos(val);\n}\nvoid node_math_tangent(float val, float val2, out float outVal)\n{\n outVal = tan(val);\n}\nvoid node_math_arcsine(float val, float val2, out float outVal)\n{\n if (val <= 1.0 && val >= -1.0)\n outVal = asin(val);\n else\n outVal = 0.0;\n}\nvoid node_math_arccosine(float val, float val2, out float outVal)\n{\n if (val <= 1.0 && val >= -1.0)\n outVal = acos(val);\n else\n outVal = 0.0;\n}\nvoid node_math_arctangent(float val, float val2, out float outVal)\n{\n outVal = atan(val);\n}\nvoid node_math_power(float val1, float val2, out float outVal)\n{\n if (val1 >= 0.0)\n outVal = powCompat(val1, val2);\n else {\n float val2_mod_1 = mod(abs(val2), 1.0);\n if (val2_mod_1 > 0.999 || val2_mod_1 < 0.001)\n outVal = powCompat(val1, floor(val2 + 0.5));\n else\n outVal = 0.0;\n }\n}\nvoid node_math_logarithm(float val1, float val2, out float outVal)\n{\n if (val1 > 0.0 && val2 > 0.0)\n outVal = log2(val1) / log2(val2);\n else\n outVal = 0.0;\n}\nvoid node_math_maximum(float val1, float val2, out float outVal)\n{\n outVal = max(val1, val2);\n}\nvoid node_math_minimum(float val1, float val2, out float outVal)\n{\n outVal = min(val1, val2);\n}\nvoid node_math_round(float val1, float val2, out float outVal)\n{\n outVal = floor(val1 + 0.5);\n}\nvoid node_math_less_than(float val1, float val2, out float outVal)\n{\n if (val1 < val2)\n outVal = 1.0;\n else\n outVal = 0.0;\n}\nvoid node_math_greater_than(float val1, float val2, out float outVal)\n{\n if (val1 > val2)\n outVal = 1.0;\n else\n outVal = 0.0;\n}\nvoid node_math_modulo(float val1, float val2, out float outVal)\n{\n if (val2 == 0.0)\n outVal = 0.0;\n else\n outVal = mod(val1, val2);\n outVal = (val1 > 0.0) ? outVal : outVal - val2;\n}\nvoid node_math_absolute(float val1, float val2, out float outVal)\n{\n outVal = abs(val1);\n}\n",node_mix_rgb_frag:"\nvoid node_mix_rgb_mix(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_add(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 + col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_multiply(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 * col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_screen(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = vec4(1.0) - (vec4(facm) + fac * (vec4(1.0) - col2)) * (vec4(1.0) - col1);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_overlay(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n if (outCol.r < 0.5)\n outCol.r *= facm + 2.0 * fac * col2.r;\n else\n outCol.r = 1.0 - (facm + 2.0 * fac * (1.0 - col2.r)) * (1.0 - outCol.r);\n if (outCol.g < 0.5)\n outCol.g *= facm + 2.0 * fac * col2.g;\n else\n outCol.g = 1.0 - (facm + 2.0 * fac * (1.0 - col2.g)) * (1.0 - outCol.g);\n if (outCol.b < 0.5)\n outCol.b *= facm + 2.0 * fac * col2.b;\n else\n outCol.b = 1.0 - (facm + 2.0 * fac * (1.0 - col2.b)) * (1.0 - outCol.b);\n}\nvoid node_mix_rgb_subtract(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, col1 - col2, fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_divide(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n if (col2.r != 0.0) outCol.r = facm * outCol.r + fac * outCol.r / col2.r;\n if (col2.g != 0.0) outCol.g = facm * outCol.g + fac * outCol.g / col2.g;\n if (col2.b != 0.0) outCol.b = facm * outCol.b + fac * outCol.b / col2.b;\n}\nvoid node_mix_rgb_difference(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = mix(col1, abs(col1 - col2), fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_darken(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol.rgb = min(col1.rgb, col2.rgb * fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_lighten(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol.rgb = max(col1.rgb, col2.rgb * fac);\n outCol.a = col1.a;\n}\nvoid node_mix_rgb_dodge(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = col1;\n if (outCol.r != 0.0) {\n float tmp = 1.0 - fac * col2.r;\n if (tmp <= 0.0)\n outCol.r = 1.0;\n else if ((tmp = outCol.r / tmp) > 1.0)\n outCol.r = 1.0;\n else\n outCol.r = tmp;\n }\n if (outCol.g != 0.0) {\n float tmp = 1.0 - fac * col2.g;\n if (tmp <= 0.0)\n outCol.g = 1.0;\n else if ((tmp = outCol.g / tmp) > 1.0)\n outCol.g = 1.0;\n else\n outCol.g = tmp;\n }\n if (outCol.b != 0.0) {\n float tmp = 1.0 - fac * col2.b;\n if (tmp <= 0.0)\n outCol.b = 1.0;\n else if ((tmp = outCol.b / tmp) > 1.0)\n outCol.b = 1.0;\n else\n outCol.b = tmp;\n }\n}\nvoid node_mix_rgb_burn(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float tmp, facm = 1.0 - fac;\n outCol = col1;\n tmp = facm + fac * col2.r;\n if (tmp <= 0.0)\n outCol.r = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.r) / tmp)) < 0.0)\n outCol.r = 0.0;\n else if (tmp > 1.0)\n outCol.r = 1.0;\n else\n outCol.r = tmp;\n tmp = facm + fac * col2.g;\n if (tmp <= 0.0)\n outCol.g = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.g) / tmp)) < 0.0)\n outCol.g = 0.0;\n else if (tmp > 1.0)\n outCol.g = 1.0;\n else\n outCol.g = tmp;\n tmp = facm + fac * col2.b;\n if (tmp <= 0.0)\n outCol.b = 0.0;\n else if ((tmp = (1.0 - (1.0 - outCol.b) / tmp)) < 0.0)\n outCol.b = 0.0;\n else if (tmp > 1.0)\n outCol.b = 1.0;\n else\n outCol.b = tmp;\n}\n#ifdef NODE_MIX_RGB_HSV\nvoid node_mix_rgb_hue(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2, tmp;\n rgbToHSV(col2, hsv2);\n if (hsv2.y != 0.0) {\n rgbToHSV(outCol, hsv);\n hsv.x = hsv2.x;\n hsvToRGB(hsv, tmp);\n outCol = mix(outCol, tmp, fac);\n outCol.a = col1.a;\n }\n}\nvoid node_mix_rgb_saturation(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2;\n rgbToHSV(outCol, hsv);\n if (hsv.y != 0.0) {\n rgbToHSV(col2, hsv2);\n hsv.y = facm * hsv.y + fac * hsv2.y;\n hsvToRGB(hsv, outCol);\n }\n}\nvoid node_mix_rgb_value(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n vec4 hsv, hsv2;\n rgbToHSV(col1, hsv);\n rgbToHSV(col2, hsv2);\n hsv.z = facm * hsv.z + fac * hsv2.z;\n hsvToRGB(hsv, outCol);\n}\nvoid node_mix_rgb_color(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n outCol = col1;\n vec4 hsv, hsv2, tmp;\n rgbToHSV(col2, hsv2);\n if (hsv2.y != 0.0) {\n rgbToHSV(outCol, hsv);\n hsv.x = hsv2.x;\n hsv.y = hsv2.y;\n hsvToRGB(hsv, tmp);\n outCol = mix(outCol, tmp, fac);\n outCol.a = col1.a;\n }\n}\n#endif\nvoid node_mix_rgb_soft_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n float facm = 1.0 - fac;\n vec4 one = vec4(1.0);\n vec4 scr = one - (one - col2) * (one - col1);\n outCol = facm * col1 + fac * ((one - col1) * col2 * col1 + col1 * scr);\n}\nvoid node_mix_rgb_linear_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\n fac = clamp(fac, 0.0, 1.0);\n outCol = col1 + fac * (2.0 * (col2 - vec4(0.5)));\n}\n",node_mix_shader_frag:"\nvoid node_mix_shader(int transpShaderNum,\n float fac, vec4 color1, vec4 color2, out vec4 outColor)\n{\n \n if (transpShaderNum == 0)\n color1.rgb = color2.rgb;\n else if (transpShaderNum == 1)\n color2.rgb = color1.rgb;\n fac = clamp(fac, 0.0, 1.0);\n outColor = mix(color1, color2, fac);\n}\n",node_new_geometry_frag:"void node_new_geometry(\n vec3 viewPos, vec3 viewNorm, \n out vec3 position, out vec3 normal, out vec3 tangent,\n out vec3 trueNormal, out vec3 incoming, out vec3 parametric,\n out float backfacing, out float pointiness)\n{\n \n position = (invViewMatrix * vec4(-viewPos, 1.0)).xyz;\n position = swizzleUpZ(position);\n vec4 viewDir = isOrtho(projectionMatrix) ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(normalize(-viewPos), 0.0);\n viewDir = invViewMatrix * viewDir;\n vec3 incomingVec = -swizzleUpZ(viewDir.xyz);\n #if WORLD_NODES == 1\n normal = incomingVec;\n #else\n normal = normalize(invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n normal = swizzleUpZ(normal);\n #endif\n tangent = vec3(0.0);\n \n trueNormal = normal;\n incoming = incomingVec;\n parametric = vec3(0.0);\n backfacing = (gl_FrontFacing) ? 0.0 : 1.0;\n #if WORLD_NODES == 1\n pointiness = 0.0;\n #else\n pointiness = 0.5;\n #endif\n}\n",node_normal_frag:"\nvoid node_normal(vec3 norParam, vec3 norIn, out vec3 norOut, out float dotOut)\n{\n norOut = norParam;\n dotOut = dot(normalize(norIn), norParam);\n}\n",node_normal_map_frag:"\nvoid node_normal_map(vec4 tangent, vec3 normal, float strength, vec4 normalColor, out vec3 normalOut)\n{\n#ifdef DOUBLE_SIDED\n \n normal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n#endif\n vec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\n vec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz), tangent.w);\n vec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\n normalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n + normalTex.z * normal);\n normalOut = mix(normal, normalOut, strength);\n normalOut = normalize((invViewMatrix * vec4(normalOut, 0.0)).xyz);\n normalOut = swizzleUpZ(normalOut);\n}\n",node_object_info_frag:"\nvoid node_object_info(out vec3 location, out float objIndex, out float matIndex, out float random) {\n #if WORLD_NODES == 1\n \n \n location = vec3(0.0);\n objIndex = 0.0;\n matIndex = 0.0;\n random = 0.0;\n #else\n location = vec3(0.0);\n objIndex = 0.0;\n matIndex = 0.0;\n random = 0.5;\n #endif\n}\n",node_output_frag:"\nvoid node_output(vec4 rgb, float alpha, out vec4 outgoingLight)\n{\n outgoingLight = vec4(rgb.rgb, alpha);\n}\n",node_output_lamp_frag:"void node_output_lamp(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_output_material_frag:"\nvoid node_output_material(vec4 surface, vec4 volume, float displacement, out vec4 outgoingLight) {\n outgoingLight = surface + volume;\n}\nvoid node_output_material(vec4 surface, vec4 volume, vec3 displacement, out vec4 outgoingLight) {\n outgoingLight = surface + volume;\n}\n",node_output_world_frag:"void node_output_world(vec4 surface, vec4 volume, out vec4 outgoingLight)\n{\n outgoingLight = surface;\n}\n",node_particle_info_frag:"\nvoid node_particle_info(out float index, out float age, out float lifeTime, out vec3 location,\n out float size, out vec3 velocity, out vec3 angularVelocity) {\n #if WORLD_NODES == 1\n index = 0.0;\n age = 0.0;\n lifeTime = 0.0;\n location = vec3(0.0);\n size = 0.0;\n velocity = vec3(0.0);\n angularVelocity = vec3(0.0);\n #else\n index = 0.0;\n age = 0.0;\n lifeTime = 0.0;\n location = vec3(0.0);\n size = 0.0;\n velocity = vec3(0.0);\n angularVelocity = vec3(0.0);\n #endif\n}\n",node_rgb_frag:"\nuniform vec4 nodeRGB[NODE_RGB_NUM];\nvoid node_rgb(vec4 color, out vec4 outColor)\n{\n outColor = color;\n}\n",node_rgbtobw_frag:"\nvoid node_rgbtobw(vec4 color, out float outVal) {\n outVal = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n}\n",node_script_frag:"void node_script(out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_sephsv_frag:"\nvoid node_sephsv(vec4 col, out float h, out float s, out float v)\n{\n vec4 hsv;\n rgbToHSV(col, hsv);\n h = hsv[0];\n s = hsv[1];\n v = hsv[2];\n}\n",node_seprgb_frag:"\nvoid node_seprgb(vec4 col, out float r, out float g, out float b)\n{\n r = col.r;\n g = col.g;\n b = col.b;\n}\n",node_sepxyz_frag:"void node_sepxyz(vec3 vector, out float x, out float y, out float z)\n{\n x = vector.x;\n y = vector.y;\n z = vector.z;\n}\n",node_squeeze_frag:"\nvoid node_squeeze(float val, float width, float center, out float outVal)\n{\n outVal = 1.0 / (1.0 + pow(2.71828183, -((val - center) * width)));\n}\n",node_subsurface_scattering_frag:"void node_subsurface_scattering(\n vec4 color, float scale, vec3 radius, float sharpen, float textureBlur, vec3 normal,\n out vec4 outColor)\n{\n outColor = color;\n}\n",node_tangent_frag:"void node_tangent(out vec3 outTangent)\n{\n outTangent = vec3(0.0);\n}\n",node_tex_brick_frag:"void node_tex_brick(\n vec3 vector, vec4 color1, vec4 color2, vec4 mortar, float scale,\n float mortarSize, float mortarSmooth, float bias, float brickWidth,\n float rowHeight,\n out vec4 outColor, out float fac)\n{\n outColor = color1;\n}\n",node_tex_checker_frag:"void node_tex_checker(vec3 vector, vec4 color1, vec4 color2, float scale, \n out vec4 outColor, out float outFac)\n{\n vec3 p = vector * scale;\n \n p = (p + 0.00001) * 0.99999;\n float cx = floor(p.x);\n float cy = floor(p.y);\n float cz = floor(p.z);\n float result = sign(mod(cx + cy + cz, 2.0));\n outFac = max(result, 0.0);\n outColor = mix(color2, color1, outFac);\n}\n",node_tex_coord_frag:"uniform vec3 boundingBoxMin;\nuniform vec3 boundingBoxMax;\nvoid node_tex_coord(\n vec3 viewPos, vec3 viewNorm, vec2 uv,\n out vec3 outGenerated, out vec3 outNormal, out vec3 outUV, out vec3 outObject,\n out vec3 outCamera, out vec3 outWindow, out vec3 outReflection)\n{\n vec4 view = vec4(-viewPos, 1.0);\n vec3 loc = swizzleUpZ((invModelMatrix * invViewMatrix * view).xyz);\n #if WORLD_NODES == 1\n loc = normalize(loc);\n #endif\n #if WORLD_NODES == 1\n outGenerated = loc;\n #else\n \n vec3 boxMin = vec3(boundingBoxMin.x, -boundingBoxMax.z, boundingBoxMin.y);\n vec3 boxMax = vec3(boundingBoxMax.x, -boundingBoxMin.z, boundingBoxMax.y);\n vec3 boxSize = boxMax - boxMin;\n \n if (abs(boxSize.x) < 0.001) {\n outGenerated.x = 0.5;\n } else {\n outGenerated.x = (loc.x - boxMin.x) / boxSize.x;\n }\n if (abs(boxSize.y) < 0.001) {\n outGenerated.y = 0.5;\n } else {\n outGenerated.y = (loc.y - boxMin.y) / boxSize.y;\n }\n if (abs(boxSize.z) < 0.001) {\n outGenerated.z = 0.5;\n } else {\n outGenerated.z = (loc.z - boxMin.z) / boxSize.z;\n }\n #endif\n #if WORLD_NODES == 1\n outNormal = -loc;\n #else\n outNormal = normalize(invModelMatrix * invViewMatrix * vec4(viewNorm, 0.0)).rgb;\n outNormal = swizzleUpZ(outNormal);\n #endif\n #if WORLD_NODES == 1\n outUV = vec3(0.0);\n #else\n \n uv.y = 1.0 - uv.y;\n outUV = vec3(uv, 0.0);\n #endif\n outObject = loc;\n \n outCamera = vec3(view.xy, -view.z);\n \n outWindow = vec3(0.0);\n #if WORLD_NODES == 1\n outReflection = -loc;\n #else\n vec4 reflection = (invViewMatrix * vec4(reflect(view.xyz, normalize(viewNorm)), 0.0));\n outReflection = normalize(swizzleUpZ(reflection.xyz));\n #endif\n}\n",node_tex_environment_frag:"void node_tex_environment(sampler2D tex, const int encoding, vec3 vector, out vec4 outColor) {\n \n vec3 direction = swizzleUpY(vector);\n if (length(direction) == 0.0) {\n direction = vec3(0.0, 1.0, 0.0);\n } else {\n direction = normalize(direction);\n }\n vec2 uv;\n uv.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n uv.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n \n uv.y = 1.0 - uv.y;\n \n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n \n \n float seam = max(0.0, 1.0 - abs (direction.z) / seamWidth) *\n clamp (1.0 - direction.x / seamWidth, 0.0, 1.0);\n outColor = texture2D(tex, uv, seamBiasFactor * seam);\n outColor = nodeTexelToLinear(outColor, encoding);\n}\n",node_tex_environment_max_frag:"void node_tex_environment_max(sampler2D tex, const int encoding, vec3 vector, out vec4 outColor) {\n \n \n \n \n vec3 direction = swizzleUpY(vector);\n if (length(direction) == 0.0) {\n direction = vec3(0.0, 1.0, 0.0);\n } else {\n direction = normalize(direction);\n }\n vec2 uv;\n uv.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n \n uv.x = atan(direction.x, direction.z) * RECIPROCAL_PI2 + 0.5;\n \n uv.y *= -1.0;\n \n const float seamWidth = 0.15;\n const float seamBiasFactor = -10.0;\n \n \n float seam = max(0.0, 1.0 - abs (direction.x) / seamWidth) *\n clamp (1.0 - direction.z / seamWidth, 0.0, 1.0);\n outColor = texture2D(tex, uv, seamBiasFactor * seam);\n outColor = nodeTexelToLinear(outColor, encoding);\n}\n",node_tex_environment_none_frag:"void node_tex_environment_none(vec3 vector, out vec4 outColor) {\n outColor = vec4(1.0, 0.0, 1.0, 1.0);\n}",node_tex_gradient_frag:"void node_tex_gradient(vec3 vector, out vec4 outColor, out float fac)\n{\n outColor = vec4(0.0);\n}\n",node_tex_image_frag:"void node_tex_image(\n sampler2D ima, const int encoding, \n vec3 vector,\n out vec4 outColor, out float outAlpha)\n{\n vec2 uv = vector.xy;\n \n uv.y = 1.0 - uv.y;\n outColor = texture2D(ima, uv);\n outAlpha = outColor.a;\n outColor = nodeTexelToLinear(outColor, encoding);\n}\n",node_tex_image_none_frag:"\nvoid node_tex_image_none(vec3 vector, out vec4 color, out float alpha)\n{\n color = vec4(1.0, 0.0, 1.0, 1.0);\n alpha = 1.0;\n}\n",node_tex_magic_frag:"void node_tex_magic(vec3 vector, float scale, float distortion,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}\n",node_tex_musgrave_frag:"void node_tex_musgrave(\n vec3 vector, float scale, float detail, float dimension, float lacunarity,\n float offset, float gain,\n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.0);\n outFac = 0.0;\n}\n",node_tex_noise_frag:"\n#define NOISE_OCTAVES 2\n#define NOISE_AMP_HACK 0.75\n#define NOISE_SCALE_HACK 0.5\n#define noiseModulo(x) (x - floor(x * (1.0 / 289.0)) * 289.0)\nvec4 noisePermute(vec4 x)\n{\n return noiseModulo(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat noisePerlin(vec3 v)\n{\n const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n \n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n \n \n \n \n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; \n vec3 x3 = x0 - D.yyy; \n \n i = noiseModulo(i);\n vec4 p = noisePermute(noisePermute(noisePermute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n \n \n float n_ = 0.142857142857; \n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_); \n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n \n \n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n \n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1),\n dot(p2, x2), dot(p3, x3)));\n}\nfloat noiseBlender(vec3 p)\n{\n return 0.5 * NOISE_AMP_HACK * (noisePerlin(NOISE_SCALE_HACK * vec3(p.x, p.y, p.z))) + 0.5;\n}\nfloat noiseTurbulence(vec3 p)\n{\n float fscale = 1.0;\n float amp = 1.0;\n float sum = 0.0;\n for (int i = 0; i <= NOISE_OCTAVES; i++) {\n float t = noiseBlender(fscale * p);\n sum += t * amp;\n amp *= 0.5;\n fscale *= 2.0;\n }\n sum *= (4.0 / 7.0);\n return sum;\n}\nvoid node_tex_noise(vec3 vector, float scale, float detail,\n float distortion, out vec4 outColor, out float outFac)\n{\n vec3 p = vector * scale;\n if (distortion != 0.0) {\n vec3 r, offset = vec3(13.5, 13.5, 13.5);\n r.x = noiseBlender(p + offset) * distortion;\n r.y = noiseBlender(p) * distortion;\n r.z = noiseBlender(p - offset) * distortion;\n p += r;\n }\n outFac = noiseTurbulence(p);\n outColor = vec4(outFac, noiseTurbulence(vec3(p.y, p.x, p.z)),\n noiseTurbulence(vec3(p.y, p.z, p.x)), 1.0);\n}\n",node_tex_pointdensity_frag:"void node_tex_pointdensity(\n vec3 vector,\n out vec4 outColor, out float outDensity)\n{\n outColor = vec4(0.0);\n outDensity = 0.0;\n}\n",node_tex_sky_frag:"\n#define Km 683.0 \nvoid node_tex_sky(vec3 param0, vec3 param1, vec3 param2, vec3 param3,\n vec3 param4, vec3 param5, vec3 param6, vec3 param7, vec3 param8,\n vec3 radiance, vec3 sunDirection, vec3 vectorIn, out vec4 outColor) {\n if (length(vectorIn) == 0.0) {\n vectorIn = vec3(0.0, 1.0, 0.0);\n } else {\n vectorIn = normalize(vectorIn);\n }\n \n vectorIn = swizzleUpY(vectorIn);\n sunDirection = swizzleUpY(sunDirection);\n float cosGamma = clamp(dot(vectorIn, sunDirection), -1.0, 1.0);\n float cosTheta = clamp(vectorIn.y, 0.0, 1.0);\n #if TEX_SKY_PREETHAM\n vec3 radInternal = (1.0 + param0 * exp(param1 / cosTheta)) * (\n 1.0 + param2 * exp(param3 * acos(cosGamma)) \n + param4 * pow(cosGamma, 2.0)\n );\n vec3 XYZ = xyY_to_XYZ(radInternal.y * radiance.y,\n radInternal.z * radiance.z, radInternal.x * radiance.x);\n \n outColor = vec4(max(xyz_to_sRGB(XYZ), 0.0), 1.0);\n #elif TEX_SKY_HOSEK_WILKIE\n float cosGammaSq = pow(cosGamma, 2.0);\n vec3 chi = (1.0 + cosGammaSq) / pow(1.0 + pow(param8, vec3(2.0))\n - 2.0 * param8 * cosGamma, vec3(1.5));\n vec3 radInternal = (1.0 + param0 * exp(param1 / (cosTheta + 0.01))) * (\n param2 + param3 * exp(param4 * acos(cosGamma)) \n + param5 * cosGammaSq + param6 * chi + param7 * sqrt(cosTheta)\n );\n \n outColor = vec4(max(xyz_to_sRGB(radInternal * radiance), 0.0) * PI2/Km, 1.0);\n #else\n outColor = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n}\n",node_tex_voronoi_frag:"\nvec3 worleyPermute(vec3 x) {\n \n return mod((34.0 * x + 1.0) * x, 289.0);\n}\nvec3 worleyDist(vec3 x, vec3 y, vec3 z, bool manhattanDistance) {\n return manhattanDistance ? abs(x) + abs(y) + abs(z) : (x * x + y * y + z * z);\n}\nvec2 worley(vec3 P, float jitter, bool manhattanDistance) {\n float K = 0.142857142857; \n float Ko = 0.428571428571; \n float K2 = 0.020408163265306; \n float Kz = 0.166666666667; \n float Kzo = 0.416666666667; \n vec3 Pi = mod(floor(P), 289.0);\n vec3 Pf = fract(P) - 0.5;\n vec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\n vec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\n vec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\n vec3 p = worleyPermute(Pi.x + vec3(-1.0, 0.0, 1.0));\n vec3 p1 = worleyPermute(p + Pi.y - 1.0);\n vec3 p2 = worleyPermute(p + Pi.y);\n vec3 p3 = worleyPermute(p + Pi.y + 1.0);\n vec3 p11 = worleyPermute(p1 + Pi.z - 1.0);\n vec3 p12 = worleyPermute(p1 + Pi.z);\n vec3 p13 = worleyPermute(p1 + Pi.z + 1.0);\n vec3 p21 = worleyPermute(p2 + Pi.z - 1.0);\n vec3 p22 = worleyPermute(p2 + Pi.z);\n vec3 p23 = worleyPermute(p2 + Pi.z + 1.0);\n vec3 p31 = worleyPermute(p3 + Pi.z - 1.0);\n vec3 p32 = worleyPermute(p3 + Pi.z);\n vec3 p33 = worleyPermute(p3 + Pi.z + 1.0);\n vec3 ox11 = fract(p11*K) - Ko;\n vec3 oy11 = mod(floor(p11*K), 7.0)*K - Ko;\n vec3 oz11 = floor(p11*K2)*Kz - Kzo; \n vec3 ox12 = fract(p12*K) - Ko;\n vec3 oy12 = mod(floor(p12*K), 7.0)*K - Ko;\n vec3 oz12 = floor(p12*K2)*Kz - Kzo;\n vec3 ox13 = fract(p13*K) - Ko;\n vec3 oy13 = mod(floor(p13*K), 7.0)*K - Ko;\n vec3 oz13 = floor(p13*K2)*Kz - Kzo;\n vec3 ox21 = fract(p21*K) - Ko;\n vec3 oy21 = mod(floor(p21*K), 7.0)*K - Ko;\n vec3 oz21 = floor(p21*K2)*Kz - Kzo;\n vec3 ox22 = fract(p22*K) - Ko;\n vec3 oy22 = mod(floor(p22*K), 7.0)*K - Ko;\n vec3 oz22 = floor(p22*K2)*Kz - Kzo;\n vec3 ox23 = fract(p23*K) - Ko;\n vec3 oy23 = mod(floor(p23*K), 7.0)*K - Ko;\n vec3 oz23 = floor(p23*K2)*Kz - Kzo;\n vec3 ox31 = fract(p31*K) - Ko;\n vec3 oy31 = mod(floor(p31*K), 7.0)*K - Ko;\n vec3 oz31 = floor(p31*K2)*Kz - Kzo;\n vec3 ox32 = fract(p32*K) - Ko;\n vec3 oy32 = mod(floor(p32*K), 7.0)*K - Ko;\n vec3 oz32 = floor(p32*K2)*Kz - Kzo;\n vec3 ox33 = fract(p33*K) - Ko;\n vec3 oy33 = mod(floor(p33*K), 7.0)*K - Ko;\n vec3 oz33 = floor(p33*K2)*Kz - Kzo;\n vec3 dx11 = Pfx + jitter*ox11;\n vec3 dy11 = Pfy.x + jitter*oy11;\n vec3 dz11 = Pfz.x + jitter*oz11;\n vec3 dx12 = Pfx + jitter*ox12;\n vec3 dy12 = Pfy.x + jitter*oy12;\n vec3 dz12 = Pfz.y + jitter*oz12;\n vec3 dx13 = Pfx + jitter*ox13;\n vec3 dy13 = Pfy.x + jitter*oy13;\n vec3 dz13 = Pfz.z + jitter*oz13;\n vec3 dx21 = Pfx + jitter*ox21;\n vec3 dy21 = Pfy.y + jitter*oy21;\n vec3 dz21 = Pfz.x + jitter*oz21;\n vec3 dx22 = Pfx + jitter*ox22;\n vec3 dy22 = Pfy.y + jitter*oy22;\n vec3 dz22 = Pfz.y + jitter*oz22;\n vec3 dx23 = Pfx + jitter*ox23;\n vec3 dy23 = Pfy.y + jitter*oy23;\n vec3 dz23 = Pfz.z + jitter*oz23;\n vec3 dx31 = Pfx + jitter*ox31;\n vec3 dy31 = Pfy.z + jitter*oy31;\n vec3 dz31 = Pfz.x + jitter*oz31;\n vec3 dx32 = Pfx + jitter*ox32;\n vec3 dy32 = Pfy.z + jitter*oy32;\n vec3 dz32 = Pfz.y + jitter*oz32;\n vec3 dx33 = Pfx + jitter*ox33;\n vec3 dy33 = Pfy.z + jitter*oy33;\n vec3 dz33 = Pfz.z + jitter*oz33;\n vec3 d11 = worleyDist(dx11, dy11, dz11, manhattanDistance);\n vec3 d12 = worleyDist(dx12, dy12, dz12, manhattanDistance);\n vec3 d13 = worleyDist(dx13, dy13, dz13, manhattanDistance);\n vec3 d21 = worleyDist(dx21, dy21, dz21, manhattanDistance);\n vec3 d22 = worleyDist(dx22, dy22, dz22, manhattanDistance);\n vec3 d23 = worleyDist(dx23, dy23, dz23, manhattanDistance);\n vec3 d31 = worleyDist(dx31, dy31, dz31, manhattanDistance);\n vec3 d32 = worleyDist(dx32, dy32, dz32, manhattanDistance);\n vec3 d33 = worleyDist(dx33, dy33, dz33, manhattanDistance);\n vec3 d1a = min(d11, d12);\n d12 = max(d11, d12);\n d11 = min(d1a, d13); \n d13 = max(d1a, d13);\n d12 = min(d12, d13); \n vec3 d2a = min(d21, d22);\n d22 = max(d21, d22);\n d21 = min(d2a, d23); \n d23 = max(d2a, d23);\n d22 = min(d22, d23); \n vec3 d3a = min(d31, d32);\n d32 = max(d31, d32);\n d31 = min(d3a, d33); \n d33 = max(d3a, d33);\n d32 = min(d32, d33); \n vec3 da = min(d11, d21);\n d21 = max(d11, d21);\n d11 = min(da, d31); \n d31 = max(da, d31); \n d11.xy = (d11.x < d11.y) ? d11.xy : d11.yx;\n d11.xz = (d11.x < d11.z) ? d11.xz : d11.zx; \n d12 = min(d12, d21); \n d12 = min(d12, d22); \n d12 = min(d12, d31); \n d12 = min(d12, d32); \n d11.yz = min(d11.yz,d12.xy); \n d11.y = min(d11.y,d12.z); \n d11.y = min(d11.y,d11.z); \n return sqrt(d11.xy); \n}\nvec4 worleyBrightContrastHack(vec4 color, float bright, float contrast)\n{\n float bminc = bright - contrast * 0.5;\n color.r = max((1.0 + contrast) * color.r + bminc, 0.0);\n color.g = max((1.0 + contrast) * color.g + bminc, 0.0);\n color.b = max((1.0 + contrast) * color.b + bminc, 0.0);\n color.a = color.a;\n return color;\n}\nvoid node_tex_voronoi(\n int cells, \n vec3 vector, float scale, float exponent,\n out vec4 outColor, out float outFac)\n{\n vector = scale * (vector - 0.0001);\n float contrast;\n if (cells == 1) {\n float r = worley(vector, 1.0, false).x;\n float g = worley(vec3(vector.y, vector.x, vector.z), 1.0, false).x;\n float b = worley(vec3(vector.y, vector.z, vector.x), 1.0, false).x;\n \n outFac = (r + g + b) / 3.0;\n outColor = vec4(r, g, b, 1.0);\n outColor = worleyBrightContrastHack(outColor, 0.0, 0.7);\n } else {\n outFac = worley(vector, 1.0, false).x;\n outColor = vec4(vec3(outFac), 1.0);\n outColor = worleyBrightContrastHack(outColor, -0.2, 0.0);\n }\n}\nvoid node_tex_voronoi(\n int cells,\n vec3 vector, float scale,\n out vec4 outColor, out float outFac)\n{\n node_tex_voronoi(cells, vector, scale, 0.5, outColor, outFac);\n}\n",node_tex_wave_frag:"void node_tex_wave(\n vec3 vector, float scale, float distortion, float detail, float detailScale, \n out vec4 outColor, out float outFac)\n{\n outColor = vec4(0.5);\n}\n",node_texture_cube_frag:"\nuniform float flipCubeMap;\nvoid node_texture_cube(samplerCube ima, const int encoding, vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n vec = vec3(flipCubeMap * vec.x, vec.z, -vec.y);\n color = textureCube(ima, vec);\n value = color.a;\n normal.x = 2.0 * (color.r - 0.5);\n normal.y = 2.0 * (0.5 - color.g);\n normal.z = 2.0 * (color.b - 0.5);\n color = nodeTexelToLinear(color, encoding);\n}\n",node_texture_frag:"\nvoid node_texture(sampler2D ima, const int encoding, vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n vec2 uv = (vec.xy + vec2(1.0, 1.0)) * 0.5;\n \n uv.y = 1.0 - uv.y;\n color = texture2D(ima, uv);\n value = color.a;\n normal.x = 2.0 * (color.r - 0.5);\n normal.y = 2.0 * (0.5 - color.g);\n normal.z = 2.0 * (color.b - 0.5);\n color = nodeTexelToLinear(color, encoding);\n}\n",node_texture_none_frag:"\nvoid node_texture_none(vec3 vec, out float value, out vec4 color, out vec3 normal)\n{\n value = 0.0;\n color = vec4(0.0);\n normal = vec3(0.0);\n}\n",node_uvmap_frag:"void node_uvmap(vec2 uv, out vec3 outUV) {\n #if WORLD_NODES == 1\n outUV = vec3(0.0);\n #else\n \n uv.y = 1.0 - uv.y;\n outUV = vec3(uv, 0.0);\n #endif\n}\n",node_valtorgb_frag:"\nvoid node_valtorgb(sampler2D colormap, float fac, out vec4 colOut, out float alphaOut)\n{\n colOut = texture2D(colormap, vec2(fac, 0.0));\n alphaOut = colOut.a;\n}\n",node_value_frag:"\nuniform float nodeValue[NODE_VALUE_NUM];\nvoid node_value(float val, out float outVal)\n{\n outVal = val;\n}\n",node_vect_math_frag:"\nvoid node_vect_math_add(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 + v2;\n outVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_subtract(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 - v2;\n outVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_average(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = v1 + v2;\n outVal = length(outVec);\n outVec = normalize(outVec);\n}\nvoid node_vect_math_dot_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = vec3(0, 0, 0);\n outVal = dot(v1, v2);\n}\nvoid node_vect_math_cross_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVec = cross(v1, v2);\n outVal = length(outVec);\n outVec /= outVal;\n}\nvoid node_vect_math_normalize(vec3 v, vec3 v2, out vec3 outVec, out float outVal)\n{\n outVal = length(v);\n outVec = normalize(v);\n}\n",node_vect_transform_frag:"\n#define VEC_TRANS_NONE 0\n#define VEC_TRANS_W_O 1\n#define VEC_TRANS_W_C 2\n#define VEC_TRANS_O_W 3\n#define VEC_TRANS_O_C 4\n#define VEC_TRANS_C_W 5\n#define VEC_TRANS_C_O 6\n#define VEC_TRANS_W_O_DIR 7\n#define VEC_TRANS_W_C_DIR 8\n#define VEC_TRANS_O_W_DIR 9\n#define VEC_TRANS_O_C_DIR 10\n#define VEC_TRANS_C_W_DIR 11\n#define VEC_TRANS_C_O_DIR 12\nvoid node_vect_transform(const int vecTransType, const int invCamZ, vec3 vIn, out vec3 vOut)\n{\n if (vecTransType == VEC_TRANS_NONE)\n vOut = vIn;\n else {\n vec4 vec;\n if (vecTransType < VEC_TRANS_W_O_DIR)\n vec = vec4(vIn.xyz, 1.0);\n else\n vec = vec4(vIn.xyz, 0.0);\n if (vecTransType == VEC_TRANS_W_O || vecTransType == VEC_TRANS_W_O_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = invModelMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_W_C || vecTransType == VEC_TRANS_W_C_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = viewMatrix * vec;\n if (invCamZ == 1)\n vec[2] = -vec[2];\n } else if (vecTransType == VEC_TRANS_O_W || vecTransType == VEC_TRANS_O_W_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = modelMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_O_C || vecTransType == VEC_TRANS_O_C_DIR) {\n vec = vec4(vec.x, vec.z, -vec.y, vec.w);\n vec = modelViewMatrix * vec;\n if (invCamZ == 1)\n vec[2] = -vec[2];\n } else if (vecTransType == VEC_TRANS_C_W || vecTransType == VEC_TRANS_C_W_DIR) {\n if (invCamZ == 1)\n vec[2] = -vec[2];\n vec = invViewMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n } else if (vecTransType == VEC_TRANS_C_O || vecTransType == VEC_TRANS_C_O_DIR) {\n if (invCamZ == 1)\n vec[2] = -vec[2];\n vec = invModelMatrix * invViewMatrix * vec;\n vec = vec4(vec.x, -vec.z, vec.y, vec.w);\n }\n vOut = vec.xyz;\n }\n}\n",node_volume_absorption_frag:"void node_volume_absorption(vec4 color, float density, out vec4 outColor)\n{\n outColor = color;\n}\n",node_volume_scatter_frag:"void node_volume_scatter(vec4 color, float density, float anisotropy, out vec4 outColor)\n{\n outColor = vec4(color);\n}\n",node_wavelength_frag:"void node_wavelength(float wavelength, out vec4 outColor)\n{\n outColor = vec4(0.0);\n}\n",node_wireframe_frag:"void node_wireframe(float size, out float outFac)\n{\n outFac = 0.0;\n}\n",node_bitmap_none_max_frag:"\nvoid node_bitmap_none_max(out vec4 color)\n{\n color = vec4(1.0);\n}\n",node_bitmap_env_max_frag:"\nvoid node_bitmap_env_max(sampler2D envMap, vec3 viewNormal, float bumpFactor, \n int modeReflection, float IOR,\n const int encoding, const int alphaAsMono, const int alphaAsRGB,\n \n float uOffset, float vOffset, float uTiling, float vTiling, float wAngle, vec3 bumpNormal,\n out vec4 color, out float value)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n vec3 reflectVec;\n if (modeReflection == 1)\n reflectVec = reflect(cameraToVertex, worldNormal);\n else {\n float refrRatio = 1.0 / IOR;\n reflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n }\n mat3 uvTransform = calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle);\n color = sampleEquirectangular(envMap, reflectVec, uvTransform, encoding);\n if (alphaAsMono == 1)\n value = color.a;\n else\n value = average(color.rgb);\n if (alphaAsRGB == 1)\n color = vec4(color.a);\n}\n",node_bitmap_max_frag:"\nvoid node_bitmap_max(sampler2D map, const vec2 uvIn, const int encoding,\n const int alphaAsMono, const int alphaAsRGB,\n float uOffset, float vOffset, float uTiling, float vTiling, float wAngle,\n out vec4 color, out float value)\n{\n vec2 uv = (calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle) * vec3(uvIn, 1.0)).xy;\n color = texture2D(map, uv);\n color = nodeTexelToLinear(color, encoding);\n if (alphaAsMono == 1)\n value = color.a;\n else\n value = average(color.rgb);\n if (alphaAsRGB == 1)\n color = vec4(color.a);\n}\n",node_bump_max_frag:"\nvoid node_bump_max(sampler2D bumpMap, const vec3 eyePos, const vec3 normal, const vec2 uv,\n out vec3 normalOut)\n{\n vec2 dSTdx = dFdx(uv);\n vec2 dSTdy = dFdy(uv);\n if (any(equal(dSTdx, vec2(0.0))) || any(equal(dSTdy, vec2(0.0)))) {\n normalOut = normal;\n } else {\n const float bumpScale = 1.0;\n vec3 vSigmaX = vec3(dFdx(eyePos.x), dFdx(eyePos.y), dFdx(eyePos.z));\n vec3 vSigmaY = vec3(dFdy(eyePos.x), dFdy(eyePos.y), dFdy(eyePos.z));\n vec3 vN = normal;\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n float fDet = dot(vSigmaX, R1);\n float Hll = bumpScale * texture2D(bumpMap, uv).x;\n float dBx = bumpScale * texture2D(bumpMap, uv + dSTdx).x - Hll;\n float dBy = bumpScale * texture2D(bumpMap, uv + dSTdy).x - Hll;\n vec2 dHdxy = vec2(dBx, dBy);\n vec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\n normalOut = normalize(abs(fDet) * normal - vGrad);\n }\n}\n",node_color_correction_max_frag:"#define REWIRE_RED 0\n#define REWIRE_GREEN 1\n#define REWIRE_BLUE 2\n#define REWIRE_ALPHA 3\n#define REWIRE_RED_INV 4\n#define REWIRE_GREEN_INV 5\n#define REWIRE_BLUE_INV 6\n#define REWIRE_ALPHA_INV 7\n#define REWIRE_MONOCHROME 8\n#define REWIRE_ONE 9\n#define REWIRE_ZERO 10\nfloat rewireChannel(int type, vec4 color)\n{\n if (type == REWIRE_RED)\n return color.r;\n else if (type == REWIRE_GREEN)\n return color.g;\n else if (type == REWIRE_BLUE)\n return color.b;\n else if (type == REWIRE_ALPHA)\n return color.a;\n else if (type == REWIRE_RED_INV)\n return 1.0-color.r;\n else if (type == REWIRE_GREEN_INV)\n return 1.0-color.g;\n else if (type == REWIRE_BLUE_INV)\n return 1.0-color.b;\n else if (type == REWIRE_ALPHA_INV)\n return 1.0-color.a;\n else if (type == REWIRE_MONOCHROME)\n return average(color.rgb);\n else if (type == REWIRE_ONE)\n return 1.0;\n else\n return 0.0;\n}\nvoid node_color_correction_max(const ivec4 rewire,\n const float hueShift, const float saturation,\n const float brightness, const float contrast,\n const vec4 color, out vec4 outColor)\n{\n \n if (all(equal(rewire, ivec4(REWIRE_RED, REWIRE_GREEN, REWIRE_BLUE, REWIRE_ALPHA)))) {\n outColor = color;\n } else {\n outColor.r = rewireChannel(rewire.x, color);\n outColor.g = rewireChannel(rewire.y, color);\n outColor.b = rewireChannel(rewire.z, color);\n outColor.a = rewireChannel(rewire.w, color);\n }\n vec4 hsv;\n rgbToHSV(outColor, hsv);\n hsv[0] += (hueShift - 0.5);\n if (hsv[0] > 1.0)\n hsv[0] -= 1.0;\n else if (hsv[0] < 0.0)\n hsv[0] += 1.0;\n \n hsv[1] *= saturation;\n hsv[1] = saturate(hsv[1]);\n hsvToRGB(hsv, outColor);\n outColor = (outColor - 0.5) * contrast + 0.5 + brightness;\n}\n",node_color_map_max_frag:"\nvoid node_color_map_max(const vec4 colorIn, out vec4 color)\n{\n color = colorIn;\n}\n",node_composite_layer_max_frag:"#define COMP_BLEND_NORMAL 0\n#define COMP_BLEND_AVERAGE 1\n#define COMP_BLEND_ADD 2\n#define COMP_BLEND_SUBTRACT 3\n#define COMP_BLEND_DARKEN 4\n#define COMP_BLEND_MULTIPLY 5\n#define COMP_BLEND_COLORBURN 6\n#define COMP_BLEND_LINEARBURN 7\n#define COMP_BLEND_LIGHTEN 8\n#define COMP_BLEND_SCREEN 9\n#define COMP_BLEND_COLORDODGE 10\n#define COMP_BLEND_LINEARDODGE 11\n#define COMP_BLEND_SPOT 12\n#define COMP_BLEND_SPOTBLEND 13\n#define COMP_BLEND_OVERLAY 14\n#define COMP_BLEND_SOFTLIGHT 15\n#define COMP_BLEND_HARDLIGHT 16\n#define COMP_BLEND_PINLIGHT 17\n#define COMP_BLEND_HARDMIX 18\n#define COMP_BLEND_DIFFERENCE 19\n#define COMP_BLEND_EXCLUSION 20\n#define COMP_BLEND_HUE 21\n#define COMP_BLEND_SATURATION 22\n#define COMP_BLEND_COLOR 23\n#define COMP_BLEND_VALUE 24\nvec4 calcBlending(const vec4 colorBG, const vec4 colorFG, const int blendMode) {\n if (blendMode == COMP_BLEND_NORMAL)\n return colorFG;\n else if (blendMode == COMP_BLEND_AVERAGE)\n return (colorFG + colorBG) / 2.0;\n else if (blendMode == COMP_BLEND_ADD)\n return colorBG + colorFG;\n else if (blendMode == COMP_BLEND_SUBTRACT)\n return colorBG - colorFG;\n else if (blendMode == COMP_BLEND_DARKEN)\n return min(colorFG, colorBG);\n else if (blendMode == COMP_BLEND_MULTIPLY)\n return colorBG * colorFG;\n else if (blendMode == COMP_BLEND_COLORBURN) {\n if (colorFG.r == 0.0 && colorFG.g == 0.0 && colorFG.b == 0.0)\n return vec4(0.0, 0.0, 0.0, 1.0);\n else\n return max(1.0 - (1.0 - colorBG) / colorFG, 0.0);\n } else if (blendMode == COMP_BLEND_LINEARBURN)\n return max(colorFG + colorBG - 1.0, 0.0);\n else if (blendMode == COMP_BLEND_LIGHTEN)\n return max(colorFG, colorBG);\n else if (blendMode == COMP_BLEND_SCREEN)\n return colorFG + colorBG - colorFG * colorBG;\n else if (blendMode == COMP_BLEND_COLORDODGE) {\n if (colorFG.r == 1.0 && colorFG.g == 1.0 && colorFG.b == 1.0)\n return vec4(1.0);\n else\n return min(colorBG / (1.0 - colorFG), 1.0);\n } else if (blendMode == COMP_BLEND_LINEARDODGE)\n return min(colorFG + colorBG, 1.0);\n else if (blendMode == COMP_BLEND_SPOT)\n return min(2.0 * colorFG * colorBG, 1.0);\n else if (blendMode == COMP_BLEND_SPOTBLEND)\n return min(colorFG * colorBG + colorBG, 1.0);\n else if (blendMode == COMP_BLEND_OVERLAY) {\n if (colorBG.r <= 0.5 && colorBG.g <= 0.5 && colorBG.b <= 0.5)\n return saturate(2.0 * colorFG * colorBG);\n else\n return saturate(1.0 - 2.0 * (1.0-colorFG) * (1.0-colorBG));\n } else if (blendMode == COMP_BLEND_SOFTLIGHT) {\n if (colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5)\n return saturate(colorBG * (colorBG + 2.0 * colorFG * (1.0 - colorBG)));\n else\n return saturate(colorBG + (2.0 * colorFG - 1.0) * (sqrt(colorBG) - colorBG));\n } else if (blendMode == COMP_BLEND_HARDLIGHT) {\n if (colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5)\n return saturate(2.0 * colorFG * colorBG);\n else\n return saturate(1.0 - 2.0*(1.0 - colorFG)*(1.0 - colorBG));\n } else if (blendMode == COMP_BLEND_PINLIGHT) {\n if (((colorFG.r > 0.5 && colorFG.g > 0.5 && colorFG.b > 0.5) && all(greaterThan(colorFG, colorBG))) ||\n ((colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5) && all(lessThan(colorFG, colorBG))))\n return colorFG;\n else\n return colorBG;\n } else if (blendMode == COMP_BLEND_HARDMIX) {\n if (colorFG.r + colorBG.r <= 1.0 && colorFG.g + colorBG.g <= 1.0 && colorFG.b + colorBG.b <= 1.0)\n return vec4(0.0, 0.0, 0.0, 1.0);\n else\n return vec4(1.0);\n } else if (blendMode == COMP_BLEND_DIFFERENCE)\n return abs(colorFG - colorBG);\n else if (blendMode == COMP_BLEND_EXCLUSION)\n return colorFG + colorBG - 2.0 * colorFG * colorBG;\n}\nvec4 calcBlendingHSV(const vec4 colorBG, const vec4 colorFG, const int blendMode)\n{\n vec4 hsvBG, hsvFG;\n vec4 outColor;\n if (blendMode == COMP_BLEND_HUE) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvFG[0], hsvBG[1], hsvBG[2], 1.0), outColor);\n } else if (blendMode == COMP_BLEND_SATURATION) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvBG[0], hsvFG[1], hsvBG[2], 1.0), outColor);\n } else if (blendMode == COMP_BLEND_COLOR) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvFG[0], hsvFG[1], hsvBG[2], 1.0), outColor);\n } else if (blendMode == COMP_BLEND_VALUE) {\n rgbToHSV(colorBG, hsvBG);\n rgbToHSV(colorFG, hsvFG);\n hsvToRGB(vec4(hsvBG[0], hsvBG[1], hsvFG[2], 1.0), outColor);\n }\n return outColor;\n}\nvoid node_composite_layer_max(const int blendMode, const float opacity, \n const vec4 colorBG, const vec4 colorFG, const vec4 mask,\n out vec4 outColor)\n{\n float fac = saturate(opacity * average(mask.rgb));\n if (blendMode < COMP_BLEND_HUE)\n outColor = calcBlending(colorBG, colorFG, blendMode);\n else\n outColor = calcBlendingHSV(colorBG, colorFG, blendMode);\n outColor = mix(colorBG, outColor, fac);\n}\n",node_falloff_max_frag:"\nvoid node_falloff_max(vec3 viewPos, float IOR, vec3 normal, float bumpFactor,\n const vec4 color1, const vec4 color2, vec3 bumpNormal, out vec4 color)\n{\n normal = normalize(mix(normal, bumpNormal, bumpFactor));\n float fac;\n \n vec3 dir = normalize(viewPos);\n float eta = max(IOR, 0.00001);\n fac = fresnelReflection(dir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n color = mix(color1, color2, fac);\n}\n",node_map_max_frag:"\nvoid node_map_max(const vec4 colorIn, out vec4 color)\n{\n color = colorIn;\n}\n",node_mask_max_frag:"\nvoid node_map_max(const vec4 colorIn, const vec4 mask, out vec4 color)\n{\n color = colorIn;\n}\n",node_material_max_frag:"\nvoid node_material_max(\n const vec3 viewNormal, \n const float bumpFactor, float reflectionRatio, const float refractionRatio,\n const int selfIllumColorOn,\n const vec4 ambientColor, const vec4 diffuseColor, const vec4 specularColor,\n const float glossiness, const float specularLevel, const vec4 selfIllum,\n const float opacity, const vec4 filterColor, const vec3 bumpNormal,\n const vec4 reflection, const vec4 refraction, const float displacement,\n out vec4 outColor, out float outAlpha)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n vec3 diffuse, specular;\n NodeMaterial material;\n material.diffuseColor = diffuseColor.rgb;\n material.specularColor = specularColor.rgb;\n material.diffuseIntensity = 1.0;\n material.specularHardness = 4.0 * exp2(glossiness * 10.0);\n material.specularIntensity = specularLevel;\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n vec3 totalEmissiveRadiance;\n if (selfIllumColorOn == 1)\n totalEmissiveRadiance = selfIllum.rgb;\n else\n totalEmissiveRadiance = vec3(selfIllum[0] * material.diffuseColor);\n diffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n totalEmissiveRadiance;\n specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n float specularStrength = maxFromRGB(specular);\n outColor = vec4(saturate(diffuse + specular), 1.0);\n \n outAlpha = opacity - saturate(maxFromRGB(specular)) * (opacity - 1.0);\n outColor += reflection * specularColor * reflectionRatio;\n outColor += refraction * refractionRatio;\n \n outAlpha += saturate(maxFromRGB(reflection.rgb) * maxFromRGB(specularColor.rgb)) * reflectionRatio;\n outAlpha += saturate(maxFromRGB(refraction.rgb)) * refractionRatio;\n}\n",node_mix_max_frag:"\nvoid node_mix_max(const vec4 color1, const vec4 color2, const float amount, out vec4 color)\n{\n color = mix(color1, color2, clamp(amount, 0.0, 1.0));\n}\n",node_normal_bump_max_frag:"\nvoid node_normal_bump_max(const vec4 tangent, const vec3 normal, ivec2 flip,\n vec4 normalColor, const vec3 additionalBump, out vec3 normalOut)\n{\n if (flip[0] == 1)\n normalColor.x = 1.0 - normalColor.x;\n \n if (flip[1] == 0)\n normalColor.y = 1.0 - normalColor.y;\n vec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\n vec4 viewTangent = vec4((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz, tangent.w);\n vec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\n normalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n + normalTex.z * normal);\n normalOut = normalize(normalOut + additionalBump);\n}\n",node_physical_max_frag:"\nvoid node_physical_max(\n const vec3 viewNormal, const float bumpFactor, const float emitLuminance,\n const float baseWeight, const vec4 baseColor, const float reflectivity,\n const vec4 reflColor, const float roughness, const float metalness,\n const float diffRoughness, const float anisotropy, const float anisoangle,\n const float transparency, const vec4 transColor, const float transRoughness,\n const float ior, const float scattering, const vec4 sssColor,\n const float sssScale, const float emission, const vec4 emitColor,\n const float coating, const vec4 coatColor, const float coatRoughness,\n const vec3 bumpNormal, const vec3 coatBumpNormal, const float displacement,\n const float cutout,\n out vec4 outColor, out float outAlpha)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n NodeMaterial material;\n vec3 baseColorWeighted = baseWeight * baseColor.rgb;\n material.diffuseColor = baseColorWeighted * (1.0 - metalness);\n#ifdef STANDARD\n float dielRefl = DEFAULT_SPECULAR_COEFFICIENT;\n#else\n float dielRefl = pow2((1.0 - ior)/ (1.0 + ior));\n material.clearCoat = saturate(coating); \n material.clearCoatRoughness = clamp(coatRoughness, 0.04, 1.0);\n#endif\n material.specularColor = mix(dielRefl * vec3(reflColor.rgb), baseColorWeighted, metalness);\n material.specularRoughness = clamp(roughness, 0.04, 1.0);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n \n float specular = saturate(metalness + reflectivity);\n vec3 totalEmissiveRadiance = emitLuminance / WATT_PER_CANDELA * emission * emitColor.rgb;\n vec3 outColor3 = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\n specular * (reflectedLight.directSpecular + reflectedLight.indirectSpecular) + \n totalEmissiveRadiance;\n outColor = vec4(outColor3, 1.0);\n outAlpha = saturate(1.0 - transparency);\n}\n",node_reflect_refract_max_frag:"\nvoid node_reflect_refract_max(sampler2D envMap, vec3 viewNormal, float bumpFactor,\n int modeReflection, const float IOR, const int encoding,\n \n vec3 bumpNormal, out vec4 color)\n{\n vec3 normal = normalize(mix(viewNormal, bumpNormal, bumpFactor));\n vec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\n vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n vec3 reflectVec;\n if (modeReflection == 1)\n reflectVec = reflect(cameraToVertex, worldNormal);\n else {\n float refrRatio = 1.0 / IOR;\n reflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n }\n reflectVec = normalize(reflectVec);\n color = sampleEquirectangular(envMap, reflectVec, mat3(1.0), encoding);\n}\n",node_reflect_refract_color_max_frag:"\nvoid node_reflect_refract_color_max(const vec4 colorIn, out vec4 color)\n{\n color = vec4(colorIn);\n}\n",node_rgb_multiply_max_frag:"\nvoid node_rgb_multiply_max(const vec4 color1, const vec4 color2, out vec4 color)\n{\n color = color1 * color2;\n}\n",node_shellac_max_frag:"\nvoid node_shellac_max(const vec4 color1, const vec4 color2, const float amount,\n out vec4 color, out float alpha)\n{\n color = mix(color1, color2, clamp(amount, 0.0, 1.0));\n \n alpha = color.a;\n}\n",node_vertex_color_max_frag:"\nvoid node_vertex_color_max(vec3 color, out vec4 outColor)\n{\n outColor = vec4(color, 1.0);\n}\n",pp_plane_vert:"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",pp_brightness_contrast_frag:"\nuniform sampler2D tDiffuse;\nuniform float brightness;\nuniform float contrast;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n texel.rgb += brightness;\n if (contrast > 0.0)\n texel.rgb = (texel.rgb - 0.5) / (1.0 - contrast) + 0.5;\n else\n texel.rgb = (texel.rgb - 0.5) * (1.0 + contrast) + 0.5;\n gl_FragColor = texel;\n}\n",pp_bokeh_frag:"#include <common>\nvarying vec2 vUv;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform float maxblur; \nuniform float aperture; \nuniform float nearClip;\nuniform float farClip;\nuniform float focus;\nuniform float aspect;\nuniform float depthLeakThreshold;\n#include <packing>\nfloat getDepth(const in vec2 screenPosition) {\n#if DEPTH_PACKING == 1\n return unpackRGBAToDepth(texture2D(tDepth, screenPosition));\n#else\n return texture2D(tDepth, screenPosition).x;\n#endif\n}\nfloat getViewZ(const in float depth) {\n#if PERSPECTIVE_CAMERA == 1\n return perspectiveDepthToViewZ(depth, nearClip, farClip);\n#else\n return orthoDepthToViewZ(depth, nearClip, farClip);\n#endif\n}\nvec4 blurSample(vec2 uvOffset, vec4 centerCol, float viewZCenter) {\n float viewZ = -getViewZ(getDepth(vUv + uvOffset));\n \n \n float blurFactor = (viewZ >= viewZCenter) ? 1.0 : \n min(depthLeakThreshold * abs((focus - viewZ) / aperture), 1.0);\n return mix(centerCol, texture2D(tColor, vUv + uvOffset), blurFactor);\n}\nvoid main() {\n vec2 aspectcorrect = vec2(1.0, aspect);\n float viewZ = -getViewZ(getDepth(vUv));\n float factor = abs(focus - viewZ);\n \n float dofblur = maxblur * min(factor / aperture, 1.0);\n float dofblur9 = dofblur * 0.9;\n float dofblur7 = dofblur * 0.7;\n float dofblur4 = dofblur * 0.4;\n vec4 centerCol = texture2D(tColor, vUv);\n vec4 col = centerCol;\n col += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.15, 0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.37, 0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.37, -0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.15, -0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.15, 0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.37, 0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.37, -0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\n col += blurSample((vec2( 0.15, -0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n \n col += blurSample((vec2( 0.15, 0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.37, 0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2( 0.37, -0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.15, -0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.15, 0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2( 0.37, 0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2(-0.37, -0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\n col += blurSample((vec2( 0.15, -0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n \n col += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\n col += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n \n col += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.4, 0.0 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\n col += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\n gl_FragColor = col / 41.0;\n gl_FragColor.a = centerCol.a;\n}\n",pp_copy_frag:"uniform sampler2D tDiffuse;\nuniform float opacity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = (texture2D(tDiffuse, vUv));\n #if MAP_TEXELS == 1\n texel = mapTexelToLinear(texel);\n #endif\n \n gl_FragColor = opacity * texel;\n #if MAP_TEXELS == 1\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #endif\n}\n",pp_fxaa_frag:"\nprecision highp float;\nuniform sampler2D tDiffuse;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#define FXAA_PC 1\n#define FXAA_GLSL_100 1\n#define FXAA_QUALITY_PRESET 12\n#define FXAA_GREEN_AS_LUMA 1\n#ifndef FXAA_PC_CONSOLE\n \n \n \n \n \n #define FXAA_PC_CONSOLE 0\n#endif\n#ifndef FXAA_GLSL_120\n #define FXAA_GLSL_120 0\n#endif\n#ifndef FXAA_GLSL_130\n #define FXAA_GLSL_130 0\n#endif\n#ifndef FXAA_HLSL_3\n #define FXAA_HLSL_3 0\n#endif\n#ifndef FXAA_HLSL_4\n #define FXAA_HLSL_4 0\n#endif\n#ifndef FXAA_HLSL_5\n #define FXAA_HLSL_5 0\n#endif\n#ifndef FXAA_GREEN_AS_LUMA\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n #define FXAA_GREEN_AS_LUMA 0\n#endif\n#ifndef FXAA_EARLY_EXIT\n \n \n \n \n \n \n \n \n \n \n #define FXAA_EARLY_EXIT 1\n#endif\n#ifndef FXAA_DISCARD\n \n \n \n \n \n \n \n \n #define FXAA_DISCARD 0\n#endif\n#ifndef FXAA_FAST_PIXEL_OFFSET\n \n \n \n \n \n \n #ifdef GL_EXT_gpu_shader4\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifndef FXAA_FAST_PIXEL_OFFSET\n #define FXAA_FAST_PIXEL_OFFSET 0\n #endif\n#endif\n#ifndef FXAA_GATHER4_ALPHA\n \n \n \n \n #if (FXAA_HLSL_5 == 1)\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifndef FXAA_GATHER4_ALPHA\n #define FXAA_GATHER4_ALPHA 0\n #endif\n#endif\n#ifndef FXAA_QUALITY_PRESET\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n #define FXAA_QUALITY_PRESET 12\n#endif\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)\n #define FxaaBool bool\n #define FxaaDiscard discard\n #define FxaaFloat float\n #define FxaaFloat2 vec2\n #define FxaaFloat3 vec3\n #define FxaaFloat4 vec4\n #define FxaaHalf float\n #define FxaaHalf2 vec2\n #define FxaaHalf3 vec3\n #define FxaaHalf4 vec4\n #define FxaaInt2 ivec2\n #define FxaaSat(x) clamp(x, 0.0, 1.0)\n #define FxaaTex sampler2D\n#else\n #define FxaaBool bool\n #define FxaaDiscard clip(-1)\n #define FxaaFloat float\n #define FxaaFloat2 float2\n #define FxaaFloat3 float3\n #define FxaaFloat4 float4\n #define FxaaHalf half\n #define FxaaHalf2 half2\n #define FxaaHalf3 half3\n #define FxaaHalf4 half4\n #define FxaaSat(x) saturate(x)\n#endif\n#if (FXAA_GLSL_100 == 1)\n #define FxaaTexTop(t, p) texture2D(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)\n#endif\n#if (FXAA_GLSL_120 == 1)\n \n \n \n \n \n #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n #if (FXAA_FAST_PIXEL_OFFSET == 1)\n #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)\n #else\n #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n #endif\n #if (FXAA_GATHER4_ALPHA == 1)\n \n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n#if (FXAA_GLSL_130 == 1)\n \n #define FxaaTexTop(t, p) textureLod(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)\n #if (FXAA_GATHER4_ALPHA == 1)\n \n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n#if (FXAA_HLSL_3 == 1)\n #define FxaaInt2 float2\n #define FxaaTex sampler2D\n #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))\n #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))\n#endif\n#if (FXAA_HLSL_4 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n#endif\n#if (FXAA_HLSL_5 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)\n #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)\n #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)\n #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)\n#endif\n#if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }\n#else\n FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n#endif\n#if (FXAA_PC == 1)\nFxaaFloat4 FxaaPixelShader(\n \n \n \n FxaaFloat2 pos,\n \n \n \n \n \n FxaaFloat4 fxaaConsolePosPos,\n \n \n \n \n \n FxaaTex tex,\n \n \n \n \n \n FxaaTex fxaaConsole360TexExpBiasNegOne,\n \n \n \n \n \n FxaaTex fxaaConsole360TexExpBiasNegTwo,\n \n \n \n \n \n FxaaFloat2 fxaaQualityRcpFrame,\n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat4 fxaaConsoleRcpFrameOpt,\n \n \n \n \n \n \n \n \n FxaaFloat4 fxaaConsoleRcpFrameOpt2,\n \n \n \n \n \n \n \n \n FxaaFloat4 fxaaConsole360RcpFrameOpt2,\n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaQualitySubpix,\n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaQualityEdgeThreshold,\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaQualityEdgeThresholdMin,\n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaConsoleEdgeSharpness,\n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaConsoleEdgeThreshold,\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n FxaaFloat fxaaConsoleEdgeThresholdMin,\n \n \n \n \n \n \n FxaaFloat4 fxaaConsole360ConstDir\n) {\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n #if (FXAA_GATHER4_ALPHA == 1)\n #if (FXAA_DISCARD == 0)\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #endif\n #if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));\n #else\n FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));\n #endif\n #if (FXAA_DISCARD == 1)\n #define lumaM luma4A.w\n #endif\n #define lumaE luma4A.z\n #define lumaS luma4A.x\n #define lumaSE luma4A.y\n #define lumaNW luma4B.w\n #define lumaN luma4B.z\n #define lumaW luma4B.x\n #else\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #if (FXAA_GLSL_100 == 1)\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0, 1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 0.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n #endif\n #endif\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n if(earlyExit)\n #if (FXAA_DISCARD == 1)\n FxaaDiscard;\n #else\n return rgbyM;\n #endif\n #if (FXAA_GATHER4_ALPHA == 0)\n #if (FXAA_GLSL_100 == 1)\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0,-1.0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n #else\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = (horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if(horzSpan) posB.y += lengthSign * 0.5;\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if(horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n #if (FXAA_DISCARD == 1)\n return FxaaTexTop(tex, posM);\n #else\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n #endif\n}\n#endif\nvoid main() {\n gl_FragColor = FxaaPixelShader(\n vUv,\n vec4(0.0),\n tDiffuse,\n tDiffuse,\n tDiffuse,\n resolution,\n vec4(0.0),\n vec4(0.0),\n vec4(0.0),\n 0.75,\n 0.166,\n 0.0833,\n 0.0,\n 0.0,\n 0.0,\n vec4(0.0)\n );\n \n gl_FragColor.a = texture2D(tDiffuse, vUv).a;\n}\n",pp_grayscale_frag:"uniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n float bw = texel.r * 0.35 + texel.g * 0.45 + texel.b * 0.2;\n texel = vec4(bw, bw, bw, texel.a);\n gl_FragColor = texel;\n}\n",pp_outline_edge_frag:"\nvarying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform vec2 texSize;\nuniform vec3 visibleEdgeColor;\nuniform vec3 hiddenEdgeColor;\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D(maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D(maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D(maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D(maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n}\n",pp_outline_blur_frag:"\n#include <common>\nvarying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;\nuniform vec2 direction;\nuniform float kernelRadius;\nfloat gaussianPdf(in float x, in float sigma) {\n return 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma;\n}\nvoid main() {\n vec2 invSize = 1.0 / texSize;\n float weightSum = gaussianPdf(0.0, kernelRadius);\n vec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum;\n vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n vec2 uvOffset = delta;\n for (int i = 1; i <= MAX_RADIUS; i++) {\n float w = gaussianPdf(uvOffset.x, kernelRadius);\n vec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb;\n vec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb;\n diffuseSum += ((sample1 + sample2) * w);\n weightSum += (2.0 * w);\n uvOffset += delta;\n }\n gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n}\n",pp_outline_overlay_frag:"\nvarying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform sampler2D edgeTexture1;\nuniform sampler2D edgeTexture2;\nuniform sampler2D patternTexture;\nuniform float edgeStrength;\nuniform float edgeGlow;\nuniform bool usePatternTexture;\nvoid main() {\n vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n vec4 maskColor = texture2D(maskTexture, vUv);\n vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n if (usePatternTexture)\n finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n gl_FragColor = finalColor;\n}\n",pp_ssao_frag:"\nuniform float cameraNear;\nuniform float cameraFar;\n#ifdef USE_LOGDEPTHBUF\n uniform float logDepthBufFC;\n#endif\nuniform float radius; \nuniform bool onlyAO; \nuniform vec2 size; \nuniform float aoClamp; \nuniform float lumInfluence; \nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nvarying vec2 vUv;\n#define DL 2.399963229728653 \n#define EULER 2.718281828459045\nconst int samples = 64; \nconst bool useNoise = true; \nconst float noiseAmount = 0.0004; \nconst float diffArea = 0.25; \nconst float gDisplace = 0.4; \n#include <packing>\nvec2 rand(const vec2 coord) {\n vec2 noise;\n if (useNoise) {\n float nx = dot (coord, vec2(12.9898, 78.233));\n float ny = dot (coord, vec2(12.9898, 78.233) * 2.0);\n noise = clamp(fract (43758.5453 * sin(vec2(nx, ny))), 0.0, 1.0);\n } else {\n float ff = fract(1.0 - coord.s * (size.x / 2.0));\n float gg = fract(coord.t * (size.y / 2.0));\n noise = vec2(0.25, 0.75) * vec2(ff) + vec2(0.75, 0.25) * gg;\n }\n return (noise * 2.0 - 1.0) * noiseAmount;\n}\nfloat readDepth(const in vec2 coord) {\n float cameraFarPlusNear = cameraFar + cameraNear;\n float cameraFarMinusNear = cameraFar - cameraNear;\n float cameraCoef = 2.0 * cameraNear;\n #ifdef USE_LOGDEPTHBUF\n float logz = unpackRGBAToDepth(texture2D(tDepth, coord));\n float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;\n float z = (logz / w) + 1.0;\n #else\n float z = unpackRGBAToDepth(texture2D(tDepth, coord));\n #endif\n return cameraCoef / (cameraFarPlusNear - z * cameraFarMinusNear);\n}\nfloat compareDepths(const in float depth1, const in float depth2, inout int far) {\n float garea = 8.0; \n float diff = (depth1 - depth2) * 100.0; \n \n if (diff < gDisplace) {\n garea = diffArea;\n } else {\n far = 1;\n }\n float dd = diff - gDisplace;\n float gauss = pow(EULER, -2.0 * (dd * dd) / (garea * garea));\n return gauss;\n}\nfloat calcAO(float depth, float dw, float dh) {\n vec2 vv = vec2(dw, dh);\n vec2 coord1 = vUv + radius * vv;\n vec2 coord2 = vUv - radius * vv;\n float temp1 = 0.0;\n float temp2 = 0.0;\n int far = 0;\n temp1 = compareDepths(depth, readDepth(coord1), far);\n \n if (far > 0) {\n temp2 = compareDepths(readDepth(coord2), depth, far);\n temp1 += (1.0 - temp1) * temp2;\n }\n return temp1;\n}\nvoid main() {\n vec2 noise = rand(vUv);\n float depth = readDepth(vUv);\n float tt = clamp(depth, aoClamp, 1.0);\n float w = (1.0 / size.x) / tt + (noise.x * (1.0 - noise.x));\n float h = (1.0 / size.y) / tt + (noise.y * (1.0 - noise.y));\n float ao = 0.0;\n float dz = 1.0 / float(samples);\n float l = 0.0;\n float z = 1.0 - dz / 2.0;\n for (int i = 0; i <= samples; i++) {\n float r = sqrt(1.0 - z);\n float pw = cos(l) * r;\n float ph = sin(l) * r;\n ao += calcAO(depth, pw * w, ph * h);\n z = z - dz;\n l = l + DL;\n }\n ao /= float(samples);\n ao = 1.0 - ao;\n vec4 color = texture2D(tDiffuse, vUv);\n vec3 lumcoeff = vec3(0.299, 0.587, 0.114);\n float lum = dot(color.rgb, lumcoeff);\n vec3 luminance = vec3(lum);\n vec3 final = vec3(color.rgb * mix(vec3(ao), vec3(1.0), luminance * lumInfluence)); \n if (onlyAO) {\n final = vec3(mix(vec3(ao), vec3(1.0), luminance * lumInfluence)); \n }\n gl_FragColor = vec4(final, color.a);\n}\n",pp_tonemap_frag:"\nuniform sampler2D tDiffuse;\nuniform float exposure;\nvarying vec2 vUv;\nvoid main() {\n vec4 texel = texture2D(tDiffuse, vUv);\n texel.rgb *= exposure;\n \n gl_FragColor = LinearTosRGB(texel);\n}\n",raw_meshline_frag:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D alphaMap;\nuniform float useMap;\nuniform float useAlphaMap;\nuniform float visibility;\nuniform float alphaTest;\nuniform vec2 repeat;\nuniform vec3 color;\nuniform float opacity;\nvarying vec2 vUV;\nvarying float vCounters;\nvec4 LinearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92,\n vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\nvoid main() {\n vec4 c = vec4(color, opacity);\n \n if (useMap == 1.0) {\n c *= texture2D(map, vUV * repeat);\n }\n if (useAlphaMap == 1.0) {\n c.a *= texture2D(alphaMap, vUV * repeat).a;\n }\n if (c.a < alphaTest) {\n discard;\n }\n gl_FragColor = c;\n gl_FragColor.a *= step(vCounters, visibility);\n gl_FragColor = LinearTosRGB(gl_FragColor);\n}",raw_meshline_vert:"precision highp float;\nattribute vec3 position;\nattribute vec3 previous;\nattribute vec3 next;\nattribute float side;\nattribute float width;\nattribute vec2 uv;\nattribute float counters;\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec2 resolution;\nuniform float lineWidth;\nuniform float sizeAttenuation;\nvarying float vCounters;\nvarying vec2 vUV;\nconst float EQ_EPS = 0.000001;\nvec2 fix(vec4 i, float aspect) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n}\nbool posEqual(vec2 pos0, vec2 pos1) {\n \n return length(pos0 - pos1) < EQ_EPS;\n}\nvoid main() {\n float aspect = resolution.x / resolution.y;\n vCounters = counters;\n vUV = uv;\n mat4 m = projectionMatrix * modelViewMatrix;\n vec4 finalPosition = m * vec4(position, 1.0);\n vec4 prevPos = m * vec4(previous, 1.0);\n vec4 nextPos = m * vec4(next, 1.0);\n vec2 currentP = fix(finalPosition, aspect);\n vec2 prevP = fix(prevPos, aspect);\n vec2 nextP = fix(nextPos, aspect);\n float w = lineWidth * width;\n if (sizeAttenuation == 0.0) {\n \n w *= finalPosition.w / resolution.x;\n }\n vec2 dir;\n if (posEqual(nextP, currentP)) {\n dir = normalize(currentP - prevP);\n } else if (posEqual(prevP, currentP)) {\n dir = normalize(nextP - currentP);\n } else {\n vec2 dir1 = normalize(currentP - prevP);\n vec2 dir2 = normalize(nextP - currentP);\n dir = normalize(dir1 + dir2);\n \n \n \n }\n \n vec2 offset = vec2(-dir.y, dir.x);\n offset.y *= aspect;\n offset *= w;\n finalPosition.xy += offset * side;\n gl_Position = finalPosition;\n}"},Nn={merge:function(e){for(var t={},n=0;n<e.length;n++){var r=this.clone(e[n]);for(var i in r)t[i]=r[i]}return t},clone:function(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}},Rn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Fn(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}Object.assign(Fn.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function a(e,t,n){return n<0&&(n+=1),1<n&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(e,t,n){if(e=Yt.euclideanModulo(e,1),t=Yt.clamp(t,0,1),n=Yt.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=a(i,r,e+1/3),this.g=a(i,r,e),this.b=a(i,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("v3d.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c,u=(c=n[1]).length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}t&&0<t.length&&(void 0!==(c=Rn[t])?this.setHex(c):console.warn("v3d.Color: Unknown color "+t));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=0<t?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(){function t(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),copyLinearToSRGB:function(){function t(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("v3d.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),l=(s+o)/2;if(s===o)n=t=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case r:t=(i-a)/c+(i<a?6:0);break;case i:t=(a-r)/c+2;break;case a:t=(r-i)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(Cn={},function(e,t,n){return this.getHSL(Cn),Cn.h+=e,Cn.s+=t,Cn.l+=n,this.setHSL(Cn.h,Cn.s,Cn.l),this}),add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:(En={h:0,s:0,l:0},Ln={h:0,s:0,l:0},function(e,t){this.getHSL(En),e.getHSL(Ln);var n=Yt.lerp(En.h,Ln.h,t),r=Yt.lerp(En.s,Ln.s,t),i=Yt.lerp(En.l,Ln.l,t);return this.setHSL(n,r,i),this}),equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}});var On,In,Dn={common:{diffuse:{value:new Fn(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Jt},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new qt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Fn(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Fn(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new Jt}},sprite:{diffuse:{value:new Fn(15658734)},opacity:{value:1},center:{value:new qt(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new Jt}},mask:{depthTexture:{value:null},cameraNearFar:{value:new qt(.5,.5)},textureMatrix:{value:new Qt}},node:{nodeRGB:{value:[]},nodeValue:{value:[]},flipCubeMap:{value:-1}}},Un={basic:{uniforms:Nn.merge([Dn.common,Dn.specularmap,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.fog]),vertexShader:Pn.meshbasic_vert,fragmentShader:Pn.meshbasic_frag},lambert:{uniforms:Nn.merge([Dn.common,Dn.specularmap,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.emissivemap,Dn.fog,Dn.lights,{emissive:{value:new Fn(0)}}]),vertexShader:Pn.meshlambert_vert,fragmentShader:Pn.meshlambert_frag},phong:{uniforms:Nn.merge([Dn.common,Dn.specularmap,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.emissivemap,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,Dn.gradientmap,Dn.fog,Dn.lights,{emissive:{value:new Fn(0)},specular:{value:new Fn(1118481)},shininess:{value:30}}]),vertexShader:Pn.meshphong_vert,fragmentShader:Pn.meshphong_frag},standard:{uniforms:Nn.merge([Dn.common,Dn.envmap,Dn.aomap,Dn.lightmap,Dn.emissivemap,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,Dn.roughnessmap,Dn.metalnessmap,Dn.fog,Dn.lights,{emissive:{value:new Fn(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},matcap:{uniforms:Nn.merge([Dn.common,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,Dn.fog,{matcap:{value:null}}]),vertexShader:Pn.meshmatcap_vert,fragmentShader:Pn.meshmatcap_frag},points:{uniforms:Nn.merge([Dn.points,Dn.fog]),vertexShader:Pn.points_vert,fragmentShader:Pn.points_frag},dashed:{uniforms:Nn.merge([Dn.common,Dn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pn.linedashed_vert,fragmentShader:Pn.linedashed_frag},depth:{uniforms:Nn.merge([Dn.common,Dn.displacementmap]),vertexShader:Pn.depth_vert,fragmentShader:Pn.depth_frag},normal:{uniforms:Nn.merge([Dn.common,Dn.bumpmap,Dn.normalmap,Dn.displacementmap,{opacity:{value:1}}]),vertexShader:Pn.normal_vert,fragmentShader:Pn.normal_frag},sprite:{uniforms:Nn.merge([Dn.sprite,Dn.fog]),vertexShader:Pn.sprite_vert,fragmentShader:Pn.sprite_frag},background:{uniforms:{t2D:{value:null}},vertexShader:Pn.background_vert,fragmentShader:Pn.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pn.cube_vert,fragmentShader:Pn.cube_frag},equirect:{uniforms:{tEquirect:{value:null},invertU:{value:!1},offsetU:{value:0}},vertexShader:Pn.equirect_vert,fragmentShader:Pn.equirect_frag},distanceRGBA:{uniforms:Nn.merge([Dn.common,Dn.displacementmap,{referencePosition:{value:new Kt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pn.distanceRGBA_vert,fragmentShader:Pn.distanceRGBA_frag},shadow:{uniforms:Nn.merge([Dn.lights,Dn.fog,{color:{value:new Fn(0)},opacity:{value:1}}]),vertexShader:Pn.shadow_vert,fragmentShader:Pn.shadow_frag},mask:{uniforms:Nn.merge([Dn.common,Dn.displacementmap,Dn.mask]),vertexShader:Pn.mask_vert,fragmentShader:Pn.mask_frag},equicube:{uniforms:{tEquirect:{value:null},faceIndex:{value:0},invertU:{value:!1},offsetU:{value:0}},vertexShader:Pn.equicube_vert,fragmentShader:Pn.equicube_frag},node:{uniforms:Nn.merge([Dn.common,Dn.displacementmap,Dn.envmap,Dn.fog,Dn.lights,Dn.node,{envMapIntensity:{value:1}}]),vertexShader:Pn.meshnode_vert,fragmentShader:Pn.meshnode_frag}};function Bn(){var n=null,r=!1,i=null;function a(e,t){!1!==r&&(i(e,t),n.requestAnimationFrame(a))}return{start:function(){!0!==r&&null!==i&&(n.requestAnimationFrame(a),r=!0)},stop:function(){r=!1},setAnimationLoop:function(e){i=e},setContext:function(e){n=e}}}function zn(l){var c=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),c.get(e)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var t=c.get(e);t&&(l.deleteBuffer(t.buffer),c.delete(e))},update:function(e,t){e.isInterleavedBufferAttribute&&(e=e.data);var n,r,i,a,o,s=c.get(e);void 0===s?c.set(e,function(e,t){var n=e.array,r=e.dynamic?l.DYNAMIC_DRAW:l.STATIC_DRAW,i=l.createBuffer();l.bindBuffer(t,i),l.bufferData(t,n,r),e.onUploadCallback();var a=l.FLOAT;return n instanceof Float32Array?a=l.FLOAT:n instanceof Float64Array?console.warn("v3d.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?a=l.UNSIGNED_SHORT:n instanceof Int16Array?a=l.SHORT:n instanceof Uint32Array?a=l.UNSIGNED_INT:n instanceof Int32Array?a=l.INT:n instanceof Int8Array?a=l.BYTE:n instanceof Uint8Array&&(a=l.UNSIGNED_BYTE),{buffer:i,type:a,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version}}(e,t)):s.version<e.version&&(n=s.buffer,i=t,a=(r=e).array,o=r.updateRange,l.bindBuffer(i,n),!1===r.dynamic?l.bufferData(i,a,l.STATIC_DRAW):-1===o.count?l.bufferSubData(i,0,a):0===o.count?console.error("v3d.WebGLObjects.updateBuffer: dynamic v3d.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(l.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),s.version=e.version)}}}function kn(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||kn.DefaultOrder}function Gn(){this.mask=1}function Vn(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}function jn(e){return void 0!==e}Un.physical={uniforms:Nn.merge([Un.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},Un.copy={defines:{MAP_TEXELS:0},uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_copy_frag},Un.bokeh={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:1},nearClip:{value:1},farClip:{value:1e3},depthLeakThreshold:{value:.2}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_bokeh_frag},Un.ssao={uniforms:{tDiffuse:{value:null},tDepth:{value:null},size:{value:new qt(512,512)},cameraNear:{value:1},cameraFar:{value:100},radius:{value:32},onlyAO:{value:0},aoClamp:{value:.25},lumInfluence:{value:.7}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_ssao_frag},Un.fxaa={uniforms:{tDiffuse:{value:null},resolution:{value:new qt(1/1024,1/512)}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_fxaa_frag},Un.grayscale={uniforms:{tDiffuse:{value:null}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_grayscale_frag},Un.brightness_contrast={uniforms:{tDiffuse:{value:null},brightness:{value:0},contrast:{value:0}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_brightness_contrast_frag},Un.outline_edge={uniforms:{maskTexture:{value:null},texSize:{value:new qt(.5,.5)},visibleEdgeColor:{value:new Kt(1,1,1)},hiddenEdgeColor:{value:new Kt(1,1,1)}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_outline_edge_frag},Un.outline_blur={defines:{MAX_RADIUS:4},uniforms:{colorTexture:{value:null},texSize:{value:new qt(.5,.5)},direction:{value:new qt(.5,.5)},kernelRadius:{value:1}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_outline_blur_frag},Un.outline_overlay={uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_outline_overlay_frag},Un.tonemap={uniforms:{tDiffuse:{value:null},exposure:{value:1}},vertexShader:Pn.pp_plane_vert,fragmentShader:Pn.pp_tonemap_frag},kn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],kn.DefaultOrder="XYZ",Object.defineProperties(kn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(kn.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=Yt.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a))):"ZYX"===t?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===t?(this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("v3d.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:(In=new Qt,function(e,t,n){return In.makeRotationFromQuaternion(e),this.setFromRotationMatrix(In,t,n)}),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(On=new Zt,function(e){return On.setFromEuler(this),this.setFromQuaternion(On,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Kt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Gn.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return 0!=(this.mask&e.mask)}});var Xn,Wn,Hn,Yn,qn,Qn,Zn,Kn,Jn,$n,er,tr,nr,rr,ir,ar,or,sr,lr,cr=0;function ur(){Object.defineProperty(this,"id",{value:cr++}),this.uuid=Yt.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ur.DefaultUp.clone();var e=new Kt,t=new kn,n=new Zt,r=new Kt(1,1,1);t.onChange(function(){n.setFromEuler(t,!1)}),n.onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Qt},normalMatrix:{value:new Jt}}),this.matrix=new Qt,this.matrixWorld=new Qt,this.matrixAutoUpdate=ur.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Gn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.constraints=[],this.disableChildRendering=!1}function hr(){ur.call(this),this.type="Camera",this.matrixWorldInverse=new Qt,this.projectionMatrix=new Qt,this.projectionMatrixInverse=new Qt,this.controls=null,this.viewportFit={type:Ht,initialAspect:1}}function dr(e,t,n,r,i,a){hr.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function pr(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new Kt,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new Fn,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}ur.DefaultUp=new Kt(0,1,0),ur.DefaultMatrixAutoUpdate=!0,ur.prototype=Object.assign(Object.create(t.prototype),{constructor:ur,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:(lr=new Zt,function(e,t){return lr.setFromAxisAngle(e,t),this.quaternion.multiply(lr),this}),rotateOnWorldAxis:(sr=new Zt,function(e,t){return sr.setFromAxisAngle(e,t),this.quaternion.premultiply(sr),this}),rotateX:(or=new Kt(1,0,0),function(e){return this.rotateOnAxis(or,e)}),rotateY:(ar=new Kt(0,1,0),function(e){return this.rotateOnAxis(ar,e)}),rotateZ:(ir=new Kt(0,0,1),function(e){return this.rotateOnAxis(ir,e)}),translateOnAxis:(rr=new Kt,function(e,t){return rr.copy(e).applyQuaternion(this.quaternion),this.position.add(rr.multiplyScalar(t)),this}),translateX:(nr=new Kt(1,0,0),function(e){return this.translateOnAxis(nr,e)}),translateY:(tr=new Kt(0,1,0),function(e){return this.translateOnAxis(tr,e)}),translateZ:(er=new Kt(0,0,1),function(e){return this.translateOnAxis(er,e)}),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:($n=new Qt,function(e){return e.applyMatrix4($n.getInverse(this.matrixWorld))}),lookAt:(Qn=new Zt,Zn=new Qt,Kn=new Kt,Jn=new Kt,function(e,t,n){e.isVector3?Kn.copy(e):Kn.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Jn.setFromMatrixPosition(this.matrixWorld),this.isCamera?Zn.lookAt(Jn,Kn,this.up):Zn.lookAt(Kn,Jn,this.up),this.quaternion.setFromRotationMatrix(Zn),r&&(Zn.extractRotation(r.matrixWorld),Qn.setFromRotationMatrix(Zn),this.quaternion.premultiply(Qn.inverse()))}),add:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("v3d.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("v3d.Object3D.add: object not an instance of v3d.Object3D.",e),this},remove:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(n,1)),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("v3d.Object3D: .getWorldPosition() target is now required"),e=new Kt),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(Yn=new Kt,qn=new Kt,function(e){return void 0===e&&(console.warn("v3d.Object3D: .getWorldQuaternion() target is now required"),e=new Zt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Yn,e,qn),e}),getWorldScale:(Wn=new Kt,Hn=new Zt,function(e){return void 0===e&&(console.warn("v3d.Object3D: .getWorldScale() target is now required"),e=new Kt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Wn,Hn,e),e}),getWorldDirection:function(e){void 0===e&&(console.warn("v3d.Object3D: .getWorldDirection() target is now required"),e=new Kt),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.updateConstraints(),this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(n){var e=void 0===n||"string"==typeof n,t={};e&&(n={geometries:{},materials:{},textures:{},images:{},shapes:{}},t.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,t){return void 0===e[t.uuid]&&(e[t.uuid]=t.toJSON(n)),t.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),!1===this.disableChildRendering&&(r.disableChildRendering=!1),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isMesh||this.isLine||this.isPoints){r.geometry=i(n.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];i(n.shapes,c)}else i(n.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,l=this.material.length;s<l;s++)u.push(i(n.materials,this.material[s]));r.material=u}else r.material=i(n.materials,this.material);if(0<this.children.length){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(n).object)}if(e){var h=m(n.geometries),d=m(n.materials),p=m(n.textures),f=m(n.images);o=m(n.shapes);0<h.length&&(t.geometries=h),0<d.length&&(t.materials=d),0<p.length&&(t.textures=p),0<f.length&&(t.images=f),0<o.length&&(t.shapes=o)}return t.object=r,t;function m(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.disableChildRendering=e.disableChildRendering,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this},copyTransform:(Xn=new Qt,function(e){this.matrix.copy(e.matrixWorld),this.parent&&this.matrix.multiplyMatrices(Xn.getInverse(this.parent.matrixWorld),this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)}),isVisible:function(){return this.visible},updateConstraints:function(){for(var e=0;e<this.constraints.length;e++)this.constraints[e].update(this)},getWorldPositionNU:function(e){return e.setFromMatrixPosition(this.matrixWorld)},findRoot:function(){var t=this;return this.traverseAncestors(function(e){t=e}),t}}),hr.prototype=Object.assign(Object.create(ur.prototype),{constructor:hr,isCamera:!0,copy:function(e,t){return ur.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),e.controls&&(this.controls.type=e.controls.type,this.controls.orbitMinDistance=e.controls.orbitMinDistance,this.controls.orbitMaxDistance=e.controls.orbitMaxDistance,this.controls.orbitTarget.copy(e.controls.orbitTarget)),this.viewportFit.type=e.viewportFit.type,this.viewportFit.initialAspect=e.viewportFit.initialAspect,this},getWorldDirection:function(e){void 0===e&&(console.warn("v3d.Camera: .getWorldDirection() target is now required"),e=new Kt),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){ur.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),dr.prototype=Object.assign(Object.create(hr.prototype),{constructor:dr,isOrthographicCamera:!0,copy:function(e,t){return hr.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var l=this.zoom/(this.view.width/this.view.fullWidth),c=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;a=(i+=u*(this.view.offsetX/l))+u*(this.view.width/l),s=(o-=h*(this.view.offsetY/c))-h*(this.view.height/c)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ur.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),Object.assign(pr.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var fr,mr,vr,gr,yr,xr,_r,br=0;function wr(){Object.defineProperty(this,"id",{value:br+=2}),this.uuid=Yt.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ar(e,t,n){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Mr(e,t,n){Ar.call(this,new Int8Array(e),t,n)}function Tr(e,t,n){Ar.call(this,new Uint8Array(e),t,n)}function Sr(e,t,n){Ar.call(this,new Uint8ClampedArray(e),t,n)}function Er(e,t,n){Ar.call(this,new Int16Array(e),t,n)}function Lr(e,t,n){Ar.call(this,new Uint16Array(e),t,n)}function Cr(e,t,n){Ar.call(this,new Int32Array(e),t,n)}function Pr(e,t,n){Ar.call(this,new Uint32Array(e),t,n)}function Nr(e,t,n){Ar.call(this,new Float32Array(e),t,n)}function Rr(e,t,n){Ar.call(this,new Float64Array(e),t,n)}function Fr(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}wr.prototype=Object.assign(Object.create(t.prototype),{constructor:wr,isGeometry:!0,applyMatrix:function(e){for(var t=(new Jt).getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(e)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:(_r=new Qt,function(e){return _r.makeRotationX(e),this.applyMatrix(_r),this}),rotateY:(xr=new Qt,function(e){return xr.makeRotationY(e),this.applyMatrix(xr),this}),rotateZ:(yr=new Qt,function(e){return yr.makeRotationZ(e),this.applyMatrix(yr),this}),translate:(gr=new Qt,function(e,t,n){return gr.makeTranslation(e,t,n),this.applyMatrix(gr),this}),scale:(vr=new Qt,function(e,t,n){return vr.makeScale(e,t,n),this.applyMatrix(vr),this}),lookAt:(mr=new ur,function(e){mr.lookAt(e),mr.updateMatrix(),this.applyMatrix(mr.matrix)}),fromBufferGeometry:function(e){var o=this,t=null!==e.index?e.index.array:void 0,n=e.attributes,r=n.position.array,s=void 0!==n.normal?n.normal.array:void 0,l=void 0!==n.color?n.color.array:void 0,c=void 0!==n.uv?n.uv.array:void 0,u=void 0!==n.uv2?n.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var i=0,a=0;i<r.length;i+=3,a+=2)o.vertices.push((new Kt).fromArray(r,i)),void 0!==l&&o.colors.push((new Fn).fromArray(l,i));function h(e,t,n,r){var i=void 0===l?[]:[o.colors[e].clone(),o.colors[t].clone(),o.colors[n].clone()],a=new pr(e,t,n,void 0===s?[]:[(new Kt).fromArray(s,3*e),(new Kt).fromArray(s,3*t),(new Kt).fromArray(s,3*n)],i,r);o.faces.push(a),void 0!==c&&o.faceVertexUvs[0].push([(new qt).fromArray(c,2*e),(new qt).fromArray(c,2*t),(new qt).fromArray(c,2*n)]),void 0!==u&&o.faceVertexUvs[1].push([(new qt).fromArray(u,2*e),(new qt).fromArray(u,2*t),(new qt).fromArray(u,2*n)])}var d=e.groups;if(0<d.length)for(i=0;i<d.length;i++)for(var p=d[i],f=p.start,m=(a=f,f+p.count);a<m;a+=3)void 0!==t?h(t[a],t[a+1],t[a+2],p.materialIndex):h(a,a+1,a+2,p.materialIndex);else if(void 0!==t)for(i=0;i<t.length;i+=3)h(t[i],t[i+1],t[i+2]);else for(i=0;i<r.length/3;i+=3)h(i,i+1,i+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:(fr=new Kt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(fr).negate(),this.translate(fr.x,fr.y,fr.z),this}),normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new Qt;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new Kt,t=new Kt,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,n,r,i,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new Kt;if(e){var s,l,c,u=new Kt,h=new Kt;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],u.subVectors(c,l),h.subVectors(s,l),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){var d=(a=this.faces[r]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var r=(n=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new wr;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)l=new Kt,c={a:new Kt,b:new Kt,c:new Kt},o.push(l),s.push(c)}var l,c,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],l=u.faceNormals[n],c=u.vertexNormals[n],l.copy(i.normal),c.a.copy(i.vertexNormals[0]),c.b.copy(i.vertexNormals[1]),c.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new An),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Mn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.faceVertexUvs[0],u=e.faceVertexUvs[0],h=this.colors,d=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new Jt).getNormalMatrix(t));for(var p=0,f=o.length;p<f;p++){var m=o[p].clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(p=0,f=d.length;p<f;p++)h.push(d[p].clone());for(p=0,f=l.length;p<f;p++){var v,g,y,x=l[p],_=x.vertexNormals,b=x.vertexColors;(v=new pr(x.a+i,x.b+i,x.c+i)).normal.copy(x.normal),void 0!==r&&v.normal.applyMatrix3(r).normalize();for(var w=0,A=_.length;w<A;w++)g=_[w].clone(),void 0!==r&&g.applyMatrix3(r).normalize(),v.vertexNormals.push(g);v.color.copy(x.color);for(w=0,A=b.length;w<A;w++)y=b[w],v.vertexColors.push(y.clone());v.materialIndex=x.materialIndex+n,s.push(v)}for(p=0,f=u.length;p<f;p++){var M=u[p],T=[];if(void 0!==M){for(w=0,A=M.length;w<A;w++)T.push(M[w].clone());c.push(T)}}}else console.error("v3d.Geometry.merge(): geometry not an instance of v3d.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("v3d.Geometry.mergeMesh(): mesh not an instance of v3d.Mesh.",e)},mergeVertices:function(){var e,t,n,r,i,a,o,s,l={},c=[],u=[],h=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)e=this.vertices[n],void 0===l[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(l[t]=n,c.push(this.vertices[n]),u[n]=c.length-1):u[n]=u[l[t]];var d=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=u[i.a],i.b=u[i.b],i.c=u[i.c],a=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;0<=n;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new Kt(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var r,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(i=[]);for(n=0;n<t;n++){var s=e[n]._id;r&&r.push(a[s]),i&&i.push(o[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}var o=[],s=[],l={},c=[],u={},h=[],d={};for(i=0;i<this.faces.length;i++){var p=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=0<p.normal.length(),v=0<p.vertexNormals.length,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=0<p.vertexColors.length,x=0;if(x=A(x=A(x=A(x=A(x=A(x=A(x=A(x=A(x,0,0),1,!0),2,!1),3,f),4,m),5,v),6,g),7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var _=this.faceVertexUvs[0][i];o.push(S(_[0]),S(_[1]),S(_[2]))}if(m&&o.push(M(p.normal)),v){var b=p.vertexNormals;o.push(M(b[0]),M(b[1]),M(b[2]))}if(g&&o.push(T(p.color)),y){var w=p.vertexColors;o.push(T(w[0]),T(w[1]),T(w[2]))}}function A(e,t,n){return n?e|1<<t:e&~(1<<t)}function M(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]||(u[t]=c.length,c.push(e.getHex())),u[t]}function S(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=h.length/2,h.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=r,e.data.normals=s,0<c.length&&(e.data.colors=c),0<h.length&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new wr).copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var h=u[r],d=[];for(a=0,o=h.length;a<o;a++){var p=h[a];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],r=0,i=f[t].vertices.length;r<i;r++)m.vertices.push(f[t].vertices[r].clone());if(void 0!==f[t].normals)for(m.normals=[],r=0,i=f[t].normals.length;r<i;r++)m.normals.push(f[t].normals[r].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],r=0,i=v[t].vertexNormals.length;r<i;r++){var y=v[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],r=0,i=v[t].faceNormals.length;r<i;r++)g.faceNormals.push(v[t].faceNormals[r].clone());this.morphNormals.push(g)}var _=e.skinWeights;for(t=0,n=_.length;t<n;t++)this.skinWeights.push(_[t].clone());var b=e.skinIndices;for(t=0,n=b.length;t<n;t++)this.skinIndices.push(b[t].clone());var w=e.lineDistances;for(t=0,n=w.length;t<n;t++)this.lineDistances.push(w[t]);var A=e.boundingBox;null!==A&&(this.boundingBox=A.clone());var M=e.boundingSphere;return null!==M&&(this.boundingSphere=M.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Ar.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Ar.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Fn),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new qt),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Kt),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("v3d.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new xn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(Mr.prototype=Object.create(Ar.prototype)).constructor=Mr,(Tr.prototype=Object.create(Ar.prototype)).constructor=Tr,(Sr.prototype=Object.create(Ar.prototype)).constructor=Sr,(Er.prototype=Object.create(Ar.prototype)).constructor=Er,(Lr.prototype=Object.create(Ar.prototype)).constructor=Lr,(Cr.prototype=Object.create(Ar.prototype)).constructor=Cr,(Pr.prototype=Object.create(Ar.prototype)).constructor=Pr,(Nr.prototype=Object.create(Ar.prototype)).constructor=Nr,(Rr.prototype=Object.create(Ar.prototype)).constructor=Rr,Object.assign(Fr.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,i=e.faceVertexUvs,a=i[0]&&0<i[0].length,o=i[1]&&0<i[1].length,s=e.morphTargets,l=s.length;if(0<l){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(0<d){u=[];for(c=0;c<d;c++)u[c]={name:h[c].name,data:[]};this.morphTargets.normal=u}var p=e.skinIndices,f=e.skinWeights,m=p.length===r.length,v=f.length===r.length;0<r.length&&0===n.length&&console.error("v3d.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<n.length;c++){var g=n[c];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var _,b=g.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=g.color;this.colors.push(w,w,w)}if(!0===a)void 0!==(_=i[0][c])?this.uvs.push(_[0],_[1],_[2]):(console.warn("v3d.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new qt,new qt,new qt));if(!0===o)void 0!==(_=i[1][c])?this.uvs2.push(_[0],_[1],_[2]):(console.warn("v3d.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new qt,new qt,new qt));for(var A=0;A<l;A++){var M=s[A].vertices;t[A].data.push(M[g.a],M[g.b],M[g.c])}for(A=0;A<d;A++){var T=h[A].vertexNormals[c];u[A].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(p[g.a],p[g.b],p[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}});var Or,Ir,Dr,Ur,Br,zr,kr,Gr,Vr,jr,Xr=1;function Wr(){Object.defineProperty(this,"id",{value:Xr+=2}),this.uuid=Yt.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function Hr(e,t,n,r,i,a){wr.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new Yr(e,t,n,r,i,a)),this.mergeVertices()}function Yr(e,t,n,r,i,a){Wr.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};var C=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var P=[],N=[],R=[],F=[],O=0,I=0;function o(e,t,n,r,i,a,o,s,l,c,u){var h,d,p=a/l,f=o/c,m=a/2,v=o/2,g=s/2,y=l+1,x=c+1,_=0,b=0,w=new Kt;for(d=0;d<x;d++){var A=d*f-v;for(h=0;h<y;h++){var M=h*p-m;w[e]=M*r,w[t]=A*i,w[n]=g,N.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[n]=0<s?1:-1,R.push(w.x,w.y,w.z),F.push(h/l),F.push(1-d/c),_+=1}}for(d=0;d<c;d++)for(h=0;h<l;h++){var T=O+h+y*d,S=O+h+y*(d+1),E=O+(h+1)+y*(d+1),L=O+(h+1)+y*d;P.push(T,S,L),P.push(S,E,L),b+=6}C.addGroup(I,b,u),I+=b,O+=_}o("z","y","x",-1,-1,n,t,e,a,i,0),o("z","y","x",1,-1,n,t,-e,a,i,1),o("x","z","y",1,1,e,n,t,r,a,2),o("x","z","y",1,-1,e,n,-t,r,a,3),o("x","y","z",1,-1,e,t,n,r,i,4),o("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(P),this.addAttribute("position",new Nr(N,3)),this.addAttribute("normal",new Nr(R,3)),this.addAttribute("uv",new Nr(F,2))}function qr(e,t,n,r){wr.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Qr(e,t,n,r)),this.mergeVertices()}function Qr(e,t,n,r){Wr.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var i,a,o=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(n)||1,c=Math.floor(r)||1,u=l+1,h=c+1,d=e/l,p=t/c,f=[],m=[],v=[],g=[];for(a=0;a<h;a++){var y=a*p-s;for(i=0;i<u;i++){var x=i*d-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/l),g.push(1-a/c)}}for(a=0;a<c;a++)for(i=0;i<l;i++){var _=i+u*a,b=i+u*(a+1),w=i+1+u*(a+1),A=i+1+u*a;f.push(_,b,A),f.push(b,w,A)}this.setIndex(f),this.addAttribute("position",new Nr(m,3)),this.addAttribute("normal",new Nr(v,3)),this.addAttribute("uv",new Nr(g,2))}Wr.prototype=Object.assign(Object.create(t.prototype),{constructor:Wr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(65535<Vn(e)?Pr:Lr)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?("index"===e?(console.warn("v3d.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t)):this.attributes[e]=t,this):(console.warn("v3d.BufferGeometry: .addAttribute() now expects (name, attribute)."),this.addAttribute(e,new Ar(t,arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new Jt).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:(jr=new Qt,function(e){return jr.makeRotationX(e),this.applyMatrix(jr),this}),rotateY:(Vr=new Qt,function(e){return Vr.makeRotationY(e),this.applyMatrix(Vr),this}),rotateZ:(Gr=new Qt,function(e){return Gr.makeRotationZ(e),this.applyMatrix(Gr),this}),translate:(kr=new Qt,function(e,t,n){return kr.makeTranslation(e,t,n),this.applyMatrix(kr),this}),scale:(zr=new Qt,function(e,t,n){return zr.makeScale(e,t,n),this.applyMatrix(zr),this}),lookAt:(Br=new ur,function(e){Br.lookAt(e),Br.updateMatrix(),this.applyMatrix(Br.matrix)}),center:(Ur=new Kt,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ur).negate(),this.translate(Ur.x,Ur.y,Ur.z),this}),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Nr(3*t.vertices.length,3),r=new Nr(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Nr(t.lineDistances.length,1);this.addAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.addAttribute("position",new Nr(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Fr).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new Ar(t,3).copyVector3sArray(e.vertices)),0<e.normals.length){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Ar(n,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new Ar(r,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var i=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Ar(i,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Ar(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,u=l.length;c<u;c++){var h=l[c],d=new Nr(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(0<e.skinIndices.length){var p=new Nr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var f=new Nr(4*e.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new An);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('v3d.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:(Ir=new An,Dr=new Kt,function(){null===this.boundingSphere&&(this.boundingSphere=new Mn);var e=this.attributes.position;if(e){var t=this.boundingSphere.center;Ir.setFromBufferAttribute(e),Ir.getCenter(t);for(var n=0,r=0,i=e.count;r<i;r++)Dr.x=e.getX(r),Dr.y=e.getY(r),Dr.z=e.getZ(r),n=Math.max(n,t.distanceToSquared(Dr));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('v3d.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new Ar(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o,s,l,c=t.normal.array,u=new Kt,h=new Kt,d=new Kt,p=new Kt,f=new Kt;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],l=3*m[i+2],u.fromArray(n,o),h.fromArray(n,s),d.fromArray(n,l),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),c[o]+=p.x,c[o+1]+=p.y,c[o+2]+=p.z,c[s]+=p.x,c[s+1]+=p.y,c[s+2]+=p.z,c[l]+=p.x,c[l+1]+=p.y,c[l+2]+=p.z}else for(i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),d.fromArray(n,i+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),c[i]=p.x,c[i+1]=p.y,c[i+2]=p.z,c[i+3]=p.x,c[i+4]=p.y,c[i+5]=p.z,c[i+6]=p.x,c[i+7]=p.y,c[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("v3d.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==e.attributes[r])for(var i=n[r].array,a=e.attributes[r],o=a.array,s=0,l=a.itemSize*t;s<o.length;s++,l++)i[l]=o[s];return this}console.error("v3d.BufferGeometry.merge(): geometry not an instance of v3d.BufferGeometry.",e)},normalizeNormals:(Or=new Kt,function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Or.x=e.getX(t),Or.y=e.getY(t),Or.z=e.getZ(t),Or.normalize(),e.setXYZ(t,Or.x,Or.y,Or.z)}),toNonIndexed:function(){if(null===this.index)return console.warn("v3d.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Wr,t=this.index.array,n=this.attributes;for(var r in n){for(var i=n[r],a=i.array,o=i.itemSize,s=new a.constructor(t.length*o),l=0,c=0,u=0,h=t.length;u<h;u++){l=t[u]*o;for(var d=0;d<o;d++)s[c++]=a[l++]}e.addAttribute(r,new Ar(s,o))}var p=this.groups;for(u=0,h=p.length;u<h;u++){var f=p[u];e.addGroup(f.start,f.count,f.materialIndex)}return e},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;if(null!==r){var i=Array.prototype.slice.call(r.array);e.data.index={type:r.array.constructor.name,array:i}}var a=this.attributes;for(var n in a){var o=a[n];i=Array.prototype.slice.call(o.array);e.data.attributes[n]={itemSize:o.itemSize,type:o.array.constructor.name,array:i,normalized:o.normalized}}var s=this.groups;0<s.length&&(e.data.groups=JSON.parse(JSON.stringify(s)));var l=this.boundingSphere;return null!==l&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e},clone:function(){return(new Wr).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,r=c.length;n<r;n++)l.push(c[n].clone());this.morphAttributes[t]=l}var u=e.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),(Hr.prototype=Object.create(wr.prototype)).constructor=Hr,(Yr.prototype=Object.create(Wr.prototype)).constructor=Yr,(qr.prototype=Object.create(wr.prototype)).constructor=qr,(Qr.prototype=Object.create(Wr.prototype)).constructor=Qr;var Zr,Kr,Jr,$r,ei,ti,ni,ri,ii,ai,oi,si,li,ci,ui,hi,di,pi,fi,mi,vi,gi,yi,xi,_i,bi=0;function wi(){Object.defineProperty(this,"id",{value:bi++}),this.uuid=Yt.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Z,this.side=I,this.flatShading=!1,this.vertexColors=A,this.opacity=1,this.transparent=!1,this.blendSrc=F,this.blendDst=O,this.blendEquation=te,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=oe,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.userData={},this.needsUpdate=!0,this.receiveShadow=!1,this.castShadow=!1}function Ai(e){wi.call(this),this.type="MeshBasicMaterial",this.color=new Fn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function Mi(e){wi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("v3d.ShaderMaterial: attributes should now be defined in v3d.BufferGeometry instead."),this.setValues(e))}function Ti(e,t){this.origin=void 0!==e?e:new Kt,this.direction=void 0!==t?t:new Kt}function Si(e,t,n){this.a=void 0!==e?e:new Kt,this.b=void 0!==t?t:new Kt,this.c=void 0!==n?n:new Kt}function Ei(e,t){ur.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Wr,this.material=void 0!==t?t:new Ai({color:16777215*Math.random()}),this.drawMode=Pt,this.updateMorphTargets(),this.isMaterialGeneratedMesh=!1}function Li(u,n,h,r){var d,p,f,m,v=new Fn(0),g=0;function y(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return v},setClearColor:function(e,t){v.set(e),y(v,g=void 0!==t?t:1)},getClearAlpha:function(){return g},setClearAlpha:function(e){y(v,g=e)},render:function(e,t,n,r){var i=t.background&&t.background.isSceneBackground,a=i?t.background.data:t.background;if(null===a?y(v,g):a&&a.isColor&&(y(a,1),r=!0),(u.autoClear||r)&&u.clear(u.autoClearColor,u.autoClearDepth,u.autoClearStencil),a&&(a.isCubeTexture||a.isWebGLRenderTargetCube)){void 0===f&&((f=new Ei(new Yr(1,1,1),new Mi({type:"WebGLBackground",uniforms:Nn.clone(Un.cube.uniforms),vertexShader:Un.cube.vertexShader,fragmentShader:Un.cube.fragmentShader,side:Me,depthTest:!0,depthWrite:!1,fog:!1,polygonOffset:!0,defines:{BACKGROUND_DEPTH:""}}))).geometry.removeAttribute("normal"),f.geometry.removeAttribute("uv"),f.onBeforeRender=function(e,t,n){var r=n.far;this.matrixWorld.makeScale(r,r,r),this.matrixWorld.copyPosition(n.matrixWorld)},h.update(f));var o=a.isCubeTexture?a:a.texture;f.material.uniforms.tCube.value=o;var s=a.isCubeTexture?-1:1;f.material.uniforms.tFlip.value=s,e.push(f,f.geometry,f.material,0,null)}else if(a&&a.isTexture)if(a.mapping===ge){var l=!!i&&t.background.equirecInvertU,c=i?t.background.equirecOffsetU:0;void 0===m&&((m=new Ei(new Yr(1,1,1),new Mi({vertexShader:Un.equirect.vertexShader,fragmentShader:Un.equirect.fragmentShader,uniforms:Un.equirect.uniforms,side:Me,depthWrite:!1,polygonOffset:!0,defines:{BACKGROUND_DEPTH:""}}))).geometry.removeAttribute("normal"),m.geometry.removeAttribute("uv"),m.onBeforeRender=function(e,t,n){var r=n.far;this.matrixWorld.makeScale(r,r,r),this.matrixWorld.copyPosition(n.matrixWorld)},h.update(m)),m.material.uniforms.invertU.value=l,m.material.uniforms.offsetU.value=c,m.material.uniforms.tEquirect.value=a,e.push(m,m.geometry,m.material,0,null)}else void 0===d&&(d=new dr(-1,1,1,-1,0,1),p=new Ei(new Qr(2,2),new Ai({depthTest:!1,depthWrite:!1,fog:!1})),h.update(p)),p.material.map=a,u.renderBufferDirect(d,null,p.geometry,p.material,p,null)}}}function Ci(i,a,o,s){var l;this.setMode=function(e){l=e},this.render=function(e,t){i.drawArrays(l,e,t),o.update(t,l)},this.renderInstances=function(e,t,n){var r;if(s.isWebGL2)r=i;else if(null===(r=a.get("ANGLE_instanced_arrays")))return void console.error("v3d.WebGLBufferRenderer: using v3d.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[s.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](l,t,n,e.maxInstancedCount),o.update(n,l,e.maxInstancedCount)}}function Pi(t,n,e){var r;function i(e){if("highp"===e){if(0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision)return"highp";e="mediump"}return"mediump"===e&&0<t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision&&0<t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,o=void 0!==e.precision?e.precision:"highp",s=i(o);s!==o&&(console.warn("v3d.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===e.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=0<u,y=a||!!n.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var e=n.get("EXT_texture_filter_anisotropic");return r=null!==e?t.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function Ni(){var u=this,h=null,d=0,p=!1,f=!1,m=new Tn,v=new Jt,g={value:null,needsUpdate:!1};function y(){g.value!==h&&(g.value=h,g.needsUpdate=0<d),u.numPlanes=d,u.numIntersection=0}function x(e,t,n,r){var i=null!==e?e.length:0,a=null;if(0!==i){if(a=g.value,!0!==r||null===a){var o=n+4*i,s=t.matrixWorldInverse;v.getNormalMatrix(s),(null===a||a.length<o)&&(a=new Float32Array(o));for(var l=0,c=n;l!==i;++l,c+=4)m.copy(e[l]).applyMatrix4(s,v),m.normal.toArray(a,c),a[c+3]=m.constant}g.value=a,g.needsUpdate=!0}return u.numPlanes=i,a}this.uniform=g,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,n){var r=0!==e.length||t||0!==d||p;return p=t,h=x(e,n,0),d=e.length,r},this.beginShadows=function(){f=!0,x(null)},this.endShadows=function(){f=!1,y()},this.setState=function(e,t,n,r,i,a){if(!p||null===e||0===e.length||f&&!n)f?x(null):y();else{var o=f?0:d,s=4*o,l=i.clippingState||null;g.value=l,l=x(e,r,s,a);for(var c=0;c!==s;++c)l[c]=h[c];i.clippingState=l,this.numIntersection=t?this.numPlanes:0,this.numPlanes+=o}}}function Ri(n){var r={};return{get:function(e){if(void 0!==r[e])return r[e];var t;switch(e){case"WEBGL_depth_texture":t=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":t=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":t=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":t=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:t=n.getExtension(e)}return null===t&&console.warn("v3d.WebGLRenderer: "+e+" extension not supported."),r[e]=t}}}function Fi(h,d,a){var o={},p={};function s(e){var t=e.target,n=o[t.id];for(var r in null!==n.index&&d.remove(n.index),n.attributes)d.remove(n.attributes[r]);t.removeEventListener("dispose",s),delete o[t.id];var i=p[n.id];i&&(d.remove(i),delete p[n.id]),a.memory.geometries--}return{get:function(e,t){var n=o[t.id];return n||(t.addEventListener("dispose",s),t.isBufferGeometry?n=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Wr).setFromObject(e)),n=t._bufferGeometry),o[t.id]=n,a.memory.geometries++,n)},update:function(e){var t=e.index,n=e.attributes;for(var r in null!==t&&d.update(t,h.ELEMENT_ARRAY_BUFFER),n)d.update(n[r],h.ARRAY_BUFFER);var i=e.morphAttributes;for(var r in i)for(var a=i[r],o=0,s=a.length;o<s;o++)d.update(a[o],h.ARRAY_BUFFER)},getWireframeAttribute:function(e){var t=p[e.id];if(t)return t;var n,r=[],i=e.index,a=e.attributes;if(null!==i)for(var o=0,s=(n=i.array).length;o<s;o+=3){var l=n[o+0],c=n[o+1],u=n[o+2];r.push(l,c,c,u,u,l)}else for(o=0,s=(n=a.position.array).length/3-1;o<s;o+=3)l=o+0,c=o+1,u=o+2,r.push(l,c,c,u,u,l);return t=new(65535<Vn(r)?Pr:Lr)(r,1),d.update(t,h.ELEMENT_ARRAY_BUFFER),p[e.id]=t}}}function Oi(i,a,o,s){var l,c,u;this.setMode=function(e){l=e},this.setIndex=function(e){c=e.type,u=e.bytesPerElement},this.render=function(e,t){i.drawElements(l,t,c,e*u),o.update(t,l)},this.renderInstances=function(e,t,n){var r;if(s.isWebGL2)r=i;else if(null===(r=a.get("ANGLE_instanced_arrays")))return void console.error("v3d.WebGLIndexedBufferRenderer: using v3d.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");r[s.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](l,n,c,t*u,e.maxInstancedCount),o.update(n,l,e.maxInstancedCount)}}function Ii(r){var i={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:i,programs:null,autoReset:!0,reset:function(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0},update:function(e,t,n){switch(n=n||1,i.calls++,t){case r.TRIANGLES:i.triangles+=n*(e/3);break;case r.TRIANGLE_STRIP:case r.TRIANGLE_FAN:i.triangles+=n*(e-2);break;case r.LINES:i.lines+=n*(e/2);break;case r.LINE_STRIP:i.lines+=n*(e-1);break;case r.LINE_LOOP:i.lines+=n*e;break;case r.POINTS:i.points+=n*e;break;default:console.error("v3d.WebGLInfo: Unknown draw mode:",t)}}}}function Di(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ui(p){var f={},m=new Float32Array(8);return{update:function(e,t,n,r){var i=e.morphTargetInfluences,a=i.length,o=f[t.id];if(void 0===o){o=[];for(var s=0;s<a;s++)o[s]=[s,0];f[t.id]=o}var l=n.morphTargets&&t.morphAttributes.position,c=n.morphNormals&&t.morphAttributes.normal;for(s=0;s<a;s++)0!==(u=o[s])[1]&&(l&&t.removeAttribute("morphTarget"+s),c&&t.removeAttribute("morphNormal"+s));for(s=0;s<a;s++)(u=o[s])[0]=s,u[1]=i[s];for(o.sort(Di),s=0;s<8;s++){var u;if(u=o[s]){var h=u[0],d=u[1];if(d){l&&t.addAttribute("morphTarget"+s,l[h]),c&&t.addAttribute("morphNormal"+s,c[h]),m[s]=d;continue}}m[s]=0}r.getUniforms().setValue(p,"morphTargetInfluences",m)}}}function Bi(i,a){var o={};return{update:function(e){var t=a.render.frame,n=e.geometry,r=i.get(e,n);return o[r.id]!==t&&(n.isGeometry&&r.updateFromObject(e),i.update(r),o[r.id]=t),r},dispose:function(){o={}}}}function zi(e,t,n,r,i,a,o,s,l,c){yn.call(this,e=void 0!==e?e:[],t=void 0!==t?t:me,n,r,i,a,o,s,l,c),this.flipY=!1}function ki(e,t,n,r){yn.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=Le,this.minFilter=Le,this.generateMipmaps=!1,this.flipY=!1}wi.prototype=Object.assign(Object.create(t.prototype),{constructor:wi,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("v3d."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("v3d.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Z&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==I&&(n.side=this.side),this.vertexColors!==A&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);0<i.length&&(n.textures=i),0<a.length&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this.receiveShadow=e.receiveShadow,this.castShadow=e.castShadow,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),((Ai.prototype=Object.create(wi.prototype)).constructor=Ai).prototype.isMeshBasicMaterial=!0,Ai.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},((Mi.prototype=Object.create(wi.prototype)).constructor=Mi).prototype.isShaderMaterial=!0,Mi.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nn.clone(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},Mi.prototype.toJSON=function(e){var t=wi.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}return 0<Object.keys(this.defines).length&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},Object.assign(Ti.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("v3d.Ray: .at() target is now required"),t=new Kt),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:(oi=new Kt,function(e){return this.origin.copy(this.at(e,oi)),this}),closestPointToPoint:function(e,t){void 0===t&&(console.warn("v3d.Ray: .closestPointToPoint() target is now required"),t=new Kt),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:(ai=new Kt,function(e){var t=ai.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ai.copy(this.direction).multiplyScalar(t).add(this.origin),ai.distanceToSquared(e))}),distanceSqToSegment:(ni=new Kt,ri=new Kt,ii=new Kt,function(e,t,n,r){ni.copy(e).add(t).multiplyScalar(.5),ri.copy(t).sub(e).normalize(),ii.copy(this.origin).sub(ni);var i,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(ri),u=ii.dot(this.direction),h=-ii.dot(ri),d=ii.lengthSq(),p=Math.abs(1-c*c);if(0<p)if(a=c*u-h,s=l*p,0<=(i=c*h-u))if(-s<=a)if(a<=s){var f=1/p;o=(i*=f)*(i+c*(a*=f)+2*u)+a*(c*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else o=a<=-s?-(i=Math.max(0,-(-c*l+u)))*i+(a=0<i?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):-(i=Math.max(0,-(c*l+u)))*i+(a=0<i?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=0<c?-l:l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(ri).multiplyScalar(a).add(ni),o}),intersectSphere:(ti=new Kt,function(e,t){ti.subVectors(e.center,this.origin);var n=ti.dot(this.direction),r=ti.dot(ti)-n*n,i=e.radius*e.radius;if(i<r)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=n?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return r=0<=l?(n=(e.min.x-h.x)*l,(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,(e.min.x-h.x)*l),(a=0<=c?(i=(e.min.y-h.y)*c,(e.max.y-h.y)*c):(i=(e.max.y-h.y)*c,(e.min.y-h.y)*c))<n||r<i?null:((n<i||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),(s=0<=u?(o=(e.min.z-h.z)*u,(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,(e.min.z-h.z)*u))<n||r<o?null:((n<o||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(0<=n?n:r,t)))},intersectsBox:(ei=new Kt,function(e){return null!==this.intersectBox(e,ei)}),intersectTriangle:(Zr=new Kt,Kr=new Kt,Jr=new Kt,$r=new Kt,function(e,t,n,r,i){Kr.subVectors(t,e),Jr.subVectors(n,e),$r.crossVectors(Kr,Jr);var a,o=this.direction.dot($r);if(0<o){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Zr.subVectors(this.origin,e);var s=a*this.direction.dot(Jr.crossVectors(Zr,Jr));if(s<0)return null;var l=a*this.direction.dot(Kr.cross(Zr));if(l<0)return null;if(o<s+l)return null;var c=-a*Zr.dot($r);return c<0?null:this.at(c/o,i)}),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(Si,{getNormal:(di=new Kt,function(e,t,n,r){void 0===r&&(console.warn("v3d.Triangle: .getNormal() target is now required"),r=new Kt),r.subVectors(n,t),di.subVectors(e,t),r.cross(di);var i=r.lengthSq();return 0<i?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}),getBarycoord:(ci=new Kt,ui=new Kt,hi=new Kt,function(e,t,n,r,i){ci.subVectors(r,t),ui.subVectors(n,t),hi.subVectors(e,t);var a=ci.dot(ci),o=ci.dot(ui),s=ci.dot(hi),l=ui.dot(ui),c=ui.dot(hi),u=a*l-o*o;if(void 0===i&&(console.warn("v3d.Triangle: .getBarycoord() target is now required"),i=new Kt),0===u)return i.set(-2,-1,-1);var h=1/u,d=(l*s-o*c)*h,p=(a*c-o*s)*h;return i.set(1-d-p,p,d)}),containsPoint:(li=new Kt,function(e,t,n,r){return Si.getBarycoord(e,t,n,r,li),0<=li.x&&0<=li.y&&li.x+li.y<=1}),getUV:(si=new Kt,function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,si),s.set(0,0),s.addScaledVector(i,si.x),s.addScaledVector(a,si.y),s.addScaledVector(o,si.z),s})}),Object.assign(Si.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:(xi=new Kt,_i=new Kt,function(){return xi.subVectors(this.c,this.b),_i.subVectors(this.a,this.b),.5*xi.cross(_i).length()}),getMidpoint:function(e){return void 0===e&&(console.warn("v3d.Triangle: .getMidpoint() target is now required"),e=new Kt),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Si.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("v3d.Triangle: .getPlane() target is now required"),e=new Kt),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Si.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Si.containsPoint(e,this.a,this.b,this.c)},getUV:function(e,t,n,r,i){return Si.getUV(e,this.a,this.b,this.c,t,n,r,i)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:(pi=new Kt,fi=new Kt,mi=new Kt,vi=new Kt,gi=new Kt,yi=new Kt,function(e,t){void 0===t&&(console.warn("v3d.Triangle: .closestPointToPoint() target is now required"),t=new Kt);var n,r,i=this.a,a=this.b,o=this.c;pi.subVectors(a,i),fi.subVectors(o,i),vi.subVectors(e,i);var s=pi.dot(vi),l=fi.dot(vi);if(s<=0&&l<=0)return t.copy(i);gi.subVectors(e,a);var c=pi.dot(gi),u=fi.dot(gi);if(0<=c&&u<=c)return t.copy(a);var h=s*u-c*l;if(h<=0&&0<=s&&c<=0)return n=s/(s-c),t.copy(i).addScaledVector(pi,n);yi.subVectors(e,o);var d=pi.dot(yi),p=fi.dot(yi);if(0<=p&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&0<=l&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(fi,r);var m=c*p-d*u;if(m<=0&&0<=u-c&&0<=d-p)return mi.subVectors(o,a),r=(u-c)/(u-c+(d-p)),t.copy(a).addScaledVector(mi,r);var v=1/(m+f+h);return n=f*v,r=h*v,t.copy(i).addScaledVector(pi,n).addScaledVector(fi,r)}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),Ei.prototype=Object.assign(Object.create(ur.prototype),{constructor:Ei,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return ur.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.isMaterialGeneratedMesh=e.isMaterialGeneratedMesh,this},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(0<a.length){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;if(void 0!==s&&0<s.length)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=s.length;e<t;e++)n=s[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}},raycast:function(){var k=new Qt,G=new Ti,V=new Mn,j=new Kt,X=new Kt,W=new Kt,H=new Kt,Y=new Kt,q=new Kt,Q=new qt,Z=new qt,K=new qt,J=new Kt,$=new Kt;function ee(e,t,n,r,i,a,o,s){if(null===(t.side===Me?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==ne,s)))return null;$.copy(s),$.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo($);return l<n.near||l>n.far?null:{distance:l,point:$.clone(),object:e}}function te(e,t,n,r,i,a,o,s,l){j.fromBufferAttribute(i,o),X.fromBufferAttribute(i,s),W.fromBufferAttribute(i,l);var c=ee(e,t,n,r,j,X,W,J);if(c){a&&(Q.fromBufferAttribute(a,o),Z.fromBufferAttribute(a,s),K.fromBufferAttribute(a,l),c.uv=Si.getUV(J,j,X,W,Q,Z,K,new qt));var u=new pr(o,s,l);Si.getNormal(j,X,W,u.normal),c.face=u}return c}return function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),V.copy(n.boundingSphere),V.applyMatrix4(i),!1!==e.ray.intersectsSphere(V)))if(k.getInverse(i),G.copy(e.ray).applyMatrix4(k),!0!==e.params.Mesh.omitGeometry){var a;if(null===n.boundingBox||!1!==G.intersectsBox(n.boundingBox))if(n.isBufferGeometry){var o,s,l,c,u,h,d,p,f,m=n.index,v=n.attributes.position,g=n.attributes.uv,y=n.groups,x=n.drawRange;if(null!==m)if(Array.isArray(r))for(c=0,h=y.length;c<h;c++)for(f=r[(p=y[c]).materialIndex],u=Math.max(p.start,x.start),d=Math.min(p.start+p.count,x.start+x.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),l=m.getX(u+2),(a=te(this,f,e,G,v,g,o,s,l))&&(a.faceIndex=Math.floor(u/3),t.push(a));else for(c=Math.max(0,x.start),h=Math.min(m.count,x.start+x.count);c<h;c+=3)o=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(a=te(this,r,e,G,v,g,o,s,l))&&(a.faceIndex=Math.floor(c/3),t.push(a));else if(void 0!==v)if(Array.isArray(r))for(c=0,h=y.length;c<h;c++)for(f=r[(p=y[c]).materialIndex],u=Math.max(p.start,x.start),d=Math.min(p.start+p.count,x.start+x.count);u<d;u+=3)(a=te(this,f,e,G,v,g,o=u,s=u+1,l=u+2))&&(a.faceIndex=Math.floor(u/3),t.push(a));else for(c=Math.max(0,x.start),h=Math.min(v.count,x.start+x.count);c<h;c+=3)(a=te(this,r,e,G,v,g,o=c,s=c+1,l=c+2))&&(a.faceIndex=Math.floor(c/3),t.push(a))}else if(n.isGeometry){var _,b,w,A,M=Array.isArray(r),T=n.vertices,S=n.faces,E=n.faceVertexUvs[0];0<E.length&&(A=E);for(var L=0,C=S.length;L<C;L++){var P=S[L],N=M?r[P.materialIndex]:r;if(void 0!==N){if(_=T[P.a],b=T[P.b],w=T[P.c],!0===N.morphTargets){var R=n.morphTargets,F=this.morphTargetInfluences;j.set(0,0,0),X.set(0,0,0),W.set(0,0,0);for(var O=0,I=R.length;O<I;O++){var D=F[O];if(0!==D){var U=R[O].vertices;j.addScaledVector(H.subVectors(U[P.a],_),D),X.addScaledVector(Y.subVectors(U[P.b],b),D),W.addScaledVector(q.subVectors(U[P.c],w),D)}}j.add(_),X.add(b),W.add(w),_=j,b=X,w=W}if(a=ee(this,N,e,G,_,b,w,J)){if(A&&A[L]){var B=A[L];Q.copy(B[0]),Z.copy(B[1]),K.copy(B[2]),a.uv=Si.getUV(J,_,b,w,Q,Z,K,new qt)}a.face=P,a.faceIndex=L,t.push(a)}}}}}else{if(null==n.boundingBox&&n.computeBoundingBox(),!G.intersectBox(n.boundingBox,J))return;$.copy(J),$.applyMatrix4(i);var z=e.ray.origin.distanceTo($);if(z<e.near||z>e.far)return;t.push({distance:z,point:$,face:null,faceIndex:null,object:this})}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},isVisible:function(){return this.isMaterialGeneratedMesh&&this.parent?this.visible&&this.parent.visible:this.visible}}),((zi.prototype=Object.create(yn.prototype)).constructor=zi).prototype.isCubeTexture=!0,Object.defineProperty(zi.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),((ki.prototype=Object.create(yn.prototype)).constructor=ki).prototype.isDataTexture3D=!0;var Gi=new yn,Vi=new ki,ji=new zi;function Xi(){this.seq=[],this.map={}}var Wi=[],Hi=[],Yi=new Float32Array(16),qi=new Float32Array(9),Qi=new Float32Array(4);function Zi(e,t,n){var r=e[0];if(r<=0||0<r)return e;var i=t*n,a=Wi[i];if(void 0===a&&(a=new Float32Array(i),Wi[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function Ki(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ji(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function $i(e,t){var n=Hi[t];void 0===n&&(n=new Int32Array(t),Hi[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocTextureUnit();return n}function ea(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ta(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function na(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Ki(n,t))return;e.uniform2fv(this.addr,t),Ji(n,t)}}function ra(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Ki(n,t))return;e.uniform3fv(this.addr,t),Ji(n,t)}}function ia(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Ki(n,t))return;e.uniform4fv(this.addr,t),Ji(n,t)}}function aa(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ki(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ji(n,t)}else{if(Ki(n,r))return;Qi.set(r),e.uniformMatrix2fv(this.addr,!1,Qi),Ji(n,r)}}function oa(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ki(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ji(n,t)}else{if(Ki(n,r))return;qi.set(r),e.uniformMatrix3fv(this.addr,!1,qi),Ji(n,r)}}function sa(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ki(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ji(n,t)}else{if(Ki(n,r))return;Yi.set(r),e.uniformMatrix4fv(this.addr,!1,Yi),Ji(n,r)}}function la(e,t,n){var r=this.cache,i=n.allocTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||Gi,i)}function ca(e,t,n){var r=this.cache,i=n.allocTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Vi,i)}function ua(e,t,n){var r=this.cache,i=n.allocTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||ji,i)}function ha(e,t){var n=this.cache;Ki(n,t)||(e.uniform2iv(this.addr,t),Ji(n,t))}function da(e,t){var n=this.cache;Ki(n,t)||(e.uniform3iv(this.addr,t),Ji(n,t))}function pa(e,t){var n=this.cache;Ki(n,t)||(e.uniform4iv(this.addr,t),Ji(n,t))}function fa(e,t){var n=this.cache;Ki(n,t)||(e.uniform1fv(this.addr,t),Ji(n,t))}function ma(e,t){var n=this.cache;Ki(n,t)||(e.uniform1iv(this.addr,t),Ji(n,t))}function va(e,t){var n=this.cache,r=Zi(t,this.size,2);Ki(n,r)||(e.uniform2fv(this.addr,r),this.updateCache(r))}function ga(e,t){var n=this.cache,r=Zi(t,this.size,3);Ki(n,r)||(e.uniform3fv(this.addr,r),this.updateCache(r))}function ya(e,t){var n=this.cache,r=Zi(t,this.size,4);Ki(n,r)||(e.uniform4fv(this.addr,r),this.updateCache(r))}function xa(e,t){var n=this.cache,r=Zi(t,this.size,4);Ki(n,r)||(e.uniformMatrix2fv(this.addr,!1,r),this.updateCache(r))}function _a(e,t){var n=this.cache,r=Zi(t,this.size,9);Ki(n,r)||(e.uniformMatrix3fv(this.addr,!1,r),this.updateCache(r))}function ba(e,t){var n=this.cache,r=Zi(t,this.size,16);Ki(n,r)||(e.uniformMatrix4fv(this.addr,!1,r),this.updateCache(r))}function wa(e,t,n){var r=this.cache,i=t.length,a=$i(n,i);!1===Ki(r,a)&&(e.uniform1iv(this.addr,a),Ji(r,a));for(var o=0;o!==i;++o)n.setTexture2D(t[o]||Gi,a[o])}function Aa(e,t,n){var r=this.cache,i=t.length,a=$i(n,i);!1===Ki(r,a)&&(e.uniform1iv(this.addr,a),Ji(r,a));for(var o=0;o!==i;++o)n.setTextureCube(t[o]||ji,a[o])}function Ma(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return ea;case 35664:return na;case 35665:return ra;case 35666:return ia;case 35674:return aa;case 35675:return oa;case 35676:return sa;case 35678:case 36198:return la;case 35679:return ca;case 35680:return ua;case 5124:case 35670:return ta;case 35667:case 35671:return ha;case 35668:case 35672:return da;case 35669:case 35673:return pa}}(t.type)}function Ta(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return fa;case 35664:return va;case 35665:return ga;case 35666:return ya;case 35674:return xa;case 35675:return _a;case 35676:return ba;case 35678:return wa;case 35680:return Aa;case 5124:case 35670:return ma;case 35667:case 35671:return ha;case 35668:case 35672:return da;case 35669:case 35673:return pa}}(t.type)}function Sa(e){this.id=e,Xi.call(this)}Ta.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ji(t,e)},Sa.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Ea=/([\w\d_]+)(\])?(\[|\.)?/g;function La(e,t){e.seq.push(t),e.map[t.id]=t}function Ca(e,t,n){var r=e.name,i=r.length;for(Ea.lastIndex=0;;){var a=Ea.exec(r),o=Ea.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===i){La(n,void 0===c?new Ma(s,e,t):new Ta(s,e,t));break}var u=n.map[s];void 0===u&&La(n,u=new Sa(s)),n=u}}function Pa(e,t,n){Xi.call(this),this.renderer=n;for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i=0;i<r;++i){var a=e.getActiveUniform(t,i);Ca(a,e.getUniformLocation(t,a.name),this)}}function Na(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),!1===e.getShaderParameter(r,e.COMPILE_STATUS)&&console.error("v3d.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(r)&&console.warn("v3d.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(r),function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(n)),r}Pa.prototype.setValue=function(e,t,n){var r=this.map[t];void 0!==r&&r.setValue(e,n,this.renderer)},Pa.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},Pa.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},Pa.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var Ra=0;function Fa(e){switch(e){case Ft:return["Linear","(value)"];case Ot:return["sRGB","(value)"];case Dt:return["RGBE","(value)"];case Ut:return["RGBM","(value, 7.0)"];case Bt:return["RGBM","(value, 16.0)"];case zt:return["RGBD","(value, 256.0)"];case It:return["Gamma","(value, float(GAMMA_FACTOR))"];default:throw new Error("unsupported encoding: "+e)}}function Oa(e,t){var n=Fa(t);return"vec4 "+e+"(vec4 value) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Ia(e){return""!==e}function Da(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Ua(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function Ba(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){var n=Pn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Ba(n)})}function za(e){return e.replace(/#pragma unroll_loop[\s]+?for \(int i \= (\d+)\; i < (\d+)\; i\+\+\) \{([\s\S]+?)(?=\})\}/g,function(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[i\]/g,"["+a+"]");return i})}function ka(e,t,n,r,i,a,o){var s=e.context,l=r.defines,c=i.vertexShader,u=i.fragmentShader,h="SHADOWMAP_TYPE_BASIC";a.shadowMapType===G?h="SHADOWMAP_TYPE_PCF":a.shadowMapType===V&&(h="SHADOWMAP_TYPE_PCF_SOFT");var d="ENVMAP_TYPE_CUBE",p="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(r.envMap.mapping){case me:case ve:d="ENVMAP_TYPE_CUBE";break;case _e:case be:d="ENVMAP_TYPE_CUBE_UV";break;case ge:case ye:d="ENVMAP_TYPE_EQUIREC";break;case xe:d="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case ve:case ye:p="ENVMAP_MODE_REFRACTION"}switch(r.combine){case j:f="ENVMAP_BLENDING_MULTIPLY";break;case X:f="ENVMAP_BLENDING_MIX";break;case W:f="ENVMAP_BLENDING_ADD"}}var m,v,g,y,x,_,b,w,A=0<e.gammaFactor?e.gammaFactor:1,M=a.unitsScaleFactor%1?String(a.unitsScaleFactor):String(a.unitsScaleFactor)+".0",T=o.isWebGL2?"":(m=r.extensions,v=a,g=t,[(m=m||{}).derivatives||v.envMapCubeUV||v.bumpMap||v.normalMap&&!v.objectSpaceNormalMap||v.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(m.fragDepth||v.logarithmicDepthBuffer)&&g.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",m.drawBuffers&&g.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(m.shaderTextureLOD||v.envMap)&&g.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ia).join("\n")),S=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(l),E=s.createProgram();if(r.isRawShaderMaterial?(0<(y=[S].filter(Ia).join("\n")).length&&(y+="\n"),0<(x=[T,S].filter(Ia).join("\n")).length&&(x+="\n")):(y=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,S,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+A,"#define MAX_BONES "+a.maxBones,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 "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",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&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.normalMapTangents?"#define USE_NORMALMAP_TANGENTS":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," 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","\n"].filter(Ia).join("\n"),x=[T,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,S,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+A,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 "+d:"",a.envMap?"#define "+p:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"",a.physicallyCorrectLights?"#define UNITS_SCALE_FACTOR "+M:"",a.normalMapTangents?"#define USE_NORMALMAP_TANGENTS":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==he?"#define TONE_MAPPING":"",a.toneMapping!==he?Pn.tonemapping_pars_fragment:"",a.toneMapping!==he?function(e,t){var n;switch(t){case Te:n="Linear";break;case de:n="Reinhard";break;case pe:n="Uncharted2";break;case fe:n="OptimizedCineon";break;case Wt:n="Logarithmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"(vec3 color) { return "+n+"ToneMapping(color); }"}("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Pn.encodings_pars_fragment:"",a.mapEncoding?Oa("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?Oa("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?Oa("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Oa("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(_="linearToOutputTexel",b=a.outputEncoding,w=Fa(b),"vec4 "+_+"(vec4 value) { return LinearTo"+w[0]+w[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Ia).join("\n")),r.isMeshNodeMaterial&&(c=Ga(c,r.nodeChunks),u=Ga(u,r.nodeChunks)),c=Ua(c=Da(c=Ba(c),a),a),u=Ua(u=Da(u=Ba(u),a),a),c=za(c),u=za(u),o.isWebGL2&&!r.isRawShaderMaterial){var L=!1,C=/^\s*#version\s+300\s+es\s*\n/;r.isShaderMaterial&&null!==c.match(C)&&null!==u.match(C)&&(L=!0,c=c.replace(C,""),u=u.replace(C,"")),y=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,x=["#version 300 es\n","#define varying in",L?"":"out highp vec4 pc_fragColor;",L?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x}var P=y+c,N=x+u,R=Na(s,s.VERTEX_SHADER,P),F=Na(s,s.FRAGMENT_SHADER,N);s.attachShader(E,R),s.attachShader(E,F),void 0!==r.index0AttributeName?s.bindAttribLocation(E,0,r.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(E,0,"position"),s.linkProgram(E);var O,I,D=s.getProgramInfoLog(E).trim(),U=s.getShaderInfoLog(R).trim(),B=s.getShaderInfoLog(F).trim(),z=!0,k=!0;return!1===s.getProgramParameter(E,s.LINK_STATUS)?(z=!1,console.error("v3d.WebGLProgram: shader error: ",s.getError(),"gl.VALIDATE_STATUS",s.getProgramParameter(E,s.VALIDATE_STATUS),"gl.getProgramInfoLog",D,U,B)):""!==D?console.warn("v3d.WebGLProgram: gl.getProgramInfoLog()",D):""!==U&&""!==B||(k=!1),k&&(this.diagnostics={runnable:z,material:r,programLog:D,vertexShader:{log:U,prefix:y},fragmentShader:{log:B,prefix:x}}),s.deleteShader(R),s.deleteShader(F),this.getUniforms=function(){return void 0===O&&(O=new Pa(s,E,e)),O},this.getAttributes=function(){return void 0===I&&(I=function(e,t){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}(s,E)),I},this.destroy=function(){s.deleteProgram(E),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("v3d.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("v3d.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=i.name,this.id=Ra++,this.code=n,this.usedTimes=1,this.program=E,this.vertexShader=R,this.fragmentShader=F,this.profile={calcRenderTime:!1,renderTime:0,timerQueries:[],materials:[]},this.beginTimerQuery=function(e){if(this.profile.calcRenderTime){var t=e.getExtension("EXT_disjoint_timer_query");if(t){var n=t.createQueryEXT();t.beginQueryEXT(t.TIME_ELAPSED_EXT,n),this.profile.timerQueries.push(n)}}},this.endTimerQuery=function(e){if(this.profile.calcRenderTime){var t=e.getExtension("EXT_disjoint_timer_query");if(t){t.endQueryEXT(t.TIME_ELAPSED_EXT);for(var n=this.profile.timerQueries,r=n.length-1;0<=r;r--){var i=n[r],a=t.getQueryObjectEXT(i,t.QUERY_RESULT_AVAILABLE_EXT),o=e.getParameter(t.GPU_DISJOINT_EXT);if(a&&!o){var s=t.getQueryObjectEXT(i,t.QUERY_RESULT_EXT);this.profile.renderTime+=s/1e6,n.splice(r,1)}}}}},this}function Ga(e,t){for(var n in t)e=e.replace("#include <"+n+">",t[n]);return e}function Va(p,c,f){var u=[],m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite",MeshMaskMaterial:"mask",MeshNodeMaterial:"node"},a=["precision","supportsVertexTextures","map","mapEncoding","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","unitsScaleFactor"];function v(e,t){var n;return e?e.isTexture?n=e.encoding:e.isWebGLRenderTarget&&(console.warn("v3d.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=e.texture.encoding):n=Ot,n===Ft&&t&&(n=It),n}this.getParameters=function(e,t,n,r,i,a,o){var s=m[e.type],l=o.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(f.floatVertexTextures)return 1024;var n=f.maxVertexUniforms,r=Math.floor((n-20)/4),i=Math.min(r,t.length);return i<t.length?(console.warn("v3d.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(o):0,c=f.precision,u=o.geometry,h=u&&u.isBufferGeometry&&u.getAttribute("tangent");null!==e.precision&&(c=f.getMaxPrecision(e.precision))!==e.precision&&console.warn("v3d.WebGLProgram.getParameters:",e.precision,"not supported, using",c,"instead.");var d=p.getRenderTarget();return{shaderID:s,precision:c,supportsVertexTextures:f.vertexTextures,outputEncoding:v(d?d.texture:null,p.gammaOutput),map:!!e.map,mapEncoding:v(e.map,p.gammaInput),matcap:!!e.matcap,matcapEncoding:v(e.matcap,p.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:v(e.envMap,p.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===_e||e.envMap.mapping===be),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:v(e.emissiveMap,p.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===jt,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,combine:e.combine,vertexColors:e.vertexColors,fog:!!r,useFog:e.fog,fogExp:r&&r.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:f.logarithmicDepthBuffer,skinning:e.skinning&&0<l,maxBones:l,useVertexTexture:f.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:p.maxMorphTargets,maxMorphNormals:p.maxMorphNormals,numDirLights:t.directional.length,numPointLights:t.point.length,numSpotLights:t.spot.length,numRectAreaLights:t.rectArea.length,numHemiLights:t.hemi.length,numClippingPlanes:i,numClipIntersection:a,dithering:e.dithering,shadowMapEnabled:p.shadowMap.enabled&&o.receiveShadow&&0<n.length,shadowMapType:p.shadowMap.type,toneMapping:p.toneMapping,physicallyCorrectLights:p.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===ne,flipSided:e.side===Me,depthPacking:void 0!==e.depthPacking&&e.depthPacking,normalMapTangents:!!e.normalMap&&!!h,unitsScaleFactor:p.unitsScaleFactor}},this.getProgramCode=function(e,t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var i=0;i<a.length;i++)n.push(t[a[i]]);return n.push(e.onBeforeCompile.toString()),n.push(p.gammaOutput),void 0!==e.nodeChunksHash&&n.push(e.nodeChunksHash),n.join()},this.acquireProgram=function(e,t,n,r){for(var i,a=0,o=u.length;a<o;a++){var s=u[a];if(s.code===r){++(i=s).usedTimes;break}}void 0===i&&(i=new ka(p,c,r,e,t,n,f),u.push(i));var l=i.profile.materials;return e.name&&l.indexOf(e.name)<0&&l.push(e.name),i},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},this.programs=u}function ja(){var r=new WeakMap;return{get:function(e){var t=r.get(e);return void 0===t&&(t={},r.set(e,t)),t},remove:function(e){r.delete(e)},update:function(e,t,n){r.get(e)[t]=n},dispose:function(){r=new WeakMap}}}function Xa(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program&&t.program&&e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Wa(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Ha(){var o=[],s=0,l=[],c=[];return{opaque:l,transparent:c,init:function(){s=0,l.length=0,c.length=0},push:function(e,t,n,r,i){var a=o[s];void 0===a?(a={id:e.id,object:e,geometry:t,material:n,program:n.program,renderOrder:e.renderOrder,z:r,group:i},o[s]=a):(a.id=e.id,a.object=e,a.geometry=t,a.material=n,a.program=n.program,a.renderOrder=e.renderOrder,a.z=r,a.group=i),(!0===n.transparent?c:l).push(a),s++},sort:function(){1<l.length&&l.sort(Xa),1<c.length&&c.sort(Wa)}}}function Ya(){var i={};return{get:function(e,t){var n=e.id+","+t.id,r=i[n];return void 0===r&&(r=new Ha,i[n]=r),r},dispose:function(){i={}}}}function qa(){var n={};return{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":t={direction:new Kt,color:new Fn,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new qt};break;case"SpotLight":t={position:new Kt,direction:new Kt,color:new Fn,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new qt};break;case"PointLight":t={position:new Kt,color:new Fn,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new qt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":t={direction:new Kt,skyColor:new Fn,groundColor:new Fn};break;case"RectAreaLight":t={color:new Fn,position:new Kt,halfWidth:new Kt,halfHeight:new Kt}}return n[e.id]=t}}}var Qa=0;function Za(){var b=new qa,w={id:Qa++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},A=new Kt,M=new Qt,T=new Qt;return{setup:function(e,t,n){for(var r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=n.matrixWorldInverse,d=0,p=e.length;d<p;d++){var f=e[d],m=f.color,v=f.intensity,g=f.distance,y=f.shadow&&f.shadow.map?f.shadow.map.texture:null;if(f.isAmbientLight)r+=m.r*v,i+=m.g*v,a+=m.b*v;else if(f.isDirectionalLight){if((_=b.get(f)).color.copy(f.color).multiplyScalar(f.intensity),_.direction.setFromMatrixPosition(f.matrixWorld),A.setFromMatrixPosition(f.target.matrixWorld),_.direction.sub(A),_.direction.transformDirection(h),_.shadow=f.castShadow,f.castShadow){var x=f.shadow;_.shadowBias=x.bias,_.shadowRadius=x.radius,_.shadowMapSize=x.mapSize}w.directionalShadowMap[o]=y,w.directionalShadowMatrix[o]=f.shadow.matrix,w.directional[o]=_,o++}else if(f.isSpotLight)(_=b.get(f)).position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(h),_.color.copy(m).multiplyScalar(v),_.distance=g,_.direction.setFromMatrixPosition(f.matrixWorld),A.setFromMatrixPosition(f.target.matrixWorld),_.direction.sub(A),_.direction.transformDirection(h),_.coneCos=Math.cos(f.angle),_.penumbraCos=Math.cos(f.angle*(1-f.penumbra)),_.decay=f.decay,_.shadow=f.castShadow,f.castShadow&&(x=f.shadow,_.shadowBias=x.bias,_.shadowRadius=x.radius,_.shadowMapSize=x.mapSize),w.spotShadowMap[l]=y,w.spotShadowMatrix[l]=f.shadow.matrix,w.spot[l]=_,l++;else if(f.isRectAreaLight)(_=b.get(f)).color.copy(m).multiplyScalar(v),_.position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(h),T.identity(),M.copy(f.matrixWorld),M.premultiply(h),T.extractRotation(M),_.halfWidth.set(.5*f.width,0,0),_.halfHeight.set(0,.5*f.height,0),_.halfWidth.applyMatrix4(T),_.halfHeight.applyMatrix4(T),w.rectArea[c]=_,c++;else if(f.isPointLight)(_=b.get(f)).position.setFromMatrixPosition(f.matrixWorld),_.position.applyMatrix4(h),_.color.copy(f.color).multiplyScalar(f.intensity),_.distance=f.distance,_.decay=f.decay,_.shadow=f.castShadow,f.castShadow&&(x=f.shadow,_.shadowBias=x.bias,_.shadowRadius=x.radius,_.shadowMapSize=x.mapSize,_.shadowCameraNear=x.camera.near,_.shadowCameraFar=x.camera.far),w.pointShadowMap[s]=y,w.pointShadowMatrix[s]=f.shadow.matrix,w.point[s]=_,s++;else if(f.isHemisphereLight){var _;(_=b.get(f)).direction.setFromMatrixPosition(f.matrixWorld),_.direction.transformDirection(h),_.direction.normalize(),_.skyColor.copy(f.color).multiplyScalar(v),_.groundColor.copy(f.groundColor).multiplyScalar(v),w.hemi[u]=_,u++}}w.ambient[0]=r,w.ambient[1]=i,w.ambient[2]=a,w.directional.length=o,w.spot.length=l,w.rectArea.length=c,w.point.length=s,w.hemi.length=u,w.hash.stateID=w.id,w.hash.directionalLength=o,w.hash.pointLength=s,w.hash.spotLength=l,w.hash.rectAreaLength=c,w.hash.hemiLength=u,w.hash.shadowsLength=t.length},state:w}}function Ka(){var t=new Za,n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:t},setupLights:function(e){t.setup(n,r,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)}}}function Ja(){var r={};return{get:function(e,t){var n;return void 0===r[e.id]?(n=new Ka,r[e.id]={},r[e.id][t.id]=n):void 0===r[e.id][t.id]?(n=new Ka,r[e.id][t.id]=n):n=r[e.id][t.id],n},dispose:function(){r={}}}}function $a(e){wi.call(this),this.type="MeshDepthMaterial",this.depthPacking=kt,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function eo(e){wi.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Kt,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(e)}function to(x,m,e){for(var _=new Sn,b=new Qt,w=new qt,A=new qt(e,e),M=new Kt,T=new Kt,g=1,y=2,t=1+(g|y),S=new Array(t),E=new Array(t),L={},C={0:Me,1:I,2:ne},P=[new Kt(1,0,0),new Kt(-1,0,0),new Kt(0,0,1),new Kt(0,0,-1),new Kt(0,1,0),new Kt(0,-1,0)],N=[new Kt(0,1,0),new Kt(0,1,0),new Kt(0,1,0),new Kt(0,1,0),new Kt(0,0,1),new Kt(0,0,-1)],R=[new xn,new xn,new xn,new xn,new xn,new xn],n=0;n!==t;++n){var r=0!=(n&g),i=0!=(n&y),a=new $a({depthPacking:Gt,morphTargets:r,skinning:i});S[n]=a;var o=new eo({morphTargets:r,skinning:i});E[n]=o}var F=this;function v(e,t,n,r,i,a){var o=e.geometry,s=null,l=S,c=e.customDepthMaterial;if(n&&(l=E,c=e.customDistanceMaterial),c)s=c;else{var u=!1;t.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&0<o.morphAttributes.position.length:o&&o.isGeometry&&(u=o.morphTargets&&0<o.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("v3d.WebGLShadowMap: v3d.SkinnedMesh with material.skinning set to false:",e);var h=e.isSkinnedMesh&&t.skinning,d=0;u&&(d|=g),h&&(d|=y),s=l[d]}if(x.localClippingEnabled&&!0===t.clipShadows&&0!==t.clippingPlanes.length){var p=s.uuid,f=t.uuid,m=L[p];void 0===m&&(m={},L[p]=m);var v=m[f];void 0===v&&(v=s.clone(),m[f]=v),s=v}return s.visible=t.visible,s.wireframe=t.wireframe,s.side=null!=t.shadowSide?t.shadowSide:C[t.side],s.clipShadows=t.clipShadows,s.clippingPlanes=t.clippingPlanes,s.clipIntersection=t.clipIntersection,s.wireframeLinewidth=t.wireframeLinewidth,s.linewidth=t.linewidth,n&&s.isMeshDistanceMaterial&&(s.referencePosition.copy(r),s.nearDistance=i,s.farDistance=a),s}function O(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||_.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld);var i=m.update(e),a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,l=o.length;s<l;s++){var c=o[s],u=a[c.materialIndex];if(u&&u.visible){var h=v(e,u,r,T,n.near,n.far);x.renderBufferDirect(n,null,i,h,e,c)}}else if(a.visible){h=v(e,a,r,T,n.near,n.far);x.renderBufferDirect(n,null,i,h,e,null)}}for(var d=e.children,p=0,f=d.length;p<f;p++)O(d[p],t,n,r)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=G,this.render=function(e,t,n){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==e.length){var r,i=x.context,a=x.state;a.disable(i.BLEND),a.buffers.color.setClear(1,1,1,1),a.buffers.depth.setTest(!0),a.setScissorTest(!1);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.shadow,u=l&&l.isPointLight;if(void 0!==c){var h=c.camera;if(w.copy(c.mapSize),w.min(A),u){var d=w.x,p=w.y;R[0].set(2*d,p,d,p),R[1].set(0,p,d,p),R[2].set(3*d,p,d,p),R[3].set(d,p,d,p),R[4].set(3*d,0,d,p),R[5].set(d,0,d,p),w.x*=4,w.y*=2}if(null===c.map){var f={minFilter:Le,magFilter:Le,format:qe};c.map=new _n(w.x,w.y,f),c.map.texture.name=l.name+".shadowMap",h.updateProjectionMatrix()}c.isSpotLightShadow&&c.update(l);var m=c.map,v=c.matrix;T.setFromMatrixPosition(l.matrixWorld),h.position.copy(T),u?(r=6,v.makeTranslation(-T.x,-T.y,-T.z)):(r=1,M.setFromMatrixPosition(l.target.matrixWorld),h.lookAt(M),h.updateMatrixWorld(),v.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),v.multiply(h.projectionMatrix),v.multiply(h.matrixWorldInverse)),x.setRenderTarget(m),x.clear();for(var g=0;g<r;g++){if(u){M.copy(h.position),M.add(P[g]),h.up.copy(N[g]),h.lookAt(M),h.updateMatrixWorld();var y=R[g];a.viewport(y)}b.multiplyMatrices(h.projectionMatrix,h.matrixWorldInverse),_.setFromMatrix(b),O(t,n,h,u)}}else console.warn("v3d.WebGLShadowMap:",l,"has no shadow.")}F.needsUpdate=!1}}}function no(u,n,l,r){var i=new function(){var t=!1,a=new xn,n=null,o=new xn(0,0,0,0);return{setMask:function(e){n===e||t||(u.colorMask(e,e,e,e),n=e)},setLocked:function(e){t=e},setClear:function(e,t,n,r,i){!0===i&&(e*=r,t*=r,n*=r),a.set(e,t,n,r),!1===o.equals(a)&&(u.clearColor(e,t,n,r),o.copy(a))},reset:function(){t=!1,n=null,o.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?z(u.DEPTH_TEST):k(u.DEPTH_TEST)},setMask:function(e){n===e||t||(u.depthMask(e),n=e)},setFunc:function(e){if(r!==e){if(e)switch(e){case re:u.depthFunc(u.NEVER);break;case ie:u.depthFunc(u.ALWAYS);break;case ae:u.depthFunc(u.LESS);break;case oe:u.depthFunc(u.LEQUAL);break;case se:u.depthFunc(u.EQUAL);break;case le:u.depthFunc(u.GEQUAL);break;case ce:u.depthFunc(u.GREATER);break;case ue:u.depthFunc(u.NOTEQUAL);break;default:u.depthFunc(u.LEQUAL)}else u.depthFunc(u.LEQUAL);r=e}},setLocked:function(e){t=e},setClear:function(e){i!==e&&(u.clearDepth(e),i=e)},reset:function(){t=!1,i=r=n=null}}},t=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){e?z(u.STENCIL_TEST):k(u.STENCIL_TEST)},setMask:function(e){n===e||t||(u.stencilMask(e),n=e)},setFunc:function(e,t,n){r===e&&i===t&&a===n||(u.stencilFunc(e,t,n),r=e,i=t,a=n)},setOp:function(e,t,n){o===e&&s===t&&l===n||(u.stencilOp(e,t,n),o=e,s=t,l=n)},setLocked:function(e){t=e},setClear:function(e){c!==e&&(u.clearStencil(e),c=e)},reset:function(){t=!1,c=l=s=o=a=i=r=n=null}}},e=u.getParameter(u.MAX_VERTEX_ATTRIBS),o=new Uint8Array(e),s=new Uint8Array(e),c=new Uint8Array(e),h={},d=null,p=null,f=null,m=null,v=null,g=null,y=null,x=null,_=null,b=null,w=!1,A=null,M=null,T=null,S=null,E=null,L=u.getParameter(u.MAX_COMBINED_TEXTURE_IMAGE_UNITS),C=!1,P=0,N=u.getParameter(u.VERSION);-1!==N.indexOf("WebGL")?(P=parseFloat(/^WebGL\ ([0-9])/.exec(N)[1]),C=1<=P):-1!==N.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(N)[1]),C=2<=P);var R=null,F={},O=new xn,I=new xn;function D(e,t,n){var r=new Uint8Array(4),i=u.createTexture();u.bindTexture(e,i),u.texParameteri(e,u.TEXTURE_MIN_FILTER,u.NEAREST),u.texParameteri(e,u.TEXTURE_MAG_FILTER,u.NEAREST);for(var a=0;a<n;a++)u.texImage2D(t+a,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,r);return i}var U={};function B(e,t){(o[e]=1,0===s[e]&&(u.enableVertexAttribArray(e),s[e]=1),c[e]!==t)&&((r.isWebGL2?u:n.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](e,t),c[e]=t)}function z(e){!0!==h[e]&&(u.enable(e),h[e]=!0)}function k(e){!1!==h[e]&&(u.disable(e),h[e]=!1)}function G(e,t,n,r,i,a,o,s){if(e!==Q){if(f||(z(u.BLEND),f=!0),e===ee)i=i||t,a=a||n,o=o||r,t===v&&i===x||(u.blendEquationSeparate(l.convert(t),l.convert(i)),v=t,x=i),n===g&&r===y&&a===_&&o===b||(u.blendFuncSeparate(l.convert(n),l.convert(r),l.convert(a),l.convert(o)),g=n,y=r,_=a,b=o),m=e,w=null;else if(e!==m||s!==w){if(v===te&&x===te||(u.blendEquation(u.FUNC_ADD),x=v=te),s)switch(e){case Z:u.blendFuncSeparate(u.ONE,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA);break;case K:u.blendFunc(u.ONE,u.ONE);break;case J:u.blendFuncSeparate(u.ZERO,u.ZERO,u.ONE_MINUS_SRC_COLOR,u.ONE_MINUS_SRC_ALPHA);break;case $:u.blendFuncSeparate(u.ZERO,u.SRC_COLOR,u.ZERO,u.SRC_ALPHA);break;default:console.error("v3d.WebGLState: Invalid blending: ",e)}else switch(e){case Z:u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA);break;case K:u.blendFunc(u.SRC_ALPHA,u.ONE);break;case J:u.blendFunc(u.ZERO,u.ONE_MINUS_SRC_COLOR);break;case $:u.blendFunc(u.ZERO,u.SRC_COLOR);break;default:console.error("v3d.WebGLState: Invalid blending: ",e)}b=_=y=g=null,m=e,w=s}}else f&&(k(u.BLEND),f=!1)}function V(e){A!==e&&(e?u.frontFace(u.CW):u.frontFace(u.CCW),A=e)}function j(e){e!==H?(z(u.CULL_FACE),e!==M&&(e===Y?u.cullFace(u.BACK):e===q?u.cullFace(u.FRONT):u.cullFace(u.FRONT_AND_BACK))):k(u.CULL_FACE),M=e}function X(e,t,n){e?(z(u.POLYGON_OFFSET_FILL),S===t&&E===n||(u.polygonOffset(t,n),S=t,E=n)):k(u.POLYGON_OFFSET_FILL)}function W(e){void 0===e&&(e=u.TEXTURE0+L-1),R!==e&&(u.activeTexture(e),R=e)}return U[u.TEXTURE_2D]=D(u.TEXTURE_2D,u.TEXTURE_2D,1),U[u.TEXTURE_CUBE_MAP]=D(u.TEXTURE_CUBE_MAP,u.TEXTURE_CUBE_MAP_POSITIVE_X,6),i.setClear(0,0,0,1),a.setClear(1),t.setClear(0),z(u.DEPTH_TEST),a.setFunc(oe),V(!1),j(Y),z(u.CULL_FACE),G(Q),{buffers:{color:i,depth:a,stencil:t},initAttributes:function(){for(var e=0,t=o.length;e<t;e++)o[e]=0},enableAttribute:function(e){B(e,0)},enableAttributeAndDivisor:B,disableUnusedAttributes:function(){for(var e=0,t=s.length;e!==t;++e)s[e]!==o[e]&&(u.disableVertexAttribArray(e),s[e]=0)},enable:z,disable:k,getCompressedTextureFormats:function(){if(null===d&&(d=[],n.get("WEBGL_compressed_texture_pvrtc")||n.get("WEBGL_compressed_texture_s3tc")||n.get("WEBGL_compressed_texture_etc1")||n.get("WEBGL_compressed_texture_astc")))for(var e=u.getParameter(u.COMPRESSED_TEXTURE_FORMATS),t=0;t<e.length;t++)d.push(e[t]);return d},useProgram:function(e){return p!==e&&(u.useProgram(e),p=e,!0)},setBlending:G,setMaterial:function(e,t){e.side===ne?k(u.CULL_FACE):z(u.CULL_FACE);var n=e.side===Me;t&&(n=!n),V(n),e.blending===Z&&!1===e.transparent?G(Q):G(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite),X(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:V,setCullFace:j,setLineWidth:function(e){e!==T&&(C&&u.lineWidth(e),T=e)},setPolygonOffset:X,setScissorTest:function(e){e?z(u.SCISSOR_TEST):k(u.SCISSOR_TEST)},activeTexture:W,bindTexture:function(e,t){null===R&&W();var n=F[R];void 0===n&&(n={type:void 0,texture:void 0},F[R]=n),n.type===e&&n.texture===t||(u.bindTexture(e,t||U[e]),n.type=e,n.texture=t)},compressedTexImage2D:function(){try{u.compressedTexImage2D.apply(u,arguments)}catch(e){console.error("v3d.WebGLState:",e)}},texImage2D:function(){try{u.texImage2D.apply(u,arguments)}catch(e){console.error("v3d.WebGLState:",e)}},texImage3D:function(){try{u.texImage3D.apply(u,arguments)}catch(e){console.error("v3d.WebGLState:",e)}},scissor:function(e){!1===O.equals(e)&&(u.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===I.equals(e)&&(u.viewport(e.x,e.y,e.z,e.w),I.copy(e))},reset:function(){for(var e=0;e<s.length;e++)1===s[e]&&(u.disableVertexAttribArray(e),s[e]=0);h={},F={},M=A=m=p=R=d=null,i.reset(),a.reset(),t.reset()}}}function ro(v,i,g,y,x,_,b){var m,s={};function w(e,t){if(e.width>t||e.height>t){if("data"in e)return void console.warn("v3d.WebGLRenderer: image in DataTexture is too big ("+e.width+"x"+e.height+").");var n=t/Math.max(e.width,e.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(e.width*n),r.height=Math.floor(e.height*n),r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("v3d.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height),r}return e}function A(e){return Yt.isPowerOfTwo(e.width)&&Yt.isPowerOfTwo(e.height)}function M(e,t){return e.generateMipmaps&&t&&e.minFilter!==Le&&e.minFilter!==Ne}function T(e,t,n,r){v.generateMipmap(e),y.get(t).__maxMipLevel=Math.log(Math.max(n,r))*Math.LOG2E}function S(e,t){if(!x.isWebGL2)return e;if(e===v.RED){if(t===v.FLOAT)return v.R32F;if(t===v.HALF_FLOAT)return v.R16F;if(t===v.UNSIGNED_BYTE)return v.R8}if(e===v.RGB){if(t===v.FLOAT)return v.RGB32F;if(t===v.HALF_FLOAT)return v.RGB16F;if(t===v.UNSIGNED_BYTE)return v.RGB8}if(e===v.RGBA){if(t===v.FLOAT)return v.RGBA32F;if(t===v.HALF_FLOAT)return v.RGBA16F;if(t===v.UNSIGNED_BYTE)return v.RGBA8}return e}function a(e){return e===Le||e===Ce||e===Pe?v.NEAREST:v.LINEAR}function E(e){var t=e.target;t.removeEventListener("dispose",E),function(e){var t=y.get(e);if(e.image&&t.__image__webglTextureCube)v.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;v.deleteTexture(t.__webglTexture)}y.remove(e)}(t),t.isVideoTexture&&delete s[t.id],b.memory.textures--}function o(e){var t=e.target;t.removeEventListener("dispose",o),function(e){var t=y.get(e),n=y.get(e.texture);if(!e)return;void 0!==n.__webglTexture&&v.deleteTexture(n.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var r=0;r<6;r++)v.deleteFramebuffer(t.__webglFramebuffer[r]),t.__webglDepthbuffer&&v.deleteRenderbuffer(t.__webglDepthbuffer[r]);else v.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&v.deleteRenderbuffer(t.__webglDepthbuffer);y.remove(e.texture),y.remove(e)}(t),b.memory.textures--}function l(e,t){var n,r,i,a=y.get(e);if(e.isVideoTexture&&(r=(n=e).id,i=b.render.frame,s[r]!==i&&(s[r]=i,n.update())),0<e.version&&a.__version!==e.version){var o=e.image;if(void 0===o)console.warn("v3d.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.complete)return void c(a,e,t);console.warn("v3d.WebGLRenderer: Texture marked for update but image is incomplete")}}g.activeTexture(v.TEXTURE0+t),g.bindTexture(v.TEXTURE_2D,a.__webglTexture)}function L(e,t,n){var r;if(n?(v.texParameteri(e,v.TEXTURE_WRAP_S,_.convert(t.wrapS)),v.texParameteri(e,v.TEXTURE_WRAP_T,_.convert(t.wrapT)),v.texParameteri(e,v.TEXTURE_MAG_FILTER,_.convert(t.magFilter)),v.texParameteri(e,v.TEXTURE_MIN_FILTER,_.convert(t.minFilter))):(v.texParameteri(e,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(e,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),t.wrapS===Se&&t.wrapT===Se||console.warn("v3d.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to v3d.ClampToEdgeWrapping."),v.texParameteri(e,v.TEXTURE_MAG_FILTER,a(t.magFilter)),v.texParameteri(e,v.TEXTURE_MIN_FILTER,a(t.minFilter)),t.minFilter!==Le&&t.minFilter!==Ne&&console.warn("v3d.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to v3d.NearestFilter or v3d.LinearFilter.")),r=i.get("EXT_texture_filter_anisotropic")){if(t.type===ke&&null===i.get("OES_texture_float_linear"))return;if(t.type===Ge&&null===(x.isWebGL2||i.get("OES_texture_half_float_linear")))return;(1<t.anisotropy||y.get(t).__currentAnisotropy)&&(v.texParameterf(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,x.getMaxAnisotropy())),y.get(t).__currentAnisotropy=t.anisotropy)}}function c(e,t,n){var r;r=t.isDataTexture3D?v.TEXTURE_3D:v.TEXTURE_2D,void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",E),e.__webglTexture=v.createTexture(),b.memory.textures++),g.activeTexture(v.TEXTURE0+n),g.bindTexture(r,e.__webglTexture),v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,t.flipY),v.pixelStorei(v.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),v.pixelStorei(v.UNPACK_ALIGNMENT,t.unpackAlignment);var i,a,o=w(t.image,x.maxTextureSize);a=t,x.isWebGL2||a.wrapS===Se&&a.wrapT===Se&&(a.minFilter===Le||a.minFilter===Ne)||!1!==A(o)||(o=(i=o)instanceof HTMLImageElement||i instanceof HTMLCanvasElement?(void 0===m&&(m=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),m.width=Yt.floorPowerOfTwo(i.width),m.height=Yt.floorPowerOfTwo(i.height),m.getContext("2d").drawImage(i,0,0,m.width,m.height),console.warn("v3d.WebGLRenderer: image is not power of two ("+i.width+"x"+i.height+"). Resized to "+m.width+"x"+m.height),m):i);var s=A(o),l=_.convert(t.format),c=_.convert(t.type),u=S(l,c);L(r,t,s);var h,d=t.mipmaps;if(t.isDepthTexture){if(u=v.DEPTH_COMPONENT,t.type===ke){if(!x.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");u=v.DEPTH_COMPONENT32F}else x.isWebGL2&&(u=v.DEPTH_COMPONENT16);t.format===Je&&u===v.DEPTH_COMPONENT&&t.type!==Ue&&t.type!==ze&&(console.warn("v3d.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),t.type=Ue,c=_.convert(t.type)),t.format===$e&&(u=v.DEPTH_STENCIL,t.type!==We&&(console.warn("v3d.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),t.type=We,c=_.convert(t.type))),g.texImage2D(v.TEXTURE_2D,0,u,o.width,o.height,0,l,c,null)}else if(t.isDataTexture)if(0<d.length&&s){for(var p=0,f=d.length;p<f;p++)h=d[p],g.texImage2D(v.TEXTURE_2D,p,u,h.width,h.height,0,l,c,h.data);t.generateMipmaps=!1,e.__maxMipLevel=d.length-1}else g.texImage2D(v.TEXTURE_2D,0,u,o.width,o.height,0,l,c,o.data),e.__maxMipLevel=0;else if(t.isCompressedTexture){for(p=0,f=d.length;p<f;p++)h=d[p],t.format!==qe&&t.format!==Ye?-1<g.getCompressedTextureFormats().indexOf(l)?g.compressedTexImage2D(v.TEXTURE_2D,p,u,h.width,h.height,0,h.data):console.warn("v3d.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):g.texImage2D(v.TEXTURE_2D,p,u,h.width,h.height,0,l,c,h.data);e.__maxMipLevel=d.length-1}else if(t.isDataTexture3D)g.texImage3D(v.TEXTURE_3D,0,u,o.width,o.height,o.depth,0,l,c,o.data),e.__maxMipLevel=0;else if(0<d.length&&s){for(p=0,f=d.length;p<f;p++)h=d[p],g.texImage2D(v.TEXTURE_2D,p,u,l,c,h);t.generateMipmaps=!1,e.__maxMipLevel=d.length-1}else g.texImage2D(v.TEXTURE_2D,0,u,l,c,o),e.__maxMipLevel=0;M(t,s)&&T(v.TEXTURE_2D,t,o.width,o.height),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function u(e,t,n,r){var i=_.convert(t.texture.format),a=_.convert(t.texture.type),o=S(i,a);g.texImage2D(r,0,o,t.width,t.height,0,i,a,null),v.bindFramebuffer(v.FRAMEBUFFER,e),v.framebufferTexture2D(v.FRAMEBUFFER,n,r,y.get(t.texture).__webglTexture,0),v.bindFramebuffer(v.FRAMEBUFFER,null)}function h(e,t){v.bindRenderbuffer(v.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(v.renderbufferStorage(v.RENDERBUFFER,v.DEPTH_COMPONENT16,t.width,t.height),v.framebufferRenderbuffer(v.FRAMEBUFFER,v.DEPTH_ATTACHMENT,v.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(v.renderbufferStorage(v.RENDERBUFFER,v.DEPTH_STENCIL,t.width,t.height),v.framebufferRenderbuffer(v.FRAMEBUFFER,v.DEPTH_STENCIL_ATTACHMENT,v.RENDERBUFFER,e)):v.renderbufferStorage(v.RENDERBUFFER,v.RGBA4,t.width,t.height),v.bindRenderbuffer(v.RENDERBUFFER,null)}function d(e){var t=y.get(e),n=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,t){if(t&&t.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(v.bindFramebuffer(v.FRAMEBUFFER,e),!t.depthTexture||!t.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of v3d.DepthTexture");y.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),l(t.depthTexture,0);var n=y.get(t.depthTexture).__webglTexture;if(t.depthTexture.format===Je)v.framebufferTexture2D(v.FRAMEBUFFER,v.DEPTH_ATTACHMENT,v.TEXTURE_2D,n,0);else{if(t.depthTexture.format!==$e)throw new Error("Unknown depthTexture format");v.framebufferTexture2D(v.FRAMEBUFFER,v.DEPTH_STENCIL_ATTACHMENT,v.TEXTURE_2D,n,0)}}(t.__webglFramebuffer,e)}else if(n){t.__webglDepthbuffer=[];for(var r=0;r<6;r++)v.bindFramebuffer(v.FRAMEBUFFER,t.__webglFramebuffer[r]),t.__webglDepthbuffer[r]=v.createRenderbuffer(),h(t.__webglDepthbuffer[r],e)}else v.bindFramebuffer(v.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=v.createRenderbuffer(),h(t.__webglDepthbuffer,e);v.bindFramebuffer(v.FRAMEBUFFER,null)}this.setTexture2D=l,this.setTexture3D=function(e,t){var n=y.get(e);0<e.version&&n.__version!==e.version?c(n,e,t):(g.activeTexture(v.TEXTURE0+t),g.bindTexture(v.TEXTURE_3D,n.__webglTexture))},this.setTextureCube=function(e,t){var n=y.get(e);if(6===e.image.length)if(0<e.version&&n.__version!==e.version){n.__image__webglTextureCube||(e.addEventListener("dispose",E),n.__image__webglTextureCube=v.createTexture(),b.memory.textures++),g.activeTexture(v.TEXTURE0+t),g.bindTexture(v.TEXTURE_CUBE_MAP,n.__image__webglTextureCube),v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var r=e&&e.isCompressedTexture,i=e.image[0]&&e.image[0].isDataTexture,a=[],o=0;o<6;o++)a[o]=r||i?i?e.image[o].image:e.image[o]:w(e.image[o],x.maxCubemapSize);var s=a[0],l=A(s),c=_.convert(e.format),u=_.convert(e.type),h=S(c,u);for(L(v.TEXTURE_CUBE_MAP,e,l),o=0;o<6;o++)if(r)for(var d,p=a[o].mipmaps,f=0,m=p.length;f<m;f++)d=p[f],e.format!==qe&&e.format!==Ye?-1<g.getCompressedTextureFormats().indexOf(c)?g.compressedTexImage2D(v.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,h,d.width,d.height,0,d.data):console.warn("v3d.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g.texImage2D(v.TEXTURE_CUBE_MAP_POSITIVE_X+o,f,h,d.width,d.height,0,c,u,d.data);else i?g.texImage2D(v.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,h,a[o].width,a[o].height,0,c,u,a[o].data):g.texImage2D(v.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,h,c,u,a[o]);n.__maxMipLevel=r?p.length-1:0,M(e,l)&&T(v.TEXTURE_CUBE_MAP,e,s.width,s.height),n.__version=e.version,e.onUpdate&&e.onUpdate(e)}else g.activeTexture(v.TEXTURE0+t),g.bindTexture(v.TEXTURE_CUBE_MAP,n.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,t){g.activeTexture(v.TEXTURE0+t),g.bindTexture(v.TEXTURE_CUBE_MAP,y.get(e).__webglTexture)},this.setupRenderTarget=function(e){var t=y.get(e),n=y.get(e.texture);e.addEventListener("dispose",o),n.__webglTexture=v.createTexture(),b.memory.textures++;var r=!0===e.isWebGLRenderTargetCube,i=A(e);if(r){t.__webglFramebuffer=[];for(var a=0;a<6;a++)t.__webglFramebuffer[a]=v.createFramebuffer()}else t.__webglFramebuffer=v.createFramebuffer();if(r){for(g.bindTexture(v.TEXTURE_CUBE_MAP,n.__webglTexture),L(v.TEXTURE_CUBE_MAP,e.texture,i),a=0;a<6;a++)u(t.__webglFramebuffer[a],e,v.COLOR_ATTACHMENT0,v.TEXTURE_CUBE_MAP_POSITIVE_X+a);M(e.texture,i)&&T(v.TEXTURE_CUBE_MAP,e.texture,e.width,e.height),g.bindTexture(v.TEXTURE_CUBE_MAP,null)}else g.bindTexture(v.TEXTURE_2D,n.__webglTexture),L(v.TEXTURE_2D,e.texture,i),u(t.__webglFramebuffer,e,v.COLOR_ATTACHMENT0,v.TEXTURE_2D),M(e.texture,i)&&T(v.TEXTURE_2D,e.texture,e.width,e.height),g.bindTexture(v.TEXTURE_2D,null);e.depthBuffer&&d(e)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(M(t,A(e))){var n=e.isWebGLRenderTargetCube?v.TEXTURE_CUBE_MAP:v.TEXTURE_2D,r=y.get(t).__webglTexture;g.bindTexture(n,r),T(n,t,e.width,e.height),g.bindTexture(n,null)}}}function io(n,r,i){return{convert:function(e){var t;if(e===we)return n.REPEAT;if(e===Se)return n.CLAMP_TO_EDGE;if(e===Ee)return n.MIRRORED_REPEAT;if(e===Le)return n.NEAREST;if(e===Ce)return n.NEAREST_MIPMAP_NEAREST;if(e===Pe)return n.NEAREST_MIPMAP_LINEAR;if(e===Ne)return n.LINEAR;if(e===Re)return n.LINEAR_MIPMAP_NEAREST;if(e===Fe)return n.LINEAR_MIPMAP_LINEAR;if(e===Oe)return n.UNSIGNED_BYTE;if(e===Ve)return n.UNSIGNED_SHORT_4_4_4_4;if(e===je)return n.UNSIGNED_SHORT_5_5_5_1;if(e===Xe)return n.UNSIGNED_SHORT_5_6_5;if(e===Ie)return n.BYTE;if(e===De)return n.SHORT;if(e===Ue)return n.UNSIGNED_SHORT;if(e===Be)return n.INT;if(e===ze)return n.UNSIGNED_INT;if(e===ke)return n.FLOAT;if(e===Ge){if(i.isWebGL2)return n.HALF_FLOAT;if(null!==(t=r.get("OES_texture_half_float")))return t.HALF_FLOAT_OES}if(e===He)return n.ALPHA;if(e===Ye)return n.RGB;if(e===qe)return n.RGBA;if(e===Qe)return n.LUMINANCE;if(e===Ze)return n.LUMINANCE_ALPHA;if(e===Je)return n.DEPTH_COMPONENT;if(e===$e)return n.DEPTH_STENCIL;if(e===et)return n.RED;if(e===te)return n.FUNC_ADD;if(e===T)return n.FUNC_SUBTRACT;if(e===S)return n.FUNC_REVERSE_SUBTRACT;if(e===C)return n.ZERO;if(e===P)return n.ONE;if(e===N)return n.SRC_COLOR;if(e===R)return n.ONE_MINUS_SRC_COLOR;if(e===F)return n.SRC_ALPHA;if(e===O)return n.ONE_MINUS_SRC_ALPHA;if(e===D)return n.DST_ALPHA;if(e===U)return n.ONE_MINUS_DST_ALPHA;if(e===B)return n.DST_COLOR;if(e===z)return n.ONE_MINUS_DST_COLOR;if(e===k)return n.SRC_ALPHA_SATURATE;if((e===tt||e===nt||e===rt||e===it)&&null!==(t=r.get("WEBGL_compressed_texture_s3tc"))){if(e===tt)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===nt)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===rt)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===it)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===at||e===ot||e===st||e===lt)&&null!==(t=r.get("WEBGL_compressed_texture_pvrtc"))){if(e===at)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===ot)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===st)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===lt)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===ct&&null!==(t=r.get("WEBGL_compressed_texture_etc1")))return t.COMPRESSED_RGB_ETC1_WEBGL;if((e===ut||e===ht||e===dt||e===pt||e===ft||e===mt||e===vt||e===gt||e===yt||e===xt||e===_t||e===bt||e===wt||e===At)&&null!==(t=r.get("WEBGL_compressed_texture_astc")))return e;if(e===E||e===L){if(i.isWebGL2){if(e===E)return n.MIN;if(e===L)return n.MAX}if(null!==(t=r.get("EXT_blend_minmax"))){if(e===E)return t.MIN_EXT;if(e===L)return t.MAX_EXT}}if(e===We){if(i.isWebGL2)return n.UNSIGNED_INT_24_8;if(null!==(t=r.get("WEBGL_depth_texture")))return t.UNSIGNED_INT_24_8_WEBGL}return 0}}}function ao(){ur.call(this),this.type="Group"}function oo(e,t,n,r){hr.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function so(e){oo.call(this),this.cameras=e||[]}(($a.prototype=Object.create(wi.prototype)).constructor=$a).prototype.isMeshDepthMaterial=!0,$a.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},((eo.prototype=Object.create(wi.prototype)).constructor=eo).prototype.isMeshDistanceMaterial=!0,eo.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},ao.prototype=Object.assign(Object.create(ur.prototype),{constructor:ao,isGroup:!0}),oo.prototype=Object.assign(Object.create(hr.prototype),{constructor:oo,isPerspectiveCamera:!0,copy:function(e,t){return hr.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Yt.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Yt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Yt.RAD2DEG*Math.atan(Math.tan(.5*Yt.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Yt.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ur.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),so.prototype=Object.assign(Object.create(oo.prototype),{constructor:so,isArrayCamera:!0});var lo,co,uo,ho,po,fo,mo,vo,go,yo,xo,_o,bo,wo,Ao,Mo,To=new Kt,So=new Kt;function Eo(e,t,n){To.setFromMatrixPosition(t.matrixWorld),So.setFromMatrixPosition(n.matrixWorld);var r=To.distanceTo(So),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=o+f,g=s+f,y=d-m,x=p+(r-m),_=l*s/g*v,b=c*s/g*v;e.projectionMatrix.makePerspective(y,x,_,b,v,g)}function Lo(r){var i=this,l=null,c=null,u=null,h=[],d=new Qt,p=new Qt,a=1,f="stage";"undefined"!=typeof window&&"VRFrameData"in window&&(c=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",e,!1));var m=new Qt,v=new Zt,g=new Kt,y=new oo;y.bounds=new xn(0,0,.5,1),y.layers.enable(1);var x=new oo;x.bounds=new xn(.5,0,.5,1),x.layers.enable(2);var o,s,_=new so([y,x]);function b(){return null!==l&&!0===l.isPresenting}function e(){if(b()){var e=l.getEyeParameters("left"),t=e.renderWidth*a,n=e.renderHeight*a;s=r.getPixelRatio(),o=r.getSize(),r.setDrawingBufferSize(2*t,n,1),M.start()}else i.enabled&&r.setDrawingBufferSize(o.width,o.height,s),M.stop()}_.layers.enable(1),_.layers.enable(2);var w=[];function A(e){for(var t=navigator.getGamepads&&navigator.getGamepads(),n=0,r=0,i=t.length;n<i;n++){var a=t[n];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(r===e)return a;r++}}}this.enabled=!1,this.getController=function(e){var t=h[e];return void 0===t&&((t=new ao).matrixAutoUpdate=!1,t.visible=!1,h[e]=t),t},this.getDevice=function(){return l},this.setDevice=function(e){void 0!==e&&(l=e),M.setContext(e)},this.setFramebufferScaleFactor=function(e){a=e},this.setFrameOfReferenceType=function(e){f=e},this.setPoseTarget=function(e){void 0!==e&&(u=e)},this.getCamera=function(e){var t="stage"===f?1.6:0;if(null===l)return e.position.set(0,t,0),e;if(l.depthNear=e.near,l.depthFar=e.far,l.getFrameData(c),"stage"===f){var n=l.stageParameters;n?d.fromArray(n.sittingToStandingTransform):d.makeTranslation(0,t,0)}var r=c.pose,i=null!==u?u:e;if(i.matrix.copy(d),i.matrix.decompose(i.position,i.quaternion,i.scale),null!==r.orientation&&(v.fromArray(r.orientation),i.quaternion.multiply(v)),null!==r.position&&(v.setFromRotationMatrix(d),g.fromArray(r.position),g.applyQuaternion(v),i.position.add(g)),i.updateMatrixWorld(),!1===l.isPresenting)return e;y.near=e.near,x.near=e.near,y.far=e.far,x.far=e.far,y.matrixWorldInverse.fromArray(c.leftViewMatrix),x.matrixWorldInverse.fromArray(c.rightViewMatrix),p.getInverse(d),"stage"===f&&(y.matrixWorldInverse.multiply(p),x.matrixWorldInverse.multiply(p));var a=i.parent;null!==a&&(m.getInverse(a.matrixWorld),y.matrixWorldInverse.multiply(m),x.matrixWorldInverse.multiply(m)),y.matrixWorld.getInverse(y.matrixWorldInverse),x.matrixWorld.getInverse(x.matrixWorldInverse),y.projectionMatrix.fromArray(c.leftProjectionMatrix),x.projectionMatrix.fromArray(c.rightProjectionMatrix),Eo(_,y,x);var o=l.getLayers();if(o.length){var s=o[0];null!==s.leftBounds&&4===s.leftBounds.length&&y.bounds.fromArray(s.leftBounds),null!==s.rightBounds&&4===s.rightBounds.length&&x.bounds.fromArray(s.rightBounds)}return function(){for(var e=0;e<h.length;e++){var t=h[e],n=A(e);if(void 0!==n&&void 0!==n.pose){if(null===n.pose)return;var r=n.pose;!1===r.hasPosition&&t.position.set(.2,-.6,-.05),null!==r.position&&t.position.fromArray(r.position),null!==r.orientation&&t.quaternion.fromArray(r.orientation),t.matrix.compose(t.position,t.quaternion,t.scale),t.matrix.premultiply(d),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0,t.visible=!0;var i="Daydream Controller"===n.id?0:1;w[e]!==n.buttons[i].pressed&&(w[e]=n.buttons[i].pressed,!0===w[e]?t.dispatchEvent({type:"selectstart"}):(t.dispatchEvent({type:"selectend"}),t.dispatchEvent({type:"select"})))}else t.visible=!1}}(),_},this.getStandingMatrix=function(){return d},this.isPresenting=b;var M=new Bn;this.setAnimationLoop=function(e){M.setAnimationLoop(e)},this.submitFrame=function(){b()&&l.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",e)}}function Co(e,t,n,r){this.ray=new Ti(e,t),this.near=n||0,this.far=r||1/0,this.params={Mesh:{omitGeometry:!1},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("v3d.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Po(e,t){return e.distance-t.distance}function No(e,t,n,r){if(!(!1===e.visible||e.isMesh&&e.isMaterialGeneratedMesh&&e.parent&&!e.parent.visible)&&(e.raycast(t,n),!0===r))for(var i=e.children,a=0,o=i.length;a<o;a++)No(i[a],t,n,!0)}function Ro(t){var n=t.context,r=null,d=null,i=1,p=null,a="stage",f=null,m=[],v=[],g=!0;function o(){return null!==d&&null!==p}var s=new oo;s.layers.enable(1),s.viewport=new xn;var l=new oo;l.layers.enable(2),l.viewport=new xn;var y=new so([s,l]);function c(e){var t=m[v.indexOf(e.inputSource)];t&&t.dispatchEvent({type:e.type})}function u(){t.setFramebuffer(null),_.stop()}function h(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}y.layers.enable(1),y.layers.enable(2),this.enabled=!1,this.getController=function(e){var t=m[e];return void 0===t&&((t=new ao).matrixAutoUpdate=!1,t.visible=!1,m[e]=t),t},this.getDevice=function(){return r},this.setDevice=function(e){void 0!==e&&(r=e),e instanceof XRDevice&&n.setCompatibleXRDevice(e)},this.setFramebufferScaleFactor=function(e){i=e},this.setFrameOfReferenceType=function(e){a=e},this.setSession=function(e){null!==(d=e)&&(d.addEventListener("select",c),d.addEventListener("selectstart",c),d.addEventListener("selectend",c),d.addEventListener("end",u),d.baseLayer=new XRWebGLLayer(d,n,{framebufferScaleFactor:i}),d.requestFrameOfReference(a).then(function(e){p=e,t.setFramebuffer(d.baseLayer.framebuffer),_.setContext(d),_.start()}),v=d.getInputSources(),d.addEventListener("inputsourceschange",function(){v=d.getInputSources(),console.log(v);for(var e=0;e<m.length;e++){m[e].userData.inputSource=v[e]}}))},this.getCamera=function(e){if(o()){var t=e.parent,n=y.cameras;h(y,t);for(var r=0;r<n.length;r++)h(n[r],t);e.matrixWorld.copy(y.matrixWorld);for(var i=e.children,a=(r=0,i.length);r<a;r++)i[r].updateMatrixWorld(!0);return Eo(y,s,l),y}return e},this.isPresenting=o;var x=null;var _=new Bn;_.setAnimationLoop(function(e,t){if(null!==(f=t.getDevicePose(p)))for(var n=d.baseLayer,r=t.views,i=0;i<r.length;i++){var a=r[i],o=n.getViewport(a),s=f.getViewMatrix(a);if(g)var l=y.cameras[i];else l=y.cameras[0];l.matrix.fromArray(s).getInverse(l.matrix),l.projectionMatrix.fromArray(a.projectionMatrix),l.viewport.set(o.x,o.y,o.width,o.height),0===i&&y.matrix.copy(l.matrix)}for(i=0;i<m.length;i++){var c=m[i],u=v[i];if(u){var h=t.getInputPose(u,p);if(null!==h){"targetRay"in h?c.matrix.elements=h.targetRay.transformMatrix:"pointerMatrix"in h&&(c.matrix.elements=h.pointerMatrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.visible=!0;continue}}c.visible=!1}x&&x(e)}),this.setAnimationLoop=function(e){x=e},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("v3d.WebXRManager: getStandingMatrix() is no longer needed."),new Qt},this.submitFrame=function(){},this.setImmersive=function(e){if((g=e)&&y.cameras.length<2){var t=new oo;t.layers.enable(2),t.viewport=new xn,y.cameras.push(t),y.layers.enable(2)}else!e&&1<y.cameras.length&&(y.layers.disable(2),y.cameras.splice(1))},this.arHitTest=function(e,t,i,a){if(d&&XRSession.prototype.requestHitTest){a=a||function(){},this.raycaster=this.raycaster||new Co,this.raycaster.setFromCamera({x:e,y:t},y.cameras[0]);var n=this.raycaster.ray,r=new Float32Array(n.origin.toArray()),o=new Float32Array(n.direction.toArray());d.requestHitTest(r,o,p).then(function(e){if(e.length){var t=e[0],n=(new Qt).fromArray(t.hitMatrix),r=new Kt;r.setFromMatrixPosition(n),i(r)}else a()})}}}function Fo(e){console.log("Verge3D",Ae);var r=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),t=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",f=null,j=null;this.domElement=r,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.unitsScaleFactor=1,this.toneMapping=Te,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var X,A,W,H,u,Y,h,M,T,m,y,d,p,v,S,E,L,g,q=this,x=!1,_=null,b=null,w=null,Q=-1,C={geometry:null,program:null,wireframe:!1},Z=null,P=null,N=new xn,R=new xn,F=null,K=0,J=r.width,$=r.height,ee=1,O=new xn(0,0,J,$),I=new xn(0,0,J,$),D=!1,U=new Sn,te=new Ni,ne=!1,re=!1,B=new Qt,ie=new Qt,ae=new Kt;function z(){return null===b?ee:1}try{var k={alpha:n,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c};if(r.addEventListener("webglcontextlost",se,!1),r.addEventListener("webglcontextrestored",le,!1),null===(X=t||r.getContext("webgl",k)||r.getContext("experimental-webgl",k)))throw null!==r.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===X.getShaderPrecisionFormat&&(X.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){console.error("v3d.WebGLRenderer: "+e.message)}function G(){A=new Ri(X),(W=new Pi(X,A,e)).isWebGL2||(A.get("WEBGL_depth_texture"),A.get("OES_texture_float"),A.get("OES_texture_half_float"),A.get("OES_texture_half_float_linear"),A.get("OES_standard_derivatives"),A.get("OES_element_index_uint"),A.get("ANGLE_instanced_arrays")),A.get("OES_texture_float_linear"),g=new io(X,A,W),(H=new no(X,A,g,W)).scissor(R.copy(I).multiplyScalar(ee)),H.viewport(N.copy(O).multiplyScalar(ee)),u=new Ii(X),Y=new ja,h=new ro(X,A,H,Y,W,g,u),M=new zn(X),T=new Fi(X,M,u),m=new Bi(T,u),S=new Ui(X),y=new Va(q,A,W),d=new Ya,p=new Ja,v=new Li(q,H,m,s),E=new Ci(X,A,u,W),L=new Oi(X,A,u,W),u.programs=y.programs,q.context=X,q.capabilities=W,q.extensions=A,q.properties=Y,q.renderLists=d,q.state=H,q.info=u}G();var V=null;"undefined"!=typeof navigator&&(V="xr"in navigator?new Ro(q):new Lo(q)),this.vr=V;var oe=new to(q,m,W.maxTextureSize);function se(e){e.preventDefault(),console.log("v3d.WebGLRenderer: Context Lost."),x=!0}function le(){console.log("v3d.WebGLRenderer: Context Restored."),x=!1,G()}function ce(e){var t,n=e.target;n.removeEventListener("dispose",ce),ue(t=n),Y.remove(t)}function ue(e){var t=Y.get(e).program;(e.program=void 0)!==t&&y.releaseProgram(t)}this.shadowMap=oe,this.getContext=function(){return X},this.getContextAttributes=function(){return X.getContextAttributes()},this.forceContextLoss=function(){var e=A.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=A.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(e){void 0!==e&&(ee=e,this.setSize(J,$,!1))},this.getSize=function(){return{width:J,height:$}},this.setSize=function(e,t,n){V.isPresenting()?console.warn("v3d.WebGLRenderer: Can't change size while VR device is presenting."):(J=e,$=t,r.width=e*ee,r.height=t*ee,!1!==n&&(r.style.width=e+"px",r.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(){return{width:J*ee,height:$*ee}},this.setDrawingBufferSize=function(e,t,n){J=e,$=t,ee=n,r.width=e*n,r.height=t*n,this.setViewport(0,0,e,t)},this.getCurrentViewport=function(){return N},this.setViewport=function(e,t,n,r){O.set(e,$-t-r,n,r),H.viewport(N.copy(O).multiplyScalar(ee))},this.setScissor=function(e,t,n,r){I.set(e,$-t-r,n,r),H.scissor(R.copy(I).multiplyScalar(ee))},this.setScissorTest=function(e){H.setScissorTest(D=e)},this.getClearColor=function(){return v.getClearColor()},this.setClearColor=function(){v.setClearColor.apply(v,arguments)},this.getClearAlpha=function(){return v.getClearAlpha()},this.setClearAlpha=function(){v.setClearAlpha.apply(v,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=X.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=X.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=X.STENCIL_BUFFER_BIT),X.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){r.removeEventListener("webglcontextlost",se,!1),r.removeEventListener("webglcontextrestored",le,!1),d.dispose(),p.dispose(),Y.dispose(),m.dispose(),V.dispose(),me.stop()},this.renderBufferImmediate=function(e,t){H.initAttributes();var n=Y.get(e);e.hasPositions&&!n.position&&(n.position=X.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=X.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=X.createBuffer()),e.hasColors&&!n.color&&(n.color=X.createBuffer());var r=t.getAttributes();e.hasPositions&&(X.bindBuffer(X.ARRAY_BUFFER,n.position),X.bufferData(X.ARRAY_BUFFER,e.positionArray,X.DYNAMIC_DRAW),H.enableAttribute(r.position),X.vertexAttribPointer(r.position,3,X.FLOAT,!1,0,0)),e.hasNormals&&(X.bindBuffer(X.ARRAY_BUFFER,n.normal),X.bufferData(X.ARRAY_BUFFER,e.normalArray,X.DYNAMIC_DRAW),H.enableAttribute(r.normal),X.vertexAttribPointer(r.normal,3,X.FLOAT,!1,0,0)),e.hasUvs&&(X.bindBuffer(X.ARRAY_BUFFER,n.uv),X.bufferData(X.ARRAY_BUFFER,e.uvArray,X.DYNAMIC_DRAW),H.enableAttribute(r.uv),X.vertexAttribPointer(r.uv,2,X.FLOAT,!1,0,0)),e.hasColors&&(X.bindBuffer(X.ARRAY_BUFFER,n.color),X.bufferData(X.ARRAY_BUFFER,e.colorArray,X.DYNAMIC_DRAW),H.enableAttribute(r.color),X.vertexAttribPointer(r.color,3,X.FLOAT,!1,0,0)),H.disableUnusedAttributes(),X.drawArrays(X.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,a){var o=i.isMesh&&i.normalMatrix.determinant()<0;H.setMaterial(r,o);var s=xe(e,t,r,i),l=!1;C.geometry===n.id&&C.program===s.id&&C.wireframe===(!0===r.wireframe)||(C.geometry=n.id,C.program=s.id,C.wireframe=!0===r.wireframe,l=!0),i.morphTargetInfluences&&(S.update(i,n,r,s),l=!0);var c,u=n.index,h=n.attributes.position,d=1;!0===r.wireframe&&(u=T.getWireframeAttribute(n),d=2);var p=E;null!==u&&(c=M.get(u),(p=L).setIndex(c)),l&&(!function(e,t,n){if(n&&n.isInstancedBufferGeometry&!W.isWebGL2&&null===A.get("ANGLE_instanced_arrays"))return console.error("v3d.WebGLRenderer.setupVertexAttributes: using v3d.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");H.initAttributes();var r=n.attributes,i=t.getAttributes(),a=e.defaultAttributeValues;for(var o in i){var s=i[o];if(0<=s){var l=r[o];if(void 0!==l){var c=l.normalized,u=l.itemSize,h=M.get(l);if(void 0===h)continue;var d=h.buffer,p=h.type,f=h.bytesPerElement;if(l.isInterleavedBufferAttribute){var m=l.data,v=m.stride,g=l.offset;m&&m.isInstancedInterleavedBuffer?(H.enableAttributeAndDivisor(s,m.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=m.meshPerAttribute*m.count)):H.enableAttribute(s),X.bindBuffer(X.ARRAY_BUFFER,d),X.vertexAttribPointer(s,u,p,c,v*f,g*f)}else l.isInstancedBufferAttribute?(H.enableAttributeAndDivisor(s,l.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):H.enableAttribute(s),X.bindBuffer(X.ARRAY_BUFFER,d),X.vertexAttribPointer(s,u,p,c,0,0)}else if(void 0!==a){var y=a[o];if(void 0!==y)switch(y.length){case 2:X.vertexAttrib2fv(s,y);break;case 3:X.vertexAttrib3fv(s,y);break;case 4:X.vertexAttrib4fv(s,y);break;default:X.vertexAttrib1fv(s,y)}}}}H.disableUnusedAttributes()}(r,s,n),null!==u&&X.bindBuffer(X.ELEMENT_ARRAY_BUFFER,c.buffer));var f=1/0;null!==u?f=u.count:void 0!==h&&(f=h.count);var m=n.drawRange.start*d,v=n.drawRange.count*d,g=null!==a?a.start*d:0,y=null!==a?a.count*d:1/0,x=Math.max(m,g),_=Math.min(f,m+v,g+y)-1,b=Math.max(0,_-x+1);if(0!==b){if(i.isMesh)if(!0===r.wireframe)H.setLineWidth(r.wireframeLinewidth*z()),p.setMode(X.LINES);else switch(i.drawMode){case Pt:p.setMode(X.TRIANGLES);break;case Nt:p.setMode(X.TRIANGLE_STRIP);break;case Rt:p.setMode(X.TRIANGLE_FAN)}else if(i.isLine){var w=r.linewidth;void 0===w&&(w=1),H.setLineWidth(w*z()),i.isLineSegments?p.setMode(X.LINES):i.isLineLoop?p.setMode(X.LINE_LOOP):p.setMode(X.LINE_STRIP)}else i.isPoints?p.setMode(X.POINTS):i.isSprite&&p.setMode(X.TRIANGLES);s.beginTimerQuery(X),n&&n.isInstancedBufferGeometry?0<n.maxInstancedCount&&p.renderInstances(n,x,b):p.render(x,b),s.endTimerQuery(X)}},this.compile=function(n,e){(j=p.get(n,e)).init(),n.traverse(function(e){e.isLight&&(j.pushLight(e),e.castShadow&&j.pushShadow(e))}),j.setupLights(e),n.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var t=0;t<e.material.length;t++)ye(e.material[t],n.fog,e);else ye(e.material,n.fog,e)})};var he=null;var de,pe,fe,me=new Bn;function ve(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,c=void 0===r?o.material:r,u=o.group;if(n.isArrayCamera)for(var h=(P=n).cameras,d=0,p=h.length;d<p;d++){var f=h[d];if(s.layers.test(f.layers)){if("viewport"in f)H.viewport(N.copy(f.viewport));else{var m=f.bounds,v=m.x*J,g=m.y*$,y=m.z*J,x=m.w*$;H.viewport(N.set(v,g,y,x).multiplyScalar(ee))}j.setupLights(f),ge(s,t,f,l,c,u)}}else P=null,ge(s,t,n,l,c,u)}}function ge(e,t,n,r,i,a){if(e.onBeforeRender(q,t,n,r,i,a),j=p.get(t,P||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){H.setMaterial(i);var o=xe(n,t.fog,i,e);C.geometry=null,C.program=null,C.wireframe=!1,s=o,e.render(function(e){q.renderBufferImmediate(e,s)})}else q.renderBufferDirect(n,t.fog,r,i,e,a);var s;e.onAfterRender(q,t,n,r,i,a),j=p.get(t,P||n)}function ye(e,t,n){var r=Y.get(e),i=j.state.lights,a=j.state.shadowsArray,o=r.lightsHash,s=i.state.hash,l=y.getParameters(e,i.state,a,t,te.numPlanes,te.numIntersection,n),c=y.getProgramCode(e,l),u=r.program,h=!0;if(void 0===u)e.addEventListener("dispose",ce);else if(u.code!==c)ue(e);else if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,h=!1;else{if(void 0!==l.shaderID)return;h=!1}if(h){if(l.shaderID){var d=Un[l.shaderID];r.shader={name:e.type,uniforms:Nn.clone(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}}else r.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(r.shader,q),c=y.getProgramCode(e,l),u=y.acquireProgram(e,r.shader,l,c),r.program=u,e.program=u}var p=u.getAttributes();if(e.morphTargets)for(var f=e.numSupportedMorphTargets=0;f<q.maxMorphTargets;f++)0<=p["morphTarget"+f]&&e.numSupportedMorphTargets++;if(e.morphNormals)for(f=e.numSupportedMorphNormals=0;f<q.maxMorphNormals;f++)0<=p["morphNormal"+f]&&e.numSupportedMorphNormals++;var m=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=te.numPlanes,r.numIntersection=te.numIntersection,m.clippingPlanes=te.uniform),r.fog=t,void 0===o&&(r.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,e.lights&&(m.ambientLightColor.value=i.state.ambient,m.directionalLights.value=i.state.directional,m.spotLights.value=i.state.spot,m.rectAreaLights.value=i.state.rectArea,m.pointLights.value=i.state.point,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotShadowMatrix.value=i.state.spotShadowMatrix,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix),e.nodeValue&&(m.nodeValue.value=e.nodeValue),e.nodeRGBArr&&(m.nodeRGB.value=e.nodeRGBArr);var v=r.program.getUniforms(),g=Pa.seqWithValue(v.seq,m);r.uniformsList=g}function xe(e,t,n,r){K=0;var i=Y.get(n),a=j.state.lights,o=i.lightsHash,s=a.state.hash;if(ne&&(re||e!==Z)){var l=e===Z&&n.id===Q;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,i,l)}if(!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==t?n.needsUpdate=!0:(!n.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===i.numClippingPlanes||i.numClippingPlanes===te.numPlanes&&i.numIntersection===te.numIntersection)||(n.needsUpdate=!0)),n.needsUpdate&&(ye(n,t,r),n.needsUpdate=!1,n.nodeRGBArr))for(var c=0;c<n.nodeRGB.length;c++){n.nodeRGB[c].toArray(n.nodeRGBArr,4*c)}var u,h,d,p,f,m,v,g,y,x,_,b,w,A,M,T,S,E,L,C,P=!1,N=!1,R=!1,F=i.program,O=F.getUniforms(),I=i.shader.uniforms;if(H.useProgram(F.program)&&(R=N=P=!0),n.id!==Q&&(Q=n.id,N=!0),P||Z!==e){if(O.setValue(X,"projectionMatrix",e.projectionMatrix),W.logarithmicDepthBuffer&&O.setValue(X,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),Z!==e&&(Z=e,R=N=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNodeMaterial||n.envMap){var D=O.map.cameraPosition;void 0!==D&&D.setValue(X,ae.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isMeshNodeMaterial||n.skinning)&&O.setValue(X,"viewMatrix",e.matrixWorldInverse),n.isMeshNodeMaterial&&O.setValue(X,"invViewMatrix",e.matrixWorld)}if(n.skinning){O.setOptional(X,r,"bindMatrix"),O.setOptional(X,r,"bindMatrixInverse");var U=r.skeleton;if(U){var B=U.bones;if(W.floatVertexTextures){if(void 0===U.boneTexture){var z=Math.sqrt(4*B.length);z=Yt.ceilPowerOfTwo(z),z=Math.max(z,4);var k=new Float32Array(z*z*4);k.set(U.boneMatrices);var G=new wn(k,z,z,qe,ke);G.needsUpdate=!0,U.boneMatrices=k,U.boneTexture=G,U.boneTextureSize=z}O.setValue(X,"boneTexture",U.boneTexture),O.setValue(X,"boneTextureSize",U.boneTextureSize)}else O.setOptional(X,U,"boneMatrices")}}if(n.needsBoundingBox){var V=r.geometry;V&&(null===V.boundingBox&&V.computeBoundingBox(),O.setValue(X,"boundingBoxMin",V.boundingBox.min),O.setValue(X,"boundingBoxMax",V.boundingBox.max))}return N&&(O.setValue(X,"toneMappingExposure",q.toneMappingExposure),O.setValue(X,"toneMappingWhitePoint",q.toneMappingWhitePoint),n.lights&&(C=R,(L=I).ambientLightColor.needsUpdate=C,L.directionalLights.needsUpdate=C,L.pointLights.needsUpdate=C,L.spotLights.needsUpdate=C,L.rectAreaLights.needsUpdate=C,L.hemisphereLights.needsUpdate=C),t&&n.fog&&(E=t,(S=I).fogColor.value=E.color,E.isFog?(S.fogNear.value=E.near,S.fogFar.value=E.far):E.isFogExp2&&(S.fogDensity.value=E.density)),n.isMeshBasicMaterial?_e(I,n):n.isMeshLambertMaterial?(_e(I,n),M=I,(T=n).emissiveMap&&(M.emissiveMap.value=T.emissiveMap)):n.isMeshPhongMaterial?(_e(I,n),n.isMeshToonMaterial?(be(w=I,A=n),A.gradientMap&&(w.gradientMap.value=A.gradientMap)):be(I,n)):n.isMeshStandardMaterial?(_e(I,n),n.isMeshPhysicalMaterial?(we(_=I,b=n),_.reflectivity.value=b.reflectivity,_.clearCoat.value=b.clearCoat,_.clearCoatRoughness.value=b.clearCoatRoughness):we(I,n)):n.isMeshMatcapMaterial?(_e(I,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(I,n)):n.isMeshDepthMaterial?(_e(I,n),y=I,(x=n).displacementMap&&(y.displacementMap.value=x.displacementMap,y.displacementScale.value=x.displacementScale,y.displacementBias.value=x.displacementBias)):n.isMeshDistanceMaterial?(_e(I,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(I,n)):n.isMeshNormalMaterial?(_e(I,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(I,n)):n.isLineBasicMaterial?(g=n,(v=I).diffuse.value=g.color,v.opacity.value=g.opacity,n.isLineDashedMaterial&&(m=n,(f=I).dashSize.value=m.dashSize,f.totalSize.value=m.dashSize+m.gapSize,f.scale.value=m.scale)):n.isPointsMaterial?(p=n,(d=I).diffuse.value=p.color,d.opacity.value=p.opacity,d.size.value=p.size*ee,d.scale.value=.5*$,d.map.value=p.map,null!==p.map&&(!0===p.map.matrixAutoUpdate&&p.map.updateMatrix(),d.uvTransform.value.copy(p.map.matrix))):n.isSpriteMaterial?(h=n,(u=I).diffuse.value=h.color,u.opacity.value=h.opacity,u.rotation.value=h.rotation,u.map.value=h.map,null!==h.map&&(!0===h.map.matrixAutoUpdate&&h.map.updateMatrix(),u.uvTransform.value.copy(h.map.matrix))):n.isShadowMaterial?(I.color.value=n.color,I.opacity.value=n.opacity):n.isMeshMaskMaterial?(_e(I,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.cameraNearFar.value=t.cameraNearFar,e.depthTexture.value=t.depthTexture,e.textureMatrix.value=t.textureMatrix}(I,n)):n.isMeshNodeMaterial?function(e,t,n){n.envMap&&(e.envMap.value=n.envMap,e.envMapIntensity.value=n.envMapIntensity,e.flipEnvMap.value=n.envMap&&n.envMap.isCubeTexture?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio,e.maxMipLevel.value=Y.get(n.envMap).__maxMipLevel);for(var r in n.nodeTextures)t.setValue(X,r,n.nodeTextures[r]);n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias)}(I,O,n):n.isMeshLineMaterial&&function(e,t){e.lineWidth.value=t.lineWidth,e.sizeAttenuation.value=t.sizeAttenuation,e.color.value=t.color,e.opacity.value=t.opacity,e.useMap.value=t.useMap,t.map&&(e.map.value=t.map);e.useAlphaMap.value=t.useAlphaMap,t.alphaMap&&(e.alphaMap.value=t.alphaMap);e.resolution.value.set(J,$),e.visibility.value=t.visibility,e.alphaTest.value=t.alphaTest,e.repeat.value=t.repeat}(I,n),void 0!==I.ltc_1&&(I.ltc_1.value=Dn.LTC_1),void 0!==I.ltc_2&&(I.ltc_2.value=Dn.LTC_2),Pa.upload(X,i.uniformsList,I,q)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Pa.upload(X,i.uniformsList,I,q),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&O.setValue(X,"center",r.center),n.isMeshNodeMaterial&&(ie.getInverse(r.matrixWorld),O.setValue(X,"invModelMatrix",ie)),O.setValue(X,"modelViewMatrix",r.modelViewMatrix),O.setValue(X,"normalMatrix",r.normalMatrix),O.setValue(X,"modelMatrix",r.matrixWorld),F}function _e(e,t){var n;e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=Y.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function be(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function we(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Me&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Me&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}me.setAnimationLoop(function(e){V.isPresenting()||he&&he(e)}),"undefined"!=typeof window&&me.setContext(window),this.setAnimationLoop=function(e){he=e,V.setAnimationLoop(e),me.start()},this.render=function(e,t,n,r){if(t&&t.isCamera){if(!x){C.geometry=null,C.program=null,C.wireframe=!1,Q=-1,!(Z=null)===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),V.enabled&&(t=V.getCamera(t)),(j=p.get(e,t)).init(),e.onBeforeRender(q,e,t,n),B.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),U.setFromMatrix(B),re=this.localClippingEnabled,ne=te.init(this.clippingPlanes,re,t),(f=d.get(e,t)).init(),function e(t,n,r){t.isAnnotationControl&&t.update(n);if(t.visible){var i=t.layers.test(n.layers);if(i)if(t.isLight)j.pushLight(t),t.castShadow&&j.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||U.intersectsSprite(t)){r&&ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B);var a=m.update(t),o=t.material;f.push(t,a,o,ae.z,null)}}else if(t.isImmediateRenderObject)r&&ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B),f.push(t,null,t.material,ae.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||U.intersectsObject(t))){r&&ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B);var a=m.update(t),o=t.material;if(Array.isArray(o))for(var s=a.groups,l=0,c=s.length;l<c;l++){var u=s[l],h=o[u.materialIndex];h&&h.visible&&f.push(t,a,h,ae.z,u)}else o.visible&&f.push(t,a,o,ae.z,null)}}else var i=!1;if(t.disableChildRendering)return;var d=t.children;for(var l=0,c=d.length;l<c;l++){var p=d[l];!i&&p.isMesh&&p.isMaterialGeneratedMesh||e(p,n,r)}}(e,t,q.sortObjects),!0===q.sortObjects&&f.sort(),ne&&te.beginShadows();var i=j.state.shadowsArray;oe.render(i,e,t),j.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0===n&&(n=null),this.setRenderTarget(n),v.render(f,e,t,r);var a=f.opaque,o=f.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&ve(a,e,t,s),o.length&&ve(o,e,t,s)}else a.length&&ve(a,e,t),o.length&&ve(o,e,t);n&&h.updateRenderTargetMipmap(n),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1),e.onAfterRender(q,e,t),V.enabled&&V.submitFrame(),j=f=null}}else console.error("v3d.WebGLRenderer.render: camera is not an instance of v3d.Camera.")},this.allocTextureUnit=function(){var e=K;return e>=W.maxTextures&&console.warn("v3d.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+W.maxTextures),K+=1,e},this.setTexture2D=(de=!1,function(e,t){e&&e.isWebGLRenderTarget&&(de||(console.warn("v3d.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),de=!0),e=e.texture),h.setTexture2D(e,t)}),this.setTexture3D=function(e,t){h.setTexture3D(e,t)},this.setTexture=(pe=!1,function(e,t){pe||(console.warn("v3d.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),pe=!0),h.setTexture2D(e,t)}),this.setTextureCube=(fe=!1,function(e,t){e&&e.isWebGLRenderTargetCube&&(fe||(console.warn("v3d.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),fe=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?h.setTextureCube(e,t):h.setTextureCubeDynamic(e,t)}),this.setFramebuffer=function(e){_=e},this.getRenderTarget=function(){return b},this.setRenderTarget=function(e){(b=e)&&void 0===Y.get(e).__webglFramebuffer&&h.setupRenderTarget(e);var t=_,n=!1;if(e){var r=Y.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=r[e.activeCubeFace],n=!0):t=r,N.copy(e.viewport),R.copy(e.scissor),F=e.scissorTest}else N.copy(O).multiplyScalar(ee),R.copy(I).multiplyScalar(ee),F=D;if(w!==t&&(X.bindFramebuffer(X.FRAMEBUFFER,t),w=t),H.viewport(N),H.scissor(R),H.setScissorTest(F),n){var i=Y.get(e.texture);X.framebufferTexture2D(X.FRAMEBUFFER,X.COLOR_ATTACHMENT0,X.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,i.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,r,i,a){if(e&&e.isWebGLRenderTarget){var o=Y.get(e).__webglFramebuffer;if(o){var s=!1;o!==w&&(X.bindFramebuffer(X.FRAMEBUFFER,o),s=!0);try{var l=e.texture,c=l.format,u=l.type;if(c!==qe&&g.convert(c)!==X.getParameter(X.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Oe||g.convert(u)===X.getParameter(X.IMPLEMENTATION_COLOR_READ_TYPE)||u===ke&&(W.isWebGL2||A.get("OES_texture_float")||A.get("WEBGL_color_buffer_float"))||u===Ge&&(W.isWebGL2?A.get("EXT_color_buffer_float"):A.get("EXT_color_buffer_half_float"))))return void console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");X.checkFramebufferStatus(X.FRAMEBUFFER)===X.FRAMEBUFFER_COMPLETE?0<=t&&t<=e.width-r&&0<=n&&n<=e.height-i&&X.readPixels(t,n,r,i,g.convert(c),g.convert(u),a):console.error("v3d.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&X.bindFramebuffer(X.FRAMEBUFFER,w)}}}else console.error("v3d.WebGLRenderer.readRenderTargetPixels: renderTarget is not v3d.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){var r=t.image.width,i=t.image.height,a=g.convert(t.format);this.setTexture2D(t,0),X.copyTexImage2D(X.TEXTURE_2D,n||0,a,e.x,e.y,r,i,0)},this.copyTextureToTexture=function(e,t,n,r){var i=t.image.width,a=t.image.height,o=g.convert(n.format),s=g.convert(n.type);this.setTexture2D(n,0),t.isDataTexture?X.texSubImage2D(X.TEXTURE_2D,r||0,e.x,e.y,i,a,o,s,t.image.data):X.texSubImage2D(X.TEXTURE_2D,r||0,e.x,e.y,o,s,t.image)},this.updateGeometry=function(e){return m.update(e)},this.renderObject=ge,this.setCanvas=function(e){r=e,this.domElement=e}}function Oo(e,t){this.name="",this.color=new Fn(e),this.density=void 0!==t?t:25e-5}function Io(e,t,n){this.name="",this.color=new Fn(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Do(){ur.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,this.postprocessing=[]}function Uo(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Bo(e,t,n,r){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function zo(e){wi.call(this),this.type="SpriteMaterial",this.color=new Fn(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function ko(e){if(ur.call(this),this.type="Sprite",void 0===lo){lo=new Wr;var t=new Uo(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);lo.setIndex([0,1,2,0,2,3]),lo.addAttribute("position",new Bo(t,3,0,!1)),lo.addAttribute("uv",new Bo(t,2,3,!1))}this.geometry=lo,this.material=void 0!==e?e:new zo,this.center=new qt(.5,.5)}function Go(){ur.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Vo(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("v3d.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Qt)}}function jo(){ur.call(this),this.type="Bone"}function Xo(e,t){Ei.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Qt,this.bindMatrixInverse=new Qt;var n=new Vo(this.initBones());this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function Wo(e){wi.call(this),this.type="LineBasicMaterial",this.color=new Fn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function Ho(e,t,n){1===n&&console.error("v3d.Line: parameter v3d.LinePieces no longer supported. Use v3d.LineSegments instead."),ur.call(this),this.type="Line",this.geometry=void 0!==e?e:new Wr,this.material=void 0!==t?t:new Wo({color:16777215*Math.random()})}function Yo(e,t){Ho.call(this,e,t),this.type="LineSegments"}function qo(e,t){Ho.call(this,e,t),this.type="LineLoop"}function Qo(e){wi.call(this),this.type="PointsMaterial",this.color=new Fn(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function Zo(e,t){ur.call(this),this.type="Points",this.geometry=void 0!==e?e:new Wr,this.material=void 0!==t?t:new Qo({color:16777215*Math.random()})}function Ko(e,t,n,r,i,a,o,s,l){yn.call(this,e,t,n,r,i,a,o,s,l),this.generateMipmaps=!1}function Jo(e,t,n,r,i,a,o,s,l,c,u,h){yn.call(this,null,a,o,s,l,c,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function $o(e,t,n,r,i,a,o,s,l){yn.call(this,e,t,n,r,i,a,o,s,l),this.needsUpdate=!0}function es(e,t,n,r,i,a,o,s,l,c){if((c=void 0!==c?c:Je)!==Je&&c!==$e)throw new Error("DepthTexture format must be either v3d.DepthFormat or v3d.DepthStencilFormat");void 0===n&&c===Je&&(n=Ue),void 0===n&&c===$e&&(n=We),yn.call(this,null,r,i,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Le,this.minFilter=void 0!==s?s:Le,this.flipY=!1,this.generateMipmaps=!1}function ts(e){Wr.call(this),this.type="WireframeGeometry";var t,n,r,i,a,o,s,l,c,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],l=v[f[(n+1)%3]],d[0]=Math.min(s,l),d[1]=Math.max(s,l),void 0===p[c=d[0]+","+d[1]]&&(p[c]={index1:d[0],index2:d[1]})}for(c in p)o=p[c],u=e.vertices[o.index1],h.push(u.x,u.y,u.z),u=e.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(e&&e.isBufferGeometry){var g,y,x,_,b,w;if(u=new Kt,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(r=(t=(_=x[i]).start)+_.count;t<r;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),l=y.getX(t+(n+1)%3),d[0]=Math.min(s,l),d[1]=Math.max(s,l),void 0===p[c=d[0]+","+d[1]]&&(p[c]={index1:d[0],index2:d[1]});for(c in p)o=p[c],u.fromBufferAttribute(g,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(g,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,r=(g=e.attributes.position).count/3;t<r;t++)for(n=0;n<3;n++)b=3*t+n,u.fromBufferAttribute(g,b),h.push(u.x,u.y,u.z),w=3*t+(n+1)%3,u.fromBufferAttribute(g,w),h.push(u.x,u.y,u.z)}this.addAttribute("position",new Nr(h,3))}function ns(e,t,n){wr.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new rs(e,t,n)),this.mergeVertices()}function rs(e,t,n){Wr.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r,i,a=[],o=[],s=[],l=[],c=new Kt,u=new Kt,h=new Kt,d=new Kt,p=new Kt;e.length<3&&console.error("v3d.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(r=0;r<=n;r++){var m=r/n;for(i=0;i<=t;i++){var v=i/t;e(v,m,u),o.push(u.x,u.y,u.z),0<=v-1e-5?(e(v-1e-5,m,h),d.subVectors(u,h)):(e(v+1e-5,m,h),d.subVectors(h,u)),0<=m-1e-5?(e(v,m-1e-5,h),p.subVectors(u,h)):(e(v,m+1e-5,h),p.subVectors(h,u)),c.crossVectors(d,p).normalize(),s.push(c.x,c.y,c.z),l.push(v,m)}}for(r=0;r<n;r++)for(i=0;i<t;i++){var g=r*f+i,y=r*f+i+1,x=(r+1)*f+i+1,_=(r+1)*f+i;a.push(g,y,_),a.push(y,x,_)}this.setIndex(a),this.addAttribute("position",new Nr(o,3)),this.addAttribute("normal",new Nr(s,3)),this.addAttribute("uv",new Nr(l,2))}function is(e,t,n,r){wr.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new as(e,t,n,r)),this.mergeVertices()}function as(r,a,e,t){Wr.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:r,indices:a,radius:e,detail:t},e=e||1;var u=[],h=[];function o(e,t,n,r){var i,a,o=Math.pow(2,r),s=[];for(i=0;i<=o;i++){s[i]=[];var l=e.clone().lerp(n,i/o),c=t.clone().lerp(n,i/o),u=o-i;for(a=0;a<=u;a++)s[i][a]=0===a&&i===o?l:l.clone().lerp(c,a/u)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var h=Math.floor(a/2);a%2==0?(d(s[i][h+1]),d(s[i+1][h]),d(s[i][h])):(d(s[i][h+1]),d(s[i+1][h+1]),d(s[i+1][h]))}}function d(e){u.push(e.x,e.y,e.z)}function s(e,t){var n=3*e;t.x=r[n+0],t.y=r[n+1],t.z=r[n+2]}function p(e,t,n,r){r<0&&1===e.x&&(h[t]=e.x-1),0===n.x&&0===n.z&&(h[t]=r/2/Math.PI+.5)}function f(e){return Math.atan2(e.z,-e.x)}!function(e){for(var t=new Kt,n=new Kt,r=new Kt,i=0;i<a.length;i+=3)s(a[i+0],t),s(a[i+1],n),s(a[i+2],r),o(t,n,r,e)}(t=t||0),function(e){for(var t=new Kt,n=0;n<u.length;n+=3)t.x=u[n+0],t.y=u[n+1],t.z=u[n+2],t.normalize().multiplyScalar(e),u[n+0]=t.x,u[n+1]=t.y,u[n+2]=t.z}(e),function(){for(var e=new Kt,t=0;t<u.length;t+=3){e.x=u[t+0],e.y=u[t+1],e.z=u[t+2];var n=f(e)/2/Math.PI+.5,r=(i=e,Math.atan2(-i.y,Math.sqrt(i.x*i.x+i.z*i.z))/Math.PI+.5);h.push(n,1-r)}var i;(function(){for(var e=new Kt,t=new Kt,n=new Kt,r=new Kt,i=new qt,a=new qt,o=new qt,s=0,l=0;s<u.length;s+=9,l+=6){e.set(u[s+0],u[s+1],u[s+2]),t.set(u[s+3],u[s+4],u[s+5]),n.set(u[s+6],u[s+7],u[s+8]),i.set(h[l+0],h[l+1]),a.set(h[l+2],h[l+3]),o.set(h[l+4],h[l+5]),r.copy(e).add(t).add(n).divideScalar(3);var c=f(r);p(i,l+0,e,c),p(a,l+2,t,c),p(o,l+4,n,c)}})(),function(){for(var e=0;e<h.length;e+=6){var t=h[e+0],n=h[e+2],r=h[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);.9<i&&a<.1&&(t<.2&&(h[e+0]+=1),n<.2&&(h[e+2]+=1),r<.2&&(h[e+4]+=1))}}()}(),this.addAttribute("position",new Nr(u,3)),this.addAttribute("normal",new Nr(u.slice(),3)),this.addAttribute("uv",new Nr(h,2)),0===t?this.computeVertexNormals():this.normalizeNormals()}function os(e,t){wr.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ss(e,t)),this.mergeVertices()}function ss(e,t){as.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ls(e,t){wr.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new cs(e,t)),this.mergeVertices()}function cs(e,t){as.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function us(e,t){wr.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new hs(e,t)),this.mergeVertices()}function hs(e,t){var n=(1+Math.sqrt(5))/2;as.call(this,[-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],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ds(e,t){wr.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ps(e,t)),this.mergeVertices()}function ps(e,t){var n=(1+Math.sqrt(5))/2,r=1/n;as.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-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],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function fs(e,t,n,r,i,a){wr.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("v3d.TubeGeometry: taper has been removed.");var o=new ms(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function ms(o,s,l,c,e){Wr.call(this),this.type="TubeBufferGeometry",this.parameters={path:o,tubularSegments:s,radius:l,radialSegments:c,closed:e},s=s||64,l=l||1,c=c||8,e=e||!1;var u=o.computeFrenetFrames(s,e);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var i,h,d=new Kt,p=new Kt,t=new qt,f=new Kt,m=[],v=[],n=[],a=[];function r(e){f=o.getPointAt(e/s,f);var t=u.normals[e],n=u.binormals[e];for(h=0;h<=c;h++){var r=h/c*Math.PI*2,i=Math.sin(r),a=-Math.cos(r);p.x=a*t.x+i*n.x,p.y=a*t.y+i*n.y,p.z=a*t.z+i*n.z,p.normalize(),v.push(p.x,p.y,p.z),d.x=f.x+l*p.x,d.y=f.y+l*p.y,d.z=f.z+l*p.z,m.push(d.x,d.y,d.z)}}!function(){for(i=0;i<s;i++)r(i);r(!1===e?s:0),function(){for(i=0;i<=s;i++)for(h=0;h<=c;h++)t.x=i/s,t.y=h/c,n.push(t.x,t.y)}(),function(){for(h=1;h<=s;h++)for(i=1;i<=c;i++){var e=(c+1)*(h-1)+(i-1),t=(c+1)*h+(i-1),n=(c+1)*h+i,r=(c+1)*(h-1)+i;a.push(e,t,r),a.push(t,n,r)}}()}(),this.setIndex(a),this.addAttribute("position",new Nr(m,3)),this.addAttribute("normal",new Nr(v,3)),this.addAttribute("uv",new Nr(n,2))}function vs(e,t,n,r,i,a,o){wr.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},void 0!==o&&console.warn("v3d.TorusKnotGeometry: heightScale has been deprecated. Use .scale(x, y, z) instead."),this.fromBufferGeometry(new gs(e,t,n,r,i,a)),this.mergeVertices()}function gs(e,t,n,r,i,a){Wr.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o,s,l=[],c=[],u=[],h=[],d=new Kt,p=new Kt,f=new Kt,m=new Kt,v=new Kt,g=new Kt,y=new Kt;for(o=0;o<=n;++o){var x=o/n*i*Math.PI*2;for(E(x,i,a,e,f),E(x+.01,i,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=r;++s){var _=s/r*Math.PI*2,b=-t*Math.cos(_),w=t*Math.sin(_);d.x=f.x+(b*y.x+w*v.x),d.y=f.y+(b*y.y+w*v.y),d.z=f.z+(b*y.z+w*v.z),c.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/n),h.push(s/r)}}for(s=1;s<=n;s++)for(o=1;o<=r;o++){var A=(r+1)*(s-1)+(o-1),M=(r+1)*s+(o-1),T=(r+1)*s+o,S=(r+1)*(s-1)+o;l.push(A,M,S),l.push(M,T,S)}function E(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}this.setIndex(l),this.addAttribute("position",new Nr(c,3)),this.addAttribute("normal",new Nr(u,3)),this.addAttribute("uv",new Nr(h,2))}function ys(e,t,n,r,i){wr.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new xs(e,t,n,r,i)),this.mergeVertices()}function xs(e,t,n,r,i){Wr.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var a,o,s=[],l=[],c=[],u=[],h=new Kt,d=new Kt,p=new Kt;for(a=0;a<=n;a++)for(o=0;o<=r;o++){var f=o/r*i,m=a/n*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),l.push(d.x,d.y,d.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),p.subVectors(d,h).normalize(),c.push(p.x,p.y,p.z),u.push(o/r),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=r;o++){var v=(r+1)*a+o-1,g=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.addAttribute("position",new Nr(l,3)),this.addAttribute("normal",new Nr(c,3)),this.addAttribute("uv",new Nr(u,2))}Object.assign(Co.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("v3d.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var r=n||[];return No(e,this,r,t),r.sort(Po),r},intersectObjects:function(e,t,n){var r=n||[];if(!1===Array.isArray(e))return console.warn("v3d.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)No(e[i],this,r,t);return r.sort(Po),r}}),Oo.prototype.isFogExp2=!0,Oo.prototype.clone=function(){return new Oo(this.color,this.density)},Oo.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Io.prototype.isFog=!0,Io.prototype.clone=function(){return new Io(this.color,this.near,this.far)},Io.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Do.prototype=Object.assign(Object.create(ur.prototype),{constructor:Do,copy:function(e,t){return ur.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=ur.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}),Object.defineProperty(Uo.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Uo.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("v3d.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.stride:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}}),Object.defineProperties(Bo.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Bo.prototype,{isInterleavedBufferAttribute:!0,setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}}),((zo.prototype=Object.create(wi.prototype)).constructor=zo).prototype.isSpriteMaterial=!0,zo.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},ko.prototype=Object.assign(Object.create(ur.prototype),{constructor:ko,isSprite:!0,raycast:function(){var l=new Kt,c=new Kt,u=new Kt,o=new qt,s=new qt,h=new Qt,d=new Kt,p=new Kt,f=new Kt,m=new qt,v=new qt,g=new qt;function y(e,t,n,r,i,a){o.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(s.x=a*o.x-i*o.y,s.y=i*o.x+a*o.y):s.copy(o),e.copy(t),e.x+=s.x,e.y+=s.y,e.applyMatrix4(h)}return function(e,t){c.setFromMatrixScale(this.matrixWorld),h.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),u.setFromMatrixPosition(this.modelViewMatrix);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;y(d.set(-.5,-.5,0),u,a,c,n,r),y(p.set(.5,-.5,0),u,a,c,n,r),y(f.set(.5,.5,0),u,a,c,n,r),m.set(0,0),v.set(1,0),g.set(1,1);var o=e.ray.intersectTriangle(d,p,f,!1,l);if(null!==o||(y(p.set(-.5,.5,0),u,a,c,n,r),v.set(0,1),null!==(o=e.ray.intersectTriangle(d,f,p,!1,l)))){var s=e.ray.origin.distanceTo(l);s<e.near||s>e.far||t.push({distance:s,point:l.clone(),uv:Si.getUV(l,d,p,f,m,v,g,new qt),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return ur.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),Go.prototype=Object.assign(Object.create(ur.prototype),{constructor:Go,copy:function(e){ur.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);n.splice(r,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object},raycast:(ho=new Kt,function(e,t){ho.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(ho);this.getObjectForDistance(n).raycast(e,t)}),update:(co=new Kt,uo=new Kt,function(e){var t=this.levels;if(1<t.length){co.setFromMatrixPosition(e.matrixWorld),uo.setFromMatrixPosition(this.matrixWorld);var n=co.distanceTo(uo);t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(;r<i;r++)t[r].object.visible=!1}}),toJSON:function(e){var t=ur.prototype.toJSON.call(this,e);t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Object.assign(Vo.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Qt;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:(po=new Qt,fo=new Qt,function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:fo;po.multiplyMatrices(o,t[i]),po.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)}),clone:function(){return new Vo(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}}),jo.prototype=Object.assign(Object.create(ur.prototype),{constructor:jo,isBone:!0}),Xo.prototype=Object.assign(Object.create(Ei.prototype),{constructor:Xo,isSkinnedMesh:!0,initBones:function(){var e,t,n,r,i=[];if(this.geometry&&void 0!==this.geometry.bones){for(n=0,r=this.geometry.bones.length;n<r;n++)t=this.geometry.bones[n],e=new jo,i.push(e),e.name=t.name,e.position.fromArray(t.pos),e.quaternion.fromArray(t.rotq),void 0!==t.scl&&e.scale.fromArray(t.scl);for(n=0,r=this.geometry.bones.length;n<r;n++)-1!==(t=this.geometry.bones[n]).parent&&null!==t.parent&&void 0!==i[t.parent]?i[t.parent].add(i[n]):this.add(i[n])}return this.updateMatrixWorld(!0),i},bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var e,t;if(this.geometry&&this.geometry.isGeometry)for(t=0;t<this.geometry.skinWeights.length;t++){var n=this.geometry.skinWeights[t];(e=1/n.manhattanLength())!==1/0?n.multiplyScalar(e):n.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var r=new xn,i=this.geometry.attributes.skinWeight;for(t=0;t<i.count;t++)r.x=i.getX(t),r.y=i.getY(t),r.z=i.getZ(t),r.w=i.getW(t),(e=1/r.manhattanLength())!==1/0?r.multiplyScalar(e):r.set(1,0,0,0),i.setXYZW(t,r.x,r.y,r.z,r.w)}},updateMatrixWorld:function(e){Ei.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("v3d.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),((Wo.prototype=Object.create(wi.prototype)).constructor=Wo).prototype.isLineBasicMaterial=!0,Wo.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},Ho.prototype=Object.assign(Object.create(ur.prototype),{constructor:Ho,isLine:!0,computeLineDistances:(yo=new Kt,xo=new Kt,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)yo.fromBufferAttribute(t,r-1),xo.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=yo.distanceTo(xo);e.addAttribute("lineDistance",new Nr(n,1))}else console.warn("v3d.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for((n=e.lineDistances)[0]=0,r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this}),raycast:(mo=new Qt,vo=new Ti,go=new Mn,function(e,t){var n=e.linePrecision,r=this.geometry,i=this.matrixWorld;if(null===r.boundingSphere&&r.computeBoundingSphere(),go.copy(r.boundingSphere),go.applyMatrix4(i),go.radius+=n,!1!==e.ray.intersectsSphere(go)){mo.getInverse(i),vo.copy(e.ray).applyMatrix4(mo);var a=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Kt,l=new Kt,c=new Kt,u=new Kt,h=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var d=r.index,p=r.attributes.position.array;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];s.fromArray(p,3*g),l.fromArray(p,3*y),o<vo.distanceSqToSegment(s,l,u,c)||(u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else for(m=0,v=p.length/3-1;m<v;m+=h)s.fromArray(p,3*m),l.fromArray(p,3*m+3),o<vo.distanceSqToSegment(s,l,u,c)||(u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else if(r.isGeometry){var x=r.vertices,_=x.length;for(m=0;m<_-1;m+=h){var b;o<vo.distanceSqToSegment(x[m],x[m+1],u,c)||(u.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(u))<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}}}}),copy:function(e){return ur.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Yo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:Yo,isLineSegments:!0,computeLineDistances:(_o=new Kt,bo=new Kt,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)_o.fromBufferAttribute(t,r),bo.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+_o.distanceTo(bo);e.addAttribute("lineDistance",new Nr(n,1))}else console.warn("v3d.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,r=0,i=a.length;r<i;r+=2)_o.copy(a[r]),bo.copy(a[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+_o.distanceTo(bo)}return this})}),qo.prototype=Object.assign(Object.create(Ho.prototype),{constructor:qo,isLineLoop:!0}),((Qo.prototype=Object.create(wi.prototype)).constructor=Qo).prototype.isPointsMaterial=!0,Qo.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},Zo.prototype=Object.assign(Object.create(ur.prototype),{constructor:Zo,isPoints:!0,raycast:(wo=new Qt,Ao=new Ti,Mo=new Mn,function(i,a){var o=this,e=this.geometry,s=this.matrixWorld,t=i.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),Mo.copy(e.boundingSphere),Mo.applyMatrix4(s),Mo.radius+=t,!1!==i.ray.intersectsSphere(Mo)){wo.getInverse(s),Ao.copy(i.ray).applyMatrix4(wo);var n=t/((this.scale.x+this.scale.y+this.scale.z)/3),l=n*n,r=new Kt,c=new Kt;if(e.isBufferGeometry){var u=e.index,h=e.attributes.position.array;if(null!==u)for(var d=u.array,p=0,f=d.length;p<f;p++){var m=d[p];r.fromArray(h,3*m),y(r,m)}else{p=0;for(var v=h.length/3;p<v;p++)r.fromArray(h,3*p),y(r,p)}}else{var g=e.vertices;for(p=0,v=g.length;p<v;p++)y(g[p],p)}}function y(e,t){var n=Ao.distanceSqToPoint(e);if(n<l){Ao.closestPointToPoint(e,c),c.applyMatrix4(s);var r=i.ray.origin.distanceTo(c);if(r<i.near||r>i.far)return;a.push({distance:r,distanceToRay:Math.sqrt(n),point:c.clone(),index:t,face:null,object:o})}}}),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ko.prototype=Object.assign(Object.create(yn.prototype),{constructor:Ko,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((Jo.prototype=Object.create(yn.prototype)).constructor=Jo).prototype.isCompressedTexture=!0,(($o.prototype=Object.create(yn.prototype)).constructor=$o).prototype.isCanvasTexture=!0,((es.prototype=Object.create(yn.prototype)).constructor=es).prototype.isDepthTexture=!0,(ts.prototype=Object.create(Wr.prototype)).constructor=ts,(ns.prototype=Object.create(wr.prototype)).constructor=ns,(rs.prototype=Object.create(Wr.prototype)).constructor=rs,(is.prototype=Object.create(wr.prototype)).constructor=is,(as.prototype=Object.create(Wr.prototype)).constructor=as,(os.prototype=Object.create(wr.prototype)).constructor=os,(ss.prototype=Object.create(as.prototype)).constructor=ss,(ls.prototype=Object.create(wr.prototype)).constructor=ls,(cs.prototype=Object.create(as.prototype)).constructor=cs,(us.prototype=Object.create(wr.prototype)).constructor=us,(hs.prototype=Object.create(as.prototype)).constructor=hs,(ds.prototype=Object.create(wr.prototype)).constructor=ds,(ps.prototype=Object.create(as.prototype)).constructor=ps,(fs.prototype=Object.create(wr.prototype)).constructor=fs,(ms.prototype=Object.create(Wr.prototype)).constructor=ms,(vs.prototype=Object.create(wr.prototype)).constructor=vs,(gs.prototype=Object.create(Wr.prototype)).constructor=gs,(ys.prototype=Object.create(wr.prototype)).constructor=ys,(xs.prototype=Object.create(Wr.prototype)).constructor=xs;var _s=function(e,t,n){n=n||2;var r,i,a,o,s,l,c,u=t&&t.length,h=u?t[0]*n:e.length,d=bs(e,0,h,n,!0),p=[];if(!d)return p;if(u&&(d=function(e,t,n,r){var i,a,o,s,l,c=[];for(i=0,a=t.length;i<a;i++)o=t[i]*r,s=i<a-1?t[i+1]*r:e.length,(l=bs(e,o,s,r,!1))===l.next&&(l.steiner=!0),c.push(Ns(l));for(c.sort(Ls),i=0;i<c.length;i++)Cs(c[i],n),n=ws(n,n.next);return n}(e,t,d,n)),e.length>80*n){r=a=e[0],i=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<r&&(r=s),(l=e[f+1])<i&&(i=l),a<s&&(a=s),o<l&&(o=l);c=0!==(c=Math.max(a-r,o-i))?1/c:0}return As(d,p,n,r,i,c),p};function bs(e,t,n,r,i){var a,o;if(i===0<function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r))for(a=t;a<n;a+=r)o=Bs(a,e[a],e[a+1],o);else for(a=n-r;t<=a;a-=r)o=Bs(a,e[a],e[a+1],o);return o&&Os(o,o.next)&&(zs(o),o=o.next),o}function ws(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Os(r,r.next)&&0!==Fs(r.prev,r,r.next))r=r.next;else{if(zs(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function As(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;for(;null===i.z&&(i.z=Ps(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next,i!==e;);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,l,c=1;do{for(n=e,a=e=null,o=0;n;){for(o++,r=n,t=s=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;0<s||0<l&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(n=(i=n).nextZ,s--):(r=(i=r).nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,c*=2}while(1<o)}(i)}(e,r,i,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Ts(e,r,i,a):Ms(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),zs(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?As(e=Ss(e,t,n),t,n,r,i,a,2):2===o&&Es(e,t,n,r,i,a):As(ws(e),t,n,r,i,a,1);break}}}function Ms(e){var t=e.prev,n=e,r=e.next;if(0<=Fs(t,n,r))return!1;for(var i=e.next.next;i!==e.prev;){if(Rs(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=Fs(i.prev,i,i.next))return!1;i=i.next}return!0}function Ts(e,t,n,r){var i=e.prev,a=e,o=e.next;if(0<=Fs(i,a,o))return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,c=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Ps(s,l,t,n,r),d=Ps(c,u,t,n,r),p=e.nextZ;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&Rs(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Fs(p.prev,p,p.next))return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Rs(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Fs(p.prev,p,p.next))return!1;p=p.prevZ}return!0}function Ss(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Os(i,a)&&Is(i,r,r.next,a)&&Ds(i,a)&&Ds(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),zs(r),zs(r.next),r=e=a),r=r.next}while(r!==e);return r}function Es(e,t,n,r,i,a){var o,s,l=e;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&(s=c,(o=l).next.i!==s.i&&o.prev.i!==s.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Is(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(o,s)&&Ds(o,s)&&Ds(s,o)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;for(;n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==e;);return r}(o,s))){var u=Us(l,c);return l=ws(l,l.next),u=ws(u,u.next),As(l,t,n,r,i,a),void As(u,t,n,r,i,a)}c=c.next}l=l.next}while(l!==e)}function Ls(e,t){return e.x-t.x}function Cs(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&o<s){if((o=s)===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n.prev;var l,c=n,u=n.x,h=n.y,d=1/0;r=n.next;for(;r!==c;)i>=r.x&&r.x>=u&&i!==r.x&&Rs(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&((l=Math.abs(a-r.y)/(i-r.x))<d||l===d&&r.x>n.x)&&Ds(r,e)&&(n=r,d=l),r=r.next;return n}(e,t)){var n=Us(t,e);ws(n,n.next)}}function Ps(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ns(e){for(var t=e,n=e;t.x<n.x&&(n=t),(t=t.next)!==e;);return n}function Rs(e,t,n,r,i,a,o,s){return 0<=(i-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(r-s)-(n-o)*(t-s)&&0<=(n-o)*(a-s)-(i-o)*(r-s)}function Fs(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Os(e,t){return e.x===t.x&&e.y===t.y}function Is(e,t,n,r){return!!(Os(e,t)&&Os(n,r)||Os(e,r)&&Os(n,t))||0<Fs(e,t,n)!=0<Fs(e,t,r)&&0<Fs(n,r,e)!=0<Fs(n,r,t)}function Ds(e,t){return Fs(e.prev,e,e.next)<0?0<=Fs(e,t,e.next)&&0<=Fs(e,e.prev,t):Fs(e,t,e.prev)<0||Fs(e,e.next,t)<0}function Us(e,t){var n=new ks(e.i,e.x,e.y),r=new ks(t.i,t.x,t.y),i=e.next,a=t.prev;return(e.next=t).prev=e,(n.next=i).prev=n,(r.next=n).prev=r,(a.next=r).prev=a,r}function Bs(e,t,n,r){var i=new ks(e,t,n);return r?(i.next=r.next,(i.prev=r).next.prev=i,r.next=i):(i.prev=i).next=i,i}function zs(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ks(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Gs={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return Gs.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Vs(e),js(n,e);var a=e.length;t.forEach(Vs);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,js(n,t[o]);var s=_s(n,r);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function Vs(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function js(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Xs(e,t){wr.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Ws(e,t)),this.mergeVertices()}function Ws(e,Z){Wr.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:Z},e=Array.isArray(e)?e:[e];for(var K=this,J=[],$=[],t=0,n=e.length;t<n;t++){r(e[t])}function r(e){var r=[],t=void 0!==Z.curveSegments?Z.curveSegments:12,l=void 0!==Z.steps?Z.steps:1,n=void 0!==Z.depth?Z.depth:100,i=void 0===Z.bevelEnabled||Z.bevelEnabled,a=void 0!==Z.bevelThickness?Z.bevelThickness:6,o=void 0!==Z.bevelSize?Z.bevelSize:a-2,c=void 0!==Z.bevelSegments?Z.bevelSegments:3,s=Z.extrudePath,u=void 0!==Z.UVGenerator?Z.UVGenerator:Hs;void 0!==Z.amount&&(console.warn("v3d.ExtrudeBufferGeometry: amount has been renamed to depth."),n=Z.amount);var h,d,p,f,m,v,g,y,x=!1;s&&(h=s.getSpacedPoints(l),i=!(x=!0),d=s.computeFrenetFrames(l,!1),p=new Kt,f=new Kt,m=new Kt),i||(o=a=c=0);var _=e.extractPoints(t),b=_.shape,w=_.holes;if(!Gs.isClockWise(b))for(b=b.reverse(),g=0,y=w.length;g<y;g++)v=w[g],Gs.isClockWise(v)&&(w[g]=v.reverse());var A=Gs.triangulateShape(b,w),M=b;for(g=0,y=w.length;g<y;g++)v=w[g],b=b.concat(v);function T(e,t,n){return t||console.error("v3d.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var S,E,L,C,P,N,R=b.length,F=A.length;function O(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=o*o+s*s,h=o*c-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(r=f+o*v-e.x)*r+(i=m+s*v-e.y)*i;if(g<=2)return new qt(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),a=y?(r=-s,i=o,Math.sqrt(u)):(r=o,i=s,Math.sqrt(u/2))}return new qt(r/a,i/a)}for(var I=[],D=0,U=M.length,B=U-1,z=D+1;D<U;D++,B++,z++)B===U&&(B=0),z===U&&(z=0),I[D]=O(M[D],M[B],M[z]);var k,G,V=[],j=I.concat();for(g=0,y=w.length;g<y;g++){for(v=w[g],k=[],D=0,B=(U=v.length)-1,z=D+1;D<U;D++,B++,z++)B===U&&(B=0),z===U&&(z=0),k[D]=O(v[D],v[B],v[z]);V.push(k),j=j.concat(k)}for(S=0;S<c;S++){for(L=S/c,C=a*Math.cos(L*Math.PI/2),E=o*Math.sin(L*Math.PI/2),D=0,U=M.length;D<U;D++)W((P=T(M[D],I[D],E)).x,P.y,-C);for(g=0,y=w.length;g<y;g++)for(v=w[g],k=V[g],D=0,U=v.length;D<U;D++)W((P=T(v[D],k[D],E)).x,P.y,-C)}for(E=o,D=0;D<R;D++)P=i?T(b[D],j[D],E):b[D],x?(f.copy(d.normals[0]).multiplyScalar(P.x),p.copy(d.binormals[0]).multiplyScalar(P.y),m.copy(h[0]).add(f).add(p),W(m.x,m.y,m.z)):W(P.x,P.y,0);for(G=1;G<=l;G++)for(D=0;D<R;D++)P=i?T(b[D],j[D],E):b[D],x?(f.copy(d.normals[G]).multiplyScalar(P.x),p.copy(d.binormals[G]).multiplyScalar(P.y),m.copy(h[G]).add(f).add(p),W(m.x,m.y,m.z)):W(P.x,P.y,n/l*G);for(S=c-1;0<=S;S--){for(L=S/c,C=a*Math.cos(L*Math.PI/2),E=o*Math.sin(L*Math.PI/2),D=0,U=M.length;D<U;D++)W((P=T(M[D],I[D],E)).x,P.y,n+C);for(g=0,y=w.length;g<y;g++)for(v=w[g],k=V[g],D=0,U=v.length;D<U;D++)P=T(v[D],k[D],E),x?W(P.x,P.y+h[l-1].y,h[l-1].x+C):W(P.x,P.y,n+C)}function X(e,t){var n,r;for(D=e.length;0<=--D;){(r=(n=D)-1)<0&&(r=e.length-1);var i=0,a=l+2*c;for(i=0;i<a;i++){var o=R*i,s=R*(i+1);Y(t+n+o,t+r+o,t+r+s,t+n+s)}}}function W(e,t,n){r.push(e),r.push(t),r.push(n)}function H(e,t,n){q(e),q(t),q(n);var r=J.length/3,i=u.generateTopUV(K,J,r-3,r-2,r-1);Q(i[0]),Q(i[1]),Q(i[2])}function Y(e,t,n,r){q(e),q(t),q(r),q(t),q(n),q(r);var i=J.length/3,a=u.generateSideWallUV(K,J,i-6,i-3,i-2,i-1);Q(a[0]),Q(a[1]),Q(a[3]),Q(a[1]),Q(a[2]),Q(a[3])}function q(e){J.push(r[3*e+0]),J.push(r[3*e+1]),J.push(r[3*e+2])}function Q(e){$.push(e.x),$.push(e.y)}!function(){var e=J.length/3;if(i){var t=0,n=R*t;for(D=0;D<F;D++)H((N=A[D])[2]+n,N[1]+n,N[0]+n);for(n=R*(t=l+2*c),D=0;D<F;D++)H((N=A[D])[0]+n,N[1]+n,N[2]+n)}else{for(D=0;D<F;D++)H((N=A[D])[2],N[1],N[0]);for(D=0;D<F;D++)H((N=A[D])[0]+R*l,N[1]+R*l,N[2]+R*l)}K.addGroup(e,J.length/3-e,0)}(),function(){var e=J.length/3,t=0;for(X(M,t),t+=M.length,g=0,y=w.length;g<y;g++)X(v=w[g],t),t+=v.length;K.addGroup(e,J.length/3-e,1)}()}this.addAttribute("position",new Nr(J,3)),this.addAttribute("uv",new Nr($,2)),this.computeVertexNormals()}((Xs.prototype=Object.create(wr.prototype)).constructor=Xs).prototype.toJSON=function(){var e=wr.prototype.toJSON.call(this);return Ys(this.parameters.shapes,this.parameters.options,e)},((Ws.prototype=Object.create(Wr.prototype)).constructor=Ws).prototype.toJSON=function(){var e=Wr.prototype.toJSON.call(this);return Ys(this.parameters.shapes,this.parameters.options,e)};var Hs={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],l=t[3*r+1],c=t[3*i],u=t[3*i+1];return[new qt(a,o),new qt(s,l),new qt(c,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*r],u=t[3*r+1],h=t[3*r+2],d=t[3*i],p=t[3*i+1],f=t[3*i+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-u)<.01?[new qt(o,1-l),new qt(c,1-h),new qt(d,1-f),new qt(m,1-g)]:[new qt(s,1-l),new qt(u,1-h),new qt(p,1-f),new qt(v,1-g)]}};function Ys(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function qs(e,t){wr.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Qs(e,t)),this.mergeVertices()}function Qs(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("v3d.TextGeometry: font parameter is not an instance of v3d.Font."),new wr;var r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Ws.call(this,r,t),this.type="TextBufferGeometry"}function Zs(e,t,n,r,i,a,o){wr.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Ks(e,t,n,r,i,a,o)),this.mergeVertices()}function Ks(e,t,n,r,i,a,o){Wr.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var s,l,c=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),u=0,h=[],d=new Kt,p=new Kt,f=[],m=[],v=[],g=[];for(l=0;l<=n;l++){var y=[],x=l/n;for(s=0;s<=t;s++){var _=s/t;d.x=-e*Math.cos(r+_*i)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(r+_*i)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.set(d.x,d.y,d.z).normalize(),v.push(p.x,p.y,p.z),g.push(_,1-x),y.push(u++)}h.push(y)}for(l=0;l<n;l++)for(s=0;s<t;s++){var b=h[l][s+1],w=h[l][s],A=h[l+1][s],M=h[l+1][s+1];(0!==l||0<a)&&f.push(b,w,M),(l!==n-1||c<Math.PI)&&f.push(w,A,M)}this.setIndex(f),this.addAttribute("position",new Nr(m,3)),this.addAttribute("normal",new Nr(v,3)),this.addAttribute("uv",new Nr(g,2))}function Js(e,t,n,r,i,a){wr.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new $s(e,t,n,r,i,a)),this.mergeVertices()}function $s(e,t,n,r,i,a){Wr.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,l,c=[],u=[],h=[],d=[],p=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new Kt,v=new qt;for(s=0;s<=r;s++){for(l=0;l<=n;l++)o=i+l/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,d.push(v.x,v.y);p+=f}for(s=0;s<r;s++){var g=s*(n+1);for(l=0;l<n;l++){var y=o=l+g,x=o+n+1,_=o+n+2,b=o+1;c.push(y,x,b),c.push(x,_,b)}}this.setIndex(c),this.addAttribute("position",new Nr(u,3)),this.addAttribute("normal",new Nr(h,3)),this.addAttribute("uv",new Nr(d,2))}function el(e,t,n,r){wr.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new tl(e,t,n,r)),this.mergeVertices()}function tl(e,t,n,r){Wr.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=Yt.clamp(r,0,2*Math.PI);var i,a,o,s=[],l=[],c=[],u=1/t,h=new Kt,d=new qt;for(a=0;a<=t;a++){var p=n+a*u*r,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,l.push(h.x,h.y,h.z),d.x=a/t,d.y=o/(e.length-1),c.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=i=o+a*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.addAttribute("position",new Nr(l,3)),this.addAttribute("uv",new Nr(c,2)),this.computeVertexNormals(),r===2*Math.PI){var _=this.attributes.normal.array,b=new Kt,w=new Kt,A=new Kt;for(i=t*e.length*3,o=a=0;a<e.length;a++,o+=3)b.x=_[o+0],b.y=_[o+1],b.z=_[o+2],w.x=_[i+o+0],w.y=_[i+o+1],w.z=_[i+o+2],A.addVectors(b,w).normalize(),_[o+0]=_[i+o+0]=A.x,_[o+1]=_[i+o+1]=A.y,_[o+2]=_[i+o+2]=A.z}}function nl(e,t){wr.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("v3d.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new rl(e,t)),this.mergeVertices()}function rl(e,f){Wr.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:f},f=f||12;var m=[],v=[],g=[],y=[],t=0,x=0;if(!1===Array.isArray(e))r(e);else for(var n=0;n<e.length;n++)r(e[n]),this.addGroup(t,x,n),t+=x,x=0;function r(e){var t,n,r,i=v.length/3,a=e.extractPoints(f),o=a.shape,s=a.holes;if(!1===Gs.isClockWise(o))for(o=o.reverse(),t=0,n=s.length;t<n;t++)r=s[t],!0===Gs.isClockWise(r)&&(s[t]=r.reverse());var l=Gs.triangulateShape(o,s);for(t=0,n=s.length;t<n;t++)r=s[t],o=o.concat(r);for(t=0,n=o.length;t<n;t++){var c=o[t];v.push(c.x,c.y,0),g.push(0,0,1),y.push(c.x,c.y)}for(t=0,n=l.length;t<n;t++){var u=l[t],h=u[0]+i,d=u[1]+i,p=u[2]+i;m.push(h,d,p),x+=3}}this.setIndex(m),this.addAttribute("position",new Nr(v,3)),this.addAttribute("normal",new Nr(g,3)),this.addAttribute("uv",new Nr(y,2))}function il(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function al(e,t){Wr.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,i,a,o=[],s=Math.cos(Yt.DEG2RAD*t),l=[0,0],c={},u=["a","b","c"];e.isBufferGeometry?(a=new wr).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],v=0;v<3;v++)n=m[u[v]],r=m[u[(v+1)%3]],l[0]=Math.min(n,r),l[1]=Math.max(n,r),void 0===c[i=l[0]+","+l[1]]?c[i]={index1:l[0],index2:l[1],face1:p,face2:void 0}:c[i].face2=p;for(i in c){var g=c[i];if(void 0===g.face2||d[g.face1].normal.dot(d[g.face2].normal)<=s){var y=h[g.index1];o.push(y.x,y.y,y.z),y=h[g.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new Nr(o,3))}function ol(e,t,n,r,i,a,o,s){wr.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new sl(e,t,n,r,i,a,o,s)),this.mergeVertices()}function sl(g,y,x,_,b,e,w,A){Wr.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:g,radiusBottom:y,height:x,radialSegments:_,heightSegments:b,openEnded:e,thetaStart:w,thetaLength:A};var M=this;g=void 0!==g?g:1,y=void 0!==y?y:1,x=x||1,_=Math.floor(_)||8,b=Math.floor(b)||1,e=void 0!==e&&e,w=void 0!==w?w:0,A=void 0!==A?A:2*Math.PI;var T=[],S=[],E=[],L=[],C=0,P=[],N=x/2,R=0;function t(e){var t,n,r,i=new qt,a=new Kt,o=0,s=!0===e?g:y,l=!0===e?1:-1;for(n=C,t=1;t<=_;t++)S.push(0,N*l,0),E.push(0,l,0),L.push(.5,.5),C++;for(r=C,t=0;t<=_;t++){var c=t/_*A+w,u=Math.cos(c),h=Math.sin(c);a.x=s*h,a.y=N*l,a.z=s*u,S.push(a.x,a.y,a.z),E.push(0,l,0),i.x=.5*u+.5,i.y=.5*h*l+.5,L.push(i.x,i.y),C++}for(t=0;t<_;t++){var d=n+t,p=r+t;!0===e?T.push(p,p+1,d):T.push(p+1,p,d),o+=3}M.addGroup(R,o,!0===e?1:2),R+=o}!function(){var e,t,n=new Kt,r=new Kt,i=0,a=(y-g)/x;for(t=0;t<=b;t++){var o=[],s=t/b,l=s*(y-g)+g;for(e=0;e<=_;e++){var c=e/_,u=c*A+w,h=Math.sin(u),d=Math.cos(u);r.x=l*h,r.y=-s*x+N,r.z=l*d,S.push(r.x,r.y,r.z),n.set(h,a,d).normalize(),E.push(n.x,n.y,n.z),L.push(c,1-s),o.push(C++)}P.push(o)}for(e=0;e<_;e++)for(t=0;t<b;t++){var p=P[t][e],f=P[t+1][e],m=P[t+1][e+1],v=P[t][e+1];T.push(p,f,v),T.push(f,m,v),i+=6}M.addGroup(R,i,0),R+=i}(),!1===e&&(0<g&&t(!0),0<y&&t(!1)),this.setIndex(T),this.addAttribute("position",new Nr(S,3)),this.addAttribute("normal",new Nr(E,3)),this.addAttribute("uv",new Nr(L,2))}function ll(e,t,n,r,i,a,o){ol.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function cl(e,t,n,r,i,a,o){sl.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function ul(e,t,n,r){wr.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new hl(e,t,n,r)),this.mergeVertices()}function hl(e,t,n,r){Wr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,a,o=[],s=[],l=[],c=[],u=new Kt,h=new qt;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var d=n+a/t*r;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,c.push(h.x,h.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.addAttribute("position",new Nr(s,3)),this.addAttribute("normal",new Nr(l,3)),this.addAttribute("uv",new Nr(c,2))}(qs.prototype=Object.create(wr.prototype)).constructor=qs,(Qs.prototype=Object.create(Ws.prototype)).constructor=Qs,(Zs.prototype=Object.create(wr.prototype)).constructor=Zs,(Ks.prototype=Object.create(Wr.prototype)).constructor=Ks,(Js.prototype=Object.create(wr.prototype)).constructor=Js,($s.prototype=Object.create(Wr.prototype)).constructor=$s,(el.prototype=Object.create(wr.prototype)).constructor=el,(tl.prototype=Object.create(Wr.prototype)).constructor=tl,((nl.prototype=Object.create(wr.prototype)).constructor=nl).prototype.toJSON=function(){var e=wr.prototype.toJSON.call(this);return il(this.parameters.shapes,e)},((rl.prototype=Object.create(Wr.prototype)).constructor=rl).prototype.toJSON=function(){var e=Wr.prototype.toJSON.call(this);return il(this.parameters.shapes,e)},(al.prototype=Object.create(Wr.prototype)).constructor=al,(ol.prototype=Object.create(wr.prototype)).constructor=ol,(sl.prototype=Object.create(Wr.prototype)).constructor=sl,(ll.prototype=Object.create(ol.prototype)).constructor=ll,(cl.prototype=Object.create(sl.prototype)).constructor=cl,(ul.prototype=Object.create(wr.prototype)).constructor=ul,(hl.prototype=Object.create(Wr.prototype)).constructor=hl;var dl=Object.freeze({WireframeGeometry:ts,ParametricGeometry:ns,ParametricBufferGeometry:rs,TetrahedronGeometry:os,TetrahedronBufferGeometry:ss,OctahedronGeometry:ls,OctahedronBufferGeometry:cs,IcosahedronGeometry:us,IcosahedronBufferGeometry:hs,DodecahedronGeometry:ds,DodecahedronBufferGeometry:ps,PolyhedronGeometry:is,PolyhedronBufferGeometry:as,TubeGeometry:fs,TubeBufferGeometry:ms,TorusKnotGeometry:vs,TorusKnotBufferGeometry:gs,TorusGeometry:ys,TorusBufferGeometry:xs,TextGeometry:qs,TextBufferGeometry:Qs,SphereGeometry:Zs,SphereBufferGeometry:Ks,RingGeometry:Js,RingBufferGeometry:$s,PlaneGeometry:qr,PlaneBufferGeometry:Qr,LatheGeometry:el,LatheBufferGeometry:tl,ShapeGeometry:nl,ShapeBufferGeometry:rl,ExtrudeGeometry:Xs,ExtrudeBufferGeometry:Ws,EdgesGeometry:al,ConeGeometry:ll,ConeBufferGeometry:cl,CylinderGeometry:ol,CylinderBufferGeometry:sl,CircleGeometry:ul,CircleBufferGeometry:hl,BoxGeometry:Hr,BoxBufferGeometry:Yr});function pl(e){wi.call(this),this.type="ShadowMaterial",this.color=new Fn(0),this.transparent=!0,this.setValues(e)}function fl(e){Mi.call(this,e),this.type="RawShaderMaterial"}function ml(e){wi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Fn(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function vl(e){ml.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function gl(e){wi.call(this),this.type="MeshPhongMaterial",this.color=new Fn(16777215),this.specular=new Fn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function yl(e){gl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function xl(e){wi.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function _l(e){wi.call(this),this.type="MeshLambertMaterial",this.color=new Fn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=j,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function bl(e){if(wi.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Fn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Vt,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e),null===this.matcap){var t=document.createElement("canvas");t.width=1,t.height=1;var n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,1,1),this.matcap=new v3d.CanvasTexture(t)}}function wl(e){Wo.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}function Al(e){wi.call(this),this.type="MeshMaskMaterial",this.skinning=!1,this.morphTargets=!1,this.side=ne,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}((pl.prototype=Object.create(wi.prototype)).constructor=pl).prototype.isShadowMaterial=!0,pl.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this},((fl.prototype=Object.create(Mi.prototype)).constructor=fl).prototype.isRawShaderMaterial=!0,((ml.prototype=Object.create(wi.prototype)).constructor=ml).prototype.isMeshStandardMaterial=!0,ml.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((vl.prototype=Object.create(ml.prototype)).constructor=vl).prototype.isMeshPhysicalMaterial=!0,vl.prototype.copy=function(e){return ml.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},((gl.prototype=Object.create(wi.prototype)).constructor=gl).prototype.isMeshPhongMaterial=!0,gl.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((yl.prototype=Object.create(gl.prototype)).constructor=yl).prototype.isMeshToonMaterial=!0,yl.prototype.copy=function(e){return gl.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},((xl.prototype=Object.create(wi.prototype)).constructor=xl).prototype.isMeshNormalMaterial=!0,xl.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((_l.prototype=Object.create(wi.prototype)).constructor=_l).prototype.isMeshLambertMaterial=!0,_l.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((bl.prototype=Object.create(wi.prototype)).constructor=bl).prototype.isMeshMatcapMaterial=!0,bl.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},((wl.prototype=Object.create(Wo.prototype)).constructor=wl).prototype.isLineDashedMaterial=!0,wl.prototype.copy=function(e){return Wo.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},((Al.prototype=Object.create(wi.prototype)).constructor=Al).prototype.isMeshMaskMaterial=!0,Al.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this};var Ml={};!function(c){c.less=function(e,t,n){return n(e,t)<0},c.exchange=function(e,t,n){var r=e[t];e[t]=e[n],e[n]=r};var u=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t};c.StackNode=function(e){this.value=e,this.next=null};var e=function(){this.N=0,this.first=null};e.prototype.push=function(e){this.first=this._push(this.first,e)},e.prototype._push=function(e,t){if(null==e)return this.N++,new c.StackNode(t);var n=e;return this.N++,(e=new c.StackNode(t)).next=n,e},e.prototype.pop=function(){if(null!=this.first){var e=this.first,t=e.value;return this.first=e.next,this.N--,t}},e.prototype.size=function(){return this.N},e.prototype.isEmpty=function(){return 0==this.N},e.prototype.peep=function(){if(null!=this.first)return this.first.value},e.prototype.toArray=function(){for(var e=[],t=this.first;null!=t;)e.push(t.value),t=t.next;return e},c.Stack=e;c.QueueNode=function(e){this.value=e,this.next=null};var t=function(){this.first=null,this.last=null,this.N=0};t.prototype.enqueue=function(e){var t=this.last;this.last=new c.QueueNode(e),null!=t&&(t.next=this.last),null==this.first&&(this.first=this.last),this.N++},t.prototype.dequeue=function(){if(null!=this.first){var e=this.first,t=e.value;return this.first=e.next,null==this.first&&(this.last=null),this.N--,t}},t.prototype.size=function(){return this.N},t.prototype.isEmpty=function(){return 0==this.N},t.prototype.toArray=function(){for(var e=[],t=this.first;null!=t;)e.push(t.value),t=t.next;return e},c.Queue=t;var n=function(e){this.s=[],this.N=0,e||(e=function(e,t){return e-t}),this.compare=e};n.prototype.enqueue=function(e){for(;this.s.lengh<=this.N+1;)this.s.push(0);this.s[++this.N]=e,this.swim(this.N)},n.prototype.swim=function(e){for(;1<e;){var t=Math.floor(e/2);if(!c.less(this.s[e],this.s[t],this.compare))break;c.exchange(this.s,e,t),e=t}},n.prototype.delMin=function(){if(0!=this.N){var e=this.s[1];return c.exchange(this.s,1,this.N--),this.sink(1),e}},n.prototype.sink=function(e){for(;2*e<=this.N;){var t=2*e;if(t<this.N&&c.less(this.s[t+1],this.s[t],this.compare)&&t++,!c.less(this.s[t],this.s[e],this.compare))break;c.exchange(this.s,t,e),e=t}},n.prototype.size=function(){return this.N},n.prototype.isEmpty=function(){return 0==this.N},c.MinPQ=n;var r=function(e){this.id=[];for(var t=0;t<e;++t)this.id.push(t)};r.prototype.union=function(e,t){var n=this.root(e),r=this.root(t);r!=n&&(this.id[r]=n)},r.prototype.root=function(e){for(;this.id[e]!=e;)e=this.id[e];return e},r.prototype.connected=function(e,t){return this.root(e)==this.root(t)},c.QuickUnion=r;var i=function(e,t){this.keys=[],this.pq=[],this.qp=[];for(var n=0;n<=e;++n)this.keys.push(null),this.pq.push(0),this.qp.push(-1);this.N=0,t||(t=function(e,t){return e-t}),this.compare=t};i.prototype.insert=function(e,t){this.keys[e]=t,this.pq[++this.N]=e,this.qp[e]=this.N,this.swim(this.N)},i.prototype.decreaseKey=function(e,t){c.less(t,this.keys[e],this.compare)&&(this.keys[e]=t,this.swim(this.qp[e]))},i.prototype.minKey=function(){return this.keys[this.pq[1]]},i.prototype.min=function(){return this.pq[1]},i.prototype.delMin=function(){var e=this.pq[1];return c.exchange(this.pq,1,this.N),this.qp[this.pq[1]]=1,this.qp[this.pq[this.N]]=-1,this.keys[this.pq[this.N]]=null,this.N--,this.sink(1),e},i.prototype.swim=function(e){for(;1<e;){var t=Math.floor(e/2);if(!c.less(this.keys[this.pq[e]],this.keys[this.pq[t]],this.compare))break;c.exchange(this.pq,e,t),this.qp[this.pq[e]]=e,e=this.qp[this.pq[t]]=t}},i.prototype.sink=function(e){for(;2*e<=this.N;){var t=2*e;if(t<this.N&&c.less(this.keys[this.pq[t+1]],this.keys[this.pq[t]],this.compare)&&t++,!c.less(this.keys[this.pq[t]],this.keys[this.pq[e]],this.compare))break;c.exchange(this.pq,e,t),this.qp[this.pq[e]]=e,e=this.qp[this.pq[t]]=t}},i.prototype.containsIndex=function(e){return-1!=this.qp[e]},i.prototype.isEmpty=function(){return 0==this.N},i.prototype.size=function(){return this.N},c.IndexMinPQ=i;c.LinkMapNode=function(e){this.value=e,this.prev=null,this.next=null};var a=function(){this.first=null,this.last=null,this.map={}};a.prototype.push=function(e,t){this.map[t]=e,null===this.first?this.first=e:(this.last.next=e).prev=this.last,this.last=e},a.prototype.removeNodeByKey=function(e){var t=this.map[e],n=t.prev,r=t.next;null!==n&&null!==r?(n.next=r).prev=n:null===n&&null!==r?(this.first=r).prev=null:null!==n&&null===r?(this.last=n).next=null:(this.first=null,this.last=null),delete this.map[e]},c.LinkMap=a;var o=function(e){this.V=e,this.adjList=[],this.nodeInfo=[],this.edges={};for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};o.prototype.addNewEdge=function(e,t){this.adjList[e].push(t),this.adjList[t].push(e);var n=e+"_"+t;t<e&&(n=t+"_"+e),this.edges[n]=new c.Edge(e,t,0)},o.prototype.adj=function(e){return this.adjList[e]},o.prototype.node=function(e){return this.nodeInfo[e]},o.prototype.len=function(){return this.V},o.prototype.edge=function(e,t){var n=e+"_"+t;return t<e&&(n=t+"_"+e),n in this.edges?this.edges[n]:null},c.Graph=o;var h=function(e){this.V=e,this.adjList=[],this.nodeInfo=[],this.edges={};for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};h.prototype.addNode=function(e){e=e||{},this.V++,this.adjList.push([]),this.nodeInfo.push(e)},h.prototype.addNewEdge=function(e,t){this.adjList[e].push(t);var n=e+"_"+t,r=new c.Edge(e,t,0);return this.edges[n]=r},h.prototype.addEdge=function(e){var t=e.v,n=e.w;this.adjList[t].push(n);var r=t+"_"+n;this.edges[r]=e},h.prototype.edge=function(e,t){var n=e+"_"+t;return n in this.edges?this.edges[n]:null},h.prototype.adj=function(e){return this.adjList[e]},h.prototype.node=function(e){return this.nodeInfo[e]},h.prototype.nodeIndex=function(e){for(var t=0;t<this.V;++t)if(this.nodeInfo[t]==e)return t;return-1},h.prototype.reverse=function(){for(var e=new h(this.V),t=0;t<this.V;++t)for(var n=this.adjList[t],r=0;r<n.length;++r){var i=n[r];e.addNewEdge(i,t)}return e},h.prototype.len=function(){return this.V},h.prototype.findInEdges=function(e){for(var t=[],n=0;n<this.V;n++)for(var r=this.adjList[n],i=0;i<r.length;i++)r[i]==e&&t.push(this.edge(n,e));return t},h.prototype.findOutEdges=function(e){for(var t=[],n=this.adjList[e],r=0;r<n.length;r++)t.push(this.edge(e,n[r]));return t},h.prototype.disconnect=function(e,t){this.adjList[e].splice(0);for(var n=0;n<this.V;n++){for(var r=this.adjList[n],i=0;i<r.length;i++)r[i]==e&&(r.splice(i,1),i--);var a=n+"_"+e;a in this.edges&&delete this.edges[a],(a=e+"_"+n)in this.edges&&delete this.edges[a]}if(t){var o=new h(this.V-1);for(n=0;n<this.V;n++)if(n!=e)for(r=this.adjList[n],i=0;i<r.length;i++){var s=r[i],l=e<n?n-1:n,c=e<s?s-1:s,u=this.edge(n,s).copy();u.v=l,u.w=c,o.addEdge(u)}this.V--,this.adjList=o.adjList,this.nodeInfo.splice(e,1),this.edges=o.edges}},h.prototype.insert=function(e,t,n){for(var r=this.V,i=e.V,a=0;a<i;a++){this.adjList.push([]),this.nodeInfo.push(u(e.nodeInfo[a]));for(var o=e.adjList[a],s=0;s<o.length;s++){var l=o[s];(c=e.edge(a,l).copy()).v+=r,c.w+=r,this.addEdge(c)}}this.V+=i;for(s=0;s<t.length;s++){(c=t[s].copy()).w+=r,this.addEdge(c)}for(s=0;s<n.length;s++){var c;(c=n[s].copy()).v+=r,this.addEdge(c)}},h.prototype.vis=function(e){e=e||function(e,t){return String(e)};for(var t="digraph G {",n=0;n<this.V;n++){t+=n+' [label="'+e(n,this.nodeInfo[n])+'"];';for(var r=this.adjList[n],i=0;i<r.length;i++){t+=n+" -> "+r[i]+";"}}t+="}",console.log(t)},c.DiGraph=h;var s=function(e,t,n){this.v=e,this.w=t,this.weight=n};s.prototype.either=function(){return this.v},s.prototype.other=function(e){return e==this.v?this.w:this.v},s.prototype.from=function(){return this.v},s.prototype.to=function(){return this.w},s.prototype.copy=function(){var e=new s(0,0,0);for(var t in this)this.hasOwnProperty(t)&&(e[t]=this[t]);return e},c.Edge=s;var l=function(e){this.V=e,this.adjList=[],this.nodeInfo=[];for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};l.prototype.adj=function(e){return this.adjList[e]},l.prototype.edge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;++r){if(n[r].other(e)==t)return n[r]}return null},l.prototype.node=function(e){return this.nodeInfo[e]},l.prototype.addNewEdge=function(e){var t=e.either(),n=e.other(t);this.adjList[t].push(e),this.adjList[n].push(e)},c.WeightedGraph=l;var d=function(e){l.call(this,e)};(d.prototype=Object.create(c.WeightedGraph.prototype)).addNewEdge=function(e){var t=e.from();this.adjList[t].push(e)},d.prototype.edge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;++r){if(n[r].other(e)==t)return n[r]}return null},d.prototype.toDiGraph=function(){for(var e=new c.DiGraph(this.V),t=0;t<this.V;++t)for(var n=this.adjList[t],r=0;r<n.length;++r){var i=n[r].other(t);e.addNewEdge(t,i)}return e},c.WeightedDiGraph=d;var p=function(e,t,n){this.v=e,this.w=t,this.capacity=n,this.flow=0};p.prototype.residualCapacityTo=function(e){return e==this.v?this.flow:this.capacity-this.flow},p.prototype.addResidualFlowTo=function(e,t){e==this.v?this.flow-=t:e==this.w&&(this.flow+=t)},p.prototype.from=function(){return this.v},p.prototype.to=function(){return this.w},p.prototype.other=function(e){return e==this.v?this.w:this.v},c.FlowEdge=p;var f=function(e){this.V=e,this.adjList=[],this.nodeInfo=[];for(var t=0;t<e;++t)this.adjList.push([]),this.nodeInfo.push({})};f.prototype.node=function(e){return this.nodeInfo[e]},f.prototype.edge=function(e,t){for(var n=this.adjList[e],r=0;r<n.length;++r){if(n[r].other(e)==t)return n[r]}return null},f.prototype.addNewEdge=function(e){var t=e.from();this.adjList[t].push(e);var n=e.other(t);this.adjList[n].push(e)},f.prototype.adj=function(e){return this.adjList[e]},c.FlowNetwork=f;var m=function(e,t){this.s=t;var n=e.V;this.marked=[],this.edgeTo=[];for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(-1);this.dfs(e,t)};m.prototype.dfs=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||(this.edgeTo[i]=t,this.dfs(e,i))}},m.prototype.hasPathTo=function(e){return this.marked[e]},m.prototype.pathTo=function(e){var t=new c.Stack;if(e==this.s)return[e];for(var n=e;n!=this.s;n=this.edgeTo[n])t.push(n);return t.push(this.s),t.toArray()},c.DepthFirstSearch=m;var v=function(e,t){var n=e.V;this.s=t;var r=new c.Queue;r.enqueue(t),this.marked=[],this.edgeTo=[];for(var i=0;i<n;++i)this.marked.push(!1),this.edgeTo.push(-1);for(;!r.isEmpty();){i=r.dequeue();this.marked[i]=!0;for(var a=e.adj(i),o=0;o<a.length;++o){var s=a[o];this.marked[s]||(this.edgeTo[s]=i,r.enqueue(s))}}};v.prototype.hasPathTo=function(e){return this.marked[e]},v.prototype.pathTo=function(e){var t=new c.Stack;if(e==this.s)return[e];for(var n=e;n!=this.s;n=this.edgeTo[n])t.push(n);return t.push(this.s),t.toArray()},c.BreadthFirstSearch=v;var g=function(e){this.count=0;var t=e.V;this.marked=[],this.id=[];for(var n=0;n<t;++n)this.marked.push(!1),this.id.push(-1);for(n=0;n<t;++n)this.marked[n]||(this.dfs(e,n),this.count++)};g.prototype.dfs=function(e,t){this.marked[t]=!0,this.id[t]=this.count;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||this.dfs(e,i)}},g.prototype.componentId=function(e){return this.id[e]},g.prototype.componentCount=function(){return this.count},c.ConnectedComponents=g;var y=function(e){this.postOrder=new c.Stack,this.marked=[];for(var t=e.V,n=0;n<t;++n)this.marked.push(!1);for(n=0;n<t;++n)this.marked[n]||this.dfs(e,n)};y.prototype.dfs=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||this.dfs(e,i)}this.postOrder.push(t)},y.prototype.order=function(){return this.postOrder.toArray()},c.TopologicalSort=y;var x=function(e){var t=e.V;this.count=0,this.marked=[],this.id=[];for(var n=0;n<t;++n)this.marked.push(!1),this.id.push(-1);for(var r=new c.TopologicalSort(e.reverse()).order(),i=0;i<r.length;++i){n=r[i];this.marked[n]||(this.dfs(e,n),this.count++)}};x.prototype.dfs=function(e,t){this.marked[t]=!0,this.id[t]=this.count;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i]||this.dfs(e,i)}},x.prototype.componentId=function(e){return this.id[e]},x.prototype.componentCount=function(){return this.count},c.StronglyConnectedComponents=x;c.KruskalMST=function(e){for(var t=e.V,n=new c.MinPQ(function(e,t){return e.weight-t.weight}),r=0;r<e.V;++r)for(var i=e.adj(r),a=0;a<i.length;++a)(s=i[a]).either()==r&&n.enqueue(s);this.mst=[];for(var o=new c.QuickUnion(t);!n.isEmpty()&&this.mst.length<t-1;){r=(s=n.delMin()).either();var s,l=s.other(r);o.connected(r,l)||(o.union(r,l),this.mst.push(s))}};var _=function(e){var t=e.V;this.marked=[];for(var n=0;n<t;++n)this.marked.push(!1);for(this.pq=new c.MinPQ(function(e,t){return e.weight-t.weight}),this.mst=[],this.visit(e,0);!this.pq.isEmpty()&&this.mst.length<t-1;){var r=this.pq.delMin(),i=(n=r.either(),r.other(n));this.marked[n]&&this.marked[i]||(this.mst.push(r),this.marked[n]||this.visit(e,n),this.marked[i]||this.visit(e,i))}};_.prototype.visit=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r];this.marked[i.other(t)]||this.pq.enqueue(i)}},c.LazyPrimMST=_;var b=function(e){var t=e.V;this.pq=new c.IndexMinPQ(t,function(e,t){return e.weight-t.weight}),this.marked=[];for(var n=0;n<t;++n)this.marked.push(!1);for(this.mst=[],this.visit(e,0);!this.pq.isEmpty();){var r=this.pq.minKey(),i=this.pq.delMin();this.mst.push(r),this.marked[i]||this.visit(e,i)}};b.prototype.visit=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r<n.length;++r){var i=n[r],a=i.other(t);this.marked[a]||(this.pq.containsIndex(a)?this.pq.decreaseKey(a,i):this.pq.insert(a,i))}},c.EagerPrimMST=b;var w=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[],this.pq=new c.IndexMinPQ(n,function(e,t){return t});for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(null),this.cost.push(Number.MAX_VALUE);for(this.cost[t]=0,this.pq.insert(t,this.cost[t]);!this.pq.isEmpty();){r=this.pq.delMin();this.marked[r]=!0;for(var i=e.adj(r),a=0;a<i.length;++a){var o=i[a];this.relax(o)}}};w.prototype.relax=function(e){var t=e.from(),n=e.to();this.cost[n]>this.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.edgeTo[n]=e,this.pq.containsIndex(n)?this.pq.decreaseKey(n,this.cost[n]):this.pq.insert(n,this.cost[n]))},w.prototype.hasPathTo=function(e){return this.marked[e]},w.prototype.pathTo=function(e){for(var t=new c.Stack,n=e;n!=this.s;n=this.edgeTo[n].from())t.push(this.edgeTo[n]);return t.toArray()},w.prototype.distanceTo=function(e){return this.cost[e]},c.Dijkstra=w;var A=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[];for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(null),this.cost.push(Number.MAX_VALUE);this.cost[t]=0,this.marked[t]=!0;for(var i=0;i<n;++i)for(r=0;r<n;++r)for(var a=e.adj(r),o=0;o<a.length;++o){var s=a[o];this.relax(s)}};A.prototype.relax=function(e){var t=e.from(),n=e.to();this.cost[n]>this.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.marked[n]=!0,this.edgeTo[n]=e)},A.prototype.hasPathTo=function(e){return this.marked[e]},A.prototype.pathTo=function(e){for(var t=new c.Stack,n=e;n!=this.s;n=this.edgeTo[n].from())t.push(this.edgeTo[n]);return t.toArray()},A.prototype.distanceTo=function(e){return this.cost[e]},c.BellmanFord=A;var M=function(e,t){var n=e.V;this.s=t,this.marked=[],this.edgeTo=[],this.cost=[];for(var r=0;r<n;++r)this.marked.push(!1),this.edgeTo.push(null),this.cost.push(Number.MAX_VALUE);this.cost[t]=0,this.marked[t]=!0;for(var i=new c.TopologicalSort(e.toDiGraph()).order(),a=0;a<i.length;++a){r=i[a];for(var o=e.adj(r),s=0;s<o.length;++s){var l=o[s];this.relax(l)}}};M.prototype.relax=function(e){var t=e.from(),n=e.to();this.cost[n]>this.cost[t]+e.weight&&(this.cost[n]=this.cost[t]+e.weight,this.marked[n]=!0,this.edgeTo[n]=e)},M.prototype.hasPathTo=function(e){return this.marked[e]},M.prototype.pathTo=function(e){for(var t=new c.Stack,n=e;n!=this.s;n=this.edgeTo[n].from())t.push(this.edgeTo[n]);return t.toArray()},M.prototype.distanceTo=function(e){return this.cost[e]},c.TopologicalSortShortestPaths=M;var T=function(e,t,n){this.value=0;e.V;var r=Number.MAX_VALUE;for(this.marked=null,this.edgeTo=null,this.s=t,this.t=n;this.hasAugmentedPath(e);){for(var i=this.t;i!=this.s;i=this.edgeTo[i].from())r=Math.min(r,this.edgeTo[i].residualCapacityTo(i));for(i=this.t;i!=this.s;i=this.edgeTo[i].from())this.edgeTo[i].addResidualFlowTo(i,r);this.value+=r}};T.prototype.hasAugmentedPath=function(e){var t=e.V;this.marked=[],this.edgeTo=[];for(var n=0;n<t;++n)this.marked.push(!1),this.edgeTo.push(null);var r=new c.Queue;for(r.enqueue(this.s),this.marked[this.s]=!0;!r.isEmpty();){n=r.dequeue();for(var i=e.adj(n),a=0;a<i.length;++a){var o=i[a],s=o.other(n);if(!this.marked[s]&&0<o.residualCapacityTo(s)){if(this.edgeTo[s]=o,this.marked[s]=!0,s==this.t)return!0;r.enqueue(s)}}}return!1},T.prototype.minCut=function(e){for(var t=[],n=e.V,r=0;r<n;++r)for(var i=e.adj(r),a=0;a<i.length;++a){var o=i[a];o.from()==r&&0==o.residualCapacityTo(o.other(r))&&t.push(o)}return t},c.FordFulkerson=T}(Ml);var Tl=[[-1.117001,-.1867262,-11.13505,12.59865,-.03937339,1.167571,.007100686,3.592678,.6083296,-1.152006,-.1926669,6.152049,-4.770802,-.08704701,.7483626,.03372718,4.464592,.4036546,-1.072371,-.2696632,.2816168,1.820571,-.3742666,2.080607,-.07675295,-2.835366,1.129329,-1.109935,-.1532764,1.198787,-.9015183,.005173015,.5749178,.1075633,4.387949,.2650413,-1.052297,-.2229452,1.952347,.5727205,-4.88507,1.984016,-.1106197,-.4898361,.8907873,-1.070108,-.1600465,1.593886,-4479251e-11,-3.306541,.9390193,.09513168,2.343583,.5335404,-1.113253,-.16996,-10.38822,11.37513,-.04040911,1.037455,.04991792,4.801919,.630271,-1.135747,-.1678594,4.970755,-4.43023,-.06657408,.3636161,.1558009,6.01337,.3959601,-1.095892,-.2732595,.7666496,1.350731,-.4401401,2.470135,-.1707929,-3.260793,1.170337,-1.073668,-.02603929,-.1944589,.4575207,.6878164,-.139077,.3690299,7.885781,.1877694,-1.070091,-.2798957,2.338478,-2.647221,-7.387808,2.32921,-.1644639,-2.00371,.9874527,-1.06712,-.1418866,1.25409,6.053048,-2.918892,.5322812,.1613053,3.018161,.527409,-1.129483,-.1890619,-9.065101,9.659923,-.03607819,.8314359,.08181661,4.768868,.6339777,-1.14642,-.1883579,3.309173,-3.127882,-.06938176,.3987113,.1400581,6.283042,.5267076,-1.128348,-.2641305,1.223176,.05514952,-.3490649,1.997784,-.04123709,-2.251251,.9483466,-1.02582,.0140469,-1.187406,2.7299,.5877588,-.276114,.4602633,8.305125,.3945001,-1.083957,-.2606679,2.207108,-7.202803,-5.968103,2.129455,-.07789512,-1.137688,.8871769,-1.062465,-.1512189,1.042881,14.27839,-4.242214,.40381,.199778,2.814449,.5803196,-1.175099,-.2410789,-11.08587,11.33404,-.018193,.6772942,.09605043,4.231166,.6239972,-1.224207,-.2883527,3.002206,-2.649612,-.04795418,.4984398,.03251434,4.851611,.6551019,-1.136955,-.2423048,1.058823,-.2489236,-.2462179,1.93314,.09106828,-.1905869,.8171065,-1.014535,-.0082625,-1.448017,2.295788,.3510334,-1.477418,.5432449,5.762796,.4908751,-1.070666,-.237978,1.844589,-5.442448,-4.012768,2.945275,.009854725,.08455959,.814503,-1.071525,-.1777132,.807659,9.925865,-3.324623,-.6367437,.2844581,2.248384,.6544022,-1.218818,-.2952382,-13.45975,13.47153,-.006814585,.5079068,.119723,3.776949,.5836961,-1.409868,-.511433,2.776539,-2.039001,-.02673769,.4145288,.0007829342,2.275883,.6629691,-1.069151,-.09434247,.7293972,-1.222473,-.1533461,2.160357,.04626837,3.852415,.859357,-1.021306,-.1149551,-1.108414,4.178343,.4013665,-2.222814,.6929462,1.392652,.4401662,-1.074251,-.2224002,1.372356,-8.858704,-3.92266,3.020018,-.01458724,1.511186,.8288064,-1.062048,-.1526582,.4921067,14.85522,-3.229936,-.8426604,.3916243,2.678994,.6689264,-1.257023,-.33647,-15.27795,15.04223,.002717715,.302991,.1636851,3.561663,.5283161,-1.635124,-.7329993,3.523939,-2.566337,-.01902543,.5505483,-.06242176,1.065992,.6654236,-.9295823,.04845834,-.299299,-.2001327,-.08019339,1.807806,.09020277,5.095372,.8639936,-1.09374,-.2148608,-.521624,2.119777,.09506454,-1.831439,.6961204,.1102084,.4384319,-1.044181,-.1849257,.9071246,-4.648901,-2.279385,2.356502,-.04169147,1.932557,.829655,-1.061451,-.1458745,.2952267,8.967214,-3.726228,-.5022316,.5684877,3.102347,.6658443,-1.332391,-.4127769,-9.328643,9.046194,.003457775,.3377425,.1530909,3.301209,.4997917,-1.932002,-.9947777,-2.042329,3.58694,-.05642182,.8130478,-.08195988,.1118294,.5617231,-.8707374,.1286999,1.820054,-4.674706,.003317471,.5919018,.1975278,6.686519,.9631727,-1.070378,-.3030579,-.9041938,6.200201,.1232207,-.3650628,.5029403,-2.903162,.3811408,-1.063035,-.1637545,.5853072,-7.889906,-1.200641,1.035018,.1192093,3.267054,.8416151,-1.053655,-.1562286,.2423683,11.28575,-4.363262,-.0731416,.5642088,2.514023,.6670457,-1.366112,-.4718287,-7.876222,7.7469,-.009182309,.4716076,.08320252,3.165603,.5392334,-2.468204,-1.33634,-5.386723,7.072672,-.08329266,.8636876,-.01978177,-.1326218,.2979222,-.9653522,-.02373416,1.81025,-6.467262,.1410706,-.4753717,.3003095,6.551163,1.151083,-.8943186,-.2487152,-.230896,8.512648,.1298402,1.034705,.2303509,-3.924095,.2982717,-1.146999,-.2318784,.08992419,-9.933614,-.886092,-.03071656,.2852012,3.046199,.8599001,-1.032399,-.1645145,.2683599,13.27701,-4.40767,.07709869,.4951727,1.957277,.6630943,-1.46907,-.6135092,-6.506263,6.661315,-.03835383,.7150413,.007784318,2.820577,.6756784,-2.501583,-1.247404,-15.23462,16.33191,-.01204803,.5896471,-.02002023,1.144647,.06177874,-2.438672,-1.127291,5.731172,-10.2135,.0616561,-.7752641,.4708254,4.176847,1.200881,-.1513427,.09792731,-1.612349,9.814289,.05188921,1.716403,-.07039255,-2.815115,.3291874,-1.318511,-.3650554,.4221268,-9.294529,-.0439752,-.8100625,.3742719,1.834166,.822345,-1.016009,-.1820264,.1278426,11.82696,-4.801528,.4947899,.4660378,1.601254,.6702359,-1.84131,-.9781779,-4.610903,4.824662,-.05100806,.6463776,-6377724e-12,2.216875,.861853,-2.376373,-1.108657,-14.89799,15.46458,.04091025,.0976178,-.01048958,2.165834,-.1609171,-4.710318,-2.261963,6.947327,-10.34828,-.1325542,.7508674,.2247553,2.873142,1.2971,.216375,-.1944345,-2.43786,10.11314,.44505,.3111492,.2751323,-1.627906,.2531213,-1.258794,-.3524641,.8425444,-10.85313,-1.154381,-.4638014,-.002781115,.4344498,.8507091,-1.018938,-.1804153,-.06354054,15.7315,-4.386999,.6211115,.5294648,1.580749,.6586655,-1.116416,-.1917524,-10.68233,12.22221,-.03668978,1.054022,.01592132,3.180583,.562737,-1.132341,-.1671286,5.976499,-4.227366,-.09542489,.8664938,.008351793,4.876068,.4492779,-1.087635,-.3173679,.4314407,1.100555,-.4410057,1.677253,-.03005925,-4.201249,1.070902,-1.083031,-.08847705,1.291773,.4546776,.3091894,.726176,.04203659,5.990615,.3704756,-1.057899,-.2246706,2.329563,-1.219656,-5.33526,.8545378,-.03906209,-.9025499,.7797348,-1.073305,-.1522553,1.767063,1.90428,-3.101673,.3995856,.02905192,2.563977,.5753067,-1.113674,-.1759694,-9.754125,10.87391,-.03841093,.9524272,.05680219,4.227034,.6029571,-1.126496,-.1680281,5.332352,-4.575579,-.06761755,.3295335,.1194896,5.570901,.4536185,-1.103074,-.2681801,.06571479,2.396522,-.455128,2.466331,-.1232022,-3.023201,1.086379,-1.053299,-.02697173,.8379121,-.9681458,.5890692,-.4872027,.2936929,7.510139,.3079122,-1.079553,-.2710448,2.462379,-.3713554,-8.534512,1.828242,-.1686398,-1.96134,.8941077,-1.069741,-.1396394,1.657868,3.236313,-2.706344,-.2948122,.1314816,2.868457,.5413403,-1.131649,-.1954455,-7.751595,8.685861,-.04910871,.8992952,.04710143,4.254818,.6821116,-1.156689,-.1884324,3.163519,-3.091522,-.06613927,-.02575883,.1640065,6.073643,.4453468,-1.079224,-.2621389,.9446437,1.448479,-.3969384,2.626638,-.08101186,-3.016355,1.076295,-1.080832,.01033057,-.3500156,-.03281419,.5655512,-1.156742,.453471,8.774122,.2772869,-1.051202,-.2679975,2.719109,-2.190316,-6.878798,2.250481,-.2030252,-2.026527,.9701096,-1.089849,-.1598589,1.564748,6.869187,-3.05367,-.6110435,.1644472,2.370452,.551177,-1.171419,-.2429746,-8.991334,9.571216,-.02772861,.6688262,.07683478,3.785611,.6347635,-1.228554,-.2917562,2.753986,-2.49178,-.04663434,.3118303,.07546506,4.463096,.5955071,-1.093124,-.2447767,.9097406,.5448296,-.2957824,2.024167,-.0005152333,-1.069081,.9369565,-1.056994,.01569507,-.8217491,1.870818,.706193,-1.483928,.5978206,6.864902,.3673332,-1.054871,-.2758129,2.712807,-5.95011,-6.554039,2.447523,-.1895171,-1.454292,.9131738,-1.100218,-.1746241,1.438505,11.15481,-3.266076,-.8837357,.19701,1.991595,.5907821,-1.207267,-.291361,-11.03767,11.40724,-.014168,.5564047,.08476262,3.371255,.6221335,-1.429698,-.5374218,2.837524,-2.221936,-.02422337,.09313758,.0719025,1.869022,.5609035,-1.002274,-.0697281,.4031308,-.3932997,-.1521923,2.390646,-.0689399,2.999661,1.017843,-1.081168,-.1178666,-.496808,3.919299,.6046866,-2.440615,.7891538,2.140835,.274047,-1.050727,-.2307688,2.276396,-9.454407,-5.505176,2.99262,-.2450942,.6078372,.9606765,-1.103752,-.1810202,1.375044,15.89095,-3.438954,-1.265669,.2475172,1.680768,.5978056,-1.244324,-.3378542,-11.11001,11.37784,-.007896794,.4808023,.09249904,3.025816,.5880239,-1.593165,-.7027621,2.220896,-1.437709,-.01534738,.06286958,.06644555,1.091727,.547008,-.9136506,.01344874,.7772636,-1.209396,-.1408978,2.433718,-.1041938,3.791244,1.037916,-1.134968,-.1803315,-.9267335,4.57667,.6851928,-2.805,.8687208,1.161483,.2571688,-1.017037,-.2053943,2.36164,-9.887818,-5.122889,3.287088,-.2594102,.8578927,.959234,-1.118723,-.1934942,1.226023,16.7414,-3.277335,-1.629809,.2765232,1.637713,.6113963,-1.314779,-.4119915,-12.4115,12.41578,.002344284,.2980837,.1414613,2.781731,.4998556,-1.926199,-1.020038,2.5692,-1.081159,-.02266833,.3588668,.008750078,-.2452171,.4796758,-.7780002,.1850647,.04445456,-2.409297,-.07816346,1.54679,-.02807227,5.998176,1.132396,-1.179326,-.357833,-.2392933,6.467883,.5904596,-1.869975,.8045839,-2.498121,.1610633,-1.009956,-.1311896,1.726577,-12.19356,-3.466239,2.343602,-.2252205,2.573681,1.027109,-1.11246,-.2063093,1.233051,20.58946,-4.578074,-1.145643,.3160192,1.420159,.5860212,-1.371689,-.4914196,-10.7661,11.07405,-.01485077,.5936218,.03685482,2.599968,.6002204,-2.436997,-1.377939,.02130141,1.079593,-.01796232,-.03933248,.1610711,-.6901181,.1206416,-.8743368,.0733137,.8734259,-3.743126,-.03151167,1.297596,-.07634926,6.532873,1.435737,-.9810197,-.3521634,-.2855205,7.134674,.6839748,-1.394841,.6952036,-4.633104,-.02173401,-1.122958,-.1691536,1.38236,-11.02913,-2.608171,1.865111,-.1345154,3.112342,1.094134,-1.075586,-.2077415,1.171477,17.9327,-4.656858,-1.036839,.3338295,1.042793,.5739374,-1.465871,-.6364486,-8.833718,9.34365,-.032236,.7552848,-3121341e-12,2.249164,.8094662,-2.448924,-1.270878,-4.823703,5.853058,-.02149127,.03581132,-.001230276,.4892553,-.1597657,-2.419809,-1.071337,1.575648,-4.98358,.009545185,.5032615,.4186266,4.634147,1.433517,-.1383278,-.02797095,-.1943067,6.679623,.411828,-.2744289,-.02118722,-4.337025,.1505072,-1.341872,-.2518572,1.027009,-6.527103,-1.081271,1.015465,.2845789,2.470371,.927812,-1.04064,-.2367454,1.100744,8.827253,-4.560794,-.7287017,.2842503,.6336593,.6327335,-1.877993,-1.025135,-4.311037,4.715016,-.04711631,.6335844,-7665398e-12,1.788017,.9001409,-2.28154,-1.137668,-10.36869,11.36254,.01961739,-.09836174,-.006734567,1.320918,-.2400807,-4.904054,-2.315781,5.735999,-8.626257,-.1255643,1.545446,.139686,2.972897,1.429934,.4077067,-.1833688,-2.450939,9.119433,.4505361,-1.340828,.397369,-1.78537,.09628711,-1.296052,-.3250526,1.813294,-10.31485,-1.38869,1.239733,-.08989196,-.3389637,.963956,-1.062181,-.2423444,.7577592,15.66938,-4.462264,-.574281,.3262259,.9461672,.6232887],[-1.127942,-.1905548,-12.52356,13.75799,-.03624732,1.055453,.01385036,4.17697,.5928345,-1.15526,-.1778135,6.216056,-5.254116,-.08787445,.8434621,.04025734,6.195322,.3111856,-1.125624,-.3217593,.5043919,1.686284,-.3536071,1.476321,-.07899019,-4.522531,1.271691,-1.081801,-.1033234,.999555,.007482946,-.06776018,1.463141,.09492021,5.612723,.1298846,-1.07532,-.2402711,2.141284,-1.203359,-4.945188,1.437221,-.0809675,-1.028378,1.004164,-1.073337,-.1516517,1.639379,2.304669,-3.214244,1.286245,.05613957,2.480902,.4999363,-1.128399,-.1857793,-10.89863,11.72984,-.03768099,.9439285,.04869335,4.845114,.6119211,-1.114002,-.139928,4.9638,-4.6855,-.07780879,.4049736,.1586297,7.770264,.3449006,-1.185472,-.3403543,.6588322,1.133713,-.4118674,2.061191,-.1882768,-4.372586,1.22353,-1.002272,.02000703,.07073269,1.485075,.5005589,.4301494,.3626541,7.921098,.1574766,-1.121006,-.3007777,2.242051,-4.571561,-7.761071,2.053404,-.1524018,-1.886162,1.018208,-1.058864,-.1358673,1.389667,8.633409,-3.437249,.7295429,.15147,2.842513,.5014325,-1.144464,-.2043799,-10.20188,10.71247,-.03256693,.7860205,.06872719,4.824771,.6259836,-1.170104,-.2118626,4.391405,-4.1989,-.07111559,.3890442,.1024831,6.282535,.5365688,-1.129171,-.255288,.2238298,.7314295,-.356273,1.881931,-.03078716,-1.03912,.9096301,-1.042294,.004450203,-.5116033,2.627589,.6098996,-.1264638,.4325281,7.080503,.4583646,-1.082293,-.2723056,2.065076,-8.143133,-7.892212,2.142231,-.0710624,-1.122398,.8338505,-1.071715,-.1426568,1.095351,17.29783,-3.851931,.4360514,.211444,2.970832,.5944389,-1.195909,-.2590449,-11.91037,12.07947,-.01589842,.6297846,.09054772,4.285959,.5933752,-1.245763,-.3316637,4.29366,-3.694011,-.04699947,.4843684,.02130425,4.097549,.6530809,-1.148742,-.1902509,-.2393233,-.2441254,-.2610918,1.846988,.03532866,2.660106,.8358294,-1.01608,-.0744496,-.5053436,4.388855,.6054987,-1.2083,.5817215,2.54357,.4726568,-1.072027,-.210144,1.518378,-10.60119,-6.016546,2.649475,-.05166992,1.571269,.8344622,-1.072365,-.1511201,.747801,19.00732,-3.950387,-.3473907,.3797211,2.782949,.6296808,-1.239423,-.3136289,-13.511,13.49468,-.007070423,.5012315,.1106008,3.803619,.5577948,-1.452524,-.5676944,2.993153,-2.277288,-.02168954,.305672,.01152338,1.852697,.6427228,-1.061421,-.04590521,.6057022,-1.096835,-.1504952,2.344921,-.05491832,5.268322,.9082253,-1.042373,-.1769498,-1.075388,3.831712,.315414,-2.416458,.7909032,-.01492892,.3854049,-1.064159,-.1892684,1.438685,-8.166362,-3.616364,3.275206,-.1203825,2.039491,.8688057,-1.07012,-.1569508,.412476,13.99683,-3.547085,-1.046326,.4973825,2.791231,.6503286,-1.283579,-.3609518,-13.35397,13.15248,-.0004431938,.3769526,.1429824,3.573613,.4998696,-1.657952,-.7627948,1.958222,-.7949816,-.02882837,.5356149,-.05191946,.8869955,.626332,-.95276,.06494189,.5361303,-2.12959,-.0925863,1.604776,.0506777,6.376055,.9138052,-1.080827,-.252312,-.7154262,4.120085,.1878228,-1.492158,.6881655,-1.446611,.4040631,-1.054075,-.1665498,.9191052,-6.636943,-1.894826,2.10781,-.03680499,2.655452,.841384,-1.061127,-.1448849,.2667493,10.34103,-4.285769,-.3874504,.5998752,3.132426,.6652753,-1.347345,-.4287832,-9.305553,9.133813,-.003173527,.3977564,.115142,3.320564,.4998134,-1.927296,-.9901372,-2.593499,4.087421,-.05833993,.8158929,-.04681279,.2423716,.4938052,-.9470092,.07325237,2.064735,-5.16754,-.01313751,.4832169,.1126295,6.970522,1.035022,-1.022557,-.2762616,-.9375748,6.696739,.2200765,-.1133253,.5492505,-3.109391,.3321914,-1.087444,-.1836263,.6225024,-8.576765,-1.107637,.7859427,.09910909,3.112938,.8596261,-1.051544,-.1546262,.2371731,12.00502,-4.527291,.07268862,.5571478,2.532873,.6662,-1.375576,-.4840019,-8.12129,8.05814,-.01445661,.5123314,.05813321,3.203219,.5442318,-2.325221,-1.241463,-7.06343,8.741369,-.0782995,.8844273,-.03471106,.1740583,.2814079,-1.2287,-.2013412,2.949042,-7.371945,.1071753,-.249197,.2265223,6.391504,1.172389,-.7601786,-.1680631,-.7584444,8.541356,.08222291,.6729633,.3206615,-3.70094,.2710054,-1.191166,-.2672347,.2927498,-9.713613,-.4783721,.2352803,.2161949,2.691481,.8745447,-1.030135,-.1653301,.2263443,12.96157,-4.650644,.007055709,.5091975,2.00037,.6603839,-1.508018,-.6460933,-6.402745,6.545995,-.0375032,.6921803,.003309819,2.797527,.6978446,-2.333308,-1.167837,-17.46787,18.6863,-.008948229,.5621946,-.03402626,1.217943,.01149865,-2.665953,-1.226307,7.169725,-11.59434,.0358342,-.3074378,.3412248,4.422122,1.283791,-.09705116,.08312991,-2.160462,10.28235,.03543357,1.032049,.105831,-2.972898,.2418628,-1.329617,-.3699557,.5560117,-9.730113,.09938865,-.3071488,.2510691,1.777111,.8705142,-1.019387,-.1893247,.1194079,12.39436,-4.799224,.2940213,.4841268,1.529724,.6582615,-1.896737,-1.005442,-6.411032,6.54822,-.03227596,.5717262,-8115192e-12,2.296704,.9000749,-2.411116,-1.225587,-17.53629,18.29393,.01247555,.2364616,-.005114637,1.603778,-.2224156,-4.707121,-2.074977,7.9423,-11.32407,-.05415654,.5446811,.1032493,4.010235,1.369802,.1010482,-.4013305,-2.674579,9.779409,.1782506,.7053045,.4200002,-2.400671,.1953165,-1.243526,-.3391255,.8848882,-9.789025,-.3997324,-.9546227,-.1044017,.6010593,.8714462,-1.014633,-.1730009,-.07738934,13.90903,-4.847307,1.076059,.5685743,1.572992,.6561432,-1.122998,-.1881183,-10.30709,11.58932,-.04079495,.9603774,.03079436,4.009235,.5060745,-1.13479,-.1539688,5.478405,-4.21727,-.1043858,.7165008,.01524765,6.473623,.4207882,-1.134957,-.3513318,.7393837,1.354415,-.4764078,1.690441,-.0549264,-5.563523,1.145743,-1.058344,-.05758503,1.16823,.3269824,.1795193,.7849011,.07441853,6.904804,.281879,-1.075194,-.2355813,2.463685,-1.536505,-7.505771,.9619712,-.06465851,-1.355492,.8489847,-1.07903,-.1465328,1.773838,2.310131,-3.136065,.3507952,.04435014,2.819225,.5689008,-1.125833,-.1870849,-9.555833,10.59713,-.04225402,.9164663,.04338796,4.40098,.6056119,-1.12744,-.1551891,4.755621,-4.408806,-.07851763,.2268284,.146007,7.048003,.3525997,-1.143788,-.3170178,.5480669,2.04183,-.4532139,2.302233,-.1887419,-4.489221,1.250967,-1.032849,.007376031,.5666073,-.2312203,.4862894,-.1748294,.357287,8.380522,.1302333,-1.093728,-.2786977,2.641272,-1.507494,-8.731243,1.684055,-.2023377,-2.176398,1.013249,-1.076578,-.1456205,1.693935,2.945003,-2.822673,-.2520033,.1517034,2.649109,.5179094,-1.146417,-.2119353,-7.187525,8.058599,-.05256438,.8375733,.03887093,4.222111,.6695347,-1.173674,-.2067025,2.899359,-2.804918,-.08473899,.003944225,.1340641,6.160887,.4527141,-1.090098,-.2599633,.9180856,1.09271,-.4215019,2.42766,-.09277667,-2.123523,1.058159,-1.08446,.008056181,-.245351,.6619567,.4668118,-.9526719,.4648454,8.001572,.3054194,-1.053728,-.2765784,2.792388,-3.489517,-8.150535,2.195757,-.2017234,-2.128017,.9326589,-1.099348,-.1593939,1.568292,7.247853,-2.933,-.5890481,.172444,2.433484,.5736558,-1.185983,-.2581184,-7.761056,8.317053,-.03351773,.6676667,.05941733,3.820727,.6324032,-1.268591,-.3398067,2.348503,-2.023779,-.05368458,.1083282,.08402858,3.910254,.5577481,-1.071353,-.1992459,.7878387,.1974702,-.3033058,2.335298,-.08205259,.7954454,.9972312,-1.089513,-.03104364,-.5995746,2.330281,.6581939,-1.821467,.6679973,5.090195,.3125161,-1.040214,-.2570934,2.660489,-6.506045,-7.053586,2.763153,-.2433632,-.7648176,.9452937,-1.116052,-.1831993,1.457694,11.63608,-3.216426,-1.045594,.2285002,1.817407,.5810396,-1.230134,-.3136264,-8.909301,9.145006,-.01055387,.4467317,.1016826,3.342964,.563384,-1.442907,-.5593147,2.156447,-1.241657,-.0351213,.3050274,.01797175,1.742358,.5977153,-1.027627,-.06481539,.4351975,-1.051677,-.2030672,1.942684,-.03615993,4.050266,.9801624,-1.08211,-.1578209,-.3397511,4.163851,.6650368,-1.84173,.7062544,.6789881,.3172623,-1.047447,-.197756,2.183364,-8.805249,-5.483962,2.551309,-.177964,1.519501,.9212536,-1.111853,-.1935736,1.394408,13.92405,-3.46543,-1.068432,.2388671,1.455336,.6233425,-1.262238,-.3546341,-10.08703,10.20084,-.001852187,.353758,.1239199,3.056093,.5132052,-1.61381,-.7355585,2.760123,-1.685253,-.02517552,.2914258,.004743448,.8689596,.5674192,-.9462336,.02950767,-.2613816,-.7398653,-.1315558,1.901042,-.06447844,4.969341,1.027342,-1.111481,-.2194054,-.09004538,3.983442,.4871278,-1.965315,.7956121,-.2363225,.2718037,-1.036397,-.1827106,1.964747,-8.870759,-4.208011,2.461215,-.2158905,1.561676,.9436866,-1.113769,-.1947819,1.30072,15.16476,-4.088732,-1.069384,.2836434,1.671451,.6229612,-1.328069,-.4244047,-8.41704,8.552244,-.006813504,.4127422,.09619897,2.854227,.505988,-1.927552,-1.02529,.9529576,.425595,-.03738779,.2584586,.04911004,-.2640913,.4138626,-.8488094,.1435988,.6356807,-2.895732,-.08473961,1.701305,-.1323908,6.499338,1.210928,-1.128313,-.3397048,-.404314,6.265097,.5482395,-2.057614,.8884087,-2.943879,.09760301,-1.039764,-.1494772,1.781915,-11.53012,-3.379232,2.517231,-.2764393,2.588849,1.05212,-1.108447,-.2012251,1.19864,19.25331,-4.423892,-1.257122,.339569,1.48122,.5880175,-1.374185,-.4967434,-7.401318,7.724021,-.02345723,.5979653,.02436346,2.65897,.6014891,-2.310933,-1.29029,-1.301909,2.557806,-.03744449,.08982861,.1090613,-.4398363,.1184329,-1.12473,-.0992183,1.366902,-4.172489,-.05078016,1.393597,-.09323843,6.452721,1.435913,-.8468477,-.2744819,-.43472,6.713362,.6127133,-1.685634,.7360941,-4.535502,-.02920866,-1.165242,-.2008697,1.438778,-10.08936,-2.214771,2.102909,-.1763085,2.859075,1.09347,-1.074614,-.2066374,1.131891,16.30063,-4.801441,-1.11259,.3595785,1.122227,.579461,-1.521515,-.6835604,-5.571044,6.028774,-.04253715,.6875746,-5279456e-12,2.18015,.8487705,-2.240415,-1.171166,-7.182771,8.417068,-.01932866,.1101887,-.01098862,.6242195,-.2393875,-2.712354,-1.19883,3.1802,-6.76813,-.002563386,.7984607,.2764376,4.695358,1.557045,-.03655172,-.02142321,-.913812,7.932786,.3516542,-.7994343,.1786761,-4.208399,.01820576,-1.36861,-.2656212,1.249397,-8.317818,-.8962772,1.423249,.1478381,2.19166,1.007748,-1.041753,-.2453366,1.061102,11.30172,-4.739312,-.9223334,.2982776,.6162931,.6080302,-1.989159,-1.09516,-2.91555,3.275339,-.05735765,.5742174,-7683288e-12,1.7634,.9001342,-2.07002,-1.086338,-10.95898,12.0696,.03780123,-.01774699,-.0005881348,1.333819,-.2605423,-5.249653,-2.38304,6.160406,-9.097138,-.1955319,1.651785,.0006016463,3.021824,1.493574,.4685432,-.2358662,-2.666433,9.685763,.5804928,-1.521875,.5668989,-1.548136,.01688642,-1.296891,-.3449031,1.928548,-11.6756,-1.627615,1.355603,-.1929074,-.6568952,1.009774,-1.067288,-.2410392,.7147961,17.8384,-4.374399,-.6588777,.3329831,1.012066,.6118645],[-1.310023,-.4407658,-36.4034,36.83292,-.008124762,.5297961,.01188633,3.13832,.5134778,-1.4241,-.5501606,-17.5351,18.22769,-.01539272,.6366826,.002661996,2.659915,.4071138,-1.103436,-.1884105,6.425322,-6.910579,-.02019861,.3553271,-.01589061,5.345985,.8790218,-1.1862,-.4307514,-3.957947,5.979352,-.05348869,1.736117,.03491346,-2.692261,.5610506,-1.006038,-.1305995,4.473513,-3.806719,.1419407,-.02148238,-.05081185,3.735362,.535828,-1.078507,-.1633754,-3.812368,4.3817,.02988122,1.754224,.1472376,3.722798,.4999157,-1.333582,-.4649908,-33.59528,34.04375,-.009384242,.5587511,.00572631,3.073145,.5425529,-1.562624,-.7107068,-14.7817,15.59839,-.01462375,.5050133,.02516017,1.604696,.2902403,-.8930158,.04068077,1.373481,-2.342752,-.02098058,.6248686,-.05258363,7.058214,1.150373,-1.262823,-.4818353,889261e-9,1.92312,-.04979718,1.040693,.1558103,-2.85248,.2420691,-.9968383,-.1200648,1.324342,-.9430889,.1931098,.4436916,-.07320456,4.215931,.7898019,-1.078185,-.1718192,-1.720191,2.358918,.02765637,1.260245,.2021941,3.395483,.5173628,-1.353023,-.4813523,-31.0492,31.40156,-.009510741,.554203,.008135471,3.136646,.5215989,-1.624704,-.7990201,-21.67125,22.46341,-.01163533,.5415746,.02618378,1.139214,.3444357,-.798361,.1417476,9.914841,-10.81503,-.01218845,.3411392,-.06137698,7.445848,1.18008,-1.266679,-.4288977,-5.818701,6.986437,-.08180711,1.397403,.2016916,-1.275731,.2592773,-1.009707,-.1537754,3.496378,-3.013726,.242115,-.2831925,.03003395,3.702862,.774632,-1.075646,-.1768747,-1.347762,1.989004,.01375836,1.76481,.1330018,3.230864,.662621,-1.375269,-.5103569,-34.42661,34.78703,-.008460009,.5408643,.004813323,3.016078,.5062069,-1.821679,-.9766461,-19.26488,19.97912,-.009822567,.3649556,.04316092,.893019,.4166527,-.6633542,.1997841,2.395592,-3.117175,-.01080884,.8983814,-.1375825,6.673463,1.115663,-1.30324,-.3612712,.08292959,.3381364,-.06078648,.3229247,.3680987,.7046755,.3144924,-.9952598,-.2039076,.4026851,.2686684,.1640712,.5186341,-.0120552,2.659613,.8030394,-1.098579,-.2151992,.6558198,-74369e-8,-.001421817,1.073701,.1886875,2.536857,.6673923,-1.457986,-.5906842,-38.12464,38.38539,-.006024357,.4741484,.01209223,2.818432,.5012433,-1.835728,-1.003405,-6.848129,7.601943,-.01277375,.4785598,.03366853,1.097701,.4636635,-.8491348,.009466365,-2.685226,2.00406,-.01168708,.6752316,-.1543371,5.674759,1.039534,-1.083379,-.150679,.7328236,-.5095568,-.08609153,.444882,.4174662,1.481556,.3942551,-1.117089,-.3337605,.2502281,.4036323,.2673899,.2829817,.0224245,2.043207,.7706902,-1.071648,-.21262,.6069466,-.00145629,-.551596,1.046755,.1985021,2.290245,.6876058,-1.483903,-.6309647,-43.80213,44.10537,-.005712161,.5195992,.002028428,2.687114,.5098321,-2.053976,-1.141473,.5109183,.08060391,-.01033983,.4066532,.04869627,1.161722,.4039525,-.6348185,.07651292,-10.31327,10.07598,-.02083688,.7359516,-.2029459,5.013257,1.077649,-1.22863,-.1650496,.04077157,-.7189167,-.0509222,.2959814,.5111496,2.540433,.361533,-1.041883,-.3278413,-.06691911,1.307364,.2166663,.3000595,-.003157136,1.389208,.7999026,-1.103556,-.2443602,.4705347,-.0009296482,-.530992,.9654511,.2142587,2.244723,.6839976,-1.555684,-.6962113,-46.47983,46.7427,-.005034895,.475509,-9.502561e-7,2.626569,.5056194,-1.998288,-1.12472,-1.629586,2.187993,-.008284384,.3845258,.0572624,1.185644,.4255812,-1.03257,-.251385,-3.721112,3.506967,-.02186561,.9436049,-.2451412,4.725724,1.039256,-.8597532,.09073332,-2.553741,1.993237,-.04390891,-.2046928,.5515623,1.909127,.3948212,-1.210482,-.4477622,-.2267805,1.219488,.1336186,.6866897,.02808997,1.600403,.7816409,-1.078168,-.2699261,.2537282,.3820684,-.4425103,.5298235,.2185217,1.728679,.6882743,-1.697968,-.8391488,-57.90105,58.1412,-.00340476,.426514,-1796301e-12,2.368442,.5324429,-2.141552,-1.17223,16.77872,-16.4147,-.005732425,.2002199,.06841834,1.485338,.3215763,-1.442946,-.7264245,-9.503706,9.650462,-.02120995,1.419263,-.2893098,3.860731,1.120857,-.5696752,.3411279,-.2931035,-.6512552,-.1068437,-1.085661,.6107549,1.459503,.3210336,-1.313839,-.5921371,-.2332222,1.648196,.2492787,1.381033,-.01993392,.981256,.8316329,-1.087464,-.3195534,.2902095,.3383709,-.8798482,.01494668,.2529703,1.452644,.669387,-2.068582,-1.118605,-50.81598,50.97486,-.003280669,.4067371,-2544951e-12,2.179497,.5778017,-1.744693,-.8537207,22.34361,-22.08318,-.005932616,.1035049,.05742772,1.97788,.2124846,-3.287515,-2.140268,-12.49566,12.40091,-.02409349,1.397821,-.2371627,2.771192,1.170496,.5502311,1.04663,2.193517,-2.2204,-.1064394,-1.017926,.4795457,1.030644,.3177516,-1.719734,-.9536198,-.6586821,1.386361,-.02513065,1.187011,.06542539,.5296055,.808266,-1.0057,-.3028096,.04470957,1.00776,-.8119016,.03153338,.2311321,1.182208,.6824758,-2.728867,-1.580388,-30.79627,30.92586,-.004197673,.3154759,-3897675e-12,1.920567,.6664791,-1.322495,-.7249275,14.7766,-14.68154,-.009044857,.05624314,.06498392,2.047389,.0636754,-6.102376,-3.473018,-9.926071,9.637797,-.01097909,1.103498,-.2424521,2.520748,1.24026,1.351796,1.018588,2.009081,-1.333394,-.1979125,-.3318292,.4476624,.9095235,.2955611,-1.774467,-1.07988,-.0808468,.2577697,-.1149295,.4975303,.002931611,-.3803171,.8002794,-.9898401,-.2542513,-.07530911,1.870355,-1.521918,.2405164,.2964615,1.3348,.6789053,-1.27973,-.4290674,-42.77972,43.43305,-.006541826,.4945086,.01425338,2.685244,.5011313,-1.449506,-.5766374,-16.88496,17.81118,-.01121649,.354502,.02287338,1.904281,.4936998,-1.02198,-.1897574,2.482462,-2.941725,-.01570448,.7532578,-.042568,5.23966,.4983116,-1.162608,-.3428049,3.974358,-1.527935,-.03919201,.8758593,.07291363,-3.455257,.8007426,-.9929985,-.08712006,-.7397313,1.348372,.09511685,.3233584,-.07549148,5.806452,.4990042,-1.084996,-.1739767,.1580475,.908818,.06871433,.5933079,.1188921,3.074079,.4999327,-1.317009,-.4661946,-42.55347,43.12782,-.005727235,.4285447,.02189854,2.60831,.51907,-1.469236,-.6282139,-12.41404,13.48765,-.0120477,.5070285,-.0007280216,1.491533,.3635064,-.9713808,-.08138038,.3709854,-1.041174,-.01814075,.506086,-.02053756,6.161431,1.093736,-1.159057,-.3698074,2.711209,-.6006479,-.04896926,.9273957,.1137712,-3.496828,.2867109,-1.011601,-.0820189,.2105725,.459752,.1478925,.213894,-.0566067,6.057755,.7859121,-1.07802,-.181158,.1646622,.8348426,.1149064,.4985738,.1376605,2.746607,.4999626,-1.325672,-.4769313,-41.11215,41.68293,-.006274997,.4649469,.01119411,2.631267,.5234546,-1.619391,-.8000253,-15.34098,16.32706,-.01012023,.4242255,.02931597,.8925807,.3314765,-.7356979,.1368406,2.972579,-3.535359,-.01318948,.460762,-.07182778,6.2541,1.236299,-1.316217,-.4194427,.03489902,1.289849,-.0475596,1.138222,.1975992,-.8991542,.2290572,-.9502188,-.1172703,1.405202,-.3061919,.1058772,-.3760592,-.01983179,3.562353,.7895959,-1.100117,-.1900567,.492503,.5250225,.1576804,1.042701,.07330743,2.796064,.6749783,-1.354183,-.5130625,-42.19268,42.71772,-.005365373,.4136743,.01235172,2.520122,.5187269,-1.741434,-.9589761,-8.230339,9.296799,-.009600162,.4994969,.02955452,.3667099,.3526999,-.6917347,.2154887,-.8760264,.2334121,-.01909621,.4748033,-.1138514,6.51536,1.225097,-1.293189,-.42187,1.620952,-.7858597,-.0376941,.6636786,.3364945,-.5341017,.2128347,-.9735521,-.1325495,1.007517,.2598258,.06762169,.001421018,-.06915987,3.185897,.8641956,-1.0948,-.1962062,.5755591,.2906259,.2625748,.7644049,.1347492,2.677126,.646546,-1.393063,-.5578338,-41.85249,42.33504,-.00543564,.4743765,.007422477,2.442801,.5211707,-1.939487,-1.128509,-8.974257,9.978383,-.007965597,.294883,.04436763,.2839868,.3440424,-.6011562,.2354877,-3.07982,2.585094,-.02002701,.7793909,-.1598414,5.834678,1.202856,-1.315676,-.3903446,1.7019,-1.304609,-.01045121,.2747707,.4143967,.3197102,.263758,-.9618628,-.1625841,1.187138,.1497802,-5590954e-12,.03178475,-.04153145,2.496096,.8195082,-1.111554,-.2365546,.7831875,.2018684,.2074369,.7395978,.122573,1.876478,.6821167,-1.427879,-.5994879,-35.31016,35.81581,-.006431497,.4554192,.0007348731,2.334619,.5233377,-1.998177,-1.206633,-21.4651,22.42237,-.005857596,.2755663,.06384795,.1358244,.3328437,-.644063,.2058571,2.155499,-2.587968,-.01840023,.8826555,-.2222452,5.847073,1.228387,-1.229071,-.3360441,-.3429599,.6179469,.00202961,.08899319,.5041624,.1882964,.225204,-1.022905,-.2101621,1.915689,-.6498794,-.03463651,.08954605,-.06797854,2.417705,.8568618,-1.082538,-.2007723,.4731009,.4077267,.1324289,.651488,.1702912,2.309383,.6600895,-1.472139,-.6499815,-34.28465,34.69659,-.005747023,.4174167,.001688597,2.323046,.5395191,-2.161176,-1.353089,-22.26827,23.29138,-.005583808,.2364793,.06096656,.001944666,.2861624,-.6593044,.1393558,4.698373,-5.193883,-.0199839,1.095635,-.2391254,5.598103,1.236193,-1.195717,-.2972715,.04648953,.3024588,.005003313,-.3754741,.5247265,-.1381312,.2493896,-1.020139,-.2253524,.3548437,.7030485,-.02107076,.4581395,-.03243757,2.453259,.8323623,-1.09877,-.243578,.8761614,.1941613,-.1990692,.3761139,.1657412,1.590503,.6741417,-1.648007,-.8205121,-44.35106,44.79801,-.004181353,.385483,-1842385e-12,2.000281,.5518363,-2.140986,-1.282239,-3.979213,4.672459,-.005008582,.242192,.06253602,.6612713,.2555851,-1.300502,-.5137898,.5179821,-.4032341,-.02066785,1.087929,-.2615309,4.225887,1.229237,-.696334,.0924106,.06936356,-.3588571,-.05461843,-.5616643,.5484166,-.04776267,.2414935,-1.233179,-.4325498,.6479813,.8368356,.2458875,.6464752,-.02897097,1.561773,.8518598,-1.051023,-.253369,1.004294,.3028083,-1.520108,.1607013,.1619975,1.131094,.6706655,-1.948249,-1.097383,-44.53697,44.94902,-.003579939,.3491605,-2500253e-12,1.740442,.6188022,-2.154253,-1.209559,4.144894,-3.562411,-.005638843,.1067169,.07594858,1.00528,.1072543,-2.513259,-1.507208,-1.602979,1.404154,-.00556075,1.24049,-.2852117,3.485252,1.349321,-.07832214,.3655626,.3856288,.6867894,-.1609523,-.6704306,.5357301,-.6457935,.1479503,-1.354784,-.5454375,.8797469,-1.466514,.713442,.5934903,-.02911178,.8643737,.9030724,-1.048324,-.2738736,.8783074,3.246188,-4.435369,.1251791,.1783486,1.064657,.6522878,-2.770408,-1.618911,-25.04031,25.31674,-.004239279,.3241013,-3764484e-12,1.586843,.7035906,-1.9135,-1.144014,-10.80587,11.53677,-.01003197,.1577515,.05217789,1.225278,.005172771,-5.293208,-2.876463,2.087053,-3.201552,.003892964,.532393,-.2034512,2.61776,1.273597,.906034,.3773409,-.6399945,3.213979,-.09112172,.6494055,.395328,.5047796,.2998695,-1.482179,-.677831,1.161775,-3.004872,.4774797,-.4969248,-.003512074,-1.30719,.7927378,-.9863181,-.1803364,.5810824,4.58057,-3.863454,.5328174,.2272821,1.771114,.6791814]],Sl=[[1.560219,1.417388,1.206927,10.91949,5.931416,7.304788,1.533049,1.560532,.3685059,13.5504,5.543711,7.792189,1.471043,1.746088,-.9299697,17.20362,5.473384,8.336416,1.355991,2.109348,-3.295855,22.64843,5.454607,9.304656,1.244963,2.547533,-5.841485,27.56879,5.576104,10.43287,1.175532,2.784634,-7.212225,29.75347,6.47298,10.92331,1.082973,3.118094,-8.934293,31.86879,8.473885,11.74019,.96925,3.349574,-10.0381,31.47654,13.38931,12.72547,.8547044,3.151538,-9.095567,25.54995,22.73219,14.10398,.758034,2.311153,-5.170814,12.29669,36.86529,15.98882,1.664273,1.574468,1.422078,9.768247,14.47338,16.44988,1.638295,1.719586,.5786675,12.39846,14.15419,17.28605,1.572623,1.921559,-.7714802,16.09246,14.20954,18.25908,1.468395,2.21197,-2.845869,20.75027,15.24822,19.37622,1.355047,2.556469,-4.96092,24.60237,16.4836,20.65648,1.291642,2.742036,-6.061967,26.02002,18.19144,21.16712,1.194565,2.97212,-7.295779,26.91805,21.2488,22.01819,1.083631,3.047021,-7.766096,24.96261,27.44264,22.91875,.9707994,2.736459,-6.308284,17.6086,37.76291,23.9215,.8574294,1.865155,-2.364707,4.337793,50.92831,25.23432],[1.632341,1.39523,1.375634,12.38193,5.921102,7.766508,1.597115,1.554617,.3932382,15.05284,5.725234,8.158155,1.522034,1.844545,-1.322862,19.18382,5.440769,8.837119,1.403048,2.290852,-4.013792,24.851,5.521888,9.845547,1.286364,2.774498,-6.648221,29.64151,5.923777,10.97075,1.213544,3.040195,-8.092676,31.86082,6.789782,11.58899,1.122622,3.347465,-9.649016,33.43824,9.347715,12.31374,1.007356,3.543858,-10.5352,32.39842,14.83962,13.31718,.8956642,3.2787,-9.254933,25.57923,24.89677,14.76166,.7985143,2.340404,-4.928274,11.41787,39.61501,16.82448,1.745162,1.639467,1.342721,11.66033,14.90124,17.74031,1.708439,1.819144,.2834399,14.48066,14.59214,18.58679,1.63172,2.094799,-1.378825,18.43198,14.63173,19.62881,1.516536,2.438729,-3.624121,22.98621,15.99782,20.70027,1.405863,2.785191,-5.705236,26.45121,17.6833,21.91903,1.344052,2.951807,-6.683851,27.44271,19.85706,22.29452,1.245827,3.182923,-7.82296,27.91395,23.27254,23.1591,1.132305,3.202593,-8.008429,25.21093,30.00014,24.05306,1.02033,2.820556,-6.238704,17.09276,40.77916,25.09949,.903157,1.863917,-1.955738,3.032665,54.3429,26.4178],[1.168084,2.156455,-3.980314,19.89302,13.28335,14.35621,1.135488,2.294701,-4.585886,20.90208,13.4784,14.67658,1.107408,2.382765,-5.112357,21.47823,14.93128,14.60882,1.054193,2.592891,-6.115,22.68967,16.35672,15.18999,1.006946,2.70542,-6.69893,22.9183,18.34324,15.70651,.9794044,2.74244,-6.805283,22.25271,20.50797,15.6313,.9413577,2.722009,-6.760707,20.98242,23.42588,16.05011,.8917923,2.59278,-6.152635,17.74141,28.58324,16.5791,.8288391,2.153434,-4.118327,10.78118,36.8171,17.38139,.7623528,1.418187,-.8845235,.7590129,46.29859,19.21657,1.352858,2.048862,-2.053393,14.05874,30.45344,30.4443,1.330497,2.126497,-2.466296,14.67559,30.90738,30.69707,1.286344,2.200436,-2.877228,14.92701,32.36288,30.77223,1.234428,2.289628,-3.404699,14.99436,34.6839,30.84842,1.17866,2.306071,-3.549159,14.11006,37.54188,30.7973,1.151366,2.333005,-3.728627,13.63374,39.05894,30.92599,1.101593,2.299422,-3.565787,11.96745,41.88472,31.02755,1.038322,2.083539,-2.649585,8.037389,47.00869,30.65948,.9596146,1.67147,-.8751538,1.679772,53.45784,30.5452,.8640731,.9858301,1.854956,-6.798097,59.36468,31.10255]],El={getTableValue:function(e,t,n,r,i){return Tl[e][540*t+54*(n-1)+9*r+i]},getTableValueRad:function(e,t,n,r){return Sl[e][60*t+6*(n-1)+r]}};function Ll(e,r,i,a,o){return Pl(e).reduce(function(e,t,n){return e+t*El.getTableValue(r,i,a,n,o)},0)}function Cl(e,r,i,a){return Pl(e).reduce(function(e,t,n){return e+t*El.getTableValueRad(r,i,a,n)},0)}function Pl(e){var t=Math.pow(2*e/Math.PI,1/3);return[Math.pow(1-t,5),5*Math.pow(1-t,4)*t,10*Math.pow(1-t,3)*Math.pow(t,2),10*Math.pow(1-t,2)*Math.pow(t,3),5*(1-t)*Math.pow(t,4),Math.pow(t,5)]}var Nl={getDistParams:function(e,t,n,r){for(var i=new Array(9),a=Math.trunc(e),o=e-a,s=0;s<9;s++){var l=Ll(n,r,0,a,s),c=Ll(n,r,1,a,s);if(i[s]=(1-t)*(1-o)*l+t*(1-o)*c,10!=a){var u=Ll(n,r,0,a+1,s),h=Ll(n,r,1,a+1,s);i[s]+=(1-t)*o*u+t*o*h}}return i},getRadiance:function(e,t,n,r){var i=Math.trunc(e),a=e-i,o=(1-t)*(1-a)*Cl(n,r,0,i)+t*(1-a)*Cl(n,r,1,i);10!=i&&(o+=(1-t)*a*Cl(n,r,0,i+1)+t*a*Cl(n,r,1,i+1));return o}};function Rl(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Fl(e,t,n,r){Rl.call(this,e,t,n,r)}Object.assign(Rl.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(i<=e)break e;var s=t[1];e<s&&(n=2,i=s);for(o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,(i=t[--n-1])<=e)break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Rl.prototype,{beforeStart_:Rl.prototype.copySampleValue_,afterEnd_:Rl.prototype.copySampleValue_}),Fl.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Fl,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(r-t),u=1-c,h=0;h!==o;++h)i[h]=a[l+h]*u+a[s+h]*c;return i}});var Ol=[[.1787,-1.463,-.3554,.4275,-.0227,5.3251,.1206,-2.5771,-.067,.3703],[-.0193,-.2592,-.0665,8e-4,-4e-4,.2125,-.0641,-.8989,-.0033,.0452],[-.0167,-.2608,-.095,.0092,-.0079,.2102,-.0441,-1.6537,-.0109,.0529]],Il=[[4.0453,-4.971,-.2155,2.4192],[.00166,-.00375,.00209,0,-.02903,.06377,-.03202,.00394,.11693,-.21196,.06052,.25886],[.00275,-.0061,.00317,0,-.04214,.0897,-.04153,.00516,.15346,-.26756,.0667,.26688]],Dl=function(e,t,n){return Ol[e][2*t+n]},Ul=function(e){return Il[e]};function Bl(e,t,n){return(1+e[0]*Math.exp(e[1]/Math.cos(t)))*(1+e[2]*Math.exp(e[3]*n)+e[4]*Math.pow(Math.cos(n),2))}var zl={getDistParams:function(e,t){for(var n=new Array(5),r=0;r<5;r++)n[r]=Dl(t,r,0)*e+Dl(t,r,1);return n},getZenithParams:function(e,t,n){switch(n){case 0:var r=new xn((o=Ul(n))[0],o[1],o[2],o[3]),i=Math.tan((4/9-e/120)*(Math.PI-2*t)),a=new xn(e*i,i,e,1);return.06*r.dot(a)/Bl(this.getDistParams(e,n),0,t);case 1:case 2:var o=Ul(n),s=Math.pow(t,2),l=Math.pow(t,3);r=new Kt(o[0]*l+o[1]*s+o[2]*t+o[3],o[4]*l+o[5]*s+o[6]*t+o[7],o[8]*l+o[9]*s+o[10]*t+o[11]);return new Kt(Math.pow(e,2),e,1).dot(r)/Bl(this.getDistParams(e,n),0,t)}}},kl=4,Gl=6,Vl=3,jl=2,Xl=12,Wl=17,Hl=0,Yl=2,ql=8,Ql=9,Zl=10,Kl=21,Jl=256;function $l(e){wi.call(this);var t,n,te=this;function _(e,t){for(var n=e.node(t),r=(n.gltfData.type,0);r<n.gltfData.inputs.length;r++)o(e,t,n.gltfData,r)}function o(e,t,n,r){if(!se(e,t,r)){var i=n.inputs[r],a={name:n.name.replace(" ","_")+"_Input_"+r,type:"",inputs:[],outputs:[]};switch(ve(i)){case"float":a.type="VALUE",a.outputs.push(i);break;case"vec3":a.type="RGB";var o=i.slice();o.push(1),a.outputs.push(o);break;case"vec4":a.type="RGB",a.outputs.push(i);break;default:throw new Error("Unsupported group input")}e.addNode({gltfData:a});var s=new Ml.Edge(e.len()-1,t,0);s.connections=[];var l={from:0,to:r};s.connections.push(l),e.addEdge(s)}}function b(e,t,n){var r={inputs:[],outputs:[],removedNodes:[]};r.removedNodes.push(n);var i=w(t,"GROUP_INPUT");if(-1<i){r.removedNodes.push(i+e.len());for(var a=e.findInEdges(n),o=t.findOutEdges(i),s=0;s<a.length;s++)for(var l=a[s],c=0;c<o.length;c++)for(var u=o[c],h=0;h<l.connections.length;h++)for(var d=l.connections[h],p=0;p<u.connections.length;p++){var f=u.connections[p];if(d.to==f.from){(b=A(r.inputs,l.from(),u.to()))||((b=new Ml.Edge(l.from(),u.to(),0)).connections=[],r.inputs.push(b));var m={from:d.from,to:f.to};b.connections.push(m)}}}var v=w(t,"GROUP_OUTPUT");r.removedNodes.push(v+e.len());var g=e.findOutEdges(n),y=t.findInEdges(v);for(s=0;s<g.length;s++){var x=g[s];for(c=0;c<y.length;c++){var _=y[c];for(h=0;h<x.connections.length;h++)for(d=x.connections[h],p=0;p<_.connections.length;p++){f=_.connections[p];if(d.from==f.to){var b;(b=A(r.outputs,_.from(),x.to()))||((b=new Ml.Edge(_.from(),x.to(),0)).connections=[],r.outputs.push(b));m={from:f.from,to:d.to};b.connections.push(m)}}}}return r}function w(e,t){for(var n=0;n<e.len();n++){if(e.node(n).gltfData.type==t)return n}return-1}function ne(e,t){for(var n=0,r=0;r<e.len();r++){e.node(r).gltfData.type==t&&n++}return n}function A(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(i.from()==t&&i.to()==n)return i}return null}function s(e,t,n){for(var r=e.findInEdges(t),i=0;i<r.length;i++)for(var a=r[i],o=e.node(a.from()).gltfData,s=0;s<a.connections.length;s++){var l=a.connections[s];if(p(o.type)&&(l.to==Ql?o.modeReflection=!0:l.to==Zl&&(o.modeReflection=!1)),l.to==ql||l.to==Kl){"BITMAP_MAX"==o.type&&(console.log("Creating Bump Map"),o.type="BUMP_MAX",o.inputs=[],o.outputs[0]=[0,0,0]);for(var c=0;c<e.len();c++){var u=e.node(c).gltfData;if(d(u.type)){var h=u.inputs.length-1;f(e,a.from(),l.from,c,h),u.bumpFactor=n.inputFactors[l.to]}}}}}function d(e){return!(!p(e)&&"FALLOFF_MAX"!=e)}function p(e){return"BITMAP_ENV_MAX"==e||"REFLECT_REFRACT_MAX"==e}function l(e,t,n){for(var r=n.blendMode.length,i=e.findInEdges(t),a=e.findOutEdges(t),o=0;o<r;o++){var s={gltfData:{name:n.name+"Layer"+o,type:"COMPOSITE_LAYER_MAX",blendMode:0!=o?n.blendMode[o]:0,opacity:n.opacity[o],inputs:[[0,0,0,0]].concat(n.inputs.slice(2*o,2*o+2)),outputs:[n.outputs[o]]}};e.addNode(s);for(var l=0;l<i.length;l++)for(var c=i[l],u=0;u<c.connections.length;u++){(d=c.connections[u]).to==2*o&&n.mapEnabled[o]?f(e,c.from(),d.from,e.len()-1,1):d.to==2*o+1&&n.maskEnabled[o]&&f(e,c.from(),d.from,e.len()-1,2)}0<o&&f(e,e.len()-2,0,e.len()-1,0)}for(o=0;o<a.length;o++){var h=a[o];for(l=0;l<h.connections.length;l++){var d=h.connections[l];f(e,e.len()-1,0,h.to(),d.to)}}}function re(e){return te.nodeUVAliases[e]||"uv"}function ie(e,t){return t=jn(t)?t:"color",te.nodeVCAliases[e]||t}function ae(e,t){var n=new wn(e,Jl,1,qe,t,yn.DEFAULT_MAPPING,Se,Se,Ne,Ne);return n.needsUpdate=!0,n}function oe(e){switch(e){case Ot:return"1";case Dt:return"2";default:return"0"}}function f(e,t,n,r,i){e.edge(t,r)||e.addNewEdge(t,r);var a=e.edge(t,r);a.connections=a.connections||[],a.connections.push({from:n,to:i})}function se(e,t,n){for(var r=e.findInEdges(t),i=0;i<r.length;i++)for(var a=r[i],o=0;o<a.connections.length;o++){if(a.connections[o].to==n)return!0}return!1}function le(e,t,n){for(var r in e.edges){var i=e.edges[r];if(i.from()==t)for(var a=0;a<i.connections.length;a++){if(i.connections[a].from==n)return!0}}return!1}function ce(e,t,n){for(var r in e.edges){var i=e.edges[r];if(i.to()==t)for(var a=e.node(i.from()),o=0;o<i.connections.length;o++){if(i.connections[o].to==n)return a}}return null}function ue(e,t,n,r){for(var i in e.edges){var a=e.edges[i];if(a.to()==t)for(var o=e.node(a.from()),s=0;s<a.connections.length;s++){var l=a.connections[s];if(l.to==n){var c=o.gltfData.type;return"BITMAP_MAX"!=c&&"BITMAP_ENV_MAX"!=c||"float"!=ve(r)?o.outputs[l.from]:o.outputs[l.from+1]}}}return null}function he(e,t,n,r){return{name:e.toLowerCase()+"_par_"+r+"_n"+t,type:ve(n),value:"boolean"==typeof n?me(n):n}}function de(e,t){var n=$l.nodeTexUniName(e,t);return{name:n,type:te.nodeTextures[n].isCubeTexture?"uniform samplerCube":"uniform sampler2D",value:t}}function pe(e){return{name:e,type:"",value:null}}function fe(e,t){return{name:"_vary_par_"+e,type:"varying "+r(t),value:null}}function me(e){return e?1:0}function ve(e){return"number"==typeof e?"float":"boolean"==typeof e?"int":r(e.length)}function r(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";case 9:return"mat3";case 16:return"mat4"}}function ge(e,t){switch(e){case"float":return ye(t);case"int":return String(t);default:for(var n=[],r=0;r<t.length;r++)n.push(ye(t[r]));return e+"("+n.join(",")+")"}}function ye(e){return e%1?String(e):String(e)+".0"}this.type="MeshNodeMaterial",this.defines={LIGHT_PATH_IS_CAM_RAY:1,WORLD_NODES:0},this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!0,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.profile="blender",this.nodeTextures={},this.nodeRGB=[],this.nodeRGBMap={},this.nodeRGBArr=null,this.nodeValue=null,this.nodeValueMap={},this.needsBoundingBox=!1,this.nodeGraph=null,this.additionalNodeGraphs={},this.nodeChunks={},this.nodeChunksHash=0,this.nodeVCAliases={},this.nodeUVAliases={},this.color=new Fn(16777215),this.envMap=null,this.envMapIntensity=1,this.advancedPBR=!1,this.reflectivity=.5,this.useHDR=!1,jn(e)&&this.setValues(e),this.nodeGraph||(this.nodeGraph=(t=new Ml.DiGraph(1),n=te.color,t.node(0).gltfData={name:"ShadelessOutput",type:"OUTPUT",inputs:[[n.r,n.g,n.b,1],1],outputs:[],is_active_output:!0},t)),this.updateNodeGraph=function(){var e=te.nodeGraph;!function(e){for(var t=0;t<e.len();t++){var n=e.node(t),r=n.gltfData.type;if("GROUP"!=r)if("REROUTE"!=r);else{for(e.findInEdges(t).length<1&&_(e,t),o=e.findInEdges(t),s=e.findOutEdges(t),m=(h=o[0]).connections[0],c=0;c<s.length;c++){for(d=s[c],(u=new Ml.Edge(h.from(),d.to(),0)).connections=[],f=0;f<d.connections.length;f++)v=d.connections[f],g={from:m.from,to:v.to},u.connections.push(g);e.addEdge(u)}e.disconnect(t,!0),t=-1}else{var i=n.gltfData.nodeGraph,a=te.additionalNodeGraphs[i];if(a.len()<=2){for(var o=e.findInEdges(t),s=e.findOutEdges(t),l=Math.min(o.length,s.length),c=0;c<l;c++){var u,h=o[c],d=s[c];(u=new Ml.Edge(h.from(),d.to(),0)).connections=[];for(var p=Math.min(h.connections.length,d.connections.length),f=0;f<p;f++){var m=h.connections[f],v=d.connections[f],g={from:m.from,to:v.to};u.connections.push(g)}e.addEdge(u)}e.disconnect(t,!0),t=-1;continue}_(e,t);var y=b(e,a,t);e.insert(a,y.inputs,y.outputs);for(var x=y.removedNodes.sort(function(e,t){return t-e}),c=0;c<x.length;c++)e.disconnect(x[c],!0);t=-1}}}(e),te.nodeRGB=[],te.nodeRGBMap={},te.nodeValueMap={},te.needsBoundingBox=!1,te.nodeChunks={},function(e){for(var t=0;t<e.len();t++){if("TEX_IMAGE"!=(i=(a=e.node(t).gltfData).type)||se(e,t,0)||(e.addNode({gltfData:{name:"UVMapGenerated",type:"UVMAP",uvLayer:"",inputs:[],outputs:[[0,0,0]]}}),f(e,e.len()-1,0,t,0)),("TEX_CHECKER"==i||"TEX_NOISE"==i||"TEX_VORONOI"==i||"TEX_SKY"==i)&&!se(e,t,0)){var n={gltfData:{name:"TexCoordGenerated",type:"TEX_COORD",inputs:[],outputs:[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]}};e.addNode(n),f(e,e.len()-1,0,t,0)}"TEX_ENVIRONMENT"!=i&&"TEX_ENVIRONMENT_MAX"!=i||se(e,t,0)||(n={gltfData:{name:"TexCoordObject",type:"TEX_COORD",inputs:[],outputs:[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]}},e.addNode(n),f(e,e.len()-1,3,t,0)),"BUMP"!=i||se(e,t,3)||(e.addNode({gltfData:{name:"NewGeomNormal",type:"NEW_GEOMETRY",inputs:[],outputs:[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],0,0]}}),f(e,e.len()-1,1,t,3)),d(i)&&(a.inputs.push([0,0,0]),a.bumpFactor=0)}var r=0;for(t=0;t<e.len();t++)"MATERIAL_MAX"!=(i=(a=e.node(t).gltfData).type)&&"PHYSICAL_MAX"!=i||(s(e,t,a),r=a.IOR);for(t=0;t<e.len();t++){var i;p(i=(a=e.node(t).gltfData).type)&&(a.IOR=r),p(i)&&!jn(a.modeReflection)&&(console.warn("v3d.MeshNodeMaterial: making indirect Reflect/Refract node Reflect"),a.modeReflection=!0)}for(t=0;t<e.len();t++)"COMPOSITE_MAX"==(a=e.node(t).gltfData).type&&(l(e,t,a),e.disconnect(t,!0));for(t=0;t<e.len();t++){var a;switch((a=e.node(t).gltfData).type){case"BSDF_DIFFUSE":case"BSDF_GLOSSY":case"MATERIAL":case"MATERIAL_EXT":case"BSDF_PRINCIPLED":o(e,t,a,0);break;case"MATERIAL_MAX":o(e,t,a,0),o(e,t,a,1),a.inputFactors[0]=1,a.inputFactors[1]=1;break;case"PHYSICAL_MAX":o(e,t,a,1),a.inputFactors[1]=1}}}(e),te.nodeRGBArr=new Float32Array(4*ne(e,"RGB")),te.nodeValue=new Float32Array(ne(e,"VALUE")),function(e){for(var t=0,n=0,r=0,i=0;i<e.len();i++){var a=(W=(X=e.node(i)).gltfData).type;X.attributes=[],X.params=[],X.inputFactors=[],X.inputs=[],X.outputs=[],jn(W.inputFactors)&&(X.inputFactors=W.inputFactors.slice(0));for(var o=0;o<W.outputs.length;o++){var s=W.outputs[o];X.outputs.push({name:a.toLowerCase()+"_out"+o+"_n"+i,type:ve(s),clamp:!1,normalize:!1})}switch("OUTPUT"!=a&&"OUTPUT_MATERIAL"!=a&&"OUTPUT_WORLD"!=a||X.outputs.push({name:"outgoingLight",type:"",clamp:!1,normalize:!1}),a){case"ATTRIBUTE":if(j=ie(W.colorLayer,"")){var l=fe(j,3);X.attributes.push({name:j,type:"attribute vec3",paramVary:l}),X.params.push(l)}else X.params.push(pe("vec3(0.0)"));break;case"BSDF_DIFFUSE":case"BSDF_GLOSSY":X.params.push(pe("1"));break;case"BSDF_PRINCIPLED":X.params.push(pe("1")),(0<W.inputs[Xl]||se(e,i,Xl))&&(te.advancedPBR=!0);break;case"BUMP":X.params.push(he(a,i,W.invert,"inv")),te.extensions.derivatives=!0;break;case"CAMERA":X.params.push(pe("vViewPosition")),0<ne(e,"OUTPUT_MATERIAL")||0<ne(e,"OUTPUT_WORLD")?X.params.push(pe("1")):X.params.push(pe("0"));break;case"CURVE_RGB":case"CURVE_VEC":if(te.useHDR)var c=new Float32Array(4*Jl),u=1;else c=new Uint8Array(4*Jl),u=255;var h,d,p,f,m=W.curveData.length/Jl;for(o=0;o<Jl;o++)f=3<m?(h=u*W.curveData[m*o],d=u*W.curveData[m*o+1],p=u*W.curveData[m*o+2],u*W.curveData[m*o+3]):(h=u*(W.curveData[m*o]/2+.5),d=u*(W.curveData[m*o+1]/2+.5),p=u*(W.curveData[m*o+2]/2+.5),u),c[4*o]=Yt.clamp(h,0,u),c[4*o+1]=Yt.clamp(d,0,u),c[4*o+2]=Yt.clamp(p,0,u),c[4*o+3]=Yt.clamp(f,0,u);var v=ae(c,te.useHDR?ke:Oe),g=$l.nodeTexUniName(a,t);te.nodeTextures[g]=v,X.params.push(de(a,t)),t++;break;case"FRESNEL":case"LAYER_WEIGHT":X.params.push(pe("vViewPosition"));break;case"GEOMETRY":X.params.push(pe("vViewPosition")),X.params.push(pe("normal")),X.params.push(pe("vec3(0.0)")),le(e,i,kl)?(l=fe(j=re(W.uvLayer),2),X.attributes.push({name:j,type:"attribute vec2",paramVary:l}),X.params.push(l)):X.params.push(pe("vec2(0.5)")),le(e,i,Gl)?(l=fe(j=ie(W.colorLayer),4),X.attributes.push({name:j,type:"attribute vec4",paramVary:l}),X.params.push(l)):X.params.push(pe("vec4(0.0)"));break;case"MAPPING":var y=new Qt,x=new kn;switch(x.set(W.rotation[0],W.rotation[1],W.rotation[2],"ZYX"),y.makeRotationFromEuler(x),y.scale((new Kt).fromArray(W.scale)),W.vectorType){case"TEXTURE":y.setPosition((new Kt).fromArray(W.translation)),y.getInverse(y);break;case"POINT":y.setPosition((new Kt).fromArray(W.translation));break;case"VECTOR":break;case"NORMAL":X.outputs[0].normalize=!0,y.getInverse(y),y.transpose();break;default:throw new Error("v3d.MeshNodeMaterial: Unknown MAPPING vector type")}X.params.push(he(a,i,y.toArray(),"mat")),X.params.push(he(a,i,W.min,"min")),X.params.push(he(a,i,W.max,"max")),X.params.push(he(a,i,W.useMin,"use_min")),X.params.push(he(a,i,W.useMax,"use_max"));break;case"MATERIAL":case"MATERIAL_EXT":jn(W.materialName)?(X.params.push(he(a,i,W.useDiffuse,"use_diff")),X.params.push(he(a,i,W.useSpecular,"use_spec")),X.params.push(he(a,i,W.invertNormal,"inv_nor")),X.params.push(he(a,i,W.specularIntensity,"spec_int")),X.params.push(he(a,i,W.specularHardness,"spec_hard")),"MATERIAL"==a&&(X.params.push(he(a,i,W.ambient,"ambient")),X.params.push(he(a,i,W.emit,"emit")),X.params.push(he(a,i,W.alpha,"alpha"))),X.params.push(he(a,i,W.useShadeless,"use_shless"))):(X.params.push(he(a,i,!1,"use_diff")),X.params.push(he(a,i,!1,"use_spec")),X.params.push(he(a,i,!1,"inv_nor")),X.params.push(he(a,i,0,"spec_int")),X.params.push(he(a,i,0,"spec_hard")),"MATERIAL"==a&&(X.params.push(he(a,i,0,"ambient")),X.params.push(he(a,i,0,"emit")),X.params.push(he(a,i,0,"alpha"))),X.params.push(he(a,i,!1,"use_shless"))),X.params.push(pe("1"));break;case"NEW_GEOMETRY":X.params.push(pe("vViewPosition")),X.params.push(pe("normal"));break;case"NORMAL_MAP":l=fe(j="tangent",4),X.attributes.push({name:j,type:"attribute vec4",paramVary:l}),X.params.push(l),X.params.push(pe("vNormal"));break;case"TEX_COORD":X.params.push(pe("vViewPosition")),X.params.push(pe("normal")),l=fe(j="uv",2),X.attributes.push({name:j,type:"attribute vec2",paramVary:l}),X.params.push(l),le(e,i,Hl)&&(te.needsBoundingBox=!0);break;case"TEX_ENVIRONMENT":case"TEX_ENVIRONMENT_MAX":case"TEX_IMAGE":var _=de(a,W.texture);X.params.push(_);var b=te.nodeTextures[_.name].encoding;X.params.push(pe(oe(b)));break;case"TEX_SKY":var w=(new Kt).fromArray(W.sunDirection).angleTo(new Kt(0,0,1));if("PREETHAM"==W.skyType){var A=zl.getDistParams(W.turbidity,0).concat([0,0,0,0]),M=zl.getDistParams(W.turbidity,1).concat([0,0,0,0]),T=zl.getDistParams(W.turbidity,2).concat([0,0,0,0]),S=zl.getZenithParams(W.turbidity,w,0),E=zl.getZenithParams(W.turbidity,w,1),L=zl.getZenithParams(W.turbidity,w,2);te.defines.TEX_SKY_HOSEK_WILKIE=0,te.defines.TEX_SKY_PREETHAM=1}else if("HOSEK_WILKIE"==W.skyType){var C=Math.max(Math.PI/2-w,0);A=Nl.getDistParams(W.turbidity,W.groundAlbedo,C,0),M=Nl.getDistParams(W.turbidity,W.groundAlbedo,C,1),T=Nl.getDistParams(W.turbidity,W.groundAlbedo,C,2),S=Nl.getRadiance(W.turbidity,W.groundAlbedo,C,0),E=Nl.getRadiance(W.turbidity,W.groundAlbedo,C,1),L=Nl.getRadiance(W.turbidity,W.groundAlbedo,C,2),te.defines.TEX_SKY_HOSEK_WILKIE=1,te.defines.TEX_SKY_PREETHAM=0}X.params.push(he(a,i,[A[0],M[0],T[0]],"param0")),X.params.push(he(a,i,[A[1],M[1],T[1]],"param1")),X.params.push(he(a,i,[A[2],M[2],T[2]],"param2")),X.params.push(he(a,i,[A[3],M[3],T[3]],"param3")),X.params.push(he(a,i,[A[4],M[4],T[4]],"param4")),X.params.push(he(a,i,[A[5],M[5],T[5]],"param5")),X.params.push(he(a,i,[A[6],M[6],T[6]],"param6")),X.params.push(he(a,i,[A[7],M[7],T[7]],"param7")),X.params.push(he(a,i,[A[8],M[8],T[8]],"param8")),X.params.push(he(a,i,[S,E,L],"radiance")),X.params.push(he(a,i,W.sunDirection,"sun_dir"));break;case"TEX_VORONOI":X.params.push(he(a,i,"CELLS"==W.coloring,"cells"));break;case"TEXTURE":case"TEXTURE_CUBE":_=de("TEXTURE",W.texture),X.params.push(_),b=te.nodeTextures[_.name].encoding,X.params.push(pe(oe(b))),W.type=-1<_.type.indexOf("samplerCube")?"TEXTURE_CUBE":"TEXTURE";break;case"MATH":X.outputs[0].clamp=W.useClamp;break;case"MIX_RGB":switch(X.gltfData.blendType){case"HUE":case"SATURATION":case"VALUE":case"COLOR":te.defines.NODE_MIX_RGB_HSV=""}X.outputs[0].clamp=W.useClamp;break;case"MIX_SHADER":var P=-1;for(o=1;o<3;o++){var N=ce(e,i,o);N&&"BSDF_TRANSPARENT"==N.gltfData.type&&(P=o-1)}X.params.push(pe(String(P)));break;case"NORMAL":X.params.push(he(a,i,W.outputs[0],"out"));break;case"RGB":_=(new xn).fromArray(W.outputs[0]),te.nodeRGB.push(_),te.nodeRGBMap[W.name]=n,X.params.push(pe("nodeRGB["+n+"]")),n++;break;case"UVMAP":l=fe(j=re(W.uvLayer),2),X.attributes.push({name:j,type:"attribute vec2",paramVary:l}),X.params.push(l);break;case"VALUE":_=W.outputs[0],te.nodeValue[r]=_,te.nodeValueMap[W.name]=r,X.params.push(pe("nodeValue["+r+"]")),r++;break;case"VALTORGB":var R=W.curve,F=new Fl(new Float32Array(R.input),new Float32Array(R.output),4);for(u=te.useHDR?(c=new Float32Array(4*Jl),1):(c=new Uint8Array(4*Jl),255),o=0;o<Jl;o++){var O=F.evaluate(o/(Jl-1));c[4*o]=u*O[0],c[4*o+1]=u*O[1],c[4*o+2]=u*O[2],c[4*o+3]=u*O[3]}v=ae(c,te.useHDR?ke:Oe),g=$l.nodeTexUniName(a,t),te.nodeTextures[g]=v,X.params.push(de(a,t)),t++;break;case"VECT_TRANSFORM":var I=W.vectorType,D=W.convertFrom,U=W.convertTo;"NORMAL"==I&&(X.outputs[0].normalize=!0);var B="";D==U?B="VEC_TRANS_NONE":(B="VEC_TRANS_"+D[0]+"_"+U[0],"VECTOR"!=I&&"NORMAL"!=I||(B+="_DIR")),X.params.push(pe(B)),0<ne(e,"OUTPUT_MATERIAL")||0<ne(e,"OUTPUT_WORLD")?X.params.push(pe("1")):X.params.push(pe("0"));break;case"BITMAP_MAX":case"BITMAP_ENV_MAX":case"REFLECT_REFRACT_MAX":var z=de(a,W.texture);X.params.push(z),"BITMAP_MAX"==a?(l=fe(j=W.uvIndex?"uv"+String(W.uvIndex+1):"uv",2),X.attributes.push({name:j,type:"attribute vec2",paramVary:l}),X.params.push(l)):(X.params.push(pe("normal")),X.params.push(he(a,i,W.bumpFactor,"bump_factor")),X.params.push(he(a,i,W.modeReflection,"mode_refl")),X.params.push(he(a,i,W.IOR,"ior"))),b=te.nodeTextures[z.name].encoding,X.params.push(pe(oe(b))),"BITMAP_MAX"!=a&&"BITMAP_ENV_MAX"!=a||(X.params.push(he(a,i,W.alphaAsMono,"as_mono")),X.params.push(he(a,i,W.alphaAsRGB,"as_rgb")),X.outputs.push({name:a.toLowerCase()+"_out1_n"+i,type:"float",clamp:!1,normalize:!1}),W.inputs.length<5&&(W.inputs.unshift(0,0,1,1,0),W.inputFactors&&W.inputFactors.unshift(0,0,0,0,0)));break;case"BUMP_MAX":z=de("BITMAP_MAX",W.texture),X.params.push(z),X.params.push(pe("-vViewPosition")),X.params.push(pe("normal")),l=fe(j=W.uvIndex?"uv"+String(W.uvIndex+1):"uv",2),X.attributes.push({name:j,type:"attribute vec2",paramVary:l}),X.params.push(l),te.extensions.derivatives=!0;break;case"COLOR_CORRECTION_MAX":var k=ge("ivec4",[W.rewireR,W.rewireG,W.rewireB,W.rewireA]);X.params.push(pe(k)),X.params.push(he(a,i,W.hueShift,"hue")),X.params.push(he(a,i,W.saturation,"sat")),X.params.push(he(a,i,W.brightness,"bright")),X.params.push(he(a,i,W.contrast,"contr"));break;case"COMPOSITE_LAYER_MAX":X.params.push(pe(ge("int",W.blendMode)));var G=se(e,i,1)?W.opacity:0;X.params.push(he(a,i,G,"opacity"));break;case"FALLOFF_MAX":X.params.push(pe("-vViewPosition")),X.params.push(he(a,i,W.IOR,"ior")),X.params.push(pe("normal")),X.params.push(he(a,i,W.bumpFactor,"bump_factor")),W.inputFactors[Yl]=1;break;case"MATERIAL_MAX":X.params.push(pe("normal")),X.params.push(he(a,i,W.inputFactors[ql],"bump_factor")),X.params.push(he(a,i,W.inputFactors[Ql],"refl_ratio")),X.params.push(he(a,i,W.inputFactors[Zl],"refr_ratio")),W.inputFactors[ql]=1,W.inputFactors[Ql]=1,W.inputFactors[Zl]=1,X.params.push(he(a,i,W.selfIllumColorOn,"self_ill_on"));break;case"NORMAL_BUMP_MAX":l=fe(j="tangent",4),X.attributes.push({name:j,type:"attribute vec4",paramVary:l}),X.params.push(l),X.params.push(pe("normal"));var V="ivec2("+me(W.flip[0])+","+me(W.flip[1])+")";X.params.push(pe(V));break;case"PHYSICAL_MAX":X.params.push(pe("normal")),X.params.push(he(a,i,W.inputFactors[Kl],"bump_factor")),X.params.push(he(a,i,W.emitLuminance,"lum")),te.advancedPBR=!0,X.inputFactors=[];break;case"REFLECT_REFRACT_COLOR_MAX":_=W.outputs[0],X.params.push(he(a,i,_,"col"));break;case"VERTEX_COLOR_MAX":var j;l=fe(j="color",3),X.attributes.push({name:j,type:"attribute vec3",paramVary:l}),X.params.push(l)}}for(i=0;i<e.len();i++){var X,W;for(a=(W=(X=e.node(i)).gltfData).type,o=0;o<W.inputs.length;o++){var H=W.inputs[o],Y=ue(e,i,o,H);if(Y){if(X.inputFactors.length)var q=X.inputFactors[o];else q=1;X.inputs.push({name:(Q=Y.name,Z=Y.type,K=H,J=q,$=void 0,void 0,ee=ve(K),Z==ee?$=Q:"float"==Z&&"vec3"==ee?$="vec3("+[Q,Q,Q].join(",")+")":"float"==Z&&"vec4"==ee?$="vec4("+[Q,Q,Q,Q].join(",")+")":"vec3"==Z&&"float"==ee?$="("+[Q+"[0]",Q+"[1]",Q+"[2]"].join("+")+")/3.0":"vec4"==Z&&"float"==ee?$="("+[Q+"[0]",Q+"[1]",Q+"[2]"].join("+")+")/3.0":"vec3"==Z&&"vec4"==ee?$="vec4("+Q+", 1.0)":"vec4"==Z&&"vec3"==ee&&($="vec3("+[Q+"[0]",Q+"[1]",Q+"[2]"].join(",")+")"),J<1&&($="mix("+ge(ee,K)+","+$+","+ye(J)+")"),$),type:"",value:null})}else("MATERIAL"!=a&&"MATERIAL_EXT"!=a||o!=Vl)&&("BSDF_DIFFUSE"!=a&&"BSDF_GLOSSY"!=a||o!=jl)?"BSDF_PRINCIPLED"==a&&o==Wl?(X.inputs.push({name:"normal",type:"",value:null}),X.params[X.params.length-1].name="0"):X.inputs.push({name:a.toLowerCase()+"_in"+o+"_n"+i,type:ve(H),value:H}):(X.inputs.push({name:"normal",type:"",value:null}),X.params[X.params.length-1].name="0")}}var Q,Z,K,J,$,ee}(e),function(e){var t=[],n=[],r=[],i=[],a=new Ml.TopologicalSort(e).order();"blender"==te.profile&&(te.defines.BLENDER_LIGHTS=""),te.defines.NODE_RGB_NUM=te.nodeRGB.length,te.defines.NODE_VALUE_NUM=te.nodeValue.length;for(var o=0;o<a.length;o++){var s=(m=e.node(a[o])).gltfData.type;te.defines["NODE_"+s]="","OUTPUT_MATERIAL"!=s&&"PHYSICAL_MAX"!=s||(te.defines.PHYSICAL="",te.advancedPBR||(te.defines.STANDARD=""));var l="node_"+s.toLowerCase()+"_vert";(h=Pn[l])&&t.indexOf(h)<0&&t.push(h);var c="node_"+s.toLowerCase()+"_frag";(d=Pn[c])&&r.indexOf(d)<0&&r.push(d);for(var u=0;u<m.attributes.length;u++){var h=(v=m.attributes[u]).type+" "+v.name+";";"uv"!=v.name&&t.indexOf(h)<0&&t.push(h)}for(u=0;u<m.params.length;u++)if(-1<(x=m.params[u]).type.indexOf("uniform")){var d=x.type+" "+x.name+";";r.indexOf(d)<0&&r.push(d)}else if(-1<x.type.indexOf("varying")){var p=x.type+" "+x.name+";";t.indexOf(p)<0&&t.push(p);var f=x.type+" "+x.name+";";r.indexOf(f)<0&&r.push(f)}else x.type&&i.push(x.type+" "+x.name+"="+ge(x.type,x.value)+";");for(u=0;u<m.inputs.length;u++)(_=m.inputs[u]).type&&i.push(_.type+" "+_.name+"="+ge(_.type,_.value)+";");for(u=0;u<m.outputs.length;u++)(b=m.outputs[u]).type&&i.push(b.type+" "+b.name+";")}for(o=0;o<a.length;o++){var m;if("ATTRIBUTE"==(s=(m=e.node(a[o])).gltfData.type)||"GEOMETRY"==s||"NEW_GEOMETRY"==s||"NORMAL_MAP"==s||"TEX_COORD"==s||"UVMAP"==s||"BITMAP_MAX"==s||"NORMAL_BUMP_MAX"==s||"BUMP_MAX"==s||"VERTEX_COLOR_MAX"==s)for(u=0;u<m.attributes.length;u++){var v,g=(v=m.attributes[u]).paramVary.name+"="+v.name+";";n.indexOf(g)<0&&n.push(g)}var y=[];for(u=0;u<m.params.length;u++){var x=m.params[u];y.push(x.name)}for(u=0;u<m.inputs.length;u++){var _=m.inputs[u];y.push(_.name)}for(u=0;u<m.outputs.length;u++){var b=m.outputs[u];y.push(b.name)}var w="node_"+s.toLowerCase();switch(s){case"MATH":case"VECT_MATH":w+="_"+m.gltfData.operation.toLowerCase();break;case"MIX_RGB":w+="_"+m.gltfData.blendType.toLowerCase()}for(i.push(w+"("+y.join(",")+");"),u=0;u<m.outputs.length;u++){var A=(b=m.outputs[u]).name;b.clamp&&(s=b.type,i.push(A+"=clamp("+A+","+s+"(0.0),"+s+"(1.0));")),b.normalize&&i.push(A+"=normalize("+A+");")}}te.nodeChunks.node_pars_vertex=t.join("\n"),te.nodeChunks.node_vertex=n.join("\n"),te.nodeChunks.node_pars_fragment=r.join("\n"),te.nodeChunks.node_fragment=i.join("\n"),te.nodeChunksHash=Yt.hashString(JSON.stringify(te.nodeChunks))}(e),ec(e)},this.updateNodeGraph()}function ec(t){for(var e=-1,n=0;n<t.len();n++)if(t.node(n).gltfData.is_active_output){e=n;break}if(-1==e)t=new Ml.DiGraph(0);else{var r=new Ml.DepthFirstSearch(t.reverse(),e),i=[];for(n=0;n<t.len();n++)r.hasPathTo(n)||i.push(t.node(n));i.forEach(function(e){t.disconnect(t.nodeIndex(e),!0)})}}$l.nodeTexUniName=function(e,t){return e.toLowerCase()+"_par_tex_idx"+t},$l.nodeGraphFromGLTF=function(e){for(var t=e.nodes,n=e.edges,r=new Ml.DiGraph(t.length),i=0;i<t.length;i++){t[i];r.node(i).gltfData=t[i]}for(i=0;i<n.length;i++){var a=n[i];r.edge(a.fromNode,a.toNode)||r.addNewEdge(a.fromNode,a.toNode);var o=r.edge(a.fromNode,a.toNode);o.connections=o.connections||[],o.connections.push({from:a.fromOutput,to:a.toInput})}return ec(r),r},$l.prototype=Object.assign(Object.create(wi.prototype),{constructor:$l,isMeshNodeMaterial:!0,hasNode:function(e){for(var t=0;t<this.nodeGraph.len();t++){if(this.nodeGraph.node(t).gltfData.type==e)return!0}return!1},copy:function(e){wi.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Nn.clone(e.uniforms),this.defines=e.defines,this.linewidth=e.linewidth,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.index0AttributeName=this.index0AttributeName,this.color.copy(e.color),this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.reflectivity=e.reflectivity,this.useHDR=e.useHDR,this.extensions=e.extensions,this.profile=e.profile,this.nodeTextures=e.nodeTextures,this.nodeRGB=e.nodeRGB.slice(),this.nodeRGBMap=Object.assign({},e.nodeRGBMap),this.nodeRGBArr=e.nodeRGBArr.slice(),this.nodeValue=e.nodeValue.slice(),this.nodeValueMap=Object.assign({},e.nodeValueMap),this.needsBoundingBox=e.needsBoundingBox,this.nodeGraph=new Ml.DiGraph(e.nodeGraph.len());for(var t=0;t<this.nodeGraph.len();t++)this.nodeGraph.node(t).gltfData=e.nodeGraph.node(t).gltfData;for(var n in e.nodeGraph.edges){var r=e.nodeGraph.edges[n];this.nodeGraph.addNewEdge(r.from(),r.to()).connections=r.connections.slice()}return this.additionalNodeGraphs=Object.assign({},e.additionalNodeGraphs),this.nodeChunks=Object.assign({},e.nodeChunks),this.nodeChunksHash=e.nodeChunksHash,this.nodeVCAliases=Object.assign({},e.nodeVCAliases),this.nodeUVAliases=Object.assign({},e.nodeUVAliases),this},toJSON:function(e){var t=wi.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t}});var tc=Object.freeze({ShadowMaterial:pl,SpriteMaterial:zo,RawShaderMaterial:fl,ShaderMaterial:Mi,PointsMaterial:Qo,MeshPhysicalMaterial:vl,MeshStandardMaterial:ml,MeshPhongMaterial:gl,MeshToonMaterial:yl,MeshNormalMaterial:xl,MeshLambertMaterial:_l,MeshDepthMaterial:$a,MeshDistanceMaterial:eo,MeshBasicMaterial:Ai,MeshMatcapMaterial:bl,LineDashedMaterial:wl,LineBasicMaterial:Wo,Material:wi,MeshMaskMaterial:Al,MeshNodeMaterial:$l}),nc={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function rc(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==r.onStart&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}var ic=new rc,ac={};function oc(e){this.manager=void 0!==e?e:ic}function sc(e){this.manager=void 0!==e?e:ic,this._parser=null}function lc(e){this.manager=void 0!==e?e:ic,this._parser=null}function cc(e){this.manager=void 0!==e?e:ic}function uc(e){this.manager=void 0!==e?e:ic}function hc(e){this.manager=void 0!==e?e:ic}function dc(){this.type="Curve",this.arcLengthDivisions=200}function pc(e,t,n,r,i,a,o,s){dc.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function fc(e,t,n,r,i,a){pc.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}function mc(){var i=0,a=0,o=0,s=0;function c(e,t,n,r){o=-3*(i=e)+3*t-2*(a=n)-r,s=2*e-2*t+n+r}return{initCatmullRom:function(e,t,n,r,i){c(t,n,i*(n-e),i*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,i,a,o){var s=(t-e)/i-(n-e)/(i+a)+(n-t)/a,l=(n-t)/a-(r-t)/(a+o)+(r-n)/o;c(t,n,s*=a,l*=a)},calc:function(e){var t=e*e;return i+a*e+o*t+s*(t*e)}}}Object.assign(oc.prototype,{load:function(o,e,t,n){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,r=nc.get(o);if(void 0!==r)return s.manager.itemStart(o),setTimeout(function(){e&&e(r),s.manager.itemEnd(o)},0),r;if(void 0===ac[o]){var i=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(i){var a=i[1],l=!!i[2],c=i[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(c.length),p=0;p<c.length;p++)d[p]=c.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:a}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(c,a);break;case"json":u=JSON.parse(c);break;default:u=c}setTimeout(function(){e&&e(u),s.manager.itemEnd(o)},0)}catch(e){setTimeout(function(){n&&n(e),s.manager.itemError(o),s.manager.itemEnd(o)},0)}}else{ac[o]=[],ac[o].push({onLoad:e,onProgress:t,onError:n});var m=new XMLHttpRequest;for(var v in m.open("GET",o,!0),m.addEventListener("load",function(e){var t=this.response;nc.add(o,t);var n=ac[o];if(delete ac[o],200===this.status||0===this.status){0===this.status&&console.warn("v3d.FileLoader: HTTP Status 0 received.");for(var r=0,i=n.length;r<i;r++){(a=n[r]).onLoad&&a.onLoad(t)}s.manager.itemEnd(o)}else{for(r=0,i=n.length;r<i;r++){var a;(a=n[r]).onError&&a.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)}},!1),m.addEventListener("progress",function(e){for(var t=ac[o],n=0,r=t.length;n<r;n++){var i=t[n];i.onProgress&&i.onProgress(e)}},!1),m.addEventListener("error",function(e){var t=ac[o];delete ac[o];for(var n=0,r=t.length;n<r;n++){var i=t[n];i.onError&&i.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),m.addEventListener("abort",function(e){var t=ac[o];delete ac[o];for(var n=0,r=t.length;n<r;n++){var i=t[n];i.onError&&i.onError(e)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return s.manager.itemStart(o),m}ac[o].push({onLoad:e,onProgress:t,onError:n})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(sc.prototype,{load:function(e,a,t,r){var o=this,s=[],l=new Jo;l.image=s;var i=new oc(this.manager);function n(n){i.load(e[n],function(e){var t=o._parser(e,!0);s[n]={width:t.width,height:t.height,format:t.format,mipmaps:t.mipmaps},6===(c+=1)&&(1===t.mipmapCount&&(l.minFilter=Ne),l.format=t.format,l.needsUpdate=!0,a&&a(l))},t,r)}if(i.setPath(this.path),i.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,u=0,h=e.length;u<h;++u)n(u);else i.load(e,function(e){var t=o._parser(e,!0);if(t.isCubemap)for(var n=t.mipmaps.length/t.mipmapCount,r=0;r<n;r++){s[r]={mipmaps:[]};for(var i=0;i<t.mipmapCount;i++)s[r].mipmaps.push(t.mipmaps[r*t.mipmapCount+i]),s[r].format=t.format,s[r].width=t.width,s[r].height=t.height}else l.image.width=t.width,l.image.height=t.height,l.mipmaps=t.mipmaps;1===t.mipmapCount&&(l.minFilter=Ne),l.format=t.format,l.needsUpdate=!0,a&&a(l)},t,r);return l},setPath:function(e){return this.path=e,this}}),Object.assign(lc.prototype,{load:function(e,n,t,r){var i=this,a=new wn,o=new oc(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(e){var t=i._parser(e);t&&(void 0!==t.image?a.image=t.image:void 0!==t.data&&(a.image.width=t.width,a.image.height=t.height,a.image.data=t.data),a.wrapS=void 0!==t.wrapS?t.wrapS:Se,a.wrapT=void 0!==t.wrapT?t.wrapT:Se,a.magFilter=void 0!==t.magFilter?t.magFilter:Ne,a.minFilter=void 0!==t.minFilter?t.minFilter:Fe,a.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(a.format=t.format),void 0!==t.type&&(a.type=t.type),void 0!==t.mipmaps&&(a.mipmaps=t.mipmaps),1===t.mipmapCount&&(a.minFilter=Ne),a.needsUpdate=!0,n&&n(a,t))},t,r),a},setPath:function(e){return this.path=e,this}}),Object.assign(cc.prototype,{crossOrigin:"anonymous",load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=nc.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){e&&e(a),i.manager.itemEnd(t)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),nc.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(uc.prototype,{crossOrigin:"anonymous",load:function(e,n,t,r){var i=new zi,a=new cc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(t){a.load(e[t],function(e){i.images[t]=e,6===++o&&(i.needsUpdate=!0,n&&n(i))},void 0,r)}for(var l=0;l<e.length;++l)s(l);return i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(hc.prototype,{crossOrigin:"anonymous",load:function(n,r,e,t){var i=new yn,a=new cc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(n,function(e){i.image=e;var t=0<n.search(/\.jpe?g$/i)||0===n.search(/^data\:image\/jpeg/);i.format=t?Ye:qe,i.needsUpdate=!0,void 0!==r&&r(i)},e,t),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(dc.prototype,{getPoint:function(){return console.warn("v3d.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(0<o)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var c=r[i];return(i+(n-c)/(r[i+1]-c))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),1<n&&(n=1);var r=this.getPoint(t);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,i,a=new Kt,o=[],s=[],l=[],c=new Kt,u=new Qt;for(n=0;n<=e;n++)r=n/e,o[n]=this.getTangentAt(r),o[n].normalize();s[0]=new Kt,l[0]=new Kt;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),i=Math.acos(Yt.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(c,i))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(i=Math.acos(Yt.clamp(s[0].dot(s[e]),-1,1)),i/=e,0<o[0].dot(c.crossVectors(s[0],s[e]))&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],i*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),((pc.prototype=Object.create(dc.prototype)).constructor=pc).prototype.isEllipseCurve=!0,pc.prototype.getPoint=function(e,t){for(var n=t||new qt,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;r<i;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*c-d*u+this.aX,l=h*u+d*c+this.aY}return n.set(s,l)},pc.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},pc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},pc.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},((fc.prototype=Object.create(pc.prototype)).constructor=fc).prototype.isArcCurve=!0;var vc=new Kt,gc=new mc,yc=new mc,xc=new mc;function _c(e,t,n,r){dc.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function bc(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function wc(e,t,n,r){return(o=1-e)*o*t+2*(1-(a=e))*a*n+(i=e)*i*r;var i,a,o}function Ac(e,t,n,r,i){return(c=1-e)*c*c*t+3*(l=1-(s=e))*l*s*n+3*(1-(o=e))*o*o*r+(a=e)*a*a*i;var a,o,s,l,c}function Mc(e,t,n,r){dc.call(this),this.type="CubicBezierCurve",this.v0=e||new qt,this.v1=t||new qt,this.v2=n||new qt,this.v3=r||new qt}function Tc(e,t,n,r){dc.call(this),this.type="CubicBezierCurve3",this.v0=e||new Kt,this.v1=t||new Kt,this.v2=n||new Kt,this.v3=r||new Kt}function Sc(e,t){dc.call(this),this.type="LineCurve",this.v1=e||new qt,this.v2=t||new qt}function Ec(e,t){dc.call(this),this.type="LineCurve3",this.v1=e||new Kt,this.v2=t||new Kt}function Lc(e,t,n){dc.call(this),this.type="QuadraticBezierCurve",this.v0=e||new qt,this.v1=t||new qt,this.v2=n||new qt}function Cc(e,t,n){dc.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Kt,this.v1=t||new Kt,this.v2=n||new Kt}function Pc(e){dc.call(this),this.type="SplineCurve",this.points=e||[]}((_c.prototype=Object.create(dc.prototype)).constructor=_c).prototype.isCatmullRomCurve3=!0,_c.prototype.getPoint=function(e,t){var n,r,i,a,o=t||new Kt,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,u=Math.floor(c),h=c-u;if(this.closed?u+=0<u?0:(Math.floor(Math.abs(u)/l)+1)*l:0===h&&u===l-1&&(u=l-2,h=1),n=this.closed||0<u?s[(u-1)%l]:(vc.subVectors(s[0],s[1]).add(s[0]),vc),r=s[u%l],i=s[(u+1)%l],a=this.closed||u+2<l?s[(u+2)%l]:(vc.subVectors(s[l-1],s[l-2]).add(s[l-1]),vc),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(r),d),f=Math.pow(r.distanceToSquared(i),d),m=Math.pow(i.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),gc.initNonuniformCatmullRom(n.x,r.x,i.x,a.x,p,f,m),yc.initNonuniformCatmullRom(n.y,r.y,i.y,a.y,p,f,m),xc.initNonuniformCatmullRom(n.z,r.z,i.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(gc.initCatmullRom(n.x,r.x,i.x,a.x,this.tension),yc.initCatmullRom(n.y,r.y,i.y,a.y,this.tension),xc.initCatmullRom(n.z,r.z,i.z,a.z,this.tension));return o.set(gc.calc(h),yc.calc(h),xc.calc(h)),o},_c.prototype.copy=function(e){dc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},_c.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},_c.prototype.fromJSON=function(e){dc.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new Kt).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},((Mc.prototype=Object.create(dc.prototype)).constructor=Mc).prototype.isCubicBezierCurve=!0,Mc.prototype.getPoint=function(e,t){var n=t||new qt,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ac(e,r.x,i.x,a.x,o.x),Ac(e,r.y,i.y,a.y,o.y)),n},Mc.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Mc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Mc.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Tc.prototype=Object.create(dc.prototype)).constructor=Tc).prototype.isCubicBezierCurve3=!0,Tc.prototype.getPoint=function(e,t){var n=t||new Kt,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ac(e,r.x,i.x,a.x,o.x),Ac(e,r.y,i.y,a.y,o.y),Ac(e,r.z,i.z,a.z,o.z)),n},Tc.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Tc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Tc.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},((Sc.prototype=Object.create(dc.prototype)).constructor=Sc).prototype.isLineCurve=!0,Sc.prototype.getPoint=function(e,t){var n=t||new qt;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Sc.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Sc.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Sc.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Sc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Sc.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Ec.prototype=Object.create(dc.prototype)).constructor=Ec).prototype.isLineCurve3=!0,Ec.prototype.getPoint=function(e,t){var n=t||new Kt;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Ec.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Ec.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ec.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ec.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Lc.prototype=Object.create(dc.prototype)).constructor=Lc).prototype.isQuadraticBezierCurve=!0,Lc.prototype.getPoint=function(e,t){var n=t||new qt,r=this.v0,i=this.v1,a=this.v2;return n.set(wc(e,r.x,i.x,a.x),wc(e,r.y,i.y,a.y)),n},Lc.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Lc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Lc.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Cc.prototype=Object.create(dc.prototype)).constructor=Cc).prototype.isQuadraticBezierCurve3=!0,Cc.prototype.getPoint=function(e,t){var n=t||new Kt,r=this.v0,i=this.v1,a=this.v2;return n.set(wc(e,r.x,i.x,a.x),wc(e,r.y,i.y,a.y),wc(e,r.z,i.z,a.z)),n},Cc.prototype.copy=function(e){return dc.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Cc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Cc.prototype.fromJSON=function(e){return dc.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},((Pc.prototype=Object.create(dc.prototype)).constructor=Pc).prototype.isSplineCurve=!0,Pc.prototype.getPoint=function(e,t){var n=t||new qt,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],l=r[a],c=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(bc(o,s.x,l.x,c.x,u.x),bc(o,s.y,l.y,c.y,u.y)),n},Pc.prototype.copy=function(e){dc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},Pc.prototype.toJSON=function(){var e=dc.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},Pc.prototype.fromJSON=function(e){dc.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new qt).fromArray(r))}return this};var Nc,Rc,Fc,Oc=Object.freeze({ArcCurve:fc,CatmullRomCurve3:_c,CubicBezierCurve:Mc,CubicBezierCurve3:Tc,EllipseCurve:pc,LineCurve:Sc,LineCurve3:Ec,QuadraticBezierCurve:Lc,QuadraticBezierCurve3:Cc,SplineCurve:Pc});function Ic(){dc.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Dc(e){Ic.call(this),this.type="Path",this.currentPoint=new qt,e&&this.setFromPoints(e)}function Uc(e){Dc.call(this,e),this.uuid=Yt.generateUUID(),this.type="Shape",this.holes=[]}function Bc(e,t){ur.call(this),this.type="Light",this.color=new Fn(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0,this.isFreeLight=void 0}function zc(e,t,n){Bc.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ur.DefaultUp),this.updateMatrix(),this.groundColor=new Fn(t),this.target=new ur}function kc(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new qt(512,512),this.map=null,this.matrix=new Qt}function Gc(){kc.call(this,new oo(50,1,.5,500))}function Vc(e,t,n,r,i,a){Bc.call(this,e,t),this.type="SpotLight",this.position.copy(ur.DefaultUp),this.updateMatrix(),this.target=new ur,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new Gc}function jc(e,t,n,r){Bc.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new kc(new oo(90,1,.5,500))}function Xc(){kc.call(this,new dr(-5,5,5,-5,.5,500))}function Wc(e,t){Bc.call(this,e,t),this.type="DirectionalLight",this.position.copy(ur.DefaultUp),this.updateMatrix(),this.target=new ur,this.shadow=new Xc}function Hc(e,t){Bc.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Yc(e,t,n,r){Bc.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}Ic.prototype=Object.assign(Object.create(dc.prototype),{constructor:Ic,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Sc(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&1<n.length&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){dc.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=dc.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){dc.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push((new Oc[r.type]).fromJSON(r))}return this}}),Dc.prototype=Object.assign(Object.create(Ic.prototype),{constructor:Dc,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new Sc(this.currentPoint.clone(),new qt(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,r){var i=new Lc(this.currentPoint.clone(),new qt(e,t),new qt(n,r));this.curves.push(i),this.currentPoint.set(n,r)},bezierCurveTo:function(e,t,n,r,i,a){var o=new Mc(this.currentPoint.clone(),new qt(e,t),new qt(n,r),new qt(i,a));this.curves.push(o),this.currentPoint.set(i,a)},splineThru:function(e){var t=new Pc([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,n,r,i,a)},absarc:function(e,t,n,r,i,a){this.absellipse(e,t,n,n,r,i,a)},ellipse:function(e,t,n,r,i,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;this.absellipse(e+l,t+c,n,r,i,a,o,s)},absellipse:function(e,t,n,r,i,a,o,s){var l=new pc(e,t,n,r,i,a,o,s);if(0<this.curves.length){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);this.currentPoint.copy(u)},copy:function(e){return Ic.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Ic.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Ic.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Uc.prototype=Object.assign(Object.create(Dc.prototype),{constructor:Uc,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Dc.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=Dc.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){Dc.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push((new Dc).fromJSON(r))}return this}}),Bc.prototype=Object.assign(Object.create(ur.prototype),{constructor:Bc,isLight:!0,copy:function(e){return ur.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this.receiveShadow=e.receiveShadow,this.isFreeLight=e.isFreeLight,this},toJSON:function(e){var t=ur.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),zc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:zc,isHemisphereLight:!0,copy:function(e){return Bc.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this.target=e.target.clone(),this},updateMatrixWorld:function(e){ur.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(Nc=new Kt,function(){Nc.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,Nc),this.target.updateMatrix()})}),Object.assign(kc.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Gc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Gc,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=2*Yt.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix())}}),Vc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:Vc,isSpotLight:!0,copy:function(e){return Bc.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},updateMatrixWorld:function(e){ur.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(Rc=new Kt,function(){Rc.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,Rc),this.target.updateMatrix()})}),jc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:jc,isPointLight:!0,copy:function(e){return Bc.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Xc.prototype=Object.assign(Object.create(kc.prototype),{constructor:Xc}),Wc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:Wc,isDirectionalLight:!0,copy:function(e){return Bc.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},updateMatrixWorld:function(e){ur.prototype.updateMatrixWorld.call(this,e),this.isFreeLight&&this.updateFreeLightTarget()},updateFreeLightTarget:(Fc=new Kt,function(){Fc.set(0,0,-1).applyQuaternion(this.quaternion).normalize(),this.target.position.addVectors(this.position,Fc),this.target.updateMatrix()})}),Hc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:Hc,isAmbientLight:!0}),Yc.prototype=Object.assign(Object.create(Bc.prototype),{constructor:Yc,isRectAreaLight:!0,copy:function(e){return Bc.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=Bc.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});var qc={arraySlice:function(e,t,n){return qc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(n){for(var e=n.length,t=new Array(e),r=0;r!==e;++r)t[r]=r;return t.sort(function(e,t){return n[e]-n[t]}),t},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),void 0!==(a=e[i++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),void 0!==(a=e[i++]););else for(;void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),void 0!==(a=e[i++]););}}};function Qc(e,t,n,r){Rl.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Zc(e,t,n,r){Rl.call(this,e,t,n,r)}function Kc(e,t,n,r){if(void 0===e)throw new Error("v3d.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("v3d.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=qc.convertArray(t,this.TimeBufferType),this.values=qc.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Jc(e,t,n){Kc.call(this,e,t,n)}function $c(e,t,n,r){Kc.call(this,e,t,n,r)}function eu(e,t,n,r){Kc.call(this,e,t,n,r)}function tu(e,t,n,r){Rl.call(this,e,t,n,r)}function nu(e,t,n,r){Kc.call(this,e,t,n,r)}function ru(e,t,n,r){Kc.call(this,e,t,n,r)}function iu(e,t,n,r){Kc.call(this,e,t,n,r)}function au(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=Yt.generateUUID(),this.duration<0&&this.resetDuration()}function ou(e){if(void 0===e.type)throw new Error("v3d.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return eu;case"vector":case"vector2":case"vector3":case"vector4":return iu;case"color":return $c;case"quaternion":return nu;case"bool":case"boolean":return Jc;case"string":return ru}throw new Error("v3d.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];qc.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}function su(e){this.manager=void 0!==e?e:ic,this.textures={}}Qc.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Qc,DefaultSettings_:{endingStart:Et,endingEnd:Et},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case Lt:i=e,o=2*t-n;break;case Ct:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Lt:a=e,s=2*n-t;break;case Ct:s=n+r[a=1]-r[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=a*c},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,_=0;_!==o;++_)i[_]=v*a[c+_]+g*a[l+_]+y*a[s+_]+x*a[u+_];return i}}),Zc.prototype=Object.assign(Object.create(Rl.prototype),{constructor:Zc,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Kc,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:qc.convertArray(e.times,Array),values:qc.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(Kc.prototype,{constructor:Kc,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Tt,InterpolantFactoryMethodDiscrete:function(e){return new Zc(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Fl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Qc(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Mt:t=this.InterpolantFactoryMethodDiscrete;break;case Tt:t=this.InterpolantFactoryMethodLinear;break;case St:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)return this.createInterpolant=t,this;var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("v3d.KeyframeTrack:",n),this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Mt;case this.InterpolantFactoryMethodLinear:return Tt;case this.InterpolantFactoryMethodSmooth:return St}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){a<=i&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=qc.arraySlice(n,i,a),this.values=qc.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("v3d.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("v3d.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("v3d.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("v3d.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&qc.isTypedArray(r)){o=0;for(var l=r.length;o!==l;++o){var c=r[o];if(isNaN(c)){console.error("v3d.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=this.getInterpolation()===St,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(r)s=!0;else for(var c=o*n,u=c-n,h=c+n,d=0;d!==n;++d){var p=t[c+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*n,m=i*n;for(d=0;d!==n;++d)t[m+d]=t[f+d]}++i}}if(0<a){e[i]=e[a];for(f=a*n,m=i*n,d=0;d!==n;++d)t[m+d]=t[f+d];++i}return i!==e.length&&(this.times=qc.arraySlice(e,0,i),this.values=qc.arraySlice(t,0,i*n)),this}}),Jc.prototype=Object.assign(Object.create(Kc.prototype),{constructor:Jc,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Mt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),$c.prototype=Object.assign(Object.create(Kc.prototype),{constructor:$c,ValueTypeName:"color"}),eu.prototype=Object.assign(Object.create(Kc.prototype),{constructor:eu,ValueTypeName:"number"}),tu.prototype=Object.assign(Object.create(Rl.prototype),{constructor:tu,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(r-t),c=s+o;s!==c;s+=4)Zt.slerpFlat(i,0,a,s-o,a,s,l);return i}}),nu.prototype=Object.assign(Object.create(Kc.prototype),{constructor:nu,ValueTypeName:"quaternion",DefaultInterpolation:Tt,InterpolantFactoryMethodLinear:function(e){return new tu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ru.prototype=Object.assign(Object.create(Kc.prototype),{constructor:ru,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Mt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),iu.prototype=Object.assign(Object.create(Kc.prototype),{constructor:iu,ValueTypeName:"vector"}),Object.assign(au,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(ou(n[i]).scale(r));return new au(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=n.length;i!==a;++i)t.push(Kc.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var c=qc.getKeyframeOrder(s);s=qc.sortedArray(s,1,c),l=qc.sortedArray(l,1,c),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new eu(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new au(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(i);if(l&&1<l.length){var c=r[h=l[1]];c||(r[h]=c=[]),c.push(s)}}var u=[];for(var h in r)u.push(au.CreateFromMorphTargetSequence(h,r[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("v3d.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];qc.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l<s.length;l++){var c=s[l].keys;if(c&&0!==c.length)if(c[0].morphTargets){for(var u={},h=0;h<c.length;h++)if(c[h].morphTargets)for(var d=0;d<c[h].morphTargets.length;d++)u[c[h].morphTargets[d]]=-1;for(var p in u){var f=[],m=[];for(d=0;d!==c[h].morphTargets.length;++d){var v=c[h];f.push(v.time),m.push(v.morphTarget===p?1:0)}r.push(new eu(".morphTargetInfluence["+p+"]",f,m))}a=u.length*(o||1)}else{var g=".bones["+t[l].name+"]";n(iu,g+".position",c,"pos",r),n(nu,g+".quaternion",c,"rot",r),n(iu,g+".scale",c,"scl",r)}}return 0===r.length?null:new au(i,a,r)}}),Object.assign(au.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}}),Object.assign(su.prototype,{load:function(e,t,n,r){var i=this,a=new oc(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("v3d.MaterialLoader: Undefined texture",e),t[e]}var r=new tc[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearCoat&&(r.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(r.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new Fn).setHex(a.value);break;case"v2":r.uniforms[i].value=(new qt).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Kt).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new xn).fromArray(a.value);break;case"m4":r.uniforms[i].value=(new Qt).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var o=e.normalScale;!1===Array.isArray(o)&&(o=[o,o]),r.normalScale=(new qt).fromArray(o)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),r},setPath:function(e){return this.path=e,this},setTextures:function(e){return this.textures=e,this}});var lu={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);return decodeURIComponent(escape(t))},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function cu(e){this.manager=void 0!==e?e:ic}Object.assign(cu.prototype,{load:function(e,t,n,r){var i=this,a=new oc(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e){var t=new Wr,n=e.data.index;if(void 0!==n){var r=new fu[n.type](n.array);t.setIndex(new Ar(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a];r=new fu[o.type](o.array);t.addAttribute(a,new Ar(r,o.itemSize,o.normalized))}var s=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==s)for(var l=0,c=s.length;l!==c;++l){var u=s[l];t.addGroup(u.start,u.count,u.materialIndex)}var h=e.data.boundingSphere;if(void 0!==h){var d=new Kt;void 0!==h.center&&d.fromArray(h.center),t.boundingSphere=new Mn(d,h.radius)}return t},setPath:function(e){return this.path=e,this}});var uu,hu,du,pu,fu={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function mu(){}function vu(e){"boolean"==typeof e&&(console.warn("v3d.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:ic,this.withCredentials=!1}function gu(e){this.manager=void 0!==e?e:ic,this.resourcePath=""}mu.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(mu.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(uu={NoBlending:Q,NormalBlending:Z,AdditiveBlending:K,SubtractiveBlending:J,MultiplyBlending:$,CustomBlending:ee},hu=new Fn,du=new hc,pu=new su,function(e,c,u){var h={};function t(e,t,n,r,i){var a,o=c+e,s=mu.Handlers.get(o);a=null!==s?s.load(o):(du.setCrossOrigin(u),du.load(o)),void 0!==t&&(a.repeat.fromArray(t),1!==t[0]&&(a.wrapS=we),1!==t[1]&&(a.wrapT=we)),void 0!==n&&a.offset.fromArray(n),void 0!==r&&("repeat"===r[0]&&(a.wrapS=we),"mirror"===r[0]&&(a.wrapS=Ee),"repeat"===r[1]&&(a.wrapT=we),"mirror"===r[1]&&(a.wrapT=Ee)),void 0!==i&&(a.anisotropy=i);var l=Yt.generateUUID();return h[l]=a,l}var n={uuid:Yt.generateUUID(),type:"MeshLambertMaterial"};for(var r in e){var i=e[r];switch(r){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":n.name=i;break;case"blending":n.blending=uu[i];break;case"colorAmbient":case"mapAmbient":console.warn("v3d.Loader.createMaterial:",r,"is no longer supported.");break;case"colorDiffuse":n.color=hu.fromArray(i).getHex();break;case"colorSpecular":n.specular=hu.fromArray(i).getHex();break;case"colorEmissive":n.emissive=hu.fromArray(i).getHex();break;case"specularCoef":n.shininess=i;break;case"shading":"basic"===i.toLowerCase()&&(n.type="MeshBasicMaterial"),"phong"===i.toLowerCase()&&(n.type="MeshPhongMaterial"),"standard"===i.toLowerCase()&&(n.type="MeshStandardMaterial");break;case"mapDiffuse":n.map=t(i,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":n.emissiveMap=t(i,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":n.lightMap=t(i,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":n.aoMap=t(i,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":n.bumpMap=t(i,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":n.bumpScale=i;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":n.normalMap=t(i,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":n.normalScale=i;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":n.specularMap=t(i,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":n.metalnessMap=t(i,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":n.roughnessMap=t(i,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":n.alphaMap=t(i,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":n.side=Me;break;case"doubleSided":n.side=ne;break;case"transparency":console.warn("v3d.Loader.createMaterial: transparency has been renamed to opacity"),n.opacity=i;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":n[r]=i;break;case"vertexColors":!0===i&&(n.vertexColors=M),"face"===i&&(n.vertexColors=1);break;default:console.error("v3d.Loader.createMaterial: Unsupported",r,i)}}return"MeshBasicMaterial"===n.type&&delete n.emissive,"MeshPhongMaterial"!==n.type&&delete n.specular,n.opacity<1&&(n.transparent=!0),pu.setTextures(h),pu.parse(n)})}),Object.assign(vu.prototype,{crossOrigin:"anonymous",load:function(a,o,e,t){var s=this,l=void 0===this.path?lu.extractUrlBase(a):this.path,n=new oc(this.manager);n.setPath(this.path),n.setWithCredentials(this.withCredentials),n.load(a,function(e){var t=JSON.parse(e),n=t.metadata;if(void 0!==n){var r=n.type;if(void 0!==r&&"object"===r.toLowerCase())return void console.error("v3d.JSONLoader: "+a+" should be loaded with v3d.ObjectLoader instead.")}var i=s.parse(t,l);o(i.geometry,i.materials)},e,t)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){void 0!==e.data&&(e=e.data),void 0!==e.scale?e.scale=1/e.scale:e.scale=1;var n=new wr;return function(e,t){function n(e,t){return e&1<<t}var r,i,a,o,s,l,c,u,h,d,p,f,m,v,g,y,x,_,b,w,A,M,T,S,E,L=e.faces,C=e.vertices,P=e.normals,N=e.colors,R=e.scale,F=0;if(void 0!==e.uvs){for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&F++;for(r=0;r<F;r++)t.faceVertexUvs[r]=[]}for(o=0,s=C.length;o<s;)(_=new Kt).x=C[o++]*R,_.y=C[o++]*R,_.z=C[o++]*R,t.vertices.push(_);for(o=0,s=L.length;o<s;)if(p=n(d=L[o++],0),f=n(d,1),m=n(d,3),v=n(d,4),g=n(d,5),y=n(d,6),x=n(d,7),p){if((w=new pr).a=L[o],w.b=L[o+1],w.c=L[o+3],(A=new pr).a=L[o+1],A.b=L[o+2],A.c=L[o+3],o+=4,f&&(h=L[o++],w.materialIndex=h,A.materialIndex=h),a=t.faces.length,m)for(r=0;r<F;r++)for(S=e.uvs[r],t.faceVertexUvs[r][a]=[],t.faceVertexUvs[r][a+1]=[],i=0;i<4;i++)E=new qt(S[2*(u=L[o++])],S[2*u+1]),2!==i&&t.faceVertexUvs[r][a].push(E),0!==i&&t.faceVertexUvs[r][a+1].push(E);if(v&&(c=3*L[o++],w.normal.set(P[c++],P[c++],P[c]),A.normal.copy(w.normal)),g)for(r=0;r<4;r++)c=3*L[o++],T=new Kt(P[c++],P[c++],P[c]),2!==r&&w.vertexNormals.push(T),0!==r&&A.vertexNormals.push(T);if(y&&(M=N[l=L[o++]],w.color.setHex(M),A.color.setHex(M)),x)for(r=0;r<4;r++)M=N[l=L[o++]],2!==r&&w.vertexColors.push(new Fn(M)),0!==r&&A.vertexColors.push(new Fn(M));t.faces.push(w),t.faces.push(A)}else{if((b=new pr).a=L[o++],b.b=L[o++],b.c=L[o++],f&&(h=L[o++],b.materialIndex=h),a=t.faces.length,m)for(r=0;r<F;r++)for(S=e.uvs[r],t.faceVertexUvs[r][a]=[],i=0;i<3;i++)E=new qt(S[2*(u=L[o++])],S[2*u+1]),t.faceVertexUvs[r][a].push(E);if(v&&(c=3*L[o++],b.normal.set(P[c++],P[c++],P[c])),g)for(r=0;r<3;r++)c=3*L[o++],T=new Kt(P[c++],P[c++],P[c]),b.vertexNormals.push(T);if(y&&(l=L[o++],b.color.setHex(N[l])),x)for(r=0;r<3;r++)l=L[o++],b.vertexColors.push(new Fn(N[l]));t.faces.push(b)}}(e,n),function(e,t){var n=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;r<i;r+=n){var a=e.skinWeights[r],o=1<n?e.skinWeights[r+1]:0,s=2<n?e.skinWeights[r+2]:0,l=3<n?e.skinWeights[r+3]:0;t.skinWeights.push(new xn(a,o,s,l))}if(e.skinIndices)for(r=0,i=e.skinIndices.length;r<i;r+=n){var c=e.skinIndices[r],u=1<n?e.skinIndices[r+1]:0,h=2<n?e.skinIndices[r+2]:0,d=3<n?e.skinIndices[r+3]:0;t.skinIndices.push(new xn(c,u,h,d))}t.bones=e.bones,t.bones&&0<t.bones.length&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,n),function(e,t){var n=e.scale;if(void 0!==e.morphTargets)for(var r=0,i=e.morphTargets.length;r<i;r++){t.morphTargets[r]={},t.morphTargets[r].name=e.morphTargets[r].name,t.morphTargets[r].vertices=[];for(var a=t.morphTargets[r].vertices,o=e.morphTargets[r].vertices,s=0,l=o.length;s<l;s+=3){var c=new Kt;c.x=o[s]*n,c.y=o[s+1]*n,c.z=o[s+2]*n,a.push(c)}}if(void 0!==e.morphColors&&0<e.morphColors.length){console.warn('v3d.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var u=t.faces,h=e.morphColors[0].colors;for(r=0,i=u.length;r<i;r++)u[r].color.fromArray(h,3*r)}}(e,n),function(e,t){var n=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var i=0;i<r.length;i++){var a=au.parseAnimation(r[i],t.bones);a&&n.push(a)}if(t.morphTargets){var o=au.CreateClipsFromMorphTargetSequences(t.morphTargets,10);n=n.concat(o)}0<n.length&&(t.animations=n)}(e,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:n}:{geometry:n,materials:mu.prototype.initMaterials(e.materials,this.resourcePath||t,this.crossOrigin)}}}),Object.assign(gu.prototype,{crossOrigin:"anonymous",load:function(r,i,e,a){var o=this,t=void 0===this.path?lu.extractUrlBase(r):this.path;this.resourcePath=this.resourcePath||t;var n=new oc(o.manager);n.setPath(this.path),n.load(r,function(e){var t=null;try{t=JSON.parse(e)}catch(e){return void 0!==a&&a(e),void console.error("v3d:ObjectLoader: Can't parse "+r+".",e.message)}var n=t.metadata;void 0!==n&&void 0!==n.type&&"geometry"!==n.type.toLowerCase()?o.parse(t,i):console.error("v3d.ObjectLoader: Can't load "+r+". Use v3d.JSONLoader instead.")},e,a)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new Uc).fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var r=new vu,i=new cu,a=0,o=e.length;a<o;a++){var s,l=e[a];switch(l.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new dl[l.type](l.width,l.height,l.widthSegments,l.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new dl[l.type](l.width,l.height,l.depth,l.widthSegments,l.heightSegments,l.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new dl[l.type](l.radius,l.segments,l.thetaStart,l.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new dl[l.type](l.radiusTop,l.radiusBottom,l.height,l.radialSegments,l.heightSegments,l.openEnded,l.thetaStart,l.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new dl[l.type](l.radius,l.height,l.radialSegments,l.heightSegments,l.openEnded,l.thetaStart,l.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new dl[l.type](l.radius,l.widthSegments,l.heightSegments,l.phiStart,l.phiLength,l.thetaStart,l.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new dl[l.type](l.radius,l.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new dl[l.type](l.innerRadius,l.outerRadius,l.thetaSegments,l.phiSegments,l.thetaStart,l.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new dl[l.type](l.radius,l.tube,l.radialSegments,l.tubularSegments,l.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new dl[l.type](l.radius,l.tube,l.tubularSegments,l.radialSegments,l.p,l.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new dl[l.type](l.points,l.segments,l.phiStart,l.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new dl[l.type](l.vertices,l.indices,l.radius,l.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],u=0,h=l.shapes.length;u<h;u++){var d=t[l.shapes[u]];c.push(d)}s=new dl[l.type](c,l.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],u=0,h=l.shapes.length;u<h;u++){d=t[l.shapes[u]];c.push(d)}var p=l.options.extrudePath;void 0!==p&&(l.options.extrudePath=(new Oc[p.type]).fromJSON(p)),s=new dl[l.type](c,l.options);break;case"BufferGeometry":s=i.parse(l);break;case"Geometry":s=r.parse(l,this.resourcePath).geometry;break;default:console.warn('v3d.ObjectLoader: Unsupported geometry type "'+l.type+'"');continue}s.uuid=l.uuid,void 0!==l.name&&(s.name=l.name),!0===s.isBufferGeometry&&void 0!==l.userData&&(s.userData=l.userData),n[l.uuid]=s}return n},parseMaterials:function(e,t){var n={},r={};if(void 0!==e){var i=new su;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var u=s.materials[c];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),l.push(n[u.uuid])}r[s.uuid]=l}else r[s.uuid]=i.parse(s),n[s.uuid]=r[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=au.parse(r);void 0!==r.uuid&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,function(){n.manager.itemEnd(e)},void 0,function(){n.manager.itemError(e),n.manager.itemEnd(e)})}if(void 0!==e&&0<e.length){var a=new cc(new rc(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.url;if(Array.isArray(c)){r[l.uuid]=[];for(var u=0,h=c.length;u<h;u++){var d=c[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;r[l.uuid].push(i(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;r[l.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("v3d.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];void 0===s.image&&console.warn('v3d.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("v3d.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new zi(t[s.image]):new yn(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,xu)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],_u),o.wrapT=n(s.wrap[1],_u)),void 0!==s.format&&(o.format=s.format),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,bu)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,bu)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),r[s.uuid]=o}return r},parseObject:function(e,t,a){var n;function r(e){return void 0===t[e]&&console.warn("v3d.ObjectLoader: Undefined geometry",e),t[e]}function i(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];void 0===a[i]&&console.warn("v3d.ObjectLoader: Undefined material",i),t.push(a[i])}return t}return void 0===a[e]&&console.warn("v3d.ObjectLoader: Undefined material",e),a[e]}}switch(e.type){case"Scene":n=new Do,void 0!==e.background&&Number.isInteger(e.background)&&(n.background=new Fn(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?n.fog=new Io(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(n.fog=new Oo(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":n=new oo(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(n.focus=e.focus),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.filmGauge&&(n.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(n.filmOffset=e.filmOffset),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"OrthographicCamera":n=new dr(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case"AmbientLight":n=new Hc(e.color,e.intensity);break;case"DirectionalLight":n=new Wc(e.color,e.intensity);break;case"PointLight":n=new jc(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":n=new Yc(e.color,e.intensity,e.width,e.height);break;case"SpotLight":n=new Vc(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":n=new zc(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("v3d.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=r(e.geometry),s=i(e.material);n=o.bones&&0<o.bones.length?new Xo(o,s):new Ei(o,s);break;case"LOD":n=new Go;break;case"Line":n=new Ho(r(e.geometry),i(e.material),e.mode);break;case"LineLoop":n=new qo(r(e.geometry),i(e.material));break;case"LineSegments":n=new Yo(r(e.geometry),i(e.material));break;case"PointCloud":case"Points":n=new Zo(r(e.geometry),i(e.material));break;case"Sprite":n=new ko(i(e.material));break;case"Group":n=new ao;break;default:n=new ur}if(n.uuid=e.uuid,void 0!==e.name&&(n.name=e.name),void 0!==e.matrix?(n.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==e.position&&n.position.fromArray(e.position),void 0!==e.rotation&&n.rotation.fromArray(e.rotation),void 0!==e.quaternion&&n.quaternion.fromArray(e.quaternion),void 0!==e.scale&&n.scale.fromArray(e.scale)),void 0!==e.castShadow&&(n.castShadow=e.castShadow),void 0!==e.receiveShadow&&(n.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(n.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(n.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&n.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(n.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.frustumCulled&&(n.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(n.renderOrder=e.renderOrder),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.layers&&(n.layers.mask=e.layers),void 0!==e.children)for(var l=e.children,c=0;c<l.length;c++)n.add(this.parseObject(l[c],t,a));if("LOD"===e.type)for(var u=e.levels,h=0;h<u.length;h++){var d=u[h],p=n.getObjectByProperty("uuid",d.object);void 0!==p&&n.addLevel(p,d.distance)}return n}});var yu,xu={UVMapping:300,CubeReflectionMapping:me,CubeRefractionMapping:ve,EquirectangularReflectionMapping:ge,EquirectangularRefractionMapping:ye,SphericalReflectionMapping:xe,CubeUVReflectionMapping:_e,CubeUVRefractionMapping:be},_u={RepeatWrapping:we,ClampToEdgeWrapping:Se,MirroredRepeatWrapping:Ee},bu={NearestFilter:Le,NearestMipMapNearestFilter:Ce,NearestMipMapLinearFilter:Pe,LinearFilter:Ne,LinearMipMapNearestFilter:Re,LinearMipMapLinearFilter:Fe};function wu(e){"undefined"==typeof createImageBitmap&&console.warn("v3d.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("v3d.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:ic,this.options=void 0}function Au(){this.type="ShapePath",this.color=new Fn,this.subPaths=[],this.currentPath=null}function Mu(e){this.type="Font",this.data=e}function Tu(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,l,c,u,h,d,p,f=new Au;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+r,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+r,f.lineTo(o,s);break;case"q":l=m[v++]*t+n,c=m[v++]*t+r,u=m[v++]*t+n,h=m[v++]*t+r,f.quadraticCurveTo(u,h,l,c);break;case"b":l=m[v++]*t+n,c=m[v++]*t+r,u=m[v++]*t+n,h=m[v++]*t+r,d=m[v++]*t+n,p=m[v++]*t+r,f.bezierCurveTo(u,h,d,p,l,c)}}return{offsetX:a.ha*t,path:f}}}function Su(e){this.manager=void 0!==e?e:ic}wu.prototype={constructor:wu,setOptions:function(e){return this.options=e,this},load:function(t,n,e,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=nc.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout(function(){n&&n(a),i.manager.itemEnd(t)},0),a;fetch(t).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,i.options)}).then(function(e){nc.add(t,e),n&&n(e),i.manager.itemEnd(t)}).catch(function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}},Object.assign(Au.prototype,{moveTo:function(e,t){this.currentPath=new Dc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,n,r){this.currentPath.quadraticCurveTo(e,t,n,r)},bezierCurveTo:function(e,t,n,r,i,a){this.currentPath.bezierCurveTo(e,t,n,r,i,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new Uc;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[i],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=c*(e.x-o.x)-l*(e.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=Gs.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new Uc).curves=s.curves,c.push(l),c;var u=!i(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(h=(s=a[g]).getPoints()),(o=e?!o:o)?(!u&&f[v]&&v++,f[v]={s:new Uc,p:h},f[v].s.curves=s.curves,u&&v++,m[v]=[]):m[v].push({h:s,p:h[0]});if(!f[0])return n(a);if(1<f.length){for(var x=!1,_=[],b=0,w=f.length;b<w;b++)p[b]=[];for(b=0,w=f.length;b<w;b++)for(var A=m[b],M=0;M<A.length;M++){for(var T=A[M],S=!0,E=0;E<f.length;E++)r(T.p,f[E].p)&&(b!==E&&_.push({froms:b,tos:E,hole:M}),S?(S=!1,p[E].push(T)):x=!0);S&&p[b].push(T)}0<_.length&&(x||(m=p))}g=0;for(var L=f.length;g<L;g++){l=f[g].s,c.push(l);for(var C=0,P=(d=m[g]).length;C<P;C++)l.holes.push(d[C].h)}return c}}),Object.assign(Mu.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],r=function(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,l=0,c=0;c<r.length;c++){var u=r[c];if("\n"===u)s=0,l-=a;else{var h=Tu(u,i,s,l,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),Object.assign(Su.prototype,{load:function(e,r,t,n){var i=this,a=new oc(this.manager);a.setPath(this.path),a.load(e,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("v3d.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var e=i.parse(n);r&&r(e)},t,n)},parse:function(e){return new Mu(e)},setPath:function(e){return this.path=e,this}});var Eu,Lu,Cu,Pu,Nu,Ru,Fu,Ou,Iu,Du,Uu,Bu,zu,ku,Gu,Vu,ju,Xu,Wu,Hu={getContext:function(){return void 0===yu&&(yu=new(window.AudioContext||window.webkitAudioContext)),yu},setContext:function(e){yu=e}};function Yu(e){this.manager=void 0!==e?e:ic}function qu(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new oo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new oo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Qu(e,t,n,r){ur.call(this),this.type="CubeCamera";var i=new oo(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new Kt(1,0,0)),this.add(i);var a=new oo(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new Kt(-1,0,0)),this.add(a);var o=new oo(90,1,e,t);o.up.set(0,0,1),o.lookAt(new Kt(0,1,0)),this.add(o);var s=new oo(90,1,e,t);s.up.set(0,0,-1),s.lookAt(new Kt(0,-1,0)),this.add(s);var l=new oo(90,1,e,t);l.up.set(0,-1,0),l.lookAt(new Kt(0,0,1)),this.add(l);var c=new oo(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new Kt(0,0,-1)),this.add(c),r=r||{format:Ye,magFilter:Ne,minFilter:Ne},this.renderTarget=new bn(n,n,r),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,i,n),n.activeCubeFace=1,e.render(t,a,n),n.activeCubeFace=2,e.render(t,o,n),n.activeCubeFace=3,e.render(t,s,n),n.activeCubeFace=4,e.render(t,l,n),n.texture.generateMipmaps=r,n.activeCubeFace=5,e.render(t,c,n),e.setRenderTarget(null)},this.clear=function(e,t,n,r){for(var i=this.renderTarget,a=0;a<6;a++)i.activeCubeFace=a,e.setRenderTarget(i),e.clear(t,n,r);e.setRenderTarget(null)}}function Zu(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Ku(){ur.call(this),this.type="AudioListener",this.context=Hu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0}function Ju(e){ur.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function $u(e){Ju.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function eh(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function th(e,t,n){this.binding=e,this.valueSize=n;var r,i=Float64Array;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(Yu.prototype,{load:function(e,n,t,r){var i=new oc(this.manager);i.setResponseType("arraybuffer"),i.setPath(this.path),i.load(e,function(e){var t=e.slice(0);Hu.getContext().decodeAudioData(t,function(e){n(e)})},t,r)},setPath:function(e){return this.path=e,this}}),Object.assign(qu.prototype,{update:(Iu=new Qt,Du=new Qt,function(e){if(Eu!==this||Lu!==e.focus||Cu!==e.fov||Pu!==e.aspect*this.aspect||Nu!==e.near||Ru!==e.far||Fu!==e.zoom||Ou!==this.eyeSep){Eu=this,Lu=e.focus,Cu=e.fov,Pu=e.aspect*this.aspect,Nu=e.near,Ru=e.far,Fu=e.zoom;var t,n,r=e.projectionMatrix.clone(),i=(Ou=this.eyeSep/2)*Nu/Lu,a=Nu*Math.tan(Yt.DEG2RAD*Cu*.5)/Fu;Du.elements[12]=-Ou,Iu.elements[12]=Ou,t=-a*Pu+i,n=a*Pu+i,r.elements[0]=2*Nu/(n-t),r.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(r),t=-a*Pu-i,n=a*Pu-i,r.elements[0]=2*Nu/(n-t),r.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Du),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Iu)})}),(Qu.prototype=Object.create(ur.prototype)).constructor=Qu,Object.assign(Zu.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),Ku.prototype=Object.assign(Object.create(ur.prototype),{constructor:Ku,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:(Uu=new Kt,Bu=new Zt,zu=new Kt,ku=new Kt,Gu=new Zu,function(e){ur.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=Gu.getDelta(),this.matrixWorld.decompose(Uu,Bu,zu),ku.set(0,0,-1).applyQuaternion(Bu),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Uu.x,r),t.positionY.linearRampToValueAtTime(Uu.y,r),t.positionZ.linearRampToValueAtTime(Uu.z,r),t.forwardX.linearRampToValueAtTime(ku.x,r),t.forwardY.linearRampToValueAtTime(ku.y,r),t.forwardZ.linearRampToValueAtTime(ku.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(Uu.x,Uu.y,Uu.z),t.setOrientation(ku.x,ku.y,ku.z,n.x,n.y,n.z)})}),Ju.prototype=Object.assign(Object.create(ur.prototype),{constructor:Ju,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),e.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,this.connect()}console.warn("v3d.Audio: this Audio has no playback control.")}else console.warn("v3d.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this;console.warn("v3d.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this;console.warn("v3d.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("v3d.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("v3d.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("v3d.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),$u.prototype=Object.assign(Object.create(Ju.prototype),{constructor:$u,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:(Vu=new Kt,ju=new Zt,Xu=new Kt,Wu=new Kt,function(e){ur.prototype.updateMatrixWorld.call(this,e);var t=this.panner;if(this.matrixWorld.decompose(Vu,ju,Xu),Wu.set(0,0,1).applyQuaternion(ju),t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Vu.x,n),t.positionY.linearRampToValueAtTime(Vu.y,n),t.positionZ.linearRampToValueAtTime(Vu.z,n),t.orientationX.linearRampToValueAtTime(Wu.x,n),t.orientationY.linearRampToValueAtTime(Wu.y,n),t.orientationZ.linearRampToValueAtTime(Wu.z,n)}else t.setPosition(Vu.x,Vu.y,Vu.z),t.setOrientation(Wu.x,Wu.y,Wu.z)})}),Object.assign(eh.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(th.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*t;this._mixBufferRegion(n,r,o,1-i,t)}for(var s=t,l=t+t;s!==l;++s)if(n[s]!==n[s+t]){a.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=3*n;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,n,r,i){if(.5<=r)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){Zt.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}});var nh,rh,ih,ah,oh,sh,lh,ch,uh,hh,dh,ph,fh,mh,vh,gh,yh,xh,_h,bh,wh,Ah,Mh,Th,Sh,Eh,Lh,Ch,Ph,Nh,Rh,Fh,Oh,Ih,Dh,Uh="\\[\\]\\.:\\/";function Bh(e,t,n){var r=n||zh.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function zh(e,t,n){this.path=t,this.parsedPath=n||zh.parseTrackName(t),this.node=zh.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function kh(){this.uuid=Yt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Gh(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var r=t.tracks,i=r.length,a=new Array(i),o={endingStart:Et,endingEnd:Et},s=0;s!==i;++s){var l=r[s].createInterpolant(null);(a[s]=l).settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._pingIsEven=!0,this._startTime=null,this.time=0,this.timeStart=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Vh(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function jh(e){"string"==typeof e&&(console.warn("v3d.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Xh(){Wr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Wh(e,t,n){Uo.call(this,e,t),this.meshPerAttribute=n||1}function Hh(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("v3d.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Ar.call(this,e,t,n),this.meshPerAttribute=r||1}function Yh(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}function qh(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}function Qh(e,t){this.min=void 0!==e?e:new qt(1/0,1/0),this.max=void 0!==t?t:new qt(-1/0,-1/0)}function Zh(e,t){this.start=void 0!==e?e:new Kt,this.end=void 0!==t?t:new Kt}function Kh(e){ur.call(this),this.material=e,this.render=function(){}}function Jh(e,t,n,r){this.object=e,this.size=void 0!==t?t:1;var i=void 0!==n?n:16711680,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new Wr,c=new Nr(2*o*3,3);l.addAttribute("position",c),Yo.call(this,l,new Wo({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function $h(e,t){ur.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Wr,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.addAttribute("position",new Nr(r,3));var l=new Wo({fog:!1});this.cone=new Yo(n,l),this.add(this.cone),this.update()}function ed(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var r=0;r<t.children.length;r++)n.push.apply(n,e(t.children[r]));return n}(e),n=new Wr,r=[],i=[],a=new Fn(0,0,1),o=new Fn(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.addAttribute("position",new Nr(r,3)),n.addAttribute("color",new Nr(i,3));var c=new Wo({vertexColors:M,depthTest:!1,depthWrite:!1,transparent:!0});Yo.call(this,n,c),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function td(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Ks(t,4,2),i=new Ai({wireframe:!0,fog:!1});Ei.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function nd(e,t){ur.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;var n=new Wo({fog:!1}),r=new Wr;r.addAttribute("position",new Ar(new Float32Array(15),3)),this.line=new Ho(r,n),this.add(this.line),this.update()}function rd(e,t,n){ur.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new cs(t);r.rotateY(.5*Math.PI),this.material=new Ai({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=M);var i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.addAttribute("color",new Ar(a,3)),this.add(new Ei(r,this.material)),this.update()}function id(e,t,n,r){e=e||10,t=t||10,n=new Fn(void 0!==n?n:4473924),r=new Fn(void 0!==r?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],l=[],c=0,u=0,h=-o;c<=t;c++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=c===i?n:r;d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3}var p=new Wr;p.addAttribute("position",new Nr(s,3)),p.addAttribute("color",new Nr(l,3));var f=new Wo({vertexColors:M});Yo.call(this,p,f)}function ad(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new Fn(void 0!==i?i:4473924),a=new Fn(void 0!==a?a:8947848);var o,s,l,c,u,h,d,p=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,p.push(0,0,0),p.push(o,0,s),d=1&c?i:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(c=0;c<=n;c++)for(d=1&c?i:a,h=e-e/n*c,u=0;u<r;u++)l=u/r*(2*Math.PI),o=Math.sin(l)*h,s=Math.cos(l)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),l=(u+1)/r*(2*Math.PI),o=Math.sin(l)*h,s=Math.cos(l)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Wr;m.addAttribute("position",new Nr(p,3)),m.addAttribute("color",new Nr(f,3));var v=new Wo({vertexColors:M});Yo.call(this,m,v)}function od(e,t,n,r){this.object=e,this.size=void 0!==t?t:1;var i=void 0!==n?n:16776960,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("v3d.FaceNormalsHelper: only v3d.Geometry is supported. Use v3d.VertexNormalsHelper, instead.");var l=new Wr,c=new Nr(2*o*3,3);l.addAttribute("position",c),Yo.call(this,l,new Wo({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function sd(e,t,n){ur.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var r=new Wr;r.addAttribute("position",new Nr([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new Wo({fog:!1});this.lightPlane=new Ho(r,i),this.add(this.lightPlane),(r=new Wr).addAttribute("position",new Nr([0,0,0,0,0,1],3)),this.targetLine=new Ho(r,i),this.add(this.targetLine),this.update()}function ld(e){var t=new Wr,n=new Wo({color:16777215,vertexColors:1}),r=[],i=[],a={},o=new Fn(16755200),s=new Fn(16711680),l=new Fn(43775),c=new Fn(16777215),u=new Fn(3355443);function h(e,t,n){d(e,n),d(t,n)}function d(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),h("c","t",c),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.addAttribute("position",new Nr(r,3)),t.addAttribute("color",new Nr(i,3)),Yo.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function cd(e,t){this.object=e,void 0===t&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new Wr;i.setIndex(new Ar(n,1)),i.addAttribute("position",new Ar(r,3)),Yo.call(this,i,new Wo({color:t})),this.matrixAutoUpdate=!1,this.update()}function ud(e,t){this.type="Box3Helper",this.box=e;var n=void 0!==t?t:16776960,r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Wr;i.setIndex(new Ar(r,1)),i.addAttribute("position",new Nr([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),Yo.call(this,i,new Wo({color:n})),this.geometry.computeBoundingSphere()}function hd(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var r=void 0!==n?n:16776960,i=new Wr;i.addAttribute("position",new Nr([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,0,1,0,0,0],3)),i.computeBoundingSphere(),Ho.call(this,i,new Wo({color:r}));var a=new Wr;a.addAttribute("position",new Nr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Ei(a,new Ai({color:r,opacity:.2,transparent:!0,depthWrite:!1})))}function dd(e,t,n,r,i,a){ur.call(this),void 0===e&&(e=new v3d.Vector3(0,0,1)),void 0===t&&(t=new v3d.Vector3(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===a&&(a=.2*i),void 0===Fh&&((Fh=new Wr).addAttribute("position",new Nr([0,0,0,0,1,0],3)),(Oh=new sl(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Ho(Fh,new Wo({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ei(Oh,new Ai({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function pd(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Wr;n.addAttribute("position",new Nr(t,3)),n.addAttribute("color",new Nr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new Wo({vertexColors:M});Yo.call(this,n,r)}Object.assign(Bh.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(zh,{Composite:Bh,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new zh.Composite(e,t,n):new zh(e,t,n)},sanitizeNodeName:(uh=new RegExp("["+Uh+"]","g"),function(e){return e.replace(/\s/g,"_").replace(uh,"")}),parseTrackName:(nh="[^"+Uh+"]",rh="[^"+Uh.replace("\\.","")+"]",ih=/((?:WC+[\/:])*)/.source.replace("WC",nh),ah=/(WCOD+)?/.source.replace("WCOD",rh),oh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nh),sh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nh),lh=new RegExp("^"+ih+ah+oh+sh+"$"),ch=["material","materials","bones"],function(e){var t=lh.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==ch.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}),findNode:function(e,i){if(!i||""===i||"root"===i||"."===i||-1===i||i===e.name||i===e.uuid)return e;if(e.skeleton){var t=e.skeleton.getBoneByName(i);if(void 0!==t)return t}if(e.children){var a=function(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.name===i||n.uuid===i)return n;var r=a(n.children);if(r)return r}return null},n=a(e.children);if(n)return n}return null}}),Object.assign(zh.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=zh.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("v3d.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("v3d.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("v3d.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("v3d.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("v3d.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[r];if(void 0!==s){var l=this.Versioning.None;void 0!==(this.targetObject=e).needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("v3d.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("v3d.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!e.geometry.morphTargets)return void console.error("v3d.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===i){i=o;break}}}else if("nodeValue"==r){if(i=i.replace(/"/g,""),!e.nodeValueMap)return void console.error("v3d.PropertyBinding: Trying to animate nodes in non-node material",this);if(void 0===(i=e.nodeValueMap[i]))return void console.error("v3d.PropertyBinding: Animated node not found ",this)}if(c=this.BindingType.ArrayElement,"nodeRGB"==r){if(i=i.replace(/"/g,""),!e.nodeRGBMap)return void console.error("v3d.PropertyBinding: Trying to animate nodes in non-node material",this);if(void 0===(i=e.nodeRGBMap[i]))return void console.error("v3d.PropertyBinding: Animated node not found ",this);c=this.BindingType.HasFromToArray,s=e.nodeRGB[i]}this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var u=t.nodeName;console.error("v3d.PropertyBinding: Trying to update property for track: "+u+"."+r+" but it wasn't found.",e)}}else console.error("v3d.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(zh.prototype,{_getValue_unbound:zh.prototype.getValue,_setValue_unbound:zh.prototype.setValue}),Object.assign(kh.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,u=arguments.length;c!==u;++c){var h=arguments[c],d=h.uuid,p=r[d];if(void 0===p){p=t++,r[d]=p,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new zh(h,i[f],a[f]))}else if(p<n){l=e[p];var v=--n,g=e[v];e[r[g.uuid]=p]=g,e[r[d]=v]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],_=y[p];y[p]=x,void 0===_&&(_=new zh(h,i[f],a[f])),y[v]=_}}else e[p]!==l&&console.error("v3d.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=n[l];if(void 0!==c&&t<=c){var u=t++,h=e[u];e[n[h.uuid]=c]=h,e[n[l]=u]=s;for(var d=0,p=i;d!==p;++d){var f=r[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o].uuid,c=r[l];if(void 0!==c)if(delete r[l],c<n){var u=--n,h=e[u],d=e[g=--t];e[r[h.uuid]=c]=h,e[r[d.uuid]=u]=d,e.pop();for(var p=0,f=a;p!==f;++p){var m=(y=i[p])[u],v=y[g];y[c]=m,y[u]=v,y.pop()}}else{var g;e[r[(d=e[g=--t]).uuid]=c]=d,e.pop();for(p=0,f=a;p!==f;++p){var y;(y=i[p])[c]=y[g],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new zh(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];a[t[e[o]]=n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign(Gh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._pingIsEven=!0,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(0<s)for(var l=this._interpolants,c=this._propertyBindings,u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t},_loopIsPing:function(e){return 2202!==this.loop||(-1==e||0==(1&e)===this._pingIsEven)},_updateTime:function(e){if(0===e)return this.time;if(2200!==this.loop&&this.repetitions<=0)return this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1}),this.time;var t=this.timeStart,n=Math.max(t,this._clip.duration),r=n-t;if(2200===this.loop)return this.time+=e,-1===this._loopCount&&(this._loopCount=0,this._setEndings(!0,!0,!1)),(this.time<t||this.time>n)&&(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Yt.clamp(this.time,t,n),this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})),this.time;var i=2202===this.loop,a=this._loopIsPing(this._loopCount)?1:-1;this.time+=a*e;var o=this.time<t||this.time>n,s=!1;if(-1===this._loopCount&&(s=o,this._loopCount=s?-1:0,this._pingIsEven=!s,0<=e?this._setEndings(!0,0===this.repetitions,i):this._setEndings(0===this.repetitions,!0,i)),o){var l=Math.floor((this.time-t)/r);this._loopCount+=Math.abs(l);var c=this.repetitions-this._loopCount;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=Yt.clamp(this.time,t,n),this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1});else{if(1==c){var u=e<0;this._setEndings(u,!u,i)}else this._setEndings(!1,!1,i);var h=(this.time-t)%r;h<0&&(h+=r),this.time=i?n-h:h+t,s||this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}return this.time},_setEndings:function(e,t,n){var r=this._interpolantSettings;r.endingEnd=n?r.endingStart=Lt:(r.endingStart=e?this.zeroSlopeAtStart?Lt:Et:Ct,t?this.zeroSlopeAtEnd?Lt:Et:Ct)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),Vh.prototype=Object.assign(Object.create(t.prototype),{constructor:Vh,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new th(zh.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;t[n._cacheIndex=r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;s[l._byClipCacheIndex=c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;void 0===i&&(i={},r[t]=i),(i[n]=e)._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],l=e._cacheIndex;t[s._cacheIndex=l]=s,t.pop(),delete o[i];e:{for(var c in o)break e;delete a[r]}},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&(e[(n=new Fl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];t[e.__cacheIndex=r]=e,t[i.__cacheIndex=n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?au.findByName(n,e):e,a=null!==i?i.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var l=o.actionByRoot[r];if(void 0!==l)return l;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var c=new Gh(this,i,t);return this._bindAction(c,s),this._addInactiveAction(c,a,r),c},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?au.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0;for(var i=this._nActiveBindings=0;i!==t;++i)e[i].reset();for(i=0;i!==r;++i)n[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}var s=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,t[u._cacheIndex=c]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),jh.prototype.clone=function(){return new jh(void 0===this.value.clone?this.value:this.value.clone())},Xh.prototype=Object.assign(Object.create(Wr.prototype),{constructor:Xh,isInstancedBufferGeometry:!0,copy:function(e){return Wr.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Wh.prototype=Object.assign(Object.create(Uo.prototype),{constructor:Wh,isInstancedInterleavedBuffer:!0,copy:function(e){return Uo.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Hh.prototype=Object.assign(Object.create(Ar.prototype),{constructor:Hh,isInstancedBufferAttribute:!0,copy:function(e){return Ar.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(Yh.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Yt.clamp(t/this.radius,-1,1))),this}}),Object.assign(qh.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}}),Object.assign(Qh.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:(dh=new qt,function(e,t){var n=dh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("v3d.Box2: .getCenter() target is now required"),e=new qt),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("v3d.Box2: .getSize() target is now required"),e=new qt),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("v3d.Box2: .getParameter() target is now required"),t=new qt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("v3d.Box2: .clampPoint() target is now required"),t=new qt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:(hh=new qt,function(e){return hh.copy(e).clamp(this.min,this.max).sub(e).length()}),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(Zh.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("v3d.Line3: .getCenter() target is now required"),e=new Kt),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("v3d.Line3: .delta() target is now required"),e=new Kt),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("v3d.Line3: .at() target is now required"),t=new Kt),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(ph=new Kt,fh=new Kt,function(e,t){ph.subVectors(e,this.start),fh.subVectors(this.end,this.start);var n=fh.dot(fh),r=fh.dot(ph)/n;return t&&(r=Yt.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("v3d.Line3: .closestPointToPoint() target is now required"),n=new Kt),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),((Kh.prototype=Object.create(ur.prototype)).constructor=Kh).prototype.isImmediateRenderObject=!0,((Jh.prototype=Object.create(Yo.prototype)).constructor=Jh).prototype.update=(mh=new Kt,vh=new Kt,gh=new Jt,function(){var e=["a","b","c"];this.object.updateMatrixWorld(!0),gh.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,n=this.geometry.attributes.position,r=this.object.geometry;if(r&&r.isGeometry)for(var i=r.vertices,a=r.faces,o=0,s=0,l=a.length;s<l;s++)for(var c=a[s],u=0,h=c.vertexNormals.length;u<h;u++){var d=i[c[e[u]]],p=c.vertexNormals[u];mh.copy(d).applyMatrix4(t),vh.copy(p).applyMatrix3(gh).normalize().multiplyScalar(this.size).add(mh),n.setXYZ(o,mh.x,mh.y,mh.z),o+=1,n.setXYZ(o,vh.x,vh.y,vh.z),o+=1}else if(r&&r.isBufferGeometry){var f=r.attributes.position,m=r.attributes.normal;for(u=o=0,h=f.count;u<h;u++)mh.set(f.getX(u),f.getY(u),f.getZ(u)).applyMatrix4(t),vh.set(m.getX(u),m.getY(u),m.getZ(u)),vh.applyMatrix3(gh).normalize().multiplyScalar(this.size).add(mh),n.setXYZ(o,mh.x,mh.y,mh.z),o+=1,n.setXYZ(o,vh.x,vh.y,vh.z),o+=1}n.needsUpdate=!0}),(($h.prototype=Object.create(ur.prototype)).constructor=$h).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},$h.prototype.update=(yh=new Kt,xh=new Kt,function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),yh.setFromMatrixPosition(this.light.matrixWorld),xh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(xh.sub(yh)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}),((ed.prototype=Object.create(Yo.prototype)).constructor=ed).prototype.updateMatrixWorld=(_h=new Kt,bh=new Qt,wh=new Qt,function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");wh.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(bh.multiplyMatrices(wh,o.matrixWorld),_h.setFromMatrixPosition(bh),r.setXYZ(a,_h.x,_h.y,_h.z),bh.multiplyMatrices(wh,o.parent.matrixWorld),_h.setFromMatrixPosition(bh),r.setXYZ(a+1,_h.x,_h.y,_h.z),a+=2)}n.getAttribute("position").needsUpdate=!0,ur.prototype.updateMatrixWorld.call(this,e)}),((td.prototype=Object.create(Ei.prototype)).constructor=td).prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},td.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},((nd.prototype=Object.create(ur.prototype)).constructor=nd).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},nd.prototype.update=function(){var e=.5*this.light.width,t=.5*this.light.height,n=this.line.geometry.attributes.position,r=n.array;r[0]=e,r[1]=-t,r[2]=0,r[3]=e,r[4]=t,r[5]=0,r[6]=-e,r[7]=t,r[8]=0,r[9]=-e,r[10]=-t,r[11]=0,r[12]=e,r[13]=-t,r[14]=0,n.needsUpdate=!0,void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},((rd.prototype=Object.create(ur.prototype)).constructor=rd).prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},rd.prototype.update=(Ah=new Kt,Mh=new Fn,Th=new Fn,function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Mh.copy(this.light.color),Th.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?Mh:Th;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(Ah.setFromMatrixPosition(this.light.matrixWorld).negate())}),(id.prototype=Object.create(Yo.prototype)).constructor=id,(ad.prototype=Object.create(Yo.prototype)).constructor=ad,((od.prototype=Object.create(Yo.prototype)).constructor=od).prototype.update=(Sh=new Kt,Eh=new Kt,Lh=new Jt,function(){this.object.updateMatrixWorld(!0),Lh.getNormalMatrix(this.object.matrixWorld);for(var e=this.object.matrixWorld,t=this.geometry.attributes.position,n=this.object.geometry,r=n.vertices,i=n.faces,a=0,o=0,s=i.length;o<s;o++){var l=i[o],c=l.normal;Sh.copy(r[l.a]).add(r[l.b]).add(r[l.c]).divideScalar(3).applyMatrix4(e),Eh.copy(c).applyMatrix3(Lh).normalize().multiplyScalar(this.size).add(Sh),t.setXYZ(a,Sh.x,Sh.y,Sh.z),a+=1,t.setXYZ(a,Eh.x,Eh.y,Eh.z),a+=1}t.needsUpdate=!0}),((sd.prototype=Object.create(ur.prototype)).constructor=sd).prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},sd.prototype.update=(Ch=new Kt,Ph=new Kt,Nh=new Kt,function(){Ch.setFromMatrixPosition(this.light.matrixWorld),Ph.setFromMatrixPosition(this.light.target.matrixWorld),Nh.subVectors(Ph,Ch),this.lightPlane.lookAt(Nh),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Nh),this.targetLine.scale.z=Nh.length()}),((ld.prototype=Object.create(Yo.prototype)).constructor=ld).prototype.update=function(){var l,c,u=new Kt,h=new hr;function e(e,t,n,r){u.set(t,n,r).unproject(h);var i=c[e];if(void 0!==i)for(var a=l.getAttribute("position"),o=0,s=i.length;o<s;o++)a.setXYZ(i[o],u.x,u.y,u.z)}return function(){l=this.geometry,c=this.pointMap;h.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-1,-1,-1),e("n2",1,-1,-1),e("n3",-1,1,-1),e("n4",1,1,-1),e("f1",-1,-1,1),e("f2",1,-1,1),e("f3",-1,1,1),e("f4",1,1,1),e("u1",.7,1.1,-1),e("u2",-.7,1.1,-1),e("u3",0,2,-1),e("cf1",-1,0,1),e("cf2",1,0,1),e("cf3",0,-1,1),e("cf4",0,1,1),e("cn1",-1,0,-1),e("cn2",1,0,-1),e("cn3",0,-1,-1),e("cn4",0,1,-1),l.getAttribute("position").needsUpdate=!0}}(),((cd.prototype=Object.create(Yo.prototype)).constructor=cd).prototype.update=(Rh=new An,function(e){if(void 0!==e&&console.warn("v3d.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Rh.setFromObject(this.object),!Rh.isEmpty()){var t=Rh.min,n=Rh.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}),cd.prototype.setFromObject=function(e){return this.object=e,this.update(),this},cd.prototype.copy=function(e){return Yo.prototype.copy.call(this,e),this.object=e.object,this},cd.prototype.clone=function(){return(new this.constructor).copy(this)},((ud.prototype=Object.create(Yo.prototype)).constructor=ud).prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),ur.prototype.updateMatrixWorld.call(this,e))},((hd.prototype=Object.create(Ho.prototype)).constructor=hd).prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?Me:I,this.lookAt(this.plane.normal),ur.prototype.updateMatrixWorld.call(this,e)},((dd.prototype=Object.create(ur.prototype)).constructor=dd).prototype.setDirection=(Dh=new Kt,function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Dh.set(e.z,0,-e.x).normalize(),Ih=Math.acos(e.y),this.quaternion.setFromAxisAngle(Dh,Ih))}),dd.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},dd.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},dd.prototype.copy=function(e){return ur.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},dd.prototype.clone=function(){return(new this.constructor).copy(this)},(pd.prototype=Object.create(Yo.prototype)).constructor=pd;var fd;function md(e){console.warn("v3d.ClosedSplineCurve3 has been deprecated. Use v3d.CatmullRomCurve3 instead."),_c.call(this,e),this.type="catmullrom",this.closed=!0}function vd(e){console.warn("v3d.SplineCurve3 has been deprecated. Use v3d.CatmullRomCurve3 instead."),_c.call(this,e),this.type="catmullrom"}function gd(e){console.warn("v3d.Spline has been removed. Use v3d.CatmullRomCurve3 instead."),_c.call(this,e),this.type="catmullrom"}dc.create=function(e,t){return console.log("v3d.Curve.create() has been deprecated"),e.prototype=Object.create(dc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(Ic.prototype,{createPointsGeometry:function(e){console.warn("v3d.CurvePath: .createPointsGeometry() has been removed. Use new v3d.Geometry().setFromPoints(points) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("v3d.CurvePath: .createSpacedPointsGeometry() has been removed. Use new v3d.Geometry().setFromPoints(points) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("v3d.CurvePath: .createGeometry() has been removed. Use new v3d.Geometry().setFromPoints(points) instead.");for(var t=new wr,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new Kt(i.x,i.y,i.z||0))}return t}}),Object.assign(Dc.prototype,{fromPoints:function(e){console.warn("v3d.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),md.prototype=Object.create(_c.prototype),vd.prototype=Object.create(_c.prototype),gd.prototype=Object.create(_c.prototype),Object.assign(gd.prototype,{initFromArray:function(){console.error("v3d.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("v3d.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("v3d.Spline: .reparametrizeByArcLength() has been removed.")}}),id.prototype.setColors=function(){console.error("v3d.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ed.prototype.update=function(){console.error("v3d.SkeletonHelper: update() no longer needs to be called.")},Object.assign(mu.prototype,{extractUrlBase:function(e){return console.warn("v3d.Loader: .extractUrlBase() has been deprecated. Use v3d.LoaderUtils.extractUrlBase() instead."),lu.extractUrlBase(e)}}),Object.assign(vu.prototype,{setTexturePath:function(e){return console.warn("v3d.JSONLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(gu.prototype,{setTexturePath:function(e){return console.warn("v3d.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Qh.prototype,{center:function(e){return console.warn("v3d.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("v3d.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("v3d.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("v3d.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(An.prototype,{center:function(e){return console.warn("v3d.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("v3d.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("v3d.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("v3d.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("v3d.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Zh.prototype.center=function(e){return console.warn("v3d.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Yt,{random16:function(){return console.warn("v3d.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("v3d.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Yt.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("v3d.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Yt.ceilPowerOfTwo(e)}}),Object.assign(Jt.prototype,{flattenToArrayOffset:function(e,t){return console.warn("v3d.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("v3d.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3(matrix) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("v3d.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("v3d.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute(attribute) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("v3d.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Qt.prototype,{extractPosition:function(e){return console.warn("v3d.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("v3d.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return void 0===fd&&(fd=new Kt),console.warn("v3d.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition(matrix) instead."),fd.setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("v3d.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("v3d.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("v3d.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("v3d.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("v3d.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("v3d.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection(matrix) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("v3d.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},translate:function(){console.error("v3d.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("v3d.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("v3d.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("v3d.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("v3d.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("v3d.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute(attribute) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("v3d.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("v3d.Matrix4: .makeFrustum() has been removed. Use .makePerspective(left, right, top, bottom, near, far) instead."),this.makePerspective(e,t,r,n,i,a)}}),Tn.prototype.isIntersectionLine=function(e){return console.warn("v3d.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Zt.prototype.multiplyVector3=function(e){return console.warn("v3d.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion(quaternion) instead."),e.applyQuaternion(this)},Object.assign(Ti.prototype,{isIntersectionBox:function(e){return console.warn("v3d.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("v3d.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("v3d.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Si.prototype,{area:function(){return console.warn("v3d.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("v3d.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("v3d.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("v3d.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("v3d.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Si,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("v3d.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Si.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("v3d.Triangle: .normal() has been renamed to .getNormal()."),Si.getNormal(e,t,n,r)}}),Object.assign(Uc.prototype,{extractAllPoints:function(e){return console.warn("v3d.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("v3d.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Xs(this,e)},makeGeometry:function(e){return console.warn("v3d.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new nl(this,e)}}),Object.assign(qt.prototype,{fromAttribute:function(e,t,n){return console.warn("v3d.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("v3d.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("v3d.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Kt.prototype,{setEulerFromRotationMatrix:function(){console.error("v3d.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("v3d.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("v3d.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("v3d.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("v3d.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("v3d.Vector3: .applyProjection() has been removed. Use .applyMatrix4(m) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("v3d.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("v3d.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("v3d.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(xn.prototype,{fromAttribute:function(e,t,n){return console.warn("v3d.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("v3d.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(wr.prototype,{computeTangents:function(){console.error("v3d.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("v3d.Geometry: .computeLineDistances() has been removed. Use v3d.Line.computeLineDistances() instead.")}}),Object.assign(ur.prototype,{getChildByName:function(e){return console.warn("v3d.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("v3d.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("v3d.Object3D: .translate() has been removed. Use .translateOnAxis(axis, distance) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("v3d.Object3D: .getWorldRotation() has been removed. Use v3d.Object3D.getWorldQuaternion(target) instead.")}}),Object.defineProperties(ur.prototype,{eulerOrder:{get:function(){return console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(Go.prototype,{objects:{get:function(){return console.warn("v3d.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Vo.prototype,"useVertexTexture",{get:function(){console.warn("v3d.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("v3d.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(dc.prototype,"__arcLengthDivisions",{get:function(){return console.warn("v3d.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("v3d.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),oo.prototype.setLens=function(e,t){console.warn("v3d.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Bc.prototype,{onlyShadow:{set:function(){console.warn("v3d.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("v3d.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("v3d.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("v3d.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("v3d.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("v3d.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("v3d.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("v3d.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("v3d.Light: .shadowCameraVisible has been removed. Use new v3d.CameraHelper(light.shadow.camera) instead.")}},shadowBias:{set:function(e){console.warn("v3d.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("v3d.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("v3d.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("v3d.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Ar.prototype,{length:{get:function(){return console.warn("v3d.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("v3d.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(Wr.prototype,{addIndex:function(e){console.warn("v3d.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,n){void 0!==n&&console.warn("v3d.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("v3d.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("v3d.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("v3d.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("v3d.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Wr.prototype,{drawcalls:{get:function(){return console.error("v3d.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("v3d.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.assign(Ws.prototype,{getArrays:function(){console.error("v3d.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("v3d.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("v3d.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(jh.prototype,{dynamic:{set:function(){console.warn("v3d.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("v3d.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(wi.prototype,{wrapAround:{get:function(){console.warn("v3d.Material: .wrapAround has been removed.")},set:function(){console.warn("v3d.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("v3d.Material: .overdraw has been removed.")},set:function(){console.warn("v3d.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("v3d.Material: .wrapRGB has been removed."),new Fn}},shading:{get:function(){console.error("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(gl.prototype,{metal:{get:function(){return console.warn("v3d.MeshPhongMaterial: .metal has been removed. Use v3d.MeshStandardMaterial instead."),!1},set:function(){console.warn("v3d.MeshPhongMaterial: .metal has been removed. Use v3d.MeshStandardMaterial instead")}}}),Object.defineProperties(Mi.prototype,{derivatives:{get:function(){return console.warn("v3d.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("v3d. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Fo.prototype,{clearTarget:function(e,t,n,r){console.warn("v3d.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("v3d.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("v3d.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("v3d.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("v3d.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("v3d.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsFloatTextures() is now .extensions.get('OES_texture_float')."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get('OES_texture_half_float')."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("v3d.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get('OES_standard_derivatives')."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get('WEBGL_compressed_texture_s3tc')."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get('WEBGL_compressed_texture_pvrtc')."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("v3d.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get('EXT_blend_minmax')."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("v3d.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("v3d.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get('ANGLE_instanced_arrays')."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("v3d.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("v3d.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("v3d.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("v3d.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("v3d.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("v3d.WebGLRenderer: .setFaceCulling() has been removed.")}}),Object.defineProperties(Fo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(to.prototype,{cullFace:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(_n.prototype,{wrapS:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(Lo.prototype,{standing:{set:function(){console.warn("v3d.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("v3d.WebVRManager: .userHeight has been removed.")}}}),Ju.prototype.load=function(e){console.warn("v3d.Audio: .load has been deprecated. Use v3d.AudioLoader instead.");var t=this;return(new Yu).load(e,function(e){t.setBuffer(e)}),this},eh.prototype.getData=function(){return console.warn("v3d.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Qu.prototype.updateCubeMap=function(e,t){return console.warn("v3d.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var yd,xd,_d,bd,wd,Ad,Md,Td,Sd,Ed,Ld,Cd,Pd,Nd,Rd,Fd,Od,Id,Dd,Ud,Bd,zd,kd,Gd,Vd,jd,Xd={merge:function(e,t,n){var r;console.warn("v3d.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge(geometry2, matrix, materialIndexOffset) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("v3d.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};function Wd(){this.name="",this.type="Constraint",this.mute=!1}function Hd(e){Wd.call(this),this.type="TargetConstraint",this.target=e}function Yd(e){Hd.call(this,e),this.type="ChildOfConstraint",this.offsetMatrix=new Qt}function qd(e){Hd.call(this,e),this.type="CopyLocationConstraint"}function Qd(e){Hd.call(this,e),this.type="CopyRotationConstraint"}function Zd(e){Hd.call(this,e),this.type="CopyScaleConstraint"}function Kd(e){Hd.call(this,e),this.type="FloorConstraint",this.floorLocation="Y",this.offset=0}function Jd(){Wd.call(this),this.type="LimitLocationConstraint",this.min=(new Kt).setScalar(-1/0),this.max=(new Kt).setScalar(1/0)}function $d(){Wd.call(this),this.type="LimitRotationConstraint",this.axis="Y",this.min=0,this.max=2*Math.PI}function ep(){Wd.call(this),this.type="LimitScaleConstraint",this.min=(new Kt).setScalar(-1/0),this.max=(new Kt).setScalar(1/0)}function tp(e){Hd.call(this,e),this.type="LockedTrackConstraint",this.trackAxis="X",this.lockAxis="Y"}function np(e){Hd.call(this,e),this.type="TrackToConstraint",this.trackAxis="X",this.upAxis="Y"}vn.crossOrigin=void 0,vn.loadTexture=function(e,t,n,r){console.warn("v3d.ImageUtils.loadTexture has been deprecated. Use v3d.TextureLoader() instead.");var i=new hc;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},vn.loadTextureCube=function(e,t,n,r){console.warn("v3d.ImageUtils.loadTextureCube has been deprecated. Use v3d.CubeTextureLoader() instead.");var i=new uc;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},vn.loadCompressedTexture=function(){console.error("v3d.ImageUtils.loadCompressedTexture has been removed. Use v3d.DDSLoader instead.")},vn.loadCompressedTextureCube=function(){console.error("v3d.ImageUtils.loadCompressedTextureCube has been removed. Use v3d.DDSLoader instead.")},Object.assign(Wd.prototype,{isConstraint:!0,update:function(e){this.mute},copy:function(e){return this.name=e.name,this.mute=e.mute,this},clone:function(){return(new this.constructor).copy(this)}}),Hd.prototype=Object.assign(Object.create(Wd.prototype),{constructor:Hd,isTargetConstraint:!0,copy:function(e){Wd.prototype.copy.call(this,e),this.target=e.target}}),Yd.prototype=Object.assign(Object.create(Hd.prototype),{constructor:Yd,isChildOfConstraint:!0,copy:function(e){Hd.prototype.copy.call(this,e),this.offsetMatrix.copy(e.offsetMatrix)},update:(yd=new Qt,function(e){Hd.prototype.update.call(this,e),this.mute||(yd.multiplyMatrices(this.target.matrixWorld,this.offsetMatrix),yd.decompose(e.position,e.quaternion,e.scale))})}),qd.prototype=Object.assign(Object.create(Hd.prototype),{constructor:qd,isCopyLocationConstraint:!0,update:(xd=new Zt,_d=new Kt,function(e){Hd.prototype.update.call(this,e),this.mute||(this.target.matrixWorld.decompose(e.position,xd,_d),e.parent&&e.parent.worldToLocal(e.position))})}),Qd.prototype=Object.assign(Object.create(Hd.prototype),{constructor:Qd,isCopyRotationConstraint:!0,update:(bd=new Kt,wd=new Zt,Ad=new Kt,function(e){Hd.prototype.update.call(this,e),this.mute||(this.target.matrixWorld.decompose(bd,e.quaternion,Ad),e.parent&&(e.parent.matrixWorld.decompose(bd,wd,Ad),e.quaternion.premultiply(wd.inverse())))})}),Zd.prototype=Object.assign(Object.create(Hd.prototype),{constructor:Zd,isCopyScaleConstraint:!0,update:function(e){Hd.prototype.update.call(this,e),this.mute||e.scale.copy(this.target.scale)}}),Kd.prototype=Object.assign(Object.create(Hd.prototype),{constructor:Kd,isFloorConstraint:!0,copy:function(e){Hd.prototype.copy.call(this,e),this.floorLocation=e.floorLocation,this.offset=e.offset},update:function(e){if(Hd.prototype.update.call(this,e),!this.mute){var t=e.position,n=this.target.position,r=this.offset;switch(this.floorLocation){case"X":t.x=Math.max(t.x,n.x+r);break;case"Y":t.y=Math.max(t.y,n.y+r);break;case"Z":t.z=Math.max(t.z,n.z+r);break;case"-X":t.x=Math.min(t.x,n.x+r);break;case"-Y":t.y=Math.min(t.y,n.y+r);break;case"-Z":t.z=Math.min(t.z,n.z+r)}}}}),Jd.prototype=Object.assign(Object.create(Wd.prototype),{constructor:Jd,isLimitLocationConstraint:!0,copy:function(e){Wd.prototype.copy.call(this,e),this.min.copy(e.min),this.max.copy(e.max)},update:function(e){Wd.prototype.update.call(this,e),this.mute||e.position.clamp(this.min,this.max)}}),$d.prototype=Object.assign(Object.create(Wd.prototype),{constructor:$d,isLimitRotationConstraint:!0,copy:function(e){Wd.prototype.copy.call(this,e),this.axis=e.axis,this.min=e.min,this.max=e.max},update:(Md=new kn,function(e){Wd.prototype.update.call(this,e),this.mute||("X"==this.axis?(Md.setFromQuaternion(e.quaternion,"XYZ"),Md.x=this._clampAngle(Md.x,this.min,this.max)):"Y"==this.axis?(Md.setFromQuaternion(e.quaternion,"YZX"),Md.y=this._clampAngle(Md.y,this.min,this.max)):"Z"==this.axis&&(Md.setFromQuaternion(e.quaternion,"ZXY"),Md.z=this._clampAngle(Md.z,this.min,this.max)),e.quaternion.setFromEuler(Md))}),_clampAngle:function(e,t,n){return Math.abs(n-t)<2*Math.PI&&(e=Yt.clampAngle(e,t,n)),e}}),ep.prototype=Object.assign(Object.create(Wd.prototype),{constructor:ep,isLimitScaleConstraint:!0,copy:function(e){Wd.prototype.copy.call(this,e),this.min.copy(e.min),this.max.copy(e.max)},update:function(e){Wd.prototype.update.call(this,e),this.mute||e.scale.clamp(this.min,this.max)}}),tp.prototype=Object.assign(Object.create(Hd.prototype),{constructor:tp,isLockedTrackConstraint:!0,copy:function(e){Hd.prototype.copy.call(this,e),this.trackAxis=e.trackAxis,this.lockAxis=e.lockAxis},update:(Td=new Kt,Sd=new Kt,Ed=new Kt,Ld=new Kt,Cd=new Kt,Pd=new Tn,Nd=new Kt,Rd=new Kt,Fd=new Zt,function(e){if(Hd.prototype.update.call(this,e),!this.mute&&(Ed.set("X"==this.trackAxis?1:"-X"==this.trackAxis?-1:0,"Y"==this.trackAxis?1:"-Y"==this.trackAxis?-1:0,"Z"==this.trackAxis?1:"-Z"==this.trackAxis?-1:0),Ld.set("X"==this.lockAxis?1:0,"Y"==this.lockAxis?1:0,"Z"==this.lockAxis?1:0),1!=Math.abs(Ed.dot(Ld)))){Td.setFromMatrixPosition(e.matrixWorld),Sd.setFromMatrixPosition(this.target.matrixWorld),Pd.setFromNormalAndCoplanarPoint(Ld,Td),Pd.projectPoint(Sd,Cd).sub(Td);var t=0<Nd.crossVectors(Ed,Cd).dot(Ld)?1:-1;e.setRotationFromAxisAngle(Pd.normal,t*Ed.angleTo(Cd)),e.parent&&(e.parent.matrixWorld.decompose(Rd,Fd,Rd),e.quaternion.premultiply(Fd.inverse()))}})}),np.prototype=Object.assign(Object.create(Hd.prototype),{constructor:np,isTrackToConstraint:!0,copy:function(e){Hd.prototype.copy.call(this,e),this.trackAxis=e.trackAxis,this.upAxis=e.upAxis},update:(Od=new Tn,Id=new Kt,Dd=new Kt,Ud=new Kt,Bd=new Kt,zd=new Kt,kd=new Qt,Gd=new Kt,Vd=new Zt,jd=new Kt(0,1,0),function(e){if(Hd.prototype.update.call(this,e),!this.mute){var t=this.trackAxis[this.trackAxis.length-1],n=this.upAxis[this.upAxis.length-1],r="-"==this.trackAxis[0],i="-"==this.upAxis[0];if(t!=n){Id.setFromMatrixPosition(e.matrixWorld),Dd.setFromMatrixPosition(this.target.matrixWorld),Ud.subVectors(Dd,Id),Ud.lengthSq()?Ud.normalize():Ud.set(0,-1,0),Od.set(Ud,0),1!=Math.abs(Ud.dot(jd))?Od.projectPoint(jd,Bd).normalize():Bd.set(0,0,-1),r&&Ud.negate(),i&&Bd.negate();var a="X"==t?Ud:"X"==n?Bd:null,o="Y"==t?Ud:"Y"==n?Bd:null,s="Z"==t?Ud:"Z"==n?Bd:null;a?o?s||(s=zd.crossVectors(a,o)):o=zd.crossVectors(s,a):a=zd.crossVectors(o,s),kd.makeBasis(a,o,s),e.setRotationFromMatrix(kd),e.parent&&(e.parent.matrixWorld.decompose(Gd,Vd,Gd),e.quaternion.premultiply(Vd.inverse()))}}})});var rp={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE_BREAK:19,CAPS_LOCK:20,ESCAPE:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,INSERT:45,DELETE:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_WINDOW_KEY:91,RIGHT_WINDOW_KEY:92,SELECT_KEY:93,NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,MULTIPLY:106,ADD:107,SUBTRACT:109,DECIMAL_POINT:110,DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUM_LOCK:144,SCROLL_LOCK:145,SEMI_COLON:186,EQUAL_SIGN:187,COMMA:188,DASH:189,PERIOD:190,FORWARD_SLASH:191,GRAVE_ACCENT:192,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRAKET:221,SINGLE_QUOTE:222};function ip(e,t){var l=this,a={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.enableDamping=!0,this.enableRotate=!0,this.rotateSpeed=.9,this.rotateSpeedTouch=.75,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enableZoom=!0,this.zoomSpeed=150,this.zoomSpeedKey=1,this.zoomSpeedTouch=20,this.zoomInertia=.05,this.zoomInertiaTouch=.05,this.enablePan=!0,this.panSpeed=20,this.panSpeedKey=.3,this.panSpeedTouch=15,this.panInertia=.05,this.panInertiaTouch=.05,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.mouseButtons={ROTATE:v3d.MOUSE.LEFT,ZOOM:v3d.MOUSE.MIDDLE,PAN:v3d.MOUSE.RIGHT};var n=new Zu,r=new Kt,i=new Kt,o=new Kt,c=new qt,s=new Kt,u=new Zt,h=a.NONE,d=new Kt,p=new Yh,f=new Yh,m=new qt,v=1,g=1,y=new qt,x=new qt,_=0,b=0,w=1,A=1,M=0,T=0,S=new qt,E=new qt,L=1,C=1,P=new qt,N=new qt,R={type:"change"},F={type:"start"},O={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 e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var I,D,U=(I=new qt,function(e,t){return I.set((e-l.screen.left)/l.screen.width,(t-l.screen.top)/l.screen.height),I}),B=(D=new qt,function(e,t){return D.set((e-.5*l.screen.width-l.screen.left)/(.5*l.screen.width),(l.screen.height+2*(l.screen.top-t))/l.screen.width),D});function z(e){if(!1!==l.enabled)switch(e.keyCode){case rp.A:case rp.LEFT_ARROW:if(!1===l.enablePan)return;E.x+=1,L=l.panSpeedKey,C=l.panInertia;break;case rp.D:case rp.RIGHT_ARROW:if(!1===l.enablePan)return;E.x-=1,L=l.panSpeedKey,C=l.panInertia;break;case rp.W:case rp.UP_ARROW:if(!1===l.enableZoom)return;b+=1,w=l.zoomSpeedKey,A=l.zoomInertia;break;case rp.S:case rp.DOWN_ARROW:if(!1===l.enableZoom)return;b-=1,w=l.zoomSpeedKey,A=l.zoomInertia}}function k(e){if(!1!==l.enabled){switch(e.preventDefault(),e.stopPropagation(),e.button){case l.mouseButtons.ROTATE:if(!1===l.enableRotate)return;x.copy(B(e.pageX,e.pageY).negate()),y.copy(x),h=a.ROTATE;break;case l.mouseButtons.ZOOM:case l.mouseButtons.PAN:if(!1===l.enablePan)return;P.copy(U(e.pageX,e.pageY)),N.copy(P),h=e.button==l.mouseButtons.PAN?a.PAN:a.ZOOM}document.addEventListener("mousemove",G,!1),document.addEventListener("mouseup",V,!1),document.addEventListener("mouseleave",V,!1),l.dispatchEvent(F)}}function G(e){if(!1!==l.enabled)if(e.preventDefault(),e.stopPropagation(),h===a.ROTATE){if(!1===l.enableRotate)return;x.copy(B(e.pageX,e.pageY).negate()),m.add(x).sub(y),y.copy(x),v=l.rotateSpeed,g=l.rotateInertia}else if(h===a.PAN||h===a.ZOOM){if(!1===l.enablePan)return;N.copy(U(e.pageX,e.pageY)),E.add(N).sub(P),P.copy(N),L=l.panSpeed,C=l.panInertia}}function V(e){!1!==l.enabled&&(e.preventDefault(),e.stopPropagation(),h=a.NONE,document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",V),document.removeEventListener("mouseleave",V),l.dispatchEvent(O))}function j(e){if(!1!==l.enabled){switch(e.preventDefault(),e.stopPropagation(),e.deltaMode){case 2:if(!1===l.enableZoom)return;b-=.025*e.deltaY,w=l.zoomSpeed,A=l.zoomInertia;break;case 1:if(!1===l.enableZoom)return;b-=.01*e.deltaY,w=l.zoomSpeed,A=l.zoomInertia;break;default:if(!1===l.enableZoom)return;b-=25e-5*e.deltaY,w=l.zoomSpeed,A=l.zoomInertia}l.dispatchEvent(F),l.dispatchEvent(O)}}function X(e){if(!1!==l.enabled){var t=e.touches[0],n=e.touches[1];switch(e.touches.length){case 1:if(!1===l.enableRotate)return;h=a.TOUCH_ROTATE,x.copy(B(t.pageX,t.pageY).negate()),y.copy(x);break;default:if(!1===l.enableZoom&&!1===l.enablePan)return;if(h=a.TOUCH_ZOOM_PAN,l.enableZoom){var r=U(t.pageX-n.pageX,t.pageY-n.pageY);M=T=r.length()}if(l.enablePan){var i=U((t.pageX+n.pageX)/2,(t.pageY+n.pageY)/2);P.copy(i),N.copy(P)}}l.dispatchEvent(F)}}function W(e){if(!1!==l.enabled){e.preventDefault(),e.stopPropagation();var t=e.touches[0],n=e.touches[1];switch(e.touches.length){case 1:if(!1===l.enableRotate)return;x.copy(B(t.pageX,t.pageY).negate()),m.add(x).sub(y),y.copy(x),v=l.rotateSpeedTouch,g=l.rotateInertiaTouch;break;default:if(!1===l.enableZoom&&!1===l.enablePan)return;var r=U(t.pageX-n.pageX,t.pageY-n.pageY),i=(T=r.length())-M;M=T;var a=U((t.pageX+n.pageX)/2,(t.pageY+n.pageY)/2);N.copy(a);var o=c.subVectors(N,P),s=o.length();P.copy(N),l.enableZoom&&Math.abs(i)>Math.abs(s)&&(b+=i,w=l.zoomSpeedTouch,A=l.zoomInertiaTouch),l.enablePan&&Math.abs(i)<=Math.abs(s)&&(E.add(o),L=l.panSpeedTouch,C=l.panInertiaTouch)}}}function H(e){if(!1!==l.enabled){switch(e.touches.length){case 0:h=a.NONE;break;case 1:if(!1===l.enableRotate)return;h=a.TOUCH_ROTATE,x.copy(B(e.touches[0].pageX,e.touches[0].pageY).negate()),y.copy(x)}l.dispatchEvent(O)}}function Y(e){!1!==l.enabled&&e.preventDefault()}this.update=function(){l.object.isCamera||l.object.isLight?d.set(0,0,-1):d.set(0,0,1),d.applyQuaternion(l.object.quaternion).normalize(),p.setFromVector3(d),p.theta+=f.theta*v,p.phi+=f.phi*v,p.theta=Math.max(l.minAzimuthAngle,Math.min(l.maxAzimuthAngle,p.theta)),p.phi=Math.max(l.minPolarAngle,Math.min(l.maxPolarAngle,p.phi)),p.makeSafe(),d.setFromSpherical(p),r.copy(d).add(l.object.position),l.object.lookAt(r),l.object.isPerspectiveCamera?l.object.position.addScaledVector(d,_*w):l.object.isOrthographicCamera&&(l.object.zoom*=1+_*w*.15,l.object.updateProjectionMatrix()),i.copy(d).cross(l.object.up).setLength(-S.x),i.add(o.copy(l.object.up).setLength(S.y)),l.object.position.addScaledVector(i,L);var e,t=!1;1e-6<s.distanceToSquared(l.object.position)&&(s.copy(l.object.position),t=!0),u.dot(l.object.quaternion)<1-1e-6&&(u.copy(l.object.quaternion),t=!0),t&&l.dispatchEvent(R),e=n.getDelta(),f.set(f.radius,m.y,m.x),m.x=l.enableDamping?Yt.expAverage(m.x,0,e,g):0,m.y=l.enableDamping?Yt.expAverage(m.y,0,e,g):0,f.set(f.radius,f.phi-m.y,f.theta-m.x),S.copy(E),E.x=l.enableDamping?Yt.expAverage(E.x,0,e,C):0,E.y=l.enableDamping?Yt.expAverage(E.y,0,e,C):0,S.sub(E),_=b,b=l.enableDamping?Yt.expAverage(b,0,e,A):0,_-=b},this.dispose=function(){this.domElement.removeEventListener("contextmenu",Y,!1),this.domElement.removeEventListener("mousedown",k,!1),this.domElement.removeEventListener("wheel",j,!1),this.domElement.removeEventListener("touchstart",X,!1),this.domElement.removeEventListener("touchend",H,!1),this.domElement.removeEventListener("touchmove",W,!1),document.removeEventListener("mousemove",G,!1),document.removeEventListener("mouseup",V,!1),document.removeEventListener("mouseleave",V,!1),window.removeEventListener("keydown",z,!1)},this.domElement.addEventListener("contextmenu",Y,!1),this.domElement.addEventListener("mousedown",k,!1),this.domElement.addEventListener("wheel",j,!1),this.domElement.addEventListener("touchstart",X,!1),this.domElement.addEventListener("touchend",H,!1),this.domElement.addEventListener("touchmove",W,!1),window.addEventListener("keydown",z,!1),this.handleResize(),this.update()}function ap(e,t){var a,o,s,l,c,r;this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new Kt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!0,this.enableZoom=!0,this.zoomSpeed=5,this.zoomSpeedTouch=1,this.zoomInertia=.05,this.zoomInertiaTouch=.05,this.enableRotate=!0,this.rotateSpeed=1.2,this.rotateSpeedTouch=.7,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enablePan=!0,this.panSpeed=1.3,this.panSpeedKey=30,this.panInertia=.05,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.mouseButtons={ROTATE:v3d.MOUSE.LEFT,ZOOM:v3d.MOUSE.MIDDLE,PAN:v3d.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return m.phi},this.getAzimuthalAngle=function(){return m.theta},this.saveState=function(){u.target0.copy(u.target),u.position0.copy(u.object.position),u.zoom0=u.object.zoom},this.reset=function(){u.target.copy(u.target0),u.object.position.copy(u.position0),u.object.zoom=u.zoom0,u.object.updateProjectionMatrix(),u.dispatchEvent(h),u.update(),p=d.NONE},this.update=(a=new Kt,o=(new Zt).setFromUnitVectors(e.up,new Kt(0,1,0)),s=o.clone().inverse(),l=new Kt,c=new Zt,function(){var e,t,n,r=u.object.position;if(this.inTween){var i=j.getElapsedTime()/V;i=Yt.smootherstep(i,0,1),r.lerpVectors(B,k,i),u.target.lerpVectors(z,G,i),u.object.lookAt(u.target),1<=i&&(this.inTween=!1,v.set(0,0,0),y.set(0,0,0),g=1,C.set(0,0),A.set(0,0))}else a.copy(r).sub(u.target),a.applyQuaternion(o),m.setFromVector3(a),u.autoRotate&&p===d.NONE&&W(2*Math.PI/60/60*u.autoRotateSpeed),m.theta+=v.theta,m.phi+=v.phi,isFinite(u.minAzimuthAngle)&&isFinite(u.maxAzimuthAngle)&&(m.theta=Yt.clampAngle(m.theta,u.minAzimuthAngle,u.maxAzimuthAngle)),m.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,m.phi)),m.makeSafe(),u.object.isPerspectiveCamera?(m.radius*=g,m.radius=Math.max(u.minDistance,Math.min(u.maxDistance,m.radius))):u.object.isOrthographicCamera&&(u.object.zoom/=g,u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom)),u.object.updateProjectionMatrix()),u.target.add(y),a.setFromSpherical(m),a.applyQuaternion(s),r.copy(u.target).add(a),u.object.lookAt(u.target),v.set(0,0,0),y.set(0,0,0),e=U.getDelta(),w.copy(A),A.x=u.enableDamping?Yt.expAverage(A.x,0,e,T):0,A.y=u.enableDamping?Yt.expAverage(A.y,0,e,T):0,w.sub(A),t=u.domElement===document?u.domElement.body:u.domElement,W(2*Math.PI*w.x/t.clientWidth*M),n=2*Math.PI*w.y/t.clientHeight*M,v.phi-=n,L.copy(C),C.x=u.enableDamping?Yt.expAverage(C.x,0,e,u.panInertia):0,C.y=u.enableDamping?Yt.expAverage(C.y,0,e,u.panInertia):0,L.sub(C),J(L.x,L.y),g=O,O=u.enableDamping?Yt.expAverage(O,1,e,D):1,g/=O;return!(!(x||l.distanceToSquared(u.object.position)>f||8*(1-c.dot(u.object.quaternion))>f)||(u.dispatchEvent(h),l.copy(u.object.position),c.copy(u.object.quaternion),x=!1))}),this.dispose=function(){u.domElement.removeEventListener("contextmenu",ue,!1),u.domElement.removeEventListener("mousedown",ne,!1),u.domElement.removeEventListener("wheel",ae,!1),u.domElement.removeEventListener("touchstart",se,!1),u.domElement.removeEventListener("touchend",ce,!1),u.domElement.removeEventListener("touchmove",le,!1),document.removeEventListener("mousemove",re,!1),document.removeEventListener("mouseup",ie,!1),document.removeEventListener("mouseleave",ie,!1),window.removeEventListener("keydown",oe,!1)},this.tween=(r=new Kt,function(e,t,n){u.object.parent&&(e=r.copy(e),u.object.parent.worldToLocal(e)),e.manhattanDistanceTo(u.object.position)<1e-5&&t.manhattanDistanceTo(u.target)<1e-5||(u.inTween=!0,B.copy(u.object.position),z.copy(u.target),k.copy(e),G.copy(t),V=n,j.start())});var u=this,h={type:"change"},i={type:"start"},n={type:"end"},d={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY_PAN:4},p=d.NONE,f=1e-6,m=new Yh,v=new Yh,g=1,y=new Kt,x=!1,_=new qt,b=new qt,w=new qt,A=new qt,M=1,T=1,S=new qt,E=new qt,L=new qt,C=new qt,P=1,N=new qt,R=new qt,F=new qt,O=1,I=1,D=1,U=new Zu,B=new Kt,z=new Kt,k=new Kt,G=new Kt,V=0,j=new Zu;function X(){return Math.pow(.95,I)}function W(e){v.theta-=e}function H(e,t){b.set(e,t),A.add(b).sub(_),_.copy(b)}var Y,q,Q,Z=(Y=new Kt,function(e,t){Y.setFromMatrixColumn(t,0),Y.multiplyScalar(-e),y.add(Y)}),K=(q=new Kt,function(e,t){q.setFromMatrixColumn(t,1),q.multiplyScalar(e),y.add(q)}),J=(Q=new Kt,function(e,t){var n=u.domElement===document?u.domElement.body:u.domElement;if(u.object.isPerspectiveCamera){var r=u.object.position;Q.copy(r).sub(u.target);var i=Q.length();i*=Math.tan(u.object.fov/2*Yt.DEG2RAD),Z(2*e*P*i/n.clientHeight,u.object.matrix),K(2*t*P*i/n.clientHeight,u.object.matrix)}else u.object.isOrthographicCamera?(Z(e*P*(u.object.right-u.object.left)/u.object.zoom/n.clientWidth,u.object.matrix),K(t*P*(u.object.top-u.object.bottom)/u.object.zoom/n.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),u.enablePan=!1)});function $(e){u.object.isPerspectiveCamera?O/=e:u.object.isOrthographicCamera?(O/=e,x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function ee(e){u.object.isPerspectiveCamera?O*=e:u.object.isOrthographicCamera?(O*=e,x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function te(e){var t,n;t=e.clientX,n=e.clientY,E.set(t,n),C.add(E).sub(S),S.copy(E),P=u.panSpeed}function ne(e){if(!1!==u.enabled){switch(e.preventDefault(),e.button){case u.mouseButtons.ROTATE:if(!1===u.enableRotate)return;n=e,_.set(n.clientX,n.clientY),p=d.ROTATE;break;case u.mouseButtons.ZOOM:case u.mouseButtons.PAN:if(!1===u.enablePan)return;t=e,S.set(t.clientX,t.clientY),p=d.PAN}var t,n;p!==d.NONE&&(document.addEventListener("mousemove",re,!1),document.addEventListener("mouseup",ie,!1),document.addEventListener("mouseleave",ie,!1),u.dispatchEvent(i))}}function re(e){var t,n;if(!1!==u.enabled)switch(e.preventDefault(),p){case d.ROTATE:if(!1===u.enableRotate)return;H((n=e).clientX,n.clientY),M=u.rotateSpeed,T=u.rotateInertia;break;case d.DOLLY:if(!1===u.enableZoom)return;t=e,R.set(t.clientX,t.clientY),F.subVectors(R,N),0<F.y?$(X()):F.y<0&&ee(X()),N.copy(R),u.update();break;case d.PAN:if(!1===u.enablePan)return;te(e)}}function ie(e){!1!==u.enabled&&(document.removeEventListener("mousemove",re,!1),document.removeEventListener("mouseup",ie,!1),document.removeEventListener("mouseleave",ie,!1),u.dispatchEvent(n),p=d.NONE)}function ae(e){var t;!1===u.enabled||!1===u.enableZoom||p!==d.NONE&&p!==d.ROTATE||(e.preventDefault(),e.stopPropagation(),u.dispatchEvent(i),t=e,I=u.zoomSpeed,D=u.zoomInertia,t.deltaY<0?ee(X()):0<t.deltaY&&$(X()),u.update(),u.dispatchEvent(n))}function oe(e){u.enabled&&u.enableKeys&&u.enablePan&&function(e){switch(e.keyCode){case rp.W:case rp.UP_ARROW:C.y+=1,P=u.panSpeedKey;break;case rp.S:case rp.DOWN_ARROW:C.y-=1,P=u.panSpeedKey;break;case rp.A:case rp.LEFT_ARROW:C.x+=1,P=u.panSpeedKey;break;case rp.D:case rp.RIGHT_ARROW:C.x-=1,P=u.panSpeedKey}}(e)}function se(e){if(!1!==u.enabled){switch(e.touches.length){case 1:if(!1===u.enableRotate)return;t=e,_.set(t.touches[0].pageX,t.touches[0].pageY),p=d.TOUCH_ROTATE;break;case 2:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){if(u.enableZoom){I=u.zoomSpeedTouch,D=u.zoomInertiaTouch;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);N.set(0,r)}if(u.enablePan){var i=.5*(e.touches[0].pageX+e.touches[1].pageX),a=.5*(e.touches[0].pageY+e.touches[1].pageY);S.set(i,a)}u.update()}(e),p=d.TOUCH_DOLLY_PAN;break;default:p=d.NONE}var t;p!==d.NONE&&u.dispatchEvent(i)}}function le(e){var t;if(!1!==u.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(!1===u.enableRotate)return;if(p!==d.TOUCH_ROTATE)return;H((t=e).touches[0].pageX,t.touches[0].pageY),M=u.rotateSpeedTouch,T=u.rotateInertiaTouch;break;case 2:if(!1===u.enableZoom&&!1===u.enablePan)return;if(p!==d.TOUCH_DOLLY_PAN)return;!function(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);R.set(0,r),F.subVectors(R,N),N.copy(R);var i=.5*(e.touches[0].pageX+e.touches[1].pageX),a=.5*(e.touches[0].pageY+e.touches[1].pageY);E.set(i,a),L.subVectors(E,S),S.copy(E),u.enableZoom&&Math.abs(F.length())>Math.abs(L.length())&&(0<F.y?ee(X()):F.y<0&&$(X())),u.enablePan&&Math.abs(F.length())<Math.abs(L.length())&&(C.add(L),P=u.panSpeed),u.update()}(e);break;default:p=d.NONE}}function ce(e){!1!==u.enabled&&(u.dispatchEvent(n),p=d.NONE)}function ue(e){!1!==u.enabled&&e.preventDefault()}u.domElement.addEventListener("contextmenu",ue,!1),u.domElement.addEventListener("mousedown",ne,!1),u.domElement.addEventListener("wheel",ae,!1),u.domElement.addEventListener("touchstart",se,!1),u.domElement.addEventListener("touchend",ce,!1),u.domElement.addEventListener("touchmove",le,!1),window.addEventListener("keydown",oe,!1),this.update()}function op(e,t){this.sourceTexture=e,this.resolution=void 0!==t?t:256;var n=this.resolution,r={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.renderTarget=new bn(n,n,r),this.renderTarget.texture.name="EquiCube.cube",this.camera=new dr(-1,1,1,-1,0,1e3),this.shader=new Mi(Un.equicube),this.planeMesh=new Ei(new Qr(2,2,0),this.shader),this.planeMesh.material.side=ne,this.scene=new Do,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.invertU=!1,this.offsetU=0,this.shader.uniforms.tEquirect.value=this.sourceTexture}function sp(e){var t=4*(this.cubeLods=e)[0].width,n=e[0].texture,r={format:n.format,magFilter:n.magFilter,minFilter:n.minFilter,type:n.type,generateMipmaps:n.generateMipmaps,anisotropy:n.anisotropy,encoding:n.encoding===v3d.RGBEEncoding?v3d.RGBM16Encoding:n.encoding};r.encoding===v3d.RGBM16Encoding&&(r.magFilter=v3d.LinearFilter,r.minFilter=v3d.LinearFilter),this.CubeUVRenderTarget=new v3d.WebGLRenderTarget(t,t,r),this.CubeUVRenderTarget.texture.name="PMREMCubeUVPacker.cubeUv",this.CubeUVRenderTarget.texture.mapping=v3d.CubeUVReflectionMapping,this.CubeUVRenderTarget.texture.minFilter=v3d.LinearFilter,this.CubeUVRenderTarget.texture.magFilter=v3d.LinearFilter,this.CubeUVRenderTarget.texture.generateMipmaps=!1,this.camera=new v3d.OrthographicCamera(.5*-t,.5*t,.5*-t,.5*t,0,1),this.scene=new v3d.Scene,this.objects=[];var i=new v3d.PlaneBufferGeometry(1,1),a=[];a.push(new v3d.Vector2(0,0)),a.push(new v3d.Vector2(1,0)),a.push(new v3d.Vector2(2,0)),a.push(new v3d.Vector2(0,1)),a.push(new v3d.Vector2(1,1)),a.push(new v3d.Vector2(2,1));var o=t;t=e[0].width;var s=0,l=4;this.numLods=Math.log(e[0].width)/Math.log(2)-2;for(var c=0;c<this.numLods;c++){var u=.5*(o-o/l);16<t&&(l*=2);for(var h=16<t?6:1,d=0,p=0,f=t,m=0;m<h;m++){for(var v=0;v<6;v++){var g=this.getShader();g.uniforms.envMap.value=this.cubeLods[c].texture,g.envMap=this.cubeLods[c].texture,g.uniforms.faceIndex.value=v,g.uniforms.mapSize.value=f,g.uniforms.mipLevel.value=m;var y=new v3d.Mesh(i,g);y.position.x=a[v].x*f-u+d,y.position.y=a[v].y*f-u+s+p,y.material.side=v3d.BackSide,y.scale.setScalar(f),this.scene.add(y),this.objects.push(y)}p+=1.75*f,d+=1.25*f,f/=2}s+=2*t,16<t&&(t/=2)}}function lp(e,t,n){this.sourceTexture=e,this.resolution=void 0!==n?n:256,this.samplesPerLevel=void 0!==t?t:64;var r=e.encoding===v3d.LinearEncoding||e.encoding===v3d.GammaEncoding||e.encoding===v3d.sRGBEncoding;this.sourceTexture.minFilter=r?v3d.LinearFilter:v3d.NearestFilter,this.sourceTexture.magFilter=r?v3d.LinearFilter:v3d.NearestFilter,this.sourceTexture.generateMipmaps=this.sourceTexture.generateMipmaps&&r,this.cubeLods=[],this.flipX=!0;var i=this.resolution,a={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.numLods=Math.log(i)/Math.log(2)-2;for(var o=0;o<this.numLods;o++){var s=new v3d.WebGLRenderTargetCube(i,i,a);s.texture.name="PMREMGenerator.cube"+o,s.texture.minFilter=v3d.LinearMipMapLinearFilter,s.texture.magFilter=v3d.LinearFilter,s.texture.generateMipmaps=!0,this.cubeLods.push(s),i=Math.max(16,i/2)}this.camera=new v3d.OrthographicCamera(-1,1,1,-1,0,1e3),this.shader=this.getShader(),this.shader.defines.SAMPLES_PER_LEVEL=this.samplesPerLevel,this.planeMesh=new v3d.Mesh(new v3d.PlaneBufferGeometry(2,2,0),this.shader),this.planeMesh.material.side=v3d.DoubleSide,this.scene=new v3d.Scene,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.shader.uniforms.envMap.value=this.sourceTexture,this.shader.envMap=this.sourceTexture}Object.assign(ip.prototype,t.prototype),(ap.prototype=Object.create(t.prototype)).constructor=ap,Object.defineProperties(ap.prototype,{center:{get:function(){return console.warn("v3d.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}}}),op.prototype={constructor:op,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=Te,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1,this.renderToCubeMapTarget(e,this.renderTarget),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},renderToCubeMapTarget:function(e,t){this.shader.uniforms.invertU.value=this.invertU,this.shader.uniforms.offsetU.value=this.offsetU;for(var n=0;n<6;n++)this.renderToCubeMapTargetFace(e,t,n)},renderToCubeMapTargetFace:function(e,t,n){t.activeCubeFace=n,this.shader.uniforms.faceIndex.value=n,e.render(this.scene,this.camera,t)},dispose:function(){this.renderTarget.dispose(),this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}},sp.prototype={constructor:sp,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.gammaInput=!1,e.gammaOutput=!1,e.toneMapping=v3d.LinearToneMapping,e.toneMappingExposure=1,e.render(this.scene,this.camera,this.CubeUVRenderTarget,!1),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},getShader:function(){var e=new v3d.ShaderMaterial({uniforms:{faceIndex:{value:0},mapSize:{value:0},mipLevel:{value:0},envMap:{value:null},testColor:{value:new v3d.Vector3(1,1,1)}},vertexShader:"precision highp float; varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }",fragmentShader:"precision highp float; varying vec2 vUv; uniform samplerCube envMap; uniform float mapSize; uniform float mipLevel; uniform vec3 testColor; uniform int faceIndex; void uvApplyMipmapOffset(inout vec2 uv, float mipLevel, float mapSize) { /* convert mipmap levels [0, 5] to an empirical offset coefficient [1, 1.5] */ float offCoeff = mipLevel / 10.0 + 1.0; float offset = -offCoeff/mapSize;\n /* the same code as in PMREMGenerator for creating a border around the cube faces to avoid seams */ const float a = -1.0;\n const float b = 1.0;\n float c = -1.0 + offset;\n float d = 1.0 - offset;\n float bminusa = b - a;\n uv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n uv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n } vec3 faceUVToTexCubeCoords(int faceIndex, vec2 uv) { if (faceIndex == 0) { return vec3(1.0, uv.y, -uv.x); } else if (faceIndex == 1) { return vec3(uv.x, 1.0, uv.y); } else if (faceIndex == 2) { return vec3(uv.x, uv.y, 1.0); } else if (faceIndex == 3) { return vec3(-1.0, uv.y, uv.x); } else if (faceIndex == 4) { return vec3(uv.x, -1.0, -uv.y); } else { return vec3(-uv.x, uv.y, -1.0); } } void main() { vec3 sampleDirection; vec2 uv = vUv; uv = uv * 2.0 - 1.0; uv.y *= -1.0; uvApplyMipmapOffset(uv, mipLevel, mapSize); vec4 color; if (mapSize == 1.0) { /* single pixel mipmap levels have abrupt seams, let's average the cubemap color then*/ color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(0, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(1, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(2, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(3, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(4, uv))); color += envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(5, uv))); color /= 6.0; } else { color = envMapTexelToLinear(textureCube(envMap, faceUVToTexCubeCoords(faceIndex, uv))); } gl_FragColor = linearToOutputTexel(color); }",blending:v3d.NoBlending});return e.type="PMREMCubeUVPacker",e},dispose:function(){for(var e=0,t=this.objects.length;e<t;e++)this.objects[e].material.dispose();this.objects[0].geometry.dispose()}},lp.prototype={constructor:lp,update:function(e){this.shader.uniforms.envMap.value=this.sourceTexture,this.shader.envMap=this.sourceTexture;var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=v3d.LinearToneMapping,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1;for(var o=0;o<this.numLods;o++){var s=o/(this.numLods-1);this.shader.uniforms.roughness.value=.9*s,this.flipX&&(this.shader.uniforms.queryScale.value.x=0==o?-1:1);var l=this.cubeLods[o].width;this.shader.uniforms.mapSize.value=l,this.renderToCubeMapTarget(e,this.cubeLods[o]),o<5&&(this.shader.uniforms.envMap.value=this.cubeLods[o].texture)}e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},renderToCubeMapTarget:function(e,t){for(var n=0;n<6;n++)this.renderToCubeMapTargetFace(e,t,n)},renderToCubeMapTargetFace:function(e,t,n){t.activeCubeFace=n,this.shader.uniforms.faceIndex.value=n,e.render(this.scene,this.camera,t,!0)},getShader:function(){var e=new v3d.ShaderMaterial({defines:{SAMPLES_PER_LEVEL:20},uniforms:{faceIndex:{value:0},roughness:{value:.5},mapSize:{value:.5},envMap:{value:null},queryScale:{value:new v3d.Vector3(1,1,1)},testColor:{value:new v3d.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"#include <common>\n varying vec2 vUv;\n uniform int faceIndex;\n uniform float roughness;\n uniform samplerCube envMap;\n uniform float mapSize;\n uniform vec3 testColor;\n uniform vec3 queryScale;\n \n float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\n float a = ggxRoughness + 0.0001;\n a *= a;\n return (2.0 / a - 2.0);\n }\n float randVanDerCorput(int n, int base) {\n float invBase = 1.0 / float(base);\n float result = 0.0;\n \n for (int i = 0; i < 32; ++i) {\n if (n > 0) {\n result += mod(float(n), 2.0) * invBase;\n invBase = invBase / 2.0;\n n = int(float(n) / 2.0);\n }\n }\n return result;\n }\n vec3 ImportanceSamplePhong(vec2 uv, mat3 vecSpace, float specPow) {\n float phi = uv.y * 2.0 * PI;\n float cosTheta = pow(1.0 - uv.x, 1.0 / (specPow + 1.0));\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n vec3 sampleDir = vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);\n return vecSpace * sampleDir;\n }\n vec3 ImportanceSampleGGX(vec2 uv, mat3 vecSpace, float Roughness)\n {\n float a = Roughness * Roughness;\n float Phi = 2.0 * PI * uv.x;\n float CosTheta = sqrt((1.0 - uv.y) / (1.0 + (a*a - 1.0) * uv.y));\n float SinTheta = sqrt(abs(1.0 - CosTheta * CosTheta));\n return vecSpace * vec3(SinTheta * cos(Phi), SinTheta * sin(Phi), CosTheta);\n }\n mat3 matrixFromVector(vec3 n) {\n float a = 1.0 / (1.0 + n.z);\n float b = -n.x * n.y * a;\n vec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n vec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n return mat3(b1, b2, n);\n }\n \n vec4 testColorMap(float Roughness) {\n vec4 color;\n if(faceIndex == 0)\n color = vec4(1.0,0.0,0.0,1.0);\n else if(faceIndex == 1)\n color = vec4(0.0,1.0,0.0,1.0);\n else if(faceIndex == 2)\n color = vec4(0.0,0.0,1.0,1.0);\n else if(faceIndex == 3)\n color = vec4(1.0,1.0,0.0,1.0);\n else if(faceIndex == 4)\n color = vec4(0.0,1.0,1.0,1.0);\n else\n color = vec4(1.0,0.0,1.0,1.0);\n color *= (1.0 - Roughness);\n return color;\n }\n void main() {\n vec3 sampleDirection;\n vec2 uv = vUv*2.0 - 1.0;\n float offset = -1.0/mapSize;\n const float a = -1.0;\n const float b = 1.0;\n float c = -1.0 + offset;\n float d = 1.0 - offset;\n float bminusa = b - a;\n uv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n uv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n if (faceIndex==0) {\n sampleDirection = vec3(1.0, -uv.y, -uv.x);\n } else if (faceIndex==1) {\n sampleDirection = vec3(-1.0, -uv.y, uv.x);\n } else if (faceIndex==2) {\n sampleDirection = vec3(uv.x, 1.0, uv.y);\n } else if (faceIndex==3) {\n sampleDirection = vec3(uv.x, -1.0, -uv.y);\n } else if (faceIndex==4) {\n sampleDirection = vec3(uv.x, -uv.y, 1.0);\n } else {\n sampleDirection = vec3(-uv.x, -uv.y, -1.0);\n }\n vec3 normal = normalize(sampleDirection * queryScale);\n mat3 vecSpace = matrixFromVector(normal);\n vec3 rgbColor = vec3(0.0);\n const int NumSamples = SAMPLES_PER_LEVEL;\n vec3 vect;\n float weight = 0.0;\n \n /**\n * several points from the Van der Corput sequence produce\n * spikes and make the result a bit ugly - practically these\n * are four points from the interval [0.9, 1], which are \n * also distributed evenly, let's just ignore them\n */\n float spikeInterval = exp2(floor(log2(float(NumSamples)))) / 4.0;\n \n for(int i = 0; i < NumSamples; i++) {\n if (mod(float(i) + 1.0, spikeInterval) == 0.0) continue;\n float r = randVanDerCorput(i, 2);\n vect = ImportanceSampleGGX(vec2(float(i) / float(NumSamples), r), vecSpace, roughness);\n vect = normalize(vect);\n \n /**\n * for roughness values above 0.5 don't use the dot formula, \n * just unity weights, because for this case there are\n * many sample directions that would have negative\n * weights when being calculated otherwise, thus \n * being discarded they wouldn't contribute to blurring \n * at all making it too insufficient for high roughness\n * levels\n */ \n if (roughness > 0.5) {\n vec3 color = envMapTexelToLinear(textureCube(envMap, vect)).rgb;\n rgbColor.rgb += color;\n weight += 1.0;\n } else {\n vec3 L = normalize(2.0 * dot(normal, vect) * vect - normal);\n float sampleWeight = max(dot(normal, L), 0.0);\n if (sampleWeight > 0.0) {\n vec3 color = envMapTexelToLinear(textureCube(envMap, vect)).rgb;\n rgbColor.rgb += color * sampleWeight;\n weight += sampleWeight;\n }\n }\n }\n rgbColor /= weight;\n gl_FragColor = linearToOutputTexel(vec4(rgbColor, 1.0));\n }",blending:v3d.NoBlending});return e.type="PMREMGenerator",e},dispose:function(){for(var e=0,t=this.cubeLods.length;e<t;e++)this.cubeLods[e].dispose();this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}};var cp,up={checkCanvas:function(){return!!window.CanvasRenderingContext2D},checkWebGL:function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},checkWorkers:function(){return!!window.Worker},checkFileAPI:function(){return window.File&&window.FileReader&&window.FileList&&window.Blob},genWebGLErrorMessage:function(){var e=document.createElement("div");return e.setAttribute("class","v3d-webgl-error"),e.innerHTML=window.WebGLRenderingContext?["Your graphics card does not seem to support WebGL.<br/>",'Find out how to get it <a href="https://www.soft8soft.com/webgl-supported-browsers-and-troubleshooting/" style="color:#000">here</a>.'].join("\n"):["Your browser does not seem to support WebGL.<br/>",'Find out how to get it <a href="https://www.soft8soft.com/webgl-supported-browsers-and-troubleshooting/" style="color:#000">here</a>.'].join("\n"),e},showWebGLErrorMessage:function(e){(e=e||document.body).appendChild(up.genWebGLErrorMessage())},checkIOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},checkAndroid:function(){return navigator.userAgent.match(/Android/i)},checkHDR:function(e){var t=e.getContext();return!(!t.getExtension("OES_texture_half_float")||!t.getExtension("OES_texture_half_float_linear"))}},hp=void 0!==hp?hp:{},dp={};for(cp in hp)hp.hasOwnProperty(cp)&&(dp[cp]=hp[cp]);hp.arguments=[],hp.thisProgram="./this.program",hp.quit=function(e,t){throw t},hp.preRun=[];var pp,fp,mp=!(hp.postRun=[]),vp=!1,gp=!1,yp=!1;if(hp.ENVIRONMENT)if("WEB"===hp.ENVIRONMENT)mp=!0;else if("WORKER"===hp.ENVIRONMENT)vp=!0;else if("NODE"===hp.ENVIRONMENT)gp=!0;else{if("SHELL"!==hp.ENVIRONMENT)throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.");yp=!0}else mp="object"==typeof window,vp="function"==typeof importScripts,gp="object"==typeof process&&"function"==typeof require&&!mp&&!vp,yp=!mp&&!gp&&!vp;gp?(hp.read=function(e,t){var n;return(n=af(e))||(pp||(pp=require("fs")),fp||(fp=require("path")),e=fp.normalize(e),n=pp.readFileSync(e)),t?n:n.toString()},hp.readBinary=function(e){var t=hp.read(e,!0);return t.buffer||(t=new Uint8Array(t)),bp(t.buffer),t},1<process.argv.length&&(hp.thisProgram=process.argv[1].replace(/\\/g,"/")),hp.arguments=process.argv.slice(2),"undefined"!=typeof module&&(module.exports=hp),process.on("uncaughtException",function(e){if(!(e instanceof mf))throw e}),process.on("unhandledRejection",function(e,t){process.exit(1)}),hp.inspect=function(){return"[Emscripten Module object]"}):yp?("undefined"!=typeof read&&(hp.read=function(e){var t=af(e);return t?nf(t):read(e)}),hp.readBinary=function(e){var t;return(t=af(e))?t:"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(bp("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?hp.arguments=scriptArgs:void 0!==arguments&&(hp.arguments=arguments),"function"==typeof quit&&(hp.quit=function(e,t){quit(e)})):(mp||vp)&&(hp.read=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText}catch(e){var n=af(t);if(n)return nf(n);throw e}},vp&&(hp.readBinary=function(t){try{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}catch(e){var n=af(t);if(n)return n;throw e}}),hp.readAsync=function(t,n,r){var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){if(200==i.status||0==i.status&&i.response)n(i.response);else{var e=af(t);e?n(e.buffer):r()}},i.onerror=r,i.send(null)},void 0!==arguments&&(hp.arguments=arguments),hp.setWindowTitle=function(e){document.title=e});for(cp in hp.print="undefined"!=typeof console?console.log.bind(console):"undefined"!=typeof print?print:null,hp.printErr="undefined"!=typeof printErr?printErr:"undefined"!=typeof console&&console.warn.bind(console)||hp.print,hp.print=hp.print,hp.printErr=hp.printErr,dp)dp.hasOwnProperty(cp)&&(hp[cp]=dp[cp]);dp=void 0;function xp(e,t){return t||(t=16),e=Math.ceil(e/t)*t}var _p=0;function bp(e,t){e||gf("Assertion failed: "+t)}function wp(e){var t=hp["_"+e];return bp(t,"Cannot call unknown function "+e+", make sure it is exported"),t}var Ap={stackSave:function(){cf()},stackRestore:function(){lf()},arrayToC:function(e){var t,n,r=sf(e.length);return t=e,n=r,Lp.set(t,n),r},stringToC:function(e){var t=0;if(null!=e&&0!==e){var n=1+(e.length<<2);t=sf(n),function(e,t,n,r){if(!(0<r))return;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(55296<=s&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(a<=n)break;t[n++]=s}else if(s<=2047){if(a<=n+1)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(a<=n+2)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else if(s<=2097151){if(a<=n+3)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}else if(s<=67108863){if(a<=n+4)break;t[n++]=248|s>>24,t[n++]=128|s>>18&63,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(a<=n+5)break;t[n++]=252|s>>30,t[n++]=128|s>>24&63,t[n++]=128|s>>18&63,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}t[n]=0}(e,Cp,t,n)}return t}},Mp={string:Ap.stringToC,array:Ap.arrayToC};function Tp(e,t,n,r,i){var a=wp(e),o=[],s=0;if(r)for(var l=0;l<r.length;l++){var c=Mp[n[l]];o[l]=c?(0===s&&(s=cf()),c(r[l])):r[l]}var u=a.apply(null,o);return"string"===t&&(u=function(e,t){if(0===t||!e)return"";var n,r=0,i=0;for(;n=Cp[e+i>>0],r|=n,(0!=n||t)&&(i++,!t||i!=t););t||(t=i);var a="";if(r<128){for(var o;0<t;)o=String.fromCharCode.apply(String,Cp.subarray(e,e+Math.min(t,1024))),a=a?a+o:o,e+=1024,t-=1024;return a}return s=e,function(e,t){for(var n=t;e[n];)++n;if(16<n-t&&e.subarray&&Sp)return Sp.decode(e.subarray(t,n));for(var r,i,a,o,s,l,c="";;){if(!(r=e[t++]))return c;if(128&r)if(i=63&e[t++],192!=(224&r))if(a=63&e[t++],(r=224==(240&r)?(15&r)<<12|i<<6|a:(o=63&e[t++],240==(248&r)?(7&r)<<18|i<<12|a<<6|o:(s=63&e[t++],248==(252&r)?(3&r)<<24|i<<18|a<<12|o<<6|s:(l=63&e[t++],(1&r)<<30|i<<24|a<<18|o<<12|s<<6|l))))<65536)c+=String.fromCharCode(r);else{var u=r-65536;c+=String.fromCharCode(55296|u>>10,56320|1023&u)}else c+=String.fromCharCode((31&r)<<6|i);else c+=String.fromCharCode(r)}}(Cp,s);var s}(u)),0!==s&&lf(s),u}var Sp="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;var Ep,Lp,Cp,Pp,Np,Rp,Fp,Op,Ip,Dp,Up;"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");function Bp(){gf("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+kp+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}Rp=Op=0,Fp=!1;var zp=hp.TOTAL_STACK||5242880,kp=hp.TOTAL_MEMORY||16777216;if(kp<zp&&hp.printErr("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+kp+"! (TOTAL_STACK="+zp+")"),hp.buffer?Ep=hp.buffer:(Ep=new ArrayBuffer(kp),hp.buffer=Ep),hp.HEAP8=Lp=new Int8Array(Ep),hp.HEAP16=Pp=new Int16Array(Ep),hp.HEAP32=Np=new Int32Array(Ep),hp.HEAPU8=Cp=new Uint8Array(Ep),hp.HEAPU16=new Uint16Array(Ep),hp.HEAPU32=new Uint32Array(Ep),hp.HEAPF32=new Float32Array(Ep),hp.HEAPF64=new Float64Array(Ep),Np[0]=1668509029,Pp[1]=25459,115!==Cp[2]||99!==Cp[3])throw"Runtime error: expected the system to be little-endian!";function Gp(e){for(;0<e.length;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?hp.dynCall_v(n):hp.dynCall_vi(n,t.arg):n(void 0===t.arg?null:t.arg)}else t()}}var Vp=[],jp=[],Xp=[],Wp=[],Hp=[],Yp=!1;var qp=0,Qp=null,Zp=null;hp.preloadedImages={},hp.preloadedAudios={};var Kp=null,Jp="data:application/octet-stream;base64,";function $p(e){return String.prototype.startsWith?e.startsWith(Jp):0===e.indexOf(Jp)}Rp=1052232,jp.push(),Kp="data:application/octet-stream;base64,/Td6WFoAAAQEBAgICBAQECAgIEBAQFla";var ef=Rp;Rp+=16,Up=function(e){bp(!Fp);var t=Rp;return Rp=Rp+e+15&-16,t}(4),Dp=xp(Ip=(Op=xp(Rp))+zp),Np[Up>>2]=Dp;var tf=!(Fp=!0);function nf(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];255<r&&(tf&&bp(!1,"Character code "+r+" ("+String.fromCharCode(r)+") at offset "+n+" not in 0x00-0xFF."),r&=255),t.push(String.fromCharCode(r))}return t.join("")}var rf="function"==typeof atob?atob:function(e){var t,n,r,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");t=s.indexOf(e.charAt(c++))<<2|(i=s.indexOf(e.charAt(c++)))>>4,n=(15&i)<<4|(a=s.indexOf(e.charAt(c++)))>>2,r=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(n)),64!==o&&(l+=String.fromCharCode(r)),c<e.length;);return l};function af(e){if($p(e))return function(t){if("boolean"==typeof gp&&gp){var n;try{n=Buffer.from(t,"base64")}catch(e){n=new Buffer(t,"base64")}return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}try{for(var e=rf(t),r=new Uint8Array(e.length),i=0;i<e.length;++i)r[i]=e.charCodeAt(i);return r}catch(e){throw new Error("Converting base64 string to bytes failed.")}}(e.slice(Jp.length))}hp.asmGlobalArg={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0},hp.asmLibraryArg={abort:gf,assert:bp,enlargeMemory:function(){Bp()},getTotalMemory:function(){return kp},abortOnCannotGrowMemory:Bp,___setErrNo:function(e){return hp.___errno_location&&(Np[hp.___errno_location()>>2]=e),e},_emscripten_memcpy_big:function(e,t,n){return Cp.set(Cp.subarray(t,t+n),e),e},DYNAMICTOP_PTR:Up,tempDoublePtr:ef,ABORT:_p,STACKTOP:Op,STACK_MAX:Ip};var of=function(e,t,n){"use asm";var H=new e.Int8Array(n);var z=new e.Int16Array(n);var Y=new e.Int32Array(n);var q=new e.Uint8Array(n);var O=new e.Uint16Array(n);var r=new e.Uint32Array(n);var i=new e.Float32Array(n);var a=new e.Float64Array(n);var o=t.DYNAMICTOP_PTR|0;var s=t.tempDoublePtr|0;var l=t.ABORT|0;var w=t.STACKTOP|0;var c=t.STACK_MAX|0;var u=0;var h=0;var d=0;var p=0;var f=e.NaN,m=e.Infinity;var v=0,g=0,y=0,x=0,_=0.0;var Q=0;var b=e.Math.floor;var A=e.Math.abs;var M=e.Math.sqrt;var T=e.Math.pow;var S=e.Math.cos;var E=e.Math.sin;var L=e.Math.tan;var C=e.Math.acos;var P=e.Math.asin;var N=e.Math.atan;var R=e.Math.atan2;var F=e.Math.exp;var I=e.Math.log;var D=e.Math.ceil;var U=e.Math.imul;var B=e.Math.min;var k=e.Math.max;var G=e.Math.clz32;var V=t.abort;var j=t.assert;var X=t.enlargeMemory;var W=t.getTotalMemory;var Z=t.abortOnCannotGrowMemory;var K=t.___setErrNo;var J=t._emscripten_memcpy_big;var $=0.0;function ee(e){e=e|0;var t=0;t=w;w=w+e|0;w=w+15&-16;return t|0}function te(){return w|0}function ne(e){e=e|0;w=e}function re(e,t){e=e|0;t=t|0;w=e;c=t}function ie(e,t){e=e|0;t=t|0;if(!u){u=e;h=t}}function ae(e){e=e|0;Q=e}function oe(){return Q|0}function se(){var e=0,t=0,n=0;e=0;do{t=e>>>1;n=(0-(e&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;n=(0-(n&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;n=(0-(n&1)&-306674912^t)>>>1;t=(0-(t&1)&-306674912^n)>>>1;Y[2088+(e<<2)>>2]=0-(t&1)&-306674912^(0-(n&1)&-306674912^t)>>>1;e=e+1|0}while((e|0)!=256);return}function le(e,t,n){e=e|0;t=t|0;n=n|0;n=~n;if(!t){t=n;t=~t;return t|0}while(1){n=Y[2088+((n&255^(q[e>>0]|0))<<2)>>2]^n>>>8;t=t+-1|0;if(!t)break;else e=e+1|0}t=~n;return t|0}function ce(){var e=0,t=0,n=0,r=0,i=0;e=0;do{i=Ie(e|0,0,1)|0;r=Q;n=Be(0,0,e&1|0,0)|0;r=Ie(n&-679014590^i|0,Q&-915646571^r|0,1)|0;n=Q;i=Be(0,0,i&1|0,0)|0;n=Ie(i&-679014590^r|0,Q&-915646571^n|0,1)|0;i=Q;r=Be(0,0,r&1|0,0)|0;i=Ie(r&-679014590^n|0,Q&-915646571^i|0,1)|0;r=Q;n=Be(0,0,n&1|0,0)|0;r=Ie(n&-679014590^i|0,Q&-915646571^r|0,1)|0;n=Q;i=Be(0,0,i&1|0,0)|0;n=Ie(i&-679014590^r|0,Q&-915646571^n|0,1)|0;i=Q;r=Be(0,0,r&1|0,0)|0;i=Ie(r&-679014590^n|0,Q&-915646571^i|0,1)|0;r=Q;n=Be(0,0,n&1|0,0)|0;r=Ie(n&-679014590^i|0,Q&-915646571^r|0,1)|0;n=Q;i=Be(0,0,i&1|0,0)|0;t=40+(e<<3)|0;Y[t>>2]=i&-679014590^r;Y[t+4>>2]=Q&-915646571^n;e=e+1|0}while((e|0)!=256);return}function ue(e,t,n,r){e=e|0;t=t|0;n=n|0;r=r|0;var i=0,a=0;i=~n;n=~r;if(!t){e=i;t=n;e=~e;t=~t;Q=t;return e|0}while(1){r=40+((i&255^(q[e>>0]|0))<<3)|0;a=Y[r>>2]|0;r=Y[r+4>>2]|0;i=Ie(i|0,n|0,8)|0;i=a^i;n=r^Q;t=t+-1|0;if(!t)break;else e=e+1|0}a=~i;e=~n;Q=e;return a|0}function he(e,t){e=e|0;t=t|0;var n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,E=0,L=0,C=0,P=0,N=0,R=0,F=0,O=0,I=0,D=0,U=0,B=0,z=0,k=0,G=0,V=0,j=0,X=0,W=0;j=e+36|0;if(!(Y[j>>2]|0)){Y[e>>2]=0;H[e+40>>0]=0;a=e+4|0;Y[a>>2]=0;o=e+24|0;i=o;Y[i>>2]=0;Y[i+4>>2]=0;i=e+172|0;n=e+72|0;r=n+100|0;do{Y[n>>2]=0;n=n+4|0}while((n|0)<(r|0));Y[i>>2]=12;n=0}else{n=Y[e>>2]|0;i=e+172|0;a=e+4|0;o=e+24|0}U=t+4|0;B=Y[U>>2]|0;z=t+16|0;k=Y[z>>2]|0;T=e+16|0;Y[T>>2]=B;D=t+8|0;E=e+168|0;L=e+176|0;C=e+182|0;P=e+184|0;N=e+185|0;R=e+186|0;d=e+187|0;F=e+183|0;O=e+32|0;p=e+64|0;I=e+177|0;f=e+48|0;A=e+8|0;m=e+56|0;v=e+1200|0;g=e+72|0;y=e+20|0;x=e+80|0;S=e+96|0;_=e+104|0;b=e+112|0;M=e+88|0;w=t+12|0;e:while(1){switch(n|0){case 6:{V=79;break e}case 7:{V=94;break e}case 8:{V=101;break e}case 9:{V=106;break e}case 0:{h=Y[U>>2]|0;l=(Y[D>>2]|0)-h|0;c=Y[E>>2]|0;u=(Y[i>>2]|0)-c|0;u=l>>>0<u>>>0?l:u;ze(e+176+c|0,(Y[t>>2]|0)+h|0,u|0)|0;Y[U>>2]=(Y[U>>2]|0)+u;u=(Y[E>>2]|0)+u|0;h=(u|0)==(Y[i>>2]|0);Y[E>>2]=h?0:u;if(!h){n=0;break e}Y[e>>2]=1;if(Fe(L,8,6)|0){n=5;break e}if((le(C,2,0)|0)!=(q[N>>0]<<8|q[P>>0]|q[R>>0]<<16|q[d>>0]<<24|0)){n=7;break e}if(H[C>>0]|0){n=6;break e}n=H[F>>0]|0;Y[O>>2]=n&255;if((n&255)>15){n=6;break e}switch(n<<24>>24){case 0:case 1:case 4:{V=13;break}default:{n=2;break e}}break}case 1:{V=13;break}case 2:{r=Y[t>>2]|0;n=Y[D>>2]|0;s=Y[E>>2]|0;l=Y[i>>2]|0;V=17;break}case 3:{V=45;break}case 4:{V=57;break}case 5:{V=63;break}default:{V=125;break e}}do{if((V|0)==13){V=0;n=Y[U>>2]|0;l=Y[D>>2]|0;if((n|0)==(l|0)){n=0;break e}r=Y[t>>2]|0;s=H[r+n>>0]|0;if(!(s<<24>>24)){Y[U>>2]=n+1;Y[T>>2]=n;n=6;break}else{V=((s&255)<<2)+4|0;Y[p>>2]=V;Y[i>>2]=V;Y[E>>2]=0;Y[e>>2]=2;n=l;s=0;l=V;V=17;break}}}while(0);if((V|0)==17){V=0;h=Y[U>>2]|0;u=n-h|0;n=l-s|0;n=u>>>0<n>>>0?u:n;ze(e+176+s|0,r+h|0,n|0)|0;Y[U>>2]=n+(Y[U>>2]|0);n=(Y[E>>2]|0)+n|0;h=(n|0)==(Y[i>>2]|0);Y[E>>2]=h?0:n;if(!h){n=0;break}c=n+-4|0;Y[i>>2]=c;c=le(L,c,0)|0;h=Y[i>>2]|0;u=e+176+h|0;if((c|0)!=(q[u+1>>0]<<8|q[u>>0]|q[u+2>>0]<<16|q[u+3>>0]<<24|0)){n=7;break}Y[E>>2]=2;u=H[I>>0]|0;n=u&255;if(n&63|0){n=6;break}if(!(n&64)){s=-1;n=-1;l=2}else{n=Y[a>>2]|0;if(!n){l=A;Y[l>>2]=0;Y[l+4>>2]=0;l=2;n=0}else l=2;while(1){if(l>>>0>=h>>>0){n=7;break e}r=H[e+176+l>>0]|0;l=l+1|0;Y[E>>2]=l;X=r&255;s=De(X&127|0,0,n|0)|0;c=A;s=s|Y[c>>2];c=Q|Y[c+4>>2];W=A;Y[W>>2]=s;Y[W+4>>2]=c;if(!(X&128))break;n=n+7|0;Y[a>>2]=n;if((n|0)==63){n=7;break e}}if(!((n|0)==0|r<<24>>24!=0)){n=7;break}Y[a>>2]=0;n=c}W=f;Y[W>>2]=s;Y[W+4>>2]=n;if(u<<24>>24<0){n=Y[a>>2]|0;if(!n){n=A;Y[n>>2]=0;Y[n+4>>2]=0;n=0}while(1){if(l>>>0>=h>>>0){n=7;break e}r=H[e+176+l>>0]|0;l=l+1|0;Y[E>>2]=l;W=r&255;s=De(W&127|0,0,n|0)|0;c=A;s=s|Y[c>>2];c=Q|Y[c+4>>2];X=A;Y[X>>2]=s;Y[X+4>>2]=c;if(!(W&128))break;n=n+7|0;Y[a>>2]=n;if((n|0)==63){n=7;break e}}if(!((n|0)==0|r<<24>>24!=0)){n=7;break}Y[a>>2]=0;n=c}else{s=-1;n=-1}W=m;Y[W>>2]=s;Y[W+4>>2]=n;if((h-l|0)>>>0<2){n=7;break}n=l+1|0;Y[E>>2]=n;if((H[e+176+l>>0]|0)!=33){n=6;break}r=l+2|0;Y[E>>2]=r;if((H[e+176+n>>0]|0)!=1){n=6;break}if((h|0)==(r|0)){n=7;break}n=Y[v>>2]|0;Y[E>>2]=l+3;n=ye(n,H[e+176+r>>0]|0)|0;if(n|0)break;n=Y[i>>2]|0;r=Y[E>>2]|0;while(1){if(r>>>0>=n>>>0)break;W=r;r=r+1|0;Y[E>>2]=r;if(H[e+176+W>>0]|0){n=6;break e}}Y[E>>2]=0;Y[g>>2]=0;Y[g+4>>2]=0;Y[g+8>>2]=0;Y[g+12>>2]=0;Y[e>>2]=3;V=45}if((V|0)==45){V=0;Y[T>>2]=Y[U>>2];Y[y>>2]=Y[z>>2];n=fe(Y[v>>2]|0,t)|0;X=g;X=Ue(Y[X>>2]|0,Y[X+4>>2]|0,(Y[U>>2]|0)-(Y[T>>2]|0)|0,0)|0;u=Q;r=g;Y[r>>2]=X;Y[r+4>>2]=u;r=Y[y>>2]|0;s=(Y[z>>2]|0)-r|0;l=x;l=Ue(Y[l>>2]|0,Y[l+4>>2]|0,s|0,0)|0;c=Q;W=x;Y[W>>2]=l;Y[W+4>>2]=c;W=f;h=Y[W+4>>2]|0;if(u>>>0>h>>>0|((u|0)==(h|0)?X>>>0>(Y[W>>2]|0)>>>0:0)){n=7;break}W=m;X=Y[W+4>>2]|0;if(c>>>0>X>>>0|((c|0)==(X|0)?l>>>0>(Y[W>>2]|0)>>>0:0)){n=7;break}switch(Y[O>>2]|0){case 1:{r=le((Y[w>>2]|0)+r|0,s,Y[o>>2]|0)|0;s=0;V=50;break}case 4:{V=o;r=ue((Y[w>>2]|0)+r|0,s,Y[V>>2]|0,Y[V+4>>2]|0)|0;s=Q;V=50;break}default:{}}if((V|0)==50){V=0;W=o;Y[W>>2]=r;Y[W+4>>2]=s}if((n|0)!=1)break;r=f;n=Y[r>>2]|0;r=Y[r+4>>2]|0;if(!((n|0)==-1&(r|0)==-1)?(W=g,!((n|0)==(Y[W>>2]|0)?(r|0)==(Y[W+4>>2]|0):0)):0){n=7;break}n=m;r=Y[n>>2]|0;n=Y[n+4>>2]|0;l=x;s=Y[l>>2]|0;l=Y[l+4>>2]|0;if(!((r|0)==-1&(n|0)==-1)){if(!((r|0)==(s|0)&(n|0)==(l|0))){n=7;break}}else{r=s;n=l}V=g;V=Ue(Y[V>>2]|0,Y[V+4>>2]|0,Y[p>>2]|0,0)|0;W=S;W=Ue(V|0,Q|0,Y[W>>2]|0,Y[W+4>>2]|0)|0;W=Ue(W|0,Q|0,q[14+(Y[O>>2]|0)>>0]|0,0)|0;V=S;Y[V>>2]=W;Y[V+4>>2]=Q;V=_;V=Ue(Y[V>>2]|0,Y[V+4>>2]|0,r|0,n|0)|0;W=_;Y[W>>2]=V;Y[W+4>>2]=Q;Y[b>>2]=le(S,24,Y[b>>2]|0)|0;W=M;W=Ue(Y[W>>2]|0,Y[W+4>>2]|0,1,0)|0;V=M;Y[V>>2]=W;Y[V+4>>2]=Q;Y[e>>2]=4;V=57}if((V|0)==57){V=0;r=g;n=Y[r>>2]|0;if(!((n&3|0)==0&0==0)){s=Y[D>>2]|0;l=Y[U>>2]|0;r=Y[r+4>>2]|0;do{if((l|0)==(s|0)){n=0;break e}X=Y[t>>2]|0;W=l;l=l+1|0;Y[U>>2]=l;if(H[X+W>>0]|0){n=7;break e}n=Ue(n|0,r|0,1,0)|0;r=Q;W=g;Y[W>>2]=n;Y[W+4>>2]=r}while(!((n&3|0)==0&0==0))}Y[e>>2]=5;V=63}t:do{if((V|0)==63){V=0;n=Y[O>>2]|0;switch(n|0){case 1:{n=Y[D>>2]|0;r=Y[U>>2]|0;do{if((r|0)==(n|0)){n=0;break e}W=o;s=Y[a>>2]|0;W=Ie(Y[W>>2]|0,Y[W+4>>2]|0,s|0)|0;h=Y[t>>2]|0;X=r;r=r+1|0;Y[U>>2]=r;if((H[h+X>>0]|0)!=(W&255)<<24>>24){n=7;break e}W=s+8|0;Y[a>>2]=W}while(W>>>0<32);n=o;Y[n>>2]=0;Y[n+4>>2]=0;Y[a>>2]=0;n=1;break t}case 4:{n=Y[D>>2]|0;r=Y[U>>2]|0;do{if((r|0)==(n|0)){n=0;break e}W=o;s=Y[a>>2]|0;W=Ie(Y[W>>2]|0,Y[W+4>>2]|0,s|0)|0;h=Y[t>>2]|0;X=r;r=r+1|0;Y[U>>2]=r;if((H[h+X>>0]|0)!=(W&255)<<24>>24){n=7;break e}W=s+8|0;Y[a>>2]=W}while(W>>>0<64);n=o;Y[n>>2]=0;Y[n+4>>2]=0;Y[a>>2]=0;n=1;break t}default:{r=Y[a>>2]|0;s=q[14+n>>0]|0;if(r>>>0<s>>>0){l=Y[D>>2]|0;c=Y[U>>2]|0;n=r;do{if((c|0)==(l|0)){n=0;break e}c=c+1|0;Y[U>>2]=c;n=n+1|0;Y[a>>2]=n}while(n>>>0<s>>>0)}Y[a>>2]=0;n=1;break t}}}}while(0);Y[e>>2]=n}e:do{if((V|0)==79){d=e+120|0;p=e+136|0;f=e+144|0;m=e+144|0;v=e+152|0;g=e+160|0;t:while(1){u=Y[t>>2]|0;l=Y[D>>2]|0;if(!(Y[a>>2]|0)){W=A;Y[W>>2]=0;Y[W+4>>2]=0}while(1){r=Y[U>>2]|0;if(r>>>0>=l>>>0){n=0;V=86;break t}c=H[u+r>>0]|0;r=r+1|0;Y[U>>2]=r;W=c&255;n=Y[a>>2]|0;s=De(W&127|0,0,n|0)|0;h=A;s=s|Y[h>>2];h=Q|Y[h+4>>2];X=A;Y[X>>2]=s;Y[X+4>>2]=h;if(!(W&128))break;W=n+7|0;Y[a>>2]=W;if((W|0)==63){n=7;V=86;break t}}if(!(c<<24>>24!=0|(n|0)==0)){n=7;V=86;break}Y[a>>2]=0;switch(Y[d>>2]|0){case 0:{W=p;Y[W>>2]=s;Y[W+4>>2]=h;W=M;if((s|0)==(Y[W>>2]|0)?(h|0)==(Y[W+4>>2]|0):0){n=1;V=91}else{n=7;break e}break}case 1:{n=2;l=f;r=h;V=90;break}case 2:{l=v;n=v;Y[n>>2]=Ue(Y[l>>2]|0,Y[l+4>>2]|0,s|0,h|0)|0;Y[n+4>>2]=Q;Y[g>>2]=le(m,24,Y[g>>2]|0)|0;n=1;l=p;s=-1;r=-1;V=90;break}default:{}}if((V|0)==90){X=l;X=Ue(Y[X>>2]|0,Y[X+4>>2]|0,s|0,r|0)|0;W=l;Y[W>>2]=X;Y[W+4>>2]=Q;V=91}if((V|0)==91){V=0;Y[d>>2]=n}W=p;if((Y[W>>2]|0)==0&(Y[W+4>>2]|0)==0){V=93;break}}if((V|0)==86){G=Y[T>>2]|0;X=r-G|0;W=e+128|0;t=W;t=Ue(Y[t>>2]|0,Y[t+4>>2]|0,X|0,0)|0;Y[W>>2]=t;Y[W+4>>2]=Q;W=o;Y[W>>2]=le(u+G|0,X,Y[o>>2]|0)|0;Y[W+4>>2]=0;break}else if((V|0)==93){Y[e>>2]=7;V=94;break}}else if((V|0)==106){s=Y[U>>2]|0;r=Y[D>>2]|0;a=Y[i>>2]|0;n=Y[t>>2]|0;V=107}else if((V|0)==125)while(1)V=125}while(0);e:do{if((V|0)==94){h=e+128|0;p=h;d=Y[p>>2]|0;p=Y[p+4>>2]|0;s=Y[T>>2]|0;n=Y[U>>2]|0;while(1){l=n-s|0;c=Ue(d|0,p|0,l|0,0)|0;u=Q;if((c&3|0)==0&0==0)break;r=Y[t>>2]|0;if((n|0)==(Y[D>>2]|0)){V=97;break}W=n;n=n+1|0;Y[U>>2]=n;if(H[r+W>>0]|0){n=7;break e}}if((V|0)==97){n=h;Y[n>>2]=c;Y[n+4>>2]=u;n=o;Y[n>>2]=le(r+s|0,l,Y[o>>2]|0)|0;Y[n+4>>2]=0;n=0;break}X=Y[t>>2]|0;W=h;Y[W>>2]=c;Y[W+4>>2]=u;W=o;Y[W>>2]=le(X+s|0,l,Y[o>>2]|0)|0;Y[W+4>>2]=0;if(!(Fe(S,e+144|0,24)|0)){Y[e>>2]=8;V=101}else n=7}}while(0);e:do{if((V|0)==101){r=Y[D>>2]|0;s=Y[U>>2]|0;do{if((s|0)==(r|0)){n=0;break e}W=o;l=Y[a>>2]|0;W=Ie(Y[W>>2]|0,Y[W+4>>2]|0,l|0)|0;n=Y[t>>2]|0;X=s;s=s+1|0;Y[U>>2]=s;if((H[n+X>>0]|0)!=(W&255)<<24>>24){n=7;break e}W=l+8|0;Y[a>>2]=W}while(W>>>0<32);V=o;Y[V>>2]=0;Y[V+4>>2]=0;Y[a>>2]=0;Y[i>>2]=12;Y[e>>2]=9;a=12;V=107}}while(0);if((V|0)==107){V=r-s|0;W=Y[E>>2]|0;X=a-W|0;X=V>>>0<X>>>0?V:X;ze(e+176+W|0,n+s|0,X|0)|0;Y[U>>2]=X+(Y[U>>2]|0);X=(Y[E>>2]|0)+X|0;W=(X|0)==(Y[i>>2]|0);Y[E>>2]=W?0:X;if(W)if((((Fe(R,30,2)|0)==0?(G=e+180|0,W=le(G,6,0)|0,(W|0)==(q[I>>0]<<8|q[L>>0]|q[e+178>>0]<<16|q[e+179>>0]<<24|0)):0)?(W=e+128|0,W=Ie(Y[W>>2]|0,Y[W+4>>2]|0,2)|0,(Q|0)==0?(W|0)==(q[e+181>>0]<<8|q[G>>0]|q[C>>0]<<16|q[F>>0]<<24|0):0):0)?(H[P>>0]|0)==0:0)n=(Y[O>>2]|0)==(q[N>>0]|0)?1:7;else n=7;else n=0}r=(n|0)==0;if(!(Y[j>>2]|0)){if(!r){if((n|0)==1){W=1;return W|0}}else n=(Y[U>>2]|0)==(Y[D>>2]|0)?7:8;Y[U>>2]=B;Y[z>>2]=k;W=n;return W|0}else{if(r)if((B|0)==(Y[U>>2]|0)?(k|0)==(Y[z>>2]|0):0){n=(H[e+40>>0]|0)==0?0:8;r=1}else{n=0;r=0}else r=0;H[e+40>>0]=r;W=n;return W|0}return 0}function de(e,t){e=e|0;t=t|0;var n=0,r=0;r=Pe(1208)|0;if(!r){r=0;return r|0}Y[r+36>>2]=e;n=ge(e,t)|0;Y[r+1200>>2]=n;if(!n){Ne(r);r=0;return r|0}else{Y[r>>2]=0;H[r+40>>0]=0;Y[r+4>>2]=0;e=r+24|0;Y[e>>2]=0;Y[e+4>>2]=0;e=r+172|0;t=r+72|0;n=t+100|0;do{Y[t>>2]=0;t=t+4|0}while((t|0)<(n|0));Y[e>>2]=12;return r|0}return 0}function pe(e){e=e|0;if(!e)return;xe(Y[e+1200>>2]|0);Ne(e);return}function fe(e,t){e=e|0;t=t|0;var n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,E=0,L=0,C=0,P=0,N=0,R=0,F=0,O=0,I=0,D=0,U=0,B=0;g=t+4|0;L=t+8|0;N=e+64|0;R=e+81|0;F=e+80|0;O=e+60|0;I=t+12|0;D=t+16|0;s=e+24|0;l=t+20|0;c=e+44|0;u=e+28|0;h=e+72|0;d=e+68|0;p=e+84|0;f=e+4|0;m=e+8|0;v=e+76|0;y=e+116|0;x=e+112|0;_=e+108|0;b=e+32|0;w=e+40|0;A=e+28388|0;M=e+28392|0;T=e+20|0;S=e+12|0;E=e+16|0;C=e+104|0;P=e+36|0;e:while(1){i=Y[g>>2]|0;r=Y[L>>2]|0;n=Y[N>>2]|0;t:do{if(i>>>0>=r>>>0)if((n|0)==7)U=5;else{n=0;U=86;break e}else{switch(n|0){case 7:{U=5;break t}case 0:{n=Y[t>>2]|0;Y[g>>2]=i+1;n=H[n+i>>0]|0;r=n&255;if(!(n<<24>>24)){n=1;U=86;break e}if(!((n&255)>223|n<<24>>24==1)){if(H[F>>0]|0){n=7;U=86;break e}}else{H[R>>0]=1;H[F>>0]=0;if(!(Y[O>>2]|0)){o=Y[D>>2]|0;Y[s>>2]=(Y[I>>2]|0)+o;Y[c>>2]=(Y[l>>2]|0)-o}Y[u>>2]=0;Y[u+4>>2]=0;Y[u+8>>2]=0;Y[u+12>>2]=0}if(n<<24>>24>=0){if((n&255)>2){n=7;U=86;break e}Y[N>>2]=3;Y[d>>2]=8;continue e}Y[h>>2]=r<<16&2031616;Y[N>>2]=1;if((n&255)>191){H[R>>0]=0;Y[d>>2]=5;continue e}if(H[R>>0]|0){n=7;U=86;break e}Y[d>>2]=6;if((n&255)<=159)continue e;Y[p>>2]=0;Y[p+4>>2]=0;Y[p+8>>2]=0;Y[p+12>>2]=0;Y[p+16>>2]=0;n=0;do{z[e+120+(n<<1)>>1]=1024;n=n+1|0}while((n|0)!=14134);Y[e>>2]=-1;Y[f>>2]=0;Y[m>>2]=5;continue e}case 1:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[h>>2]=(q[o+i>>0]<<8)+(Y[h>>2]|0);Y[N>>2]=2;continue e}case 2:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[h>>2]=(q[o+i>>0]|0)+1+(Y[h>>2]|0);Y[N>>2]=3;continue e}case 3:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[v>>2]=q[o+i>>0]<<8;Y[N>>2]=4;continue e}case 4:{o=Y[t>>2]|0;Y[g>>2]=i+1;Y[v>>2]=(q[o+i>>0]|0)+1+(Y[v>>2]|0);Y[N>>2]=Y[d>>2];continue e}case 5:{n=Y[t>>2]|0;Y[g>>2]=i+1;n=H[n+i>>0]|0;if((n&255)>224){n=7;U=86;break e}if((n&255)>44){n=n+-45<<24>>24;r=(n&255)/45|0;n=(r*211|0)+n<<24>>24;r=r+1&255}else r=0;Y[y>>2]=(1<<r)+-1;Y[x>>2]=0;r=n&255;if((n&255)>8){n=0;do{o=r+247|0;n=n+1|0;r=o&255}while((o&255)>8);Y[x>>2]=n}else n=0;Y[_>>2]=r;if((r+n|0)>>>0>4){n=7;U=86;break e}Y[x>>2]=(1<<n)+-1;Y[p>>2]=0;Y[p+4>>2]=0;Y[p+8>>2]=0;Y[p+12>>2]=0;Y[p+16>>2]=0;n=0;do{z[e+120+(n<<1)>>1]=1024;n=n+1|0}while((n|0)!=14134);Y[e>>2]=-1;Y[f>>2]=0;Y[m>>2]=5;Y[N>>2]=6;break}case 6:break;case 8:{n=Y[v>>2]|0;n:do{if(n|0){if(r>>>0>i>>>0)o=i;else{n=0;U=86;break e}while(1){i=Y[D>>2]|0;a=Y[l>>2]|0;if(a>>>0<=i>>>0){n=0;U=86;break e}o=(r-o|0)>>>0<(a-i|0)>>>0;r=(o?r:a)-(Y[(o?g:D)>>2]|0)|0;o=Y[b>>2]|0;a=(Y[c>>2]|0)-o|0;r=r>>>0>a>>>0?a:r;r=r>>>0>n>>>0?n:r;Y[v>>2]=n-r;ze((Y[s>>2]|0)+o|0,(Y[t>>2]|0)+(Y[g>>2]|0)|0,r|0)|0;n=(Y[b>>2]|0)+r|0;Y[b>>2]=n;if((Y[P>>2]|0)>>>0<n>>>0)Y[P>>2]=n;if(Y[O>>2]|0){if((n|0)==(Y[c>>2]|0))Y[b>>2]=0;ze((Y[I>>2]|0)+(Y[D>>2]|0)|0,(Y[t>>2]|0)+(Y[g>>2]|0)|0,r|0)|0;n=Y[b>>2]|0}Y[u>>2]=n;Y[D>>2]=(Y[D>>2]|0)+r;o=(Y[g>>2]|0)+r|0;Y[g>>2]=o;n=Y[v>>2]|0;if(!n)break n;r=Y[L>>2]|0;if(r>>>0<=o>>>0){n=0;U=86;break e}}}}while(0);Y[N>>2]=0;continue e}default:continue e}a=Y[v>>2]|0;if(a>>>0<5){n=7;U=86;break e}n=Y[m>>2]|0;if(!n){r=Y[L>>2]|0;i=Y[g>>2]|0;n=a}else{r=Y[L>>2]|0;i=Y[g>>2]|0;do{if((i|0)==(r|0)){n=0;U=86;break e}B=Y[f>>2]<<8;a=Y[t>>2]|0;o=i;i=i+1|0;Y[g>>2]=i;Y[f>>2]=B|q[a+o>>0];n=n+-1|0;Y[m>>2]=n}while((n|0)!=0);n=Y[v>>2]|0}a=n+-5|0;Y[v>>2]=a;Y[N>>2]=7;n=i}}while(0);if((U|0)==5){n=i;a=Y[v>>2]|0}i=(Y[l>>2]|0)-(Y[D>>2]|0)|0;o=Y[h>>2]|0;o=i>>>0<o>>>0?i:o;i=Y[c>>2]|0;B=Y[b>>2]|0;Y[w>>2]=(i-B|0)>>>0>o>>>0?B+o|0:i;i=r-n|0;o=Y[A>>2]|0;if(!o)if(!a){r=0;U=46}else U=56;else{r=a;U=46}t:do{if((U|0)==46){U=0;B=42-o|0;r=r-o|0;r=B>>>0>r>>>0?r:B;i=r>>>0>i>>>0?i:r;ze(e+28392+o|0,(Y[t>>2]|0)+n|0,i|0)|0;n=Y[A>>2]|0;r=i+n|0;do{if((r|0)!=(Y[v>>2]|0))if(r>>>0<21){Y[A>>2]=r;Y[g>>2]=(Y[g>>2]|0)+i;break t}else{n=r+-21|0;break}else{Ge(e+28392+n+i|0,0,63-n-i|0)|0;n=(Y[A>>2]|0)+i|0}}while(0);Y[T>>2]=n;Y[S>>2]=M;Y[E>>2]=0;if(!(me(e)|0)){n=7;U=86;break e}n=Y[E>>2]|0;r=Y[A>>2]|0;if(n>>>0>(r+i|0)>>>0){n=7;U=86;break e}i=(Y[v>>2]|0)-n|0;Y[v>>2]=i;if(r>>>0>n>>>0){B=r-n|0;Y[A>>2]=B;ke(M|0,e+28392+n|0,B|0)|0;break}else{n=(Y[g>>2]|0)+(n-r)|0;Y[g>>2]=n;Y[A>>2]=0;r=Y[L>>2]|0;a=i;U=56;break}}}while(0);if((U|0)==56){U=0;i=r-n|0;if(i>>>0>20){Y[S>>2]=Y[t>>2];Y[E>>2]=n;B=i>>>0<(a+21|0)>>>0;Y[T>>2]=(Y[(B?L:g)>>2]|0)+(B?-21:a);if(!(me(e)|0)){n=7;U=86;break}n=Y[E>>2]|0;r=n-(Y[g>>2]|0)|0;i=Y[v>>2]|0;if(i>>>0<r>>>0){n=7;U=86;break}i=i-r|0;Y[v>>2]=i;Y[g>>2]=n;r=Y[L>>2]|0}else i=a;r=r-n|0;if(r>>>0<21){B=r>>>0>i>>>0?i:r;ze(M|0,(Y[t>>2]|0)+n|0,B|0)|0;Y[A>>2]=B;Y[g>>2]=(Y[g>>2]|0)+B}}n=Y[b>>2]|0;r=Y[u>>2]|0;i=n-r|0;if(Y[O>>2]|0){if((n|0)==(Y[c>>2]|0))Y[b>>2]=0;ze((Y[I>>2]|0)+(Y[D>>2]|0)|0,(Y[s>>2]|0)+r|0,i|0)|0;n=Y[b>>2]|0}Y[u>>2]=n;n=(Y[D>>2]|0)+i|0;Y[D>>2]=n;B=(Y[h>>2]|0)-i|0;Y[h>>2]=B;if(B|0){if((n|0)==(Y[l>>2]|0)){n=0;U=86;break}if((Y[g>>2]|0)!=(Y[L>>2]|0))continue;if((Y[A>>2]|0)>>>0<(Y[v>>2]|0)>>>0){n=0;U=86;break}else continue}if(Y[v>>2]|0){n=7;U=86;break}if(Y[C>>2]|0){n=7;U=86;break}if(Y[f>>2]|0){n=7;U=86;break}Y[e>>2]=-1;Y[f>>2]=0;Y[m>>2]=5;Y[N>>2]=0}if((U|0)==86)return n|0;return 0}function me(e){e=e|0;var t=0,n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0,w=0,A=0,M=0,T=0,S=0,E=0,L=0,C=0,P=0,N=0,R=0,F=0;F=e+24|0;N=e+32|0;t=Y[N>>2]|0;R=e+40|0;n=Y[R>>2]|0;if(((n>>>0>t>>>0?(r=e+104|0,i=Y[r>>2]|0,(i|0)!=0):0)?(o=Y[e+84>>2]|0,s=e+36|0,(Y[s>>2]|0)>>>0>o>>>0):0)?(Y[e+48>>2]|0)>>>0>o>>>0:0){a=n-t|0;a=a>>>0<i>>>0?a:i;Y[r>>2]=i-a;n=t-o+-1|0;r=e+44|0;if(t>>>0<=o>>>0)n=(Y[r>>2]|0)+n|0;P=Y[F>>2]|0;C=H[P+n>>0]|0;Y[N>>2]=t+1;H[P+t>>0]=C;t=a+-1|0;if(t|0)do{P=n+1|0;n=(P|0)==(Y[r>>2]|0)?0:P;P=Y[N>>2]|0;C=Y[F>>2]|0;L=H[C+n>>0]|0;Y[N>>2]=P+1;H[C+P>>0]=L;t=t+-1|0}while((t|0)!=0);t=Y[N>>2]|0;if((Y[s>>2]|0)>>>0<t>>>0)Y[s>>2]=t}e:do{if(t>>>0<(Y[R>>2]|0)>>>0){h=e+16|0;d=e+20|0;p=e+116|0;f=e+100|0;m=e+4|0;v=e+12|0;g=e+44|0;y=e+36|0;x=e+108|0;_=e+112|0;b=e+24|0;w=e+84|0;A=e+92|0;M=e+96|0;T=e+88|0;S=e+1756|0;E=e+104|0;L=e+1726|0;C=e+48|0;P=e+2784|0;while(1){n=Y[h>>2]|0;if(n>>>0>(Y[d>>2]|0)>>>0){n=e;break e}o=Y[p>>2]&t;a=e+120+(Y[f>>2]<<5)+(o<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;u=Y[m>>2]<<8;i=Y[v>>2]|0;Y[h>>2]=n+1;i=u|(q[i+n>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;if(i>>>0>=r>>>0){Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+504+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;t:do{if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;Y[f>>2]=(Y[f>>2]|0)>>>0<7?7:10;Y[M>>2]=Y[A>>2];Y[A>>2]=Y[T>>2];Y[T>>2]=Y[w>>2];ve(e,S,o);o=Y[E>>2]|0;o=o>>>0<6?o+-2|0:3;l=1;t=Y[e>>2]|0;do{s=e+984+(o<<7)+(l<<1)|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;n=Y[h>>2]|0;Y[h>>2]=n+1;n=c|(q[u+n>>0]|0);Y[m>>2]=n}else n=Y[m>>2]|0;a=O[s>>1]|0;i=U(t>>>11,a)|0;if(n>>>0<i>>>0){Y[e>>2]=i;r=0;t=i;n=(2048-a>>5)+a|0}else{t=t-i|0;Y[e>>2]=t;Y[m>>2]=n-i;r=1;n=a-(a>>>5)|0}z[s>>1]=n;l=r|l<<1}while(l>>>0<64);t=l+-64|0;if(t>>>0<4){Y[w>>2]=t;break}n=t>>>1;c=n+-1|0;r=t&1|2;Y[w>>2]=r;if(t>>>0<14){s=r<<c;Y[w>>2]=s;l=e+1496+(s<<1)+(64-l<<1)+-2|0;s=0;t=1;while(1){o=l+(t<<1)|0;n=Y[e>>2]|0;if(n>>>0<16777216){n=n<<8;Y[e>>2]=n;i=Y[m>>2]<<8;u=Y[v>>2]|0;a=Y[h>>2]|0;Y[h>>2]=a+1;a=i|(q[u+a>>0]|0);Y[m>>2]=a}else a=Y[m>>2]|0;r=O[o>>1]|0;i=U(n>>>11,r)|0;if(a>>>0<i>>>0){Y[e>>2]=i;z[o>>1]=((2048-r|0)>>>5)+r;t=t<<1}else{Y[e>>2]=n-i;Y[m>>2]=a-i;z[o>>1]=r-(r>>>5);Y[w>>2]=(Y[w>>2]|0)+(1<<s);t=t<<1|1}s=s+1|0;if(s>>>0>=c>>>0)break t}}i=n+-5|0;o=Y[e>>2]|0;do{if(o>>>0<16777216){a=o<<8;Y[e>>2]=a;c=Y[m>>2]<<8;u=Y[v>>2]|0;t=Y[h>>2]|0;Y[h>>2]=t+1;t=c|(q[u+t>>0]|0);Y[m>>2]=t}else{a=o;t=Y[m>>2]|0}o=a>>>1;Y[e>>2]=o;n=t-o|0;u=n>>31;n=(u&o)+n|0;Y[m>>2]=n;r=(r<<1|1)+u|0;Y[w>>2]=r;i=i+-1|0}while((i|0)!=0);s=r<<4;Y[w>>2]=s;if(a>>>0<33554432){r=o<<8;Y[e>>2]=r;c=Y[v>>2]|0;u=Y[h>>2]|0;Y[h>>2]=u+1;n=n<<8|(q[c+u>>0]|0);Y[m>>2]=n}else r=o;t=O[L>>1]|0;i=U(r>>>11,t)|0;if(n>>>0<i>>>0){Y[e>>2]=i;z[L>>1]=((2048-t|0)>>>5)+t;l=2;o=s}else{u=r-i|0;Y[e>>2]=u;n=n-i|0;Y[m>>2]=n;z[L>>1]=t-(t>>>5);o=s|1;Y[w>>2]=o;l=3;i=u}a=e+1724+(l<<1)|0;if(i>>>0<16777216){i=i<<8;Y[e>>2]=i;c=Y[v>>2]|0;u=Y[h>>2]|0;Y[h>>2]=u+1;n=n<<8|(q[c+u>>0]|0);Y[m>>2]=n}r=O[a>>1]|0;t=U(i>>>11,r)|0;if(n>>>0<t>>>0){Y[e>>2]=t;z[a>>1]=((2048-r|0)>>>5)+r;o=l<<1}else{u=i-t|0;Y[e>>2]=u;n=n-t|0;Y[m>>2]=n;z[a>>1]=r-(r>>>5);Y[w>>2]=o+2;o=l<<1|1;t=u}a=e+1724+(o<<1)|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[v>>2]|0;u=Y[h>>2]|0;Y[h>>2]=u+1;n=n<<8|(q[c+u>>0]|0);Y[m>>2]=n}r=O[a>>1]|0;i=U(t>>>11,r)|0;if(n>>>0<i>>>0){Y[e>>2]=i;z[a>>1]=((2048-r|0)>>>5)+r;t=o<<1}else{Y[e>>2]=t-i;Y[m>>2]=n-i;z[a>>1]=r-(r>>>5);Y[w>>2]=(Y[w>>2]|0)+4;t=o<<1|1}a=e+1724+(t<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;break}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);Y[w>>2]=(Y[w>>2]|0)+8;break}}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+528+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;do{if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;a=e+600+(Y[f>>2]<<5)+(o<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;Y[f>>2]=(Y[f>>2]|0)>>>0<7?9:11;Y[E>>2]=1;break t}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);break}}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+552+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;t=Y[T>>2]|0}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);a=e+576+(Y[f>>2]<<1)|0;t=Y[e>>2]|0;if(t>>>0<16777216){t=t<<8;Y[e>>2]=t;c=Y[m>>2]<<8;u=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=c|(q[u+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;n=O[a>>1]|0;r=U(t>>>11,n)|0;if(i>>>0<r>>>0){Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;t=Y[A>>2]|0}else{Y[e>>2]=t-r;Y[m>>2]=i-r;z[a>>1]=n-(n>>>5);t=Y[M>>2]|0;Y[M>>2]=Y[A>>2]}Y[A>>2]=Y[T>>2]}Y[T>>2]=Y[w>>2];Y[w>>2]=t}}while(0);Y[f>>2]=(Y[f>>2]|0)>>>0<7?8:11;ve(e,P,o)}}while(0);t=Y[w>>2]|0;if((Y[y>>2]|0)>>>0<=t>>>0){t=0;r=130;break}if((Y[C>>2]|0)>>>0<=t>>>0){t=0;r=130;break}i=Y[N>>2]|0;r=(Y[R>>2]|0)-i|0;n=Y[E>>2]|0;r=r>>>0<n>>>0?r:n;Y[E>>2]=n-r;n=i-t+-1|0;if(i>>>0<=t>>>0)n=(Y[g>>2]|0)+n|0;t=Y[F>>2]|0;u=H[t+n>>0]|0;Y[N>>2]=i+1;H[t+i>>0]=u;t=r+-1|0;if(t|0)do{u=n+1|0;n=(u|0)==(Y[g>>2]|0)?0:u;u=Y[N>>2]|0;c=Y[F>>2]|0;l=H[c+n>>0]|0;Y[N>>2]=u+1;H[c+u>>0]=l;t=t+-1|0}while((t|0)!=0);t=Y[N>>2]|0;if((Y[y>>2]|0)>>>0<t>>>0)Y[y>>2]=t}else{Y[e>>2]=r;z[a>>1]=((2048-n|0)>>>5)+n;n=Y[N>>2]|0;t=n+-1|0;if(!n)t=(Y[g>>2]|0)+t|0;r=(Y[y>>2]|0)==0;if(r)t=0;else t=q[(Y[b>>2]|0)+t>>0]|0;u=Y[x>>2]|0;u=((Y[_>>2]&n)<<u)+(t>>>(8-u|0))|0;if((Y[f>>2]|0)>>>0<7){t=1;n=Y[e>>2]|0;do{s=e+3812+(u*1536|0)+(t<<1)|0;if(n>>>0<16777216){n=n<<8;Y[e>>2]=n;l=Y[m>>2]<<8;c=Y[v>>2]|0;r=Y[h>>2]|0;Y[h>>2]=r+1;r=l|(q[c+r>>0]|0);Y[m>>2]=r}else r=Y[m>>2]|0;o=O[s>>1]|0;a=U(n>>>11,o)|0;if(r>>>0<a>>>0){Y[e>>2]=a;i=0;n=a;r=(2048-o>>5)+o|0}else{n=n-a|0;Y[e>>2]=n;Y[m>>2]=r-a;i=1;r=o-(o>>>5)|0}z[s>>1]=r;t=i|t<<1}while(t>>>0<256)}else{c=Y[w>>2]|0;t=n-c+-1|0;if(n>>>0>c>>>0)n=t;else n=(Y[g>>2]|0)+t|0;if(r){t=1;c=256;s=0}else{t=1;c=256;s=q[(Y[b>>2]|0)+n>>0]|0}while(1){s=s<<1;l=s&c;o=e+3812+(u*1536|0)+(l+c+t<<1)|0;n=Y[e>>2]|0;if(n>>>0<16777216){n=n<<8;Y[e>>2]=n;r=Y[m>>2]<<8;a=Y[v>>2]|0;i=Y[h>>2]|0;Y[h>>2]=i+1;i=r|(q[a+i>>0]|0);Y[m>>2]=i}else i=Y[m>>2]|0;a=O[o>>1]|0;r=U(n>>>11,a)|0;if(i>>>0<r>>>0){Y[e>>2]=r;r=1;n=(2048-a>>5)+a|0}else{Y[e>>2]=n-r;Y[m>>2]=i-r;r=0;n=a-(a>>>5)|0}z[o>>1]=n;t=t<<1|(r^1)&1;if(t>>>0>=256)break;else c=(r?c:0)^l}}c=Y[b>>2]|0;u=Y[N>>2]|0;Y[N>>2]=u+1;H[c+u>>0]=t;t=Y[N>>2]|0;if((Y[y>>2]|0)>>>0<t>>>0)Y[y>>2]=t;u=Y[f>>2]|0;Y[f>>2]=u>>>0<4?0:u-(u>>>0<10?3:6)|0}if(t>>>0>=(Y[R>>2]|0)>>>0){n=e;break e}}if((r|0)==130)return t|0}else n=e}while(0);t=Y[n>>2]|0;if(t>>>0>=16777216){e=1;return e|0}Y[n>>2]=t<<8;F=e+4|0;N=Y[F>>2]<<8;R=Y[e+12>>2]|0;P=e+16|0;e=Y[P>>2]|0;Y[P>>2]=e+1;Y[F>>2]=N|(q[R+e>>0]|0);e=1;return e|0}function ve(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0;r=Y[e>>2]|0;if(r>>>0<16777216){r=r<<8;Y[e>>2]=r;a=e+4|0;p=Y[a>>2]<<8;f=Y[e+12>>2]|0;d=e+16|0;o=Y[d>>2]|0;Y[d>>2]=o+1;o=p|(q[f+o>>0]|0);Y[a>>2]=o}else{o=e+4|0;a=o;o=Y[o>>2]|0}i=O[t>>1]|0;l=U(r>>>11,i)|0;do{if(o>>>0>=l>>>0){s=r-l|0;Y[e>>2]=s;r=o-l|0;Y[a>>2]=r;z[t>>1]=i-(i>>>5);l=t+2|0;if(s>>>0<16777216){i=s<<8;Y[e>>2]=i;a=e+4|0;f=Y[e+12>>2]|0;p=e+16|0;o=Y[p>>2]|0;Y[p>>2]=o+1;o=r<<8|(q[f+o>>0]|0);Y[a>>2]=o}else{a=e+4|0;i=s;o=r}r=O[l>>1]|0;s=U(i>>>11,r)|0;if(o>>>0<s>>>0){Y[e>>2]=s;z[l>>1]=((2048-r|0)>>>5)+r;f=8;p=t+260+(n<<4)|0;r=s;c=10;break}else{c=i-s|0;Y[e>>2]=c;o=o-s|0;Y[a>>2]=o;z[l>>1]=r-(r>>>5);f=256;p=t+516|0;r=c;c=18;break}}else{Y[e>>2]=l;z[t>>1]=((2048-i|0)>>>5)+i;f=8;p=t+4+(n<<4)|0;r=l;c=2}}while(0);n=e+104|0;Y[n>>2]=c;u=e+4|0;h=e+12|0;d=e+16|0;t=1;do{l=p+(t<<1)|0;if(r>>>0<16777216){r=r<<8;Y[e>>2]=r;a=Y[h>>2]|0;s=Y[d>>2]|0;Y[d>>2]=s+1;o=o<<8|(q[a+s>>0]|0);Y[u>>2]=o}s=O[l>>1]|0;i=U(r>>>11,s)|0;if(o>>>0<i>>>0){Y[e>>2]=i;a=0;r=i;i=(2048-s>>5)+s|0}else{r=r-i|0;Y[e>>2]=r;o=o-i|0;Y[u>>2]=o;a=1;i=s-(s>>>5)|0}z[l>>1]=i;t=a|t<<1}while(t>>>0<f>>>0);Y[n>>2]=t-f+c;return}function ge(e,t){e=e|0;t=t|0;var n=0,r=0;n=Pe(28456)|0;e:do{if(n){r=n+24|0;Y[n+60>>2]=e;Y[n+52>>2]=t;switch(e|0){case 1:break;case 2:{Y[r>>2]=0;Y[n+56>>2]=0;break e}default:break e}t=Pe(t)|0;Y[r>>2]=t;if(!t){Ne(n);n=0}}else n=0}while(0);return n|0}function ye(e,t){e=e|0;t=t|0;var n=0,r=0,i=0;n=t&255;if((t&255)>39){i=6;return i|0}r=e+48|0;n=(n&1|2)<<(n>>>1)+11;Y[r>>2]=n;t=Y[e+60>>2]|0;if(t|0){if(n>>>0>(Y[e+52>>2]|0)>>>0){i=4;return i|0}Y[e+44>>2]=n;if(((t|0)==2?(i=e+56|0,(Y[i>>2]|0)>>>0<n>>>0):0)?(n=e+24|0,Ne(Y[n>>2]|0),r=Pe(Y[r>>2]|0)|0,Y[n>>2]=r,(r|0)==0):0){Y[i>>2]=0;i=3;return i|0}}Y[e+104>>2]=0;Y[e+64>>2]=0;H[e+80>>0]=1;Y[e+28388>>2]=0;i=0;return i|0}function xe(e){e=e|0;if(!(Y[e+60>>2]|0)){Ne(e);return}Ne(Y[e+24>>2]|0);Ne(e);return}function _e(){var e=0;Y[778]=3640;Y[779]=0;Y[780]=0;Y[781]=527928;Y[782]=0;Y[783]=524288;se();ce();e=de(2,8388608)|0;Y[784]=e;if(e|0){e=0;return e|0}pe(0);e=1;return e|0}function be(){var e=0;switch(he(Y[784]|0,3112)|0){case 2:case 0:{e=0;break}case 1:{pe(Y[784]|0);e=0;break}case 3:{pe(Y[784]|0);e=1;break}case 4:{pe(Y[784]|0);e=2;break}case 5:{pe(Y[784]|0);e=4;break}case 6:{pe(Y[784]|0);e=5;break}case 8:case 7:{pe(Y[784]|0);e=6;break}default:{pe(Y[784]|0);e=7}}return e|0}function we(){return Y[778]|0}function Ae(){return Y[781]|0}function Me(e){e=e|0;Y[779]=e;return}function Te(e){e=e|0;Y[780]=e>>>0<524288?e:524288;return}function Se(e){e=e|0;Y[782]=e;return}function Ee(e){e=e|0;Y[783]=e>>>0<524288?e:524288;return}function Le(){return Y[782]|0}function Ce(){return(Y[779]|0)==(Y[780]|0)|0}function Pe(e){e=e|0;var t=0,n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=0;b=w;w=w+16|0;p=b;do{if(e>>>0<245){u=e>>>0<11?16:e+11&-8;e=u>>>3;d=Y[785]|0;n=d>>>e;if(n&3|0){t=(n&1^1)+e|0;e=3180+(t<<1<<2)|0;n=e+8|0;r=Y[n>>2]|0;i=r+8|0;a=Y[i>>2]|0;if((a|0)==(e|0))Y[785]=d&~(1<<t);else{Y[a+12>>2]=e;Y[n>>2]=a}_=t<<3;Y[r+4>>2]=_|3;_=r+_+4|0;Y[_>>2]=Y[_>>2]|1;_=i;w=b;return _|0}h=Y[787]|0;if(u>>>0>h>>>0){if(n|0){t=2<<e;t=n<<e&(t|0-t);t=(t&0-t)+-1|0;s=t>>>12&16;t=t>>>s;n=t>>>5&8;t=t>>>n;a=t>>>2&4;t=t>>>a;e=t>>>1&2;t=t>>>e;r=t>>>1&1;r=(n|s|a|e|r)+(t>>>r)|0;t=3180+(r<<1<<2)|0;e=t+8|0;a=Y[e>>2]|0;s=a+8|0;n=Y[s>>2]|0;if((n|0)==(t|0)){e=d&~(1<<r);Y[785]=e}else{Y[n+12>>2]=t;Y[e>>2]=n;e=d}_=r<<3;o=_-u|0;Y[a+4>>2]=u|3;i=a+u|0;Y[i+4>>2]=o|1;Y[a+_>>2]=o;if(h|0){r=Y[790]|0;t=h>>>3;n=3180+(t<<1<<2)|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=r;Y[t+12>>2]=r;Y[r+8>>2]=t;Y[r+12>>2]=n}Y[787]=o;Y[790]=i;_=s;w=b;return _|0}l=Y[786]|0;if(l){n=(l&0-l)+-1|0;s=n>>>12&16;n=n>>>s;o=n>>>5&8;n=n>>>o;c=n>>>2&4;n=n>>>c;r=n>>>1&2;n=n>>>r;e=n>>>1&1;e=Y[3444+((o|s|c|r|e)+(n>>>e)<<2)>>2]|0;n=(Y[e+4>>2]&-8)-u|0;r=Y[e+16+(((Y[e+16>>2]|0)==0&1)<<2)>>2]|0;if(!r){c=e;o=n}else{do{s=(Y[r+4>>2]&-8)-u|0;c=s>>>0<n>>>0;n=c?s:n;e=c?r:e;r=Y[r+16+(((Y[r+16>>2]|0)==0&1)<<2)>>2]|0}while((r|0)!=0);c=e;o=n}s=c+u|0;if(s>>>0>c>>>0){i=Y[c+24>>2]|0;t=Y[c+12>>2]|0;do{if((t|0)==(c|0)){e=c+20|0;t=Y[e>>2]|0;if(!t){e=c+16|0;t=Y[e>>2]|0;if(!t){n=0;break}}while(1){n=t+20|0;r=Y[n>>2]|0;if(r|0){t=r;e=n;continue}n=t+16|0;r=Y[n>>2]|0;if(!r)break;else{t=r;e=n}}Y[e>>2]=0;n=t}else{n=Y[c+8>>2]|0;Y[n+12>>2]=t;Y[t+8>>2]=n;n=t}}while(0);do{if(i|0){t=Y[c+28>>2]|0;e=3444+(t<<2)|0;if((c|0)==(Y[e>>2]|0)){Y[e>>2]=n;if(!n){Y[786]=l&~(1<<t);break}}else{Y[i+16+(((Y[i+16>>2]|0)!=(c|0)&1)<<2)>>2]=n;if(!n)break}Y[n+24>>2]=i;t=Y[c+16>>2]|0;if(t|0){Y[n+16>>2]=t;Y[t+24>>2]=n}t=Y[c+20>>2]|0;if(t|0){Y[n+20>>2]=t;Y[t+24>>2]=n}}}while(0);if(o>>>0<16){_=o+u|0;Y[c+4>>2]=_|3;_=c+_+4|0;Y[_>>2]=Y[_>>2]|1}else{Y[c+4>>2]=u|3;Y[s+4>>2]=o|1;Y[s+o>>2]=o;if(h|0){r=Y[790]|0;t=h>>>3;n=3180+(t<<1<<2)|0;t=1<<t;if(!(d&t)){Y[785]=d|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=r;Y[t+12>>2]=r;Y[r+8>>2]=t;Y[r+12>>2]=n}Y[787]=o;Y[790]=s}_=c+8|0;w=b;return _|0}else h=u}else h=u}else h=u}else if(e>>>0<=4294967231){e=e+11|0;u=e&-8;c=Y[786]|0;if(c){r=0-u|0;e=e>>>8;if(e)if(u>>>0>16777215)l=31;else{d=(e+1048320|0)>>>16&8;x=e<<d;h=(x+520192|0)>>>16&4;x=x<<h;l=(x+245760|0)>>>16&2;l=14-(h|d|l)+(x<<l>>>15)|0;l=u>>>(l+7|0)&1|l<<1}else l=0;n=Y[3444+(l<<2)>>2]|0;e:do{if(!n){n=0;e=0;x=57}else{e=0;s=n;o=u<<((l|0)==31?0:25-(l>>>1)|0);n=0;while(1){i=(Y[s+4>>2]&-8)-u|0;if(i>>>0<r>>>0)if(!i){r=0;n=s;e=s;x=61;break e}else{e=s;r=i}i=Y[s+20>>2]|0;s=Y[s+16+(o>>>31<<2)>>2]|0;n=(i|0)==0|(i|0)==(s|0)?n:i;i=(s|0)==0;if(i){x=57;break}else o=o<<((i^1)&1)}}}while(0);if((x|0)==57){if((n|0)==0&(e|0)==0){e=2<<l;e=c&(e|0-e);if(!e){h=u;break}d=(e&0-e)+-1|0;s=d>>>12&16;d=d>>>s;o=d>>>5&8;d=d>>>o;l=d>>>2&4;d=d>>>l;h=d>>>1&2;d=d>>>h;n=d>>>1&1;e=0;n=Y[3444+((o|s|l|h|n)+(d>>>n)<<2)>>2]|0}if(!n){s=e;o=r}else x=61}if((x|0)==61)while(1){x=0;h=(Y[n+4>>2]&-8)-u|0;d=h>>>0<r>>>0;r=d?h:r;e=d?n:e;n=Y[n+16+(((Y[n+16>>2]|0)==0&1)<<2)>>2]|0;if(!n){s=e;o=r;break}else x=61}if((s|0)!=0?o>>>0<((Y[787]|0)-u|0)>>>0:0){a=s+u|0;if(a>>>0<=s>>>0){_=0;w=b;return _|0}i=Y[s+24>>2]|0;t=Y[s+12>>2]|0;do{if((t|0)==(s|0)){e=s+20|0;t=Y[e>>2]|0;if(!t){e=s+16|0;t=Y[e>>2]|0;if(!t){t=0;break}}while(1){n=t+20|0;r=Y[n>>2]|0;if(r|0){t=r;e=n;continue}n=t+16|0;r=Y[n>>2]|0;if(!r)break;else{t=r;e=n}}Y[e>>2]=0}else{_=Y[s+8>>2]|0;Y[_+12>>2]=t;Y[t+8>>2]=_}}while(0);do{if(i){e=Y[s+28>>2]|0;n=3444+(e<<2)|0;if((s|0)==(Y[n>>2]|0)){Y[n>>2]=t;if(!t){r=c&~(1<<e);Y[786]=r;break}}else{Y[i+16+(((Y[i+16>>2]|0)!=(s|0)&1)<<2)>>2]=t;if(!t){r=c;break}}Y[t+24>>2]=i;e=Y[s+16>>2]|0;if(e|0){Y[t+16>>2]=e;Y[e+24>>2]=t}e=Y[s+20>>2]|0;if(e){Y[t+20>>2]=e;Y[e+24>>2]=t;r=c}else r=c}else r=c}while(0);do{if(o>>>0>=16){Y[s+4>>2]=u|3;Y[a+4>>2]=o|1;Y[a+o>>2]=o;t=o>>>3;if(o>>>0<256){n=3180+(t<<1<<2)|0;e=Y[785]|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=a;Y[t+12>>2]=a;Y[a+8>>2]=t;Y[a+12>>2]=n;break}t=o>>>8;if(t)if(o>>>0>16777215)t=31;else{x=(t+1048320|0)>>>16&8;_=t<<x;y=(_+520192|0)>>>16&4;_=_<<y;t=(_+245760|0)>>>16&2;t=14-(y|x|t)+(_<<t>>>15)|0;t=o>>>(t+7|0)&1|t<<1}else t=0;n=3444+(t<<2)|0;Y[a+28>>2]=t;e=a+16|0;Y[e+4>>2]=0;Y[e>>2]=0;e=1<<t;if(!(r&e)){Y[786]=r|e;Y[n>>2]=a;Y[a+24>>2]=n;Y[a+12>>2]=a;Y[a+8>>2]=a;break}e=o<<((t|0)==31?0:25-(t>>>1)|0);n=Y[n>>2]|0;while(1){if((Y[n+4>>2]&-8|0)==(o|0)){x=97;break}r=n+16+(e>>>31<<2)|0;t=Y[r>>2]|0;if(!t){x=96;break}else{e=e<<1;n=t}}if((x|0)==96){Y[r>>2]=a;Y[a+24>>2]=n;Y[a+12>>2]=a;Y[a+8>>2]=a;break}else if((x|0)==97){x=n+8|0;_=Y[x>>2]|0;Y[_+12>>2]=a;Y[x>>2]=a;Y[a+8>>2]=_;Y[a+12>>2]=n;Y[a+24>>2]=0;break}}else{_=o+u|0;Y[s+4>>2]=_|3;_=s+_+4|0;Y[_>>2]=Y[_>>2]|1}}while(0);_=s+8|0;w=b;return _|0}else h=u}else h=u}else h=-1}while(0);n=Y[787]|0;if(n>>>0>=h>>>0){t=n-h|0;e=Y[790]|0;if(t>>>0>15){_=e+h|0;Y[790]=_;Y[787]=t;Y[_+4>>2]=t|1;Y[e+n>>2]=t;Y[e+4>>2]=h|3}else{Y[787]=0;Y[790]=0;Y[e+4>>2]=n|3;_=e+n+4|0;Y[_>>2]=Y[_>>2]|1}_=e+8|0;w=b;return _|0}s=Y[788]|0;if(s>>>0>h>>>0){y=s-h|0;Y[788]=y;_=Y[791]|0;x=_+h|0;Y[791]=x;Y[x+4>>2]=y|1;Y[_+4>>2]=h|3;_=_+8|0;w=b;return _|0}if(!(Y[903]|0)){Y[905]=4096;Y[904]=4096;Y[906]=-1;Y[907]=-1;Y[908]=0;Y[896]=0;Y[903]=p&-16^1431655768;e=4096}else e=Y[905]|0;l=h+48|0;c=h+47|0;o=e+c|0;i=0-e|0;u=o&i;if(u>>>0<=h>>>0){_=0;w=b;return _|0}e=Y[895]|0;if(e|0?(d=Y[893]|0,p=d+u|0,p>>>0<=d>>>0|p>>>0>e>>>0):0){_=0;w=b;return _|0}e:do{if(!(Y[896]&4)){n=Y[791]|0;t:do{if(n){r=3588;while(1){e=Y[r>>2]|0;if(e>>>0<=n>>>0?(v=r+4|0,(e+(Y[v>>2]|0)|0)>>>0>n>>>0):0)break;e=Y[r+8>>2]|0;if(!e){x=118;break t}else r=e}t=o-s&i;if(t>>>0<2147483647){e=Ve(t|0)|0;if((e|0)==((Y[r>>2]|0)+(Y[v>>2]|0)|0)){if((e|0)!=(-1|0)){o=t;a=e;x=135;break e}}else{r=e;x=126}}else t=0}else x=118}while(0);do{if((x|0)==118){n=Ve(0)|0;if((n|0)!=(-1|0)?(t=n,f=Y[904]|0,m=f+-1|0,t=((m&t|0)==0?0:(m+t&0-f)-t|0)+u|0,f=Y[893]|0,m=t+f|0,t>>>0>h>>>0&t>>>0<2147483647):0){v=Y[895]|0;if(v|0?m>>>0<=f>>>0|m>>>0>v>>>0:0){t=0;break}e=Ve(t|0)|0;if((e|0)==(n|0)){o=t;a=n;x=135;break e}else{r=e;x=126}}else t=0}}while(0);do{if((x|0)==126){n=0-t|0;if(!(l>>>0>t>>>0&(t>>>0<2147483647&(r|0)!=(-1|0))))if((r|0)==(-1|0)){t=0;break}else{o=t;a=r;x=135;break e}e=Y[905]|0;e=c-t+e&0-e;if(e>>>0>=2147483647){o=t;a=r;x=135;break e}if((Ve(e|0)|0)==(-1|0)){Ve(n|0)|0;t=0;break}else{o=e+t|0;a=r;x=135;break e}}}while(0);Y[896]=Y[896]|4;x=133}else{t=0;x=133}}while(0);if(((x|0)==133?u>>>0<2147483647:0)?(a=Ve(u|0)|0,v=Ve(0)|0,g=v-a|0,y=g>>>0>(h+40|0)>>>0,!((a|0)==(-1|0)|y^1|a>>>0<v>>>0&((a|0)!=(-1|0)&(v|0)!=(-1|0))^1)):0){o=y?g:t;x=135}if((x|0)==135){t=(Y[893]|0)+o|0;Y[893]=t;if(t>>>0>(Y[894]|0)>>>0)Y[894]=t;l=Y[791]|0;do{if(l){t=3588;while(1){e=Y[t>>2]|0;n=t+4|0;r=Y[n>>2]|0;if((a|0)==(e+r|0)){x=143;break}i=Y[t+8>>2]|0;if(!i)break;else t=i}if(((x|0)==143?(Y[t+12>>2]&8|0)==0:0)?a>>>0>l>>>0&e>>>0<=l>>>0:0){Y[n>>2]=r+o;_=(Y[788]|0)+o|0;y=l+8|0;y=(y&7|0)==0?0:0-y&7;x=l+y|0;y=_-y|0;Y[791]=x;Y[788]=y;Y[x+4>>2]=y|1;Y[l+_+4>>2]=40;Y[792]=Y[907];break}if(a>>>0<(Y[789]|0)>>>0)Y[789]=a;e=a+o|0;t=3588;while(1){if((Y[t>>2]|0)==(e|0)){x=151;break}t=Y[t+8>>2]|0;if(!t){e=3588;break}}if((x|0)==151)if(!(Y[t+12>>2]&8)){Y[t>>2]=a;u=t+4|0;Y[u>>2]=(Y[u>>2]|0)+o;u=a+8|0;u=a+((u&7|0)==0?0:0-u&7)|0;t=e+8|0;t=e+((t&7|0)==0?0:0-t&7)|0;c=u+h|0;s=t-u-h|0;Y[u+4>>2]=h|3;do{if((l|0)!=(t|0)){if((Y[790]|0)==(t|0)){_=(Y[787]|0)+s|0;Y[787]=_;Y[790]=c;Y[c+4>>2]=_|1;Y[c+_>>2]=_;break}e=Y[t+4>>2]|0;if((e&3|0)==1){o=e&-8;r=e>>>3;e:do{if(e>>>0<256){e=Y[t+8>>2]|0;n=Y[t+12>>2]|0;if((n|0)==(e|0)){Y[785]=Y[785]&~(1<<r);break}else{Y[e+12>>2]=n;Y[n+8>>2]=e;break}}else{a=Y[t+24>>2]|0;e=Y[t+12>>2]|0;do{if((e|0)==(t|0)){r=t+16|0;n=r+4|0;e=Y[n>>2]|0;if(!e){e=Y[r>>2]|0;if(!e){e=0;break}else n=r}while(1){r=e+20|0;i=Y[r>>2]|0;if(i|0){e=i;n=r;continue}r=e+16|0;i=Y[r>>2]|0;if(!i)break;else{e=i;n=r}}Y[n>>2]=0}else{_=Y[t+8>>2]|0;Y[_+12>>2]=e;Y[e+8>>2]=_}}while(0);if(!a)break;n=Y[t+28>>2]|0;r=3444+(n<<2)|0;do{if((Y[r>>2]|0)!=(t|0)){Y[a+16+(((Y[a+16>>2]|0)!=(t|0)&1)<<2)>>2]=e;if(!e)break e}else{Y[r>>2]=e;if(e|0)break;Y[786]=Y[786]&~(1<<n);break e}}while(0);Y[e+24>>2]=a;n=t+16|0;r=Y[n>>2]|0;if(r|0){Y[e+16>>2]=r;Y[r+24>>2]=e}n=Y[n+4>>2]|0;if(!n)break;Y[e+20>>2]=n;Y[n+24>>2]=e}}while(0);t=t+o|0;i=o+s|0}else i=s;t=t+4|0;Y[t>>2]=Y[t>>2]&-2;Y[c+4>>2]=i|1;Y[c+i>>2]=i;t=i>>>3;if(i>>>0<256){n=3180+(t<<1<<2)|0;e=Y[785]|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=c;Y[t+12>>2]=c;Y[c+8>>2]=t;Y[c+12>>2]=n;break}t=i>>>8;do{if(!t)t=0;else{if(i>>>0>16777215){t=31;break}x=(t+1048320|0)>>>16&8;_=t<<x;y=(_+520192|0)>>>16&4;_=_<<y;t=(_+245760|0)>>>16&2;t=14-(y|x|t)+(_<<t>>>15)|0;t=i>>>(t+7|0)&1|t<<1}}while(0);r=3444+(t<<2)|0;Y[c+28>>2]=t;e=c+16|0;Y[e+4>>2]=0;Y[e>>2]=0;e=Y[786]|0;n=1<<t;if(!(e&n)){Y[786]=e|n;Y[r>>2]=c;Y[c+24>>2]=r;Y[c+12>>2]=c;Y[c+8>>2]=c;break}e=i<<((t|0)==31?0:25-(t>>>1)|0);n=Y[r>>2]|0;while(1){if((Y[n+4>>2]&-8|0)==(i|0)){x=192;break}r=n+16+(e>>>31<<2)|0;t=Y[r>>2]|0;if(!t){x=191;break}else{e=e<<1;n=t}}if((x|0)==191){Y[r>>2]=c;Y[c+24>>2]=n;Y[c+12>>2]=c;Y[c+8>>2]=c;break}else if((x|0)==192){x=n+8|0;_=Y[x>>2]|0;Y[_+12>>2]=c;Y[x>>2]=c;Y[c+8>>2]=_;Y[c+12>>2]=n;Y[c+24>>2]=0;break}}else{_=(Y[788]|0)+s|0;Y[788]=_;Y[791]=c;Y[c+4>>2]=_|1}}while(0);_=u+8|0;w=b;return _|0}else e=3588;while(1){t=Y[e>>2]|0;if(t>>>0<=l>>>0?(_=t+(Y[e+4>>2]|0)|0,_>>>0>l>>>0):0)break;e=Y[e+8>>2]|0}i=_+-47|0;e=i+8|0;e=i+((e&7|0)==0?0:0-e&7)|0;i=l+16|0;e=e>>>0<i>>>0?l:e;t=e+8|0;n=o+-40|0;y=a+8|0;y=(y&7|0)==0?0:0-y&7;x=a+y|0;y=n-y|0;Y[791]=x;Y[788]=y;Y[x+4>>2]=y|1;Y[a+n+4>>2]=40;Y[792]=Y[907];n=e+4|0;Y[n>>2]=27;Y[t>>2]=Y[897];Y[t+4>>2]=Y[898];Y[t+8>>2]=Y[899];Y[t+12>>2]=Y[900];Y[897]=a;Y[898]=o;Y[900]=0;Y[899]=t;t=e+24|0;do{x=t;t=t+4|0;Y[t>>2]=7}while((x+8|0)>>>0<_>>>0);if((e|0)!=(l|0)){a=e-l|0;Y[n>>2]=Y[n>>2]&-2;Y[l+4>>2]=a|1;Y[e>>2]=a;t=a>>>3;if(a>>>0<256){n=3180+(t<<1<<2)|0;e=Y[785]|0;t=1<<t;if(!(e&t)){Y[785]=e|t;t=n;e=n+8|0}else{e=n+8|0;t=Y[e>>2]|0}Y[e>>2]=l;Y[t+12>>2]=l;Y[l+8>>2]=t;Y[l+12>>2]=n;break}t=a>>>8;if(t)if(a>>>0>16777215)n=31;else{x=(t+1048320|0)>>>16&8;_=t<<x;y=(_+520192|0)>>>16&4;_=_<<y;n=(_+245760|0)>>>16&2;n=14-(y|x|n)+(_<<n>>>15)|0;n=a>>>(n+7|0)&1|n<<1}else n=0;r=3444+(n<<2)|0;Y[l+28>>2]=n;Y[l+20>>2]=0;Y[i>>2]=0;t=Y[786]|0;e=1<<n;if(!(t&e)){Y[786]=t|e;Y[r>>2]=l;Y[l+24>>2]=r;Y[l+12>>2]=l;Y[l+8>>2]=l;break}e=a<<((n|0)==31?0:25-(n>>>1)|0);n=Y[r>>2]|0;while(1){if((Y[n+4>>2]&-8|0)==(a|0)){x=213;break}r=n+16+(e>>>31<<2)|0;t=Y[r>>2]|0;if(!t){x=212;break}else{e=e<<1;n=t}}if((x|0)==212){Y[r>>2]=l;Y[l+24>>2]=n;Y[l+12>>2]=l;Y[l+8>>2]=l;break}else if((x|0)==213){x=n+8|0;_=Y[x>>2]|0;Y[_+12>>2]=l;Y[x>>2]=l;Y[l+8>>2]=_;Y[l+12>>2]=n;Y[l+24>>2]=0;break}}}else{_=Y[789]|0;if((_|0)==0|a>>>0<_>>>0)Y[789]=a;Y[897]=a;Y[898]=o;Y[900]=0;Y[794]=Y[903];Y[793]=-1;Y[798]=3180;Y[797]=3180;Y[800]=3188;Y[799]=3188;Y[802]=3196;Y[801]=3196;Y[804]=3204;Y[803]=3204;Y[806]=3212;Y[805]=3212;Y[808]=3220;Y[807]=3220;Y[810]=3228;Y[809]=3228;Y[812]=3236;Y[811]=3236;Y[814]=3244;Y[813]=3244;Y[816]=3252;Y[815]=3252;Y[818]=3260;Y[817]=3260;Y[820]=3268;Y[819]=3268;Y[822]=3276;Y[821]=3276;Y[824]=3284;Y[823]=3284;Y[826]=3292;Y[825]=3292;Y[828]=3300;Y[827]=3300;Y[830]=3308;Y[829]=3308;Y[832]=3316;Y[831]=3316;Y[834]=3324;Y[833]=3324;Y[836]=3332;Y[835]=3332;Y[838]=3340;Y[837]=3340;Y[840]=3348;Y[839]=3348;Y[842]=3356;Y[841]=3356;Y[844]=3364;Y[843]=3364;Y[846]=3372;Y[845]=3372;Y[848]=3380;Y[847]=3380;Y[850]=3388;Y[849]=3388;Y[852]=3396;Y[851]=3396;Y[854]=3404;Y[853]=3404;Y[856]=3412;Y[855]=3412;Y[858]=3420;Y[857]=3420;Y[860]=3428;Y[859]=3428;_=o+-40|0;y=a+8|0;y=(y&7|0)==0?0:0-y&7;x=a+y|0;y=_-y|0;Y[791]=x;Y[788]=y;Y[x+4>>2]=y|1;Y[a+_+4>>2]=40;Y[792]=Y[907]}}while(0);t=Y[788]|0;if(t>>>0>h>>>0){y=t-h|0;Y[788]=y;_=Y[791]|0;x=_+h|0;Y[791]=x;Y[x+4>>2]=y|1;Y[_+4>>2]=h|3;_=_+8|0;w=b;return _|0}}Y[(Re()|0)>>2]=12;_=0;w=b;return _|0}function Ne(e){e=e|0;var t=0,n=0,r=0,i=0,a=0,o=0,s=0,l=0;if(!e)return;n=e+-8|0;i=Y[789]|0;e=Y[e+-4>>2]|0;t=e&-8;l=n+t|0;do{if(!(e&1)){r=Y[n>>2]|0;if(!(e&3))return;o=n+(0-r)|0;a=r+t|0;if(o>>>0<i>>>0)return;if((Y[790]|0)==(o|0)){e=l+4|0;t=Y[e>>2]|0;if((t&3|0)!=3){s=o;t=a;break}Y[787]=a;Y[e>>2]=t&-2;Y[o+4>>2]=a|1;Y[o+a>>2]=a;return}n=r>>>3;if(r>>>0<256){e=Y[o+8>>2]|0;t=Y[o+12>>2]|0;if((t|0)==(e|0)){Y[785]=Y[785]&~(1<<n);s=o;t=a;break}else{Y[e+12>>2]=t;Y[t+8>>2]=e;s=o;t=a;break}}i=Y[o+24>>2]|0;e=Y[o+12>>2]|0;do{if((e|0)==(o|0)){n=o+16|0;t=n+4|0;e=Y[t>>2]|0;if(!e){e=Y[n>>2]|0;if(!e){e=0;break}else t=n}while(1){n=e+20|0;r=Y[n>>2]|0;if(r|0){e=r;t=n;continue}n=e+16|0;r=Y[n>>2]|0;if(!r)break;else{e=r;t=n}}Y[t>>2]=0}else{s=Y[o+8>>2]|0;Y[s+12>>2]=e;Y[e+8>>2]=s}}while(0);if(i){t=Y[o+28>>2]|0;n=3444+(t<<2)|0;if((Y[n>>2]|0)==(o|0)){Y[n>>2]=e;if(!e){Y[786]=Y[786]&~(1<<t);s=o;t=a;break}}else{Y[i+16+(((Y[i+16>>2]|0)!=(o|0)&1)<<2)>>2]=e;if(!e){s=o;t=a;break}}Y[e+24>>2]=i;t=o+16|0;n=Y[t>>2]|0;if(n|0){Y[e+16>>2]=n;Y[n+24>>2]=e}t=Y[t+4>>2]|0;if(t){Y[e+20>>2]=t;Y[t+24>>2]=e;s=o;t=a}else{s=o;t=a}}else{s=o;t=a}}else{s=n;o=n}}while(0);if(o>>>0>=l>>>0)return;e=l+4|0;r=Y[e>>2]|0;if(!(r&1))return;if(!(r&2)){if((Y[791]|0)==(l|0)){l=(Y[788]|0)+t|0;Y[788]=l;Y[791]=s;Y[s+4>>2]=l|1;if((s|0)!=(Y[790]|0))return;Y[790]=0;Y[787]=0;return}if((Y[790]|0)==(l|0)){l=(Y[787]|0)+t|0;Y[787]=l;Y[790]=o;Y[s+4>>2]=l|1;Y[o+l>>2]=l;return}i=(r&-8)+t|0;n=r>>>3;do{if(r>>>0<256){t=Y[l+8>>2]|0;e=Y[l+12>>2]|0;if((e|0)==(t|0)){Y[785]=Y[785]&~(1<<n);break}else{Y[t+12>>2]=e;Y[e+8>>2]=t;break}}else{a=Y[l+24>>2]|0;e=Y[l+12>>2]|0;do{if((e|0)==(l|0)){n=l+16|0;t=n+4|0;e=Y[t>>2]|0;if(!e){e=Y[n>>2]|0;if(!e){n=0;break}else t=n}while(1){n=e+20|0;r=Y[n>>2]|0;if(r|0){e=r;t=n;continue}n=e+16|0;r=Y[n>>2]|0;if(!r)break;else{e=r;t=n}}Y[t>>2]=0;n=e}else{n=Y[l+8>>2]|0;Y[n+12>>2]=e;Y[e+8>>2]=n;n=e}}while(0);if(a|0){e=Y[l+28>>2]|0;t=3444+(e<<2)|0;if((Y[t>>2]|0)==(l|0)){Y[t>>2]=n;if(!n){Y[786]=Y[786]&~(1<<e);break}}else{Y[a+16+(((Y[a+16>>2]|0)!=(l|0)&1)<<2)>>2]=n;if(!n)break}Y[n+24>>2]=a;e=l+16|0;t=Y[e>>2]|0;if(t|0){Y[n+16>>2]=t;Y[t+24>>2]=n}e=Y[e+4>>2]|0;if(e|0){Y[n+20>>2]=e;Y[e+24>>2]=n}}}}while(0);Y[s+4>>2]=i|1;Y[o+i>>2]=i;if((s|0)==(Y[790]|0)){Y[787]=i;return}}else{Y[e>>2]=r&-2;Y[s+4>>2]=t|1;Y[o+t>>2]=t;i=t}e=i>>>3;if(i>>>0<256){n=3180+(e<<1<<2)|0;t=Y[785]|0;e=1<<e;if(!(t&e)){Y[785]=t|e;e=n;t=n+8|0}else{t=n+8|0;e=Y[t>>2]|0}Y[t>>2]=s;Y[e+12>>2]=s;Y[s+8>>2]=e;Y[s+12>>2]=n;return}e=i>>>8;if(e)if(i>>>0>16777215)e=31;else{o=(e+1048320|0)>>>16&8;l=e<<o;a=(l+520192|0)>>>16&4;l=l<<a;e=(l+245760|0)>>>16&2;e=14-(a|o|e)+(l<<e>>>15)|0;e=i>>>(e+7|0)&1|e<<1}else e=0;r=3444+(e<<2)|0;Y[s+28>>2]=e;Y[s+20>>2]=0;Y[s+16>>2]=0;t=Y[786]|0;n=1<<e;do{if(t&n){t=i<<((e|0)==31?0:25-(e>>>1)|0);n=Y[r>>2]|0;while(1){if((Y[n+4>>2]&-8|0)==(i|0)){e=73;break}r=n+16+(t>>>31<<2)|0;e=Y[r>>2]|0;if(!e){e=72;break}else{t=t<<1;n=e}}if((e|0)==72){Y[r>>2]=s;Y[s+24>>2]=n;Y[s+12>>2]=s;Y[s+8>>2]=s;break}else if((e|0)==73){o=n+8|0;l=Y[o>>2]|0;Y[l+12>>2]=s;Y[o>>2]=s;Y[s+8>>2]=l;Y[s+12>>2]=n;Y[s+24>>2]=0;break}}else{Y[786]=t|n;Y[r>>2]=s;Y[s+24>>2]=r;Y[s+12>>2]=s;Y[s+8>>2]=s}}while(0);l=(Y[793]|0)+-1|0;Y[793]=l;if(!l)e=3596;else return;while(1){e=Y[e>>2]|0;if(!e)break;else e=e+8|0}Y[793]=-1;return}function Re(){return 3636}function Fe(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0;e:do{if(!n)e=0;else{while(1){r=H[e>>0]|0;i=H[t>>0]|0;if(r<<24>>24!=i<<24>>24)break;n=n+-1|0;if(!n){e=0;break e}else{e=e+1|0;t=t+1|0}}e=(r&255)-(i&255)|0}}while(0);return e|0}function Oe(){}function Ie(e,t,n){e=e|0;t=t|0;n=n|0;if((n|0)<32){Q=t>>>n;return e>>>n|(t&(1<<n)-1)<<32-n}Q=0;return t>>>n-32|0}function De(e,t,n){e=e|0;t=t|0;n=n|0;if((n|0)<32){Q=t<<n|(e&(1<<n)-1<<32-n)>>>32-n;return e<<n}Q=e<<n-32;return 0}function Ue(e,t,n,r){e=e|0;t=t|0;n=n|0;r=r|0;n=e+n>>>0;return(Q=t+r+(n>>>0<e>>>0|0)>>>0,n|0)|0}function Be(e,t,n,r){e=e|0;t=t|0;n=n|0;r=r|0;r=t-r-(n>>>0>e>>>0|0)>>>0;return(Q=r,e-n>>>0|0)|0}function ze(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0,a=0;if((n|0)>=8192)return J(e|0,t|0,n|0)|0;a=e|0;i=e+n|0;if((e&3)==(t&3)){while(e&3){if(!n)return a|0;H[e>>0]=H[t>>0]|0;e=e+1|0;t=t+1|0;n=n-1|0}n=i&-4|0;r=n-64|0;while((e|0)<=(r|0)){Y[e>>2]=Y[t>>2];Y[e+4>>2]=Y[t+4>>2];Y[e+8>>2]=Y[t+8>>2];Y[e+12>>2]=Y[t+12>>2];Y[e+16>>2]=Y[t+16>>2];Y[e+20>>2]=Y[t+20>>2];Y[e+24>>2]=Y[t+24>>2];Y[e+28>>2]=Y[t+28>>2];Y[e+32>>2]=Y[t+32>>2];Y[e+36>>2]=Y[t+36>>2];Y[e+40>>2]=Y[t+40>>2];Y[e+44>>2]=Y[t+44>>2];Y[e+48>>2]=Y[t+48>>2];Y[e+52>>2]=Y[t+52>>2];Y[e+56>>2]=Y[t+56>>2];Y[e+60>>2]=Y[t+60>>2];e=e+64|0;t=t+64|0}while((e|0)<(n|0)){Y[e>>2]=Y[t>>2];e=e+4|0;t=t+4|0}}else{n=i-4|0;while((e|0)<(n|0)){H[e>>0]=H[t>>0]|0;H[e+1>>0]=H[t+1>>0]|0;H[e+2>>0]=H[t+2>>0]|0;H[e+3>>0]=H[t+3>>0]|0;e=e+4|0;t=t+4|0}}while((e|0)<(i|0)){H[e>>0]=H[t>>0]|0;e=e+1|0;t=t+1|0}return a|0}function ke(e,t,n){e=e|0;t=t|0;n=n|0;var r=0;if((t|0)<(e|0)&(e|0)<(t+n|0)){r=e;t=t+n|0;e=e+n|0;while((n|0)>0){e=e-1|0;t=t-1|0;n=n-1|0;H[e>>0]=H[t>>0]|0}e=r}else ze(e,t,n)|0;return e|0}function Ge(e,t,n){e=e|0;t=t|0;n=n|0;var r=0,i=0,a=0,o=0;a=e+n|0;t=t&255;if((n|0)>=67){while(e&3){H[e>>0]=t;e=e+1|0}r=a&-4|0;i=r-64|0;o=t|t<<8|t<<16|t<<24;while((e|0)<=(i|0)){Y[e>>2]=o;Y[e+4>>2]=o;Y[e+8>>2]=o;Y[e+12>>2]=o;Y[e+16>>2]=o;Y[e+20>>2]=o;Y[e+24>>2]=o;Y[e+28>>2]=o;Y[e+32>>2]=o;Y[e+36>>2]=o;Y[e+40>>2]=o;Y[e+44>>2]=o;Y[e+48>>2]=o;Y[e+52>>2]=o;Y[e+56>>2]=o;Y[e+60>>2]=o;e=e+64|0}while((e|0)<(r|0)){Y[e>>2]=o;e=e+4|0}}while((e|0)<(a|0)){H[e>>0]=t;e=e+1|0}return a-n|0}function Ve(e){e=e|0;var t=0,n=0;n=e+15&-16|0;t=Y[o>>2]|0;e=t+n|0;if((n|0)>0&(e|0)<(t|0)|(e|0)<0){Z()|0;K(12);return-1}Y[o>>2]=e;if((e|0)>(W()|0)?(X()|0)==0:0){Y[o>>2]=t;K(12);return-1}return t|0}return{_bitshift64Lshr:Ie,_bitshift64Shl:De,_decompress:be,_free:Ne,_get_curr_output_length:Le,_get_in_buffer_ptr:we,_get_out_buffer_ptr:Ae,_i64Add:Ue,_i64Subtract:Be,_in_buffer_set_pos:Me,_in_buffer_set_size:Te,_init_decompressor:_e,_is_input_end_reached:Ce,_malloc:Pe,_memcpy:ze,_memmove:ke,_memset:Ge,_out_buffer_set_pos:Se,_out_buffer_set_size:Ee,_sbrk:Ve,establishStackSpace:re,getTempRet0:oe,runPostSets:Oe,setTempRet0:ae,setThrew:ie,stackAlloc:ee,stackRestore:ne,stackSave:te}}(hp.asmGlobalArg,hp.asmLibraryArg,Ep),sf=(hp._bitshift64Lshr=of._bitshift64Lshr,hp._bitshift64Shl=of._bitshift64Shl,hp._decompress=of._decompress,hp._free=of._free,hp._get_curr_output_length=of._get_curr_output_length,hp._get_in_buffer_ptr=of._get_in_buffer_ptr,hp._get_out_buffer_ptr=of._get_out_buffer_ptr,hp._i64Add=of._i64Add,hp._i64Subtract=of._i64Subtract,hp._in_buffer_set_pos=of._in_buffer_set_pos,hp._in_buffer_set_size=of._in_buffer_set_size,hp._init_decompressor=of._init_decompressor,hp._is_input_end_reached=of._is_input_end_reached,hp._malloc=of._malloc,hp._memcpy=of._memcpy,hp._memmove=of._memmove,hp._memset=of._memset,hp._out_buffer_set_pos=of._out_buffer_set_pos,hp._out_buffer_set_size=of._out_buffer_set_size,hp._sbrk=of._sbrk,hp.establishStackSpace=of.establishStackSpace,hp.getTempRet0=of.getTempRet0,hp.runPostSets=of.runPostSets,hp.setTempRet0=of.setTempRet0,hp.setThrew=of.setThrew,hp.stackAlloc=of.stackAlloc),lf=hp.stackRestore=of.stackRestore,cf=hp.stackSave=of.stackSave;if(hp.asm=of,hp.cwrap=function(e,t,n){n=n||[];var r=wp(e),i=n.every(function(e){return"number"===e});return"string"!==t&&i?r:function(){return Tp(e,t,n,arguments)}},Kp)if($p(Kp)||("function"==typeof hp.locateFile?Kp=hp.locateFile(Kp):hp.memoryInitializerPrefixURL&&(Kp=hp.memoryInitializerPrefixURL+Kp)),gp||yp){var uf=hp.readBinary(Kp);Cp.set(uf,8)}else{qp++,hp.monitorRunDependencies&&hp.monitorRunDependencies(qp);var hf=function(e){e.byteLength&&(e=new Uint8Array(e)),Cp.set(e,8),hp.memoryInitializerRequest&&delete hp.memoryInitializerRequest.response,function(e){if(qp--,hp.monitorRunDependencies&&hp.monitorRunDependencies(qp),0==qp&&(null!==Qp&&(clearInterval(Qp),Qp=null),Zp)){var t=Zp;Zp=null,t()}}()},df=function(){hp.readAsync(Kp,hf,function(){throw"could not load memory initializer "+Kp})},pf=af(Kp);if(pf)hf(pf.buffer);else if(hp.memoryInitializerRequest){var ff=function(){var e=hp.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var n=af(hp.memoryInitializerRequestURL);if(!n)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+e.status+", retrying "+Kp),void df();t=n.buffer}hf(t)};hp.memoryInitializerRequest.response?setTimeout(ff,0):hp.memoryInitializerRequest.addEventListener("load",ff)}else df()}function mf(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function vf(e){function t(){hp.calledRun||(hp.calledRun=!0,_p||(Yp||(Yp=!0,Gp(jp)),Gp(Xp),hp.onRuntimeInitialized&&hp.onRuntimeInitialized(),function(){if(hp.postRun)for("function"==typeof hp.postRun&&(hp.postRun=[hp.postRun]);hp.postRun.length;)e=hp.postRun.shift(),Hp.unshift(e);var e;Gp(Hp)}()))}e=e||hp.arguments,0<qp||(!function(){if(hp.preRun)for("function"==typeof hp.preRun&&(hp.preRun=[hp.preRun]);hp.preRun.length;)e=hp.preRun.shift(),Vp.unshift(e);var e;Gp(Vp)}(),0<qp||hp.calledRun||(hp.setStatus?(hp.setStatus("Running..."),setTimeout(function(){setTimeout(function(){hp.setStatus("")},1),t()},1)):t()))}function gf(e){throw hp.onAbort&&hp.onAbort(e),e=void 0!==e?(hp.print(e),hp.printErr(e),JSON.stringify(e)):"",_p=!0,1,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if((mf.prototype=new Error).constructor=mf,Zp=function e(){hp.calledRun||vf(),hp.calledRun||(Zp=e)},hp.run=vf,hp.exit=function(e,t){t&&hp.noExitRuntime&&0===e||(hp.noExitRuntime||(_p=!0,e,Op=void 0,Gp(Wp),!0,hp.onExit&&hp.onExit(e)),gp&&process.exit(e),hp.quit(e,new mf(e)))},hp.abort=gf,hp.preInit)for("function"==typeof hp.preInit&&(hp.preInit=[hp.preInit]);0<hp.preInit.length;)hp.preInit.pop()();hp.noExitRuntime=!0,vf();var yf=hp,xf={getPageParams:function(){var e=decodeURIComponent(location.href.toString()),t={};if(-1==e.indexOf("?"))return t;for(var n=e.split("#")[0].split("?")[1].split("&"),r=0;r<n.length;r++){var i=n[r].split("="),a=i[0];1==i.length?t[a]="":t[a]=i[1]}return t},loadScript:function(e,t,n,r){var i=document.createElement("script");i.addEventListener("load",n,!1),i.addEventListener("error",r,!1),t.appendChild(i),i.src=e},drawWatermark:function(e,t){var n=["color: #fff;","opacity: 0.5;","font-size: 18px;","font-family: sans-serif;","text-align: center;","position: absolute;","bottom: 1%;","right: 1%;","user-select: none;","z-index: 9999;","pointer-events: none;","text-shadow: 1px 1px #000;"].join("\n"),r=document.createElement("div");r.setAttribute("style",n);var i=document.createTextNode(t);r.appendChild(i),e.appendChild(r)},isXML:function(e){return null!==e.match(/.*\.xml$/)},isJS:function(e){return null!==e.match(/.*\.js$/)},createLineObjectHTML:function(m,v,g,e,t,y){console.warn("v3d.AppUtils.createLineObjectHTML has been deprecated. Use v3d.LineHTML instead."),e=e||2,t=t?t.convertSRGBToLinear():new v3d.Color(1,0,.2),y=y||5;var x=new v3d.Vector3(1,0,0),n=new v3d.MeshLine;n.setGeometry([0,0,0,x.x,x.y,x.z]);var r=new v3d.MeshLineMaterial({color:t,lineWidth:e,sizeAttenuation:0}),_=new v3d.Mesh(n.geometry,r);_.name=v.name+"_LINE",v.add(_);var b=new v3d.Vector3,w=new v3d.Vector3,A=new v3d.Quaternion;m.renderCallbacks.push(function(){m.camera.updateMatrixWorld(),v.traverseAncestors(function(e){e.updateMatrixWorld()});var e=g.getBoundingClientRect(),t=(e.left+e.right)/2,n=(e.top+e.bottom)/2,r=v.getWorldPosition(b);r.project(m.camera);var i=(r.x+1)/2*m.getWidth(),a=(1-r.y)/2*m.getHeight(),o=(n-a)/(t-i),s=(e.height+2*y)/(e.width+2*y);if(Math.abs(o)>s)var l=((c=n<a?Math.min(e.bottom+y,a):Math.max(e.top-y,a))-a)/o+i;else var c=((l=i<t?Math.max(e.left-y,i):Math.min(e.right+y,i))-i)*o+a;var u=2*l/m.getWidth()-1,h=1-2*c/m.getHeight(),d=w.set(u,h,0);d.unproject(m.camera),v.worldToLocal(d);var p=d.length();_.scale.set(p,p,p),d.normalize();var f=A.setFromUnitVectors(x,d);_.setRotationFromQuaternion(f)})}};function _f(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}Object.assign(_f.prototype,{setCamera:function(e){},setSize:function(e,t){},dispose:function(){},render:function(e,t,n,r,i){console.error("v3d.Pass: .render() must be implemented in derived pass.")}});var bf={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{type:"t",value:null},luminosityThreshold:{type:"f",value:1},smoothWidth:{type:"f",value:1},defaultColor:{type:"c",value:new Fn(0)},defaultOpacity:{type:"f",value:0}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","vec4 texel = texture2D(tDiffuse, vUv);","vec3 luma = vec3(0.299, 0.587, 0.114);","float v = dot(texel.xyz, luma);","vec4 outputColor = vec4(defaultColor.rgb, defaultOpacity);","float alpha = smoothstep(luminosityThreshold, luminosityThreshold + smoothWidth, v);","gl_FragColor = mix(outputColor, texel, alpha);","}"].join("\n")};function wf(e,t,n,r,i){_f.call(this),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=r,this.resolution=void 0!==e?new qt(e.x,e.y):new qt(256,256),i=i||{minFilter:Ne,magFilter:Ne,format:qe},this.clearColor=new Fn(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new _n(a,o,i),this.renderTargetBright.texture.name="BloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(var s=0;s<this.nMips;s++){var l;(l=new _n(a,o,i)).texture.name="BloomPass.h"+s,l.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(l),(l=new _n(a,o,i)).texture.name="BloomPass.v"+s,l.texture.generateMipmaps=!1,this.renderTargetsVertical.push(l),a=Math.round(a/2),o=Math.round(o/2)}var c=bf;this.highPassUniforms=Nn.clone(c.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new Mi({type:"BloomHighPass",uniforms:this.highPassUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,defines:{}}),this.separableBlurMaterials=[];var u=[3,5,7,9,11];for(a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2),s=0;s<this.nMips;s++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(u[s])),this.separableBlurMaterials[s].uniforms.texSize.value=new qt(a,o),a=Math.round(a/2),o=Math.round(o/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new Kt(1,1,1),new Kt(1,1,1),new Kt(1,1,1),new Kt(1,1,1),new Kt(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;var h=Un.copy;this.copyUniforms=Nn.clone(h.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Mi({type:"BloomCopy",defines:h.defines,uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:K,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Fn,this.oldClearAlpha=1,this.camera=new dr(-1,1,1,-1,0,1),this.scene=new Do,this.basic=new Ai,this.quad=new Ei(new Qr(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)}function Af(e,t){_f.call(this),this.textureID=void 0!==t?t:"tDiffuse",e instanceof Mi?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Nn.clone(e.uniforms),this.material=new Mi({type:"ShaderPass",defines:e.defines||{},uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.camera=new dr(-1,1,1,-1,0,1),this.scene=new Do,this.quad=new Ei(new Qr(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)}function Mf(){Af.call(this,Un.brightness_contrast),Object.defineProperties(this,{brightness:{get:function(){return this.uniforms.brightness.value},set:function(e){this.uniforms.brightness.value=e}},contrast:{get:function(){return this.uniforms.contrast.value},set:function(e){this.uniforms.contrast.value=e}}})}function Tf(e,t,n){_f.call(this),this.scene=e,this.camera=t;var r=new _n(n.width||window.innerWidth||1,n.height||window.innerHeight||1,{minFilter:Ne,magFilter:Ne,format:qe});this.renderTargetDepth=r.clone(),this.renderTargetDepth.texture.name="BokehPass.depth",this.materialDepth=new $a,this.materialDepth.depthPacking=Gt,this.materialDepth.blending=Q;var i=Un.bokeh,a=Nn.clone(i.uniforms);a.tDepth.value=this.renderTargetDepth.texture,a.focus.value=jn(n.focus)?n.focus:1,a.aperture.value=jn(n.aperture)?n.aperture:1,a.maxblur.value=jn(n.maxblur)?n.maxblur:1,a.depthLeakThreshold.value=jn(n.depthLeakThreshold)?n.depthLeakThreshold:.2,a.nearClip.value=t.near,a.farClip.value=t.far,a.aspect.value=t.aspect,Object.defineProperties(this,{focus:{get:function(){return this.uniforms.focus.value},set:function(e){this.uniforms.focus.value=e}},aperture:{get:function(){return this.uniforms.aperture.value},set:function(e){this.uniforms.aperture.value=e}},maxblur:{get:function(){return this.uniforms.maxblur.value},set:function(e){this.uniforms.maxblur.value=e}},depthLeakThreshold:{get:function(){return this.uniforms.depthLeakThreshold.value},set:function(e){this.uniforms.depthLeakThreshold.value=e}}}),this.materialBokeh=new Mi({type:"Bokeh",defines:i.defines,uniforms:a,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}),this.uniforms=a,this.camera2=new dr(-1,1,1,-1,0,1),this.scene2=new Do,this.quad2=new Ei(new Qr(2,2),null),this.quad2.frustumCulled=!1,this.scene2.add(this.quad2),this.oldClearColor=new Fn,this.oldClearAlpha=1}function Sf(e,t){_f.call(this),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}function Ef(){_f.call(this),this.needsSwap=!1}function Lf(e,t){if(this.renderer=e,void 0===t){var n={minFilter:Ne,magFilter:Ne,format:qe,stencilBuffer:!1},r=e.getDrawingBufferSize();(t=new _n(r.width,r.height,n)).texture.name="EffectComposer.rt1",t.texture.encoding=Ot}this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],this.copyPass=new Af(Un.copy)}function Cf(e,t,n,r){Af.call(this,Un.fxaa),this.width=void 0!==n?n:512,this.height=void 0!==r?r:256,this.needsSwap=!1}wf.prototype=Object.assign(Object.create(_f.prototype),{constructor:wf,dispose:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose()},setSize:function(e,t){var n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(n,r),this.renderTargetsVertical[i].setSize(n,r),this.separableBlurMaterials[i].uniforms.texSize.value=new qt(n,r),n=Math.round(n/2),r=Math.round(r/2)},render:function(e,t,n,r,i){this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.context.disable(e.context.STENCIL_TEST),this.renderToScreen&&(this.quad.material=this.basic,this.basic.map=n.texture,e.render(this.scene,this.camera,void 0,!0)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.quad.material=this.materialHighPassFilter,e.render(this.scene,this.camera,this.renderTargetBright,!0);for(var o=this.renderTargetBright,s=0;s<this.nMips;s++)this.quad.material=this.separableBlurMaterials[s],this.separableBlurMaterials[s].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[s].uniforms.direction.value=wf.BlurDirectionX,e.render(this.scene,this.camera,this.renderTargetsHorizontal[s],!0),this.separableBlurMaterials[s].uniforms.colorTexture.value=this.renderTargetsHorizontal[s].texture,this.separableBlurMaterials[s].uniforms.direction.value=wf.BlurDirectionY,e.render(this.scene,this.camera,this.renderTargetsVertical[s],!0),o=this.renderTargetsVertical[s];this.quad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.render(this.scene,this.camera,this.renderTargetsHorizontal[0],!0),this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.context.enable(e.context.STENCIL_TEST),this.renderToScreen?e.render(this.scene,this.camera,void 0,!1):e.render(this.scene,this.camera,n,!1),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a},getSeperableBlurMaterial:function(e){return new Mi({type:"BloomSeparableBlur",defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new qt(.5,.5)},direction:{value:new qt(.5,.5)}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"#include <common> varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 texSize; uniform vec2 direction; float gaussianPdf(in float x, in float sigma) { return 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma; } void main() {\n vec2 invSize = 1.0 / texSize; float fSigma = float(SIGMA); float weightSum = gaussianPdf(0.0, fSigma); vec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum; for(int i = 1; i < KERNEL_RADIUS; i++) { float x = float(i); float w = gaussianPdf(x, fSigma); vec2 uvOffset = direction * invSize * x; vec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb; vec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb; diffuseSum += (sample1 + sample2) * w; weightSum += 2.0 * w; } gl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n }"})},getCompositeMaterial:function(e){return new Mi({type:"BloomComposite",defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"varying vec2 vUv; uniform sampler2D blurTexture1; uniform sampler2D blurTexture2; uniform sampler2D blurTexture3; uniform sampler2D blurTexture4; uniform sampler2D blurTexture5; uniform sampler2D dirtTexture; uniform float bloomStrength; uniform float bloomRadius; uniform float bloomFactors[NUM_MIPS]; uniform vec3 bloomTintColors[NUM_MIPS]; float lerpBloomFactor(const in float factor) { float mirrorFactor = 1.2 - factor; return mix(factor, mirrorFactor, bloomRadius); } void main() { gl_FragColor = bloomStrength * (lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv)); }"})}}),wf.BlurDirectionX=new qt(1,0),wf.BlurDirectionY=new qt(0,1),Af.prototype=Object.assign(Object.create(_f.prototype),{constructor:Af,render:function(e,t,n,r,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.quad.material=this.material,this.renderToScreen?e.render(this.scene,this.camera):e.render(this.scene,this.camera,t,this.clear)}}),Mf.prototype=Object.assign(Object.create(Af.prototype),{constructor:Mf}),Tf.prototype=Object.assign(Object.create(_f.prototype),{constructor:Tf,render:function(e,t,n,r,i){this.quad2.material=this.materialBokeh,this.scene.overrideMaterial=this.materialDepth,this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();e.autoClear;e.autoClear=!1,e.setClearColor(16777215),e.setClearAlpha(1),e.render(this.scene,this.camera,this.renderTargetDepth,!0),this.uniforms.tColor.value=n.texture,this.uniforms.nearClip.value=this.camera.near,this.uniforms.farClip.value=this.camera.far,this.uniforms.aspect.value=this.camera.aspect,this.renderToScreen?e.render(this.scene2,this.camera2):e.render(this.scene2,this.camera2,t,this.clear),this.scene.overrideMaterial=null,e.setClearColor(this.oldClearColor),e.setClearAlpha(this.oldClearAlpha),e.autoClear=this.oldAutoClear},setCamera:function(e){this.camera=e},setSize:function(e,t){this.renderTargetDepth.setSize(e,t)},dispose:function(){this.renderTargetDepth.dispose()}}),Sf.prototype=Object.assign(Object.create(_f.prototype),{constructor:Sf,render:function(e,t,n,r,i){var a,o,s=e.context,l=e.state;l.buffers.color.setMask(!1),l.buffers.depth.setMask(!1),l.buffers.color.setLocked(!0),l.buffers.depth.setLocked(!0),o=this.inverse?(a=0,1):(a=1,0),l.buffers.stencil.setTest(!0),l.buffers.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),l.buffers.stencil.setFunc(s.ALWAYS,a,4294967295),l.buffers.stencil.setClear(o),e.render(this.scene,this.camera,n,this.clear),e.render(this.scene,this.camera,t,this.clear),l.buffers.color.setLocked(!1),l.buffers.depth.setLocked(!1),l.buffers.stencil.setFunc(s.EQUAL,1,4294967295),l.buffers.stencil.setOp(s.KEEP,s.KEEP,s.KEEP)},setCamera:function(e){this.camera=e}}),Ef.prototype=Object.create(_f.prototype),Object.assign(Ef.prototype,{render:function(e,t,n,r,i){e.state.buffers.stencil.setTest(!1)}}),Object.assign(Lf.prototype,{swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e);var t=this.renderer.getDrawingBufferSize();e.setSize(t.width,t.height)},insertPass:function(e,t){this.passes.splice(t,0,e)},render:function(e){var t,n,r=!1,i=this.passes.length;for(n=0;n<i;n++)if(!1!==(t=this.passes[n]).enabled){if(t.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),t.needsSwap){if(r){var a=this.renderer.context;a.stencilFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),a.stencilFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}t instanceof Sf?r=!0:t instanceof Ef&&(r=!1)}},reset:function(e){if(void 0===e){var t=this.renderer.getDrawingBufferSize();(e=this.renderTarget1.clone()).setSize(t.width,t.height)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t);for(var n=0;n<this.passes.length;n++)this.passes[n].setSize(e,t)}});var Pf=[[0,0,!((Cf.prototype=Object.create(Af.prototype)).setSize=function(e,t){this.width=e,this.height=t,this.uniforms.resolution.value.set(1/e,1/t)}),!1],[2,0,!1,!1],[1,1,!0,!0],[0,1,!0,!0],[1,0,!1,!1],[2,1,!1,!1]];function Nf(e){this.manager=void 0!==e?e:ic}Object.assign(Nf.prototype,{crossOrigin:"Anonymous",load:function(e,s,t,n){var l=new zi,r=new cc(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);var c=0;return r.load(e,function(e){for(var t=0;t<Pf.length;t++){var n=Pf[t],r=document.createElement("canvas"),i=e.width/3,a=e.height/2;r.width=i,r.height=a;var o=r.getContext("2d");n[2]&&(o.translate(i,0),o.scale(-1,1)),n[3]&&(o.translate(0,a),o.scale(1,-1)),o.drawImage(e,n[0]*i,n[1]*a,i,a,0,0,i,a),l.images[t]=r,6===++c&&(l.needsUpdate=!0,s&&s(l))}},void 0,n),l},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}});var Rf=["","Memory allocation failed","Memory usage limit reached","Unsupported check; not verifying file integrity","Not an .xz file","Unsupported options in the .xz headers","File is corrupt","Unknown decompression bug"];function Ff(e){this.manager=void 0!==e?e:ic}function Of(e){this.manager=void 0!==e?e:ic,this.type=Oe}function If(e,t){qs.call(this,e,t),this.type="BlenderTextGeometry",this.computeBoundingBox();var n,r,i=this.boundingBox.max.x-this.boundingBox.min.x,a=this.boundingBox.max.y-this.boundingBox.min.y;switch(t.alignX){case"left":n=0;break;case"center":n=-.5*i;break;case"right":n=-i}switch(t.alignY){case"bottom":r=0;break;case"center":r=-.5*a;break;case"top":r=-a}(0<Math.abs(n)||0<Math.abs(r))&&this.translate(n,r,0)}function Df(){this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this.geometry=new Wr,this.widthCallback=null}function Uf(e,t,n,r,i){var a;if(e=e.subarray||e.slice?e:e.buffer,n=n.subarray||n.slice?n:n.buffer,e=t?e.subarray?e.subarray(t,i&&t+i):e.slice(t,i&&t+i):e,n.set)n.set(e,r);else for(a=0;a<e.length;a++)n[a+r]=e[a];return n}function Bf(e){this.headEdge=this.tailEdge=e,this.headIndex=e.index0,this.tailIndex=e.index1,this.indexCount=2}function zf(e,t){this.index0=e,this.index1=t,this.edge0=null,this.edge1=null}function kf(){this.geometry=new Wr}function Gf(e){fl.call(this),this.type="MeshLineMaterial",this.lineWidth=1,this.sizeAttenuation=1,this.color=new Fn(16777215),this.opacity=1,this.useMap=0,this.map=null,this.useAlphaMap=0,this.alphaMap=null,this.resolution=new qt(1,1),this.visibility=1,this.alphaTest=0,this.repeat=new qt(1,1),this.uniforms={lineWidth:{value:1},sizeAttenuation:{value:1},color:{value:new Fn(16777215)},opacity:{value:1},useMap:{value:0},map:{value:null},alphaMap:{value:null},useAlphaMap:{value:0},resolution:{value:new qt(1,1)},visibility:{value:1},alphaTest:{value:0},repeat:{value:new qt(1,1)}},this.vertexShader=Pn.raw_meshline_vert,this.fragmentShader=Pn.raw_meshline_frag,this.setValues(e)}Object.assign(Ff.prototype,{crossOrigin:"Anonymous",load:function(n,r,t,i){void 0===n&&(n=""),void 0!==this.path&&(n=this.path+n);var a=this,e=nc.get(n);if(void 0!==e)return a.manager.itemStart(n),setTimeout(function(){r&&r(e),a.manager.itemEnd(n)},0),e;var o=new XMLHttpRequest;return o.open("GET",n,!0),o.addEventListener("load",function(e){var t=e.target.response;200===this.status||0===this.status?(0===this.status&&console.warn("v3d.XZLoader: HTTP Status 0 received."),a.decompressArrayBuffer(t,function(e){r&&r(e),a.manager.itemEnd(n),nc.add(n,e)},function(e){i&&i(e),a.manager.itemEnd(n),a.manager.itemError(n)})):(i&&i(e),a.manager.itemEnd(n),a.manager.itemError(n))},!1),t&&o.addEventListener("progress",function(e){t(e)},!1),o.addEventListener("error",function(e){i&&i(e),a.manager.itemEnd(n),a.manager.itemError(n)},!1),o.responseType="arraybuffer",o.send(null),a.manager.itemStart(n),o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},decompressArrayBuffer:function(e,l,c){var u=this;function h(e){var t=u._emGetInBufferPtr();yf.HEAPU8.set(e,t),u._emInBufferSetPos(0),u._emInBufferSetSize(e.length),d()}function d(){u._emOutBufferSetPos(0)}var t=u._emInitDecompressor();if(0!=t)return console.error("XZLoader._emInitDecompressor: error code "+t+" ("+Rf[t]+")"),void(c&&c(t));var p=new Uint8Array(e),f=p.length,m=[],v=0,g=Math.min(524288,f),y=0;h(p.subarray(v,g)),function e(){var t,n,r=u._emDecompress();if(r)console.error("XZLoader._emDecompress: error code "+r+" ("+Rf[r]+")"),c&&c(r);else{var i=u._emGetCurrOutputLength();if(m.push((t=i,n=u._emGetOutBufferPtr(),new Uint8Array(yf.HEAPU8.subarray(n,n+t)))),d(),u._emIsInputEndReached()&&(v=g,g=Math.min(g+524288,f),h(p.subarray(v,g))),v==g){var a=m.reduce(function(e,t,n,r){return e+t.length},0),o=new Uint8Array(a),s=0;m.forEach(function(e){o.set(e,s),s+=e.length}),l&&l(o.buffer)}else++y%2==0?setTimeout(e,1):e()}}()},_emInitDecompressor:yf.cwrap("init_decompressor","number"),_emDecompress:yf.cwrap("decompress","number"),_emGetInBufferPtr:yf.cwrap("get_in_buffer_ptr","number"),_emGetOutBufferPtr:yf.cwrap("get_out_buffer_ptr","number"),_emInBufferSetPos:yf.cwrap("in_buffer_set_pos",null,["number"]),_emInBufferSetSize:yf.cwrap("in_buffer_set_size",null,["number"]),_emOutBufferSetPos:yf.cwrap("out_buffer_set_pos",null,["number"]),_emOutBufferSetSize:yf.cwrap("out_buffer_set_size",null,["number"]),_emGetCurrOutputLength:yf.cwrap("get_curr_output_length","number"),_emIsInputEndReached:yf.cwrap("is_input_end_reached","number")}),(Of.prototype=Object.create(lc.prototype))._parser=function(e){var y=function(e,t){switch(e){case 1:console.error("v3d.RGBELoader Read Error: "+(t||""));break;case 2:console.error("v3d.RGBELoader Write Error: "+(t||""));break;case 3:console.error("v3d.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("v3d.RGBELoader: Error: "+(t||""))}return-1},l=function(e,t,n){t=t||1024;for(var r=e.pos,i=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));(i=s.indexOf("\n"))<0&&a<t&&r<e.byteLength;)o+=s,a+=s.length,r+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<i&&(!1!==n&&(e.pos+=a+i+1),o+s.slice(0,i))},t=new Uint8Array(e);t.byteLength;t.pos=0;var n,r,i,a,o,s,c=function(e){var t,n,r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,s={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=l(e)))return y(1,"no header found");if(!(n=t.match(/^#\?(\S+)$/)))return y(3,"bad initial token");for(s.valid|=1,s.programtype=n[1],s.string+=t+"\n";!1!==(t=l(e));)if(s.string+=t+"\n","#"!==t.charAt(0)){if((n=t.match(r))&&(s.gamma=parseFloat(n[1],10)),(n=t.match(i))&&(s.exposure=parseFloat(n[1],10)),(n=t.match(a))&&(s.valid|=2,s.format=n[1]),(n=t.match(o))&&(s.valid|=4,s.height=parseInt(n[1],10),s.width=parseInt(n[2],10)),2&s.valid&&4&s.valid)break}else s.comments+=t+"\n";return 2&s.valid?4&s.valid?s:y(3,"missing image size specifier"):y(3,"missing format specifier")}(t);if(-1!==c){var u=c.width,h=c.height,d=function(e,t,n){var r,i,a,o,s,l,c,u,h,d,p,f,m,v=t,g=n;if(v<8||32767<v||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(v!==(e[2]<<8|e[3]))return y(3,"wrong scanline width");if(!(r=new Uint8Array(4*t*n))||!r.length)return y(4,"unable to allocate buffer space");for(a=i=0,u=4*v,m=new Uint8Array(4),l=new Uint8Array(u);0<g&&a<e.byteLength;){if(a+4>e.byteLength)return y(1);if(m[0]=e[a++],m[1]=e[a++],m[2]=e[a++],m[3]=e[a++],2!=m[0]||2!=m[1]||(m[2]<<8|m[3])!=v)return y(3,"bad rgbe scanline format");for(c=0;c<u&&a<e.byteLength;){if((f=128<(o=e[a++]))&&(o-=128),0===o||u<c+o)return y(3,"bad scanline data");if(f)for(s=e[a++],h=0;h<o;h++)l[c++]=s;else l.set(e.subarray(a,a+o),c),c+=o,a+=o}for(d=v,h=0;h<d;h++)p=0,r[i]=l[h+p],p+=v,r[i+1]=l[h+p],p+=v,r[i+2]=l[h+p],p+=v,r[i+3]=l[h+p],i+=4;g--}return r}(t.subarray(t.pos),u,h);if(-1!==d){if(this.type===Oe)var p=d,f=Ke,m=Oe;else if(this.type===ke){for(var v=d.length/4*3,g=new Float32Array(v),x=0;x<v;x++)i=g,a=3*x,void 0,o=(n=d)[(r=4*x)+3],s=Math.pow(2,o-128)/255,i[a+0]=n[r+0]*s,i[a+1]=n[r+1]*s,i[a+2]=n[r+2]*s;p=g,f=Ye,m=ke}else console.error("v3d.RGBELoader: unsupported type: ",this.type);return{width:u,height:h,data:p,header:c.string,gamma:c.gamma,exposure:c.exposure,format:f,type:m}}}return null},Of.prototype.setType=function(e){return this.type=e,this},Of.prototype.setCrossOrigin=function(e){return this},((If.prototype=Object.create(qs.prototype)).constructor=If).prototype.cloneWithText=function(e){var t=this.parameters.parameters;return new If(e,{font:t.font,size:t.size,height:t.height,curveSegments:t.curveSegments,bevelEnabled:t.bevelEnabled,bevelThickness:t.bevelThickness,bevelSize:t.bevelSize,alignX:t.alignX,alignY:t.alignY})},Df.prototype.setGeometry=function(e,t){if(this.widthCallback=t,this.positions=[],this.counters=[],e instanceof wr)for(var n=0;n<e.vertices.length;n++){var r=e.vertices[n];t=n/e.vertices.length;this.positions.push(r.x,r.y,r.z),this.positions.push(r.x,r.y,r.z),this.counters.push(t),this.counters.push(t)}if(e instanceof Float32Array||e instanceof Array)for(n=0;n<e.length;n+=3){t=n/e.length;this.positions.push(e[n],e[n+1],e[n+2]),this.positions.push(e[n],e[n+1],e[n+2]),this.counters.push(t),this.counters.push(t)}this.process()},Df.prototype.compareV3=function(e,t){var n=6*e,r=6*t;return this.positions[n]===this.positions[r]&&this.positions[n+1]===this.positions[r+1]&&this.positions[n+2]===this.positions[r+2]},Df.prototype.copyV3=function(e){var t=6*e;return[this.positions[t],this.positions[t+1],this.positions[t+2]]},Df.prototype.process=function(){var e,t,n=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];for(var r=0;r<n;r++)this.side.push(1),this.side.push(-1);for(r=0;r<n;r++)e=this.widthCallback?this.widthCallback(r/(n-1)):1,this.width.push(e),this.width.push(e);for(r=0;r<n;r++)this.uvs.push(r/(n-1),0),this.uvs.push(r/(n-1),1);t=this.compareV3(0,n-1)?this.copyV3(n-2):this.copyV3(0),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(r=0;r<n-1;r++)t=this.copyV3(r),this.previous.push(t[0],t[1],t[2]),this.previous.push(t[0],t[1],t[2]);for(r=1;r<n;r++)t=this.copyV3(r),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]);t=this.compareV3(n-1,0)?this.copyV3(1):this.copyV3(n-1),this.next.push(t[0],t[1],t[2]),this.next.push(t[0],t[1],t[2]);for(r=0;r<n-1;r++){var i=2*r;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}this.attributes?(this.attributes.position.copyArray(new Float32Array(this.positions)),this.attributes.position.needsUpdate=!0,this.attributes.previous.copyArray(new Float32Array(this.previous)),this.attributes.previous.needsUpdate=!0,this.attributes.next.copyArray(new Float32Array(this.next)),this.attributes.next.needsUpdate=!0,this.attributes.side.copyArray(new Float32Array(this.side)),this.attributes.side.needsUpdate=!0,this.attributes.width.copyArray(new Float32Array(this.width)),this.attributes.width.needsUpdate=!0,this.attributes.uv.copyArray(new Float32Array(this.uvs)),this.attributes.uv.needsUpdate=!0,this.attributes.counters.copyArray(new Float32Array(this.counters)),this.attributes.counters.needsUpdate=!0,this.attributes.index.copyArray(new Uint16Array(this.indices_array)),this.attributes.index.needsUpdate=!0):this.attributes={position:new Ar(new Float32Array(this.positions),3),previous:new Ar(new Float32Array(this.previous),3),next:new Ar(new Float32Array(this.next),3),side:new Ar(new Float32Array(this.side),1),width:new Ar(new Float32Array(this.width),1),uv:new Ar(new Float32Array(this.uvs),2),counters:new Ar(new Float32Array(this.counters),1),index:new Ar(new Uint16Array(this.indices_array),1)},this.geometry.addAttribute("position",this.attributes.position),this.geometry.addAttribute("previous",this.attributes.previous),this.geometry.addAttribute("next",this.attributes.next),this.geometry.addAttribute("side",this.attributes.side),this.geometry.addAttribute("width",this.attributes.width),this.geometry.addAttribute("uv",this.attributes.uv),this.geometry.addAttribute("counters",this.attributes.counters),this.geometry.setIndex(this.attributes.index)},Df.prototype.advance=function(e){var t=this.attributes.position.array,n=this.attributes.previous.array,r=this.attributes.next.array,i=t.length;Uf(t,0,n,0,i),Uf(t,6,t,0,i-6),t[i-6]=e.x,t[i-5]=e.y,t[i-4]=e.z,t[i-3]=e.x,t[i-2]=e.y,t[i-1]=e.z,Uf(t,6,r,0,i-6),r[i-6]=e.x,r[i-5]=e.y,r[i-4]=e.z,r[i-3]=e.x,r[i-2]=e.y,r[i-1]=e.z,this.attributes.position.needsUpdate=!0,this.attributes.previous.needsUpdate=!0,this.attributes.next.needsUpdate=!0},Object.assign(Bf.prototype,{mergeStrip:function(e){var t=this.headIndex,n=e.headIndex,r=this.tailIndex,i=e.tailIndex;t==n?(this.headEdge.linkToEdge(e.headEdge),e.headEdge.linkToEdge(this.headEdge),this.headEdge=e.tailEdge,this.headIndex=e.tailIndex,this.indexCount+=e.indexCount-1):t==i?(this.headEdge.linkToEdge(e.tailEdge),e.tailEdge.linkToEdge(this.headEdge),this.headEdge=e.headEdge,this.headIndex=e.headIndex,this.indexCount+=e.indexCount-1):r==n?(this.tailEdge.linkToEdge(e.headEdge),e.headEdge.linkToEdge(this.tailEdge),this.tailEdge=e.tailEdge,this.tailIndex=e.tailIndex,this.indexCount+=e.indexCount-1):r==i&&(this.tailEdge.linkToEdge(e.tailEdge),e.tailEdge.linkToEdge(this.tailEdge),this.tailEdge=e.headEdge,this.tailIndex=e.headIndex,this.indexCount+=e.indexCount-1)},getIndicesFlat:function(){for(var e=new Float32Array(this.indexCount),t=0,n=null,r=this.headEdge,i=e[t++]=this.headIndex;null!==r;){i=r.index0==i?r.index1:r.index0;e[t++]=i;var a=r.edge0;a!=n&&null!==a||(a=r.edge1),a==n&&(a=null),n=r,r=a}return e}}),Object.assign(zf.prototype,{linkToEdge:function(e){null===this.edge0?this.edge0=e:null===this.edge1&&(this.edge1=e)}}),Object.assign(kf.prototype,{fromBufferGeometry:function(){function m(e,t,n){var r=e.headIndex,i=e.tailIndex;return t[r][0]||t[i][0]||n[r][0]||n[i][0]||null}return function(e){var r=e.getAttribute("position"),t=e.getIndex();if(void 0!==r){var i=[];if(null!==t){(function(e){for(var t=e.length%2?e.length-1:e.length,n={},r={},i=0;i<t;i+=2){var a=(u=new Bf(new zf(e[i],e[i+1]))).headIndex,o=u.tailIndex;n[a]=n[a]||[],n[o]=n[o]||[],r[a]=r[a]||[],r[o]=r[o]||[],n[a].push(u),r[o].push(u)}var s=new Ml.LinkMap;for(var l in n)n[l].length&&s.push(new Ml.LinkMapNode(n[l]),l);for(var c=[],u=s.first&&s.first.value[0];u;){n[a=u.headIndex].splice(n[a].indexOf(u),1),r[o=u.tailIndex].splice(r[o].indexOf(u),1),0==n[a].length&&s.removeNodeByKey(a);for(var h=m(u,n,r);null!==h;)n[a=h.headIndex].splice(n[a].indexOf(h),1),r[o=h.tailIndex].splice(r[o].indexOf(h),1),0==n[a].length&&s.removeNodeByKey(a),u.mergeStrip(h),h=m(u,n,r);c.push(u),u=s.first&&s.first.value[0]}return c})(t.array).forEach(function(e){var t=new Df,n=new Float32Array(3*e.indexCount);e.getIndicesFlat().forEach(function(e,t){n.set(r.array.subarray(3*e,3*e+3),3*t)}),t.setGeometry(n),i.push(t)})}else{var n=new Df;n.setGeometry(r.array),i.push(n)}var a=[],o=[],s=[],l=[],c=[],u=[],h=[],d=[],p=0;i.forEach(function(e){a.push.apply(a,e.positions),o.push.apply(o,e.previous),s.push.apply(s,e.next),l.push.apply(l,e.side),c.push.apply(c,e.width),u.push.apply(u,e.uvs),h.push.apply(h,e.counters);var t=e.indices_array.map(function(e){return e+p});d.push.apply(d,t),p+=e.positions.length/3}),this.geometry.addAttribute("position",new Ar(new Float32Array(a),3)),this.geometry.addAttribute("previous",new Ar(new Float32Array(o),3)),this.geometry.addAttribute("next",new Ar(new Float32Array(s),3)),this.geometry.addAttribute("side",new Ar(new Float32Array(l),1)),this.geometry.addAttribute("width",new Ar(new Float32Array(c),1)),this.geometry.addAttribute("uv",new Ar(new Float32Array(u),2)),this.geometry.addAttribute("counters",new Ar(new Float32Array(h),1));var f=65535<Vn(d)?Uint32Array:Uint16Array;this.geometry.setIndex(new Ar(new f(d),1))}}}()}),Gf.prototype=Object.assign(Object.create(fl.prototype),{constructor:Gf,isMeshLineMaterial:!0,copy:function(e){return fl.prototype.copy.call(this,e),this.lineWidth=e.lineWidth,this.sizeAttenuation=e.sizeAttenuation,this.color.copy(e.color),this.opacity=e.opacity,this.useMap=e.useMap,this.map=e.map,this.useAlphaMap=e.useAlphaMap,this.alphaMap=e.alphaMap,this.resolution.copy(e.resolution),this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}});var Vf=["TEXTURE","TEX_IMAGE","TEX_ENVIRONMENT","TEX_ENVIRONMENT_MAX","BITMAP_MAX","BITMAP_ENV_MAX","REFLECT_REFRACT_MAX"];function jf(e){this.manager=void 0!==e?e:ic,this.crossOrigin="Anonymous",this.onProgress=null}function Xf(){var n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}Object.assign(jf.prototype,{load:function(e,t,n,r){var i=this;i.onProgress=n||function(){};var a=this.path&&"string"==typeof this.path?this.path:lu.extractUrlBase(e),o=-1!=e.indexOf(".xz",e.length-3);if(o)var s=new Ff(i.manager);else(s=new oc(i.manager)).setResponseType("arraybuffer");s.load(e,function(e){i.parse(e,a,t,r,o)},function(e){if(e.lengthComputable)var t=e.loaded/e.total*100;else t=100;i.onProgress(.3*t)},r)},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e},parse:function(e,t,s,n,r){var i,l=this,a={};i=xm(new Uint8Array(e,0,4))===qf?(a[Wf.KHR_BINARY_GLTF]=new Kf(e),a[Wf.KHR_BINARY_GLTF].content):xm(new Uint8Array(e));var o=JSON.parse(i);void 0===o.asset||o.asset.version[0]<2?n(new Error("v3d.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")):(o.extensionsUsed&&(0<=o.extensionsUsed.indexOf(Wf.S8S_V3D_DATA)&&(a[Wf.S8S_V3D_DATA]=new Hf(o)),0<=o.extensionsUsed.indexOf(Wf.S8S_V3D_MATERIAL_DATA)&&(a[Wf.S8S_V3D_MATERIAL_DATA]=new Yf(o))),new bm(o,a,{path:t||this.path,crossOrigin:this.crossOrigin,loadBinXZ:r,onProgress:function(e){l.onProgress(e)}}).parse(function(e,t,n,r,i,a){var o={scene:e,scenes:t,world:n,cameras:r,animations:i,renderer:a};l.onProgress(100),s(o)},n))}});var Wf={KHR_BINARY_GLTF:"KHR_binary_glTF",S8S_V3D_ANIMATION_DATA:"S8S_v3d_animation_data",S8S_V3D_DATA:"S8S_v3d_data",S8S_V3D_CAMERA_DATA:"S8S_v3d_camera_data",S8S_V3D_MATERIAL_DATA:"S8S_v3d_material_data",S8S_V3D_MESH_DATA:"S8S_v3d_mesh_data",S8S_V3D_NODE_DATA:"S8S_v3d_node_data",S8S_V3D_SCENE_DATA:"S8S_v3d_scene_data",S8S_V3D_TEXTURE_DATA:"S8S_v3d_texture_data"};function Hf(e){this.name=Wf.S8S_V3D_DATA;var t=e.extensions&&e.extensions[Wf.S8S_V3D_DATA]||{};this.lights={};var n=t.lights||{};for(var r in n){var i,a=n[r],o=(new Fn).fromArray(a.color),s=jn(a.intensity)?a.intensity:1;switch(a.type){case"point":i=new jc(o,s);break;case"directional":i=new Wc(o,s);break;case"spot":i=new Vc(o,s);break;case"hemisphere":i=new zc(o,new Fn(0,0,0),s);break;case"ambient":i=new Hc(o,s)}if(i){if(jn(a.distance)&&(i.distance=a.distance),jn(a.decay)&&(i.decay=a.decay,"blender"==a.profile&&2<=a.decay&&(i.intensity/=4*Math.PI)),jn(a.angle)&&(i.angle=a.angle),jn(a.penumbra)&&(i.penumbra=a.penumbra),jn(a.shadow)){if(i.castShadow=!0,i.shadow.bias=a.shadow.bias,i.shadow.radius=a.shadow.radius,i.shadow.mapSize.width=a.shadow.mapSize,i.shadow.mapSize.height=a.shadow.mapSize,i.shadow.camera.near=a.shadow.cameraNear,i.shadow.camera.far=a.shadow.cameraFar,i.isSpotLight)i.shadow.camera.fov=a.shadow.cameraFov;else if(i.isDirectionalLight){var l=a.shadow.cameraSize/2;i.shadow.camera.bottom=-l,i.shadow.camera.left=-l,i.shadow.camera.top=l,i.shadow.camera.right=l}}else i.castShadow=!1;i.name=a.name||"light_"+r,this.lights[r]=i}}this.nodeGraphs={};var c=t.nodeGraphs||[];for(var u in c){var h=c[u];this.nodeGraphs[u]=h}}function Yf(e){this.name=Wf.S8S_V3D_MATERIAL_DATA}Hf.prototype.loadCurves=function(e,t){var n=e.extensions&&e.extensions[Wf.S8S_V3D_DATA]||{};this.curves={};var r=n.curves||{};for(var i in r){var a,o=r[i];switch(o.type){case"font":var s=new Mu(o.font),l=0<o.bevelSize||0<o.bevelThickness,c=new If(o.text,{font:s,size:o.size,height:o.height,curveSegments:o.curveSegments,bevelEnabled:l,bevelThickness:o.bevelThickness,bevelSize:o.bevelSize,bevelSegments:o.bevelSegments,alignX:o.alignX,alignY:o.alignY});if(t&&t[o.material])var u=t[o.material];else u=new gl({color:new Fn(.8,.8,.8)});a=new Ei(c,u)}a&&(a.name=o.name||"curve_"+i,this.curves[i]=a)}},Yf.prototype.extendParams=function(e,t,n){var r=t.extensions[this.name],i=[];if(jn(r.nodeGraph)){var a=r.nodeGraph;e.nodeGraph=$l.nodeGraphFromGLTF(a);for(var o=0;o<a.nodes.length;o++){var s=a.nodes[o];if(-1<Vf.indexOf(s.type)){var l=$l.nodeTexUniName(s.type,s.texture);i.push(n.assignTextureNode(e,l,s.texture))}}var c=n.extensions[Wf.S8S_V3D_DATA];if(c)for(var u in e.additionalNodeGraphs={},c.nodeGraphs){a=c.nodeGraphs[u];e.additionalNodeGraphs[u]=$l.nodeGraphFromGLTF(a);for(o=0;o<a.nodes.length;o++){s=a.nodes[o];if(-1<Vf.indexOf(s.type)){l=$l.nodeTexUniName(s.type,s.texture);i.push(n.assignTextureNode(e,l,s.texture))}}}jn(r.profile)&&(e.profile=r.profile)}return jn(r.depthWrite)&&(e.depthWrite=r.depthWrite),jn(r.dithering)&&(e.dithering=r.dithering),Promise.all(i)};var qf="glTF",Qf=12,Zf={JSON:1313821514,BIN:5130562};function Kf(e){this.name=Wf.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,Qf);if(this.header={magic:xm(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==qf)throw new Error("v3d.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("v3d.GLTFLoader: Legacy binary file detected. Use GLTFLoader instead.");for(var n=new DataView(e,Qf),r=0;r<n.byteLength;){var i=n.getUint32(r,!0);r+=4;var a=n.getUint32(r,!0);if(r+=4,a===Zf.JSON){var o=new Uint8Array(e,Qf+r,i);this.content=xm(o)}else if(a===Zf.BIN){var s=Qf+r;this.body=e.slice(s,s+i)}r+=i}if(null===this.content)throw new Error("v3d.GLTFLoader: JSON content not found.")}var Jf=0,$f=1,em=2,tm=3,nm=4,rm=5,im=6,am={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},om={9728:Le,9729:Ne,9984:Ce,9985:Re,9986:Pe,9987:Fe},sm={33071:Se,33648:Ee,10497:we},lm={6406:He,6407:Ye,6408:qe,6409:Qe,6410:Ze},cm={5121:Oe,32819:Ve,32820:je,33635:Xe},um={32774:te,32778:T,32779:S},hm={0:C,1:P,768:N,769:R,770:F,771:O,772:D,773:U,774:B,775:z,776:k},dm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pm={CATMULLROMSPLINE:St,CUBICSPLINE:St,LINEAR:Tt,STEP:Mt},fm="OPAQUE",mm="MASK",vm={FRONT:I,BACK:Me,DOUBLE:ne};function gm(e,t,n){if(!e)return Promise.resolve();var r,i=[];if("[object Array]"===Object.prototype.toString.call(e)){r=[];for(var a=e.length,o=0;o<a;o++){(l=t.call(n||this,e[o],o))&&(i.push(l),l instanceof Promise?l.then(function(e,t){r[e]=t}.bind(this,o)):r[o]=l)}}else for(var s in r={},e){var l;if(e.hasOwnProperty(s))(l=t.call(n||this,e[s],s))&&(i.push(l),l instanceof Promise?l.then(function(e,t){r[e]=t}.bind(this,s)):r[s]=l)}return Promise.all(i).then(function(){return r})}function ym(e,t){return"string"!=typeof e||""===e?"":/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:(t||"")+e}function xm(e){if(void 0!==window.TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);return t}function _m(e,t,n,r){var i=e.geometry,a=e.material,o=n.targets,s=i.morphAttributes;s.position=[],s.normal=[],a.morphTargets=!0;for(var l=0,c=o.length;l<c;l++){var u,h,d=o[l],p="morphTarget"+l;if(void 0!==d.POSITION){u=r.accessors[d.POSITION].clone();for(var f=i.attributes.position,m=0,v=u.count;m<v;m++)u.setXYZ(m,u.getX(m)+f.getX(m),u.getY(m)+f.getY(m),u.getZ(m)+f.getZ(m))}else u=i.attributes.position.clone();if(void 0!==d.NORMAL){a.morphNormals=!0,h=r.accessors[d.NORMAL].clone();var g=i.attributes.normal;for(m=0,v=h.count;m<v;m++)h.setXYZ(m,h.getX(m)+g.getX(m),h.getY(m)+g.getY(m),h.getZ(m)+g.getZ(m))}else h=i.attributes.normal.clone();d.TANGENT,u.name=p,h.name=p,s.position.push(u),s.normal.push(h)}if(e.updateMorphTargets(),void 0!==t.weights)for(l=0,c=t.weights.length;l<c;l++)e.morphTargetInfluences[l]=t.weights[l]}function bm(e,t,n){this.json=e||{},this.extensions=t||{},this.options=n||{},this.onProgress=n.onProgress||function(){},this.cache=new Xf}function wm(){Af.call(this,Un.grayscale)}function Am(e,t,n,r){this.renderScene=t,this.renderCamera=n,this.selectedObjects=void 0!==r?r:[],this.visibleEdgeColor=new Fn(1,1,1),this.hiddenEdgeColor=new Fn(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this.renderToScreen=!1,_f.call(this),this.resolution=void 0!==e?new qt(e.x,e.y):new qt(256,256);var i={minFilter:Ne,magFilter:Ne,format:qe},a=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new _n(this.resolution.x,this.resolution.y,i),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.renderTargetDepthBuffer=new _n(this.resolution.x,this.resolution.y,i),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new _n(a,o,i),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new _n(a,o,i),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new _n(Math.round(a/2),Math.round(o/2),i),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new _n(a,o,i),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new _n(Math.round(a/2),Math.round(o/2),i),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value=new qt(a,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value=new qt(Math.round(a/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial();var s=Un.copy;this.copyUniforms=Nn.clone(s.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Mi({defines:s.defines,uniforms:this.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:Q,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new Fn,this.oldClearAlpha=1,this.camera=new dr(-1,1,1,-1,0,1),this.scene=new Do,this.quad=new Ei(new Qr(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad),this.tempPulseColor1=new Fn,this.tempPulseColor2=new Fn,this.textureMatrix=new Qt,this._MorphingFlag=1,this._SkinningFlag=2,this._NumberOfMaterialVariants=1+(this._MorphingFlag|this._SkinningFlag),this._depthMaterials=new Array(this._NumberOfMaterialVariants),this._maskMaterials=new Array(this._NumberOfMaterialVariants);for(var l=0;l!==this._NumberOfMaterialVariants;++l){var c=0!=(l&this._MorphingFlag),u=0!=(l&this._SkinningFlag),h=new $a({blending:Q,depthPacking:Gt,side:ne,morphTargets:c,skinning:u});this._depthMaterials[l]=h;var d=new Al({side:ne,morphTargets:c,skinning:u});this._maskMaterials[l]=d}}function Mm(e,t,n,r,i){_f.call(this),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1}function Tm(e,t){var n=(this.sourceTexture=e).image.width,r=e.image.height,i={format:Ye,magFilter:Ne,minFilter:Fe,type:t,generateMipmaps:!0,anisotropy:e.anisotropy,encoding:Ft};this.renderTarget=new _n(n,r,i),this.renderTarget.texture.name=e.name,this.renderTarget.texture.flipY=e.flipY,this.camera=new dr(-1,1,1,-1,0,1e3),this.shader=new Mi({type:"RGBEToFloat",uniforms:Nn.clone(Un.copy.uniforms),vertexShader:Un.copy.vertexShader,fragmentShader:Un.copy.fragmentShader,defines:{MAP_TEXELS:1}}),this.planeMesh=new Ei(new Qr(2,2,0),this.shader),this.planeMesh.material.side=ne,this.planeMesh.material.map=e,this.scene=new Do,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.shader.uniforms.tDiffuse.value=e,this.shader.uniforms.opacity.value=1}bm.prototype._withDependencies=function(e){for(var t={},n=0;n<e.length;n++){var r=e[n],i="load"+r.charAt(0).toUpperCase()+r.slice(1),a=this.cache.get(r);if(void 0!==a)t[r]=a;else if(this[i]){var o=this[i]();this.cache.add(r,o),t[r]=o}}return gm(t,function(e){return e})},bm.prototype.parse=function(f,e){var m=this,v=this.json;this.cache.removeAll(),this._withDependencies(["scenes","materials","cameras","animations"]).then(function(e){var t=[];e.scenes=e.scenes||[];for(var n=0;n<e.scenes.length;n++)t.push(e.scenes[n]);var r=jn(v.scene)?v.scenes[v.scene]:v.scenes[0],i=jn(v.scene)?e.scenes[v.scene]:t[0],a={};r&&((h=m.getExt(r,Wf.S8S_V3D_SCENE_DATA))&&(jn(h.worldMaterial)?a.material=e.materials[h.worldMaterial]:jn(h.horizonColor)&&(a.material=new $l({color:(new Fn).fromArray(h.horizonColor)}))));var o=[];e.cameras=e.cameras||[];for(n=0;n<e.cameras.length;n++){var s=e.cameras[n],l=!1;s.traverseAncestors(function(e){e==i&&(l=!0)}),l&&o.push(s)}var c=[];e.animations=e.animations||[];for(n=0;n<e.animations.length;n++){var u=e.animations[n];u.clip&&void 0!==u.clip.name&&(u.clip.name=u.clip.name),c.push(u)}var h,d={};if(r&&(h=m.getExt(r,Wf.S8S_V3D_SCENE_DATA))){if(jn(h.shadowMap)){switch(d.shadowMap={enabled:!0},h.shadowMap.type){case"BASIC":d.shadowMap.type=0;break;case"PCF":d.shadowMap.type=G;break;case"PCFSOFT":d.shadowMap.type=V}e.materials=e.materials||[];for(n=0;n<e.materials.length;n++){var p=e.materials[n];h.shadowMap.renderSingleSided?h.shadowMap.renderReverseSided?p.shadowSide=Me:p.shadowSide=I:p.shadowSide=ne}}if(jn(h.physicallyCorrectLights)&&(d.physicallyCorrectLights=h.physicallyCorrectLights),jn(h.useHDR)&&(d.useHDR=h.useHDR),jn(h.unitsScaleFactor)?d.unitsScaleFactor=h.unitsScaleFactor:d.unitsScaleFactor=1,jn(h.toneMapping))switch(h.toneMapping.type){case"logarithmic":d.toneMapping=Wt,d.toneMappingExposure=h.toneMapping.exposure}}f(i,t,a,o,c,d)}).catch(e)},bm.prototype.getDependency=function(e,t){var n=e+":"+t,r=this.cache.get(n);r||(r=this["load"+e.charAt(0).toUpperCase()+e.slice(1)](t),this.cache.add(n,r));return r},bm.prototype.loadBuffer=function(e){var r=this,i=this.json.buffers[e];if(i.type&&"arraybuffer"!==i.type)throw new Error("v3d.GLTFLoader: %s buffer type is not supported.",i.type);if(void 0===i.uri&&0===e)return Promise.resolve(this.extensions[Wf.KHR_BINARY_GLTF].body);var a=this.options;return new Promise(function(e){if(a.loadBinXZ)var t=ym(i.uri,a.path)+".xz",n=new Ff;else{t=ym(i.uri,a.path);(n=new oc).setResponseType("arraybuffer")}n.load(t,e,function(e){if(e.lengthComputable)var t=e.loaded/e.total*100;else t=100;r.onProgress(30+.7*t)})})},bm.prototype.loadBufferView=function(e){var r=this.json.bufferViews[e];return this.getDependency("buffer",r.buffer).then(function(e){var t=r.byteLength||0,n=r.byteOffset||0;return e.slice(n,n+t)})},bm.prototype.loadAccessors=function(){var e=this,s=this.json;return gm(s.accessors,function(o){return e.getDependency("bufferView",o.bufferView).then(function(e){var t=dm[o.type],n=am[o.componentType],r=n.BYTES_PER_ELEMENT,i=r*t,a=s.bufferViews[o.bufferView].byteStride;return a&&a!==i?new Bo(new Uo(new n(e),a/r),t,o.byteOffset/r):new Ar(new n(e,o.byteOffset,o.count*t),t)})})},bm.prototype.loadTexture=function(e){var n=this.json,a=this.options,r=(this.extensions,window.URL||window.webkitURL),i=n.textures[e],o=n.images[i.source],s=o.uri,l=!1,c=this.getExt(i,Wf.S8S_V3D_TEXTURE_DATA);if(c)var t=!!c.isCubeTexture,u="linear"==c.colorSpace||"non-color"==c.colorSpace?Ft:Ot;else t=!1,u=Ot;return void 0!==o.bufferView&&(s=this.getDependency("bufferView",o.bufferView).then(function(e){l=!0;var t=new Blob([e],{type:o.mimeType});return s=r.createObjectURL(t)})),Promise.resolve(s).then(function(r){"hdr"!=r.split(".").pop()&&"image/vnd.radiance"!=o.mimeType||(u=Dt);var i=mu.Handlers.get(r);return i||(i=u==Dt?new Of:t?new Nf:new hc),i.setCrossOrigin(a.crossOrigin),new Promise(function(e,t){var n=i.load(ym(r,a.path),e,void 0,function(e){t(n)})}).then(function(e){return e},function(e){return e.isCubeTexture&&(e.images=new Array(6).fill(document.createElement("img"))),e})}).then(function(e){!0===l&&r.revokeObjectURL(s),e.flipY=!1,void 0!==i.name&&(e.name=i.name),e.format=void 0!==i.format?lm[i.format]:qe,void 0!==i.internalFormat&&e.format!==lm[i.internalFormat]&&console.warn("v3d.GLTFLoader: Three.js does not support texture internalFormat which is different from texture format. internalFormat will be forced to be the same value as format."),e.type=void 0!==i.type?cm[i.type]:Oe;var t=(n.samplers||{})[i.sampler]||{};return e.magFilter=om[t.magFilter]||Ne,e.minFilter=om[t.minFilter]||Fe,e.wrapS=sm[t.wrapS]||we,e.wrapT=sm[t.wrapT]||we,(e.encoding=u)==Dt&&(e.minFilter=Ne,e.magFilter=Ne),c&&(jn(c.anisotropy)&&(e.anisotropy=c.anisotropy),jn(c.uvTransform)&&(e.matrix=(new Jt).fromArray(c.uvTransform),e.matrixAutoUpdate=!1)),e})},bm.prototype.assignTexture=function(t,n,e){return this.getDependency("texture",e).then(function(e){t[n]=e})},bm.prototype.assignTextureNode=function(t,n,e){return this.getDependency("texture",e).then(function(e){t.nodeTextures=t.nodeTextures||{},t.nodeTextures[n]=e})},bm.prototype.loadMaterials=function(){var p=this,e=this.json,f=this.extensions;return gm(e.materials,function(t){var n,r={},e=[],i=p.getExt(t,Wf.S8S_V3D_MATERIAL_DATA);if(jn(t.pbrMetallicRoughness)){n=ml;var a=t.pbrMetallicRoughness;if(r.color=new Fn(1,1,1),r.opacity=1,Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;r.color.fromArray(o),r.opacity=o[3]}if(void 0!==a.baseColorTexture&&e.push(p.assignTexture(r,"map",a.baseColorTexture.index)),r.metalness=void 0!==a.metallicFactor?a.metallicFactor:1,r.roughness=void 0!==a.roughnessFactor?a.roughnessFactor:1,void 0!==a.metallicRoughnessTexture){var s=a.metallicRoughnessTexture.index;e.push(p.assignTexture(r,"metalnessMap",s)),e.push(p.assignTexture(r,"roughnessMap",s))}}else if(i){var l=f[Wf.S8S_V3D_MATERIAL_DATA];n=$l,e.push(l.extendParams(r,t,p))}else n=gl;!0===t.doubleSided&&(r.side=ne),i&&(jn(i.renderSide)&&(r.side=vm[i.renderSide]),jn(i.useShadows)&&(r.receiveShadow=i.useShadows),jn(i.useCastShadows)&&(r.castShadow=i.useCastShadows));var c=t.alphaMode||fm,u=c!==fm,h=c===mm;if(r.premultipliedAlpha=u,r.transparent=u,r.alphaTest=h?jn(t.alphaCutoff)?t.alphaCutoff:.5:0,u)if(i&&jn(i.blendMode)){var d=i.blendMode;r.blending=ee,jn(d.blendEquation)&&(r.blendEquation=um[d.blendEquation]),jn(d.blendEquationAlpha)&&(r.blendEquationAlpha=um[d.blendEquationAlpha]),jn(d.srcRGB)&&(r.blendSrc=hm[d.srcRGB]),jn(d.dstRGB)&&(r.blendDst=hm[d.dstRGB]),jn(d.srcAlpha)&&(r.blendSrcAlpha=hm[d.srcAlpha]),jn(d.dstAlpha)&&(r.blendDstAlpha=hm[d.dstAlpha])}else r.blending=ee,r.blendEquation=te,r.blendSrc=P,r.blendDst=O;return void 0!==t.normalTexture&&(e.push(p.assignTexture(r,"normalMap",t.normalTexture.index)),r.normalScale=new qt(1,1),void 0!==t.normalTexture.scale&&r.normalScale.set(t.normalTexture.scale,t.normalTexture.scale)),void 0!==t.occlusionTexture&&(e.push(p.assignTexture(r,"aoMap",t.occlusionTexture.index)),void 0!==t.occlusionTexture.strength&&(r.aoMapIntensity=t.occlusionTexture.strength)),void 0!==t.emissiveFactor&&(n===Ai?r.color=(new Fn).fromArray(t.emissiveFactor):n!==$l&&(r.emissive=(new Fn).fromArray(t.emissiveFactor))),void 0!==t.emissiveTexture&&(n===Ai?e.push(p.assignTexture(r,"map",t.emissiveTexture.index)):e.push(p.assignTexture(r,"emissiveMap",t.emissiveTexture.index))),Promise.all(e).then(function(){var e=new n(r);return void 0!==t.name&&(e.name=t.name),e.normalScale&&(i&&jn(i.profile)&&"max"==i.profile||(e.normalScale.y=-e.normalScale.y)),e.map&&(e.map.encoding=Ot),e.emissiveMap&&(e.emissiveMap.encoding=Ot),e.metalnessMap&&(e.metalnessMap.encoding=Ft),e.roughnessMap&&(e.roughnessMap.encoding=Ft),t.extras&&(e.userData.v3d=t.extras),(t.pbrMetallicRoughness||e.isMeshNodeMaterial)&&e.envMap&&(e.envMap.mapping=ge,e.envMap.flipY=!0),e})})},bm.prototype.loadGeometries=function(e){var s=this;return this._withDependencies(["accessors"]).then(function(o){return gm(e,function(e){var t=new Wr,n=e.attributes;for(var r in n){var i=n[r];if(void 0===i)return;var a=o.accessors[i];switch(r){case"POSITION":t.addAttribute("position",a);break;case"NORMAL":t.addAttribute("normal",a);break;case"TEXCOORD_0":case"TEXCOORD0":case"TEXCOORD":t.addAttribute("uv",a);break;case"COLOR_0":case"COLOR0":case"COLOR":t.addAttribute("color",a);break;case"WEIGHTS_0":case"WEIGHT":t.addAttribute("skinWeight",a);break;case"JOINTS_0":case"JOINT":t.addAttribute("skinIndex",a);break;case"TANGENT":t.addAttribute("tangent",a);break;default:-1<r.indexOf("TEXCOORD_")&&t.addAttribute(s.texcoordToAttrName(r),a),-1<r.indexOf("COLOR_")&&t.addAttribute(s.colorToAttrName(r),a)}}return void 0!==e.indices&&t.setIndex(o.accessors[e.indices]),t})})},bm.prototype.loadMeshes=function(){var y=this,e=this.json;return this._withDependencies(["accessors","materials"]).then(function(g){return gm(e.meshes,function(d,p){var f=new ao,m=d.primitives||[],v=y.getExt(d,Wf.S8S_V3D_MESH_DATA);return y.loadGeometries(m).then(function(e){for(var t=0;t<m.length;t++){var n=m[t],r=e[t],i=void 0===n.material?new ml({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:I,receiveShadow:!0,castShadow:!0}):g.materials[n.material];if(i.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.addAttribute("uv2",new Ar(r.attributes.uv.array,2)),jn(r.attributes.color)&&!i.isMeshNodeMaterial)var a=!0;else a=!1;var o,s=void 0===r.attributes.normal,l=i.isMeshNodeMaterial&&(i.nodeValue.length||i.nodeRGB.length);if((a||s||l)&&(i=i.clone()),i.isMeshNodeMaterial&&v){if(v.uvLayers)for(var c in v.uvLayers)i.nodeUVAliases[c]=y.texcoordToAttrName(v.uvLayers[c]);if(v.colorLayers)for(var c in v.colorLayers)i.nodeVCAliases[c]=y.colorToAttrName(v.colorLayers[c]);i.updateNodeGraph()}if(a&&(i.vertexColors=M,i.needsUpdate=!0),s&&(i.flatShading=!0),n.mode===nm||void 0===n.mode)o=new Ei(r,i);else if(n.mode===rm)(o=new Ei(r,i)).drawMode=Nt;else if(n.mode===im)(o=new Ei(r,i)).drawMode=Rt;else if(n.mode===$f)if(v){var u=new kf;u.fromBufferGeometry(r);var h=new Gf({color:jn(v.lineColor)?(new Fn).fromArray(v.lineColor):new Fn(1,1,1),lineWidth:jn(v.lineWidth)?v.lineWidth:1,sizeAttenuation:0});o=new Ei(u.geometry,h)}else o=new Yo(r,i);else if(n.mode===tm)o=new Ho(r,i);else if(n.mode===em)o=new qo(r,i);else{if(n.mode!==Jf)throw new Error("v3d.GLTFLoader: Primitive mode unsupported: ",n.mode);o=new Zo(r,i)}if(o.name=d.name||"mesh_"+p,void 0!==n.targets&&_m(o,d,n,g),!(1<m.length))return o;o.name+="_"+t,o.isMaterialGeneratedMesh=!0,f.add(o)}return f})})})},bm.prototype.loadCameras=function(){var e=this.json,o=this;return gm(e.cameras,function(e){var t,n=e[e.type];if(n){if("perspective"===e.type){var r=n.aspectRatio||1,i=n.yfov;t=new oo(Yt.radToDeg(i),r,n.znear||1,n.zfar||2e6)}else"orthographic"===e.type&&(t=new dr(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar));jn(e.name)||(t.name=e.name);var a=o.getExt(e,Wf.S8S_V3D_CAMERA_DATA);if(a){if(t.controls={},t.controls.type=a.controls,t.viewportFit.type=3,jn(a.viewportFitType))switch(a.viewportFitType){case"VERTICAL":t.viewportFit.type=1;break;case"HORIZONTAL":t.viewportFit.type=2;break;case"AUTO":t.viewportFit.type=3}jn(a.viewportFitInitialAspect)&&(t.viewportFit.initialAspect=a.viewportFitInitialAspect),jn(a.enablePan)?t.controls.enablePan=a.enablePan:t.controls.enablePan=!0,jn(a.rotateSpeed)?t.controls.rotateSpeed=a.rotateSpeed:t.controls.rotateSpeed=1,jn(a.moveSpeed)?t.controls.moveSpeed=a.moveSpeed:t.controls.moveSpeed=1,jn(a.orbitMinDistance)&&(t.controls.orbitMinDistance=a.orbitMinDistance),jn(a.orbitMaxDistance)&&(t.controls.orbitMaxDistance=a.orbitMaxDistance),jn(a.orbitMinPolarAngle)&&(t.controls.orbitMinPolarAngle=a.orbitMinPolarAngle),jn(a.orbitMaxPolarAngle)&&(t.controls.orbitMaxPolarAngle=a.orbitMaxPolarAngle),jn(a.orbitMinAzimuthAngle)?t.controls.orbitMinAzimuthAngle=a.orbitMinAzimuthAngle:t.controls.orbitMinAzimuthAngle=-1/0,jn(a.orbitMaxAzimuthAngle)?t.controls.orbitMaxAzimuthAngle=a.orbitMaxAzimuthAngle:t.controls.orbitMaxAzimuthAngle=1/0,jn(a.orbitTarget)&&(t.controls.orbitTarget=new Kt,t.controls.orbitTarget.fromArray(a.orbitTarget))}return e.extras&&(t.userData.v3d=e.extras),t}console.warn("v3d.GLTFLoader: Missing camera parameters.")})},bm.prototype.loadSkins=function(){var e=this.json;return this._withDependencies(["accessors"]).then(function(t){return gm(e.skins,function(e){return{joints:e.joints,inverseBindMatrices:t.accessors[e.inverseBindMatrices]}})})},bm.prototype.loadAnimations=function(){var N=this,e=this.json;return this._withDependencies(["accessors","nodes"]).then(function(P){return gm(e.animations,function(e,t){for(var n=[],r=-1,i=0;i<e.channels.length;i++){var a=e.channels[i],o=e.samplers[a.sampler];if(o&&-1<o.input&&-1<o.output){var s=a.target,l=void 0!==s.node?s.node:s.id,c=void 0!==e.parameters?e.parameters[o.input]:o.input,u=void 0!==e.parameters?e.parameters[o.output]:o.output,h=P.accessors[c];if(h.count<=1)continue;var d=P.accessors[u],p=P.nodes[l];if(p){var f;r=p.id,p.updateMatrix(),p.matrixAutoUpdate=!0;var m="";switch(s.path){case"weights":f=eu,m="morphTargetInfluences";break;case"rotation":f=nu,m="quaternion";break;case"translation":f=iu,m="position";break;case"scale":f=iu,m="scale";break;case"intensity":f=eu,m="intensity";break;default:if(f=iu,-1<s.path.indexOf("nodeValue"))m="material.nodeValue["+s.path.match(/".*"/g)[0]+"]";else if(-1<s.path.indexOf("nodeRGB")){m="material.nodeRGB["+s.path.match(/".*"/g)[0]+"]"}}var v=p.name?p.name:p.uuid;"CATMULLROMSPLINE"==o.interpolation&&console.warn("v3d.GLTFLoader: CATMULLROMSPLINE interpolation is not supported. Using CUBICSPLINE instead.");var g=jn(o.interpolation)?pm[o.interpolation]:Tt,y=[];"weights"==s.path?p.traverse(function(e){e.isMesh&&e.material.morphTargets&&y.push(e.name?e.name:e.uuid)}):-1<s.path.indexOf("material")?p.traverse(function(e){e.isMesh&&e.material.isMeshNodeMaterial&&y.push(e.name?e.name:e.uuid)}):y.push(v);for(var x=0,_=y.length;x<_;x++){var b=qc.arraySlice(h.array,0),w=qc.arraySlice(d.array,0);if(g==St){for(var A=new w.constructor(w.length/3),M=A.length/b.length,T=0;T<A.length/M;T++)for(var S=0;S<M;S++)A[M*T+S]=w[3*M*T+M+S];g=Tt,w=A}n.push(new f(y[x]+"."+m,b,w,g))}}}}var E={clip:new au(l=jn(e.name)?e.name:"animation_"+t,void 0,n),nodeId:r,auto:!0,loop:2201,repetitions:1/0,startAt:0},L=N.getExt(e,Wf.S8S_V3D_ANIMATION_DATA);if(L){E.auto=L.auto;var C=L.repeatInfinite?1/0:L.repeatCount;switch(L.loop){case"ONCE":E.loop=2200;break;case"REPEAT":E.loop=2201,E.repetitions=C;break;case"PING_PONG":E.loop=2202,E.repetitions=C}E.startAt=L.offset}return E})})},bm.prototype.loadNodes=function(){var _=this.json,b=this,t=_.nodes||[],e=_.skins||[],r={},i={};for(var n in e.forEach(function(e){e.joints.forEach(function(e){t[e].isBone=!0})}),t){var a=t[n];jn(a.mesh)&&(jn(r[a.mesh])||(r[a.mesh]=i[a.mesh]=0),r[a.mesh]++)}return b._withDependencies(["materials","meshes","skins","cameras"]).then(function(x){var e=b.getExt(b,Wf.S8S_V3D_DATA);return e&&e.loadCurves(_,x.materials),gm(_.nodes,function(e){var t=b.getExt(e,Wf.S8S_V3D_NODE_DATA);if(!0===e.isBone)return new jo;if(void 0===e.mesh)return void 0!==e.camera?x.cameras[e.camera]:t&&jn(t.curve)?b.getExt(b,Wf.S8S_V3D_DATA).curves[t.curve]:t&&jn(t.light)?b.getExt(b,Wf.S8S_V3D_DATA).lights[t.light].clone():new ur;var n=x.meshes[e.mesh].clone();return 1<r[e.mesh]&&(n.name+="_instance_"+i[e.mesh]++),n}).then(function(y){return gm(y,function(h,e){var d=_.nodes[e];if(jn(d.skin)){for(var t=[],n=0<h.children.length?h.children:[h],r=0;r<n.length;r++){var i=n[r];if(i.isMesh){var a=x.skins[d.skin],o=i.geometry,s=i.material.clone();s.skinning=!0;var l=new Xo(o,s);l.morphTargetInfluences=i.morphTargetInfluences,l.name=i.name,l.isMaterialGeneratedMesh=i.isMaterialGeneratedMesh;for(var c=[],u=[],p=0,f=a.joints.length;p<f;p++){var m=a.joints[p],v=y[m];if(v){c.push(v);var g=new Qt;jn(a.inverseBindMatrices)&&g.fromArray(a.inverseBindMatrices.array,16*p),u.push(g)}else console.warn('v3d.GLTFLoader: Joint "%s" could not be found.',m)}l.bind(new Vo(c,u),l.matrixWorld),t.push(l)}}t.length&&(0<h.children.length?(h.remove.apply(h,h.children),h.add.apply(h,t)):h=t[0])}return h.traverse(function(e){var t=h==e,n=b.getExt(d,Wf.S8S_V3D_NODE_DATA);if(t){if(void 0!==d.name&&(e.name=d.name),void 0!==d.matrix){var r=new Qt;r.fromArray(d.matrix),e.applyMatrix(r)}else void 0!==d.translation&&e.position.fromArray(d.translation),void 0!==d.rotation&&e.quaternion.fromArray(d.rotation),void 0!==d.scale&&e.scale.fromArray(d.scale);if((e.isDirectionalLight||e.isSpotLight||e.isHemisphereLight)&&(e.isFreeLight=!0),n&&n.hidden&&(e.visible=!1),n&&jn(n.constraints))for(var i=0;i<n.constraints.length;i++){var a=n.constraints[i];if("lockedTrack"==a.type)a.trackAxis=a.trackAxis.toUpperCase(),a.lockAxis=a.lockAxis||"Y";else if("trackTo"==a.type)a.trackAxis=a.trackAxis.toUpperCase(),a.upAxis=a.upAxis||"Y";else if("floor"==a.type)a.floorLocation=a.floorLocation.toUpperCase();else if("copyTransforms"==a.type){var o=y[a.target],s=new qd(o),l=new Qd(o),c=new Zd(o);s.name=l.name=c.name=a.name,s.mute=l.mute=c.mute=a.mute,e.constraints.push(s),e.constraints.push(l),e.constraints.push(c)}var u=null;switch(a.type){case"copyLocation":u=new qd(y[a.target]);break;case"copyRotation":u=new Qd(y[a.target]);break;case"copyScale":u=new Zd(y[a.target]);break;case"limitLocation":(u=new Jd).min.set(Number(a.minX),Number(a.minY),Number(a.minZ)),u.max.set(Number(a.maxX),Number(a.maxY),Number(a.maxZ));break;case"limitRotation":(u=new $d).axis=a.axis,u.min=a.min,u.max=a.max;break;case"limitScale":(u=new ep).min.set(Number(a.minX),Number(a.minY),Number(a.minZ)),u.max.set(Number(a.maxX),Number(a.maxY),Number(a.maxZ));break;case"lockedTrack":(u=new tp(y[a.target])).trackAxis=a.trackAxis,u.lockAxis=a.lockAxis;break;case"trackTo":(u=new np(y[a.target])).trackAxis=a.trackAxis,u.upAxis=a.upAxis;break;case"childOf":(u=new Yd(y[a.target])).offsetMatrix=(new Qt).fromArray(a.offsetMatrix);break;case"floor":(u=new Kd(y[a.target])).floorLocation=a.floorLocation,u.offset=a.offset}u&&(u.name=a.name,u.mute=a.mute,e.constraints.push(u))}}e.isMesh&&(n&&jn(n.useCastShadows)?e.castShadow=n.useCastShadows:jn(e.material.castShadow)&&(e.castShadow=e.material.castShadow),n&&jn(n.useShadows)?e.receiveShadow=n.useShadows:jn(e.material.receiveShadow)&&(e.receiveShadow=e.material.receiveShadow)),d.extras&&(e.userData.v3d=d.extras),n&&(e.renderOrder=n.renderOrder,e.frustumCulled=n.frustumCulling,jn(n.groupNames)?e.groupNames=n.groupNames:e.groupNames=[])}),h})})})},bm.prototype.loadScenes=function(){var l=this.json,c=this,u=this.extensions;function h(e,t,n){var r=n[e];t.add(r),(r.isDirectionalLight||r.isSpotLight||r.isHemisphereLight)&&t.add(r.target);var i=l.nodes[e];if(i.children)for(var a=i.children,o=0,s=a.length;o<s;o++){h(a[o],r,n)}}return this._withDependencies(["nodes"]).then(function(s){return gm(l.scenes,function(e){var t=new Do;jn(e.name)&&(t.name=e.name),e.extras&&(t.userData.v3d=e.extras);for(var n=e.nodes||[],r=0,i=n.length;r<i;r++){h(n[r],t,s.nodes)}var a=c.getExt(e,Wf.S8S_V3D_SCENE_DATA);if(a&&jn(a.light)){var o=u[Wf.S8S_V3D_DATA].lights;t.add(o[a.light])}return jn(a.postprocessing)&&(t.postprocessing=a.postprocessing),t})})},bm.prototype.getExt=function(e,t){return e.extensions&&e.extensions[t]?e.extensions[t]:null},bm.prototype.texcoordToAttrName=function(e){return"TEXCOORD_0"==e?"uv":"uv"+String(Number(e.split("TEXCOORD_")[1])+1)},bm.prototype.colorToAttrName=function(e){return"COLOR_0"==e?"color":"color"+String(Number(e.split("COLOR_")[1])+1)},wm.prototype=Object.assign(Object.create(Af.prototype),{constructor:wm}),Am.prototype=Object.assign(Object.create(_f.prototype),{constructor:Am,dispose:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()},setSize:function(e,t){this.renderTargetMaskBuffer.setSize(e,t);var n=Math.round(e/this.downSampleRatio),r=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(n,r),this.renderTargetBlurBuffer1.setSize(n,r),this.renderTargetEdgeBuffer1.setSize(n,r),this.separableBlurMaterial1.uniforms.texSize.value=new qt(n,r),n=Math.round(n/2),r=Math.round(r/2),this.renderTargetBlurBuffer2.setSize(n,r),this.renderTargetEdgeBuffer2.setSize(n,r),this.separableBlurMaterial2.uniforms.texSize.value=new qt(n,r)},changeVisibilityOfSelectedObjects:function(t){function e(e){e instanceof Ei&&(e.outlineVisible=t)}for(var n=0;n<this.selectedObjects.length;n++){var r=this.selectedObjects[n];e(r);for(var i=r.children,a=0;a<i.length;a++){var o=i[a];o.isMesh&&o.isMaterialGeneratedMesh&&e(o)}}},changeVisibilityOfNonSelectedObjects:function(r){var i=[];function e(e){e instanceof Ei&&i.push(e)}for(var t=0;t<this.selectedObjects.length;t++){var n=this.selectedObjects[t];e(n);for(var a=n.children,o=0;o<a.length;o++){var s=a[o];s.isMesh&&s.isMaterialGeneratedMesh&&e(s)}}this.renderScene.traverse(function(e){if(e instanceof Ei){for(var t=!1,n=0;n<i.length;n++)if(i[n].id===e.id){t=!0;break}t||(e.outlineVisible=r)}})},updateTextureMatrix:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)},getDepthMaterial:function(e,t,n){var r=e.geometry,i=null,a=this._depthMaterials,o=e.customDepthMaterial;if(n&&(a=this._maskMaterials),o)i=o;else{var s=!1;t.morphTargets&&(r&&r.isBufferGeometry?s=r.morphAttributes&&r.morphAttributes.position&&0<r.morphAttributes.position.length:r&&r.isGeometry&&(s=r.morphTargets&&0<r.morphTargets.length)),e.isSkinnedMesh&&!1===t.skinning&&console.warn("v3d.OutlinePass: v3d.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&t.skinning,c=0;s&&(c|=this._MorphingFlag),l&&(c|=this._SkinningFlag),i=a[c]}i.visible=t.visible,i.wireframe=t.wireframe;var u=t.side;return i.side=u,i.clipShadows=t.clipShadows,i.clippingPlanes=t.clippingPlanes,i.clipIntersection=t.clipIntersection,i.wireframeLinewidth=t.wireframeLinewidth,i.linewidth=t.linewidth,n&&(i.cameraNearFar=new qt(this.renderCamera.near,this.renderCamera.far),i.depthTexture=this.renderTargetDepthBuffer.texture,i.textureMatrix=this.textureMatrix),i},renderObject:function(e,t,n,r){if(t.outlineVisible&&t.isVisible()&&t.layers.test(n.layers)){var i=e.updateGeometry(t),a=t.material;if(a.visible){var o=this.getDepthMaterial(t,a,r);e.renderObject(t,this.scene,n,i,o,null)}}for(var s=t.children,l=0,c=s.length;l<c;l++)this.renderObject(e,s[l],n,r)},render:function(e,t,n,r,i){if(0!==this.selectedObjects.length){this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha();var a=e.autoClear;e.autoClear=!1,i&&e.context.disable(e.context.STENCIL_TEST),e.setClearColor(16777215,1);var o=this.renderScene.background;if(this.renderScene.background=null,this.changeVisibilityOfSelectedObjects(!1),e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),this.renderObject(e,this.renderScene,this.renderCamera,!1),this.changeVisibilityOfSelectedObjects(!0),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),this.renderObject(e,this.renderScene,this.renderCamera,!0),this.changeVisibilityOfNonSelectedObjects(!0),this.renderScene.background=o,this.quad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.render(this.scene,this.camera,this.renderTargetMaskDownSampleBuffer,!0),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod){var s=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(s),this.tempPulseColor2.multiplyScalar(s)}this.quad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value=new qt(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.render(this.scene,this.camera,this.renderTargetEdgeBuffer1,!0),this.quad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Am.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.render(this.scene,this.camera,this.renderTargetBlurBuffer1,!0),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=Am.BlurDirectionY,e.render(this.scene,this.camera,this.renderTargetEdgeBuffer1,!0),this.quad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=Am.BlurDirectionX,e.render(this.scene,this.camera,this.renderTargetBlurBuffer2,!0),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=Am.BlurDirectionY,e.render(this.scene,this.camera,this.renderTargetEdgeBuffer2,!0),this.quad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.context.enable(e.context.STENCIL_TEST),e.render(this.scene,this.camera,n,!1),e.setClearColor(this.oldClearColor,this.oldClearAlpha),e.autoClear=a}},getEdgeDetectionMaterial:function(){return new Mi(Un.outline_edge)},getSeperableBlurMaterial:function(e){var t=new Mi(Un.outline_blur);return t.defines.MAX_RADIUS=e,t},getOverlayMaterial:function(){var e=new Mi(Un.outline_overlay);return e.blending=K,e.depthTest=!1,e.depthWrite=!1,e.transparent=!0,e},setCamera:function(e){this.renderCamera=e}}),Am.BlurDirectionX=new qt(1,0),Am.BlurDirectionY=new qt(0,1),Mm.prototype=Object.assign(Object.create(_f.prototype),{constructor:Mm,render:function(e,t,n,r,i){var a,o,s=e.autoClear;e.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(a=e.getClearColor().getHex(),o=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.render(this.scene,this.camera,this.renderToScreen?null:n,this.clear),this.clearColor&&e.setClearColor(a,o),this.scene.overrideMaterial=null,e.autoClear=s},setCamera:function(e){this.camera=e}}),Tm.prototype={constructor:Tm,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=Te,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1,e.render(this.scene,this.camera,this.renderTarget),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},dispose:function(){this.renderTarget.dispose(),this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}};var Sm={renderWorldNodeMatToCubemap:function(e,t,n){t.isMeshNodeMaterial||console.error("v3d.RenderUtils.renderWorldNodeMatToCubemap(): material is not an instance of MeshNodeMaterial.");var r=new Do,i=new Qu(.1,10,n);i.renderTarget.texture.encoding=Ot,i.renderTarget.texture.generateMipmaps=!1,r.add(i);var a=e.getContext();if(a.getExtension("OES_texture_half_float")&&a.getExtension("OES_texture_half_float_linear")){i.renderTarget.texture.type=Ge;window.navigator.userAgent;var o=window.navigator.platform,s=!!window.chrome&&!/Edge/.test(navigator.userAgent),l=-1!==["Macintosh","MacIntel","MacPPC","Mac68K"].indexOf(o);for(var c in t.nodeTextures){var u=t.nodeTextures[c];if(!(u.encoding!=Dt||s&&l)){var h=new Tm(u,Ge);h.update(e),t.nodeTextures[c]=h.renderTarget.texture,t.updateNodeGraph()}}}var d=t.clone();d.defines.WORLD_NODES=1,d.side=Me;var p=new Ei(new Yr(1,1,1),d);for(var c in r.add(p),i.update(e,r),p.material.dispose(),p.material.nodeTextures)p.material.nodeTextures[c].dispose();return p.geometry.dispose(),i.renderTarget}};function Em(e){this.data=void 0!==e?e:null,this.equirecInvertU=!1,this.equirecOffsetU=0}function Lm(e,t,n,r){Af.call(this,Un.ssao),this.width=void 0!==n?n:512,this.height=void 0!==r?r:256,this.renderToScreen=!1,this.camera2=t,this.scene2=e,this.depthMaterial=new $a,this.depthMaterial.depthPacking=Gt,this.depthMaterial.blending=Q,this.depthRenderTarget=new _n(this.width,this.height,{minFilter:Ne,magFilter:Ne}),this.uniforms.tDepth.value=this.depthRenderTarget.texture,this.uniforms.size.value.set(this.width,this.height),this.uniforms.cameraNear.value=this.camera2.near,this.uniforms.cameraFar.value=this.camera2.far,this.uniforms.radius.value=4,this.uniforms.onlyAO.value=!1,this.uniforms.aoClamp.value=.25,this.uniforms.lumInfluence.value=.7;Object.defineProperties(this,{radius:{get:function(){return this.uniforms.radius.value},set:function(e){this.uniforms.radius.value=e}},onlyAO:{get:function(){return this.uniforms.onlyAO.value},set:function(e){this.uniforms.onlyAO.value=e}},aoClamp:{get:function(){return this.uniforms.aoClamp.value},set:function(e){this.uniforms.aoClamp.value=e}},lumInfluence:{get:function(){return this.uniforms.lumInfluence.value},set:function(e){this.uniforms.lumInfluence.value=e}}})}function Cm(){Af.call(this,Un.tonemap),this.uniforms.exposure.value=1,Object.defineProperties(this,{exposure:{get:function(){return this.uniforms.exposure.value},set:function(e){this.uniforms.exposure.value=e}}})}function Pm(e,t,n){(this.container=e instanceof HTMLElement?e:document.getElementById(e),up.checkWebGL())?(this.scene=null,this.camera=null,this.clock=new Zu,this.mixer=null,this.renderCallbacks=[],this.elapsed=0,this.frame=0,this.preloader=n,this.worldMaterial=null,this.worldCubemapRes=1024,this.xrImmersiveDevice=null,this.xrNonImmersiveDevice=null,this.xrContext=null,this.xrSession=null,this.xrControllers=[],t=t||{},this.renderer=new Fo({alpha:t.alpha,depth:t.depth,stencil:t.stencil,antialias:void 0===t.antialias||t.antialias,premultipliedAlpha:t.premultipliedAlpha,preserveDrawingBuffer:t.preserveDrawingBuffer}),this.clearBkgOnLoad=!1,this.renderer.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(this.renderer.domElement),this.container.classList.add("v3d-container"),this.renderer.domElement.classList.add("v3d-canvas"),this.loader=new jf,"0000000000"==Xt.replace("__V3DL__","")&&xf.drawWatermark(this.container,"VERGE3D TRIAL - USE IN PRODUCTION PROHIBITED")):up.showWebGLErrorMessage(this.container)}Object.assign(Em.prototype,{isSceneBackground:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){null===e.data?this.data=null:e.data.isColor?this.data=e.data.clone():e.data.isCubeTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):e.data.isTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):e.data.isWebGLRenderTargetCube?(this.data=e.data.clone(),this.data.texture.needsUpdate=!0):this.data=e.data,this.equirecInvertU=e.equirecInvertU,this.equirecOffsetU=e.equirecOffsetU},toJSON:function(e){var t={metadata:{version:4.5,type:"SceneBackground",generator:"SceneBackground.toJSON"}};return null!==this.data&&(t.data=this.data.toJSON(e)),!0===this.equirecInvertU&&(t.equirecInvertU=!0),0!==this.equirecOffsetU&&(t.equirecOffsetU=this.equirecOffsetU),t}}),(Lm.prototype=Object.create(Af.prototype)).render=function(e,t,n,r,i){this.scene2.overrideMaterial=this.depthMaterial,e.render(this.scene2,this.camera2,this.depthRenderTarget,!0),this.scene2.overrideMaterial=null,Af.prototype.render.call(this,e,t,n,r,i)},Lm.prototype.setScene=function(e){this.scene2=e},Lm.prototype.setCamera=function(e){this.camera2=e,this.uniforms.cameraNear.value=this.camera2.near,this.uniforms.cameraFar.value=this.camera2.far},Lm.prototype.setSize=function(e,t){this.width=e,this.height=t,this.uniforms.size.value.set(this.width,this.height),this.depthRenderTarget.setSize(this.width,this.height)},Cm.prototype=Object.assign(Object.create(Af.prototype),{constructor:Cm}),Object.assign(Pm.prototype,{constructor:Pm,load:function(e,l,t,c){c=void 0===c||c;var u=this;u.renderer?(this.loader.load(e,function(e){e.renderer.shadowMap?(u.renderer.shadowMap.enabled=e.renderer.shadowMap.enabled,u.renderer.shadowMap.type=e.renderer.shadowMap.type):(u.renderer.shadowMap.enabled=!0,u.renderer.shadowMap.type=V),e.renderer.physicallyCorrectLights&&(u.renderer.physicallyCorrectLights=!0),e.renderer.useHDR&&up.checkHDR(u.renderer)?u.useHDR=!0:u.useHDR=!1,u.renderer.unitsScaleFactor=e.renderer.unitsScaleFactor,e.renderer.toneMapping&&(u.renderer.toneMapping=e.renderer.toneMapping,u.renderer.toneMappingExposure=e.renderer.toneMappingExposure);var t=e.scene||new Do;if(u.scene=t,e.cameras&&e.cameras.length){e.cameras.length;u.camera=e.cameras[0]}else u.camera=new oo(45,u.container.offsetWidth/u.container.offsetHeight,.001,1e3),u.scene.add(u.camera);u.materials=[],t.traverse(function(e){var t=e.material;t&&(t.isMeshNodeMaterial&&u.useHDR&&"max"!=t.profile&&(t.useHDR=!0,t.updateNodeGraph()),u.materials.push(t))});var n=e.animations;if(u.actions=[],n&&n.length){u.mixer=new Vh(t);for(var r=0;r<n.length;r++){var i=n[r],a=t.getObjectById(i.nodeId);if(a){if(a.id==t.id||""!==a.name&&"root"!==a.name&&"."!==a.name&&a.name!==t.name&&a.name!==t.uuid)o=u.mixer.clipAction(i.clip);else var o=u.mixer.clipAction(i.clip,a);o.setLoop(i.loop,i.repetitions),o.startAt(i.startAt),o.clampWhenFinished=!0,i.auto?o.play():(o.stop(),o.paused=!0),u.actions.push(o)}}}u.initPostprocessing();var s=e.world.material;s&&(u.updateEnvironment(s),u.worldMaterial=s),u.onResize&&u.onResize(),u.scene.updateMatrixWorld(),u.clearBkgOnLoad&&(u.scene.background=null),l&&l(),c&&u.run()},function(e){u.preloader&&u.preloader.onUpdate(e)},function(e){console.error(e),t&&t(e)}),window.addEventListener("resize",function(){u.onResize&&u.onResize()},!1)):t&&t("WebGL not found")},getWidth:function(){return this.container.offsetWidth},getHeight:function(){return this.container.offsetHeight},onResize:function(){function c(e,t,n){return 2*Yt.RAD2DEG*Math.atan(Math.tan(Yt.DEG2RAD*e/2)*t/n)}return function(){var e=this.getWidth(),t=this.getHeight();if(this.renderer.setSize(e,t),this.postprocessing){var n=this.renderer.getPixelRatio();this.postprocessing.composer.setSize(e*n,t*n)}if(this.scene){var r=e/t,i=this.camera;if(i.isPerspectiveCamera)switch(i.viewportFit.type){case 1:i.aspect=r;break;case 2:i.fov=c(i.fov,i.aspect,r),i.aspect=r;break;case 3:var a=i.aspect<i.viewportFit.initialAspect,o=r<i.viewportFit.initialAspect;a&&o?i.fov=c(i.fov,i.aspect,r):a&&!o?i.fov=c(i.fov,i.aspect,i.viewportFit.initialAspect):!a&&o&&(i.fov=c(i.fov,i.viewportFit.initialAspect,r)),i.aspect=r}else if(i.isOrthographicCamera)switch(i.viewportFit.type){case 1:var s=i.top*r;i.left=-s,i.right=s;break;case 2:var l=i.right/r;i.bottom=-l,i.top=l;break;case 3:a=(i.right-i.left)/(i.top-i.bottom)<i.viewportFit.initialAspect,o=r<i.viewportFit.initialAspect;if(a&&o)s=i.right;else if(a&&!o)s=i.right*r/i.viewportFit.initialAspect;else if(!a&&o)s=i.top*i.viewportFit.initialAspect;else s=i.top*r;i.left=-s,i.right=s,i.bottom=-s/r,i.top=s/r}i.updateProjectionMatrix()}}}(),run:function(){this.preloader&&(this.preloader.onFinish(),this.preloader=null),this.animate()},animate:function(){var r=this;r.renderer.setAnimationLoop(function(){var e=r.clock.getDelta();r.elapsed=e,r.mixer&&r.mixer.update(e),r.controls&&r.controls.update(e);for(var t=r.renderCallbacks,n=0;n<t.length;n++)t[n](e,r.clock.elapsedTime);r.render(),r.frame++})},render:function(){this.postprocessing?this.postprocessing.composer.render(this.elapsed):this.scene&&this.camera&&this.renderer.render(this.scene,this.camera)},enableControls:function(e){var t=this.camera;if(t.controls){switch(t.controls.type){case"ORBIT":this.controls=new ap(t,e||this.renderer.domElement),this.controls.target.copy(t.controls.orbitTarget),this.controls.minDistance=t.controls.orbitMinDistance,this.controls.maxDistance=t.controls.orbitMaxDistance,this.controls.minPolarAngle=t.controls.orbitMinPolarAngle,this.controls.maxPolarAngle=t.controls.orbitMaxPolarAngle,this.controls.minAzimuthAngle=t.controls.orbitMinAzimuthAngle,this.controls.maxAzimuthAngle=t.controls.orbitMaxAzimuthAngle;break;case"FLYING":this.controls=new ip(t,this.renderer.domElement),this.controls.panSpeedTouch*=t.controls.moveSpeed,this.controls.zoomSpeedKey*=t.controls.moveSpeed;break;default:this.controls=null}this.controls&&(this.controls.enablePan=t.controls.enablePan,this.controls.rotateSpeed*=t.controls.rotateSpeed,this.controls.rotateSpeedTouch*=t.controls.moveSpeed,this.controls.panSpeed*=t.controls.moveSpeed,this.controls.panSpeedKey*=t.controls.moveSpeed,this.controls.zoomSpeed*=t.controls.moveSpeed,this.controls.zoomSpeedTouch*=t.controls.moveSpeed)}},setCamera:function(e){if(this.camera=e,this.postprocessing)for(var t=this.postprocessing.composer.passes,n=0;n<t.length;n++)t[n].setCamera(e);this.controls&&this.controls.dispose(),this.enableControls(),this.onResize()},getCamera:function(){return this.camera},cleanup:function(){this.container&&this.renderer&&this.container.removeChild(this.renderer.domElement),this.loader&&this.mixer&&this.mixer.stopAllAction()},initPostprocessing:function(){(this.scene.postprocessing&&this.scene.postprocessing.length||this.useHDR)&&this.enablePostprocessing(this.scene.postprocessing||[])},enablePostprocessing:function(e){if(this.useHDR)var t={format:qe,stencilBuffer:!1,encoding:Ft,type:Ge};if(this.postprocessing)n=this.postprocessing.composer;else{this.postprocessing={};var n,r=new Mm(this.scene,this.camera);if(this.useHDR)var i=new _n(this.getWidth(),this.getHeight(),t);else i=void 0;if((n=new Lf(this.renderer,i)).addPass(r),this.postprocessing.composer=n,this.useHDR){var a=new Cm;n.addPass(a),this.postprocessing.toneMapPass=a}var o=new Cf(this.scene,this.camera);o.renderToScreen=!0,n.addPass(o),this.postprocessing.fxaaPass=o}for(var s=0;s<e.length;s++){var l=e[s],c=n.passes.length-(this.useHDR?2:1);switch(l.type){case"bloom":var u=l.strength,h=l.radius,d=l.threshold;if(this.postprocessing.bloomPass){(p=this.postprocessing.bloomPass).strength=u,p.radius=h,p.threshold=d}else{var p=new wf(new qt(this.getWidth(),this.getHeight()),u,h,d,t);n.insertPass(p,c),this.postprocessing.bloomPass=p}break;case"brightnessContrast":if(this.postprocessing.brightnessContrastPass)f=this.postprocessing.brightnessContrastPass;else{var f=new Mf;n.insertPass(f,c),this.postprocessing.brightnessContrastPass=f}f.brightness=l.brightness,f.contrast=l.contrast;break;case"dof":if(this.postprocessing.bokehPass)m=this.postprocessing.bokehPass;else{var m=new Tf(this.scene,this.camera,{width:this.getWidth(),height:this.getHeight()});n.insertPass(m,c),this.postprocessing.bokehPass=m}m.focus=l.focus,m.aperture=l.aperture,m.maxblur=l.maxblur,m.depthLeakThreshold=l.depthLeakThreshold;break;case"grayscale":if(!this.postprocessing.grayscalePass){var v=new wm;n.insertPass(v,c),this.postprocessing.grayscalePass=v}break;case"outline":if(this.postprocessing.outlinePass)g=this.postprocessing.outlinePass;else{var g=new Am(new qt(this.getWidth(),this.getHeight()),this.scene,this.camera);n.insertPass(g,c),this.postprocessing.outlinePass=g}g.edgeStrength=l.edgeStrength,g.edgeGlow=l.edgeGlow,g.edgeThickness=l.edgeThickness,g.pulsePeriod=l.pulsePeriod,g.visibleEdgeColor.fromArray(l.visibleEdgeColor.slice(0,3)),g.hiddenEdgeColor.fromArray(l.hiddenEdgeColor.slice(0,3));break;case"ssao":if(up.checkIOS())continue;if(this.postprocessing.ssaoPass)y=this.postprocessing.ssaoPass;else{var y=new Lm(this.scene,this.camera);n.insertPass(y,c),this.postprocessing.ssaoPass=y}y.onlyAO=l.onlyAO||!1,y.radius=l.radius,y.aoClamp=l.aoClamp,y.lumInfluence=l.lumInfluence;break;default:console.error("v3d.App: wrong postprocessing effect")}}},disablePostprocessing:function(e){if(this.postprocessing){var t=["bloomPass","brightnessContrastPass","bokehPass","grayscalePass","ssaoPass"];e||t.append("outlinePass");for(var n=this.postprocessing.composer,r=0;r<t.length;r++){var i=t[r];this.postprocessing[i]&&(n.passes.splice(n.passes.indexOf(this.postprocessing[i]),1),this.postprocessing[i].dispose(),this.postprocessing[i]=null)}2==n.passes.length&&(this.postprocessing=null)}},updateEnvironment:function(e){var t=Sm.renderWorldNodeMatToCubemap(this.renderer,e,this.worldCubemapRes);if(e.hasNode("LIGHT_PATH")){var n=e.defines.LIGHT_PATH_IS_CAM_RAY;e.defines.LIGHT_PATH_IS_CAM_RAY=0;var r=Sm.renderWorldNodeMatToCubemap(this.renderer,e,this.worldCubemapRes);e.defines.LIGHT_PATH_IS_CAM_RAY=n}else r=t;this.scene.background=new Em(t),this.initPMREM(r)},initPMREM:function(e){if(e.isWebGLRenderTargetCube){var t=new lp(e.texture);t.flipX=!1,t.update(this.renderer);var n=new sp(t.cubeLods);n.update(this.renderer);var r=n.CubeUVRenderTarget;this.scene.traverse(function(e){e.isMesh&&e.material&&(e.material.isMeshStandardMaterial||e.material.isMeshPhysicalMaterial||e.material.isMeshNodeMaterial&&"PHYSICAL"in e.material.defines)&&(e.material.envMap=r.texture,e.material.needsUpdate=!0)})}},checkWebXR:function(i,a,o){var s=this;"xr"in navigator?navigator.xr.requestDevice().then(function(e){if(!i){var t=document.createElement("canvas"),n=t.getContext("xrpresent");if(!n)return void o();window.document.body.appendChild(t)}var r=Pm.getXRSessionOpts(i,n);e.supportsSession(r).then(function(){i?s.xrImmersiveDevice=e:(s.xrNonImmersiveDevice=e,s.xrContext=n),a()}).catch(o)}).catch(o):o()},initWebXR:function(a,o,s,e,l){s=s||function(){},e=e||function(){},l=l||function(){};var c=this;function u(e){if(c.xrSession.removeEventListener("end",u),c.xrSession=null,c.renderer.vr.setSession(null),l(),a){for(var t=0;t<c.xrControllers.length;t++){var n=c.xrControllers[t];c.scene.remove(n);for(var r=0;r<n.children.length;r++){var i=n.children[r];i.geometry.dispose(),i.material.dispose()}}c.xrControllers=[]}}if("xr"in navigator){var t=a?c.xrImmersiveDevice:c.xrNonImmersiveDevice;c.renderer.vr.setDevice(t);var n=Pm.getXRSessionOpts(a,c.xrContext);t.requestSession(n).then(function(e){if(c.postprocessing=null,c.renderer.vr.setFrameOfReferenceType(o),(c.xrSession=e).addEventListener("end",u),a){2<=window.devicePixelRatio&&c.renderer.vr.setFramebufferScaleFactor(.5);for(var t=(new Wr).setFromPoints([new Kt(0,0,0),new Kt(0,0,-1)]),n=0;n<1;n++){var r=c.renderer.vr.getController(n);c.scene.add(r),c.xrControllers.push(r);var i=new Ho(t);i.name="line",i.scale.z=5,r.add(i.clone())}}else c.container.removeChild(c.renderer.domElement),c.container.appendChild(c.xrContext.canvas),c.renderer.setCanvas(c.xrContext.canvas),c.renderer.domElement.classList.add("v3d-canvas"),c.scene.background=null,c.renderer.autoClear=!1,c.onResize();c.renderer.vr.setImmersive(a),c.renderer.vr.enabled=!0,c.renderer.vr.setSession(e),s()}).catch(e)}else e()},printPerformanceInfo:function(s){var l=this;s=s||1;var c=l.renderer.info,u=c.autoReset;c.autoReset=!1,c.reset();for(var h=l.frame,e=0;e<c.programs.length;e++)c.programs[e].profile.calcRenderTime=!0;setTimeout(function(){console.log("--- Verge3D Performance Profile ("+s+"s) ---");var e=l.frame-h;console.log("FPS:",e/s),console.log("Render Calls:",c.render.calls/e),console.log("Triangles Rendered:",c.render.triangles/e),console.log("Geometry Buffers:",c.memory.geometries),console.log("Textures & Render Buffers:",c.memory.textures),console.log("Materials and Shaders:");var t=c.programs.slice(0);t.sort(function(e,t){return t.profile.renderTime-e.profile.renderTime});for(var n=0,r=0;r<t.length;r++){var i=t[r];i.profile.calcRenderTime=!1;var a=i.profile.materials,o=i.profile.renderTime;console.log(0==a.length?"System Material":a.join(","),String(Math.round(o))+"ms",i),n+=o,i.profile.renderTime=0}console.log("Total Render Time:",String(Math.round(n))+"ms"),c.autoReset=u},1e3*s)}}),Pm.getXRSessionOpts=function(e,t){var n={immersive:e,environmentIntegration:!e};return e||(n.outputContext=t),n};var Nm="SceneLoadError",Rm="LogicLoadError",Fm="EditorLoadError";function Om(e,t,n){console.warn("v3d.AppPuzzles has been deprecated. Use v3d.PuzzlesLoader instead."),Pm.call(this,e,t,n),this._editorJSFile="puzzles.min.js",this._editorCSSFile="puzzles.css",this._editorMediaDir="media/",this._libraryXML="library.xml",this.ExternalInterface={}}Om.prototype=Object.assign(Object.create(Pm.prototype),{constructor:Om,onSceneLoad:function(){},onEditorLoad:function(){},onLogicLoad:function(){},onLoadFinished:function(e,t,n){e&&this.run()},onError:function(e){console.error(e)},run:function(){this.enableControls(),Pm.prototype.run.call(this),v3d.PL&&v3d.PL.init(this)},_createSceneLoadError:function(e){var t=new Error(e);return t.name=Nm,t},_createLogicLoadError:function(e){var t=new Error(e);return t.name=Rm,t},_createEditorLoadError:function(e){var t=new Error(e);return t.name=Fm,t},_getScenePromise:function(n){var r=this;return new Promise(function(e,t){Pm.prototype.load.call(r,n,function(){e()},function(){t(r._createSceneLoadError("Unable to load the scene file: '"+n+"'."))},!1)})},_getLogicPromise:function(n){var r=this;return new Promise(function(e,t){xf.loadScript(n,document.body,function(){e()},function(){t(r._createLogicLoadError("Unable to load the logic file: '"+n+"'."))})})},_getEditorPromise:function(r,i){var a=this;return new Promise(function(e,t){var n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=i,document.head.appendChild(n),xf.loadScript(r,document.body,function(){e()},function(){t(a._createEditorLoadError("Unable to load the Puzzles Editor: '"+r+"'."))})})},_getLogicViaEditorPromise:function(i,a,o){var s=this;return new Promise(function(t,n){var e=i.match(/(.*)\.js$/);if(e)if(v3d.PE){var r=e[1]+".xml";v3d.PE.init(a,function(e){e?t():n(s._createLogicLoadError("Unable to load The Puzzles Editor's XML logic file: '"+r+"'."))},s,r,o)}else n(s._createLogicLoadError("Unable to load Puzzles' logic. The Puzzles Editor isn't loaded."));else n(s._createLogicLoadError("Unable to load Puzzles' logic. The provided file should be of type JS: '"+i+"'."))})},loadScene:function(e){var t=this;t._getScenePromise(e).then(function(){t.onSceneLoad(),t.onLoadFinished(!0,!1,!1)}).catch(function(e){switch(t.onError(e),e.name){case Nm:t.onLoadFinished(!1,!1,!1)}})},loadSceneWithLogic:function(e,t){var n=this;n._getScenePromise(e).then(function(){return n.onSceneLoad(),n._getLogicPromise(t)}).then(function(){n.onLogicLoad(),n.onLoadFinished(!0,!0,!1)}).catch(function(e){switch(n.onError(e),e.name){case Nm:n.onLoadFinished(!1,!1,!1);break;case Rm:n.onLoadFinished(!0,!1,!1)}})},loadSceneWithEditor:function(e,t,n){var r=this,i=n+r._editorJSFile,a=n+r._editorCSSFile,o=n+r._editorMediaDir,s=n+r._libraryXML;r._getScenePromise(e).then(function(){return r.onSceneLoad(),r._getEditorPromise(i,a)}).then(function(){return r.onEditorLoad(),r._getLogicViaEditorPromise(t,o,s)}).then(function(){r.onLogicLoad(),r.onLoadFinished(!0,!0,!0)}).catch(function(e){switch(r.onError(e),e.name){case Nm:r.onLoadFinished(!1,!1,!1);break;case Fm:r.onLoadFinished(!0,!1,!1);break;case Rm:r.onLoadFinished(!0,!1,!0)}})}});var Im,Dm,Um,Bm={normalizeDialectOptions:function(e){var t={delimiter:",",doublequote:!0,lineterminator:"\n",quotechar:'"',skipinitialspace:!0,skipinitialrows:0};for(var n in e)t[n.toLowerCase()]=e[n];return t},parse:function(e,t){(!t||t&&!t.lineterminator)&&(e=Bm.normalizeLineTerminator(e,t));var n=Bm.normalizeDialectOptions(t);e=Bm.chomp(e,n.lineterminator);var r,i,a="",o=!1,s=!1,l="",c=[],u=[];for(i=function(e){var t=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")};return!0!==s&&(""===e?e=null:!0===n.skipinitialspace&&(e=t(e)),/^\d+$/.test(e)?e=parseInt(e,10):/^\d*\.\d+$|^\d+\.\d*$/.test(e)&&(e=parseFloat(e,10))),e},r=0;r<e.length;r+=1)a=e.charAt(r),!1!==o||a!==n.delimiter&&a!==n.lineterminator?a!==n.quotechar?l+=a:o?e.charAt(r+1)===n.quotechar?(l+=n.quotechar,r+=1):o=!1:s=o=!0:(l=i(l),c.push(l),a===n.lineterminator&&(u.push(c),c=[]),l="",s=!1);return l=i(l),c.push(l),u.push(c),n.skipinitialrows&&(u=u.slice(n.skipinitialrows)),u},normalizeLineTerminator:function(e,t){return(t=t||{}).lineterminator?e:e.replace(/(\r\n|\n|\r)/gm,"\n")},chomp:function(e,t){return e.charAt(e.length-t.length)!==t?e:e.substring(0,e.length-t.length)}},zm=new Kt(1,0,0);function km(e,t){e=void 0!==e?e:new Fn(1,0,0),t=void 0!==t?t:2;var n=new Df;n.setGeometry([0,0,0,zm.x,zm.y,zm.z]);var r=new Gf({color:e,lineWidth:t,sizeAttenuation:0});Ei.call(this,n.geometry,r),this.elemHTML=null,this.offset=5}km.prototype=Object.assign(Object.create(Ei.prototype),{constructor:km,isLineHTML:!0,onBeforeRender:(Im=new Kt,Dm=new Kt,Um=new Zt,function(e,t,n,r,i,a){if(Ei.prototype.onBeforeRender.call(this),this.elemHTML){var o=e.domElement.offsetHeight,s=e.domElement.offsetWidth,l=this.elemHTML.getBoundingClientRect(),c=(l.left+l.right)/2,u=(l.top+l.bottom)/2,h=this.getWorldPosition(Im).project(n),d=(h.x+1)/2*s,p=(1-h.y)/2*o,f=(u-p)/(c-d),m=(l.height+2*this.offset)/(l.width+2*this.offset);if(Math.abs(f)>m)var v=((g=u<p?Math.min(l.bottom+this.offset,p):Math.max(l.top-this.offset,p))-p)/f+d;else var g=((v=d<c?Math.max(l.left-this.offset,d):Math.min(l.right+this.offset,d))-d)*f+p;var y=2*v/s-1,x=1-2*g/o,_=Dm.set(y,x,-1);_.unproject(n),this.parent&&this.parent.worldToLocal(_);var b=_.length();this.scale.setScalar(b),_.normalize();var w=Um.setFromUnitVectors(zm,_);this.setRotationFromQuaternion(w),this.updateMatrixWorld()}})});function Gm(){}function Vm(e){for(var t in Gm.call(this),this.backgroundColor=new Fn(16777215),this.textColor=new Fn(24242),this.imageRotationSpeed=200,this.imageURL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAEyIAABMiAER9/n7AAAAB3RJTUUH4gUZDgMn9hBM7gAAIABJREFUeNrt3XdgVuXZx/HfdT8JYYmj2gLWih222rdD7XhrayvWOoAnAWuoA5IQFWtduLVqjbhwzw6oQBLUVuIgeQLVviraWtu3VdSOt9qlYh11KwJZz7nePxiKE8g64/v5q/1Dcs517vv8nuuM+5gAJFfNwuHy6NOSPiKLtg0Ko9z1Eck/KGmQpCGSBkgatvq/eE3y5ZKtXPW/9bzJH4+kxyR7XKbHFPwRzalYRnGBZDFKACTEgYUtNSDaVaadzW0XSTtLGtkLfymS9IjJ749cf5D7H9TW8aCaJnZwEAACHcCG2n1xibZd/jl5tKeZ8pK+Iin009askOw+d79DFu5Qw7gHOEAAgQ7g3Ry8aJhyneVmoVLyb2rVJfM4njr+afKFkXy+Gsrvk8w5eACBDmTb1MJgdeibIfJKN+0X3xB/N/5vk90SuTWpcdxvCHeAQAcyxE2TC18PQYe6tL+kgenYLT3q0lx511zN2+85jjNAoAPpdFDr5iqNKk06WtJ/pXhPO0zWHHlxlhor7qRrBwh0IB2mLNg1RLlpLq/QqtfIMsT/5h5mauDK2Zo18VUGA0CgA8lSVxf0+C5jLdKpMt+VgmiZSXOjktxlmj32CcoBEOhAvB3UurlKoqlmfpRkH6Ygb9NlUlOkcCmvvwEEOhA/NQuHBy+e4NJ3JQ2lIOvBdZfLz1VjxWKKARDoQP+qKnwkmJ/g0mFatdwqNjjY7T4PmqH6fIFiAAQ60Lcmt2wXgqa5NFVpee2s//3WzS5Q/bhWnowHCHSgd1Xf+rGg8AOXHSwpR0F6xR/c/Aeqr7iNUgAEOtCzpizYJkThRJcOl1RGQfqoY3c/nXvsAIEOdN/kWz4YciXHu+tYcWm9v05Vd7jsVJ6KBwh0YMMdWNgyDPDTVz+1TpD3PzfZTZHpB6rPP0I5AAIdeJ+O/PYhsvajzOw0yTelILETmev6KOo8Rdd9+xnKARDowLqmzixV+4gpJquTfAQFib0VZro66iw5X9ePeY1ygEAHMs9NNS37m9t5kj5BPRLnBXc/V0uH/VB3j+6iHCDQgSyqah5tZhdL2oViJN4j7jpVjeXNlAIEOpCZIF+4fbDoXJdXUozUudstd5zqxz5EKUCgA2l1yG1bhGLHye6aJt4lT7NVD86F3MmqH/ss5QCBDqTF2gfedJ6kLSlIZix380ukYTNUP7qNcoBAB5KsppA31+WSf4xiZNZSl52phnwjpQCBDiTN5OYvWLBLJX2dYmD1KW+x53Sc5uQfphYg0IG4O3jRh0NJ15kuHSopUBC8xar76wP8JF1b8R/KAQIdiF1HfvsQ5dpOMreTxXfJ8f5ed/NLtUnpBbp6TDvlAIEO9Le6uqDHdplk8gslDacg2ED/cPPvq76iiVKAQAf6rStv3dtCdJmkHSkGuulOt+g41Y//E6UAgQ70ldrmT1oxXCr5WIqBHlQ008woN+BMzd7nJcoBAh3oLTW3bhaUO5WFYdDLXnb3s7Wy/Ro1TSxSDhDoQE954z75RZI+REHQN/wht9wxqh/3a2oBAh3orqrm0Sa7XKbPUQz0k1YvyR2l2WOfoBQg0IENNWXBNqEYznPTZIqBGFjh5hezjCwIdGB9vfE++SmSBlIQxOy0+U+36DRecwOBDrwrN1W3TuZ9ciTEnS4dq4byv1AKEOjAGlWFL5n5FZK+QjGQoFNop8l/HHWVnKnrx7xGPUCgI8tBvnWQX+CmSYxHJNizLp2l7ZZcq7q6iHKAQEd2TC0MVpsfbaYzJA2lIEiJ+93tGDXmf0spQKAj5dxU07K/RXaxTNtSD6RykLuu42tuINCRXtWtu5iiKyV9lWIgA15x1wytbLtcTRM7KAcIdCRfbfPIULSz+D45stmv61GXjlNj+S8oBgh0JFPl/AEaVHaEmU2XNIyCIONaPdIxmlf+GKUAgY7kqGmuNLeLJI2iGP2qXdKKN/3/AZKGUJZ+s9LNL9Ly9gvVNHEl5QCBjviqat7Jgl0u1zcoRq95UdI/zfUPmf4RSU/J7Dl59LxyekFtued0w7iX3/NfqJw/QKWDhygXbaaSaISKYSuZj5TpQ0FhlLt/UtL2krag3L3A9YTLTlRj/iaKAQId8TL5lg+GUHKeS7XiPnlP6ZLrL2ZaErkvUc6XqL3kr+8b1j36A+2WD0il2yvoc8H9Cy59UdKOkko4PD0S7He5h2M1b9yfKQYIdPSvyvkDNGTQseY6XfJNKUi3LJN0r7vukexXCkMfjOVHQKYWBqs92kkWdjX30ZJ2E2sJdOuHm0k/iqx4luonvEI5QKCj71U3l5vsEkmfoBgb2YGbfuPui+Thbi0dukR3j+5K3F5MnVmq9uFfksJoM99Trq9JynF4N9jzbn66Rj04m9XmQKCjb9QUPmWRXyrTGIqxwV4y2Z2R1KpOK/Tp5fO+cshtW6jY/s0QWd5NFeINhw314OrV5u6lFCDQ0TuqbvlAsNzZLjtc3EPdwBDXrZH5jVrefpeaJhaz8+Nv8UDp9T1C5Ae4abykTRgO62XVanNR5ym67tvPUA4Q6OgZU2eWqn3kESavk7Q5BVkvy0xqjlw3amXbL1kpTFLl/EEaNKjcgh8o175a9Qod3mccufxcrWi/gjEEAh3d7Mpb9jXTpZJ2oBjv31XJ9Ct3m6My3aRZ+RWU5F0c1Lq5SosHmOxQSTtTkPcdWn9zt2msNgcCHRtuyoIdLQqXStqHYryvp8zUEHX5XF1X8Q/KsaFjrbBziKLDXHaQuN/+flrd7HjV5/9OKUCg470dWNgylPnZ7poq7pO/dzcu/Y/Lf6gV7QszdV+8t0y+fYhCx0STHylpFwryrjrM/cqoWHqurh/zGuUAgY51TZ1ZqvYRU0w6T9KWFORdvWbSzyPpKjWU/4Vy9JLq1l2CR8e62QGSl1KQd/Siu5+jle3X8IMSBDpWqSmMN/eLxPvk7+X/3HWVvOw6zdt7OeXoI1WFrUPw77nrMElbUZB3dL+H6FjNHX8fpSDQkdkgX/h58+gyyUdTjHedIovddInqx/1CMqce/TVWFw+UXq8x9xMkfZyCvI2b/IbIwylqzD9FOQh0ZMWBhS3DAD/TpSPFil7vJJK0yE3nqb78d5QjRurqgh7fZaxJp8v9yxTkbVa4+cV8zY1ARxa6HH/tOJOdJhb4eCdt5vppVJq7VLPHPkE5Yq668E2TnyLpWxTjbR536UQ1lN9MKQh0pC7MC3lzv0LSRynG27Sb1BC5TedyZRLHdst/r/o4kMZRjLe523M2TXPyD1MKAh2J72JadzEVL5dsN4rxNstNmh3l/ELNqXiaciRcVeErZv59gv1tInNdH3nXiZq333OUg0BH0tQ2jwxFO8ulQ8X3yd85yIudM1gnO4WmLNjVonAawf42r7hrhla2Xc4ysgQ6kmBqYbDa/GgznS7uk7/V6ybNiSx3gerHPks5Uq66+asmO1vSNynGm7ge9WDHqz6/iGIQ6IjnLDXVtOxvkV0s07bUYx3LzPSjKDfgIs3e5yXKkTFVha+Z/GyZ9qAY65z+7/DIjtG8cX+lFgQ64tWJXC7pixRjHa+42xUKXVeqfsIrlCPrwb5gT7NQJ+mrFGOtdjNdEQU/T3MqllEOAh39pebWUcFzF7pUybFcx0pzvyYqLZtBR463/wAu7GXyC8RX3t4cBc+4R6epsbyRBZQIdPSlybcPUa7tJHM7RdJACrJWZLKbI+s6WfUTHqcceHerb1F5uEDyj1GPtR5w+bFqqPgNpSDQ0Zvq6oIe22WSyS+UNJyCrDOU73CPTlBjxR+pBdbbGx8lOkfSBynIml87dlPkOlGN+aWUg0BHT6tqHm2myyT7PMVY59Rznwc7VfXjfk0xsNEq5w/VkLITze1kSYMoiKQ1y8hq2AzVj26jHAQ6umtS88dDLpzv8kqKsY6/uPnZqq9oohToMQcv+nAo6TrTpUPEdw7WeNJlZ6gh30gpCHRsjJpbNwvKnequaZLKKMhaS106TyvaZvMNaPSaKQt2DFGujh/S68TFYvdoGre1CHSsr90Xl2jbZbXc03ubF9x1iTYtuUJXj2mnHOgTqz4Ac5F4In6NVcvI5kpO0Nwxz1MOAh3v2pU372Nul0rakWKstdyli7Si7TI1TXydcqDP1dUF/Wung0x2Los2rfWSy36gJ4bO1N2juygHgY41pizY0aJwqaR9KMabOwGrj0qiM/lwCmLh6EVlerVrGssqr+PPLpumhvydlIJAz7ZDbtsidHbUuekISSUUZDXXXR5yJ6h+7EMUA7FTs3B4iKLz3LxGfPhozaS91XO5EzVn3L+oBYGeLZXzcxpcNtVk50j6AAVZG+SPuvnJaqhooRiIvSmFnS2KruDTxGu1memyqFh2vubtvZxyEOjpN7nlG2a6UqbPUYy1XnLXRTzwhmR27IW8uV8paTuKIUl62mWnqWHcPJaRJdDT6eBFHw65rvPdNIm6rx1+nSafG3XY6fpZ/gXqgcSqnD9Ag8qOMLPpkoZREEmme1zR0aof/yeKQaCnZaIP0qCBx5jpDElDKcharV7043RdxT8oBVKjtnlkKNpZLh0q7q9LUpdJP4rK2n6gWRNfpRwEenKtuhR3laRRFGOtBzzSCZpXfg+lQGpVt+5iiq6Q9DWKIUl61qWztN2Sa1VXF1EOAj05JrfuYCG6QtJeFGOtp1yazoQGP+oz7Q/udpQa87+nFAR6vB1Y2DIMiM5x2WFiHeg1Vrh0oVa0XaymiSspBzJnamGwOqKTze0kSYMpiIpmmhnlBpyp2fu8RDkI9Hh5Y7nW8yRtSUHWanUrHs23yQFJVYWtg/wCN02mGJKkl9x9ula2X8N3GQj0mEzS5tFmdrWkT1OMtR50C8fySVPgHaxaH/4qscTzGvd7FB2leeP/l1IQ6P1j0s0jQq7kYpcdRB3Xes7Nz9CoB2dznxx4D1Nnlqpt5NFmfpZ4zU1as9Szd56mefs9RzkI9L5RVxf02M6HmuwiyTelINLq98l/HFnxLNVPeIV6AOupZuHw4MWzec1trVfcvY7L8AR671v1KsqPJH2JYqx1p0vHqqH8L5QC2EiTm79guXCN3L9MMSRJD3jk39W8ivspBYHes6pu+UCwkhku1fIreq2/u+t4NZa3UgqgB1TOz2nIoMPM/VzxjQdp1aI0V0RRWR1rwxPoPaOmudLcrpH0QYohSVru5pdok9ILWHcd6AUHtW4eSqM6l44Ur79K0tNuPk31FU2UgkDfOJNbtrOc/1hue1MMSWseWgnhdNWPfZZyAL1sSmFni/waSV+hGNKqT7TqKM2peJpaEOjrZ/fFJdr2tWNNNl0sArHGA246QvXlf6AUQJ+GmKmqpcrMZkgaTj30irudpMZxs/mSG4G+Pr+IfyppZ4qxevLIztCKlT/hiVOgH02dv2loH3Suy48Ql+El2WJX12FqmPBPakGgv2WyzCxV24jjzTRd0gAKIpmsKSqNjta1Ff+hGkBMVDXvZGY/EW/aSNJKd52tlW2X0HAQ6KtUt+5i8rmSf4bhIEn6Pzc7UvX5uykFEEO7Ly7RqGVHmWu6pE0oiO53qYZXZ7Mc6HTlb7XCzS/m6XUgIWqbR4Yum8Ha8JJknW7R+Vrefk6Wu/VsBnpV805moYGufA2/1T1MU2N+KbUAEqa6udxkV0v6CMXQva5iTVbvrWcs0N1U1XKMmV1EVy5J+pfLj1FDxUJKASTYG59oPY1z2+p76x9dcnHWvimRnUCfdPMIy5U2SPoWs1/t5nZRtHLlBXyjHEiR2sLnrOg/kfTfFEO/dMtVZ2ndjGwEek0hb+6zJW2V+SHuusuVO0KNY//GfAdSqK4u6LGdDjfZ+ZI2y3g1nnPzatVX3EagJ93Ri8rCa8VLXH6kMv9Ev73q8pPVkP8pCzIAWWhkFg4PKl7hru9kvY0x6dJoRdvpaprYQaAn0cGLPmwlXU3i0pMk/cJDdLjmjn+SUgAZU9081mSzJI3MeCUe8KIfoOsq/kGgJ2oAF75p8p+JS+wvuvs0NVZcx1kNyLADC1uGAbra5QdkvBKvuVSrhvKbCfTYW/sU+yWSSjI+cFs954fzIQMAdOtvCQrTRdHyttPT9s56egJ9amGwtfk8mfbL+JR91s2PVH3FLZy9ALxjt17m13BvXbd5ZzhIN4x7mUCP2QC1Ab5A0lezPDpN1hR16Hv6Wf4FzloA3lNVyzgzzcx4t77UFfZTw7gHCPQ4mNy6g4VooaTtMjwon3TX4Wos/wVnKQB06xtkubsOUGN5K4Hen2oKu5v7LZI2z2xX7v7TqFh6oq4f8xpnJwAbpbrl2yb9SNIHM1qBLpeOVEP5LAK9P1QVJpj5z5XdZQ6fc/lhaqho4WwEoNumLNoqRMUfurwysw2SdF7UkD8zqWt1JDPQa5orzcP1kpdmdNz90nM+hSfYAfTO+dVmKaOrzJlrXrSy7dAkLkJjCRxsB5jbPGXztbSV7n6aGsuvYrU3AL13nr11lHnuOmX3QeNfuG2yn+pHtyVpo0OiSlxdmGJu12UyzF0Pe853UmPFlYQ5gF5VP+FxL3tmtJnOl5TF74vva75svirnJ+qWbnI69FWXgX6euB8hPXKQ/CeRDTsuab8WAaTA5JZvWPDrJPtwBve+1YeV7K+rx7QT6D3WmTd/3WS3SxqYscH0mrtNVWP+Rs4qAPrNlEVbWdR1naS9MrfvrkW+acl+SQj1+Af6lAU7WhTuVfZeTXvQiz4xzR8SAJCoZDNVFU4203mSclnaczPdGNXnD4z77c54X76uKmxtUbgta2Fu0rU+rOQrhDmAGJ2ZXI3lF7psb0n/ydRPGdd3QnXreXToG6ty/gAbPPAeZevzp+0uHZP0xQ0ApFxt80gr2nxl7Cl4d31XjeUz6dA3dMOGDLooY2H+lJt2J8wBxN6ciqd9RdseJmXqfGWma1TVsi8d+oZY9UT7/Az97vu1W8lE1Y99ljMFgESpKXzX3K9UdlbtfNlLcjtp9tgnCPT3HxyfMPf7JQ3LxC8+aW60ou27SVyVCABWnbdbdzOPmiR9KCOt+v/6gKd306zDO+O0WfG65F5XF8x9bkbC3N11etRQXkuYA0i0+nG/9hB9UdIfM7G/7l8OHcNnxG2z4hXo/9r5u8rGQxZt7nagGsvP50wAIBXmjn/Su0p2k/TLbGS6HaeaQj5WFw5isyUHL/qwlXT9JQPd+QseogrNHX8fZwAAqTN1ZmloG/kTN69N/87aM25dO6p+wit06G8uS0nX1ekPc3vGLdqDMAeQWrMO74wa84e4+zRJKf/uhI8IXhKbK63x6NAnt+5tIbot3cddj7psLzXmlzLjAWRCTXPt6k+xpnlluchDtFscGrUYdOhuFqK030te4t71dcIcQKbUV8xx6SDJOlO8l8GiMFNTZ5YS6FWtEyXtnOKDfa+Xte2hefs9x+wGkDkN5fNd0QRJK1O8l/+lthGH9fdG9O8l98r5ORs88M+SPpXSg/w7z/lemlOxjFkNINNWfTWzoNQ+K2XPeJk+rln5Fdns0AcPqkpxmP/ey9r2IcwBQFJDxa/cbayk5encQR+h9uiI/tyCfg10k09L6YF9yEsG7KtZE19lFgPAao35ez2oXCm9/G6yU1XbvEn2An1yyzckfTaFx/Qv7sU9NXufl5i9APAWc8vvcte3JaVxhcwtVVS/den9FugWdHQKD+ZTHqJ91bjfi8xaAHi3Tr38F+52gKSuFHbpR6hyfr+8ptc/gV5V+IikipQdx9c8Z2M1d/yTzFYAeL9Qz9/q0ndTuGejNGTQmOwEeoiqJZWk6AC2u1mF5uQfZpYCwHpqKJ9tptStQ2KKjsxMoJvbd9J08Nz9UNXn72Z2AsCGierzZ5jrhlTtlNteqil8Iv2BPrn1vyR9Oj2/xHS5GiuuY1oCwMa1eNGmJbUy3ZOmnQoeVaU+0EOIDkjRMVscPbHJyUxIAOiGq8e0e27AfpIeS02TLk1MfaD3x072kqUect/R3aO7mI0A0E2z93lp9ZPv7Slp+LZXzYLPpDfQawqfkvSJFByoTner1NwxzzMLAaCHNOZ/79Ixadmd4GH/9AZ6FO2ZhoPk7nVqzP+e2QcAPayhfJa5zUlFVkiVqQ10C5aGQL9XK9suZNYBQC/1fgN1tFyPpmBXdlDNraPSF+iV83NyfSPZx8ZedStOVtPEIlMOAHrJrPwKt3BwKr6j7iWj0xfoQwZ+UdJmiT4u0jGqn/A4sw0AelnDuAfcosQvOhPke6Qv0KOkd+e6Uw35RmYZAPSRx4edKynRzyu5lL4O3UxfTPAxaXezo5hdANCH7h7d5VJtwi+9b62qhdunq0OXdknsLyy3C1Sff4TZBQB9rKH8L+bRFYneByvulp5AP7CwpaRRCY3zv2nT3AxmFQD0j2hl+3RJif2SZTDtnJ5AL/XEXm53C6fo6jHtTCkA6CdNE19382mJzRHXTukJ9D76ddILfqP6/AJmEwD0s/qKWyT9T0K3/rOqnJ9LRaAH2X8l8leV/BRmEQDE5Jycs5MkRQnc9CEaOLjXH4zrk0B3+fbJGzm6RQ0Vv2EKAUBMzMk/bNJNidz24L1+pboPAt1NUtIC3d3DWcweAIiXyHNnSkrcVy6DfIfkB3ptywhJQ5NVeito3rg/M3UAIGYax/7N3OcmbrtNH09+oHfpk0mru4ciH18BgLh26SW5GZIS9U0Nd30s+YEuS9bldtM9mjv+PqYMAMTUnHH/kvzWhLXon0h8oIeELSjjsouYLQAQ9443XJywLd5UUxZtlewO3XybBFX8Xxr1wG1MFQCIucb87yXdnahtLhZ79T56rwe6y7ZOzO8ns5+qri5ipgBAErp0JW2N948ku0OXPpyQQneoJJrLFAGAhFi6yUJJTydme81HJj3QE9Ghm+lWXVvxH2YIACTE3aO7zFSflM0N7iOSG+hVt3xA0qAkFDqSz2Z2AECyRCHMluTJ6NAtwYEewsiEjIn/aHn7XUwNAEiYOeP+JdmdSdhUdyX4kruFrZJQZJM1qWlikZkBAMnjHl2XjA5dCe7Q3T+QhBpHZvOZEgCQUCFqltSRgC0dntxAV0hAoPu/Nep+vqoGAElVP+EVue5IwJZu1pvfRc98h26yW3j3HACSzYOaErCZpkElmyUy0IMU+0CPorCIqQAACdcRknHZPcptntAOXVvGvLTLlRtyDzMBABLuhnEvy3Vv7LezxJIZ6G7aPOalXaz60W3MBABIPje/PfYbWQxbJLNDl28a64Mv53I7AKRFLsQ/0HPFhF5ylw2NdWEj48tqAJAWc8b9UbJn4r2RIZkPxUk2LMb9+b81r/wxZgAApIW5mX4Z601077VGt7cvuce2QzfZrxn8AJAukSvuy3gPTmigK7YdemT2K4Y+AKRNV6wXCguWxEBftRpOfL+05k6HDgBp0zDhn7G+jx4lMdCHlG4S40P+krZb8ldGPgCkkPtv47txNiR5gR6VDIlvPf0PLPcKACnNc1l8L7sn8pK7dQ2Mb56HJQx5AEit2HboLk9gh65cbAM9chHoAJBWA/WwpGJMW8pee7asFwM9xDbQ5f4AIx4AUmpWfoWkv8Uzz700gYFejGugv6x5+ccZ8QCQXiZ7OJ4NpQYkL9CDlcX0MD8kmTPcASC9IveHYrppCQz0yGP5DrpJf2GoA0DKBX84pluWwEvuplh26JH0CCMdANIe6PojHXpP8bhecifQASD15pQ/I2kZgd4zHXpJLA9yLmKFOABIPXNJf4/hhiXxKXflYljI11b/agMApD3SpUcJ9J7gsQz0R3nCHQCyITKP47voIXH/sDx+l9xN9k+GOABkhIc4XnK35AV6HC+5mz/BCAeAjIhnh57AQA/xC/Qo0mOMcADIiBJfSqD3hBhecpcZgQ4AWXFt+XOS2gj07ovfJXcPjzPCASArzCX9m0Dvfocet0B3hcFLGeAAkCGuuJ336dB7wHOqH93G6AaADPXoFrdAtyQ+FOcxC3RnQRkAyFyHbk/GbYPo0Ltfw6cZ2QCQLZFFcWvmkhfowS1WT7mbiQ4dALLG9B8CvdsdsbjkDgDo51M/gd4TVYxVoEduBDoAZE2RQO+JfzleHXrwZxnZAJC1Dr30OQK9+/90vAK9aC8ysgEgY64f85qklQR6t34VxaxDL7VXGNkAkEnPE+jd2mQPsTqcXXqZMQ0AWWSvEuhpUszRoQNAJnmMAj2JK8V57230xsS5rt93GYMaADIpRud/dzr07nll9Vd3AAAZY/G65B4lMNCjOHXo3D8HgMzy1wj0VHXoAIBs5rnToXeLGR06AKD/E9QCHXpaGIEOAFkWo0A3HorrJi65A0BWWZzuoXsCO3RXfC65Gx06AGRWxFPu6TmWYtlXAMhuhy7uoXevQ/c4PRRHoANAZjv0KE4dOvfQu1k+VokDgMx26CV06Ok5mNFKRjQAZNSArjit5Z7ADj1W76GHNkY0AGRUaI9RBkRFOvRu1Y8OHQAyq2Or9hh16Im85E6HDgDof6Pu6YjNtjgPxXVzLwMdOgBkVV1dJKkrHg16Il9bi9M99IgOHQCyLSZduvGUe/d0EegAQKDHQBKXfrUYLSxTwiV3ACDQYxHo3EPv3l6206EDQKY5l9y7s9WxOY5lQwl0AMg0i8uT7txD71bxrt63g8EMAJlGoKdAW28utQcAINDTHejxWfqVy+0AgHgEOgvLdAtPuANA1nlM7qEnc2GZKCYdutGhA0DWmXPJPQU/y3ggDgAI9Lh8oIVL7t1QZCQDQMY5r611p3gxueTuXYxkAMi8uDR3XHLfeEaHDgCISY+ZxJXiLDYrxUWMIADIfJLGYz0Sczr0bqBDBwA647gsMJbEQI/N19YIdADIOpOnfTvo0AEA6CuJvIcem6fceSgOABCTe+jiHjodOgBg41s7Be6hJ/8oRgQ6ANChxyXQE3gPPS6vrUVccgcAWnTRoafgIBLoAIC49Oe70lkPAAAgAElEQVRJDHTjtTUAQEyC1OLy2hodehx/DQEAEhMGMbnknsilX+OxsIwZ99ABgDyPy8IyzsIy3UCgAwBi8sMiie+he1w+zsJrawCQecYl9xT8GjLuoQNA5jvjuGRBAi+5uzwePxbi8xlXAEDGmZK5lnvg0AEA4pGksWkyE7lSXEwC3enQASDzQi4mkZTEp9zp0AEAsZFL+w72YujG5PJGbD7jCgDotyhwz8VlS5LYoccjSHkoDgAQ6NCT36EDAOAxCXRP5ENxcQl0LrkDAOjQu/ErJCYPxRlPuQMAYhLoCV3LnUvuAIB4cJXQoW/8z5CYPOXOQ3EAkHmxeSguke+hc6kbABCbDp176DH9tzfk1xA/LAAAPOWe9EB3RQQ6AIAOfeOTlKVfAQAE+joS+ZQ776EDAGLD6dBj+m8DALAhkRSTDj0k8h56XDrjHAMZAOjQ6dCT36GXMZABIOt5zkNxaQj0AYxkAMg4i0lz50l8KM7jEuhOoAMABsZkO5L4lHtcPs4SCHQAoEUflPY9TP/Sr06HDgDweHTobqwU1w0EOgBkO8wtC1lAoAMA0q2yaaCU/i9v9uYl97h8PpVAB4AsGzYsPvfPE7n0a1y+h25GoANAlnn7wCzsZgYuufNQHABkWy5Ogc7Sr91AoANAlhWjQVnYzQwsLEOgA0C2hfh06IlcKc7iFOjOJ1QBILstOvfQY/xvb9hPi8qmUgY0AGSUe4yecjeecu9+lw4AyKZAh97Nn0Txucw9dOggBjQAZJUR6DH+tzdMZ+emDGgAyKooPoFuYi33bm7JJgxoAMhqgx7i09Ql8in3WAV6oEMHgMzyzbKwl9kIdI+GMaABIJuCbPMYbQ0devcCXQQ6ANCh06FvpBgt5mIEOgBkNc5d8enQjXvo3S0g99ABIKssTpfckxm6IT47GXjKHQCy26PH55I7T7nToQMANhodejdTlIfiAABx6Op4yr2bKRqbQHceigOAbKqrC5Jn4rZryMQB5ZI7AGTT458blpWsy0agc8kdALIplG4RrzxK5ENxFsWohHToAJBFHrNFZRL6cZY4+SCjGgAyKIrZE+7mXQkMdI9Thz5UUwuDGdkAkDEWxeuSe6QiHXp3rfQPMbIBIHMd+siY/cJIZKB7rGqYE4EOABkTgo2IV54n8pJ7zAI9ItABIHPcYxXokYkOvft76jwYBwBZy3PFrENXMgM9itdRjd1BBQD0Ohseq82JjIfiemBHt2FgA0DmevSt4/X7gnvoPbExH2FgA0CGVM4fpPh9aY0OvQcSfVtGNwBkyNAB20myeHXovLbWA0XURyQ3RjgAZKWRy42K3TZFibzkbh6zMg7SlF9syQgHgIyIPH6BnszX1jyKXSG7OrnsDgAZEcxieM7nKfeekdPHGeIAkBnbxXCbeA+9R7htz/gGgGxwefwC3Qj0HtpZJ9ABIBtxbpI+FbvNSuhDcV2xO7yiQweATKhq3UbS0Ph16Em8h+7eEb8jTKADQCZYDLtzKaErxZk641dJ31Q1C4cz0gEg5TzaIZ7bpfbkBbrUEdOD/FlGOgCkWwi2Q0y3rC2Bge7xDHTT5xjqAJDyBt19x3huWZTEQLfOOJYyeESgA0Ca1dUFyT4fz18aSezQPZ6B7nE9yACAnrF0p09I2oQOvcca9Jhecpc+ufqTegCANIq0U3w3riSJHbpWxLWaGjToM4x4AEinEGnnGP/aSGSHviK+R9t3ZcgDQDq5WXwD3TuTF+hmYXl889wIdABIo8r5Ocm+EN8NHNJr2ZjFS+5y+VcZ9QCQQoPKPiv5pjHduqLm7dVr2dib76Evj/EhH6maW0cx8gEgZSzsFuONe10yT1ygRxbrQJe8hC4dAFImSF+LcfC83sv73lvbHd9L7pIUXHsw9AEgXTzWga5lyQz0Xt7wbh90871Xfy8XAJAGtc2flHxEjLcwoR267JWYH/qtNXnhp5kBAJASXdon3htoCe3QzV+O/cEPxb2ZAQCQDha0b8w3MaGBXox/oJuMQAeANKicP0huX4915rheSGagl8b+krskfV1T52/KTACAhBtctoekmH+nI3oxmYHeWXw5AUOgTB0Dy5kJAJBswWxM3LcxkiU00Ac9n4RAl7kqmQoAkGB1dcFd4+MfOEm95D7r8E7F/NW11fbisjsAJNgTO+8uaWT8Az2pHfoqzyZgKJSprSzPjACAZApFPyARGxoltUOXJNPTSaixBU1iSgBAAk2dWepm+yXjl0eCA93cnklEkd2+xcdaACCBOkZ+S9IHkhHo0VMJ7tCjpxMyJEKISmqZGQCQLObRoQnZ0lc1pyKxa7krSkqHLsnNa1U5P8f0AICEmHTzCCmMS0jK/LvXO9Ne/kXyTIKGxtYaNHBfZggAJERJyaGSlyZka3v9inUvX3K3pUkaG2aaxgwBgASoqwsW2SGJyRe3J5Peof89YUPkm6pu3YWZAgAx99hO42TaNjkdY5TwDr1+7LNKxuIybxTEopOYKQAQ83yUnZyk7Y1MjyW8Q5ck/2eSiu6u/TWp+eNMFwCIqckt35D01URts+vRFAS6/pGwoZILJXYiMwYAYtqdB52auI0OpX9LfKCbW9ICXe5Wq5rCJ5g2ABAzNQs/L2nvhG31y5o75vnEB3pk9tfkjRgvDfJzmDkAELPu3IvTJVmyNtr+1hd/pvcvuUe2JImDxl0TeeIdAOLUnbfuJilxH9Myjx7ti7/T+4H+5JBHJK1M4g9BU3QBMwgAYtFmmXl0URK3PLLw53QE+t2juyT9KaEj6FuqKYxnIgFAP6tq/bak/07ktkfR/ekIdEkmX5LUMWTuV2ry7UOYTQDQT2oWDzTzpF4xdYXowdQEemRakuCh9JEQOn7AjAKA/hF82WmSkro+yD9UP+GV1AS6irl7kzyYXH68qpo/y7QCgD5WtXB7l05J6uabdH9f/a2+CfR54/6asC+vvVWJhTBLuy8uYXYBQJ+1U2ZW/KmksqTuQSR/IF2BLsncFyd7XPmXte2y7zPBAKCvuvPWQyR9PdH7EOme1AV6JFuc9LFl0pmavODLzDIA6GW1rR8180sTvhcv6mMP9tkzZH0W6LKuxSkYYiUWwnWqnD+U2QYAvWT3xSVWjK6TNCzZTaDdpbq6KH2B3jDhn5IeScFQ+3gYPPAKZhwA9FIwbbvsTElfSfp+RO539mnd+vbXit+UhsHm0iGqKhzKtAOAHlbd/FWX0vG8UpTiQI9y4aa0jDkzv0Y1LV9k9gFAD6lZONxkN0pKwxtFj+i6ij792mifBrrm5B9WOi67S1KZuW7WlEVbMQsBoJumziw175ovaes07I5LP+vrvxn6+g+a6ZYUDcFtLCreqMr5A5iNANCNMGoffpVku6Vmh8zmpz7Qo+CNq368pIWPDoMHzpbcmJIAsBFqmg9z2XfTEwt6WPX5Pr8a3eeBrjkVj0q6I01j0aVJobpwDrMSADY4zPcxDz9MVSaY39gffzf0z87aj9I2Jl06XdXNRzA7AWA9VbfuYm5NkpemZ6esU12l8zIT6Fq+siBpadrGpsmuUlVhArMUAN7H5JbtTFGrpFQt1GXSzbp+zL+zE+hNE4tu9uMUDtESM/+5qlr2ZbYCwLuF+S0fNNMvJA1P265FoXh1f/3t0G97vXzlNZKeS+FQHWCmW1XTvA+zFgDe4qDWzS2U/EKmT6Zw75Zo7vj7shfoTRNfd+nilA7ZMnO7SVWFrzF7AWC1Q27bwkqLd0naOY275+6X9+ffD/2697bJNZKeSunQHWLmt6lqwZ7MYgCZN3X+ptbVcZtkn0/l/rke1dJhP89uoNePbnPZBSkewkPMQkHVzWOZzQAyq+qWD1j7wDskpXa5bDedrrtHd2U30CWp7OlZkv6c4qE80BRuVXXLRGY1gMypbR5pVnKPpC+keC/vV0O+31dB7f9An3V4p4focElReo+1l5p0g6pbDmF2A8iMSc0ft6LdK+nTad5Nl50uWb+vgBpiUY254+8z009TPrRzJv1UNc11LBMLIPWqWz5tObtb0nYp39NWNeR/GYcNCXGpSKTiqZI9k/IDb+Z2VqguzNbUmaXMeACpVFPY3aRfKyVfTnuPU/qrnvPD47I1sQl01U94xU2HK1UfbnlnLk2x9hELdfCiYcx8AOkK85Yac79d0ubpP5f7yZpT8TSB/o6hni+YdEVGhv23rKTr15qyYBvOAABSEG8WalrOM9dcSen/pLTpHjXkY3WrOMStRtGKtlNl9r8ZmQGftSj8QTWtu3EyAJDcrnzxwFBT+Jm7vp+RPX7FQ6iNw4NwsQ50NU3scCtWSnoxIwPjQ+bRXapqOYWzAoDEqSpsbXr9bnd9JyN77O5Wqznj/hW/iwax/cVXGGPuzZJKsjIvzDQzWt52jJomdnCWABB71c1fN9l8SR/KzHna/eKoseLkOG5biG3V6vOL3HVUluaGuw63wQPvVG3zSM4UAGKtpuVoU7gjS2Eu6d5o6bDY3laI/fvQobpwvstPy9hU+Y/LDlZD/k7OGgBipXL+oDC47Ccuq8rYnj/mlttV9WOfJdA3vm+1UN1Sn8HB42a6KFredrqaJhY5iwDod7XNn7Quu1Gmz2Vsz190s6+pPv9IrBvg+NfRPFrRfpik1owNIHPXKTZ44CJNWbQVZxIA/aq6UGVFuz+DYb7CTePiHuYJ6dBXq5w/wAYPvElSPoNT6Sk3m6T6/N2cVQD0qcm3Dwmh/RqXajK490U3m6D6fCERXWCiSls5f4ANHtQkeXkGB1ZksgujsqfP0qzDOznLAOh1Vc2fNbOfS9ohg3vf5VKVGsp/lpQNTt5HQqbOLLX2EfMljc/oFLvfzQ5Sff7vnG0A9A43VRcOM+lySYMz2ZnLqtWQvz5JG53Mr37tvrgkbLvshy5NzehsW+nup6mx4kpOPAB6VM3C4ebFOZL2zWgFOtztADXmb03ahif4M55uoar1bDc/M8O/om/yUPo9zR3zPGchAN0P8+ZKc/uJpC0yWoE2d1WqsTyRD2En/7vcVYVDzfzHytCKcm/xvJsfqfqKJs5GADYuyG/dLHi4MoOvB7/Ziy6vUEPFb5K6A5aOwVgYY+43Shqa1ZFo0vwolBxFtw5gw5qilgoz+7HkIzJchb+72dikP5tkqTkctc2ftKLdqmw+jUm3DmDDHNS6eSiNZmT4WaQ1fuehpDwNzZCl6rDU3LqZRbnrZRqT5dFJtw7gvc+VzQeY21WSMr1olbluiMImh6h+dFtKzv1p46aqwslmOl+JWAmv1zznbkeqMX8TZy8Aq4J84XCLij+Uab+MV6LLXWeosfzClDVzKVVVmGCmuZJvmvluvcOO1M/yL3A2A7LKTdWtNSa/TNJmGS/Gs25hourH/TqF5/sUO2ThttYZ3SDzXTM+gOnWgaw6ZOG21lWcJWkviqHfeM4nak7F0ylt4FJu6szS0D7yXJeflIn9fc+DbU1RseNYXfftZ5jXQMrV1QU9tssRJp+hDL8BtJqb+eXRgGdPTfPS2dkJuMmte1uIGiR9KNvj2l519+/ro0t+orq6iLMekMrz3Q4WijMl241i6FmPQo3mjbs9/U1blqxa0nCupH0Y4/q9W+5w1Y99iFIAaQny24cEaz/DzU6QvJSC2EKPOms1b7/nMrG3mTzG1YUqk18jaZOMj/Yuk34U5fwMzalYxuQHktywFPLmfpWkURRDbe6q00eXXJylK5HZvadc2/pRKxbruSQlSXrSXUersbyZUgBJ68pbtrOgqySNoxiSpCVuUY3qx/8paztu2T7umf9E4Fu1eknuKM0e+wSlAGJu6sxStQ3/npmdKx56k6QuM10aLW/7gZomdmSxAMYYkDRlwY4WhbmSvkQx9Lq7naWlQ6/S3aO7KAcQQ1UL9jSFa2T6JMWQJH/Ic6FGc/IPZ7kKBPoadXVBj+18qEmX8mtXkvRHNx2u+vLfUQogJibdPCKE0gvdNInzN105gf5+als/asVolqRvUgxFJv9xVNZ+umZNfJVyAP1k98UlGrXsKHOdLWkYBZEk3e+WO4w3dQj09+GmmpYp5naJpM2ph/7jplNVn2+QzCkH0IemLNjViuFHMn2OYkiSXnfTmVredrWaJhYpB4G+fibdPMJyJVdJtj/FkCT9zhWOUsO4BygF0Mtqm0eGLpvB5fV1Imuhu76nxvxSakGgb5zq5rEmu0a83ylJkbmuj7zrxKws1gD0qTeeXp8uLq+v8R+XnayGfCOlINB7YJIVBocO/4G7Hc8KTJKkl1x+hla0z+KyF9BDqloqzOxSyT9GMVY3ELKZkXV9X/UTXqEcBHoPT7iF25uKP5ZpD4ohSf6Qezhajfl7qQWwkWqbP2lddplMYyjGWg+66Xu8aUOg93aImapbJ5v8UklbUg+5yW6KQvEEzR3/JOUA1lPNrZsF5U5113GSBlAQSdIr7l6nle3XcPWPQO87UxZtFaKu812qlRQoiF5zt7M18Omr0/yJQqDbKufnNGjgoWY6l6bgzY2BGqKo6xSezyHQ+/FXdssXzXWNWGlujf9z2TFqyN9JKYC3qG7+uklXSvZ5irEmyvWwy47i1h2BHp8fl6suw18s6YPUQ5LU6lY8WvUTHqcUyLyqwtZBfgGvoa3jJXefzuV1Aj2eDmrdPJQWz3HZdyXlKIhWuPnFGhAu0qz8CsqBzKmcP0iDBp1s5ieLj0Ct0WWuH0dd4SzdMO5lykGgx1tt4XNWjK7m86xrPeXSdG235NosfZ8YWeammpb9ze0isYbFm2NnsVvx2Cx+3pRAT7qaQt7cfyhpG4ohSfqDh2ia5o6/j1IgtSYv+LJZ7jKZ70ox1nrSZWewOAyBnvDJffsQ5dpOMrfTxKspq1sXuykqCSfx7XWkSlXhI0F+LvfJ17HqtpuGzVD96DbKQaCnZLIv3N6seKWkfSjGqolupquj5W3nqmni65QDiXVQ6+ZhQHSKu6ZJKqMga7V6Se4ofrgT6Om16jL8VeK+2pqG/d+ucLoaxs3ja25IlKkzS9U+YopJ50raioKs9aBbOFb1435NKQj09Jt8+5AQ2k9z6QRJAymIJOleV5jG19yQkB/m4839IkmfoBhrPe/mp2vUg7N5+JVAz2Cwt2xnpktk2o9iSJIikxqiYufpuu7bz1AOxE516y5m0aVyfYNirI2STpP/MLLi2XxEhUDHlJY9LLIrJP8MxZAkLXP5BbJhl/MgDWLh4EUfDiWd57lskljq+c1aPecnak7Fo5SCQMcauy8u0UeWTTXTdEkfoCCSpKVuOkOjllzPJTz0i9rmTUJXOMnNTxALw7w5Pv7kFp2g+or/oRYEOt7NG0/M8gWmN/yfm9epvqKJUqBPvPHA29mShlOQtV5093O0dNgPdffoLspBoGP9OoNPWtEul7QvxVg7ZO/woFM0N7+EWqBX1NUFPb7Tt83DBZJ/jIKsnXudJv9xVNb2A82a+Cr1INCxMWoKeXNdzsllrVUL0+TsVM0Z9y/KgR5TtWBPM7uYL6G9TaurOE0NE/5JKQh0dNfUmaVqG/49M5suaRgFkSR1mFQfhZIzNHfM85QDG23ygi9bCDMk7U4x1vGgRzpO88rvoRQEOnrapJtHhFxpnUuHiidt13jZXRcqbHIlT8Rjw4K8dYcQ/GyX78/5cJ1oeMbldVrRNpvPmhLo6PUTUfMXzMKVfPxhHU+6dC4nIbyvKQu2CVE4w6VDxGeO36zDpJ9EXSVn6voxr1EOAh19xk1VLVVm4QLJR1CPtR508++rvuI2SoF1HFjYMgzw77v0PbHm+ltOJnZjVBJOZd11Ah39qXL+0DBo4OluOo6T1Dp+6+Zn8Z4sdMhtW4TOzmlufqx4BuUtKWD/65GOU2P+txSDQEdcTFmwTSiG89w0mWK8NdjtAtXnC5QiY6pu+YBC7mhzO1bSZhRkHU+5NF3bLbmWRZsIdMQ22FlG9h253edBMwj2DDiwsKXKoqPMwzTJN6Ug6+CzxQQ6EmX3xSXadlktn3V8R79x2VlqyN9JKdL2Y3bRVvLOI83tOHFp/e0/aWU3RSXhJO6TE+hIooNaNw+lUd3qh4BKKMhbgt39TDVWLKYUCTf5lg+GXMnx7jparLf+Tn7vITpOc8ffRykIdCRdTeFT5n65pH0oxjsEu9kZqs/fTSkS5tDmD4UuO85dx0gaREHe5kmXnaGGcfMkc8pBoCNNqlu+bdLFkrajGG+bDne4RRfxVHwC1LZ+NBT9RJfXijc73slrbnaBNPQKFlsi0JFmlfMHaFDZEWZ2jqRNKMhbuB52s8v0xNAb+JpUzEwp7ByKPs1NB4pbSO8kMtf1UcidrPqxz1IOAh1ZUVXYOlh0ocsOYiy8o3+561KtbJurpokrKUc/qasL+tfOeTM/QbLdKMi7/hC9y0vseM3JP0wxCHRktutZsKtF4UpJX6AY7+hFc/00ykU/0tzxT1KOPlLbvImKocoUHSPZ9hTkXf3dXSepsbyZUhDogCQ3VbdONvmFkoZTj3cUSVrkHl2pxvF3UI5eUlP4RJAf4q6pkjanIO/qFXfN0KYlV+jqMe2UAwQ61nXwomEh13mGmx0raQAFeVdL3PyHKg68UfP2Xk45umn3xSUa9fo4cz9K0h6cm95Tl5lmRe12ln6Wf4FygEDH+3ZJ5n6ZpHEU4z29ZqafRUW/VvMq7qccGzzOPhXkNe5WxQeG1sttHqITNHf8/1EKEOjYMFUt+5r5FdzDXB/+kCtcK+/8uRr3e5F6vIva5k1UtIkmTZH0VQqyXv7q5sfzBUEQ6OieqTNL1Tb8e2Y2XSynuT6Kki12aZ5WrLyF9bIlHb2oTMuKe4XIK900QdJQhsl6edldF2pl2+VqmthBOUCgo2dMunlECKUXumkSY2e9vW7y5sjCjVq+8o5Mvf5WOX+AhgzaM0R+gJsq+DG4QbpMPjPy4llc7QGBjt4zufkLFuxqSf9NMTbISkl3ulRQsbOg6779TOr2cNXnSvcIkeXdlBefLN1wrrtcfpwaK/5IMUCgo/fV1QU9vtMh5nae+JrbxihK+q273SHpTg18+n816/DOxO3F1Jmlah/+Jcl2N2mspC9LChzejfJ3NzuBz/uCQEf/qLl1s+C5s/maW7ctl/m97rpLHu6TD3gwlq/DTS0MVpt2lvk3TPqGpF0lDeHwdes0/KrLz9WKtqu4Tw4CHf2vuuXT5rpKpj0oRo918H816Q+R636F8CcVOx7VvP2e67MtmLJoK3V17aicdgqRdnbTzpI+JSnH4emZY2zS7CjqOrNPjysIdGC9VBX2N/klMm1LMXrFK5L+ZtLf5PZYpOg5mT0jt/8o6D/qsBc01Ns1K7/i3bvsmaXq3GYzqWMrRbalZFvJ9aEQtLVcH3fp45J9TPJNKXevudstd5zqxz5EKUCgI74q5w/SkLJTzO1k8Y3q/rRS0ps/nbmJuC3S3x5z6SQ1lN9MKUCgIzkOXvThkOs6302TKQYybrmbXyINm8H3yUGgI7lqCrub6yrJP0MxkDFuspsi14lqzC+lHCDQkXy7Ly7RtstqTTpP0pYUBBnwe3ebpsb8bykFCHSkzyG3bRG6Os5y6UjxtDTS6SmXfV8N4+ZJ5pQDBDrSrap5JzO7WnycA+mxwkxXR8vbzmX9fhDoyBg31bTsb26XStqGeiC5A9luikrCSZo99gnKAQId2TX59iHKtZ1kbqdKKqMgSJAHVt8nv5dSgEAH1pjU/HHL2eWSxlEMxNzTLp2t7ZZcq7q6iHKAQAfeSdWCPc3CVZJ2oBiImQ6TfhLl/AzNqVhGOUCgA+9n6sxStQ3/nplNF9/RRjy0eqRjNK/8MUoBAh3YULXNI0OXzXDTJMYr+smDLp+mhopfUQoQ6EB31bR80WRXy/3LFAN95EV3P0cr269R08Qi5QCBDvSUurqgx3aZZPKLJX2QgqCXToudJv9xVNb2A82a+Cr1AIEO9JZDbtsidLVPd9nh4uth6FkLvOgn6bqKf1AKEOhAX5nc+l8W/HLJ96QY6KY/uux4NeTvpBQg0IH+suo1tyskfZpiYAO94O7ncp8cBDoQF1Nnlqp9xBS+5ob1tGrd9c6S83X9mNcoBwh0IG7e+Jrb98T9dbzdqnXXretk1U94nHKAQAfirqbwKYv8UpnGUAys9jt3O57vk4NAB5Jo1f31KyXtSDEy6+9ufrrqK5ooBdIsUAKkWuP4O7zsmc+7+zRJr1CQTHnJXaf6sJLPEOagQwfShPvrWTmtdZp8btRhp+tn+ReoBwh0IK1qCp8y98sk7UsxUqfVVZymhgn/pBQg0IHsBHve3GeI++tp8DuXn6iGit9QChDoQBa9sT78BZJGUpDEecTNf6D68pskc8oBAh3IuqmFwWrzo830ffH99SR4yqXpemKTObp7dBflAAh0YF0HFrYMZX6iu46TNICCxM7L7rpQK9uuUtPElZQDINCB91a1cPtg0dkunyhe74yD5ea6OuoKF+mGcS9TDoBABzZMdcung+wsl+/PfOkXHSbVR8XOOl337WcoB0CgA91T0/LfFuk8mfagGH1yalr1LrnbdDXmn6IeAIEO9HDHXtjLTNPl/mWK0Su6zK0xKg3TNXvsE5QDINCB3lVV+JrJz6Zj7zEd5roxUu5cNY79G+UACHSg74Pd/BRJ4yjGRllu0uyoq+RiXT/m35QDINCB/lXTupt5dIakvSjGennF5NdEHeFK1lsHCHQghh1782eD2ZEuVUkaSEHe5jF3zVRXmMXrZwCBDsTfoc0fUpeOMLejJW1BQfSAy67SE0NvYGU3gEAHkqe2eRMVwxSTf1fSDhnb+3aT3xRFukLzKu5nMAAEOpAO1a27BEVTXZokaXCK9/QRd9UrVzJHc8c8z4EHCHQgnQ4sbKkBUbXJpkj6dEr26nWTboxM16q+/HccZIBABzLWtbd8WuaV5naQpE8kbOvbJN3hsiatWHmLmia+zgEFCHQg495hA0kAAADFSURBVNw0uflLIYTvuHysZNvHdEOXyfU/HrxJxYEFzdt7OccOINABvJvJLdsp6FtBtqfLvyVps37akqKkh8x0RxRFd2hlx6/UNLGDAwQQ6AA21NSZpWrf+rMy/2KI9EU3fVHyHSXlev5CgZ6Q9ICblsj8AQ1o/61mTXyVgwAQ6AB6pYO/fYisbXsFbacojAqm7Vw+StJwrXqCfrCkTSUbKrlLWi75csk6JL0q6XmTlkbmS+XhCUX+hKzrz2rc70WKCyTT/wNg/R4EjK5AQAAAAABJRU5ErkJggg==",e){var n=e[t];switch(t){case"container":void 0===n?this.container=document.body:n instanceof HTMLElement?this.container=n:this.container=document.getElementById(n);break;case"textColor":this.textColor=n;break;case"backgroundColor":this.backgroundColor=n;break;case"imageURL":this.imageURL=n;break;case"imageRotationSpeed":this.imageRotationSpeed=n}}var r=["background-color: "+this.backgroundColor.getStyle()+";","position: absolute;","z-index: 1;","height: 100%;","width: 100%;"].join("\n"),i=["position: absolute;","top: 50%;","left: 50%;","margin-top: -75px;","margin-left: -75px;","width: 150px;","height: 150px;"].join("\n"),a=["width: 150px;","height: 150px;",'background-image: url("'+this.imageURL+'");',"background-repeat: no-repeat;","background-size: 150px;"].join("\n"),o=["color: "+this.textColor.getStyle()+";","text-align: center;","position: absolute;","top: 50%;","left: 50%;","margin-top: -18px;","margin-left: -43px;","min-width: 90px;","font-size: 30px;","font-family: sans-serif;","font-weight: bold;"].join("\n");this.text=document.createElement("div"),this.text.setAttribute("style",o),this.text.innerHTML="0%",this.gear=document.createElement("div"),this.gear.setAttribute("style",a),this.gearCont=document.createElement("div"),this.gearCont.setAttribute("style",i),this.background=document.createElement("div"),this.background.setAttribute("style",r),this.background.appendChild(this.gearCont),this.gearCont.appendChild(this.gear),this.gearCont.appendChild(this.text),this.container.appendChild(this.background),this.clock=new Zu;var s=this,l=function(){0<s.imageRotationSpeed&&requestAnimationFrame(l);var e=s.clock.getElapsedTime()*s.imageRotationSpeed;s.gear.style.transform="rotate("+e+"deg)"};l()}Object.assign(Gm.prototype,{onUpdate:function(e){},onFinish:function(){}}),Vm.prototype=Object.assign(Object.create(Gm.prototype),{constructor:Vm,onUpdate:function(e){e=Math.round(e),this.text.innerHTML=e+"%"},onFinish:function(){this.container.removeChild(this.background),this.imageRotationSpeed=0}});function jm(){}Object.assign(jm.prototype,{_logicFileLoadError:function(e){var t=new Error(e);return t.name="LogicFileLoadError",t},_editorLoadError:function(e){var t=new Error(e);return t.name="EditorLoadError",t},_getLogicPromise:function(n){var r=this;return new Promise(function(e,t){xf.loadScript(n,document.body,function(){e()},function(){t(r._logicFileLoadError("Unable to load the logic file: '"+n+"'."))})})},_getEditorPromise:function(n,e){var r=this;return new Promise(function(e,t){xf.loadScript(n,document.body,function(){e()},function(){t(r._editorLoadError("Unable to load the Puzzles Editor: '"+n+"'."))})})},_getLogicViaEditorPromise:function(i,a){var o=this;return new Promise(function(t,n){if(v3d.PE){var e=a.split(".");e[e.length-1]="xml";var r=e.join(".");v3d.PE.init(i,r,function(e){e?t():n(o._logicFileLoadError("Unable to load the Puzzles Editor's XML logic file: '"+r+"'."))})}else n(o._editorLoadError("Unable to load Puzzles' logic. The Puzzles Editor isn't loaded."))})},loadLogic:function(e,t,n){this._getLogicPromise(e).then(function(){t&&t()},function(e){console.error(e),n&&n(e)})},loadEditorWithLogic:function(e,t,n,r){var i=this;i._getEditorPromise(e+"puzzles.min.js").then(function(){return i._getLogicViaEditorPromise(e,t)}).then(function(){n&&n()}).catch(function(e){console.error(e),r&&r(e)})}});var Xm={createMultiMaterialObject:function(e,t){for(var n=new ao,r=0,i=t.length;r<i;r++)n.add(new Ei(e,t[r]));return n},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(e,t,n){e.applyMatrix((new Qt).getInverse(n.matrixWorld)),t.remove(e),n.add(e)},getMaterialByName:function(e,t){var n=this.getMaterialsByName(e,t);return n.length?n[0]:null},getMaterialsByName:function(e,t){for(var n=[],r=0;r<e.materials.length;r++){var i=e.materials[r];i.name==t&&n.push(i)}var a=e.worldMaterial;return a&&a.name==t&&n.push(a),n},getAnimationActionByName:function(e,t){for(var n=0;n<e.actions.length;n++){var r=e.actions[n];if(r.getClip().name==t)return r}}};function Wm(e){Ei.call(this),this.type="CubeTextureHelper",this.geometry=new Hr(2,2,2,1,1,1),this.geometry.computeBoundingSphere(),this.material=new Ai,this.material.envMap=e}function Hm(e){ur.call(this),this.projected=new Kt,this.container=e,this.updatedCallback=null}function Ym(e,t,n){Hm.call(this,e),this.type="Annotation",this.character=t,this.text=n,this.annotation=document.createElement("div"),this.annotation.innerHTML=t,this.annotation.setAttribute("class","v3d-annotation"),this.container.appendChild(this.annotation),this.annotationTextVisible=!1,this.annotationText=document.createElement("div"),this.annotationText.innerHTML=n,this.annotationText.setAttribute("class","v3d-annotation-dialog"),this.annotation.appendChild(this.annotationText),this.fadeObscured=!0;var r=this.obscured=!1,i=this;function a(e){e.target==i.annotation?0==i.annotationText.innerHTML.length||i.obscured||(i.annotationTextVisible=!i.annotationTextVisible,i.annotationText.style.visibility=i.annotationTextVisible?"visible":"hidden",i.annotationTextVisible?i.annotation.style.zIndex="1":i.annotation.style.zIndex="auto"):"v3d-annotation"==e.target.getAttribute("class")&&(i.annotationTextVisible=!1,i.annotationText.style.visibility="hidden",i.annotation.style.zIndex="auto")}document.body.addEventListener("touchstart",function(e){a(e),r=!0},!1),document.body.addEventListener("mousedown",function(e){r||a(e),r=!1},!1)}(Wm.prototype=Object.create(Ei.prototype)).constructor=Wm,Hm.prototype=Object.assign(Object.create(ur.prototype),{constructor:Hm,isAnnotationControl:!0,clone:function(){return new this.constructor(this.container).copy(this)},update:function(e){var t=this.projected;this.getWorldPosition(t).project(e);var n=this.container.offsetWidth,r=this.container.offsetHeight,i=(.5+t.x/2)*n,a=(.5-t.y/2)*r;t.x=i,t.y=a;var o=t.z<=1&&0<=i&&i<=n&&0<=a&&a<=r;this.visible=o,this.updatedCallback&&this.updatedCallback(t.x,t.y,o)}}),Ym.prototype=Object.assign(Object.create(Hm.prototype),{constructor:Ym,isAnnotation:!0,raycast:function(){},clone:function(){return new this.constructor(this.container,this.character,this.text).copy(this)},update:function(){var i=new Co;i.params.Mesh.omitGeometry=!0;var a=new Kt,o=new Kt,s=new Kt;return function(e){Hm.prototype.update.call(this,e);var t=this.projected,n=this.annotation;if(n.style.transform="translate("+t.x+"px, "+t.y+"px)",n.style.visibility=this.visible?"visible":"hidden",this.annotationText.style.visibility=this.visible&&this.annotationTextVisible?"visible":"hidden",this.fadeObscured){e.getWorldPositionNU(a),this.getWorldPositionNU(o),s.copy(o).sub(a).normalize(),i.set(a,s),i.far=a.distanceTo(o);var r=i.intersectObject(this.findRoot(),!0);1<r.length||1==r.length&&r[0].object!=this.parent?(n.style.opacity=.25,this.obscured=!0,this.annotationText.style.visibility="hidden"):(n.style.opacity=1,this.obscured=!1)}}}()});window.THREE=v3d;var qm=document.createElement("style");qm.appendChild(document.createTextNode(".v3d-container {\n \n overflow: hidden;\n}\n.v3d-canvas {\n \n position: absolute;\n}\n.v3d-annotation {\n position: absolute;\n top: -26px;\n left: -26px;\n width: auto;\n min-width: 14px;\n height: 26px;\n padding: 2px 8px;\n border: 1px solid #fff;\n border-radius: 18px;\n font-size: 16px;\n font-family: sans-serif;\n line-height: 26px;\n color: #fff;\n text-align: center;\n user-select: none;\n background: rgba(0, 0, 0, 0.8);\n}\n.v3d-annotation-dialog {\n position: absolute;\n top: 0;\n left: 0;\n margin-left: 25px;\n margin-top: 25px;\n font-family: sans-serif;\n user-select: none;\n padding: 1em;\n min-width: 200px;\n color: #fff;\n background: rgba(0, 0, 0, 0.8);\n border-radius: .5em;\n font-size: 12px;\n line-height: 1.2;\n transition: opacity .5s;\n visibility: hidden;\n}\n.v3d-webgl-error {\n background-color: white;\n position: absolute;\n width: 50%;\n left: 25%;\n text-align: center;\n border-style: solid;\n border-width: 3px;\n border-radius: 8px;\n border-color: black;\n top: 5%;\n font-size: 20px;\n font-family: sans-serif;\n padding: 10px;\n line-height: 30px;\n z-index: 10;\n}\n")),document.head.insertBefore(qm,document.head.firstChild),e.WebGLRenderTargetCube=bn,e.WebGLRenderTarget=_n,e.WebGLRenderer=Fo,e.ShaderLib=Un,e.UniformsLib=Dn,e.UniformsUtils=Nn,e.ShaderChunk=Pn,e.FogExp2=Oo,e.Fog=Io,e.Scene=Do,e.Sprite=ko,e.LOD=Go,e.SkinnedMesh=Xo,e.Skeleton=Vo,e.Bone=jo,e.Mesh=Ei,e.LineSegments=Yo,e.LineLoop=qo,e.Line=Ho,e.Points=Zo,e.Group=ao,e.VideoTexture=Ko,e.DataTexture=wn,e.DataTexture3D=ki,e.CompressedTexture=Jo,e.CubeTexture=zi,e.CanvasTexture=$o,e.DepthTexture=es,e.Texture=yn,e.CompressedTextureLoader=sc,e.DataTextureLoader=lc,e.CubeTextureLoader=uc,e.TextureLoader=hc,e.ObjectLoader=gu,e.MaterialLoader=su,e.BufferGeometryLoader=cu,e.DefaultLoadingManager=ic,e.LoadingManager=rc,e.JSONLoader=vu,e.ImageLoader=cc,e.ImageBitmapLoader=wu,e.FontLoader=Su,e.FileLoader=oc,e.Loader=mu,e.LoaderUtils=lu,e.Cache=nc,e.AudioLoader=Yu,e.SpotLightShadow=Gc,e.SpotLight=Vc,e.PointLight=jc,e.RectAreaLight=Yc,e.HemisphereLight=zc,e.DirectionalLightShadow=Xc,e.DirectionalLight=Wc,e.AmbientLight=Hc,e.LightShadow=kc,e.Light=Bc,e.StereoCamera=qu,e.PerspectiveCamera=oo,e.OrthographicCamera=dr,e.CubeCamera=Qu,e.ArrayCamera=so,e.Camera=hr,e.AudioListener=Ku,e.PositionalAudio=$u,e.AudioContext=Hu,e.AudioAnalyser=eh,e.Audio=Ju,e.VectorKeyframeTrack=iu,e.StringKeyframeTrack=ru,e.QuaternionKeyframeTrack=nu,e.NumberKeyframeTrack=eu,e.ColorKeyframeTrack=$c,e.BooleanKeyframeTrack=Jc,e.PropertyMixer=th,e.PropertyBinding=zh,e.KeyframeTrack=Kc,e.AnimationUtils=qc,e.AnimationObjectGroup=kh,e.AnimationMixer=Vh,e.AnimationClip=au,e.Uniform=jh,e.InstancedBufferGeometry=Xh,e.BufferGeometry=Wr,e.Geometry=wr,e.InterleavedBufferAttribute=Bo,e.InstancedInterleavedBuffer=Wh,e.InterleavedBuffer=Uo,e.InstancedBufferAttribute=Hh,e.Face3=pr,e.Object3D=ur,e.Raycaster=Co,e.Layers=Gn,e.EventDispatcher=t,e.Clock=Zu,e.QuaternionLinearInterpolant=tu,e.LinearInterpolant=Fl,e.DiscreteInterpolant=Zc,e.CubicInterpolant=Qc,e.Interpolant=Rl,e.Triangle=Si,e.Math=Yt,e.Spherical=Yh,e.Cylindrical=qh,e.Plane=Tn,e.Frustum=Sn,e.Sphere=Mn,e.Ray=Ti,e.Matrix4=Qt,e.Matrix3=Jt,e.Box3=An,e.Box2=Qh,e.Line3=Zh,e.Euler=kn,e.Vector4=xn,e.Vector3=Kt,e.Vector2=qt,e.Quaternion=Zt,e.Color=Fn,e.ImmediateRenderObject=Kh,e.VertexNormalsHelper=Jh,e.SpotLightHelper=$h,e.SkeletonHelper=ed,e.PointLightHelper=td,e.RectAreaLightHelper=nd,e.HemisphereLightHelper=rd,e.GridHelper=id,e.PolarGridHelper=ad,e.FaceNormalsHelper=od,e.DirectionalLightHelper=sd,e.CameraHelper=ld,e.BoxHelper=cd,e.Box3Helper=ud,e.PlaneHelper=hd,e.ArrowHelper=dd,e.AxesHelper=pd,e.Shape=Uc,e.Path=Dc,e.ShapePath=Au,e.Font=Mu,e.CurvePath=Ic,e.Curve=dc,e.ImageUtils=vn,e.ShapeUtils=Gs,e.WebGLUtils=io,e.FlyingControls=ip,e.OrbitControls=ap,e.Keys=rp,e.EquiCube=op,e.PMREMCubeUVPacker=sp,e.PMREMGenerator=lp,e.GraphUtils=Ml,e.Detector=up,e.XZ=yf,e.App=Pm,e.AppPuzzles=Om,e.AppUtils=xf,e.CSVParser=Bm,e.LineHTML=km,e.MeshLine=Df,e.MeshLineIndexed=kf,e.MeshLineMaterial=Gf,e.Preloader=Gm,e.SimplePreloader=Vm,e.PuzzlesLoader=jm,e.SceneUtils=Xm,e.CubeTextureHelper=Wm,e.Annotation=Ym,e.AnnotationControl=Hm,e.BokehPass=Tf,e.BrightnessContrastPass=Mf,e.EffectComposer=Lf,e.FXAAPass=Cf,e.GrayscalePass=wm,e.MaskPass=Sf,e.ClearMaskPass=Ef,e.OutlinePass=Am,e.Pass=_f,e.RenderPass=Mm,e.ShaderPass=Af,e.SSAOPass=Lm,e.RenderUtils=Sm,e.SceneBackground=Em,e.BlenderCubeTextureLoader=Nf,e.GLTFLoader=jf,e.RGBELoader=Of,e.XZLoader=Ff,e.WireframeGeometry=ts,e.ParametricGeometry=ns,e.ParametricBufferGeometry=rs,e.TetrahedronGeometry=os,e.TetrahedronBufferGeometry=ss,e.OctahedronGeometry=ls,e.OctahedronBufferGeometry=cs,e.IcosahedronGeometry=us,e.IcosahedronBufferGeometry=hs,e.DodecahedronGeometry=ds,e.DodecahedronBufferGeometry=ps,e.PolyhedronGeometry=is,e.PolyhedronBufferGeometry=as,e.TubeGeometry=fs,e.TubeBufferGeometry=ms,e.TorusKnotGeometry=vs,e.TorusKnotBufferGeometry=gs,e.TorusGeometry=ys,e.TorusBufferGeometry=xs,e.TextGeometry=qs,e.TextBufferGeometry=Qs,e.SphereGeometry=Zs,e.SphereBufferGeometry=Ks,e.RingGeometry=Js,e.RingBufferGeometry=$s,e.PlaneGeometry=qr,e.PlaneBufferGeometry=Qr,e.LatheGeometry=el,e.LatheBufferGeometry=tl,e.ShapeGeometry=nl,e.ShapeBufferGeometry=rl,e.ExtrudeGeometry=Xs,e.ExtrudeBufferGeometry=Ws,e.EdgesGeometry=al,e.ConeGeometry=ll,e.ConeBufferGeometry=cl,e.CylinderGeometry=ol,e.CylinderBufferGeometry=sl,e.CircleGeometry=ul,e.CircleBufferGeometry=hl,e.BoxGeometry=Hr,e.BoxBufferGeometry=Yr,e.ShadowMaterial=pl,e.SpriteMaterial=zo,e.RawShaderMaterial=fl,e.ShaderMaterial=Mi,e.PointsMaterial=Qo,e.MeshPhysicalMaterial=vl,e.MeshStandardMaterial=ml,e.MeshPhongMaterial=gl,e.MeshToonMaterial=yl,e.MeshNormalMaterial=xl,e.MeshLambertMaterial=_l,e.MeshDepthMaterial=$a,e.MeshDistanceMaterial=eo,e.MeshBasicMaterial=Ai,e.MeshMatcapMaterial=bl,e.LineDashedMaterial=wl,e.LineBasicMaterial=Wo,e.Material=wi,e.MeshMaskMaterial=Al,e.MeshNodeMaterial=$l,e.Float64BufferAttribute=Rr,e.Float32BufferAttribute=Nr,e.Uint32BufferAttribute=Pr,e.Int32BufferAttribute=Cr,e.Uint16BufferAttribute=Lr,e.Int16BufferAttribute=Er,e.Uint8ClampedBufferAttribute=Sr,e.Uint8BufferAttribute=Tr,e.Int8BufferAttribute=Mr,e.BufferAttribute=Ar,e.ArcCurve=fc,e.CatmullRomCurve3=_c,e.CubicBezierCurve=Mc,e.CubicBezierCurve3=Tc,e.EllipseCurve=pc,e.LineCurve=Sc,e.LineCurve3=Ec,e.QuadraticBezierCurve=Lc,e.QuadraticBezierCurve3=Cc,e.SplineCurve=Pc,e.REVISION=Ae,e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=H,e.CullFaceBack=Y,e.CullFaceFront=q,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=G,e.PCFSoftShadowMap=V,e.FrontSide=I,e.BackSide=Me,e.DoubleSide=ne,e.FlatShading=1,e.SmoothShading=2,e.NoColors=A,e.FaceColors=1,e.VertexColors=M,e.NoBlending=Q,e.NormalBlending=Z,e.AdditiveBlending=K,e.SubtractiveBlending=J,e.MultiplyBlending=$,e.CustomBlending=ee,e.AddEquation=te,e.SubtractEquation=T,e.ReverseSubtractEquation=S,e.MinEquation=E,e.MaxEquation=L,e.ZeroFactor=C,e.OneFactor=P,e.SrcColorFactor=N,e.OneMinusSrcColorFactor=R,e.SrcAlphaFactor=F,e.OneMinusSrcAlphaFactor=O,e.DstAlphaFactor=D,e.OneMinusDstAlphaFactor=U,e.DstColorFactor=B,e.OneMinusDstColorFactor=z,e.SrcAlphaSaturateFactor=k,e.NeverDepth=re,e.AlwaysDepth=ie,e.LessDepth=ae,e.LessEqualDepth=oe,e.EqualDepth=se,e.GreaterEqualDepth=le,e.GreaterDepth=ce,e.NotEqualDepth=ue,e.MultiplyOperation=j,e.MixOperation=X,e.AddOperation=W,e.NoToneMapping=he,e.LinearToneMapping=Te,e.ReinhardToneMapping=de,e.Uncharted2ToneMapping=pe,e.CineonToneMapping=fe,e.UVMapping=300,e.CubeReflectionMapping=me,e.CubeRefractionMapping=ve,e.EquirectangularReflectionMapping=ge,e.EquirectangularRefractionMapping=ye,e.SphericalReflectionMapping=xe,e.CubeUVReflectionMapping=_e,e.CubeUVRefractionMapping=be,e.RepeatWrapping=we,e.ClampToEdgeWrapping=Se,e.MirroredRepeatWrapping=Ee,e.NearestFilter=Le,e.NearestMipMapNearestFilter=Ce,e.NearestMipMapLinearFilter=Pe,e.LinearFilter=Ne,e.LinearMipMapNearestFilter=Re,e.LinearMipMapLinearFilter=Fe,e.UnsignedByteType=Oe,e.ByteType=Ie,e.ShortType=De,e.UnsignedShortType=Ue,e.IntType=Be,e.UnsignedIntType=ze,e.FloatType=ke,e.HalfFloatType=Ge,e.UnsignedShort4444Type=Ve,e.UnsignedShort5551Type=je,e.UnsignedShort565Type=Xe,e.UnsignedInt248Type=We,e.AlphaFormat=He,e.RGBFormat=Ye,e.RGBAFormat=qe,e.LuminanceFormat=Qe,e.LuminanceAlphaFormat=Ze,e.RGBEFormat=Ke,e.DepthFormat=Je,e.DepthStencilFormat=$e,e.RedFormat=et,e.RGB_S3TC_DXT1_Format=tt,e.RGBA_S3TC_DXT1_Format=nt,e.RGBA_S3TC_DXT3_Format=rt,e.RGBA_S3TC_DXT5_Format=it,e.RGB_PVRTC_4BPPV1_Format=at,e.RGB_PVRTC_2BPPV1_Format=ot,e.RGBA_PVRTC_4BPPV1_Format=st,e.RGBA_PVRTC_2BPPV1_Format=lt,e.RGB_ETC1_Format=ct,e.RGBA_ASTC_4x4_Format=ut,e.RGBA_ASTC_5x4_Format=ht,e.RGBA_ASTC_5x5_Format=dt,e.RGBA_ASTC_6x5_Format=pt,e.RGBA_ASTC_6x6_Format=ft,e.RGBA_ASTC_8x5_Format=mt,e.RGBA_ASTC_8x6_Format=vt,e.RGBA_ASTC_8x8_Format=gt,e.RGBA_ASTC_10x5_Format=yt,e.RGBA_ASTC_10x6_Format=xt,e.RGBA_ASTC_10x8_Format=_t,e.RGBA_ASTC_10x10_Format=bt,e.RGBA_ASTC_12x10_Format=wt,e.RGBA_ASTC_12x12_Format=At,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=Mt,e.InterpolateLinear=Tt,e.InterpolateSmooth=St,e.ZeroCurvatureEnding=Et,e.ZeroSlopeEnding=Lt,e.WrapAroundEnding=Ct,e.TrianglesDrawMode=Pt,e.TriangleStripDrawMode=Nt,e.TriangleFanDrawMode=Rt,e.LinearEncoding=Ft,e.sRGBEncoding=Ot,e.GammaEncoding=It,e.RGBEEncoding=Dt,e.LogLuvEncoding=3003,e.RGBM7Encoding=Ut,e.RGBM16Encoding=Bt,e.RGBDEncoding=zt,e.BasicDepthPacking=kt,e.RGBADepthPacking=Gt,e.TangentSpaceNormalMap=Vt,e.ObjectSpaceNormalMap=jt,e.V3DL=Xt,e.LogarithmicToneMapping=Wt,e.ViewportFitNone=Ht,e.ViewportFitVertical=1,e.ViewportFitHorizontal=2,e.ViewportFitAuto=3,e.CubeGeometry=Hr,e.Face4=function(e,t,n,r,i,a,o){return console.warn("v3d.Face4 has been removed. A v3d.Face3 will be created instead."),new pr(e,t,n,i,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("v3d.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("v3d.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("v3d.PointCloud has been renamed to v3d.Points."),new Zo(e,t)},e.Particle=function(e){return console.warn("v3d.Particle has been renamed to v3d.Sprite."),new ko(e)},e.ParticleSystem=function(e,t){return console.warn("v3d.ParticleSystem has been renamed to v3d.Points."),new Zo(e,t)},e.PointCloudMaterial=function(e){return console.warn("v3d.PointCloudMaterial has been renamed to v3d.PointsMaterial."),new Qo(e)},e.ParticleBasicMaterial=function(e){return console.warn("v3d.ParticleBasicMaterial has been renamed to v3d.PointsMaterial."),new Qo(e)},e.ParticleSystemMaterial=function(e){return console.warn("v3d.ParticleSystemMaterial has been renamed to v3d.PointsMaterial."),new Qo(e)},e.Vertex=function(e,t,n){return console.warn("v3d.Vertex has been removed. Use v3d.Vector3 instead."),new Kt(e,t,n)},e.DynamicBufferAttribute=function(e,t){return console.warn("v3d.DynamicBufferAttribute has been removed. Use new v3d.BufferAttribute().setDynamic(true) instead."),new Ar(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("v3d.Int8Attribute has been removed. Use new v3d.Int8BufferAttribute() instead."),new Mr(e,t)},e.Uint8Attribute=function(e,t){return console.warn("v3d.Uint8Attribute has been removed. Use new v3d.Uint8BufferAttribute() instead."),new Tr(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("v3d.Uint8ClampedAttribute has been removed. Use new v3d.Uint8ClampedBufferAttribute() instead."),new Sr(e,t)},e.Int16Attribute=function(e,t){return console.warn("v3d.Int16Attribute has been removed. Use new v3d.Int16BufferAttribute() instead."),new Er(e,t)},e.Uint16Attribute=function(e,t){return console.warn("v3d.Uint16Attribute has been removed. Use new v3d.Uint16BufferAttribute() instead."),new Lr(e,t)},e.Int32Attribute=function(e,t){return console.warn("v3d.Int32Attribute has been removed. Use new v3d.Int32BufferAttribute() instead."),new Cr(e,t)},e.Uint32Attribute=function(e,t){return console.warn("v3d.Uint32Attribute has been removed. Use new v3d.Uint32BufferAttribute() instead."),new Pr(e,t)},e.Float32Attribute=function(e,t){return console.warn("v3d.Float32Attribute has been removed. Use new v3d.Float32BufferAttribute() instead."),new Nr(e,t)},e.Float64Attribute=function(e,t){return console.warn("v3d.Float64Attribute has been removed. Use new v3d.Float64BufferAttribute() instead."),new Rr(e,t)},e.ClosedSplineCurve3=md,e.SplineCurve3=vd,e.Spline=gd,e.AxisHelper=function(e){return console.warn("v3d.AxisHelper has been renamed to v3d.AxesHelper."),new pd(e)},e.BoundingBoxHelper=function(e,t){return console.warn("v3d.BoundingBoxHelper has been deprecated. Creating a v3d.BoxHelper instead."),new cd(e,t)},e.EdgesHelper=function(e,t){return console.warn("v3d.EdgesHelper has been removed. Use v3d.EdgesGeometry instead."),new Yo(new al(e.geometry),new Wo({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("v3d.WireframeHelper has been removed. Use v3d.WireframeGeometry instead."),new Yo(new ts(e.geometry),new Wo({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("v3d.XHRLoader has been renamed to v3d.FileLoader."),new oc(e)},e.BinaryTextureLoader=function(e){return console.warn("v3d.BinaryTextureLoader has been renamed to v3d.DataTextureLoader."),new lc(e)},e.GeometryUtils=Xd,e.Projector=function(){console.error("v3d.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("v3d.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("v3d.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("v3d.Projector: .pickingRay() is now raycaster.setFromCamera().")}},e.CanvasRenderer=function(){console.error("v3d.CanvasRenderer has been removed")},e.LensFlare=function(){console.error("v3d.LensFlare has been moved to /examples/js/objects/Lensflare.js")},e.ChildOfConstraint=Yd,e.Constraint=Wd,e.CopyLocationConstraint=qd,e.CopyRotationConstraint=Qd,e.CopyScaleConstraint=Zd,e.FloorConstraint=Kd,e.LimitLocationConstraint=Jd,e.LimitRotationConstraint=$d,e.LimitScaleConstraint=ep,e.LockedTrackConstraint=tp,e.TargetConstraint=Hd,e.TrackToConstraint=np,Object.defineProperty(e,"__esModule",{value:!0})});