<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">function A_(i){return new URL(window.location.href)}/**
 * @license
 * Copyright 2010-2024 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const Ua="170",w_={ROTATE:0,DOLLY:1,PAN:2},R_={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},wc=0,so=1,Rc=2,Ll=1,Cc=2,un=3,Cn=0,Ct=1,hn=2,wn=0,_i=1,ao=2,oo=3,lo=4,Pc=5,Hn=100,Lc=101,Dc=102,Ic=103,Uc=104,Nc=200,Fc=201,Oc=202,Bc=203,Ws=204,Xs=205,zc=206,kc=207,Vc=208,Hc=209,Gc=210,Wc=211,Xc=212,qc=213,Yc=214,qs=0,Ys=1,Zs=2,Mi=3,Ks=4,js=5,$s=6,Js=7,Zr=0,Zc=1,Kc=2,Rn=0,jc=1,$c=2,Jc=3,Qc=4,eu=5,tu=6,nu=7,co="attached",iu="detached",Dl=300,yi=301,Si=302,Hr=303,Qs=304,Kr=306,qi=1e3,fn=1001,ea=1002,It=1003,ru=1004,ar=1005,$t=1006,ss=1007,Wn=1008,C_=1008,mn=1009,Il=1010,Ul=1011,Yi=1012,Na=1013,Xn=1014,Jt=1015,tr=1016,Fa=1017,Oa=1018,Ei=1020,Nl=35902,Fl=1021,Ol=1022,Bt=1023,Bl=1024,zl=1025,vi=1026,Ti=1027,kl=1028,Ba=1029,Vl=1030,za=1031,ka=1033,Fr=33776,Or=33777,Br=33778,zr=33779,ta=35840,na=35841,ia=35842,ra=35843,sa=36196,aa=37492,oa=37496,la=37808,ca=37809,ua=37810,ha=37811,fa=37812,da=37813,pa=37814,ma=37815,ga=37816,_a=37817,va=37818,xa=37819,Ma=37820,ya=37821,kr=36492,Sa=36494,Ea=36495,Hl=36283,Ta=36284,ba=36285,Aa=36286,Gr=2300,wa=2301,as=2302,uo=2400,ho=2401,fo=2402,su=2500,au=3200,ou=3201,jr=0,lu=1,An="",tt="srgb",Ri="srgb-linear",$r="linear",$e="srgb",$n=7680,po=519,cu=512,uu=513,hu=514,Gl=515,fu=516,du=517,pu=518,mu=519,mo=35044,go="300 es",dn=2e3,Wr=2001;class Zn{addEventListener(e,t){this._listeners===void 0&amp;&amp;(this._listeners={});const n=this._listeners;n[e]===void 0&amp;&amp;(n[e]=[]),n[e].indexOf(t)===-1&amp;&amp;n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&amp;&amp;n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&amp;&amp;r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s&lt;a;s++)r[s].call(this,e);e.target=null}}}const xt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let _o=1234567;const Gi=Math.PI/180,bi=180/Math.PI;function Dn(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(xt[i&amp;255]+xt[i&gt;&gt;8&amp;255]+xt[i&gt;&gt;16&amp;255]+xt[i&gt;&gt;24&amp;255]+"-"+xt[e&amp;255]+xt[e&gt;&gt;8&amp;255]+"-"+xt[e&gt;&gt;16&amp;15|64]+xt[e&gt;&gt;24&amp;255]+"-"+xt[t&amp;63|128]+xt[t&gt;&gt;8&amp;255]+"-"+xt[t&gt;&gt;16&amp;255]+xt[t&gt;&gt;24&amp;255]+xt[n&amp;255]+xt[n&gt;&gt;8&amp;255]+xt[n&gt;&gt;16&amp;255]+xt[n&gt;&gt;24&amp;255]).toLowerCase()}function gt(i,e,t){return Math.max(e,Math.min(t,i))}function Va(i,e){return(i%e+e)%e}function gu(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function _u(i,e,t){return i!==e?(t-i)/(e-i):0}function Wi(i,e,t){return(1-t)*i+t*e}function vu(i,e,t,n){return Wi(i,e,1-Math.exp(-t*n))}function xu(i,e=1){return e-Math.abs(Va(i,e*2)-e)}function Mu(i,e,t){return i&lt;=e?0:i&gt;=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function yu(i,e,t){return i&lt;=e?0:i&gt;=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Su(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Eu(i,e){return i+Math.random()*(e-i)}function Tu(i){return i*(.5-Math.random())}function bu(i){i!==void 0&amp;&amp;(_o=i);let e=_o+=1831565813;return e=Math.imul(e^e&gt;&gt;&gt;15,e|1),e^=e+Math.imul(e^e&gt;&gt;&gt;7,e|61),((e^e&gt;&gt;&gt;14)&gt;&gt;&gt;0)/4294967296}function Au(i){return i*Gi}function wu(i){return i*bi}function Ru(i){return(i&amp;i-1)===0&amp;&amp;i!==0}function Cu(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Pu(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Lu(i,e,t,n,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+n)/2),u=a((e+n)/2),h=s((e-n)/2),f=a((e-n)/2),d=s((n-e)/2),g=a((n-e)/2);switch(r){case"XYX":i.set(o*u,l*h,l*f,o*c);break;case"YZY":i.set(l*f,o*u,l*h,o*c);break;case"ZXZ":i.set(l*h,l*f,o*u,o*c);break;case"XZX":i.set(o*u,l*g,l*d,o*c);break;case"YXY":i.set(l*d,o*u,l*g,o*c);break;case"ZYZ":i.set(l*g,l*d,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function fi(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function yt(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Tt={DEG2RAD:Gi,RAD2DEG:bi,generateUUID:Dn,clamp:gt,euclideanModulo:Va,mapLinear:gu,inverseLerp:_u,lerp:Wi,damp:vu,pingpong:xu,smoothstep:Mu,smootherstep:yu,randInt:Su,randFloat:Eu,randFloatSpread:Tu,seededRandom:bu,degToRad:Au,radToDeg:wu,isPowerOfTwo:Ru,ceilPowerOfTwo:Cu,floorPowerOfTwo:Pu,setQuaternionFromProperEuler:Lu,normalize:yt,denormalize:fi};class ke{constructor(e=0,t=0){ke.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(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(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const 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(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(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(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&amp;&amp;e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ce{constructor(e,t,n,r,s,a,o,l,c){Ce.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&amp;&amp;this.set(e,t,n,r,s,a,o,l,c)}set(e,t,n,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],u=n[4],h=n[7],f=n[2],d=n[5],g=n[8],_=r[0],m=r[3],p=r[6],b=r[1],y=r[4],M=r[7],N=r[2],w=r[5],R=r[8];return s[0]=a*_+o*b+l*N,s[3]=a*m+o*y+l*w,s[6]=a*p+o*M+l*R,s[1]=c*_+u*b+h*N,s[4]=c*m+u*y+h*w,s[7]=c*p+u*M+h*R,s[2]=f*_+d*b+g*N,s[5]=f*m+d*y+g*w,s[8]=f*p+d*M+g*R,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-n*s*u+n*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,f=o*l-u*s,d=c*s-a*l,g=t*h+n*f+r*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=h*_,e[1]=(r*c-u*n)*_,e[2]=(o*n-r*a)*_,e[3]=f*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-o*t)*_,e[6]=d*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*s)*_,this}transpose(){let e;const 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(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const 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(e,t,n,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(os.makeScale(e,t)),this}rotate(e){return this.premultiply(os.makeRotation(-e)),this}translate(e,t){return this.premultiply(os.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r&lt;9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n&lt;9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const 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}clone(){return new this.constructor().fromArray(this.elements)}}const os=new Ce;function Wl(i){for(let e=i.length-1;e&gt;=0;--e)if(i[e]&gt;=65535)return!0;return!1}function Zi(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Du(){const i=Zi("canvas");return i.style.display="block",i}const vo={};function Vi(i){i in vo||(vo[i]=!0,console.warn(i))}function Iu(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function Uu(i){const e=i.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Nu(i){const e=i.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const Ie={enabled:!0,workingColorSpace:Ri,spaces:{},convert:function(i,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===$e&amp;&amp;(i.r=pn(i.r),i.g=pn(i.g),i.b=pn(i.b)),this.spaces[e].primaries!==this.spaces[t].primaries&amp;&amp;(i.applyMatrix3(this.spaces[e].toXYZ),i.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===$e&amp;&amp;(i.r=xi(i.r),i.g=xi(i.g),i.b=xi(i.b))),i},fromWorkingColorSpace:function(i,e){return this.convert(i,this.workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===An?$r:this.spaces[i].transfer},getLuminanceCoefficients:function(i,e=this.workingColorSpace){return i.fromArray(this.spaces[e].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,e,t){return i.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}};function pn(i){return i&lt;.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function xi(i){return i&lt;.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}const xo=[.64,.33,.3,.6,.15,.06],Mo=[.2126,.7152,.0722],yo=[.3127,.329],So=new Ce().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Eo=new Ce().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Ie.define({[Ri]:{primaries:xo,whitePoint:yo,transfer:$r,toXYZ:So,fromXYZ:Eo,luminanceCoefficients:Mo,workingColorSpaceConfig:{unpackColorSpace:tt},outputColorSpaceConfig:{drawingBufferColorSpace:tt}},[tt]:{primaries:xo,whitePoint:yo,transfer:$e,toXYZ:So,fromXYZ:Eo,luminanceCoefficients:Mo,outputColorSpaceConfig:{drawingBufferColorSpace:tt}}});let Jn;class Fu{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement&gt;"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Jn===void 0&amp;&amp;(Jn=Zi("canvas")),Jn.width=e.width,Jn.height=e.height;const n=Jn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Jn}return t.width&gt;2048||t.height&gt;2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement&lt;"u"&amp;&amp;e instanceof HTMLImageElement||typeof HTMLCanvasElement&lt;"u"&amp;&amp;e instanceof HTMLCanvasElement||typeof ImageBitmap&lt;"u"&amp;&amp;e instanceof ImageBitmap){const t=Zi("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a&lt;s.length;a++)s[a]=pn(s[a]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n&lt;t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(pn(t[n]/255)*255):t[n]=pn(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Ou=0;class Xl{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Ou++}),this.uuid=Dn(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&amp;&amp;this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&amp;&amp;e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a&lt;o;a++)r[a].isDataTexture?s.push(ls(r[a].image)):s.push(ls(r[a]))}else s=ls(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function ls(i){return typeof HTMLImageElement&lt;"u"&amp;&amp;i instanceof HTMLImageElement||typeof HTMLCanvasElement&lt;"u"&amp;&amp;i instanceof HTMLCanvasElement||typeof ImageBitmap&lt;"u"&amp;&amp;i instanceof ImageBitmap?Fu.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Bu=0;class _t extends Zn{constructor(e=_t.DEFAULT_IMAGE,t=_t.DEFAULT_MAPPING,n=fn,r=fn,s=$t,a=Wn,o=Bt,l=mn,c=_t.DEFAULT_ANISOTROPY,u=An){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Bu++}),this.uuid=Dn(),this.name="",this.source=new Xl(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new ke(0,0),this.repeat=new ke(1,1),this.center=new ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ce,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,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.internalFormat=e.internalFormat,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.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&amp;&amp;e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length&gt;0&amp;&amp;(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Dl)return e;if(e.applyMatrix3(this.matrix),e.x&lt;0||e.x&gt;1)switch(this.wrapS){case qi:e.x=e.x-Math.floor(e.x);break;case fn:e.x=e.x&lt;0?0:1;break;case ea:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y&lt;0||e.y&gt;1)switch(this.wrapT){case qi:e.y=e.y-Math.floor(e.y);break;case fn:e.y=e.y&lt;0?0:1;break;case ea:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&amp;&amp;(e.y=1-e.y),e}set needsUpdate(e){e===!0&amp;&amp;(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&amp;&amp;this.pmremVersion++}}_t.DEFAULT_IMAGE=null;_t.DEFAULT_MAPPING=Dl;_t.DEFAULT_ANISOTROPY=1;class ze{constructor(e=0,t=0,n=0,r=1){ze.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(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(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(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(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(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(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t&lt;1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],d=l[5],g=l[9],_=l[2],m=l[6],p=l[10];if(Math.abs(u-f)&lt;.01&amp;&amp;Math.abs(h-_)&lt;.01&amp;&amp;Math.abs(g-m)&lt;.01){if(Math.abs(u+f)&lt;.1&amp;&amp;Math.abs(h+_)&lt;.1&amp;&amp;Math.abs(g+m)&lt;.1&amp;&amp;Math.abs(c+d+p-3)&lt;.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,M=(d+1)/2,N=(p+1)/2,w=(u+f)/4,R=(h+_)/4,U=(g+m)/4;return y&gt;M&amp;&amp;y&gt;N?y&lt;.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(y),r=w/n,s=R/n):M&gt;N?M&lt;.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(M),n=w/r,s=U/r):N&lt;.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(N),n=R/s,r=U/s),this.set(n,r,s,t),this}let b=Math.sqrt((m-g)*(m-g)+(h-_)*(h-_)+(f-u)*(f-u));return Math.abs(b)&lt;.001&amp;&amp;(b=1),this.x=(m-g)/b,this.y=(h-_)/b,this.z=(f-u)/b,this.w=Math.acos((c+d+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(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(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(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(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){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(){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(){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(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&amp;&amp;e.y===this.y&amp;&amp;e.z===this.z&amp;&amp;e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class zu extends Zn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ze(0,0,e,t),this.scissorTest=!1,this.viewport=new ze(0,0,e,t);const r={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$t,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const s=new _t(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);s.flipY=!1,s.generateMipmaps=n.generateMipmaps,s.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let o=0;o&lt;a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r&lt;s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n&lt;r;n++)this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Xl(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&amp;&amp;(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class qn extends zu{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class ql extends _t{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=fn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ku extends _t{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=It,this.minFilter=It,this.wrapR=fn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class wt{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,o){let l=n[r+0],c=n[r+1],u=n[r+2],h=n[r+3];const f=s[a+0],d=s[a+1],g=s[a+2],_=s[a+3];if(o===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(o===1){e[t+0]=f,e[t+1]=d,e[t+2]=g,e[t+3]=_;return}if(h!==_||l!==f||c!==d||u!==g){let m=1-o;const p=l*f+c*d+u*g+h*_,b=p&gt;=0?1:-1,y=1-p*p;if(y&gt;Number.EPSILON){const N=Math.sqrt(y),w=Math.atan2(N,p*b);m=Math.sin(m*w)/N,o=Math.sin(o*w)/N}const M=o*b;if(l=l*m+f*M,c=c*m+d*M,u=u*m+g*M,h=h*m+_*M,m===1-o){const N=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=N,c*=N,u*=N,h*=N}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,r,s,a){const o=n[r],l=n[r+1],c=n[r+2],u=n[r+3],h=s[a],f=s[a+1],d=s[a+2],g=s[a+3];return e[t]=o*g+u*h+l*d-c*f,e[t+1]=l*g+u*f+c*h-o*d,e[t+2]=c*g+u*d+o*f-l*h,e[t+3]=u*g-o*h-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),u=o(r/2),h=o(s/2),f=l(n/2),d=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h-f*d*g;break;case"YXZ":this._x=f*u*h+c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h+f*d*g;break;case"ZXY":this._x=f*u*h-c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h-f*d*g;break;case"ZYX":this._x=f*u*h-c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h+f*d*g;break;case"YZX":this._x=f*u*h+c*d*g,this._y=c*d*h+f*u*g,this._z=c*u*g-f*d*h,this._w=c*u*h-f*d*g;break;case"XZY":this._x=f*u*h-c*d*g,this._y=c*d*h-f*u*g,this._z=c*u*g+f*d*h,this._w=c*u*h+f*d*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&amp;&amp;this._onChangeCallback(),this}setFromAxisAngle(e,t){const 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(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=n+o+h;if(f&gt;0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-l)*d,this._y=(s-c)*d,this._z=(a-r)*d}else if(n&gt;o&amp;&amp;n&gt;h){const d=2*Math.sqrt(1+n-o-h);this._w=(u-l)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+c)/d}else if(o&gt;h){const d=2*Math.sqrt(1+o-n-h);this._w=(s-c)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(l+u)/d}else{const d=2*Math.sqrt(1+h-n-o);this._w=(a-r)/d,this._x=(s+c)/d,this._y=(l+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n&lt;Number.EPSILON?(n=0,Math.abs(e.x)&gt;Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(gt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-n*c,this._z=s*u+a*c+n*l-r*o,this._w=a*u-n*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+s*e._z;if(o&lt;0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o&gt;=1)return this._w=a,this._x=n,this._y=r,this._z=s,this;const l=1-o*o;if(l&lt;=Number.EPSILON){const d=1-t;return this._w=d*a+t*this._w,this._x=d*n+t*this._x,this._y=d*r+t*this._y,this._z=d*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*h+this._w*f,this._x=n*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&amp;&amp;e._y===this._y&amp;&amp;e._z===this._z&amp;&amp;e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class P{constructor(e=0,t=0,n=0){P.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&amp;&amp;(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(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(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(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(To.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(To.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*n),u=2*(o*t-s*r),h=2*(s*n-a*t);return this.x=t+l*c+a*h-o*u,this.y=n+l*u+o*c-s*h,this.z=r+l*h+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(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(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(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(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-n*l,this.z=n*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return cs.copy(this).projectOnVector(e),this.sub(cs)}reflect(e){return this.sub(cs.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const 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(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const 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(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&amp;&amp;e.y===this.y&amp;&amp;e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const cs=new P,To=new wt;class Ci{constructor(e=new P(1/0,1/0,1/0),t=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t&lt;n;t+=3)this.expandByPoint(Ht.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t&lt;n;t++)this.expandByPoint(Ht.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t&lt;n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ht.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){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(){return this.max.x&lt;this.min.x||this.max.y&lt;this.min.y||this.max.z&lt;this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&amp;&amp;s!==void 0&amp;&amp;e.isInstancedMesh!==!0)for(let a=0,o=s.count;a&lt;o;a++)e.isMesh===!0?e.getVertexPosition(a,Ht):Ht.fromBufferAttribute(s,a),Ht.applyMatrix4(e.matrixWorld),this.expandByPoint(Ht);else e.boundingBox!==void 0?(e.boundingBox===null&amp;&amp;e.computeBoundingBox(),or.copy(e.boundingBox)):(n.boundingBox===null&amp;&amp;n.computeBoundingBox(),or.copy(n.boundingBox)),or.applyMatrix4(e.matrixWorld),this.union(or)}const r=e.children;for(let s=0,a=r.length;s&lt;a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x&gt;=this.min.x&amp;&amp;e.x&lt;=this.max.x&amp;&amp;e.y&gt;=this.min.y&amp;&amp;e.y&lt;=this.max.y&amp;&amp;e.z&gt;=this.min.z&amp;&amp;e.z&lt;=this.max.z}containsBox(e){return this.min.x&lt;=e.min.x&amp;&amp;e.max.x&lt;=this.max.x&amp;&amp;this.min.y&lt;=e.min.y&amp;&amp;e.max.y&lt;=this.max.y&amp;&amp;this.min.z&lt;=e.min.z&amp;&amp;e.max.z&lt;=this.max.z}getParameter(e,t){return 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(e){return e.max.x&gt;=this.min.x&amp;&amp;e.min.x&lt;=this.max.x&amp;&amp;e.max.y&gt;=this.min.y&amp;&amp;e.min.y&lt;=this.max.y&amp;&amp;e.max.z&gt;=this.min.z&amp;&amp;e.min.z&lt;=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Ht),Ht.distanceToSquared(e.center)&lt;=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x&gt;0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y&gt;0?(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),e.normal.z&gt;0?(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&lt;=-e.constant&amp;&amp;n&gt;=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ni),lr.subVectors(this.max,Ni),Qn.subVectors(e.a,Ni),ei.subVectors(e.b,Ni),ti.subVectors(e.c,Ni),xn.subVectors(ei,Qn),Mn.subVectors(ti,ei),Un.subVectors(Qn,ti);let t=[0,-xn.z,xn.y,0,-Mn.z,Mn.y,0,-Un.z,Un.y,xn.z,0,-xn.x,Mn.z,0,-Mn.x,Un.z,0,-Un.x,-xn.y,xn.x,0,-Mn.y,Mn.x,0,-Un.y,Un.x,0];return!us(t,Qn,ei,ti,lr)||(t=[1,0,0,0,1,0,0,0,1],!us(t,Qn,ei,ti,lr))?!1:(cr.crossVectors(xn,Mn),t=[cr.x,cr.y,cr.z],us(t,Qn,ei,ti,lr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ht).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ht).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&amp;&amp;this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(rn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&amp;&amp;e.max.equals(this.max)}}const rn=[new P,new P,new P,new P,new P,new P,new P,new P],Ht=new P,or=new Ci,Qn=new P,ei=new P,ti=new P,xn=new P,Mn=new P,Un=new P,Ni=new P,lr=new P,cr=new P,Nn=new P;function us(i,e,t,n,r){for(let s=0,a=i.length-3;s&lt;=a;s+=3){Nn.fromArray(i,s);const o=r.x*Math.abs(Nn.x)+r.y*Math.abs(Nn.y)+r.z*Math.abs(Nn.z),l=e.dot(Nn),c=t.dot(Nn),u=n.dot(Nn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))&gt;o)return!1}return!0}const Vu=new Ci,Fi=new P,hs=new P;class Kn{constructor(e=new P,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):Vu.setFromPoints(e).getCenter(n);let r=0;for(let s=0,a=e.length;s&lt;a;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius&lt;0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)&lt;=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)&lt;=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))&lt;=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n&gt;this.radius*this.radius&amp;&amp;(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Fi.subVectors(e,this.center);const t=Fi.lengthSq();if(t&gt;this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(Fi,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(hs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fi.copy(e.center).add(hs)),this.expandByPoint(Fi.copy(e.center).sub(hs))),this)}equals(e){return e.center.equals(this.center)&amp;&amp;e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const sn=new P,fs=new P,ur=new P,yn=new P,ds=new P,hr=new P,ps=new P;class Jr{constructor(e=new P,t=new P(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,sn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n&lt;0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=sn.subVectors(e,this.origin).dot(this.direction);return t&lt;0?this.origin.distanceToSquared(e):(sn.copy(this.origin).addScaledVector(this.direction,t),sn.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){fs.copy(e).add(t).multiplyScalar(.5),ur.copy(t).sub(e).normalize(),yn.copy(this.origin).sub(fs);const s=e.distanceTo(t)*.5,a=-this.direction.dot(ur),o=yn.dot(this.direction),l=-yn.dot(ur),c=yn.lengthSq(),u=Math.abs(1-a*a);let h,f,d,g;if(u&gt;0)if(h=a*l-o,f=a*o-l,g=s*u,h&gt;=0)if(f&gt;=-g)if(f&lt;=g){const _=1/u;h*=_,f*=_,d=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;else f&lt;=-g?(h=Math.max(0,-(-a*s+o)),f=h&gt;0?-s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c):f&lt;=g?(h=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h&gt;0?s:Math.min(Math.max(-s,-l),s),d=-h*h+f*(f+2*l)+c);else f=a&gt;0?-s:s,h=Math.max(0,-(a*f+o)),d=-h*h+f*(f+2*l)+c;return n&amp;&amp;n.copy(this.origin).addScaledVector(this.direction,h),r&amp;&amp;r.copy(fs).addScaledVector(ur,f),d}intersectSphere(e,t){sn.subVectors(e.center,this.origin);const n=sn.dot(this.direction),r=sn.dot(sn)-n*n,s=e.radius*e.radius;if(r&gt;s)return null;const a=Math.sqrt(s-r),o=n-a,l=n+a;return l&lt;0?null:o&lt;0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)&lt;=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n&gt;=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t&lt;0}intersectBox(e,t){let n,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c&gt;=0?(n=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(n=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u&gt;=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),n&gt;a||s&gt;r||((s&gt;n||isNaN(n))&amp;&amp;(n=s),(a&lt;r||isNaN(r))&amp;&amp;(r=a),h&gt;=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),n&gt;l||o&gt;r)||((o&gt;n||n!==n)&amp;&amp;(n=o),(l&lt;r||r!==r)&amp;&amp;(r=l),r&lt;0)?null:this.at(n&gt;=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,sn)!==null}intersectTriangle(e,t,n,r,s){ds.subVectors(t,e),hr.subVectors(n,e),ps.crossVectors(ds,hr);let a=this.direction.dot(ps),o;if(a&gt;0){if(r)return null;o=1}else if(a&lt;0)o=-1,a=-a;else return null;yn.subVectors(this.origin,e);const l=o*this.direction.dot(hr.crossVectors(yn,hr));if(l&lt;0)return null;const c=o*this.direction.dot(ds.cross(yn));if(c&lt;0||l+c&gt;a)return null;const u=-o*yn.dot(ps);return u&lt;0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&amp;&amp;e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class xe{constructor(e,t,n,r,s,a,o,l,c,u,h,f,d,g,_,m){xe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&amp;&amp;this.set(e,t,n,r,s,a,o,l,c,u,h,f,d,g,_,m)}set(e,t,n,r,s,a,o,l,c,u,h,f,d,g,_,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=r,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=u,p[10]=h,p[14]=f,p[3]=d,p[7]=g,p[11]=_,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new xe().fromArray(this.elements)}copy(e){const 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(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(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(e){const t=this.elements,n=e.elements,r=1/ni.setFromMatrixColumn(e,0).length(),s=1/ni.setFromMatrixColumn(e,1).length(),a=1/ni.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]*s,t[5]=n[5]*s,t[6]=n[6]*s,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(e){const t=this.elements,n=e.x,r=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,d=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=d+g*c,t[5]=f-_*c,t[9]=-o*l,t[2]=_-f*c,t[6]=g+d*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,d=l*h,g=c*u,_=c*h;t[0]=f+_*o,t[4]=g*o-d,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=d*o-g,t[6]=_+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,d=l*h,g=c*u,_=c*h;t[0]=f-_*o,t[4]=-a*h,t[8]=g+d*o,t[1]=d+g*o,t[5]=a*u,t[9]=_-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,d=a*h,g=o*u,_=o*h;t[0]=l*u,t[4]=g*c-d,t[8]=f*c+_,t[1]=l*h,t[5]=_*c+f,t[9]=d*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,d=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=_-f*h,t[8]=g*h+d,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=d*h+g,t[10]=f-_*h}else if(e.order==="XZY"){const f=a*l,d=a*c,g=o*l,_=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+_,t[5]=a*u,t[9]=d*h-g,t[2]=g*h-d,t[6]=o*u,t[10]=_*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Hu,e,Gu)}lookAt(e,t,n){const r=this.elements;return Lt.subVectors(e,t),Lt.lengthSq()===0&amp;&amp;(Lt.z=1),Lt.normalize(),Sn.crossVectors(n,Lt),Sn.lengthSq()===0&amp;&amp;(Math.abs(n.z)===1?Lt.x+=1e-4:Lt.z+=1e-4,Lt.normalize(),Sn.crossVectors(n,Lt)),Sn.normalize(),fr.crossVectors(Lt,Sn),r[0]=Sn.x,r[4]=fr.x,r[8]=Lt.x,r[1]=Sn.y,r[5]=fr.y,r[9]=Lt.y,r[2]=Sn.z,r[6]=fr.z,r[10]=Lt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],u=n[1],h=n[5],f=n[9],d=n[13],g=n[2],_=n[6],m=n[10],p=n[14],b=n[3],y=n[7],M=n[11],N=n[15],w=r[0],R=r[4],U=r[8],E=r[12],S=r[1],A=r[5],G=r[9],z=r[13],X=r[2],j=r[6],H=r[10],J=r[14],k=r[3],te=r[7],ce=r[11],Me=r[15];return s[0]=a*w+o*S+l*X+c*k,s[4]=a*R+o*A+l*j+c*te,s[8]=a*U+o*G+l*H+c*ce,s[12]=a*E+o*z+l*J+c*Me,s[1]=u*w+h*S+f*X+d*k,s[5]=u*R+h*A+f*j+d*te,s[9]=u*U+h*G+f*H+d*ce,s[13]=u*E+h*z+f*J+d*Me,s[2]=g*w+_*S+m*X+p*k,s[6]=g*R+_*A+m*j+p*te,s[10]=g*U+_*G+m*H+p*ce,s[14]=g*E+_*z+m*J+p*Me,s[3]=b*w+y*S+M*X+N*k,s[7]=b*R+y*A+M*j+N*te,s[11]=b*U+y*G+M*H+N*ce,s[15]=b*E+y*z+M*J+N*Me,this}multiplyScalar(e){const 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}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],d=e[14],g=e[3],_=e[7],m=e[11],p=e[15];return g*(+s*l*h-r*c*h-s*o*f+n*c*f+r*o*d-n*l*d)+_*(+t*l*d-t*c*f+s*a*f-r*a*d+r*c*u-s*l*u)+m*(+t*c*h-t*o*d-s*a*h+n*a*d+s*o*u-n*c*u)+p*(-r*o*u-t*l*h+t*o*f+r*a*h-n*a*f+n*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],g=e[12],_=e[13],m=e[14],p=e[15],b=h*m*c-_*f*c+_*l*d-o*m*d-h*l*p+o*f*p,y=g*f*c-u*m*c-g*l*d+a*m*d+u*l*p-a*f*p,M=u*_*c-g*h*c+g*o*d-a*_*d-u*o*p+a*h*p,N=g*h*l-u*_*l-g*o*f+a*_*f+u*o*m-a*h*m,w=t*b+n*y+r*M+s*N;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/w;return e[0]=b*R,e[1]=(_*f*s-h*m*s-_*r*d+n*m*d+h*r*p-n*f*p)*R,e[2]=(o*m*s-_*l*s+_*r*c-n*m*c-o*r*p+n*l*p)*R,e[3]=(h*l*s-o*f*s-h*r*c+n*f*c+o*r*d-n*l*d)*R,e[4]=y*R,e[5]=(u*m*s-g*f*s+g*r*d-t*m*d-u*r*p+t*f*p)*R,e[6]=(g*l*s-a*m*s-g*r*c+t*m*c+a*r*p-t*l*p)*R,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*d+t*l*d)*R,e[8]=M*R,e[9]=(g*h*s-u*_*s-g*n*d+t*_*d+u*n*p-t*h*p)*R,e[10]=(a*_*s-g*o*s+g*n*c-t*_*c-a*n*p+t*o*p)*R,e[11]=(u*o*s-a*h*s-u*n*c+t*h*c+a*n*d-t*o*d)*R,e[12]=N*R,e[13]=(u*_*r-g*h*r+g*n*f-t*_*f-u*n*m+t*h*m)*R,e[14]=(g*o*r-a*_*r-g*n*l+t*_*l+a*n*m-t*o*m)*R,e[15]=(a*h*r-u*o*r+u*n*l-t*h*l-a*n*f+t*o*f)*R,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const 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(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const 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(e){const 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(e){const 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(e,t){const n=Math.cos(t),r=Math.sin(t),s=1-n,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+n,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+n,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,a){return this.set(1,n,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,f=s*c,d=s*u,g=s*h,_=a*u,m=a*h,p=o*h,b=l*c,y=l*u,M=l*h,N=n.x,w=n.y,R=n.z;return r[0]=(1-(_+p))*N,r[1]=(d+M)*N,r[2]=(g-y)*N,r[3]=0,r[4]=(d-M)*w,r[5]=(1-(f+p))*w,r[6]=(m+b)*w,r[7]=0,r[8]=(g+y)*R,r[9]=(m-b)*R,r[10]=(1-(f+_))*R,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=ni.set(r[0],r[1],r[2]).length();const a=ni.set(r[4],r[5],r[6]).length(),o=ni.set(r[8],r[9],r[10]).length();this.determinant()&lt;0&amp;&amp;(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Gt.copy(this);const c=1/s,u=1/a,h=1/o;return Gt.elements[0]*=c,Gt.elements[1]*=c,Gt.elements[2]*=c,Gt.elements[4]*=u,Gt.elements[5]*=u,Gt.elements[6]*=u,Gt.elements[8]*=h,Gt.elements[9]*=h,Gt.elements[10]*=h,t.setFromRotationMatrix(Gt),n.x=s,n.y=a,n.z=o,this}makePerspective(e,t,n,r,s,a,o=dn){const l=this.elements,c=2*s/(t-e),u=2*s/(n-r),h=(t+e)/(t-e),f=(n+r)/(n-r);let d,g;if(o===dn)d=-(a+s)/(a-s),g=-2*a*s/(a-s);else if(o===Wr)d=-a/(a-s),g=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,a,o=dn){const l=this.elements,c=1/(t-e),u=1/(n-r),h=1/(a-s),f=(t+e)*c,d=(n+r)*u;let g,_;if(o===dn)g=(a+s)*h,_=-2*h;else if(o===Wr)g=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-d,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r&lt;16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n&lt;16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const 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}}const ni=new P,Gt=new xe,Hu=new P(0,0,0),Gu=new P(1,1,1),Sn=new P,fr=new P,Lt=new P,bo=new xe,Ao=new wt;class ft{constructor(e=0,t=0,n=0,r=ft.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],h=r[2],f=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(gt(o,-1,1)),Math.abs(o)&lt;.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gt(u,-1,1)),Math.abs(u)&lt;.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(gt(f,-1,1)),Math.abs(f)&lt;.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-gt(h,-1,1)),Math.abs(h)&lt;.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(gt(l,-1,1)),Math.abs(l)&lt;.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-gt(a,-1,1)),Math.abs(a)&lt;.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&amp;&amp;this._onChangeCallback(),this}setFromQuaternion(e,t,n){return bo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(bo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ao.setFromEuler(this),this.setFromQuaternion(Ao,e)}equals(e){return e._x===this._x&amp;&amp;e._y===this._y&amp;&amp;e._z===this._z&amp;&amp;e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&amp;&amp;(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ft.DEFAULT_ORDER="XYZ";class Yl{constructor(){this.mask=1}set(e){this.mask=(1&lt;&lt;e|0)&gt;&gt;&gt;0}enable(e){this.mask|=1&lt;&lt;e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1&lt;&lt;e|0}disable(e){this.mask&amp;=~(1&lt;&lt;e|0)}disableAll(){this.mask=0}test(e){return(this.mask&amp;e.mask)!==0}isEnabled(e){return(this.mask&amp;(1&lt;&lt;e|0))!==0}}let Wu=0;const wo=new P,ii=new wt,an=new xe,dr=new P,Oi=new P,Xu=new P,qu=new wt,Ro=new P(1,0,0),Co=new P(0,1,0),Po=new P(0,0,1),Lo={type:"added"},Yu={type:"removed"},ri={type:"childadded",child:null},ms={type:"childremoved",child:null};class at extends Zn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Wu++}),this.uuid=Dn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=at.DEFAULT_UP.clone();const e=new P,t=new ft,n=new wt,r=new P(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),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 xe},normalMatrix:{value:new Ce}}),this.matrix=new xe,this.matrixWorld=new xe,this.matrixAutoUpdate=at.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&amp;&amp;this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ii.setFromAxisAngle(e,t),this.quaternion.multiply(ii),this}rotateOnWorldAxis(e,t){return ii.setFromAxisAngle(e,t),this.quaternion.premultiply(ii),this}rotateX(e){return this.rotateOnAxis(Ro,e)}rotateY(e){return this.rotateOnAxis(Co,e)}rotateZ(e){return this.rotateOnAxis(Po,e)}translateOnAxis(e,t){return wo.copy(e).applyQuaternion(this.quaternion),this.position.add(wo.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ro,e)}translateY(e){return this.translateOnAxis(Co,e)}translateZ(e){return this.translateOnAxis(Po,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(an.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?dr.copy(e):dr.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Oi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?an.lookAt(Oi,dr,this.up):an.lookAt(dr,Oi,this.up),this.quaternion.setFromRotationMatrix(an),r&amp;&amp;(an.extractRotation(r.matrixWorld),ii.setFromRotationMatrix(an),this.quaternion.premultiply(ii.invert()))}add(e){if(arguments.length&gt;1){for(let t=0;t&lt;arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&amp;&amp;e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Lo),ri.child=e,this.dispatchEvent(ri),ri.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length&gt;1){for(let n=0;n&lt;arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&amp;&amp;(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Yu),ms.child=e,this.dispatchEvent(ms),ms.child=null),this}removeFromParent(){const e=this.parent;return e!==null&amp;&amp;e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),an.copy(this.matrixWorld).invert(),e.parent!==null&amp;&amp;(e.parent.updateWorldMatrix(!0,!1),an.multiply(e.parent.matrixWorld)),e.applyMatrix4(an),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Lo),ri.child=e,this.dispatchEvent(ri),ri.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n&lt;r;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&amp;&amp;n.push(this);const r=this.children;for(let s=0,a=r.length;s&lt;a;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,e,Xu),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Oi,qu,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n&lt;r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n&lt;r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&amp;&amp;(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&amp;&amp;this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&amp;&amp;(this.matrixWorldAutoUpdate===!0&amp;&amp;(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n&lt;r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&amp;&amp;n!==null&amp;&amp;n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&amp;&amp;this.updateMatrix(),this.matrixWorldAutoUpdate===!0&amp;&amp;(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const r=this.children;for(let s=0,a=r.length;s&lt;a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&amp;&amp;(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&amp;&amp;(r.name=this.name),this.castShadow===!0&amp;&amp;(r.castShadow=!0),this.receiveShadow===!0&amp;&amp;(r.receiveShadow=!0),this.visible===!1&amp;&amp;(r.visible=!1),this.frustumCulled===!1&amp;&amp;(r.frustumCulled=!1),this.renderOrder!==0&amp;&amp;(r.renderOrder=this.renderOrder),Object.keys(this.userData).length&gt;0&amp;&amp;(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&amp;&amp;(r.matrixAutoUpdate=!1),this.isInstancedMesh&amp;&amp;(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&amp;&amp;(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&amp;&amp;(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(o=&gt;({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&amp;&amp;(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&amp;&amp;(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&amp;&amp;(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(o,l){return o[l.uuid]===void 0&amp;&amp;(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&amp;&amp;(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&amp;&amp;(r.background=this.background.toJSON(e).uuid)),this.environment&amp;&amp;this.environment.isTexture&amp;&amp;this.environment.isRenderTargetTexture!==!0&amp;&amp;(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&amp;&amp;o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c&lt;u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&amp;&amp;(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&amp;&amp;(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l&lt;c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length&gt;0){r.children=[];for(let o=0;o&lt;this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length&gt;0){r.animations=[];for(let o=0;o&lt;this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),h=a(e.shapes),f=a(e.skeletons),d=a(e.animations),g=a(e.nodes);o.length&gt;0&amp;&amp;(n.geometries=o),l.length&gt;0&amp;&amp;(n.materials=l),c.length&gt;0&amp;&amp;(n.textures=c),u.length&gt;0&amp;&amp;(n.images=u),h.length&gt;0&amp;&amp;(n.shapes=h),f.length&gt;0&amp;&amp;(n.skeletons=f),d.length&gt;0&amp;&amp;(n.animations=d),g.length&gt;0&amp;&amp;(n.nodes=g)}return n.object=r,n;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n&lt;e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}at.DEFAULT_UP=new P(0,1,0);at.DEFAULT_MATRIX_AUTO_UPDATE=!0;at.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Wt=new P,on=new P,gs=new P,ln=new P,si=new P,ai=new P,Do=new P,_s=new P,vs=new P,xs=new P,Ms=new ze,ys=new ze,Ss=new ze;class Yt{constructor(e=new P,t=new P,n=new P){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Wt.subVectors(e,t),r.cross(Wt);const s=r.lengthSq();return s&gt;0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Wt.subVectors(r,t),on.subVectors(n,t),gs.subVectors(e,t);const a=Wt.dot(Wt),o=Wt.dot(on),l=Wt.dot(gs),c=on.dot(on),u=on.dot(gs),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const f=1/h,d=(c*l-o*u)*f,g=(a*u-o*l)*f;return s.set(1-d-g,g,d)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,ln)===null?!1:ln.x&gt;=0&amp;&amp;ln.y&gt;=0&amp;&amp;ln.x+ln.y&lt;=1}static getInterpolation(e,t,n,r,s,a,o,l){return this.getBarycoord(e,t,n,r,ln)===null?(l.x=0,l.y=0,"z"in l&amp;&amp;(l.z=0),"w"in l&amp;&amp;(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,ln.x),l.addScaledVector(a,ln.y),l.addScaledVector(o,ln.z),l)}static getInterpolatedAttribute(e,t,n,r,s,a){return Ms.setScalar(0),ys.setScalar(0),Ss.setScalar(0),Ms.fromBufferAttribute(e,t),ys.fromBufferAttribute(e,n),Ss.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ms,s.x),a.addScaledVector(ys,s.y),a.addScaledVector(Ss,s.z),a}static isFrontFacing(e,t,n,r){return Wt.subVectors(n,t),on.subVectors(e,t),Wt.cross(on).dot(r)&lt;0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Wt.subVectors(this.c,this.b),on.subVectors(this.a,this.b),Wt.cross(on).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Yt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Yt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Yt.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Yt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Yt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,o;si.subVectors(r,n),ai.subVectors(s,n),_s.subVectors(e,n);const l=si.dot(_s),c=ai.dot(_s);if(l&lt;=0&amp;&amp;c&lt;=0)return t.copy(n);vs.subVectors(e,r);const u=si.dot(vs),h=ai.dot(vs);if(u&gt;=0&amp;&amp;h&lt;=u)return t.copy(r);const f=l*h-u*c;if(f&lt;=0&amp;&amp;l&gt;=0&amp;&amp;u&lt;=0)return a=l/(l-u),t.copy(n).addScaledVector(si,a);xs.subVectors(e,s);const d=si.dot(xs),g=ai.dot(xs);if(g&gt;=0&amp;&amp;d&lt;=g)return t.copy(s);const _=d*c-l*g;if(_&lt;=0&amp;&amp;c&gt;=0&amp;&amp;g&lt;=0)return o=c/(c-g),t.copy(n).addScaledVector(ai,o);const m=u*g-d*h;if(m&lt;=0&amp;&amp;h-u&gt;=0&amp;&amp;d-g&gt;=0)return Do.subVectors(s,r),o=(h-u)/(h-u+(d-g)),t.copy(r).addScaledVector(Do,o);const p=1/(m+_+f);return a=_*p,o=f*p,t.copy(n).addScaledVector(si,a).addScaledVector(ai,o)}equals(e){return e.a.equals(this.a)&amp;&amp;e.b.equals(this.b)&amp;&amp;e.c.equals(this.c)}}const Zl={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},En={h:0,s:0,l:0},pr={h:0,s:0,l:0};function Es(i,e,t){return t&lt;0&amp;&amp;(t+=1),t&gt;1&amp;&amp;(t-=1),t&lt;1/6?i+(e-i)*6*t:t&lt;1/2?e:t&lt;2/3?i+(e-i)*6*(2/3-t):i}class be{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&amp;&amp;n===void 0){const r=e;r&amp;&amp;r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&amp;&amp;this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tt){return e=Math.floor(e),this.r=(e&gt;&gt;16&amp;255)/255,this.g=(e&gt;&gt;8&amp;255)/255,this.b=(e&amp;255)/255,Ie.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=Ie.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ie.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=Ie.workingColorSpace){if(e=Va(e,1),t=gt(t,0,1),n=gt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n&lt;=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Es(a,s,e+1/3),this.g=Es(a,s,e),this.b=Es(a,s,e-1/3)}return Ie.toWorkingColorSpace(this,r),this}setStyle(e,t=tt){function n(s){s!==void 0&amp;&amp;parseFloat(s)&lt;1&amp;&amp;console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&amp;&amp;e.length&gt;0)return this.setColorName(e,t);return this}setColorName(e,t=tt){const n=Zl[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=pn(e.r),this.g=pn(e.g),this.b=pn(e.b),this}copyLinearToSRGB(e){return this.r=xi(e.r),this.g=xi(e.g),this.b=xi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tt){return Ie.fromWorkingColorSpace(Mt.copy(this),e),Math.round(gt(Mt.r*255,0,255))*65536+Math.round(gt(Mt.g*255,0,255))*256+Math.round(gt(Mt.b*255,0,255))}getHexString(e=tt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ie.workingColorSpace){Ie.fromWorkingColorSpace(Mt.copy(this),t);const n=Mt.r,r=Mt.g,s=Mt.b,a=Math.max(n,r,s),o=Math.min(n,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u&lt;=.5?h/(a+o):h/(2-a-o),a){case n:l=(r-s)/h+(r&lt;s?6:0);break;case r:l=(s-n)/h+2;break;case s:l=(n-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Ie.workingColorSpace){return Ie.fromWorkingColorSpace(Mt.copy(this),t),e.r=Mt.r,e.g=Mt.g,e.b=Mt.b,e}getStyle(e=tt){Ie.fromWorkingColorSpace(Mt.copy(this),e);const t=Mt.r,n=Mt.g,r=Mt.b;return e!==tt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(En),this.setHSL(En.h+e,En.s+t,En.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(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(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(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}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(En),e.getHSL(pr);const n=Wi(En.h,pr.h,t),r=Wi(En.s,pr.s,t),s=Wi(En.l,pr.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&amp;&amp;e.g===this.g&amp;&amp;e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Mt=new be;be.NAMES=Zl;let Zu=0;class gn extends Zn{static get type(){return"Material"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Zu++}),this.uuid=Dn(),this.name="",this.blending=_i,this.side=Cn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ws,this.blendDst=Xs,this.blendEquation=Hn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=Mi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=po,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$n,this.stencilZFail=$n,this.stencilZPass=$n,this.stencilWrite=!1,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest&gt;0!=e&gt;0&amp;&amp;this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&amp;&amp;r.isColor?r.set(n):r&amp;&amp;r.isVector3&amp;&amp;n&amp;&amp;n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&amp;&amp;(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&amp;&amp;(n.name=this.name),this.color&amp;&amp;this.color.isColor&amp;&amp;(n.color=this.color.getHex()),this.roughness!==void 0&amp;&amp;(n.roughness=this.roughness),this.metalness!==void 0&amp;&amp;(n.metalness=this.metalness),this.sheen!==void 0&amp;&amp;(n.sheen=this.sheen),this.sheenColor&amp;&amp;this.sheenColor.isColor&amp;&amp;(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&amp;&amp;(n.sheenRoughness=this.sheenRoughness),this.emissive&amp;&amp;this.emissive.isColor&amp;&amp;(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&amp;&amp;this.emissiveIntensity!==1&amp;&amp;(n.emissiveIntensity=this.emissiveIntensity),this.specular&amp;&amp;this.specular.isColor&amp;&amp;(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&amp;&amp;(n.specularIntensity=this.specularIntensity),this.specularColor&amp;&amp;this.specularColor.isColor&amp;&amp;(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&amp;&amp;(n.shininess=this.shininess),this.clearcoat!==void 0&amp;&amp;(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&amp;&amp;(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&amp;&amp;this.clearcoatMap.isTexture&amp;&amp;(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&amp;&amp;this.clearcoatRoughnessMap.isTexture&amp;&amp;(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&amp;&amp;this.clearcoatNormalMap.isTexture&amp;&amp;(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&amp;&amp;(n.dispersion=this.dispersion),this.iridescence!==void 0&amp;&amp;(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&amp;&amp;(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&amp;&amp;(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&amp;&amp;this.iridescenceMap.isTexture&amp;&amp;(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&amp;&amp;this.iridescenceThicknessMap.isTexture&amp;&amp;(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&amp;&amp;(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&amp;&amp;(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&amp;&amp;this.anisotropyMap.isTexture&amp;&amp;(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&amp;&amp;this.map.isTexture&amp;&amp;(n.map=this.map.toJSON(e).uuid),this.matcap&amp;&amp;this.matcap.isTexture&amp;&amp;(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&amp;&amp;this.alphaMap.isTexture&amp;&amp;(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&amp;&amp;this.lightMap.isTexture&amp;&amp;(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&amp;&amp;this.aoMap.isTexture&amp;&amp;(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&amp;&amp;this.bumpMap.isTexture&amp;&amp;(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&amp;&amp;this.normalMap.isTexture&amp;&amp;(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&amp;&amp;this.displacementMap.isTexture&amp;&amp;(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&amp;&amp;this.roughnessMap.isTexture&amp;&amp;(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&amp;&amp;this.metalnessMap.isTexture&amp;&amp;(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&amp;&amp;this.emissiveMap.isTexture&amp;&amp;(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&amp;&amp;this.specularMap.isTexture&amp;&amp;(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&amp;&amp;this.specularIntensityMap.isTexture&amp;&amp;(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&amp;&amp;this.specularColorMap.isTexture&amp;&amp;(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&amp;&amp;this.envMap.isTexture&amp;&amp;(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&amp;&amp;(n.combine=this.combine)),this.envMapRotation!==void 0&amp;&amp;(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&amp;&amp;(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&amp;&amp;(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&amp;&amp;(n.refractionRatio=this.refractionRatio),this.gradientMap&amp;&amp;this.gradientMap.isTexture&amp;&amp;(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&amp;&amp;(n.transmission=this.transmission),this.transmissionMap&amp;&amp;this.transmissionMap.isTexture&amp;&amp;(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&amp;&amp;(n.thickness=this.thickness),this.thicknessMap&amp;&amp;this.thicknessMap.isTexture&amp;&amp;(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&amp;&amp;this.attenuationDistance!==1/0&amp;&amp;(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&amp;&amp;(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&amp;&amp;(n.size=this.size),this.shadowSide!==null&amp;&amp;(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&amp;&amp;(n.sizeAttenuation=this.sizeAttenuation),this.blending!==_i&amp;&amp;(n.blending=this.blending),this.side!==Cn&amp;&amp;(n.side=this.side),this.vertexColors===!0&amp;&amp;(n.vertexColors=!0),this.opacity&lt;1&amp;&amp;(n.opacity=this.opacity),this.transparent===!0&amp;&amp;(n.transparent=!0),this.blendSrc!==Ws&amp;&amp;(n.blendSrc=this.blendSrc),this.blendDst!==Xs&amp;&amp;(n.blendDst=this.blendDst),this.blendEquation!==Hn&amp;&amp;(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&amp;&amp;(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&amp;&amp;(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&amp;&amp;(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&amp;&amp;this.blendColor.isColor&amp;&amp;(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&amp;&amp;(n.blendAlpha=this.blendAlpha),this.depthFunc!==Mi&amp;&amp;(n.depthFunc=this.depthFunc),this.depthTest===!1&amp;&amp;(n.depthTest=this.depthTest),this.depthWrite===!1&amp;&amp;(n.depthWrite=this.depthWrite),this.colorWrite===!1&amp;&amp;(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&amp;&amp;(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==po&amp;&amp;(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&amp;&amp;(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&amp;&amp;(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==$n&amp;&amp;(n.stencilFail=this.stencilFail),this.stencilZFail!==$n&amp;&amp;(n.stencilZFail=this.stencilZFail),this.stencilZPass!==$n&amp;&amp;(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&amp;&amp;(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&amp;&amp;this.rotation!==0&amp;&amp;(n.rotation=this.rotation),this.polygonOffset===!0&amp;&amp;(n.polygonOffset=!0),this.polygonOffsetFactor!==0&amp;&amp;(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&amp;&amp;(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&amp;&amp;this.linewidth!==1&amp;&amp;(n.linewidth=this.linewidth),this.dashSize!==void 0&amp;&amp;(n.dashSize=this.dashSize),this.gapSize!==void 0&amp;&amp;(n.gapSize=this.gapSize),this.scale!==void 0&amp;&amp;(n.scale=this.scale),this.dithering===!0&amp;&amp;(n.dithering=!0),this.alphaTest&gt;0&amp;&amp;(n.alphaTest=this.alphaTest),this.alphaHash===!0&amp;&amp;(n.alphaHash=!0),this.alphaToCoverage===!0&amp;&amp;(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&amp;&amp;(n.premultipliedAlpha=!0),this.forceSinglePass===!0&amp;&amp;(n.forceSinglePass=!0),this.wireframe===!0&amp;&amp;(n.wireframe=!0),this.wireframeLinewidth&gt;1&amp;&amp;(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&amp;&amp;(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&amp;&amp;(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&amp;&amp;(n.flatShading=!0),this.visible===!1&amp;&amp;(n.visible=!1),this.toneMapped===!1&amp;&amp;(n.toneMapped=!1),this.fog===!1&amp;&amp;(n.fog=!1),Object.keys(this.userData).length&gt;0&amp;&amp;(n.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length&gt;0&amp;&amp;(n.textures=s),a.length&gt;0&amp;&amp;(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&amp;&amp;this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Kl extends gn{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new be(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.envMapRotation=new ft,this.combine=Zr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(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.envMapRotation.copy(e.envMapRotation),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.fog=e.fog,this}}const ht=new P,mr=new ke;class Qt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=mo,this.updateRanges=[],this.gpuType=Jt,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&amp;&amp;this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(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.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r&lt;s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t&lt;n;t++)mr.fromBufferAttribute(this,t),mr.applyMatrix3(e),this.setXY(t,mr.x,mr.y);else if(this.itemSize===3)for(let t=0,n=this.count;t&lt;n;t++)ht.fromBufferAttribute(this,t),ht.applyMatrix3(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t&lt;n;t++)ht.fromBufferAttribute(this,t),ht.applyMatrix4(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t&lt;n;t++)ht.fromBufferAttribute(this,t),ht.applyNormalMatrix(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}transformDirection(e){for(let t=0,n=this.count;t&lt;n;t++)ht.fromBufferAttribute(this,t),ht.transformDirection(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&amp;&amp;(n=fi(n,this.array)),n}setComponent(e,t,n){return this.normalized&amp;&amp;(n=yt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&amp;&amp;(t=fi(t,this.array)),t}setX(e,t){return this.normalized&amp;&amp;(t=yt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&amp;&amp;(t=fi(t,this.array)),t}setY(e,t){return this.normalized&amp;&amp;(t=yt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&amp;&amp;(t=fi(t,this.array)),t}setZ(e,t){return this.normalized&amp;&amp;(t=yt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&amp;&amp;(t=fi(t,this.array)),t}setW(e,t){return this.normalized&amp;&amp;(t=yt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&amp;&amp;(t=yt(t,this.array),n=yt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&amp;&amp;(t=yt(t,this.array),n=yt(n,this.array),r=yt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&amp;&amp;(t=yt(t,this.array),n=yt(n,this.array),r=yt(r,this.array),s=yt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&amp;&amp;(e.name=this.name),this.usage!==mo&amp;&amp;(e.usage=this.usage),e}}class Ha extends Qt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class jl extends Qt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class bt extends Qt{constructor(e,t,n){super(new Float32Array(e),t,n)}}let Ku=0;const Ft=new xe,Ts=new at,oi=new P,Dt=new Ci,Bi=new Ci,mt=new P;class zt extends Zn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ku++}),this.uuid=Dn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Wl(e)?jl:Ha)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&amp;&amp;(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ce().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&amp;&amp;(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&amp;&amp;this.computeBoundingBox(),this.boundingSphere!==null&amp;&amp;this.computeBoundingSphere(),this}applyQuaternion(e){return Ft.makeRotationFromQuaternion(e),this.applyMatrix4(Ft),this}rotateX(e){return Ft.makeRotationX(e),this.applyMatrix4(Ft),this}rotateY(e){return Ft.makeRotationY(e),this.applyMatrix4(Ft),this}rotateZ(e){return Ft.makeRotationZ(e),this.applyMatrix4(Ft),this}translate(e,t,n){return Ft.makeTranslation(e,t,n),this.applyMatrix4(Ft),this}scale(e,t,n){return Ft.makeScale(e,t,n),this.applyMatrix4(Ft),this}lookAt(e){return Ts.lookAt(e),Ts.updateMatrix(),this.applyMatrix4(Ts.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(oi).negate(),this.translate(oi.x,oi.y,oi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;r&lt;s;r++){const a=e[r];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new bt(n,3))}else{for(let n=0,r=t.count;n&lt;r;n++){const s=e[n];t.setXYZ(n,s.x,s.y,s.z||0)}e.length&gt;t.count&amp;&amp;console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&amp;&amp;(this.boundingBox=new Ci);const e=this.attributes.position,t=this.morphAttributes.position;if(e&amp;&amp;e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n&lt;r;n++){const s=t[n];Dt.setFromBufferAttribute(s),this.morphTargetsRelative?(mt.addVectors(this.boundingBox.min,Dt.min),this.boundingBox.expandByPoint(mt),mt.addVectors(this.boundingBox.max,Dt.max),this.boundingBox.expandByPoint(mt)):(this.boundingBox.expandByPoint(Dt.min),this.boundingBox.expandByPoint(Dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&amp;&amp;console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&amp;&amp;(this.boundingSphere=new Kn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&amp;&amp;e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new P,1/0);return}if(e){const n=this.boundingSphere.center;if(Dt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s&lt;a;s++){const o=t[s];Bi.setFromBufferAttribute(o),this.morphTargetsRelative?(mt.addVectors(Dt.min,Bi.min),Dt.expandByPoint(mt),mt.addVectors(Dt.max,Bi.max),Dt.expandByPoint(mt)):(Dt.expandByPoint(Bi.min),Dt.expandByPoint(Bi.max))}Dt.getCenter(n);let r=0;for(let s=0,a=e.count;s&lt;a;s++)mt.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(mt));if(t)for(let s=0,a=t.length;s&lt;a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c&lt;u;c++)mt.fromBufferAttribute(o,c),l&amp;&amp;(oi.fromBufferAttribute(e,c),mt.add(oi)),r=Math.max(r,n.distanceToSquared(mt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&amp;&amp;console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&amp;&amp;this.setAttribute("tangent",new Qt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let U=0;U&lt;n.count;U++)o[U]=new P,l[U]=new P;const c=new P,u=new P,h=new P,f=new ke,d=new ke,g=new ke,_=new P,m=new P;function p(U,E,S){c.fromBufferAttribute(n,U),u.fromBufferAttribute(n,E),h.fromBufferAttribute(n,S),f.fromBufferAttribute(s,U),d.fromBufferAttribute(s,E),g.fromBufferAttribute(s,S),u.sub(c),h.sub(c),d.sub(f),g.sub(f);const A=1/(d.x*g.y-g.x*d.y);isFinite(A)&amp;&amp;(_.copy(u).multiplyScalar(g.y).addScaledVector(h,-d.y).multiplyScalar(A),m.copy(h).multiplyScalar(d.x).addScaledVector(u,-g.x).multiplyScalar(A),o[U].add(_),o[E].add(_),o[S].add(_),l[U].add(m),l[E].add(m),l[S].add(m))}let b=this.groups;b.length===0&amp;&amp;(b=[{start:0,count:e.count}]);for(let U=0,E=b.length;U&lt;E;++U){const S=b[U],A=S.start,G=S.count;for(let z=A,X=A+G;z&lt;X;z+=3)p(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const y=new P,M=new P,N=new P,w=new P;function R(U){N.fromBufferAttribute(r,U),w.copy(N);const E=o[U];y.copy(E),y.sub(N.multiplyScalar(N.dot(E))).normalize(),M.crossVectors(w,E);const A=M.dot(l[U])&lt;0?-1:1;a.setXYZW(U,y.x,y.y,y.z,A)}for(let U=0,E=b.length;U&lt;E;++U){const S=b[U],A=S.start,G=S.count;for(let z=A,X=A+G;z&lt;X;z+=3)R(e.getX(z+0)),R(e.getX(z+1)),R(e.getX(z+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Qt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f&lt;d;f++)n.setXYZ(f,0,0,0);const r=new P,s=new P,a=new P,o=new P,l=new P,c=new P,u=new P,h=new P;if(e)for(let f=0,d=e.count;f&lt;d;f+=3){const g=e.getX(f+0),_=e.getX(f+1),m=e.getX(f+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,m),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),o.fromBufferAttribute(n,g),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,m),o.add(u),l.add(u),c.add(u),n.setXYZ(g,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let f=0,d=t.count;f&lt;d;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),a.fromBufferAttribute(t,f+2),u.subVectors(a,s),h.subVectors(r,s),u.cross(h),n.setXYZ(f+0,u.x,u.y,u.z),n.setXYZ(f+1,u.x,u.y,u.z),n.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t&lt;n;t++)mt.fromBufferAttribute(e,t),mt.normalize(),e.setXYZ(t,mt.x,mt.y,mt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,h=o.normalized,f=new c.constructor(l.length*u);let d=0,g=0;for(let _=0,m=l.length;_&lt;m;_++){o.isInterleavedBufferAttribute?d=l[_]*o.data.stride+o.offset:d=l[_]*u;for(let p=0;p&lt;u;p++)f[g++]=c[d++]}return new Qt(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new zt,n=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,n);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,h=c.length;u&lt;h;u++){const f=c[u],d=e(f,n);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o&lt;l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&amp;&amp;(e.name=this.name),Object.keys(this.userData).length&gt;0&amp;&amp;(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&amp;&amp;(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&amp;&amp;(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h&lt;f;h++){const d=c[h];u.push(d.toJSON(e.data))}u.length&gt;0&amp;&amp;(r[l]=u,s=!0)}s&amp;&amp;(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length&gt;0&amp;&amp;(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&amp;&amp;(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&amp;&amp;this.setIndex(n.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f&lt;d;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c&lt;u;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&amp;&amp;(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&amp;&amp;(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Io=new xe,Fn=new Jr,gr=new Kn,Uo=new P,_r=new P,vr=new P,xr=new P,bs=new P,Mr=new P,No=new P,yr=new P;class Zt extends at{constructor(e=new zt,t=new Kl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&amp;&amp;(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&amp;&amp;(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length&gt;0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s&lt;a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&amp;&amp;o){Mr.set(0,0,0);for(let l=0,c=s.length;l&lt;c;l++){const u=o[l],h=s[l];u!==0&amp;&amp;(bs.fromBufferAttribute(h,e),a?Mr.addScaledVector(bs,u):Mr.addScaledVector(bs.sub(t),u))}t.add(Mr)}return t}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&amp;&amp;(n.boundingSphere===null&amp;&amp;n.computeBoundingSphere(),gr.copy(n.boundingSphere),gr.applyMatrix4(s),Fn.copy(e.ray).recast(e.near),!(gr.containsPoint(Fn.origin)===!1&amp;&amp;(Fn.intersectSphere(gr,Uo)===null||Fn.origin.distanceToSquared(Uo)&gt;(e.far-e.near)**2))&amp;&amp;(Io.copy(s).invert(),Fn.copy(e.ray).applyMatrix4(Io),!(n.boundingBox!==null&amp;&amp;Fn.intersectsBox(n.boundingBox)===!1)&amp;&amp;this._computeIntersections(e,t,Fn)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=f.length;g&lt;_;g++){const m=f[g],p=a[m.materialIndex],b=Math.max(m.start,d.start),y=Math.min(o.count,Math.min(m.start+m.count,d.start+d.count));for(let M=b,N=y;M&lt;N;M+=3){const w=o.getX(M),R=o.getX(M+1),U=o.getX(M+2);r=Sr(this,p,e,n,c,u,h,w,R,U),r&amp;&amp;(r.faceIndex=Math.floor(M/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,d.start),_=Math.min(o.count,d.start+d.count);for(let m=g,p=_;m&lt;p;m+=3){const b=o.getX(m),y=o.getX(m+1),M=o.getX(m+2);r=Sr(this,a,e,n,c,u,h,b,y,M),r&amp;&amp;(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=f.length;g&lt;_;g++){const m=f[g],p=a[m.materialIndex],b=Math.max(m.start,d.start),y=Math.min(l.count,Math.min(m.start+m.count,d.start+d.count));for(let M=b,N=y;M&lt;N;M+=3){const w=M,R=M+1,U=M+2;r=Sr(this,p,e,n,c,u,h,w,R,U),r&amp;&amp;(r.faceIndex=Math.floor(M/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,d.start),_=Math.min(l.count,d.start+d.count);for(let m=g,p=_;m&lt;p;m+=3){const b=m,y=m+1,M=m+2;r=Sr(this,a,e,n,c,u,h,b,y,M),r&amp;&amp;(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function ju(i,e,t,n,r,s,a,o){let l;if(e.side===Ct?l=n.intersectTriangle(a,s,r,!0,o):l=n.intersectTriangle(r,s,a,e.side===Cn,o),l===null)return null;yr.copy(o),yr.applyMatrix4(i.matrixWorld);const c=t.ray.origin.distanceTo(yr);return c&lt;t.near||c&gt;t.far?null:{distance:c,point:yr.clone(),object:i}}function Sr(i,e,t,n,r,s,a,o,l,c){i.getVertexPosition(o,_r),i.getVertexPosition(l,vr),i.getVertexPosition(c,xr);const u=ju(i,e,t,n,_r,vr,xr,No);if(u){const h=new P;Yt.getBarycoord(No,_r,vr,xr,h),r&amp;&amp;(u.uv=Yt.getInterpolatedAttribute(r,o,l,c,h,new ke)),s&amp;&amp;(u.uv1=Yt.getInterpolatedAttribute(s,o,l,c,h,new ke)),a&amp;&amp;(u.normal=Yt.getInterpolatedAttribute(a,o,l,c,h,new P),u.normal.dot(n.direction)&gt;0&amp;&amp;u.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new P,materialIndex:0};Yt.getNormal(_r,vr,xr,f.normal),u.face=f,u.barycoord=h}return u}class nr extends zt{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let f=0,d=0;g("z","y","x",-1,-1,n,t,e,a,s,0),g("z","y","x",1,-1,n,t,-e,a,s,1),g("x","z","y",1,1,e,n,t,r,a,2),g("x","z","y",1,-1,e,n,-t,r,a,3),g("x","y","z",1,-1,e,t,n,r,s,4),g("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new bt(c,3)),this.setAttribute("normal",new bt(u,3)),this.setAttribute("uv",new bt(h,2));function g(_,m,p,b,y,M,N,w,R,U,E){const S=M/R,A=N/U,G=M/2,z=N/2,X=w/2,j=R+1,H=U+1;let J=0,k=0;const te=new P;for(let ce=0;ce&lt;H;ce++){const Me=ce*A-z;for(let Pe=0;Pe&lt;j;Pe++){const Ve=Pe*S-G;te[_]=Ve*b,te[m]=Me*y,te[p]=X,c.push(te.x,te.y,te.z),te[_]=0,te[m]=0,te[p]=w&gt;0?1:-1,u.push(te.x,te.y,te.z),h.push(Pe/R),h.push(1-ce/U),J+=1}}for(let ce=0;ce&lt;U;ce++)for(let Me=0;Me&lt;R;Me++){const Pe=f+Me+j*ce,Ve=f+Me+j*(ce+1),W=f+(Me+1)+j*(ce+1),$=f+(Me+1)+j*ce;l.push(Pe,Ve,$),l.push(Ve,W,$),k+=6}o.addGroup(d,k,E),d+=k,f+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ai(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&amp;&amp;(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function St(i){const e={};for(let t=0;t&lt;i.length;t++){const n=Ai(i[t]);for(const r in n)e[r]=n[r]}return e}function $u(i){const e=[];for(let t=0;t&lt;i.length;t++)e.push(i[t].clone());return e}function $l(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ie.workingColorSpace}const Ju={clone:Ai,merge:St};var Qu=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,eh=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Pn extends gn{static get type(){return"ShaderMaterial"}constructor(e){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Qu,this.fragmentShader=eh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&amp;&amp;this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ai(e.uniforms),this.uniformsGroups=$u(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&amp;&amp;a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&amp;&amp;a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&amp;&amp;a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&amp;&amp;a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&amp;&amp;a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&amp;&amp;a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&amp;&amp;a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length&gt;0&amp;&amp;(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&amp;&amp;(n[r]=!0);return Object.keys(n).length&gt;0&amp;&amp;(t.extensions=n),t}}class Jl extends at{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new xe,this.projectionMatrix=new xe,this.projectionMatrixInverse=new xe,this.coordinateSystem=dn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Tn=new P,Fo=new ke,Oo=new ke;class Rt extends Jl{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=bi*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Gi*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return bi*2*Math.atan(Math.tan(Gi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Tn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Tn.x,Tn.y).multiplyScalar(-e/Tn.z),Tn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Tn.x,Tn.y).multiplyScalar(-e/Tn.z)}getViewSize(e,t){return this.getViewBounds(e,Fo,Oo),t.subVectors(Oo,Fo)}setViewOffset(e,t,n,r,s,a){this.aspect=e/t,this.view===null&amp;&amp;(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=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&amp;&amp;(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Gi*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const a=this.view;if(this.view!==null&amp;&amp;this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*n/c,r*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&amp;&amp;(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(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,this.view!==null&amp;&amp;(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const li=-90,ci=1;class th extends at{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Rt(li,ci,e,t);r.layers=this.layers,this.add(r);const s=new Rt(li,ci,e,t);s.layers=this.layers,this.add(s);const a=new Rt(li,ci,e,t);a.layers=this.layers,this.add(a);const o=new Rt(li,ci,e,t);o.layers=this.layers,this.add(o);const l=new Rt(li,ci,e,t);l.layers=this.layers,this.add(l);const c=new Rt(li,ci,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===dn)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Wr)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&amp;&amp;this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&amp;&amp;(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,s),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,l),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(h,f,d),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class Ga extends _t{constructor(e,t,n,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:yi,super(e,t,n,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class nh extends qn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Ga(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:$t}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include &lt;begin_vertex&gt;
					#include &lt;project_vertex&gt;

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include &lt;common&gt;

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},r=new nr(5,5,5),s=new Pn({name:"CubemapFromEquirect",uniforms:Ai(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ct,blending:wn});s.uniforms.tEquirect.value=t;const a=new Zt(r,s),o=t.minFilter;return t.minFilter===Wn&amp;&amp;(t.minFilter=$t),new th(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let a=0;a&lt;6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}const As=new P,ih=new P,rh=new Ce;class kn{constructor(e=new P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=As.subVectors(n,t).cross(ih.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(As),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s&lt;0||s&gt;1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t&lt;0&amp;&amp;n&gt;0||n&lt;0&amp;&amp;t&gt;0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||rh.getNormalMatrix(e),r=this.coplanarPoint(As).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&amp;&amp;e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const On=new Kn,Er=new P;class Wa{constructor(e=new kn,t=new kn,n=new kn,r=new kn,s=new kn,a=new kn){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n&lt;6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=dn){const n=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],d=r[8],g=r[9],_=r[10],m=r[11],p=r[12],b=r[13],y=r[14],M=r[15];if(n[0].setComponents(l-s,f-c,m-d,M-p).normalize(),n[1].setComponents(l+s,f+c,m+d,M+p).normalize(),n[2].setComponents(l+a,f+u,m+g,M+b).normalize(),n[3].setComponents(l-a,f-u,m-g,M-b).normalize(),n[4].setComponents(l-o,f-h,m-_,M-y).normalize(),t===dn)n[5].setComponents(l+o,f+h,m+_,M+y).normalize();else if(t===Wr)n[5].setComponents(o,h,_,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&amp;&amp;e.computeBoundingSphere(),On.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&amp;&amp;t.computeBoundingSphere(),On.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(On)}intersectsSprite(e){return On.center.set(0,0,0),On.radius=.7071067811865476,On.applyMatrix4(e.matrixWorld),this.intersectsSphere(On)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s&lt;6;s++)if(t[s].distanceToPoint(n)&lt;r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n&lt;6;n++){const r=t[n];if(Er.x=r.normal.x&gt;0?e.max.x:e.min.x,Er.y=r.normal.y&gt;0?e.max.y:e.min.y,Er.z=r.normal.z&gt;0?e.max.z:e.min.z,r.distanceToPoint(Er)&lt;0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n&lt;6;n++)if(t[n].distanceToPoint(e)&lt;0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Ql(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&amp;&amp;t!==null&amp;&amp;(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function sh(i){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,h=c.byteLength,f=i.createBuffer();i.bindBuffer(l,f),i.bufferData(l,c,u),o.onUploadCallback();let d;if(c instanceof Float32Array)d=i.FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?d=i.HALF_FLOAT:d=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)d=i.SHORT;else if(c instanceof Uint32Array)d=i.UNSIGNED_INT;else if(c instanceof Int32Array)d=i.INT;else if(c instanceof Int8Array)d=i.BYTE;else if(c instanceof Uint8Array)d=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)d=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function n(o,l,c){const u=l.array,h=l.updateRanges;if(i.bindBuffer(c,o),h.length===0)i.bufferSubData(c,0,u);else{h.sort((d,g)=&gt;d.start-g.start);let f=0;for(let d=1;d&lt;h.length;d++){const g=h[f],_=h[d];_.start&lt;=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++f,h[f]=_)}h.length=f+1;for(let d=0,g=h.length;d&lt;g;d++){const _=h[d];i.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&amp;&amp;(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&amp;&amp;(o=o.data);const l=e.get(o);l&amp;&amp;(i.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&amp;&amp;(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version&lt;o.version)&amp;&amp;e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version&lt;o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}class Qr extends zt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(n),l=Math.floor(r),c=o+1,u=l+1,h=e/o,f=t/l,d=[],g=[],_=[],m=[];for(let p=0;p&lt;u;p++){const b=p*f-a;for(let y=0;y&lt;c;y++){const M=y*h-s;g.push(M,-b,0),_.push(0,0,1),m.push(y/o),m.push(1-p/l)}}for(let p=0;p&lt;l;p++)for(let b=0;b&lt;o;b++){const y=b+c*p,M=b+c*(p+1),N=b+1+c*(p+1),w=b+1+c*p;d.push(y,M,w),d.push(M,N,w)}this.setIndex(d),this.setAttribute("position",new bt(g,3)),this.setAttribute("normal",new bt(_,3)),this.setAttribute("uv",new bt(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qr(e.width,e.height,e.widthSegments,e.heightSegments)}}var ah=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a &lt; getAlphaHashThreshold( vPosition ) ) discard;
#endif`,oh=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x &lt; ( 1.0 - a ) )
			? ( ( x &lt; a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,lh=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,ch=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,uh=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a &lt; alphaTest ) discard;
	#endif
#endif`,hh=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,fh=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) &amp;&amp; defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,dh=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,ph=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,mh=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,gh=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,_h=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,vh=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,xh=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq &lt; 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR &lt; outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] &lt; iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] &lt; iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] &lt; iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m &lt;= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,Mh=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,yh=`#if NUM_CLIPPING_PLANES &gt; 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i &lt; UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES &lt; NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i &lt; NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i &lt; UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) &gt; plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES &lt; NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i &lt; NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) &gt; plane.w ) &amp;&amp; clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,Sh=`#if NUM_CLIPPING_PLANES &gt; 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Eh=`#if NUM_CLIPPING_PLANES &gt; 0
	varying vec3 vClipPosition;
#endif`,Th=`#if NUM_CLIPPING_PLANES &gt; 0
	vClipPosition = - mvPosition.xyz;
#endif`,bh=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Ah=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,wh=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,Rh=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,Ch=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,Ph=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x &gt; absDirection.z ) {
			if ( absDirection.x &gt; absDirection.y )
				face = direction.x &gt; 0.0 ? 0.0 : 3.0;
			else
				face = direction.y &gt; 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z &gt; absDirection.y )
				face = direction.z &gt; 0.0 ? 2.0 : 5.0;
			else
				face = direction.y &gt; 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face &gt; 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness &gt;= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness &gt;= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness &gt;= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness &gt;= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,Lh=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,Dh=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,Ih=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,Uh=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,Nh=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,Fh="gl_FragColor = linearToOutputTexel( gl_FragColor );",Oh=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	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 );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	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 );
}`,Bh=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,zh=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,kh=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,Vh=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,Hh=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,Gh=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,Wh=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,Xh=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,qh=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,Yh=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,Zh=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,Kh=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,jh=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,$h=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance &gt; 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS &gt; 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS &gt; 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS &gt; 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation &gt; 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS &gt; 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS &gt; 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,Jh=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,Qh=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,ef=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,tf=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,nf=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,rf=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,sf=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x &gt; 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) &lt; 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness &lt; 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness &lt; 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness &lt; 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS &gt; 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,af=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence &gt; 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS &gt; 0 ) &amp;&amp; defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) &amp;&amp; NUM_POINT_LIGHT_SHADOWS &gt; 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) &amp;&amp; ( UNROLLED_LOOP_INDEX &lt; NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible &amp;&amp; receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS &gt; 0 ) &amp;&amp; defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) &amp;&amp; NUM_SPOT_LIGHT_SHADOWS &gt; 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX &lt; NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX &lt; NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX &lt; NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) &amp;&amp; ( UNROLLED_LOOP_INDEX &lt; NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible &amp;&amp; receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS &gt; 0 ) &amp;&amp; defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) &amp;&amp; NUM_DIR_LIGHT_SHADOWS &gt; 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) &amp;&amp; ( UNROLLED_LOOP_INDEX &lt; NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible &amp;&amp; receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS &gt; 0 ) &amp;&amp; defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS &gt; 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i &lt; NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,of=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) &amp;&amp; defined( STANDARD ) &amp;&amp; defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) &amp;&amp; defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,lf=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,cf=`#if defined( USE_LOGDEPTHBUF )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,uf=`#if defined( USE_LOGDEPTHBUF )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,hf=`#ifdef USE_LOGDEPTHBUF
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,ff=`#ifdef USE_LOGDEPTHBUF
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,df=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,pf=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,mf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,gf=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,_f=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,vf=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,xf=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i &lt; MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,Mf=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i &lt; MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,yf=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i &lt; MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Sf=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,Ef=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i &lt; MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,Tf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) &amp;&amp; ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) &amp;&amp; ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,bf=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,Af=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,wf=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Rf=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,Cf=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) &amp;&amp; ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,Pf=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,Lf=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,Df=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,If=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,Uf=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Nf=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v &lt;= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v &gt;= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v &lt;= 0.0 )
		return vec3( 0., 0., 0. );
	if( v &gt;= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v &lt;= 0.0 )
		return vec2( 0., 0. );
	if( v &gt;= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,Ff=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,Of=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,Bf=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,zf=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,kf=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,Vf=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,Hf=`#if NUM_SPOT_LIGHT_COORDS &gt; 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS &gt; 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS &gt; 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS &gt; 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS &gt; 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x &gt;= 0.0 &amp;&amp; shadowCoord.x &lt;= 1.0 &amp;&amp; shadowCoord.y &gt;= 0.0 &amp;&amp; shadowCoord.y &lt;= 1.0;
		bool frustumTest = inFrustum &amp;&amp; shadowCoord.z &lt;= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z &gt;= almostOne ) {
			if ( v.z &gt; 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x &gt;= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y &gt;= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar &lt;= 0.0 &amp;&amp; lightToPositionLength - shadowCameraNear &gt;= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,Gf=`#if NUM_SPOT_LIGHT_COORDS &gt; 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS &gt; 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS &gt; 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS &gt; 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,Wf=`#if ( defined( USE_SHADOWMAP ) &amp;&amp; ( NUM_DIR_LIGHT_SHADOWS &gt; 0 || NUM_POINT_LIGHT_SHADOWS &gt; 0 ) ) || ( NUM_SPOT_LIGHT_COORDS &gt; 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS &gt; 0
		#pragma unroll_loop_start
		for ( int i = 0; i &lt; NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS &gt; 0
		#pragma unroll_loop_start
		for ( int i = 0; i &lt; NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS &gt; 0
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) &amp;&amp; UNROLLED_LOOP_INDEX &lt; NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,Xf=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS &gt; 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS &gt; 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS &gt; 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i &lt; NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,qf=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,Yf=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,Zf=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,Kf=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,jf=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,$f=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,Jf=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,Qf=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x &lt; 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak &lt; StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,ed=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,td=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i &lt; 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
		
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
		
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		
		#else
		
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,nd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,id=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,rd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,sd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS &gt; 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const ad=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,od=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
}`,ld=`varying vec3 vWorldDirection;
#include &lt;common&gt;
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include &lt;begin_vertex&gt;
	#include &lt;project_vertex&gt;
	gl_Position.z = gl_Position.w;
}`,cd=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include &lt;cube_uv_reflection_fragment&gt;
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
}`,ud=`varying vec3 vWorldDirection;
#include &lt;common&gt;
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include &lt;begin_vertex&gt;
	#include &lt;project_vertex&gt;
	gl_Position.z = gl_Position.w;
}`,hd=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
}`,fd=`#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
varying vec2 vHighPrecisionZW;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#ifdef USE_DISPLACEMENTMAP
		#include &lt;beginnormal_vertex&gt;
		#include &lt;morphnormal_vertex&gt;
		#include &lt;skinnormal_vertex&gt;
	#endif
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	vHighPrecisionZW = gl_Position.zw;
}`,dd=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include &lt;clipping_planes_fragment&gt;
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include &lt;map_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;logdepthbuf_fragment&gt;
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,pd=`#define DISTANCE
varying vec3 vWorldPosition;
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#ifdef USE_DISPLACEMENTMAP
		#include &lt;beginnormal_vertex&gt;
		#include &lt;morphnormal_vertex&gt;
		#include &lt;skinnormal_vertex&gt;
	#endif
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;worldpos_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	vWorldPosition = worldPosition.xyz;
}`,md=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include &lt;clipping_planes_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,gd=`varying vec3 vWorldDirection;
#include &lt;common&gt;
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include &lt;begin_vertex&gt;
	#include &lt;project_vertex&gt;
}`,_d=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include &lt;common&gt;
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
}`,vd=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include &lt;common&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	vLineDistance = scale * lineDistance;
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,xd=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include &lt;common&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	if ( mod( vLineDistance, totalSize ) &gt; dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	outgoingLight = diffuseColor.rgb;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
}`,Md=`#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;envmap_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;batching_vertex&gt;
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include &lt;beginnormal_vertex&gt;
		#include &lt;morphnormal_vertex&gt;
		#include &lt;skinbase_vertex&gt;
		#include &lt;skinnormal_vertex&gt;
		#include &lt;defaultnormal_vertex&gt;
	#endif
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	#include &lt;worldpos_vertex&gt;
	#include &lt;envmap_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,yd=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include &lt;common&gt;
#include &lt;dithering_pars_fragment&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;aomap_pars_fragment&gt;
#include &lt;lightmap_pars_fragment&gt;
#include &lt;envmap_common_pars_fragment&gt;
#include &lt;envmap_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;specularmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;specularmap_fragment&gt;
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include &lt;aomap_fragment&gt;
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include &lt;envmap_fragment&gt;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
	#include &lt;dithering_fragment&gt;
}`,Sd=`#define LAMBERT
varying vec3 vViewPosition;
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;envmap_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;normal_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;shadowmap_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;normal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	vViewPosition = - mvPosition.xyz;
	#include &lt;worldpos_vertex&gt;
	#include &lt;envmap_vertex&gt;
	#include &lt;shadowmap_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,Ed=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;dithering_pars_fragment&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;aomap_pars_fragment&gt;
#include &lt;lightmap_pars_fragment&gt;
#include &lt;emissivemap_pars_fragment&gt;
#include &lt;envmap_common_pars_fragment&gt;
#include &lt;envmap_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;bsdfs&gt;
#include &lt;lights_pars_begin&gt;
#include &lt;normal_pars_fragment&gt;
#include &lt;lights_lambert_pars_fragment&gt;
#include &lt;shadowmap_pars_fragment&gt;
#include &lt;bumpmap_pars_fragment&gt;
#include &lt;normalmap_pars_fragment&gt;
#include &lt;specularmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;specularmap_fragment&gt;
	#include &lt;normal_fragment_begin&gt;
	#include &lt;normal_fragment_maps&gt;
	#include &lt;emissivemap_fragment&gt;
	#include &lt;lights_lambert_fragment&gt;
	#include &lt;lights_fragment_begin&gt;
	#include &lt;lights_fragment_maps&gt;
	#include &lt;lights_fragment_end&gt;
	#include &lt;aomap_fragment&gt;
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include &lt;envmap_fragment&gt;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
	#include &lt;dithering_fragment&gt;
}`,Td=`#define MATCAP
varying vec3 vViewPosition;
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;normal_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;normal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	#include &lt;fog_vertex&gt;
	vViewPosition = - mvPosition.xyz;
}`,bd=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include &lt;common&gt;
#include &lt;dithering_pars_fragment&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;normal_pars_fragment&gt;
#include &lt;bumpmap_pars_fragment&gt;
#include &lt;normalmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;normal_fragment_begin&gt;
	#include &lt;normal_fragment_maps&gt;
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
	#include &lt;dithering_fragment&gt;
}`,Ad=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;normal_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;normal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,wd=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include &lt;packing&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;normal_pars_fragment&gt;
#include &lt;bumpmap_pars_fragment&gt;
#include &lt;normalmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include &lt;clipping_planes_fragment&gt;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;normal_fragment_begin&gt;
	#include &lt;normal_fragment_maps&gt;
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,Rd=`#define PHONG
varying vec3 vViewPosition;
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;envmap_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;normal_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;shadowmap_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;normal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	vViewPosition = - mvPosition.xyz;
	#include &lt;worldpos_vertex&gt;
	#include &lt;envmap_vertex&gt;
	#include &lt;shadowmap_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,Cd=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;dithering_pars_fragment&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;aomap_pars_fragment&gt;
#include &lt;lightmap_pars_fragment&gt;
#include &lt;emissivemap_pars_fragment&gt;
#include &lt;envmap_common_pars_fragment&gt;
#include &lt;envmap_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;bsdfs&gt;
#include &lt;lights_pars_begin&gt;
#include &lt;normal_pars_fragment&gt;
#include &lt;lights_phong_pars_fragment&gt;
#include &lt;shadowmap_pars_fragment&gt;
#include &lt;bumpmap_pars_fragment&gt;
#include &lt;normalmap_pars_fragment&gt;
#include &lt;specularmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;specularmap_fragment&gt;
	#include &lt;normal_fragment_begin&gt;
	#include &lt;normal_fragment_maps&gt;
	#include &lt;emissivemap_fragment&gt;
	#include &lt;lights_phong_fragment&gt;
	#include &lt;lights_fragment_begin&gt;
	#include &lt;lights_fragment_maps&gt;
	#include &lt;lights_fragment_end&gt;
	#include &lt;aomap_fragment&gt;
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include &lt;envmap_fragment&gt;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
	#include &lt;dithering_fragment&gt;
}`,Pd=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;normal_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;shadowmap_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;normal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	vViewPosition = - mvPosition.xyz;
	#include &lt;worldpos_vertex&gt;
	#include &lt;shadowmap_vertex&gt;
	#include &lt;fog_vertex&gt;
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,Ld=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;dithering_pars_fragment&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;aomap_pars_fragment&gt;
#include &lt;lightmap_pars_fragment&gt;
#include &lt;emissivemap_pars_fragment&gt;
#include &lt;iridescence_fragment&gt;
#include &lt;cube_uv_reflection_fragment&gt;
#include &lt;envmap_common_pars_fragment&gt;
#include &lt;envmap_physical_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;lights_pars_begin&gt;
#include &lt;normal_pars_fragment&gt;
#include &lt;lights_physical_pars_fragment&gt;
#include &lt;transmission_pars_fragment&gt;
#include &lt;shadowmap_pars_fragment&gt;
#include &lt;bumpmap_pars_fragment&gt;
#include &lt;normalmap_pars_fragment&gt;
#include &lt;clearcoat_pars_fragment&gt;
#include &lt;iridescence_pars_fragment&gt;
#include &lt;roughnessmap_pars_fragment&gt;
#include &lt;metalnessmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;roughnessmap_fragment&gt;
	#include &lt;metalnessmap_fragment&gt;
	#include &lt;normal_fragment_begin&gt;
	#include &lt;normal_fragment_maps&gt;
	#include &lt;clearcoat_normal_fragment_begin&gt;
	#include &lt;clearcoat_normal_fragment_maps&gt;
	#include &lt;emissivemap_fragment&gt;
	#include &lt;lights_physical_fragment&gt;
	#include &lt;lights_fragment_begin&gt;
	#include &lt;lights_fragment_maps&gt;
	#include &lt;lights_fragment_end&gt;
	#include &lt;aomap_fragment&gt;
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include &lt;transmission_fragment&gt;
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
	#include &lt;dithering_fragment&gt;
}`,Dd=`#define TOON
varying vec3 vViewPosition;
#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;displacementmap_pars_vertex&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;normal_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;shadowmap_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;normal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;displacementmap_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	vViewPosition = - mvPosition.xyz;
	#include &lt;worldpos_vertex&gt;
	#include &lt;shadowmap_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,Id=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;dithering_pars_fragment&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;aomap_pars_fragment&gt;
#include &lt;lightmap_pars_fragment&gt;
#include &lt;emissivemap_pars_fragment&gt;
#include &lt;gradientmap_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;bsdfs&gt;
#include &lt;lights_pars_begin&gt;
#include &lt;normal_pars_fragment&gt;
#include &lt;lights_toon_pars_fragment&gt;
#include &lt;shadowmap_pars_fragment&gt;
#include &lt;bumpmap_pars_fragment&gt;
#include &lt;normalmap_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	#include &lt;normal_fragment_begin&gt;
	#include &lt;normal_fragment_maps&gt;
	#include &lt;emissivemap_fragment&gt;
	#include &lt;lights_toon_fragment&gt;
	#include &lt;lights_fragment_begin&gt;
	#include &lt;lights_fragment_maps&gt;
	#include &lt;lights_fragment_end&gt;
	#include &lt;aomap_fragment&gt;
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
	#include &lt;dithering_fragment&gt;
}`,Ud=`uniform float size;
uniform float scale;
#include &lt;common&gt;
#include &lt;color_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include &lt;color_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphcolor_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;project_vertex&gt;
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	#include &lt;worldpos_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,Nd=`uniform vec3 diffuse;
uniform float opacity;
#include &lt;common&gt;
#include &lt;color_pars_fragment&gt;
#include &lt;map_particle_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	vec3 outgoingLight = vec3( 0.0 );
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_particle_fragment&gt;
	#include &lt;color_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	outgoingLight = diffuseColor.rgb;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
	#include &lt;premultiplied_alpha_fragment&gt;
}`,Fd=`#include &lt;common&gt;
#include &lt;batching_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;morphtarget_pars_vertex&gt;
#include &lt;skinning_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;shadowmap_pars_vertex&gt;
void main() {
	#include &lt;batching_vertex&gt;
	#include &lt;beginnormal_vertex&gt;
	#include &lt;morphinstance_vertex&gt;
	#include &lt;morphnormal_vertex&gt;
	#include &lt;skinbase_vertex&gt;
	#include &lt;skinnormal_vertex&gt;
	#include &lt;defaultnormal_vertex&gt;
	#include &lt;begin_vertex&gt;
	#include &lt;morphtarget_vertex&gt;
	#include &lt;skinning_vertex&gt;
	#include &lt;project_vertex&gt;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;worldpos_vertex&gt;
	#include &lt;shadowmap_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,Od=`uniform vec3 color;
uniform float opacity;
#include &lt;common&gt;
#include &lt;packing&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;bsdfs&gt;
#include &lt;lights_pars_begin&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;shadowmap_pars_fragment&gt;
#include &lt;shadowmask_pars_fragment&gt;
void main() {
	#include &lt;logdepthbuf_fragment&gt;
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
}`,Bd=`uniform float rotation;
uniform vec2 center;
#include &lt;common&gt;
#include &lt;uv_pars_vertex&gt;
#include &lt;fog_pars_vertex&gt;
#include &lt;logdepthbuf_pars_vertex&gt;
#include &lt;clipping_planes_pars_vertex&gt;
void main() {
	#include &lt;uv_vertex&gt;
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include &lt;logdepthbuf_vertex&gt;
	#include &lt;clipping_planes_vertex&gt;
	#include &lt;fog_vertex&gt;
}`,zd=`uniform vec3 diffuse;
uniform float opacity;
#include &lt;common&gt;
#include &lt;uv_pars_fragment&gt;
#include &lt;map_pars_fragment&gt;
#include &lt;alphamap_pars_fragment&gt;
#include &lt;alphatest_pars_fragment&gt;
#include &lt;alphahash_pars_fragment&gt;
#include &lt;fog_pars_fragment&gt;
#include &lt;logdepthbuf_pars_fragment&gt;
#include &lt;clipping_planes_pars_fragment&gt;
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include &lt;clipping_planes_fragment&gt;
	vec3 outgoingLight = vec3( 0.0 );
	#include &lt;logdepthbuf_fragment&gt;
	#include &lt;map_fragment&gt;
	#include &lt;alphamap_fragment&gt;
	#include &lt;alphatest_fragment&gt;
	#include &lt;alphahash_fragment&gt;
	outgoingLight = diffuseColor.rgb;
	#include &lt;opaque_fragment&gt;
	#include &lt;tonemapping_fragment&gt;
	#include &lt;colorspace_fragment&gt;
	#include &lt;fog_fragment&gt;
}`,Ne={alphahash_fragment:ah,alphahash_pars_fragment:oh,alphamap_fragment:lh,alphamap_pars_fragment:ch,alphatest_fragment:uh,alphatest_pars_fragment:hh,aomap_fragment:fh,aomap_pars_fragment:dh,batching_pars_vertex:ph,batching_vertex:mh,begin_vertex:gh,beginnormal_vertex:_h,bsdfs:vh,iridescence_fragment:xh,bumpmap_pars_fragment:Mh,clipping_planes_fragment:yh,clipping_planes_pars_fragment:Sh,clipping_planes_pars_vertex:Eh,clipping_planes_vertex:Th,color_fragment:bh,color_pars_fragment:Ah,color_pars_vertex:wh,color_vertex:Rh,common:Ch,cube_uv_reflection_fragment:Ph,defaultnormal_vertex:Lh,displacementmap_pars_vertex:Dh,displacementmap_vertex:Ih,emissivemap_fragment:Uh,emissivemap_pars_fragment:Nh,colorspace_fragment:Fh,colorspace_pars_fragment:Oh,envmap_fragment:Bh,envmap_common_pars_fragment:zh,envmap_pars_fragment:kh,envmap_pars_vertex:Vh,envmap_physical_pars_fragment:Jh,envmap_vertex:Hh,fog_vertex:Gh,fog_pars_vertex:Wh,fog_fragment:Xh,fog_pars_fragment:qh,gradientmap_pars_fragment:Yh,lightmap_pars_fragment:Zh,lights_lambert_fragment:Kh,lights_lambert_pars_fragment:jh,lights_pars_begin:$h,lights_toon_fragment:Qh,lights_toon_pars_fragment:ef,lights_phong_fragment:tf,lights_phong_pars_fragment:nf,lights_physical_fragment:rf,lights_physical_pars_fragment:sf,lights_fragment_begin:af,lights_fragment_maps:of,lights_fragment_end:lf,logdepthbuf_fragment:cf,logdepthbuf_pars_fragment:uf,logdepthbuf_pars_vertex:hf,logdepthbuf_vertex:ff,map_fragment:df,map_pars_fragment:pf,map_particle_fragment:mf,map_particle_pars_fragment:gf,metalnessmap_fragment:_f,metalnessmap_pars_fragment:vf,morphinstance_vertex:xf,morphcolor_vertex:Mf,morphnormal_vertex:yf,morphtarget_pars_vertex:Sf,morphtarget_vertex:Ef,normal_fragment_begin:Tf,normal_fragment_maps:bf,normal_pars_fragment:Af,normal_pars_vertex:wf,normal_vertex:Rf,normalmap_pars_fragment:Cf,clearcoat_normal_fragment_begin:Pf,clearcoat_normal_fragment_maps:Lf,clearcoat_pars_fragment:Df,iridescence_pars_fragment:If,opaque_fragment:Uf,packing:Nf,premultiplied_alpha_fragment:Ff,project_vertex:Of,dithering_fragment:Bf,dithering_pars_fragment:zf,roughnessmap_fragment:kf,roughnessmap_pars_fragment:Vf,shadowmap_pars_fragment:Hf,shadowmap_pars_vertex:Gf,shadowmap_vertex:Wf,shadowmask_pars_fragment:Xf,skinbase_vertex:qf,skinning_pars_vertex:Yf,skinning_vertex:Zf,skinnormal_vertex:Kf,specularmap_fragment:jf,specularmap_pars_fragment:$f,tonemapping_fragment:Jf,tonemapping_pars_fragment:Qf,transmission_fragment:ed,transmission_pars_fragment:td,uv_pars_fragment:nd,uv_pars_vertex:id,uv_vertex:rd,worldpos_vertex:sd,background_vert:ad,background_frag:od,backgroundCube_vert:ld,backgroundCube_frag:cd,cube_vert:ud,cube_frag:hd,depth_vert:fd,depth_frag:dd,distanceRGBA_vert:pd,distanceRGBA_frag:md,equirect_vert:gd,equirect_frag:_d,linedashed_vert:vd,linedashed_frag:xd,meshbasic_vert:Md,meshbasic_frag:yd,meshlambert_vert:Sd,meshlambert_frag:Ed,meshmatcap_vert:Td,meshmatcap_frag:bd,meshnormal_vert:Ad,meshnormal_frag:wd,meshphong_vert:Rd,meshphong_frag:Cd,meshphysical_vert:Pd,meshphysical_frag:Ld,meshtoon_vert:Dd,meshtoon_frag:Id,points_vert:Ud,points_frag:Nd,shadow_vert:Fd,shadow_frag:Od,sprite_vert:Bd,sprite_frag:zd},ie={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ce},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ce}},envmap:{envMap:{value:null},envMapRotation:{value:new Ce},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ce}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ce}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ce},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ce},normalScale:{value:new ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ce},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ce}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ce}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ce}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0},uvTransform:{value:new Ce}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ce},alphaMap:{value:null},alphaMapTransform:{value:new Ce},alphaTest:{value:0}}},jt={basic:{uniforms:St([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.fog]),vertexShader:Ne.meshbasic_vert,fragmentShader:Ne.meshbasic_frag},lambert:{uniforms:St([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new be(0)}}]),vertexShader:Ne.meshlambert_vert,fragmentShader:Ne.meshlambert_frag},phong:{uniforms:St([ie.common,ie.specularmap,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,ie.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30}}]),vertexShader:Ne.meshphong_vert,fragmentShader:Ne.meshphong_frag},standard:{uniforms:St([ie.common,ie.envmap,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.roughnessmap,ie.metalnessmap,ie.fog,ie.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ne.meshphysical_vert,fragmentShader:Ne.meshphysical_frag},toon:{uniforms:St([ie.common,ie.aomap,ie.lightmap,ie.emissivemap,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.gradientmap,ie.fog,ie.lights,{emissive:{value:new be(0)}}]),vertexShader:Ne.meshtoon_vert,fragmentShader:Ne.meshtoon_frag},matcap:{uniforms:St([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,ie.fog,{matcap:{value:null}}]),vertexShader:Ne.meshmatcap_vert,fragmentShader:Ne.meshmatcap_frag},points:{uniforms:St([ie.points,ie.fog]),vertexShader:Ne.points_vert,fragmentShader:Ne.points_frag},dashed:{uniforms:St([ie.common,ie.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ne.linedashed_vert,fragmentShader:Ne.linedashed_frag},depth:{uniforms:St([ie.common,ie.displacementmap]),vertexShader:Ne.depth_vert,fragmentShader:Ne.depth_frag},normal:{uniforms:St([ie.common,ie.bumpmap,ie.normalmap,ie.displacementmap,{opacity:{value:1}}]),vertexShader:Ne.meshnormal_vert,fragmentShader:Ne.meshnormal_frag},sprite:{uniforms:St([ie.sprite,ie.fog]),vertexShader:Ne.sprite_vert,fragmentShader:Ne.sprite_frag},background:{uniforms:{uvTransform:{value:new Ce},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ne.background_vert,fragmentShader:Ne.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ce}},vertexShader:Ne.backgroundCube_vert,fragmentShader:Ne.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ne.cube_vert,fragmentShader:Ne.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ne.equirect_vert,fragmentShader:Ne.equirect_frag},distanceRGBA:{uniforms:St([ie.common,ie.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ne.distanceRGBA_vert,fragmentShader:Ne.distanceRGBA_frag},shadow:{uniforms:St([ie.lights,ie.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:Ne.shadow_vert,fragmentShader:Ne.shadow_frag}};jt.physical={uniforms:St([jt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ce},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ce},clearcoatNormalScale:{value:new ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ce},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ce},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ce},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ce},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ce},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ce},transmissionSamplerSize:{value:new ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ce},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ce},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ce},anisotropyVector:{value:new ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ce}}]),vertexShader:Ne.meshphysical_vert,fragmentShader:Ne.meshphysical_frag};const Tr={r:0,b:0,g:0},Bn=new ft,kd=new xe;function Vd(i,e,t,n,r,s,a){const o=new be(0);let l=s===!0?0:1,c,u,h=null,f=0,d=null;function g(b){let y=b.isScene===!0?b.background:null;return y&amp;&amp;y.isTexture&amp;&amp;(y=(b.backgroundBlurriness&gt;0?t:e).get(y)),y}function _(b){let y=!1;const M=g(b);M===null?p(o,l):M&amp;&amp;M.isColor&amp;&amp;(p(M,1),y=!0);const N=i.xr.getEnvironmentBlendMode();N==="additive"?n.buffers.color.setClear(0,0,0,1,a):N==="alpha-blend"&amp;&amp;n.buffers.color.setClear(0,0,0,0,a),(i.autoClear||y)&amp;&amp;(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function m(b,y){const M=g(y);M&amp;&amp;(M.isCubeTexture||M.mapping===Kr)?(u===void 0&amp;&amp;(u=new Zt(new nr(1,1,1),new Pn({name:"BackgroundCubeMaterial",uniforms:Ai(jt.backgroundCube.uniforms),vertexShader:jt.backgroundCube.vertexShader,fragmentShader:jt.backgroundCube.fragmentShader,side:Ct,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(N,w,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Bn.copy(y.backgroundRotation),Bn.x*=-1,Bn.y*=-1,Bn.z*=-1,M.isCubeTexture&amp;&amp;M.isRenderTargetTexture===!1&amp;&amp;(Bn.y*=-1,Bn.z*=-1),u.material.uniforms.envMap.value=M,u.material.uniforms.flipEnvMap.value=M.isCubeTexture&amp;&amp;M.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(kd.makeRotationFromEuler(Bn)),u.material.toneMapped=Ie.getTransfer(M.colorSpace)!==$e,(h!==M||f!==M.version||d!==i.toneMapping)&amp;&amp;(u.material.needsUpdate=!0,h=M,f=M.version,d=i.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null)):M&amp;&amp;M.isTexture&amp;&amp;(c===void 0&amp;&amp;(c=new Zt(new Qr(2,2),new Pn({name:"BackgroundMaterial",uniforms:Ai(jt.background.uniforms),vertexShader:jt.background.vertexShader,fragmentShader:jt.background.fragmentShader,side:Cn,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=Ie.getTransfer(M.colorSpace)!==$e,M.matrixAutoUpdate===!0&amp;&amp;M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||f!==M.version||d!==i.toneMapping)&amp;&amp;(c.material.needsUpdate=!0,h=M,f=M.version,d=i.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function p(b,y){b.getRGB(Tr,$l(i)),n.buffers.color.setClear(Tr.r,Tr.g,Tr.b,y,a)}return{getClearColor:function(){return o},setClearColor:function(b,y=1){o.set(b),l=y,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,p(o,l)},render:_,addToRenderList:m}}function Hd(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=f(null);let s=r,a=!1;function o(S,A,G,z,X){let j=!1;const H=h(z,G,A);s!==H&amp;&amp;(s=H,c(s.object)),j=d(S,z,G,X),j&amp;&amp;g(S,z,G,X),X!==null&amp;&amp;e.update(X,i.ELEMENT_ARRAY_BUFFER),(j||a)&amp;&amp;(a=!1,M(S,A,G,z),X!==null&amp;&amp;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function l(){return i.createVertexArray()}function c(S){return i.bindVertexArray(S)}function u(S){return i.deleteVertexArray(S)}function h(S,A,G){const z=G.wireframe===!0;let X=n[S.id];X===void 0&amp;&amp;(X={},n[S.id]=X);let j=X[A.id];j===void 0&amp;&amp;(j={},X[A.id]=j);let H=j[z];return H===void 0&amp;&amp;(H=f(l()),j[z]=H),H}function f(S){const A=[],G=[],z=[];for(let X=0;X&lt;t;X++)A[X]=0,G[X]=0,z[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:A,enabledAttributes:G,attributeDivisors:z,object:S,attributes:{},index:null}}function d(S,A,G,z){const X=s.attributes,j=A.attributes;let H=0;const J=G.getAttributes();for(const k in J)if(J[k].location&gt;=0){const ce=X[k];let Me=j[k];if(Me===void 0&amp;&amp;(k==="instanceMatrix"&amp;&amp;S.instanceMatrix&amp;&amp;(Me=S.instanceMatrix),k==="instanceColor"&amp;&amp;S.instanceColor&amp;&amp;(Me=S.instanceColor)),ce===void 0||ce.attribute!==Me||Me&amp;&amp;ce.data!==Me.data)return!0;H++}return s.attributesNum!==H||s.index!==z}function g(S,A,G,z){const X={},j=A.attributes;let H=0;const J=G.getAttributes();for(const k in J)if(J[k].location&gt;=0){let ce=j[k];ce===void 0&amp;&amp;(k==="instanceMatrix"&amp;&amp;S.instanceMatrix&amp;&amp;(ce=S.instanceMatrix),k==="instanceColor"&amp;&amp;S.instanceColor&amp;&amp;(ce=S.instanceColor));const Me={};Me.attribute=ce,ce&amp;&amp;ce.data&amp;&amp;(Me.data=ce.data),X[k]=Me,H++}s.attributes=X,s.attributesNum=H,s.index=z}function _(){const S=s.newAttributes;for(let A=0,G=S.length;A&lt;G;A++)S[A]=0}function m(S){p(S,0)}function p(S,A){const G=s.newAttributes,z=s.enabledAttributes,X=s.attributeDivisors;G[S]=1,z[S]===0&amp;&amp;(i.enableVertexAttribArray(S),z[S]=1),X[S]!==A&amp;&amp;(i.vertexAttribDivisor(S,A),X[S]=A)}function b(){const S=s.newAttributes,A=s.enabledAttributes;for(let G=0,z=A.length;G&lt;z;G++)A[G]!==S[G]&amp;&amp;(i.disableVertexAttribArray(G),A[G]=0)}function y(S,A,G,z,X,j,H){H===!0?i.vertexAttribIPointer(S,A,G,X,j):i.vertexAttribPointer(S,A,G,z,X,j)}function M(S,A,G,z){_();const X=z.attributes,j=G.getAttributes(),H=A.defaultAttributeValues;for(const J in j){const k=j[J];if(k.location&gt;=0){let te=X[J];if(te===void 0&amp;&amp;(J==="instanceMatrix"&amp;&amp;S.instanceMatrix&amp;&amp;(te=S.instanceMatrix),J==="instanceColor"&amp;&amp;S.instanceColor&amp;&amp;(te=S.instanceColor)),te!==void 0){const ce=te.normalized,Me=te.itemSize,Pe=e.get(te);if(Pe===void 0)continue;const Ve=Pe.buffer,W=Pe.type,$=Pe.bytesPerElement,de=W===i.INT||W===i.UNSIGNED_INT||te.gpuType===Na;if(te.isInterleavedBufferAttribute){const ne=te.data,ye=ne.stride,Ae=te.offset;if(ne.isInstancedInterleavedBuffer){for(let Fe=0;Fe&lt;k.locationSize;Fe++)p(k.location+Fe,ne.meshPerAttribute);S.isInstancedMesh!==!0&amp;&amp;z._maxInstanceCount===void 0&amp;&amp;(z._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Fe=0;Fe&lt;k.locationSize;Fe++)m(k.location+Fe);i.bindBuffer(i.ARRAY_BUFFER,Ve);for(let Fe=0;Fe&lt;k.locationSize;Fe++)y(k.location+Fe,Me/k.locationSize,W,ce,ye*$,(Ae+Me/k.locationSize*Fe)*$,de)}else{if(te.isInstancedBufferAttribute){for(let ne=0;ne&lt;k.locationSize;ne++)p(k.location+ne,te.meshPerAttribute);S.isInstancedMesh!==!0&amp;&amp;z._maxInstanceCount===void 0&amp;&amp;(z._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let ne=0;ne&lt;k.locationSize;ne++)m(k.location+ne);i.bindBuffer(i.ARRAY_BUFFER,Ve);for(let ne=0;ne&lt;k.locationSize;ne++)y(k.location+ne,Me/k.locationSize,W,ce,Me*$,Me/k.locationSize*ne*$,de)}}else if(H!==void 0){const ce=H[J];if(ce!==void 0)switch(ce.length){case 2:i.vertexAttrib2fv(k.location,ce);break;case 3:i.vertexAttrib3fv(k.location,ce);break;case 4:i.vertexAttrib4fv(k.location,ce);break;default:i.vertexAttrib1fv(k.location,ce)}}}}b()}function N(){U();for(const S in n){const A=n[S];for(const G in A){const z=A[G];for(const X in z)u(z[X].object),delete z[X];delete A[G]}delete n[S]}}function w(S){if(n[S.id]===void 0)return;const A=n[S.id];for(const G in A){const z=A[G];for(const X in z)u(z[X].object),delete z[X];delete A[G]}delete n[S.id]}function R(S){for(const A in n){const G=n[A];if(G[S.id]===void 0)continue;const z=G[S.id];for(const X in z)u(z[X].object),delete z[X];delete G[S.id]}}function U(){E(),a=!0,s!==r&amp;&amp;(s=r,c(s.object))}function E(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:U,resetDefaultState:E,dispose:N,releaseStatesOfGeometry:w,releaseStatesOfProgram:R,initAttributes:_,enableAttribute:m,disableUnusedAttributes:b}}function Gd(i,e,t){let n;function r(c){n=c}function s(c,u){i.drawArrays(n,c,u),t.update(u,n,1)}function a(c,u,h){h!==0&amp;&amp;(i.drawArraysInstanced(n,c,u,h),t.update(u,n,h))}function o(c,u,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,u,0,h);let d=0;for(let g=0;g&lt;h;g++)d+=u[g];t.update(d,n,1)}function l(c,u,h,f){if(h===0)return;const d=e.get("WEBGL_multi_draw");if(d===null)for(let g=0;g&lt;c.length;g++)a(c[g],u[g],f[g]);else{d.multiDrawArraysInstancedWEBGL(n,c,0,u,0,f,0,h);let g=0;for(let _=0;_&lt;h;_++)g+=u[_]*f[_];t.update(g,n,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Wd(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(R){return!(R!==Bt&amp;&amp;n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const U=R===tr&amp;&amp;(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==mn&amp;&amp;n.convert(R)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&amp;&amp;R!==Jt&amp;&amp;!U)}function l(R){if(R==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision&gt;0&amp;&amp;i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision&gt;0)return"highp";R="mediump"}return R==="mediump"&amp;&amp;i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision&gt;0&amp;&amp;i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision&gt;0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&amp;&amp;(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const h=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&amp;&amp;e.has("EXT_clip_control"),d=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),g=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),p=i.getParameter(i.MAX_VERTEX_ATTRIBS),b=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),y=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),N=g&gt;0,w=i.getParameter(i.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reverseDepthBuffer:f,maxTextures:d,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:p,maxVertexUniforms:b,maxVaryings:y,maxFragmentUniforms:M,vertexTextures:N,maxSamples:w}}function Xd(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new kn,o=new Ce,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const d=h.length!==0||f||n!==0||r;return r=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){const g=h.clippingPlanes,_=h.clipIntersection,m=h.clipShadows,p=i.get(h);if(!r||g===null||g.length===0||s&amp;&amp;!m)s?u(null):c();else{const b=s?0:n,y=b*4;let M=p.clippingState||null;l.value=M,M=u(g,f,y,d);for(let N=0;N!==y;++N)M[N]=t[N];p.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&amp;&amp;(l.value=t,l.needsUpdate=n&gt;0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,g){const _=h!==null?h.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const p=d+_*4,b=f.matrixWorldInverse;o.getNormalMatrix(b),(m===null||m.length&lt;p)&amp;&amp;(m=new Float32Array(p));for(let y=0,M=d;y!==_;++y,M+=4)a.copy(h[y]).applyMatrix4(b,o),a.normal.toArray(m,M),m[M+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function qd(i){let e=new WeakMap;function t(a,o){return o===Hr?a.mapping=yi:o===Qs&amp;&amp;(a.mapping=Si),a}function n(a){if(a&amp;&amp;a.isTexture){const o=a.mapping;if(o===Hr||o===Qs)if(e.has(a)){const l=e.get(a).texture;return t(l,a.mapping)}else{const l=a.image;if(l&amp;&amp;l.height&gt;0){const c=new nh(l.height);return c.fromEquirectangularTexture(i,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&amp;&amp;(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class ec extends Jl{constructor(e=-1,t=1,n=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(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=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,a){this.view===null&amp;&amp;(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=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&amp;&amp;(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const 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;let s=n-e,a=n+e,o=r+t,l=r-t;if(this.view!==null&amp;&amp;this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(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,this.view!==null&amp;&amp;(t.object.view=Object.assign({},this.view)),t}}const di=4,Bo=[.125,.215,.35,.446,.526,.582],Gn=20,ws=new ec,zo=new be;let Rs=null,Cs=0,Ps=0,Ls=!1;const Vn=(1+Math.sqrt(5))/2,ui=1/Vn,ko=[new P(-Vn,ui,0),new P(Vn,ui,0),new P(-ui,0,Vn),new P(ui,0,Vn),new P(0,Vn,-ui),new P(0,Vn,ui),new P(-1,1,-1),new P(1,1,-1),new P(-1,1,1),new P(1,1,1)];class Vo{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){Rs=this._renderer.getRenderTarget(),Cs=this._renderer.getActiveCubeFace(),Ps=this._renderer.getActiveMipmapLevel(),Ls=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t&gt;0&amp;&amp;this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&amp;&amp;(this._cubemapMaterial=Wo(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&amp;&amp;(this._equirectMaterial=Go(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&amp;&amp;this._cubemapMaterial.dispose(),this._equirectMaterial!==null&amp;&amp;this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&amp;&amp;this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&amp;&amp;this._pingPongRenderTarget.dispose();for(let e=0;e&lt;this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Rs,Cs,Ps),this._renderer.xr.enabled=Ls,e.scissorTest=!1,br(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===yi||e.mapping===Si?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Rs=this._renderer.getRenderTarget(),Cs=this._renderer.getActiveCubeFace(),Ps=this._renderer.getActiveMipmapLevel(),Ls=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:$t,minFilter:$t,generateMipmaps:!1,type:tr,format:Bt,colorSpace:Ri,depthBuffer:!1},r=Ho(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&amp;&amp;this._dispose(),this._pingPongRenderTarget=Ho(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Yd(s)),this._blurMaterial=Zd(s,e,t)}return r}_compileMaterial(e){const t=new Zt(this._lodPlanes[0],e);this._renderer.compile(t,ws)}_sceneToCubeUV(e,t,n,r){const o=new Rt(90,1,t,n),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(zo),u.toneMapping=Rn,u.autoClear=!1;const d=new Kl({name:"PMREM.Background",side:Ct,depthWrite:!1,depthTest:!1}),g=new Zt(new nr,d);let _=!1;const m=e.background;m?m.isColor&amp;&amp;(d.color.copy(m),e.background=null,_=!0):(d.color.copy(zo),_=!0);for(let p=0;p&lt;6;p++){const b=p%3;b===0?(o.up.set(0,l[p],0),o.lookAt(c[p],0,0)):b===1?(o.up.set(0,0,l[p]),o.lookAt(0,c[p],0)):(o.up.set(0,l[p],0),o.lookAt(0,0,c[p]));const y=this._cubeSize;br(r,b*y,p&gt;2?y:0,y,y),u.setRenderTarget(r),_&amp;&amp;u.render(g,o),u.render(e,o)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===yi||e.mapping===Si;r?(this._cubemapMaterial===null&amp;&amp;(this._cubemapMaterial=Wo()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&amp;&amp;(this._equirectMaterial=Go());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new Zt(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;br(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,ws)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;s&lt;r;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=ko[(r-s-1)%ko.length];this._blur(e,s-1,s,a,o)}t.autoClear=n}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&amp;&amp;a!=="longitudinal"&amp;&amp;console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new Zt(this._lodPlanes[r],c),f=c.uniforms,d=this._sizeLods[n]-1,g=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Gn-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):Gn;m&gt;Gn&amp;&amp;console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Gn}`);const p=[];let b=0;for(let R=0;R&lt;Gn;++R){const U=R/_,E=Math.exp(-U*U/2);p.push(E),R===0?b+=E:R&lt;m&amp;&amp;(b+=2*E)}for(let R=0;R&lt;p.length;R++)p[R]=p[R]/b;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=p,f.latitudinal.value=a==="latitudinal",o&amp;&amp;(f.poleAxis.value=o);const{_lodMax:y}=this;f.dTheta.value=g,f.mipInt.value=y-n;const M=this._sizeLods[r],N=3*M*(r&gt;y-di?r-y+di:0),w=4*(this._cubeSize-M);br(t,N,w,3*M,2*M),l.setRenderTarget(t),l.render(h,ws)}}function Yd(i){const e=[],t=[],n=[];let r=i;const s=i-di+1+Bo.length;for(let a=0;a&lt;s;a++){const o=Math.pow(2,r);t.push(o);let l=1/o;a&gt;i-di?l=Bo[a-i+di-1]:a===0&amp;&amp;(l=0),n.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,g=6,_=3,m=2,p=1,b=new Float32Array(_*g*d),y=new Float32Array(m*g*d),M=new Float32Array(p*g*d);for(let w=0;w&lt;d;w++){const R=w%3*2/3-1,U=w&gt;2?0:-1,E=[R,U,0,R+2/3,U,0,R+2/3,U+1,0,R,U,0,R+2/3,U+1,0,R,U+1,0];b.set(E,_*g*w),y.set(f,m*g*w);const S=[w,w,w,w,w,w];M.set(S,p*g*w)}const N=new zt;N.setAttribute("position",new Qt(b,_)),N.setAttribute("uv",new Qt(y,m)),N.setAttribute("faceIndex",new Qt(M,p)),e.push(N),r&gt;di&amp;&amp;r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Ho(i,e,t){const n=new qn(i,e,t);return n.texture.mapping=Kr,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function br(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Zd(i,e,t){const n=new Float32Array(Gn),r=new P(0,1,0);return new Pn({name:"SphericalGaussianBlur",defines:{n:Gn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Xa(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include &lt;cube_uv_reflection_fragment&gt;

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i &lt; n; i++ ) {

					if ( i &gt;= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:wn,depthTest:!1,depthWrite:!1})}function Go(){return new Pn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Xa(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include &lt;common&gt;

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:wn,depthTest:!1,depthWrite:!1})}function Wo(){return new Pn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Xa(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:wn,depthTest:!1,depthWrite:!1})}function Xa(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function Kd(i){let e=new WeakMap,t=null;function n(o){if(o&amp;&amp;o.isTexture){const l=o.mapping,c=l===Hr||l===Qs,u=l===yi||l===Si;if(c||u){let h=e.get(o);const f=h!==void 0?h.texture.pmremVersion:0;if(o.isRenderTargetTexture&amp;&amp;o.pmremVersion!==f)return t===null&amp;&amp;(t=new Vo(i)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),h.texture;if(h!==void 0)return h.texture;{const d=o.image;return c&amp;&amp;d&amp;&amp;d.height&gt;0||u&amp;&amp;d&amp;&amp;r(d)?(t===null&amp;&amp;(t=new Vo(i)),h=c?t.fromEquirectangular(o):t.fromCubemap(o),h.texture.pmremVersion=o.pmremVersion,e.set(o,h),o.addEventListener("dispose",s),h.texture):null}}}return o}function r(o){let l=0;const c=6;for(let u=0;u&lt;c;u++)o[u]!==void 0&amp;&amp;l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&amp;&amp;(e.delete(l),c.dispose())}function a(){e=new WeakMap,t!==null&amp;&amp;(t.dispose(),t=null)}return{get:n,dispose:a}}function jd(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&amp;&amp;Vi("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function $d(i,e,t,n){const r={},s=new WeakMap;function a(h){const f=h.target;f.index!==null&amp;&amp;e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);for(const g in f.morphAttributes){const _=f.morphAttributes[g];for(let m=0,p=_.length;m&lt;p;m++)e.remove(_[m])}f.removeEventListener("dispose",a),delete r[f.id];const d=s.get(f);d&amp;&amp;(e.remove(d),s.delete(f)),n.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&amp;&amp;delete f._maxInstanceCount,t.memory.geometries--}function o(h,f){return r[f.id]===!0||(f.addEventListener("dispose",a),r[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const g in f)e.update(f[g],i.ARRAY_BUFFER);const d=h.morphAttributes;for(const g in d){const _=d[g];for(let m=0,p=_.length;m&lt;p;m++)e.update(_[m],i.ARRAY_BUFFER)}}function c(h){const f=[],d=h.index,g=h.attributes.position;let _=0;if(d!==null){const b=d.array;_=d.version;for(let y=0,M=b.length;y&lt;M;y+=3){const N=b[y+0],w=b[y+1],R=b[y+2];f.push(N,w,w,R,R,N)}}else if(g!==void 0){const b=g.array;_=g.version;for(let y=0,M=b.length/3-1;y&lt;M;y+=3){const N=y+0,w=y+1,R=y+2;f.push(N,w,w,R,R,N)}}else return;const m=new(Wl(f)?jl:Ha)(f,1);m.version=_;const p=s.get(h);p&amp;&amp;e.remove(p),s.set(h,m)}function u(h){const f=s.get(h);if(f){const d=h.index;d!==null&amp;&amp;f.version&lt;d.version&amp;&amp;c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:u}}function Jd(i,e,t){let n;function r(f){n=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*a),t.update(d,n,1)}function c(f,d,g){g!==0&amp;&amp;(i.drawElementsInstanced(n,d,s,f*a,g),t.update(d,n,g))}function u(f,d,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,g);let m=0;for(let p=0;p&lt;g;p++)m+=d[p];t.update(m,n,1)}function h(f,d,g,_){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let p=0;p&lt;f.length;p++)c(f[p]/a,d[p],_[p]);else{m.multiDrawElementsInstancedWEBGL(n,d,0,s,f,0,_,0,g);let p=0;for(let b=0;b&lt;g;b++)p+=d[b]*_[b];t.update(p,n,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=h}function Qd(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case i.TRIANGLES:t.triangles+=o*(s/3);break;case i.LINES:t.lines+=o*(s/2);break;case i.LINE_STRIP:t.lines+=o*(s-1);break;case i.LINE_LOOP:t.lines+=o*s;break;case i.POINTS:t.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function ep(i,e,t){const n=new WeakMap,r=new ze;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=u!==void 0?u.length:0;let f=n.get(o);if(f===void 0||f.count!==h){let E=function(){R.dispose(),n.delete(o),o.removeEventListener("dispose",E)};f!==void 0&amp;&amp;f.texture.dispose();const d=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],b=o.morphAttributes.color||[];let y=0;d===!0&amp;&amp;(y=1),g===!0&amp;&amp;(y=2),_===!0&amp;&amp;(y=3);let M=o.attributes.position.count*y,N=1;M&gt;e.maxTextureSize&amp;&amp;(N=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const w=new Float32Array(M*N*4*h),R=new ql(w,M,N,h);R.type=Jt,R.needsUpdate=!0;const U=y*4;for(let S=0;S&lt;h;S++){const A=m[S],G=p[S],z=b[S],X=M*N*4*S;for(let j=0;j&lt;A.count;j++){const H=j*U;d===!0&amp;&amp;(r.fromBufferAttribute(A,j),w[X+H+0]=r.x,w[X+H+1]=r.y,w[X+H+2]=r.z,w[X+H+3]=0),g===!0&amp;&amp;(r.fromBufferAttribute(G,j),w[X+H+4]=r.x,w[X+H+5]=r.y,w[X+H+6]=r.z,w[X+H+7]=0),_===!0&amp;&amp;(r.fromBufferAttribute(z,j),w[X+H+8]=r.x,w[X+H+9]=r.y,w[X+H+10]=r.z,w[X+H+11]=z.itemSize===4?r.w:1)}}f={count:h,texture:R,size:new ke(M,N)},n.set(o,f),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&amp;&amp;a.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",a.morphTexture,t);else{let d=0;for(let _=0;_&lt;c.length;_++)d+=c[_];const g=o.morphTargetsRelative?1:1-d;l.getUniforms().setValue(i,"morphTargetBaseInfluence",g),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",f.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",f.size)}return{update:s}}function tp(i,e,t,n){let r=new WeakMap;function s(l){const c=n.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&amp;&amp;(e.update(h),r.set(h,c)),l.isInstancedMesh&amp;&amp;(l.hasEventListener("dispose",o)===!1&amp;&amp;l.addEventListener("dispose",o),r.get(l)!==c&amp;&amp;(t.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&amp;&amp;t.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;r.get(f)!==c&amp;&amp;(f.update(),r.set(f,c))}return h}function a(){r=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),t.remove(c.instanceMatrix),c.instanceColor!==null&amp;&amp;t.remove(c.instanceColor)}return{update:s,dispose:a}}class tc extends _t{constructor(e,t,n,r,s,a,o,l,c,u=vi){if(u!==vi&amp;&amp;u!==Ti)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&amp;&amp;u===vi&amp;&amp;(n=Xn),n===void 0&amp;&amp;u===Ti&amp;&amp;(n=Ei),super(null,r,s,a,o,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:It,this.minFilter=l!==void 0?l:It,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&amp;&amp;(t.compareFunction=this.compareFunction),t}}const nc=new _t,Xo=new tc(1,1),ic=new ql,rc=new ku,sc=new Ga,qo=[],Yo=[],Zo=new Float32Array(16),Ko=new Float32Array(9),jo=new Float32Array(4);function Pi(i,e,t){const n=i[0];if(n&lt;=0||n&gt;0)return i;const r=e*t;let s=qo[r];if(s===void 0&amp;&amp;(s=new Float32Array(r),qo[r]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,i[a].toArray(s,o)}return s}function dt(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t&lt;n;t++)if(i[t]!==e[t])return!1;return!0}function pt(i,e){for(let t=0,n=e.length;t&lt;n;t++)i[t]=e[t]}function es(i,e){let t=Yo[e];t===void 0&amp;&amp;(t=new Int32Array(e),Yo[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function np(i,e){const t=this.cache;t[0]!==e&amp;&amp;(i.uniform1f(this.addr,e),t[0]=e)}function ip(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&amp;&amp;(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(dt(t,e))return;i.uniform2fv(this.addr,e),pt(t,e)}}function rp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&amp;&amp;(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&amp;&amp;(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(dt(t,e))return;i.uniform3fv(this.addr,e),pt(t,e)}}function sp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&amp;&amp;(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(dt(t,e))return;i.uniform4fv(this.addr,e),pt(t,e)}}function ap(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(dt(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,n))return;jo.set(n),i.uniformMatrix2fv(this.addr,!1,jo),pt(t,n)}}function op(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(dt(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,n))return;Ko.set(n),i.uniformMatrix3fv(this.addr,!1,Ko),pt(t,n)}}function lp(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(dt(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),pt(t,e)}else{if(dt(t,n))return;Zo.set(n),i.uniformMatrix4fv(this.addr,!1,Zo),pt(t,n)}}function cp(i,e){const t=this.cache;t[0]!==e&amp;&amp;(i.uniform1i(this.addr,e),t[0]=e)}function up(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&amp;&amp;(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(dt(t,e))return;i.uniform2iv(this.addr,e),pt(t,e)}}function hp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&amp;&amp;(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(dt(t,e))return;i.uniform3iv(this.addr,e),pt(t,e)}}function fp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&amp;&amp;(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(dt(t,e))return;i.uniform4iv(this.addr,e),pt(t,e)}}function dp(i,e){const t=this.cache;t[0]!==e&amp;&amp;(i.uniform1ui(this.addr,e),t[0]=e)}function pp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&amp;&amp;(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(dt(t,e))return;i.uniform2uiv(this.addr,e),pt(t,e)}}function mp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&amp;&amp;(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(dt(t,e))return;i.uniform3uiv(this.addr,e),pt(t,e)}}function gp(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&amp;&amp;(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(dt(t,e))return;i.uniform4uiv(this.addr,e),pt(t,e)}}function _p(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&amp;&amp;(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(Xo.compareFunction=Gl,s=Xo):s=nc,t.setTexture2D(e||s,r)}function vp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&amp;&amp;(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||rc,r)}function xp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&amp;&amp;(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||sc,r)}function Mp(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&amp;&amp;(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||ic,r)}function yp(i){switch(i){case 5126:return np;case 35664:return ip;case 35665:return rp;case 35666:return sp;case 35674:return ap;case 35675:return op;case 35676:return lp;case 5124:case 35670:return cp;case 35667:case 35671:return up;case 35668:case 35672:return hp;case 35669:case 35673:return fp;case 5125:return dp;case 36294:return pp;case 36295:return mp;case 36296:return gp;case 35678:case 36198:case 36298:case 36306:case 35682:return _p;case 35679:case 36299:case 36307:return vp;case 35680:case 36300:case 36308:case 36293:return xp;case 36289:case 36303:case 36311:case 36292:return Mp}}function Sp(i,e){i.uniform1fv(this.addr,e)}function Ep(i,e){const t=Pi(e,this.size,2);i.uniform2fv(this.addr,t)}function Tp(i,e){const t=Pi(e,this.size,3);i.uniform3fv(this.addr,t)}function bp(i,e){const t=Pi(e,this.size,4);i.uniform4fv(this.addr,t)}function Ap(i,e){const t=Pi(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function wp(i,e){const t=Pi(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function Rp(i,e){const t=Pi(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Cp(i,e){i.uniform1iv(this.addr,e)}function Pp(i,e){i.uniform2iv(this.addr,e)}function Lp(i,e){i.uniform3iv(this.addr,e)}function Dp(i,e){i.uniform4iv(this.addr,e)}function Ip(i,e){i.uniform1uiv(this.addr,e)}function Up(i,e){i.uniform2uiv(this.addr,e)}function Np(i,e){i.uniform3uiv(this.addr,e)}function Fp(i,e){i.uniform4uiv(this.addr,e)}function Op(i,e,t){const n=this.cache,r=e.length,s=es(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTexture2D(e[a]||nc,s[a])}function Bp(i,e,t){const n=this.cache,r=e.length,s=es(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||rc,s[a])}function zp(i,e,t){const n=this.cache,r=e.length,s=es(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||sc,s[a])}function kp(i,e,t){const n=this.cache,r=e.length,s=es(t,r);dt(n,s)||(i.uniform1iv(this.addr,s),pt(n,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||ic,s[a])}function Vp(i){switch(i){case 5126:return Sp;case 35664:return Ep;case 35665:return Tp;case 35666:return bp;case 35674:return Ap;case 35675:return wp;case 35676:return Rp;case 5124:case 35670:return Cp;case 35667:case 35671:return Pp;case 35668:case 35672:return Lp;case 35669:case 35673:return Dp;case 5125:return Ip;case 36294:return Up;case 36295:return Np;case 36296:return Fp;case 35678:case 36198:case 36298:case 36306:case 35682:return Op;case 35679:case 36299:case 36307:return Bp;case 35680:case 36300:case 36308:case 36293:return zp;case 36289:case 36303:case 36311:case 36292:return kp}}class Hp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=yp(t.type)}}class Gp{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Vp(t.type)}}class Wp{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],n)}}}const Ds=/(\w+)(\])?(\[|\.)?/g;function $o(i,e){i.seq.push(e),i.map[e.id]=e}function Xp(i,e,t){const n=i.name,r=n.length;for(Ds.lastIndex=0;;){const s=Ds.exec(n),a=Ds.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&amp;&amp;(o=o|0),c===void 0||c==="["&amp;&amp;a+2===r){$o(t,c===void 0?new Hp(o,i,e):new Gp(o,i,e));break}else{let h=t.map[o];h===void 0&amp;&amp;(h=new Wp(o),$o(t,h)),t=h}}}class Vr{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r&lt;n;++r){const s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);Xp(s,a,this)}}setValue(e,t,n,r){const s=this.map[t];s!==void 0&amp;&amp;s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&amp;&amp;this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=n[o.id];l.needsUpdate!==!1&amp;&amp;o.setValue(e,l.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&amp;&amp;n.push(a)}return n}}function Jo(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const qp=37297;let Yp=0;function Zp(i,e){const t=i.split(`
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a&lt;s;a++){const o=a+1;n.push(`${o===e?"&gt;":" "} ${o}: ${t[a]}`)}return n.join(`
`)}const Qo=new Ce;function Kp(i){Ie._getMatrix(Qo,Ie.workingColorSpace,i);const e=`mat3( ${Qo.elements.map(t=&gt;t.toFixed(4))} )`;switch(Ie.getTransfer(i)){case $r:return[e,"LinearTransferOETF"];case $e:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function el(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),r=i.getShaderInfoLog(e).trim();if(n&amp;&amp;r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+`

`+r+`

`+Zp(i.getShaderSource(e),a)}else return r}function jp(i,e){const t=Kp(e);return[`vec4 ${i}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
`)}function $p(i,e){let t;switch(e){case jc:t="Linear";break;case $c:t="Reinhard";break;case Jc:t="Cineon";break;case Qc:t="ACESFilmic";break;case tu:t="AgX";break;case nu:t="Neutral";break;case eu:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ar=new P;function Jp(){Ie.getLuminanceCoefficients(Ar);const i=Ar.x.toFixed(4),e=Ar.y.toFixed(4),t=Ar.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
`)}function Qp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Hi).join(`
`)}function em(i){const e=[];for(const t in i){const n=i[t];n!==!1&amp;&amp;e.push("#define "+t+" "+n)}return e.join(`
`)}function tm(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r&lt;n;r++){const s=i.getActiveAttrib(e,r),a=s.name;let o=1;s.type===i.FLOAT_MAT2&amp;&amp;(o=2),s.type===i.FLOAT_MAT3&amp;&amp;(o=3),s.type===i.FLOAT_MAT4&amp;&amp;(o=4),t[a]={type:s.type,location:i.getAttribLocation(e,a),locationSize:o}}return t}function Hi(i){return i!==""}function tl(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function nl(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const nm=/^[ \t]*#include +&lt;([\w\d./]+)&gt;/gm;function Ra(i){return i.replace(nm,rm)}const im=new Map;function rm(i,e){let t=Ne[e];if(t===void 0){const n=im.get(e);if(n!==void 0)t=Ne[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include &lt;"+e+"&gt;")}return Ra(t)}const sm=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*&lt;\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function il(i){return i.replace(sm,am)}function am(i,e,t,n){let r="";for(let s=parseInt(e);s&lt;parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function rl(i){let e=`precision ${i.precision} float;
	precision ${i.precision} int;
	precision ${i.precision} sampler2D;
	precision ${i.precision} samplerCube;
	precision ${i.precision} sampler3D;
	precision ${i.precision} sampler2DArray;
	precision ${i.precision} sampler2DShadow;
	precision ${i.precision} samplerCubeShadow;
	precision ${i.precision} sampler2DArrayShadow;
	precision ${i.precision} isampler2D;
	precision ${i.precision} isampler3D;
	precision ${i.precision} isamplerCube;
	precision ${i.precision} isampler2DArray;
	precision ${i.precision} usampler2D;
	precision ${i.precision} usampler3D;
	precision ${i.precision} usamplerCube;
	precision ${i.precision} usampler2DArray;
	`;return i.precision==="highp"?e+=`
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:i.precision==="lowp"&amp;&amp;(e+=`
#define LOW_PRECISION`),e}function om(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Ll?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Cc?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===un&amp;&amp;(e="SHADOWMAP_TYPE_VSM"),e}function lm(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case yi:case Si:e="ENVMAP_TYPE_CUBE";break;case Kr:e="ENVMAP_TYPE_CUBE_UV";break}return e}function cm(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Si:e="ENVMAP_MODE_REFRACTION";break}return e}function um(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case Zr:e="ENVMAP_BLENDING_MULTIPLY";break;case Zc:e="ENVMAP_BLENDING_MIX";break;case Kc:e="ENVMAP_BLENDING_ADD";break}return e}function hm(i){const e=i.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function fm(i,e,t,n){const r=i.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=om(t),c=lm(t),u=cm(t),h=um(t),f=hm(t),d=Qp(t),g=em(s),_=r.createProgram();let m,p,b=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Hi).join(`
`),m.length&gt;0&amp;&amp;(m+=`
`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Hi).join(`
`),p.length&gt;0&amp;&amp;(p+=`
`)):(m=[rl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&amp;&amp;t.fog?"#define USE_FOG":"",t.useFog&amp;&amp;t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&amp;&amp;t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&amp;&amp;t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount&gt;0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount&gt;0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes&gt;0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(Hi).join(`
`),p=[rl(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&amp;&amp;t.fog?"#define USE_FOG":"",t.useFog&amp;&amp;t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&amp;&amp;t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes&gt;0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Rn?"#define TONE_MAPPING":"",t.toneMapping!==Rn?Ne.tonemapping_pars_fragment:"",t.toneMapping!==Rn?$p("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ne.colorspace_pars_fragment,jp("linearToOutputTexel",t.outputColorSpace),Jp(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(Hi).join(`
`)),a=Ra(a),a=tl(a,t),a=nl(a,t),o=Ra(o),o=tl(o,t),o=nl(o,t),a=il(a),o=il(o),t.isRawShaderMaterial!==!0&amp;&amp;(b=`#version 300 es
`,m=[d,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+m,p=["#define varying in",t.glslVersion===go?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===go?"":"#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(`
`)+`
`+p);const y=b+m+a,M=b+p+o,N=Jo(r,r.VERTEX_SHADER,y),w=Jo(r,r.FRAGMENT_SHADER,M);r.attachShader(_,N),r.attachShader(_,w),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&amp;&amp;r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function R(A){if(i.debug.checkShaderErrors){const G=r.getProgramInfoLog(_).trim(),z=r.getShaderInfoLog(N).trim(),X=r.getShaderInfoLog(w).trim();let j=!0,H=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(j=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,_,N,w);else{const J=el(r,N,"vertex"),k=el(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+`

Material Name: `+A.name+`
Material Type: `+A.type+`

Program Info Log: `+G+`
`+J+`
`+k)}else G!==""?console.warn("THREE.WebGLProgram: Program Info Log:",G):(z===""||X==="")&amp;&amp;(H=!1);H&amp;&amp;(A.diagnostics={runnable:j,programLog:G,vertexShader:{log:z,prefix:m},fragmentShader:{log:X,prefix:p}})}r.deleteShader(N),r.deleteShader(w),U=new Vr(r,_),E=tm(r,_)}let U;this.getUniforms=function(){return U===void 0&amp;&amp;R(this),U};let E;this.getAttributes=function(){return E===void 0&amp;&amp;R(this),E};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&amp;&amp;(S=r.getProgramParameter(_,qp)),S},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Yp++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=N,this.fragmentShader=w,this}let dm=0;class pm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&amp;&amp;(a.add(r),r.usedTimes++),a.has(s)===!1&amp;&amp;(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&amp;&amp;this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&amp;&amp;(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&amp;&amp;(n=new mm(e),t.set(e,n)),n}}class mm{constructor(e){this.id=dm++,this.code=e,this.usedTimes=0}}function gm(i,e,t,n,r,s,a){const o=new Yl,l=new pm,c=new Set,u=[],h=r.logarithmicDepthBuffer,f=r.vertexTextures;let d=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(E){return c.add(E),E===0?"uv":`uv${E}`}function m(E,S,A,G,z){const X=G.fog,j=z.geometry,H=E.isMeshStandardMaterial?G.environment:null,J=(E.isMeshStandardMaterial?t:e).get(E.envMap||H),k=J&amp;&amp;J.mapping===Kr?J.image.height:null,te=g[E.type];E.precision!==null&amp;&amp;(d=r.getMaxPrecision(E.precision),d!==E.precision&amp;&amp;console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",d,"instead."));const ce=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Me=ce!==void 0?ce.length:0;let Pe=0;j.morphAttributes.position!==void 0&amp;&amp;(Pe=1),j.morphAttributes.normal!==void 0&amp;&amp;(Pe=2),j.morphAttributes.color!==void 0&amp;&amp;(Pe=3);let Ve,W,$,de;if(te){const je=jt[te];Ve=je.vertexShader,W=je.fragmentShader}else Ve=E.vertexShader,W=E.fragmentShader,l.update(E),$=l.getVertexShaderID(E),de=l.getFragmentShaderID(E);const ne=i.getRenderTarget(),ye=i.state.buffers.depth.getReversed(),Ae=z.isInstancedMesh===!0,Fe=z.isBatchedMesh===!0,Je=!!E.map,Be=!!E.matcap,ot=!!J,I=!!E.aoMap,Ut=!!E.lightMap,He=!!E.bumpMap,Ge=!!E.normalMap,Ee=!!E.displacementMap,nt=!!E.emissiveMap,Se=!!E.metalnessMap,T=!!E.roughnessMap,v=E.anisotropy&gt;0,F=E.clearcoat&gt;0,Y=E.dispersion&gt;0,K=E.iridescence&gt;0,q=E.sheen&gt;0,_e=E.transmission&gt;0,se=v&amp;&amp;!!E.anisotropyMap,ue=F&amp;&amp;!!E.clearcoatMap,Xe=F&amp;&amp;!!E.clearcoatNormalMap,Q=F&amp;&amp;!!E.clearcoatRoughnessMap,he=K&amp;&amp;!!E.iridescenceMap,Te=K&amp;&amp;!!E.iridescenceThicknessMap,we=q&amp;&amp;!!E.sheenColorMap,fe=q&amp;&amp;!!E.sheenRoughnessMap,We=!!E.specularMap,Ue=!!E.specularColorMap,Qe=!!E.specularIntensityMap,C=_e&amp;&amp;!!E.transmissionMap,re=_e&amp;&amp;!!E.thicknessMap,V=!!E.gradientMap,Z=!!E.alphaMap,le=E.alphaTest&gt;0,ae=!!E.alphaHash,Le=!!E.extensions;let ct=Rn;E.toneMapped&amp;&amp;(ne===null||ne.isXRRenderTarget===!0)&amp;&amp;(ct=i.toneMapping);const vt={shaderID:te,shaderType:E.type,shaderName:E.name,vertexShader:Ve,fragmentShader:W,defines:E.defines,customVertexShaderID:$,customFragmentShaderID:de,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:d,batching:Fe,batchingColor:Fe&amp;&amp;z._colorsTexture!==null,instancing:Ae,instancingColor:Ae&amp;&amp;z.instanceColor!==null,instancingMorph:Ae&amp;&amp;z.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:ne===null?i.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:Ri,alphaToCoverage:!!E.alphaToCoverage,map:Je,matcap:Be,envMap:ot,envMapMode:ot&amp;&amp;J.mapping,envMapCubeUVHeight:k,aoMap:I,lightMap:Ut,bumpMap:He,normalMap:Ge,displacementMap:f&amp;&amp;Ee,emissiveMap:nt,normalMapObjectSpace:Ge&amp;&amp;E.normalMapType===lu,normalMapTangentSpace:Ge&amp;&amp;E.normalMapType===jr,metalnessMap:Se,roughnessMap:T,anisotropy:v,anisotropyMap:se,clearcoat:F,clearcoatMap:ue,clearcoatNormalMap:Xe,clearcoatRoughnessMap:Q,dispersion:Y,iridescence:K,iridescenceMap:he,iridescenceThicknessMap:Te,sheen:q,sheenColorMap:we,sheenRoughnessMap:fe,specularMap:We,specularColorMap:Ue,specularIntensityMap:Qe,transmission:_e,transmissionMap:C,thicknessMap:re,gradientMap:V,opaque:E.transparent===!1&amp;&amp;E.blending===_i&amp;&amp;E.alphaToCoverage===!1,alphaMap:Z,alphaTest:le,alphaHash:ae,combine:E.combine,mapUv:Je&amp;&amp;_(E.map.channel),aoMapUv:I&amp;&amp;_(E.aoMap.channel),lightMapUv:Ut&amp;&amp;_(E.lightMap.channel),bumpMapUv:He&amp;&amp;_(E.bumpMap.channel),normalMapUv:Ge&amp;&amp;_(E.normalMap.channel),displacementMapUv:Ee&amp;&amp;_(E.displacementMap.channel),emissiveMapUv:nt&amp;&amp;_(E.emissiveMap.channel),metalnessMapUv:Se&amp;&amp;_(E.metalnessMap.channel),roughnessMapUv:T&amp;&amp;_(E.roughnessMap.channel),anisotropyMapUv:se&amp;&amp;_(E.anisotropyMap.channel),clearcoatMapUv:ue&amp;&amp;_(E.clearcoatMap.channel),clearcoatNormalMapUv:Xe&amp;&amp;_(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Q&amp;&amp;_(E.clearcoatRoughnessMap.channel),iridescenceMapUv:he&amp;&amp;_(E.iridescenceMap.channel),iridescenceThicknessMapUv:Te&amp;&amp;_(E.iridescenceThicknessMap.channel),sheenColorMapUv:we&amp;&amp;_(E.sheenColorMap.channel),sheenRoughnessMapUv:fe&amp;&amp;_(E.sheenRoughnessMap.channel),specularMapUv:We&amp;&amp;_(E.specularMap.channel),specularColorMapUv:Ue&amp;&amp;_(E.specularColorMap.channel),specularIntensityMapUv:Qe&amp;&amp;_(E.specularIntensityMap.channel),transmissionMapUv:C&amp;&amp;_(E.transmissionMap.channel),thicknessMapUv:re&amp;&amp;_(E.thicknessMap.channel),alphaMapUv:Z&amp;&amp;_(E.alphaMap.channel),vertexTangents:!!j.attributes.tangent&amp;&amp;(Ge||v),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&amp;&amp;!!j.attributes.color&amp;&amp;j.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&amp;&amp;!!j.attributes.uv&amp;&amp;(Je||Z),fog:!!X,useFog:E.fog===!0,fogExp2:!!X&amp;&amp;X.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:h,reverseDepthBuffer:ye,skinning:z.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:Me,morphTextureStride:Pe,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:E.dithering,shadowMapEnabled:i.shadowMap.enabled&amp;&amp;A.length&gt;0,shadowMapType:i.shadowMap.type,toneMapping:ct,decodeVideoTexture:Je&amp;&amp;E.map.isVideoTexture===!0&amp;&amp;Ie.getTransfer(E.map.colorSpace)===$e,decodeVideoTextureEmissive:nt&amp;&amp;E.emissiveMap.isVideoTexture===!0&amp;&amp;Ie.getTransfer(E.emissiveMap.colorSpace)===$e,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===hn,flipSided:E.side===Ct,useDepthPacking:E.depthPacking&gt;=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:Le&amp;&amp;E.extensions.clipCullDistance===!0&amp;&amp;n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Le&amp;&amp;E.extensions.multiDraw===!0||Fe)&amp;&amp;n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt}function p(E){const S=[];if(E.shaderID?S.push(E.shaderID):(S.push(E.customVertexShaderID),S.push(E.customFragmentShaderID)),E.defines!==void 0)for(const A in E.defines)S.push(A),S.push(E.defines[A]);return E.isRawShaderMaterial===!1&amp;&amp;(b(S,E),y(S,E),S.push(i.outputColorSpace)),S.push(E.customProgramCacheKey),S.join()}function b(E,S){E.push(S.precision),E.push(S.outputColorSpace),E.push(S.envMapMode),E.push(S.envMapCubeUVHeight),E.push(S.mapUv),E.push(S.alphaMapUv),E.push(S.lightMapUv),E.push(S.aoMapUv),E.push(S.bumpMapUv),E.push(S.normalMapUv),E.push(S.displacementMapUv),E.push(S.emissiveMapUv),E.push(S.metalnessMapUv),E.push(S.roughnessMapUv),E.push(S.anisotropyMapUv),E.push(S.clearcoatMapUv),E.push(S.clearcoatNormalMapUv),E.push(S.clearcoatRoughnessMapUv),E.push(S.iridescenceMapUv),E.push(S.iridescenceThicknessMapUv),E.push(S.sheenColorMapUv),E.push(S.sheenRoughnessMapUv),E.push(S.specularMapUv),E.push(S.specularColorMapUv),E.push(S.specularIntensityMapUv),E.push(S.transmissionMapUv),E.push(S.thicknessMapUv),E.push(S.combine),E.push(S.fogExp2),E.push(S.sizeAttenuation),E.push(S.morphTargetsCount),E.push(S.morphAttributeCount),E.push(S.numDirLights),E.push(S.numPointLights),E.push(S.numSpotLights),E.push(S.numSpotLightMaps),E.push(S.numHemiLights),E.push(S.numRectAreaLights),E.push(S.numDirLightShadows),E.push(S.numPointLightShadows),E.push(S.numSpotLightShadows),E.push(S.numSpotLightShadowsWithMaps),E.push(S.numLightProbes),E.push(S.shadowMapType),E.push(S.toneMapping),E.push(S.numClippingPlanes),E.push(S.numClipIntersection),E.push(S.depthPacking)}function y(E,S){o.disableAll(),S.supportsVertexTextures&amp;&amp;o.enable(0),S.instancing&amp;&amp;o.enable(1),S.instancingColor&amp;&amp;o.enable(2),S.instancingMorph&amp;&amp;o.enable(3),S.matcap&amp;&amp;o.enable(4),S.envMap&amp;&amp;o.enable(5),S.normalMapObjectSpace&amp;&amp;o.enable(6),S.normalMapTangentSpace&amp;&amp;o.enable(7),S.clearcoat&amp;&amp;o.enable(8),S.iridescence&amp;&amp;o.enable(9),S.alphaTest&amp;&amp;o.enable(10),S.vertexColors&amp;&amp;o.enable(11),S.vertexAlphas&amp;&amp;o.enable(12),S.vertexUv1s&amp;&amp;o.enable(13),S.vertexUv2s&amp;&amp;o.enable(14),S.vertexUv3s&amp;&amp;o.enable(15),S.vertexTangents&amp;&amp;o.enable(16),S.anisotropy&amp;&amp;o.enable(17),S.alphaHash&amp;&amp;o.enable(18),S.batching&amp;&amp;o.enable(19),S.dispersion&amp;&amp;o.enable(20),S.batchingColor&amp;&amp;o.enable(21),E.push(o.mask),o.disableAll(),S.fog&amp;&amp;o.enable(0),S.useFog&amp;&amp;o.enable(1),S.flatShading&amp;&amp;o.enable(2),S.logarithmicDepthBuffer&amp;&amp;o.enable(3),S.reverseDepthBuffer&amp;&amp;o.enable(4),S.skinning&amp;&amp;o.enable(5),S.morphTargets&amp;&amp;o.enable(6),S.morphNormals&amp;&amp;o.enable(7),S.morphColors&amp;&amp;o.enable(8),S.premultipliedAlpha&amp;&amp;o.enable(9),S.shadowMapEnabled&amp;&amp;o.enable(10),S.doubleSided&amp;&amp;o.enable(11),S.flipSided&amp;&amp;o.enable(12),S.useDepthPacking&amp;&amp;o.enable(13),S.dithering&amp;&amp;o.enable(14),S.transmission&amp;&amp;o.enable(15),S.sheen&amp;&amp;o.enable(16),S.opaque&amp;&amp;o.enable(17),S.pointsUvs&amp;&amp;o.enable(18),S.decodeVideoTexture&amp;&amp;o.enable(19),S.decodeVideoTextureEmissive&amp;&amp;o.enable(20),S.alphaToCoverage&amp;&amp;o.enable(21),E.push(o.mask)}function M(E){const S=g[E.type];let A;if(S){const G=jt[S];A=Ju.clone(G.uniforms)}else A=E.uniforms;return A}function N(E,S){let A;for(let G=0,z=u.length;G&lt;z;G++){const X=u[G];if(X.cacheKey===S){A=X,++A.usedTimes;break}}return A===void 0&amp;&amp;(A=new fm(i,S,E,s),u.push(A)),A}function w(E){if(--E.usedTimes===0){const S=u.indexOf(E);u[S]=u[u.length-1],u.pop(),E.destroy()}}function R(E){l.remove(E)}function U(){l.dispose()}return{getParameters:m,getProgramCacheKey:p,getUniforms:M,acquireProgram:N,releaseProgram:w,releaseShaderCache:R,programs:u,dispose:U}}function _m(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let o=i.get(a);return o===void 0&amp;&amp;(o={},i.set(a,o)),o}function n(a){i.delete(a)}function r(a,o,l){i.get(a)[o]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function vm(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function sl(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function al(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(h,f,d,g,_,m){let p=i[e];return p===void 0?(p={id:h.id,object:h,geometry:f,material:d,groupOrder:g,renderOrder:h.renderOrder,z:_,group:m},i[e]=p):(p.id=h.id,p.object=h,p.geometry=f,p.material=d,p.groupOrder=g,p.renderOrder=h.renderOrder,p.z=_,p.group=m),e++,p}function o(h,f,d,g,_,m){const p=a(h,f,d,g,_,m);d.transmission&gt;0?n.push(p):d.transparent===!0?r.push(p):t.push(p)}function l(h,f,d,g,_,m){const p=a(h,f,d,g,_,m);d.transmission&gt;0?n.unshift(p):d.transparent===!0?r.unshift(p):t.unshift(p)}function c(h,f){t.length&gt;1&amp;&amp;t.sort(h||vm),n.length&gt;1&amp;&amp;n.sort(f||sl),r.length&gt;1&amp;&amp;r.sort(f||sl)}function u(){for(let h=e,f=i.length;h&lt;f;h++){const d=i[h];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:o,unshift:l,finish:u,sort:c}}function xm(){let i=new WeakMap;function e(n,r){const s=i.get(n);let a;return s===void 0?(a=new al,i.set(n,[a])):r&gt;=s.length?(a=new al,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function Mm(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new P,color:new be};break;case"SpotLight":t={position:new P,direction:new P,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new P,halfWidth:new P,halfHeight:new P};break}return i[e.id]=t,t}}}function ym(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let Sm=0;function Em(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Tm(i){const e=new Mm,t=ym(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c&lt;9;c++)n.probe.push(new P);const r=new P,s=new xe,a=new xe;function o(c){let u=0,h=0,f=0;for(let E=0;E&lt;9;E++)n.probe[E].set(0,0,0);let d=0,g=0,_=0,m=0,p=0,b=0,y=0,M=0,N=0,w=0,R=0;c.sort(Em);for(let E=0,S=c.length;E&lt;S;E++){const A=c[E],G=A.color,z=A.intensity,X=A.distance,j=A.shadow&amp;&amp;A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)u+=G.r*z,h+=G.g*z,f+=G.b*z;else if(A.isLightProbe){for(let H=0;H&lt;9;H++)n.probe[H].addScaledVector(A.sh.coefficients[H],z);R++}else if(A.isDirectionalLight){const H=e.get(A);if(H.color.copy(A.color).multiplyScalar(A.intensity),A.castShadow){const J=A.shadow,k=t.get(A);k.shadowIntensity=J.intensity,k.shadowBias=J.bias,k.shadowNormalBias=J.normalBias,k.shadowRadius=J.radius,k.shadowMapSize=J.mapSize,n.directionalShadow[d]=k,n.directionalShadowMap[d]=j,n.directionalShadowMatrix[d]=A.shadow.matrix,b++}n.directional[d]=H,d++}else if(A.isSpotLight){const H=e.get(A);H.position.setFromMatrixPosition(A.matrixWorld),H.color.copy(G).multiplyScalar(z),H.distance=X,H.coneCos=Math.cos(A.angle),H.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),H.decay=A.decay,n.spot[_]=H;const J=A.shadow;if(A.map&amp;&amp;(n.spotLightMap[N]=A.map,N++,J.updateMatrices(A),A.castShadow&amp;&amp;w++),n.spotLightMatrix[_]=J.matrix,A.castShadow){const k=t.get(A);k.shadowIntensity=J.intensity,k.shadowBias=J.bias,k.shadowNormalBias=J.normalBias,k.shadowRadius=J.radius,k.shadowMapSize=J.mapSize,n.spotShadow[_]=k,n.spotShadowMap[_]=j,M++}_++}else if(A.isRectAreaLight){const H=e.get(A);H.color.copy(G).multiplyScalar(z),H.halfWidth.set(A.width*.5,0,0),H.halfHeight.set(0,A.height*.5,0),n.rectArea[m]=H,m++}else if(A.isPointLight){const H=e.get(A);if(H.color.copy(A.color).multiplyScalar(A.intensity),H.distance=A.distance,H.decay=A.decay,A.castShadow){const J=A.shadow,k=t.get(A);k.shadowIntensity=J.intensity,k.shadowBias=J.bias,k.shadowNormalBias=J.normalBias,k.shadowRadius=J.radius,k.shadowMapSize=J.mapSize,k.shadowCameraNear=J.camera.near,k.shadowCameraFar=J.camera.far,n.pointShadow[g]=k,n.pointShadowMap[g]=j,n.pointShadowMatrix[g]=A.shadow.matrix,y++}n.point[g]=H,g++}else if(A.isHemisphereLight){const H=e.get(A);H.skyColor.copy(A.color).multiplyScalar(z),H.groundColor.copy(A.groundColor).multiplyScalar(z),n.hemi[p]=H,p++}}m&gt;0&amp;&amp;(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ie.LTC_FLOAT_1,n.rectAreaLTC2=ie.LTC_FLOAT_2):(n.rectAreaLTC1=ie.LTC_HALF_1,n.rectAreaLTC2=ie.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=f;const U=n.hash;(U.directionalLength!==d||U.pointLength!==g||U.spotLength!==_||U.rectAreaLength!==m||U.hemiLength!==p||U.numDirectionalShadows!==b||U.numPointShadows!==y||U.numSpotShadows!==M||U.numSpotMaps!==N||U.numLightProbes!==R)&amp;&amp;(n.directional.length=d,n.spot.length=_,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=y,n.spotLightMatrix.length=M+N-w,n.spotLightMap.length=N,n.numSpotLightShadowsWithMaps=w,n.numLightProbes=R,U.directionalLength=d,U.pointLength=g,U.spotLength=_,U.rectAreaLength=m,U.hemiLength=p,U.numDirectionalShadows=b,U.numPointShadows=y,U.numSpotShadows=M,U.numSpotMaps=N,U.numLightProbes=R,n.version=Sm++)}function l(c,u){let h=0,f=0,d=0,g=0,_=0;const m=u.matrixWorldInverse;for(let p=0,b=c.length;p&lt;b;p++){const y=c[p];if(y.isDirectionalLight){const M=n.directional[h];M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(m),h++}else if(y.isSpotLight){const M=n.spot[d];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(y.matrixWorld),r.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(r),M.direction.transformDirection(m),d++}else if(y.isRectAreaLight){const M=n.rectArea[g];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(m),a.identity(),s.copy(y.matrixWorld),s.premultiply(m),a.extractRotation(s),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),g++}else if(y.isPointLight){const M=n.point[f];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(m),f++}else if(y.isHemisphereLight){const M=n.hemi[_];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:n}}function ol(i){const e=new Tm(i),t=[],n=[];function r(u){c.camera=u,t.length=0,n.length=0}function s(u){t.push(u)}function a(u){n.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function bm(i){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new ol(i),e.set(r,[o])):s&gt;=a.length?(o=new ol(i),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}class Am extends gn{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=au,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}class wm extends gn{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Rm=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,Cm=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include &lt;packing&gt;
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples &lt;= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples &lt;= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i &lt; samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function Pm(i,e,t){let n=new Wa;const r=new ke,s=new ke,a=new ze,o=new Am({depthPacking:ou}),l=new wm,c={},u=t.maxTextureSize,h={[Cn]:Ct,[Ct]:Cn,[hn]:hn},f=new Pn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ke},radius:{value:4}},vertexShader:Rm,fragmentShader:Cm}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new zt;g.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Zt(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ll;let p=this.type;this.render=function(w,R,U){if(m.enabled===!1||m.autoUpdate===!1&amp;&amp;m.needsUpdate===!1||w.length===0)return;const E=i.getRenderTarget(),S=i.getActiveCubeFace(),A=i.getActiveMipmapLevel(),G=i.state;G.setBlending(wn),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const z=p!==un&amp;&amp;this.type===un,X=p===un&amp;&amp;this.type!==un;for(let j=0,H=w.length;j&lt;H;j++){const J=w[j],k=J.shadow;if(k===void 0){console.warn("THREE.WebGLShadowMap:",J,"has no shadow.");continue}if(k.autoUpdate===!1&amp;&amp;k.needsUpdate===!1)continue;r.copy(k.mapSize);const te=k.getFrameExtents();if(r.multiply(te),s.copy(k.mapSize),(r.x&gt;u||r.y&gt;u)&amp;&amp;(r.x&gt;u&amp;&amp;(s.x=Math.floor(u/te.x),r.x=s.x*te.x,k.mapSize.x=s.x),r.y&gt;u&amp;&amp;(s.y=Math.floor(u/te.y),r.y=s.y*te.y,k.mapSize.y=s.y)),k.map===null||z===!0||X===!0){const Me=this.type!==un?{minFilter:It,magFilter:It}:{};k.map!==null&amp;&amp;k.map.dispose(),k.map=new qn(r.x,r.y,Me),k.map.texture.name=J.name+".shadowMap",k.camera.updateProjectionMatrix()}i.setRenderTarget(k.map),i.clear();const ce=k.getViewportCount();for(let Me=0;Me&lt;ce;Me++){const Pe=k.getViewport(Me);a.set(s.x*Pe.x,s.y*Pe.y,s.x*Pe.z,s.y*Pe.w),G.viewport(a),k.updateMatrices(J,Me),n=k.getFrustum(),M(R,U,k.camera,J,this.type)}k.isPointLightShadow!==!0&amp;&amp;this.type===un&amp;&amp;b(k,U),k.needsUpdate=!1}p=this.type,m.needsUpdate=!1,i.setRenderTarget(E,S,A)};function b(w,R){const U=e.update(_);f.defines.VSM_SAMPLES!==w.blurSamples&amp;&amp;(f.defines.VSM_SAMPLES=w.blurSamples,d.defines.VSM_SAMPLES=w.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),w.mapPass===null&amp;&amp;(w.mapPass=new qn(r.x,r.y)),f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(R,null,U,f,_,null),d.uniforms.shadow_pass.value=w.mapPass.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(R,null,U,d,_,null)}function y(w,R,U,E){let S=null;const A=U.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(A!==void 0)S=A;else if(S=U.isPointLight===!0?l:o,i.localClippingEnabled&amp;&amp;R.clipShadows===!0&amp;&amp;Array.isArray(R.clippingPlanes)&amp;&amp;R.clippingPlanes.length!==0||R.displacementMap&amp;&amp;R.displacementScale!==0||R.alphaMap&amp;&amp;R.alphaTest&gt;0||R.map&amp;&amp;R.alphaTest&gt;0){const G=S.uuid,z=R.uuid;let X=c[G];X===void 0&amp;&amp;(X={},c[G]=X);let j=X[z];j===void 0&amp;&amp;(j=S.clone(),X[z]=j,R.addEventListener("dispose",N)),S=j}if(S.visible=R.visible,S.wireframe=R.wireframe,E===un?S.side=R.shadowSide!==null?R.shadowSide:R.side:S.side=R.shadowSide!==null?R.shadowSide:h[R.side],S.alphaMap=R.alphaMap,S.alphaTest=R.alphaTest,S.map=R.map,S.clipShadows=R.clipShadows,S.clippingPlanes=R.clippingPlanes,S.clipIntersection=R.clipIntersection,S.displacementMap=R.displacementMap,S.displacementScale=R.displacementScale,S.displacementBias=R.displacementBias,S.wireframeLinewidth=R.wireframeLinewidth,S.linewidth=R.linewidth,U.isPointLight===!0&amp;&amp;S.isMeshDistanceMaterial===!0){const G=i.properties.get(S);G.light=U}return S}function M(w,R,U,E,S){if(w.visible===!1)return;if(w.layers.test(R.layers)&amp;&amp;(w.isMesh||w.isLine||w.isPoints)&amp;&amp;(w.castShadow||w.receiveShadow&amp;&amp;S===un)&amp;&amp;(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,w.matrixWorld);const z=e.update(w),X=w.material;if(Array.isArray(X)){const j=z.groups;for(let H=0,J=j.length;H&lt;J;H++){const k=j[H],te=X[k.materialIndex];if(te&amp;&amp;te.visible){const ce=y(w,te,E,S);w.onBeforeShadow(i,w,R,U,z,ce,k),i.renderBufferDirect(U,null,z,ce,w,k),w.onAfterShadow(i,w,R,U,z,ce,k)}}}else if(X.visible){const j=y(w,X,E,S);w.onBeforeShadow(i,w,R,U,z,j,null),i.renderBufferDirect(U,null,z,j,w,null),w.onAfterShadow(i,w,R,U,z,j,null)}}const G=w.children;for(let z=0,X=G.length;z&lt;X;z++)M(G[z],R,U,E,S)}function N(w){w.target.removeEventListener("dispose",N);for(const U in c){const E=c[U],S=w.target.uuid;S in E&amp;&amp;(E[S].dispose(),delete E[S])}}}const Lm={[qs]:Ys,[Zs]:$s,[Ks]:Js,[Mi]:js,[Ys]:qs,[$s]:Zs,[Js]:Ks,[js]:Mi};function Dm(i,e){function t(){let C=!1;const re=new ze;let V=null;const Z=new ze(0,0,0,0);return{setMask:function(le){V!==le&amp;&amp;!C&amp;&amp;(i.colorMask(le,le,le,le),V=le)},setLocked:function(le){C=le},setClear:function(le,ae,Le,ct,vt){vt===!0&amp;&amp;(le*=ct,ae*=ct,Le*=ct),re.set(le,ae,Le,ct),Z.equals(re)===!1&amp;&amp;(i.clearColor(le,ae,Le,ct),Z.copy(re))},reset:function(){C=!1,V=null,Z.set(-1,0,0,0)}}}function n(){let C=!1,re=!1,V=null,Z=null,le=null;return{setReversed:function(ae){if(re!==ae){const Le=e.get("EXT_clip_control");re?Le.clipControlEXT(Le.LOWER_LEFT_EXT,Le.ZERO_TO_ONE_EXT):Le.clipControlEXT(Le.LOWER_LEFT_EXT,Le.NEGATIVE_ONE_TO_ONE_EXT);const ct=le;le=null,this.setClear(ct)}re=ae},getReversed:function(){return re},setTest:function(ae){ae?ne(i.DEPTH_TEST):ye(i.DEPTH_TEST)},setMask:function(ae){V!==ae&amp;&amp;!C&amp;&amp;(i.depthMask(ae),V=ae)},setFunc:function(ae){if(re&amp;&amp;(ae=Lm[ae]),Z!==ae){switch(ae){case qs:i.depthFunc(i.NEVER);break;case Ys:i.depthFunc(i.ALWAYS);break;case Zs:i.depthFunc(i.LESS);break;case Mi:i.depthFunc(i.LEQUAL);break;case Ks:i.depthFunc(i.EQUAL);break;case js:i.depthFunc(i.GEQUAL);break;case $s:i.depthFunc(i.GREATER);break;case Js:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Z=ae}},setLocked:function(ae){C=ae},setClear:function(ae){le!==ae&amp;&amp;(re&amp;&amp;(ae=1-ae),i.clearDepth(ae),le=ae)},reset:function(){C=!1,V=null,Z=null,le=null,re=!1}}}function r(){let C=!1,re=null,V=null,Z=null,le=null,ae=null,Le=null,ct=null,vt=null;return{setTest:function(je){C||(je?ne(i.STENCIL_TEST):ye(i.STENCIL_TEST))},setMask:function(je){re!==je&amp;&amp;!C&amp;&amp;(i.stencilMask(je),re=je)},setFunc:function(je,kt,tn){(V!==je||Z!==kt||le!==tn)&amp;&amp;(i.stencilFunc(je,kt,tn),V=je,Z=kt,le=tn)},setOp:function(je,kt,tn){(ae!==je||Le!==kt||ct!==tn)&amp;&amp;(i.stencilOp(je,kt,tn),ae=je,Le=kt,ct=tn)},setLocked:function(je){C=je},setClear:function(je){vt!==je&amp;&amp;(i.clearStencil(je),vt=je)},reset:function(){C=!1,re=null,V=null,Z=null,le=null,ae=null,Le=null,ct=null,vt=null}}}const s=new t,a=new n,o=new r,l=new WeakMap,c=new WeakMap;let u={},h={},f=new WeakMap,d=[],g=null,_=!1,m=null,p=null,b=null,y=null,M=null,N=null,w=null,R=new be(0,0,0),U=0,E=!1,S=null,A=null,G=null,z=null,X=null;const j=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let H=!1,J=0;const k=i.getParameter(i.VERSION);k.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(k)[1]),H=J&gt;=1):k.indexOf("OpenGL ES")!==-1&amp;&amp;(J=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),H=J&gt;=2);let te=null,ce={};const Me=i.getParameter(i.SCISSOR_BOX),Pe=i.getParameter(i.VIEWPORT),Ve=new ze().fromArray(Me),W=new ze().fromArray(Pe);function $(C,re,V,Z){const le=new Uint8Array(4),ae=i.createTexture();i.bindTexture(C,ae),i.texParameteri(C,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(C,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Le=0;Le&lt;V;Le++)C===i.TEXTURE_3D||C===i.TEXTURE_2D_ARRAY?i.texImage3D(re,0,i.RGBA,1,1,Z,0,i.RGBA,i.UNSIGNED_BYTE,le):i.texImage2D(re+Le,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,le);return ae}const de={};de[i.TEXTURE_2D]=$(i.TEXTURE_2D,i.TEXTURE_2D,1),de[i.TEXTURE_CUBE_MAP]=$(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),de[i.TEXTURE_2D_ARRAY]=$(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),de[i.TEXTURE_3D]=$(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ne(i.DEPTH_TEST),a.setFunc(Mi),He(!1),Ge(so),ne(i.CULL_FACE),I(wn);function ne(C){u[C]!==!0&amp;&amp;(i.enable(C),u[C]=!0)}function ye(C){u[C]!==!1&amp;&amp;(i.disable(C),u[C]=!1)}function Ae(C,re){return h[C]!==re?(i.bindFramebuffer(C,re),h[C]=re,C===i.DRAW_FRAMEBUFFER&amp;&amp;(h[i.FRAMEBUFFER]=re),C===i.FRAMEBUFFER&amp;&amp;(h[i.DRAW_FRAMEBUFFER]=re),!0):!1}function Fe(C,re){let V=d,Z=!1;if(C){V=f.get(re),V===void 0&amp;&amp;(V=[],f.set(re,V));const le=C.textures;if(V.length!==le.length||V[0]!==i.COLOR_ATTACHMENT0){for(let ae=0,Le=le.length;ae&lt;Le;ae++)V[ae]=i.COLOR_ATTACHMENT0+ae;V.length=le.length,Z=!0}}else V[0]!==i.BACK&amp;&amp;(V[0]=i.BACK,Z=!0);Z&amp;&amp;i.drawBuffers(V)}function Je(C){return g!==C?(i.useProgram(C),g=C,!0):!1}const Be={[Hn]:i.FUNC_ADD,[Lc]:i.FUNC_SUBTRACT,[Dc]:i.FUNC_REVERSE_SUBTRACT};Be[Ic]=i.MIN,Be[Uc]=i.MAX;const ot={[Nc]:i.ZERO,[Fc]:i.ONE,[Oc]:i.SRC_COLOR,[Ws]:i.SRC_ALPHA,[Gc]:i.SRC_ALPHA_SATURATE,[Vc]:i.DST_COLOR,[zc]:i.DST_ALPHA,[Bc]:i.ONE_MINUS_SRC_COLOR,[Xs]:i.ONE_MINUS_SRC_ALPHA,[Hc]:i.ONE_MINUS_DST_COLOR,[kc]:i.ONE_MINUS_DST_ALPHA,[Wc]:i.CONSTANT_COLOR,[Xc]:i.ONE_MINUS_CONSTANT_COLOR,[qc]:i.CONSTANT_ALPHA,[Yc]:i.ONE_MINUS_CONSTANT_ALPHA};function I(C,re,V,Z,le,ae,Le,ct,vt,je){if(C===wn){_===!0&amp;&amp;(ye(i.BLEND),_=!1);return}if(_===!1&amp;&amp;(ne(i.BLEND),_=!0),C!==Pc){if(C!==m||je!==E){if((p!==Hn||M!==Hn)&amp;&amp;(i.blendEquation(i.FUNC_ADD),p=Hn,M=Hn),je)switch(C){case _i:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ao:i.blendFunc(i.ONE,i.ONE);break;case oo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case lo:i.blendFuncSeparate(i.ZERO,i.SRC_COLOR,i.ZERO,i.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}else switch(C){case _i:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case ao:i.blendFunc(i.SRC_ALPHA,i.ONE);break;case oo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case lo:i.blendFunc(i.ZERO,i.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",C);break}b=null,y=null,N=null,w=null,R.set(0,0,0),U=0,m=C,E=je}return}le=le||re,ae=ae||V,Le=Le||Z,(re!==p||le!==M)&amp;&amp;(i.blendEquationSeparate(Be[re],Be[le]),p=re,M=le),(V!==b||Z!==y||ae!==N||Le!==w)&amp;&amp;(i.blendFuncSeparate(ot[V],ot[Z],ot[ae],ot[Le]),b=V,y=Z,N=ae,w=Le),(ct.equals(R)===!1||vt!==U)&amp;&amp;(i.blendColor(ct.r,ct.g,ct.b,vt),R.copy(ct),U=vt),m=C,E=!1}function Ut(C,re){C.side===hn?ye(i.CULL_FACE):ne(i.CULL_FACE);let V=C.side===Ct;re&amp;&amp;(V=!V),He(V),C.blending===_i&amp;&amp;C.transparent===!1?I(wn):I(C.blending,C.blendEquation,C.blendSrc,C.blendDst,C.blendEquationAlpha,C.blendSrcAlpha,C.blendDstAlpha,C.blendColor,C.blendAlpha,C.premultipliedAlpha),a.setFunc(C.depthFunc),a.setTest(C.depthTest),a.setMask(C.depthWrite),s.setMask(C.colorWrite);const Z=C.stencilWrite;o.setTest(Z),Z&amp;&amp;(o.setMask(C.stencilWriteMask),o.setFunc(C.stencilFunc,C.stencilRef,C.stencilFuncMask),o.setOp(C.stencilFail,C.stencilZFail,C.stencilZPass)),nt(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),C.alphaToCoverage===!0?ne(i.SAMPLE_ALPHA_TO_COVERAGE):ye(i.SAMPLE_ALPHA_TO_COVERAGE)}function He(C){S!==C&amp;&amp;(C?i.frontFace(i.CW):i.frontFace(i.CCW),S=C)}function Ge(C){C!==wc?(ne(i.CULL_FACE),C!==A&amp;&amp;(C===so?i.cullFace(i.BACK):C===Rc?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):ye(i.CULL_FACE),A=C}function Ee(C){C!==G&amp;&amp;(H&amp;&amp;i.lineWidth(C),G=C)}function nt(C,re,V){C?(ne(i.POLYGON_OFFSET_FILL),(z!==re||X!==V)&amp;&amp;(i.polygonOffset(re,V),z=re,X=V)):ye(i.POLYGON_OFFSET_FILL)}function Se(C){C?ne(i.SCISSOR_TEST):ye(i.SCISSOR_TEST)}function T(C){C===void 0&amp;&amp;(C=i.TEXTURE0+j-1),te!==C&amp;&amp;(i.activeTexture(C),te=C)}function v(C,re,V){V===void 0&amp;&amp;(te===null?V=i.TEXTURE0+j-1:V=te);let Z=ce[V];Z===void 0&amp;&amp;(Z={type:void 0,texture:void 0},ce[V]=Z),(Z.type!==C||Z.texture!==re)&amp;&amp;(te!==V&amp;&amp;(i.activeTexture(V),te=V),i.bindTexture(C,re||de[C]),Z.type=C,Z.texture=re)}function F(){const C=ce[te];C!==void 0&amp;&amp;C.type!==void 0&amp;&amp;(i.bindTexture(C.type,null),C.type=void 0,C.texture=void 0)}function Y(){try{i.compressedTexImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function K(){try{i.compressedTexImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function q(){try{i.texSubImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function _e(){try{i.texSubImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function se(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function ue(){try{i.compressedTexSubImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Xe(){try{i.texStorage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Q(){try{i.texStorage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function he(){try{i.texImage2D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function Te(){try{i.texImage3D.apply(i,arguments)}catch(C){console.error("THREE.WebGLState:",C)}}function we(C){Ve.equals(C)===!1&amp;&amp;(i.scissor(C.x,C.y,C.z,C.w),Ve.copy(C))}function fe(C){W.equals(C)===!1&amp;&amp;(i.viewport(C.x,C.y,C.z,C.w),W.copy(C))}function We(C,re){let V=c.get(re);V===void 0&amp;&amp;(V=new WeakMap,c.set(re,V));let Z=V.get(C);Z===void 0&amp;&amp;(Z=i.getUniformBlockIndex(re,C.name),V.set(C,Z))}function Ue(C,re){const Z=c.get(re).get(C);l.get(re)!==Z&amp;&amp;(i.uniformBlockBinding(re,Z,C.__bindingPointIndex),l.set(re,Z))}function Qe(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),u={},te=null,ce={},h={},f=new WeakMap,d=[],g=null,_=!1,m=null,p=null,b=null,y=null,M=null,N=null,w=null,R=new be(0,0,0),U=0,E=!1,S=null,A=null,G=null,z=null,X=null,Ve.set(0,0,i.canvas.width,i.canvas.height),W.set(0,0,i.canvas.width,i.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ne,disable:ye,bindFramebuffer:Ae,drawBuffers:Fe,useProgram:Je,setBlending:I,setMaterial:Ut,setFlipSided:He,setCullFace:Ge,setLineWidth:Ee,setPolygonOffset:nt,setScissorTest:Se,activeTexture:T,bindTexture:v,unbindTexture:F,compressedTexImage2D:Y,compressedTexImage3D:K,texImage2D:he,texImage3D:Te,updateUBOMapping:We,uniformBlockBinding:Ue,texStorage2D:Xe,texStorage3D:Q,texSubImage2D:q,texSubImage3D:_e,compressedTexSubImage2D:se,compressedTexSubImage3D:ue,scissor:we,viewport:fe,reset:Qe}}function ll(i,e,t,n){const r=Im(n);switch(t){case Fl:return i*e;case Bl:return i*e;case zl:return i*e*2;case kl:return i*e/r.components*r.byteLength;case Ba:return i*e/r.components*r.byteLength;case Vl:return i*e*2/r.components*r.byteLength;case za:return i*e*2/r.components*r.byteLength;case Ol:return i*e*3/r.components*r.byteLength;case Bt:return i*e*4/r.components*r.byteLength;case ka:return i*e*4/r.components*r.byteLength;case Fr:case Or:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Br:case zr:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case na:case ra:return Math.max(i,16)*Math.max(e,8)/4;case ta:case ia:return Math.max(i,8)*Math.max(e,8)/2;case sa:case aa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case oa:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case la:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ca:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case ua:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case ha:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case fa:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case da:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case pa:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case ma:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case ga:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case _a:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case va:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case xa:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Ma:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case ya:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case kr:case Sa:case Ea:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Hl:case Ta:return Math.ceil(i/4)*Math.ceil(e/4)*8;case ba:case Aa:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Im(i){switch(i){case mn:case Il:return{byteLength:1,components:1};case Yi:case Ul:case tr:return{byteLength:2,components:1};case Fa:case Oa:return{byteLength:2,components:4};case Xn:case Na:case Jt:return{byteLength:4,components:1};case Nl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}function Um(i,e,t,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator&gt;"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new ke,u=new WeakMap;let h;const f=new WeakMap;let d=!1;try{d=typeof OffscreenCanvas&lt;"u"&amp;&amp;new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(T,v){return d?new OffscreenCanvas(T,v):Zi("canvas")}function _(T,v,F){let Y=1;const K=Se(T);if((K.width&gt;F||K.height&gt;F)&amp;&amp;(Y=F/Math.max(K.width,K.height)),Y&lt;1)if(typeof HTMLImageElement&lt;"u"&amp;&amp;T instanceof HTMLImageElement||typeof HTMLCanvasElement&lt;"u"&amp;&amp;T instanceof HTMLCanvasElement||typeof ImageBitmap&lt;"u"&amp;&amp;T instanceof ImageBitmap||typeof VideoFrame&lt;"u"&amp;&amp;T instanceof VideoFrame){const q=Math.floor(Y*K.width),_e=Math.floor(Y*K.height);h===void 0&amp;&amp;(h=g(q,_e));const se=v?g(q,_e):h;return se.width=q,se.height=_e,se.getContext("2d").drawImage(T,0,0,q,_e),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+K.width+"x"+K.height+") to ("+q+"x"+_e+")."),se}else return"data"in T&amp;&amp;console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+K.width+"x"+K.height+")."),T;return T}function m(T){return T.generateMipmaps}function p(T){i.generateMipmap(T)}function b(T){return T.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?i.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function y(T,v,F,Y,K=!1){if(T!==null){if(i[T]!==void 0)return i[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let q=v;if(v===i.RED&amp;&amp;(F===i.FLOAT&amp;&amp;(q=i.R32F),F===i.HALF_FLOAT&amp;&amp;(q=i.R16F),F===i.UNSIGNED_BYTE&amp;&amp;(q=i.R8)),v===i.RED_INTEGER&amp;&amp;(F===i.UNSIGNED_BYTE&amp;&amp;(q=i.R8UI),F===i.UNSIGNED_SHORT&amp;&amp;(q=i.R16UI),F===i.UNSIGNED_INT&amp;&amp;(q=i.R32UI),F===i.BYTE&amp;&amp;(q=i.R8I),F===i.SHORT&amp;&amp;(q=i.R16I),F===i.INT&amp;&amp;(q=i.R32I)),v===i.RG&amp;&amp;(F===i.FLOAT&amp;&amp;(q=i.RG32F),F===i.HALF_FLOAT&amp;&amp;(q=i.RG16F),F===i.UNSIGNED_BYTE&amp;&amp;(q=i.RG8)),v===i.RG_INTEGER&amp;&amp;(F===i.UNSIGNED_BYTE&amp;&amp;(q=i.RG8UI),F===i.UNSIGNED_SHORT&amp;&amp;(q=i.RG16UI),F===i.UNSIGNED_INT&amp;&amp;(q=i.RG32UI),F===i.BYTE&amp;&amp;(q=i.RG8I),F===i.SHORT&amp;&amp;(q=i.RG16I),F===i.INT&amp;&amp;(q=i.RG32I)),v===i.RGB_INTEGER&amp;&amp;(F===i.UNSIGNED_BYTE&amp;&amp;(q=i.RGB8UI),F===i.UNSIGNED_SHORT&amp;&amp;(q=i.RGB16UI),F===i.UNSIGNED_INT&amp;&amp;(q=i.RGB32UI),F===i.BYTE&amp;&amp;(q=i.RGB8I),F===i.SHORT&amp;&amp;(q=i.RGB16I),F===i.INT&amp;&amp;(q=i.RGB32I)),v===i.RGBA_INTEGER&amp;&amp;(F===i.UNSIGNED_BYTE&amp;&amp;(q=i.RGBA8UI),F===i.UNSIGNED_SHORT&amp;&amp;(q=i.RGBA16UI),F===i.UNSIGNED_INT&amp;&amp;(q=i.RGBA32UI),F===i.BYTE&amp;&amp;(q=i.RGBA8I),F===i.SHORT&amp;&amp;(q=i.RGBA16I),F===i.INT&amp;&amp;(q=i.RGBA32I)),v===i.RGB&amp;&amp;F===i.UNSIGNED_INT_5_9_9_9_REV&amp;&amp;(q=i.RGB9_E5),v===i.RGBA){const _e=K?$r:Ie.getTransfer(Y);F===i.FLOAT&amp;&amp;(q=i.RGBA32F),F===i.HALF_FLOAT&amp;&amp;(q=i.RGBA16F),F===i.UNSIGNED_BYTE&amp;&amp;(q=_e===$e?i.SRGB8_ALPHA8:i.RGBA8),F===i.UNSIGNED_SHORT_4_4_4_4&amp;&amp;(q=i.RGBA4),F===i.UNSIGNED_SHORT_5_5_5_1&amp;&amp;(q=i.RGB5_A1)}return(q===i.R16F||q===i.R32F||q===i.RG16F||q===i.RG32F||q===i.RGBA16F||q===i.RGBA32F)&amp;&amp;e.get("EXT_color_buffer_float"),q}function M(T,v){let F;return T?v===null||v===Xn||v===Ei?F=i.DEPTH24_STENCIL8:v===Jt?F=i.DEPTH32F_STENCIL8:v===Yi&amp;&amp;(F=i.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===Xn||v===Ei?F=i.DEPTH_COMPONENT24:v===Jt?F=i.DEPTH_COMPONENT32F:v===Yi&amp;&amp;(F=i.DEPTH_COMPONENT16),F}function N(T,v){return m(T)===!0||T.isFramebufferTexture&amp;&amp;T.minFilter!==It&amp;&amp;T.minFilter!==$t?Math.log2(Math.max(v.width,v.height))+1:T.mipmaps!==void 0&amp;&amp;T.mipmaps.length&gt;0?T.mipmaps.length:T.isCompressedTexture&amp;&amp;Array.isArray(T.image)?v.mipmaps.length:1}function w(T){const v=T.target;v.removeEventListener("dispose",w),U(v),v.isVideoTexture&amp;&amp;u.delete(v)}function R(T){const v=T.target;v.removeEventListener("dispose",R),S(v)}function U(T){const v=n.get(T);if(v.__webglInit===void 0)return;const F=T.source,Y=f.get(F);if(Y){const K=Y[v.__cacheKey];K.usedTimes--,K.usedTimes===0&amp;&amp;E(T),Object.keys(Y).length===0&amp;&amp;f.delete(F)}n.remove(T)}function E(T){const v=n.get(T);i.deleteTexture(v.__webglTexture);const F=T.source,Y=f.get(F);delete Y[v.__cacheKey],a.memory.textures--}function S(T){const v=n.get(T);if(T.depthTexture&amp;&amp;(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let Y=0;Y&lt;6;Y++){if(Array.isArray(v.__webglFramebuffer[Y]))for(let K=0;K&lt;v.__webglFramebuffer[Y].length;K++)i.deleteFramebuffer(v.__webglFramebuffer[Y][K]);else i.deleteFramebuffer(v.__webglFramebuffer[Y]);v.__webglDepthbuffer&amp;&amp;i.deleteRenderbuffer(v.__webglDepthbuffer[Y])}else{if(Array.isArray(v.__webglFramebuffer))for(let Y=0;Y&lt;v.__webglFramebuffer.length;Y++)i.deleteFramebuffer(v.__webglFramebuffer[Y]);else i.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer&amp;&amp;i.deleteRenderbuffer(v.__webglDepthbuffer),v.__webglMultisampledFramebuffer&amp;&amp;i.deleteFramebuffer(v.__webglMultisampledFramebuffer),v.__webglColorRenderbuffer)for(let Y=0;Y&lt;v.__webglColorRenderbuffer.length;Y++)v.__webglColorRenderbuffer[Y]&amp;&amp;i.deleteRenderbuffer(v.__webglColorRenderbuffer[Y]);v.__webglDepthRenderbuffer&amp;&amp;i.deleteRenderbuffer(v.__webglDepthRenderbuffer)}const F=T.textures;for(let Y=0,K=F.length;Y&lt;K;Y++){const q=n.get(F[Y]);q.__webglTexture&amp;&amp;(i.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(F[Y])}n.remove(T)}let A=0;function G(){A=0}function z(){const T=A;return T&gt;=r.maxTextures&amp;&amp;console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),A+=1,T}function X(T){const v=[];return v.push(T.wrapS),v.push(T.wrapT),v.push(T.wrapR||0),v.push(T.magFilter),v.push(T.minFilter),v.push(T.anisotropy),v.push(T.internalFormat),v.push(T.format),v.push(T.type),v.push(T.generateMipmaps),v.push(T.premultiplyAlpha),v.push(T.flipY),v.push(T.unpackAlignment),v.push(T.colorSpace),v.join()}function j(T,v){const F=n.get(T);if(T.isVideoTexture&amp;&amp;Ee(T),T.isRenderTargetTexture===!1&amp;&amp;T.version&gt;0&amp;&amp;F.__version!==T.version){const Y=T.image;if(Y===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{W(F,T,v);return}}t.bindTexture(i.TEXTURE_2D,F.__webglTexture,i.TEXTURE0+v)}function H(T,v){const F=n.get(T);if(T.version&gt;0&amp;&amp;F.__version!==T.version){W(F,T,v);return}t.bindTexture(i.TEXTURE_2D_ARRAY,F.__webglTexture,i.TEXTURE0+v)}function J(T,v){const F=n.get(T);if(T.version&gt;0&amp;&amp;F.__version!==T.version){W(F,T,v);return}t.bindTexture(i.TEXTURE_3D,F.__webglTexture,i.TEXTURE0+v)}function k(T,v){const F=n.get(T);if(T.version&gt;0&amp;&amp;F.__version!==T.version){$(F,T,v);return}t.bindTexture(i.TEXTURE_CUBE_MAP,F.__webglTexture,i.TEXTURE0+v)}const te={[qi]:i.REPEAT,[fn]:i.CLAMP_TO_EDGE,[ea]:i.MIRRORED_REPEAT},ce={[It]:i.NEAREST,[ru]:i.NEAREST_MIPMAP_NEAREST,[ar]:i.NEAREST_MIPMAP_LINEAR,[$t]:i.LINEAR,[ss]:i.LINEAR_MIPMAP_NEAREST,[Wn]:i.LINEAR_MIPMAP_LINEAR},Me={[cu]:i.NEVER,[mu]:i.ALWAYS,[uu]:i.LESS,[Gl]:i.LEQUAL,[hu]:i.EQUAL,[pu]:i.GEQUAL,[fu]:i.GREATER,[du]:i.NOTEQUAL};function Pe(T,v){if(v.type===Jt&amp;&amp;e.has("OES_texture_float_linear")===!1&amp;&amp;(v.magFilter===$t||v.magFilter===ss||v.magFilter===ar||v.magFilter===Wn||v.minFilter===$t||v.minFilter===ss||v.minFilter===ar||v.minFilter===Wn)&amp;&amp;console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(T,i.TEXTURE_WRAP_S,te[v.wrapS]),i.texParameteri(T,i.TEXTURE_WRAP_T,te[v.wrapT]),(T===i.TEXTURE_3D||T===i.TEXTURE_2D_ARRAY)&amp;&amp;i.texParameteri(T,i.TEXTURE_WRAP_R,te[v.wrapR]),i.texParameteri(T,i.TEXTURE_MAG_FILTER,ce[v.magFilter]),i.texParameteri(T,i.TEXTURE_MIN_FILTER,ce[v.minFilter]),v.compareFunction&amp;&amp;(i.texParameteri(T,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(T,i.TEXTURE_COMPARE_FUNC,Me[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===It||v.minFilter!==ar&amp;&amp;v.minFilter!==Wn||v.type===Jt&amp;&amp;e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy&gt;1||n.get(v).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");i.texParameterf(T,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,r.getMaxAnisotropy())),n.get(v).__currentAnisotropy=v.anisotropy}}}function Ve(T,v){let F=!1;T.__webglInit===void 0&amp;&amp;(T.__webglInit=!0,v.addEventListener("dispose",w));const Y=v.source;let K=f.get(Y);K===void 0&amp;&amp;(K={},f.set(Y,K));const q=X(v);if(q!==T.__cacheKey){K[q]===void 0&amp;&amp;(K[q]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,F=!0),K[q].usedTimes++;const _e=K[T.__cacheKey];_e!==void 0&amp;&amp;(K[T.__cacheKey].usedTimes--,_e.usedTimes===0&amp;&amp;E(v)),T.__cacheKey=q,T.__webglTexture=K[q].texture}return F}function W(T,v,F){let Y=i.TEXTURE_2D;(v.isDataArrayTexture||v.isCompressedArrayTexture)&amp;&amp;(Y=i.TEXTURE_2D_ARRAY),v.isData3DTexture&amp;&amp;(Y=i.TEXTURE_3D);const K=Ve(T,v),q=v.source;t.bindTexture(Y,T.__webglTexture,i.TEXTURE0+F);const _e=n.get(q);if(q.version!==_e.__version||K===!0){t.activeTexture(i.TEXTURE0+F);const se=Ie.getPrimaries(Ie.workingColorSpace),ue=v.colorSpace===An?null:Ie.getPrimaries(v.colorSpace),Xe=v.colorSpace===An||se===ue?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Xe);let Q=_(v.image,!1,r.maxTextureSize);Q=nt(v,Q);const he=s.convert(v.format,v.colorSpace),Te=s.convert(v.type);let we=y(v.internalFormat,he,Te,v.colorSpace,v.isVideoTexture);Pe(Y,v);let fe;const We=v.mipmaps,Ue=v.isVideoTexture!==!0,Qe=_e.__version===void 0||K===!0,C=q.dataReady,re=N(v,Q);if(v.isDepthTexture)we=M(v.format===Ti,v.type),Qe&amp;&amp;(Ue?t.texStorage2D(i.TEXTURE_2D,1,we,Q.width,Q.height):t.texImage2D(i.TEXTURE_2D,0,we,Q.width,Q.height,0,he,Te,null));else if(v.isDataTexture)if(We.length&gt;0){Ue&amp;&amp;Qe&amp;&amp;t.texStorage2D(i.TEXTURE_2D,re,we,We[0].width,We[0].height);for(let V=0,Z=We.length;V&lt;Z;V++)fe=We[V],Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_2D,V,0,0,fe.width,fe.height,he,Te,fe.data):t.texImage2D(i.TEXTURE_2D,V,we,fe.width,fe.height,0,he,Te,fe.data);v.generateMipmaps=!1}else Ue?(Qe&amp;&amp;t.texStorage2D(i.TEXTURE_2D,re,we,Q.width,Q.height),C&amp;&amp;t.texSubImage2D(i.TEXTURE_2D,0,0,0,Q.width,Q.height,he,Te,Q.data)):t.texImage2D(i.TEXTURE_2D,0,we,Q.width,Q.height,0,he,Te,Q.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ue&amp;&amp;Qe&amp;&amp;t.texStorage3D(i.TEXTURE_2D_ARRAY,re,we,We[0].width,We[0].height,Q.depth);for(let V=0,Z=We.length;V&lt;Z;V++)if(fe=We[V],v.format!==Bt)if(he!==null)if(Ue){if(C)if(v.layerUpdates.size&gt;0){const le=ll(fe.width,fe.height,v.format,v.type);for(const ae of v.layerUpdates){const Le=fe.data.subarray(ae*le/fe.data.BYTES_PER_ELEMENT,(ae+1)*le/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,V,0,0,ae,fe.width,fe.height,1,he,Le)}v.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,V,0,0,0,fe.width,fe.height,Q.depth,he,fe.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,V,we,fe.width,fe.height,Q.depth,0,fe.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?C&amp;&amp;t.texSubImage3D(i.TEXTURE_2D_ARRAY,V,0,0,0,fe.width,fe.height,Q.depth,he,Te,fe.data):t.texImage3D(i.TEXTURE_2D_ARRAY,V,we,fe.width,fe.height,Q.depth,0,he,Te,fe.data)}else{Ue&amp;&amp;Qe&amp;&amp;t.texStorage2D(i.TEXTURE_2D,re,we,We[0].width,We[0].height);for(let V=0,Z=We.length;V&lt;Z;V++)fe=We[V],v.format!==Bt?he!==null?Ue?C&amp;&amp;t.compressedTexSubImage2D(i.TEXTURE_2D,V,0,0,fe.width,fe.height,he,fe.data):t.compressedTexImage2D(i.TEXTURE_2D,V,we,fe.width,fe.height,0,fe.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_2D,V,0,0,fe.width,fe.height,he,Te,fe.data):t.texImage2D(i.TEXTURE_2D,V,we,fe.width,fe.height,0,he,Te,fe.data)}else if(v.isDataArrayTexture)if(Ue){if(Qe&amp;&amp;t.texStorage3D(i.TEXTURE_2D_ARRAY,re,we,Q.width,Q.height,Q.depth),C)if(v.layerUpdates.size&gt;0){const V=ll(Q.width,Q.height,v.format,v.type);for(const Z of v.layerUpdates){const le=Q.data.subarray(Z*V/Q.data.BYTES_PER_ELEMENT,(Z+1)*V/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Z,Q.width,Q.height,1,he,Te,le)}v.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,he,Te,Q.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,we,Q.width,Q.height,Q.depth,0,he,Te,Q.data);else if(v.isData3DTexture)Ue?(Qe&amp;&amp;t.texStorage3D(i.TEXTURE_3D,re,we,Q.width,Q.height,Q.depth),C&amp;&amp;t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,he,Te,Q.data)):t.texImage3D(i.TEXTURE_3D,0,we,Q.width,Q.height,Q.depth,0,he,Te,Q.data);else if(v.isFramebufferTexture){if(Qe)if(Ue)t.texStorage2D(i.TEXTURE_2D,re,we,Q.width,Q.height);else{let V=Q.width,Z=Q.height;for(let le=0;le&lt;re;le++)t.texImage2D(i.TEXTURE_2D,le,we,V,Z,0,he,Te,null),V&gt;&gt;=1,Z&gt;&gt;=1}}else if(We.length&gt;0){if(Ue&amp;&amp;Qe){const V=Se(We[0]);t.texStorage2D(i.TEXTURE_2D,re,we,V.width,V.height)}for(let V=0,Z=We.length;V&lt;Z;V++)fe=We[V],Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_2D,V,0,0,he,Te,fe):t.texImage2D(i.TEXTURE_2D,V,we,he,Te,fe);v.generateMipmaps=!1}else if(Ue){if(Qe){const V=Se(Q);t.texStorage2D(i.TEXTURE_2D,re,we,V.width,V.height)}C&amp;&amp;t.texSubImage2D(i.TEXTURE_2D,0,0,0,he,Te,Q)}else t.texImage2D(i.TEXTURE_2D,0,we,he,Te,Q);m(v)&amp;&amp;p(Y),_e.__version=q.version,v.onUpdate&amp;&amp;v.onUpdate(v)}T.__version=v.version}function $(T,v,F){if(v.image.length!==6)return;const Y=Ve(T,v),K=v.source;t.bindTexture(i.TEXTURE_CUBE_MAP,T.__webglTexture,i.TEXTURE0+F);const q=n.get(K);if(K.version!==q.__version||Y===!0){t.activeTexture(i.TEXTURE0+F);const _e=Ie.getPrimaries(Ie.workingColorSpace),se=v.colorSpace===An?null:Ie.getPrimaries(v.colorSpace),ue=v.colorSpace===An||_e===se?i.NONE:i.BROWSER_DEFAULT_WEBGL;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,v.flipY),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v.premultiplyAlpha),i.pixelStorei(i.UNPACK_ALIGNMENT,v.unpackAlignment),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ue);const Xe=v.isCompressedTexture||v.image[0].isCompressedTexture,Q=v.image[0]&amp;&amp;v.image[0].isDataTexture,he=[];for(let Z=0;Z&lt;6;Z++)!Xe&amp;&amp;!Q?he[Z]=_(v.image[Z],!0,r.maxCubemapSize):he[Z]=Q?v.image[Z].image:v.image[Z],he[Z]=nt(v,he[Z]);const Te=he[0],we=s.convert(v.format,v.colorSpace),fe=s.convert(v.type),We=y(v.internalFormat,we,fe,v.colorSpace),Ue=v.isVideoTexture!==!0,Qe=q.__version===void 0||Y===!0,C=K.dataReady;let re=N(v,Te);Pe(i.TEXTURE_CUBE_MAP,v);let V;if(Xe){Ue&amp;&amp;Qe&amp;&amp;t.texStorage2D(i.TEXTURE_CUBE_MAP,re,We,Te.width,Te.height);for(let Z=0;Z&lt;6;Z++){V=he[Z].mipmaps;for(let le=0;le&lt;V.length;le++){const ae=V[le];v.format!==Bt?we!==null?Ue?C&amp;&amp;t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,0,0,ae.width,ae.height,we,ae.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,We,ae.width,ae.height,0,ae.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,0,0,ae.width,ae.height,we,fe,ae.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le,We,ae.width,ae.height,0,we,fe,ae.data)}}}else{if(V=v.mipmaps,Ue&amp;&amp;Qe){V.length&gt;0&amp;&amp;re++;const Z=Se(he[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,re,We,Z.width,Z.height)}for(let Z=0;Z&lt;6;Z++)if(Q){Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,he[Z].width,he[Z].height,we,fe,he[Z].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,We,he[Z].width,he[Z].height,0,we,fe,he[Z].data);for(let le=0;le&lt;V.length;le++){const Le=V[le].image[Z].image;Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,0,0,Le.width,Le.height,we,fe,Le.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,We,Le.width,Le.height,0,we,fe,Le.data)}}else{Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,0,0,we,fe,he[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,0,We,we,fe,he[Z]);for(let le=0;le&lt;V.length;le++){const ae=V[le];Ue?C&amp;&amp;t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,0,0,we,fe,ae.image[Z]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Z,le+1,We,we,fe,ae.image[Z])}}}m(v)&amp;&amp;p(i.TEXTURE_CUBE_MAP),q.__version=K.version,v.onUpdate&amp;&amp;v.onUpdate(v)}T.__version=v.version}function de(T,v,F,Y,K,q){const _e=s.convert(F.format,F.colorSpace),se=s.convert(F.type),ue=y(F.internalFormat,_e,se,F.colorSpace),Xe=n.get(v),Q=n.get(F);if(Q.__renderTarget=v,!Xe.__hasExternalTextures){const he=Math.max(1,v.width&gt;&gt;q),Te=Math.max(1,v.height&gt;&gt;q);K===i.TEXTURE_3D||K===i.TEXTURE_2D_ARRAY?t.texImage3D(K,q,ue,he,Te,v.depth,0,_e,se,null):t.texImage2D(K,q,ue,he,Te,0,_e,se,null)}t.bindFramebuffer(i.FRAMEBUFFER,T),Ge(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Y,K,Q.__webglTexture,0,He(v)):(K===i.TEXTURE_2D||K&gt;=i.TEXTURE_CUBE_MAP_POSITIVE_X&amp;&amp;K&lt;=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&amp;&amp;i.framebufferTexture2D(i.FRAMEBUFFER,Y,K,Q.__webglTexture,q),t.bindFramebuffer(i.FRAMEBUFFER,null)}function ne(T,v,F){if(i.bindRenderbuffer(i.RENDERBUFFER,T),v.depthBuffer){const Y=v.depthTexture,K=Y&amp;&amp;Y.isDepthTexture?Y.type:null,q=M(v.stencilBuffer,K),_e=v.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,se=He(v);Ge(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,se,q,v.width,v.height):F?i.renderbufferStorageMultisample(i.RENDERBUFFER,se,q,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,q,v.width,v.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,_e,i.RENDERBUFFER,T)}else{const Y=v.textures;for(let K=0;K&lt;Y.length;K++){const q=Y[K],_e=s.convert(q.format,q.colorSpace),se=s.convert(q.type),ue=y(q.internalFormat,_e,se,q.colorSpace),Xe=He(v);F&amp;&amp;Ge(v)===!1?i.renderbufferStorageMultisample(i.RENDERBUFFER,Xe,ue,v.width,v.height):Ge(v)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Xe,ue,v.width,v.height):i.renderbufferStorage(i.RENDERBUFFER,ue,v.width,v.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function ye(T,v){if(v&amp;&amp;v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(i.FRAMEBUFFER,T),!(v.depthTexture&amp;&amp;v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Y=n.get(v.depthTexture);Y.__renderTarget=v,(!Y.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&amp;&amp;(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),j(v.depthTexture,0);const K=Y.__webglTexture,q=He(v);if(v.depthTexture.format===vi)Ge(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0,q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,K,0);else if(v.depthTexture.format===Ti)Ge(v)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0,q):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,K,0);else throw new Error("Unknown depthTexture format")}function Ae(T){const v=n.get(T),F=T.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==T.depthTexture){const Y=T.depthTexture;if(v.__depthDisposeCallback&amp;&amp;v.__depthDisposeCallback(),Y){const K=()=&gt;{delete v.__boundDepthTexture,delete v.__depthDisposeCallback,Y.removeEventListener("dispose",K)};Y.addEventListener("dispose",K),v.__depthDisposeCallback=K}v.__boundDepthTexture=Y}if(T.depthTexture&amp;&amp;!v.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");ye(v.__webglFramebuffer,T)}else if(F){v.__webglDepthbuffer=[];for(let Y=0;Y&lt;6;Y++)if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer[Y]),v.__webglDepthbuffer[Y]===void 0)v.__webglDepthbuffer[Y]=i.createRenderbuffer(),ne(v.__webglDepthbuffer[Y],T,!1);else{const K=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,q=v.__webglDepthbuffer[Y];i.bindRenderbuffer(i.RENDERBUFFER,q),i.framebufferRenderbuffer(i.FRAMEBUFFER,K,i.RENDERBUFFER,q)}}else if(t.bindFramebuffer(i.FRAMEBUFFER,v.__webglFramebuffer),v.__webglDepthbuffer===void 0)v.__webglDepthbuffer=i.createRenderbuffer(),ne(v.__webglDepthbuffer,T,!1);else{const Y=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,K=v.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,K),i.framebufferRenderbuffer(i.FRAMEBUFFER,Y,i.RENDERBUFFER,K)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Fe(T,v,F){const Y=n.get(T);v!==void 0&amp;&amp;de(Y.__webglFramebuffer,T,T.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),F!==void 0&amp;&amp;Ae(T)}function Je(T){const v=T.texture,F=n.get(T),Y=n.get(v);T.addEventListener("dispose",R);const K=T.textures,q=T.isWebGLCubeRenderTarget===!0,_e=K.length&gt;1;if(_e||(Y.__webglTexture===void 0&amp;&amp;(Y.__webglTexture=i.createTexture()),Y.__version=v.version,a.memory.textures++),q){F.__webglFramebuffer=[];for(let se=0;se&lt;6;se++)if(v.mipmaps&amp;&amp;v.mipmaps.length&gt;0){F.__webglFramebuffer[se]=[];for(let ue=0;ue&lt;v.mipmaps.length;ue++)F.__webglFramebuffer[se][ue]=i.createFramebuffer()}else F.__webglFramebuffer[se]=i.createFramebuffer()}else{if(v.mipmaps&amp;&amp;v.mipmaps.length&gt;0){F.__webglFramebuffer=[];for(let se=0;se&lt;v.mipmaps.length;se++)F.__webglFramebuffer[se]=i.createFramebuffer()}else F.__webglFramebuffer=i.createFramebuffer();if(_e)for(let se=0,ue=K.length;se&lt;ue;se++){const Xe=n.get(K[se]);Xe.__webglTexture===void 0&amp;&amp;(Xe.__webglTexture=i.createTexture(),a.memory.textures++)}if(T.samples&gt;0&amp;&amp;Ge(T)===!1){F.__webglMultisampledFramebuffer=i.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let se=0;se&lt;K.length;se++){const ue=K[se];F.__webglColorRenderbuffer[se]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,F.__webglColorRenderbuffer[se]);const Xe=s.convert(ue.format,ue.colorSpace),Q=s.convert(ue.type),he=y(ue.internalFormat,Xe,Q,ue.colorSpace,T.isXRRenderTarget===!0),Te=He(T);i.renderbufferStorageMultisample(i.RENDERBUFFER,Te,he,T.width,T.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+se,i.RENDERBUFFER,F.__webglColorRenderbuffer[se])}i.bindRenderbuffer(i.RENDERBUFFER,null),T.depthBuffer&amp;&amp;(F.__webglDepthRenderbuffer=i.createRenderbuffer(),ne(F.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(q){t.bindTexture(i.TEXTURE_CUBE_MAP,Y.__webglTexture),Pe(i.TEXTURE_CUBE_MAP,v);for(let se=0;se&lt;6;se++)if(v.mipmaps&amp;&amp;v.mipmaps.length&gt;0)for(let ue=0;ue&lt;v.mipmaps.length;ue++)de(F.__webglFramebuffer[se][ue],T,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+se,ue);else de(F.__webglFramebuffer[se],T,v,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+se,0);m(v)&amp;&amp;p(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(_e){for(let se=0,ue=K.length;se&lt;ue;se++){const Xe=K[se],Q=n.get(Xe);t.bindTexture(i.TEXTURE_2D,Q.__webglTexture),Pe(i.TEXTURE_2D,Xe),de(F.__webglFramebuffer,T,Xe,i.COLOR_ATTACHMENT0+se,i.TEXTURE_2D,0),m(Xe)&amp;&amp;p(i.TEXTURE_2D)}t.unbindTexture()}else{let se=i.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&amp;&amp;(se=T.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(se,Y.__webglTexture),Pe(se,v),v.mipmaps&amp;&amp;v.mipmaps.length&gt;0)for(let ue=0;ue&lt;v.mipmaps.length;ue++)de(F.__webglFramebuffer[ue],T,v,i.COLOR_ATTACHMENT0,se,ue);else de(F.__webglFramebuffer,T,v,i.COLOR_ATTACHMENT0,se,0);m(v)&amp;&amp;p(se),t.unbindTexture()}T.depthBuffer&amp;&amp;Ae(T)}function Be(T){const v=T.textures;for(let F=0,Y=v.length;F&lt;Y;F++){const K=v[F];if(m(K)){const q=b(T),_e=n.get(K).__webglTexture;t.bindTexture(q,_e),p(q),t.unbindTexture()}}}const ot=[],I=[];function Ut(T){if(T.samples&gt;0){if(Ge(T)===!1){const v=T.textures,F=T.width,Y=T.height;let K=i.COLOR_BUFFER_BIT;const q=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,_e=n.get(T),se=v.length&gt;1;if(se)for(let ue=0;ue&lt;v.length;ue++)t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let ue=0;ue&lt;v.length;ue++){if(T.resolveDepthBuffer&amp;&amp;(T.depthBuffer&amp;&amp;(K|=i.DEPTH_BUFFER_BIT),T.stencilBuffer&amp;&amp;T.resolveStencilBuffer&amp;&amp;(K|=i.STENCIL_BUFFER_BIT)),se){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,_e.__webglColorRenderbuffer[ue]);const Xe=n.get(v[ue]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,Xe,0)}i.blitFramebuffer(0,0,F,Y,0,0,F,Y,K,i.NEAREST),l===!0&amp;&amp;(ot.length=0,I.length=0,ot.push(i.COLOR_ATTACHMENT0+ue),T.depthBuffer&amp;&amp;T.resolveDepthBuffer===!1&amp;&amp;(ot.push(q),I.push(q),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,I)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,ot))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),se)for(let ue=0;ue&lt;v.length;ue++){t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.RENDERBUFFER,_e.__webglColorRenderbuffer[ue]);const Xe=n.get(v[ue]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,_e.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ue,i.TEXTURE_2D,Xe,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}else if(T.depthBuffer&amp;&amp;T.resolveDepthBuffer===!1&amp;&amp;l){const v=T.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[v])}}}function He(T){return Math.min(r.maxSamples,T.samples)}function Ge(T){const v=n.get(T);return T.samples&gt;0&amp;&amp;e.has("WEBGL_multisampled_render_to_texture")===!0&amp;&amp;v.__useRenderToTexture!==!1}function Ee(T){const v=a.render.frame;u.get(T)!==v&amp;&amp;(u.set(T,v),T.update())}function nt(T,v){const F=T.colorSpace,Y=T.format,K=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||F!==Ri&amp;&amp;F!==An&amp;&amp;(Ie.getTransfer(F)===$e?(Y!==Bt||K!==mn)&amp;&amp;console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),v}function Se(T){return typeof HTMLImageElement&lt;"u"&amp;&amp;T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame&lt;"u"&amp;&amp;T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=G,this.setTexture2D=j,this.setTexture2DArray=H,this.setTexture3D=J,this.setTextureCube=k,this.rebindTextures=Fe,this.setupRenderTarget=Je,this.updateRenderTargetMipmap=Be,this.updateMultisampleRenderTarget=Ut,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=de,this.useMultisampledRTT=Ge}function Nm(i,e){function t(n,r=An){let s;const a=Ie.getTransfer(r);if(n===mn)return i.UNSIGNED_BYTE;if(n===Fa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===Oa)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Nl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Il)return i.BYTE;if(n===Ul)return i.SHORT;if(n===Yi)return i.UNSIGNED_SHORT;if(n===Na)return i.INT;if(n===Xn)return i.UNSIGNED_INT;if(n===Jt)return i.FLOAT;if(n===tr)return i.HALF_FLOAT;if(n===Fl)return i.ALPHA;if(n===Ol)return i.RGB;if(n===Bt)return i.RGBA;if(n===Bl)return i.LUMINANCE;if(n===zl)return i.LUMINANCE_ALPHA;if(n===vi)return i.DEPTH_COMPONENT;if(n===Ti)return i.DEPTH_STENCIL;if(n===kl)return i.RED;if(n===Ba)return i.RED_INTEGER;if(n===Vl)return i.RG;if(n===za)return i.RG_INTEGER;if(n===ka)return i.RGBA_INTEGER;if(n===Fr||n===Or||n===Br||n===zr)if(a===$e)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Fr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Or)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Br)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===zr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Fr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Or)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Br)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===zr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ta||n===na||n===ia||n===ra)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===ta)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===na)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ia)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ra)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===sa||n===aa||n===oa)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===sa||n===aa)return a===$e?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===oa)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===la||n===ca||n===ua||n===ha||n===fa||n===da||n===pa||n===ma||n===ga||n===_a||n===va||n===xa||n===Ma||n===ya)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===la)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ca)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ua)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ha)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===fa)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===da)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===pa)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ma)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ga)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===_a)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===va)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===xa)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ma)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ya)return a===$e?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===kr||n===Sa||n===Ea)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===kr)return a===$e?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Sa)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ea)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Hl||n===Ta||n===ba||n===Aa)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===kr)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Ta)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ba)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Aa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ei?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}class Fm extends Rt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class pi extends at{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Om={type:"move"};class Is{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&amp;&amp;(this._hand=new pi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&amp;&amp;(this._targetRay=new pi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&amp;&amp;(this._grip=new pi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P),this._grip}dispatchEvent(e){return this._targetRay!==null&amp;&amp;this._targetRay.dispatchEvent(e),this._grip!==null&amp;&amp;this._grip.dispatchEvent(e),this._hand!==null&amp;&amp;this._hand.dispatchEvent(e),this}connect(e){if(e&amp;&amp;e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&amp;&amp;(this._targetRay.visible=!1),this._grip!==null&amp;&amp;(this._grip.visible=!1),this._hand!==null&amp;&amp;(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&amp;&amp;t.session.visibilityState!=="visible-blurred"){if(c&amp;&amp;e.hand){a=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,n),p=this._getHandJoint(c,_);m!==null&amp;&amp;(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,g=.005;c.inputState.pinching&amp;&amp;f&gt;d+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&amp;&amp;f&lt;=d-g&amp;&amp;(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&amp;&amp;e.gripSpace&amp;&amp;(s=t.getPose(e.gripSpace,n),s!==null&amp;&amp;(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&amp;&amp;(r=t.getPose(e.targetRaySpace,n),r===null&amp;&amp;s!==null&amp;&amp;(r=s),r!==null&amp;&amp;(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Om)))}return o!==null&amp;&amp;(o.visible=r!==null),l!==null&amp;&amp;(l.visible=s!==null),c!==null&amp;&amp;(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new pi;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Bm=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,zm=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x &gt;= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class km{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const r=new _t,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&amp;&amp;(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&amp;&amp;this.mesh===null){const t=e.cameras[0].viewport,n=new Pn({vertexShader:Bm,fragmentShader:zm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Zt(new Qr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Vm extends Zn{constructor(e,t){super();const n=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,d=null,g=null;const _=new km,m=t.getContextAttributes();let p=null,b=null;const y=[],M=[],N=new ke;let w=null;const R=new Rt;R.viewport=new ze;const U=new Rt;U.viewport=new ze;const E=[R,U],S=new Fm;let A=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(W){let $=y[W];return $===void 0&amp;&amp;($=new Is,y[W]=$),$.getTargetRaySpace()},this.getControllerGrip=function(W){let $=y[W];return $===void 0&amp;&amp;($=new Is,y[W]=$),$.getGripSpace()},this.getHand=function(W){let $=y[W];return $===void 0&amp;&amp;($=new Is,y[W]=$),$.getHandSpace()};function z(W){const $=M.indexOf(W.inputSource);if($===-1)return;const de=y[$];de!==void 0&amp;&amp;(de.update(W.inputSource,W.frame,c||a),de.dispatchEvent({type:W.type,data:W.inputSource}))}function X(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",X),r.removeEventListener("inputsourceschange",j);for(let W=0;W&lt;y.length;W++){const $=M[W];$!==null&amp;&amp;(M[W]=null,y[W].disconnect($))}A=null,G=null,_.reset(),e.setRenderTarget(p),d=null,f=null,h=null,r=null,b=null,Ve.stop(),n.isPresenting=!1,e.setPixelRatio(w),e.setSize(N.width,N.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(W){s=W,n.isPresenting===!0&amp;&amp;console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(W){o=W,n.isPresenting===!0&amp;&amp;console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(W){c=W},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(W){if(r=W,r!==null){if(p=e.getRenderTarget(),r.addEventListener("select",z),r.addEventListener("selectstart",z),r.addEventListener("selectend",z),r.addEventListener("squeeze",z),r.addEventListener("squeezestart",z),r.addEventListener("squeezeend",z),r.addEventListener("end",X),r.addEventListener("inputsourceschange",j),m.xrCompatible!==!0&amp;&amp;await t.makeXRCompatible(),w=e.getPixelRatio(),e.getSize(N),r.renderState.layers===void 0){const $={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,$),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),b=new qn(d.framebufferWidth,d.framebufferHeight,{format:Bt,type:mn,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let $=null,de=null,ne=null;m.depth&amp;&amp;(ne=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$=m.stencil?Ti:vi,de=m.stencil?Ei:Xn);const ye={colorFormat:t.RGBA8,depthFormat:ne,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(ye),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),b=new qn(f.textureWidth,f.textureHeight,{format:Bt,type:mn,depthTexture:new tc(f.textureWidth,f.textureHeight,de,void 0,void 0,void 0,void 0,void 0,void 0,$),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1})}b.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),Ve.setContext(r),Ve.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};function j(W){for(let $=0;$&lt;W.removed.length;$++){const de=W.removed[$],ne=M.indexOf(de);ne&gt;=0&amp;&amp;(M[ne]=null,y[ne].disconnect(de))}for(let $=0;$&lt;W.added.length;$++){const de=W.added[$];let ne=M.indexOf(de);if(ne===-1){for(let Ae=0;Ae&lt;y.length;Ae++)if(Ae&gt;=M.length){M.push(de),ne=Ae;break}else if(M[Ae]===null){M[Ae]=de,ne=Ae;break}if(ne===-1)break}const ye=y[ne];ye&amp;&amp;ye.connect(de)}}const H=new P,J=new P;function k(W,$,de){H.setFromMatrixPosition($.matrixWorld),J.setFromMatrixPosition(de.matrixWorld);const ne=H.distanceTo(J),ye=$.projectionMatrix.elements,Ae=de.projectionMatrix.elements,Fe=ye[14]/(ye[10]-1),Je=ye[14]/(ye[10]+1),Be=(ye[9]+1)/ye[5],ot=(ye[9]-1)/ye[5],I=(ye[8]-1)/ye[0],Ut=(Ae[8]+1)/Ae[0],He=Fe*I,Ge=Fe*Ut,Ee=ne/(-I+Ut),nt=Ee*-I;if($.matrixWorld.decompose(W.position,W.quaternion,W.scale),W.translateX(nt),W.translateZ(Ee),W.matrixWorld.compose(W.position,W.quaternion,W.scale),W.matrixWorldInverse.copy(W.matrixWorld).invert(),ye[10]===-1)W.projectionMatrix.copy($.projectionMatrix),W.projectionMatrixInverse.copy($.projectionMatrixInverse);else{const Se=Fe+Ee,T=Je+Ee,v=He-nt,F=Ge+(ne-nt),Y=Be*Je/T*Se,K=ot*Je/T*Se;W.projectionMatrix.makePerspective(v,F,Y,K,Se,T),W.projectionMatrixInverse.copy(W.projectionMatrix).invert()}}function te(W,$){$===null?W.matrixWorld.copy(W.matrix):W.matrixWorld.multiplyMatrices($.matrixWorld,W.matrix),W.matrixWorldInverse.copy(W.matrixWorld).invert()}this.updateCamera=function(W){if(r===null)return;let $=W.near,de=W.far;_.texture!==null&amp;&amp;(_.depthNear&gt;0&amp;&amp;($=_.depthNear),_.depthFar&gt;0&amp;&amp;(de=_.depthFar)),S.near=U.near=R.near=$,S.far=U.far=R.far=de,(A!==S.near||G!==S.far)&amp;&amp;(r.updateRenderState({depthNear:S.near,depthFar:S.far}),A=S.near,G=S.far),R.layers.mask=W.layers.mask|2,U.layers.mask=W.layers.mask|4,S.layers.mask=R.layers.mask|U.layers.mask;const ne=W.parent,ye=S.cameras;te(S,ne);for(let Ae=0;Ae&lt;ye.length;Ae++)te(ye[Ae],ne);ye.length===2?k(S,R,U):S.projectionMatrix.copy(R.projectionMatrix),ce(W,S,ne)};function ce(W,$,de){de===null?W.matrix.copy($.matrixWorld):(W.matrix.copy(de.matrixWorld),W.matrix.invert(),W.matrix.multiply($.matrixWorld)),W.matrix.decompose(W.position,W.quaternion,W.scale),W.updateMatrixWorld(!0),W.projectionMatrix.copy($.projectionMatrix),W.projectionMatrixInverse.copy($.projectionMatrixInverse),W.isPerspectiveCamera&amp;&amp;(W.fov=bi*2*Math.atan(1/W.projectionMatrix.elements[5]),W.zoom=1)}this.getCamera=function(){return S},this.getFoveation=function(){if(!(f===null&amp;&amp;d===null))return l},this.setFoveation=function(W){l=W,f!==null&amp;&amp;(f.fixedFoveation=W),d!==null&amp;&amp;d.fixedFoveation!==void 0&amp;&amp;(d.fixedFoveation=W)},this.hasDepthSensing=function(){return _.texture!==null},this.getDepthSensingMesh=function(){return _.getMesh(S)};let Me=null;function Pe(W,$){if(u=$.getViewerPose(c||a),g=$,u!==null){const de=u.views;d!==null&amp;&amp;(e.setRenderTargetFramebuffer(b,d.framebuffer),e.setRenderTarget(b));let ne=!1;de.length!==S.cameras.length&amp;&amp;(S.cameras.length=0,ne=!0);for(let Ae=0;Ae&lt;de.length;Ae++){const Fe=de[Ae];let Je=null;if(d!==null)Je=d.getViewport(Fe);else{const ot=h.getViewSubImage(f,Fe);Je=ot.viewport,Ae===0&amp;&amp;(e.setRenderTargetTextures(b,ot.colorTexture,f.ignoreDepthValues?void 0:ot.depthStencilTexture),e.setRenderTarget(b))}let Be=E[Ae];Be===void 0&amp;&amp;(Be=new Rt,Be.layers.enable(Ae),Be.viewport=new ze,E[Ae]=Be),Be.matrix.fromArray(Fe.transform.matrix),Be.matrix.decompose(Be.position,Be.quaternion,Be.scale),Be.projectionMatrix.fromArray(Fe.projectionMatrix),Be.projectionMatrixInverse.copy(Be.projectionMatrix).invert(),Be.viewport.set(Je.x,Je.y,Je.width,Je.height),Ae===0&amp;&amp;(S.matrix.copy(Be.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale)),ne===!0&amp;&amp;S.cameras.push(Be)}const ye=r.enabledFeatures;if(ye&amp;&amp;ye.includes("depth-sensing")){const Ae=h.getDepthInformation(de[0]);Ae&amp;&amp;Ae.isValid&amp;&amp;Ae.texture&amp;&amp;_.init(e,Ae,r.renderState)}}for(let de=0;de&lt;y.length;de++){const ne=M[de],ye=y[de];ne!==null&amp;&amp;ye!==void 0&amp;&amp;ye.update(ne,$,c||a)}Me&amp;&amp;Me(W,$),$.detectedPlanes&amp;&amp;n.dispatchEvent({type:"planesdetected",data:$}),g=null}const Ve=new Ql;Ve.setAnimationLoop(Pe),this.setAnimationLoop=function(W){Me=W},this.dispose=function(){}}}const zn=new ft,Hm=new xe;function Gm(i,e){function t(m,p){m.matrixAutoUpdate===!0&amp;&amp;m.updateMatrix(),p.value.copy(m.matrix)}function n(m,p){p.color.getRGB(m.fogColor.value,$l(i)),p.isFog?(m.fogNear.value=p.near,m.fogFar.value=p.far):p.isFogExp2&amp;&amp;(m.fogDensity.value=p.density)}function r(m,p,b,y,M){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(m,p):p.isMeshToonMaterial?(s(m,p),h(m,p)):p.isMeshPhongMaterial?(s(m,p),u(m,p)):p.isMeshStandardMaterial?(s(m,p),f(m,p),p.isMeshPhysicalMaterial&amp;&amp;d(m,p,M)):p.isMeshMatcapMaterial?(s(m,p),g(m,p)):p.isMeshDepthMaterial?s(m,p):p.isMeshDistanceMaterial?(s(m,p),_(m,p)):p.isMeshNormalMaterial?s(m,p):p.isLineBasicMaterial?(a(m,p),p.isLineDashedMaterial&amp;&amp;o(m,p)):p.isPointsMaterial?l(m,p,b,y):p.isSpriteMaterial?c(m,p):p.isShadowMaterial?(m.color.value.copy(p.color),m.opacity.value=p.opacity):p.isShaderMaterial&amp;&amp;(p.uniformsNeedUpdate=!1)}function s(m,p){m.opacity.value=p.opacity,p.color&amp;&amp;m.diffuse.value.copy(p.color),p.emissive&amp;&amp;m.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&amp;&amp;(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&amp;&amp;(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.bumpMap&amp;&amp;(m.bumpMap.value=p.bumpMap,t(p.bumpMap,m.bumpMapTransform),m.bumpScale.value=p.bumpScale,p.side===Ct&amp;&amp;(m.bumpScale.value*=-1)),p.normalMap&amp;&amp;(m.normalMap.value=p.normalMap,t(p.normalMap,m.normalMapTransform),m.normalScale.value.copy(p.normalScale),p.side===Ct&amp;&amp;m.normalScale.value.negate()),p.displacementMap&amp;&amp;(m.displacementMap.value=p.displacementMap,t(p.displacementMap,m.displacementMapTransform),m.displacementScale.value=p.displacementScale,m.displacementBias.value=p.displacementBias),p.emissiveMap&amp;&amp;(m.emissiveMap.value=p.emissiveMap,t(p.emissiveMap,m.emissiveMapTransform)),p.specularMap&amp;&amp;(m.specularMap.value=p.specularMap,t(p.specularMap,m.specularMapTransform)),p.alphaTest&gt;0&amp;&amp;(m.alphaTest.value=p.alphaTest);const b=e.get(p),y=b.envMap,M=b.envMapRotation;y&amp;&amp;(m.envMap.value=y,zn.copy(M),zn.x*=-1,zn.y*=-1,zn.z*=-1,y.isCubeTexture&amp;&amp;y.isRenderTargetTexture===!1&amp;&amp;(zn.y*=-1,zn.z*=-1),m.envMapRotation.value.setFromMatrix4(Hm.makeRotationFromEuler(zn)),m.flipEnvMap.value=y.isCubeTexture&amp;&amp;y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&amp;&amp;(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&amp;&amp;(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function a(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&amp;&amp;(m.map.value=p.map,t(p.map,m.mapTransform))}function o(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,b,y){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*b,m.scale.value=y*.5,p.map&amp;&amp;(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&amp;&amp;(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest&gt;0&amp;&amp;(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&amp;&amp;(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&amp;&amp;(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest&gt;0&amp;&amp;(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&amp;&amp;(m.gradientMap.value=p.gradientMap)}function f(m,p){m.metalness.value=p.metalness,p.metalnessMap&amp;&amp;(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&amp;&amp;(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&amp;&amp;(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,b){m.ior.value=p.ior,p.sheen&gt;0&amp;&amp;(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&amp;&amp;(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&amp;&amp;(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat&gt;0&amp;&amp;(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&amp;&amp;(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&amp;&amp;(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&amp;&amp;(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Ct&amp;&amp;m.clearcoatNormalScale.value.negate())),p.dispersion&gt;0&amp;&amp;(m.dispersion.value=p.dispersion),p.iridescence&gt;0&amp;&amp;(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&amp;&amp;(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&amp;&amp;(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission&gt;0&amp;&amp;(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),p.transmissionMap&amp;&amp;(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&amp;&amp;(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy&gt;0&amp;&amp;(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&amp;&amp;(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&amp;&amp;(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&amp;&amp;(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&amp;&amp;(m.matcap.value=p.matcap)}function _(m,p){const b=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Wm(i,e,t,n){let r={},s={},a=[];const o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(b,y){const M=y.program;n.uniformBlockBinding(b,M)}function c(b,y){let M=r[b.id];M===void 0&amp;&amp;(g(b),M=u(b),r[b.id]=M,b.addEventListener("dispose",m));const N=y.program;n.updateUBOMapping(b,N);const w=e.render.frame;s[b.id]!==w&amp;&amp;(f(b),s[b.id]=w)}function u(b){const y=h();b.__bindingPointIndex=y;const M=i.createBuffer(),N=b.__size,w=b.usage;return i.bindBuffer(i.UNIFORM_BUFFER,M),i.bufferData(i.UNIFORM_BUFFER,N,w),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,y,M),M}function h(){for(let b=0;b&lt;o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(b){const y=r[b.id],M=b.uniforms,N=b.__cache;i.bindBuffer(i.UNIFORM_BUFFER,y);for(let w=0,R=M.length;w&lt;R;w++){const U=Array.isArray(M[w])?M[w]:[M[w]];for(let E=0,S=U.length;E&lt;S;E++){const A=U[E];if(d(A,w,E,N)===!0){const G=A.__offset,z=Array.isArray(A.value)?A.value:[A.value];let X=0;for(let j=0;j&lt;z.length;j++){const H=z[j],J=_(H);typeof H=="number"||typeof H=="boolean"?(A.__data[0]=H,i.bufferSubData(i.UNIFORM_BUFFER,G+X,A.__data)):H.isMatrix3?(A.__data[0]=H.elements[0],A.__data[1]=H.elements[1],A.__data[2]=H.elements[2],A.__data[3]=0,A.__data[4]=H.elements[3],A.__data[5]=H.elements[4],A.__data[6]=H.elements[5],A.__data[7]=0,A.__data[8]=H.elements[6],A.__data[9]=H.elements[7],A.__data[10]=H.elements[8],A.__data[11]=0):(H.toArray(A.__data,X),X+=J.storage/Float32Array.BYTES_PER_ELEMENT)}i.bufferSubData(i.UNIFORM_BUFFER,G,A.__data)}}}i.bindBuffer(i.UNIFORM_BUFFER,null)}function d(b,y,M,N){const w=b.value,R=y+"_"+M;if(N[R]===void 0)return typeof w=="number"||typeof w=="boolean"?N[R]=w:N[R]=w.clone(),!0;{const U=N[R];if(typeof w=="number"||typeof w=="boolean"){if(U!==w)return N[R]=w,!0}else if(U.equals(w)===!1)return U.copy(w),!0}return!1}function g(b){const y=b.uniforms;let M=0;const N=16;for(let R=0,U=y.length;R&lt;U;R++){const E=Array.isArray(y[R])?y[R]:[y[R]];for(let S=0,A=E.length;S&lt;A;S++){const G=E[S],z=Array.isArray(G.value)?G.value:[G.value];for(let X=0,j=z.length;X&lt;j;X++){const H=z[X],J=_(H),k=M%N,te=k%J.boundary,ce=k+te;M+=te,ce!==0&amp;&amp;N-ce&lt;J.storage&amp;&amp;(M+=N-ce),G.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=M,M+=J.storage}}}const w=M%N;return w&gt;0&amp;&amp;(M+=N-w),b.__size=M,b.__cache={},this}function _(b){const y={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(y.boundary=4,y.storage=4):b.isVector2?(y.boundary=8,y.storage=8):b.isVector3||b.isColor?(y.boundary=16,y.storage=12):b.isVector4?(y.boundary=16,y.storage=16):b.isMatrix3?(y.boundary=48,y.storage=48):b.isMatrix4?(y.boundary=64,y.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),y}function m(b){const y=b.target;y.removeEventListener("dispose",m);const M=a.indexOf(y.__bindingPointIndex);a.splice(M,1),i.deleteBuffer(r[y.id]),delete r[y.id],delete s[y.id]}function p(){for(const b in r)i.deleteBuffer(r[b]);a=[],r={},s={}}return{bind:l,update:c,dispose:p}}class P_{constructor(e={}){const{canvas:t=Du(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext&lt;"u"&amp;&amp;n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=a;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,p=null;const b=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=tt,this.toneMapping=Rn,this.toneMappingExposure=1;const M=this;let N=!1,w=0,R=0,U=null,E=-1,S=null;const A=new ze,G=new ze;let z=null;const X=new be(0);let j=0,H=t.width,J=t.height,k=1,te=null,ce=null;const Me=new ze(0,0,H,J),Pe=new ze(0,0,H,J);let Ve=!1;const W=new Wa;let $=!1,de=!1;const ne=new xe,ye=new xe,Ae=new P,Fe=new ze,Je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Be=!1;function ot(){return U===null?k:1}let I=n;function Ut(x,L){return t.getContext(x,L)}try{const x={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&amp;&amp;t.setAttribute("data-engine",`three.js r${Ua}`),t.addEventListener("webglcontextlost",Z,!1),t.addEventListener("webglcontextrestored",le,!1),t.addEventListener("webglcontextcreationerror",ae,!1),I===null){const L="webgl2";if(I=Ut(L,x),I===null)throw Ut(L)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(x){throw console.error("THREE.WebGLRenderer: "+x.message),x}let He,Ge,Ee,nt,Se,T,v,F,Y,K,q,_e,se,ue,Xe,Q,he,Te,we,fe,We,Ue,Qe,C;function re(){He=new jd(I),He.init(),Ue=new Nm(I,He),Ge=new Wd(I,He,e,Ue),Ee=new Dm(I,He),Ge.reverseDepthBuffer&amp;&amp;f&amp;&amp;Ee.buffers.depth.setReversed(!0),nt=new Qd(I),Se=new _m,T=new Um(I,He,Ee,Se,Ge,Ue,nt),v=new qd(M),F=new Kd(M),Y=new sh(I),Qe=new Hd(I,Y),K=new $d(I,Y,nt,Qe),q=new tp(I,K,Y,nt),we=new ep(I,Ge,T),Q=new Xd(Se),_e=new gm(M,v,F,He,Ge,Qe,Q),se=new Gm(M,Se),ue=new xm,Xe=new bm(He),Te=new Vd(M,v,F,Ee,q,d,l),he=new Pm(M,q,Ge),C=new Wm(I,nt,Ge,Ee),fe=new Gd(I,He,nt),We=new Jd(I,He,nt),nt.programs=_e.programs,M.capabilities=Ge,M.extensions=He,M.properties=Se,M.renderLists=ue,M.shadowMap=he,M.state=Ee,M.info=nt}re();const V=new Vm(M,I);this.xr=V,this.getContext=function(){return I},this.getContextAttributes=function(){return I.getContextAttributes()},this.forceContextLoss=function(){const x=He.get("WEBGL_lose_context");x&amp;&amp;x.loseContext()},this.forceContextRestore=function(){const x=He.get("WEBGL_lose_context");x&amp;&amp;x.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(x){x!==void 0&amp;&amp;(k=x,this.setSize(H,J,!1))},this.getSize=function(x){return x.set(H,J)},this.setSize=function(x,L,O=!0){if(V.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=x,J=L,t.width=Math.floor(x*k),t.height=Math.floor(L*k),O===!0&amp;&amp;(t.style.width=x+"px",t.style.height=L+"px"),this.setViewport(0,0,x,L)},this.getDrawingBufferSize=function(x){return x.set(H*k,J*k).floor()},this.setDrawingBufferSize=function(x,L,O){H=x,J=L,k=O,t.width=Math.floor(x*O),t.height=Math.floor(L*O),this.setViewport(0,0,x,L)},this.getCurrentViewport=function(x){return x.copy(A)},this.getViewport=function(x){return x.copy(Me)},this.setViewport=function(x,L,O,B){x.isVector4?Me.set(x.x,x.y,x.z,x.w):Me.set(x,L,O,B),Ee.viewport(A.copy(Me).multiplyScalar(k).round())},this.getScissor=function(x){return x.copy(Pe)},this.setScissor=function(x,L,O,B){x.isVector4?Pe.set(x.x,x.y,x.z,x.w):Pe.set(x,L,O,B),Ee.scissor(G.copy(Pe).multiplyScalar(k).round())},this.getScissorTest=function(){return Ve},this.setScissorTest=function(x){Ee.setScissorTest(Ve=x)},this.setOpaqueSort=function(x){te=x},this.setTransparentSort=function(x){ce=x},this.getClearColor=function(x){return x.copy(Te.getClearColor())},this.setClearColor=function(){Te.setClearColor.apply(Te,arguments)},this.getClearAlpha=function(){return Te.getClearAlpha()},this.setClearAlpha=function(){Te.setClearAlpha.apply(Te,arguments)},this.clear=function(x=!0,L=!0,O=!0){let B=0;if(x){let D=!1;if(U!==null){const ee=U.texture.format;D=ee===ka||ee===za||ee===Ba}if(D){const ee=U.texture.type,oe=ee===mn||ee===Xn||ee===Yi||ee===Ei||ee===Fa||ee===Oa,pe=Te.getClearColor(),me=Te.getClearAlpha(),Re=pe.r,De=pe.g,ge=pe.b;oe?(g[0]=Re,g[1]=De,g[2]=ge,g[3]=me,I.clearBufferuiv(I.COLOR,0,g)):(_[0]=Re,_[1]=De,_[2]=ge,_[3]=me,I.clearBufferiv(I.COLOR,0,_))}else B|=I.COLOR_BUFFER_BIT}L&amp;&amp;(B|=I.DEPTH_BUFFER_BIT),O&amp;&amp;(B|=I.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),I.clear(B)},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(){t.removeEventListener("webglcontextlost",Z,!1),t.removeEventListener("webglcontextrestored",le,!1),t.removeEventListener("webglcontextcreationerror",ae,!1),ue.dispose(),Xe.dispose(),Se.dispose(),v.dispose(),F.dispose(),q.dispose(),Qe.dispose(),C.dispose(),_e.dispose(),V.dispose(),V.removeEventListener("sessionstart",$a),V.removeEventListener("sessionend",Ja),In.stop()};function Z(x){x.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),N=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),N=!1;const x=nt.autoReset,L=he.enabled,O=he.autoUpdate,B=he.needsUpdate,D=he.type;re(),nt.autoReset=x,he.enabled=L,he.autoUpdate=O,he.needsUpdate=B,he.type=D}function ae(x){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",x.statusMessage)}function Le(x){const L=x.target;L.removeEventListener("dispose",Le),ct(L)}function ct(x){vt(x),Se.remove(x)}function vt(x){const L=Se.get(x).programs;L!==void 0&amp;&amp;(L.forEach(function(O){_e.releaseProgram(O)}),x.isShaderMaterial&amp;&amp;_e.releaseShaderCache(x))}this.renderBufferDirect=function(x,L,O,B,D,ee){L===null&amp;&amp;(L=Je);const oe=D.isMesh&amp;&amp;D.matrixWorld.determinant()&lt;0,pe=Tc(x,L,O,B,D);Ee.setMaterial(B,oe);let me=O.index,Re=1;if(B.wireframe===!0){if(me=K.getWireframeAttribute(O),me===void 0)return;Re=2}const De=O.drawRange,ge=O.attributes.position;let qe=De.start*Re,et=(De.start+De.count)*Re;ee!==null&amp;&amp;(qe=Math.max(qe,ee.start*Re),et=Math.min(et,(ee.start+ee.count)*Re)),me!==null?(qe=Math.max(qe,0),et=Math.min(et,me.count)):ge!=null&amp;&amp;(qe=Math.max(qe,0),et=Math.min(et,ge.count));const it=et-qe;if(it&lt;0||it===1/0)return;Qe.setup(D,B,pe,O,me);let At,Ze=fe;if(me!==null&amp;&amp;(At=Y.get(me),Ze=We,Ze.setIndex(At)),D.isMesh)B.wireframe===!0?(Ee.setLineWidth(B.wireframeLinewidth*ot()),Ze.setMode(I.LINES)):Ze.setMode(I.TRIANGLES);else if(D.isLine){let ve=B.linewidth;ve===void 0&amp;&amp;(ve=1),Ee.setLineWidth(ve*ot()),D.isLineSegments?Ze.setMode(I.LINES):D.isLineLoop?Ze.setMode(I.LINE_LOOP):Ze.setMode(I.LINE_STRIP)}else D.isPoints?Ze.setMode(I.POINTS):D.isSprite&amp;&amp;Ze.setMode(I.TRIANGLES);if(D.isBatchedMesh)if(D._multiDrawInstances!==null)Ze.renderMultiDrawInstances(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount,D._multiDrawInstances);else if(He.get("WEBGL_multi_draw"))Ze.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else{const ve=D._multiDrawStarts,nn=D._multiDrawCounts,Ke=D._multiDrawCount,Vt=me?Y.get(me).bytesPerElement:1,jn=Se.get(B).currentProgram.getUniforms();for(let Pt=0;Pt&lt;Ke;Pt++)jn.setValue(I,"_gl_DrawID",Pt),Ze.render(ve[Pt]/Vt,nn[Pt])}else if(D.isInstancedMesh)Ze.renderInstances(qe,it,D.count);else if(O.isInstancedBufferGeometry){const ve=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,nn=Math.min(O.instanceCount,ve);Ze.renderInstances(qe,it,nn)}else Ze.render(qe,it)};function je(x,L,O){x.transparent===!0&amp;&amp;x.side===hn&amp;&amp;x.forceSinglePass===!1?(x.side=Ct,x.needsUpdate=!0,sr(x,L,O),x.side=Cn,x.needsUpdate=!0,sr(x,L,O),x.side=hn):sr(x,L,O)}this.compile=function(x,L,O=null){O===null&amp;&amp;(O=x),p=Xe.get(O),p.init(L),y.push(p),O.traverseVisible(function(D){D.isLight&amp;&amp;D.layers.test(L.layers)&amp;&amp;(p.pushLight(D),D.castShadow&amp;&amp;p.pushShadow(D))}),x!==O&amp;&amp;x.traverseVisible(function(D){D.isLight&amp;&amp;D.layers.test(L.layers)&amp;&amp;(p.pushLight(D),D.castShadow&amp;&amp;p.pushShadow(D))}),p.setupLights();const B=new Set;return x.traverse(function(D){if(!(D.isMesh||D.isPoints||D.isLine||D.isSprite))return;const ee=D.material;if(ee)if(Array.isArray(ee))for(let oe=0;oe&lt;ee.length;oe++){const pe=ee[oe];je(pe,O,D),B.add(pe)}else je(ee,O,D),B.add(ee)}),y.pop(),p=null,B},this.compileAsync=function(x,L,O=null){const B=this.compile(x,L,O);return new Promise(D=&gt;{function ee(){if(B.forEach(function(oe){Se.get(oe).currentProgram.isReady()&amp;&amp;B.delete(oe)}),B.size===0){D(x);return}setTimeout(ee,10)}He.get("KHR_parallel_shader_compile")!==null?ee():setTimeout(ee,10)})};let kt=null;function tn(x){kt&amp;&amp;kt(x)}function $a(){In.stop()}function Ja(){In.start()}const In=new Ql;In.setAnimationLoop(tn),typeof self&lt;"u"&amp;&amp;In.setContext(self),this.setAnimationLoop=function(x){kt=x,V.setAnimationLoop(x),x===null?In.stop():In.start()},V.addEventListener("sessionstart",$a),V.addEventListener("sessionend",Ja),this.render=function(x,L){if(L!==void 0&amp;&amp;L.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(N===!0)return;if(x.matrixWorldAutoUpdate===!0&amp;&amp;x.updateMatrixWorld(),L.parent===null&amp;&amp;L.matrixWorldAutoUpdate===!0&amp;&amp;L.updateMatrixWorld(),V.enabled===!0&amp;&amp;V.isPresenting===!0&amp;&amp;(V.cameraAutoUpdate===!0&amp;&amp;V.updateCamera(L),L=V.getCamera()),x.isScene===!0&amp;&amp;x.onBeforeRender(M,x,L,U),p=Xe.get(x,y.length),p.init(L),y.push(p),ye.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),W.setFromProjectionMatrix(ye),de=this.localClippingEnabled,$=Q.init(this.clippingPlanes,de),m=ue.get(x,b.length),m.init(),b.push(m),V.enabled===!0&amp;&amp;V.isPresenting===!0){const ee=M.xr.getDepthSensingMesh();ee!==null&amp;&amp;rs(ee,L,-1/0,M.sortObjects)}rs(x,L,0,M.sortObjects),m.finish(),M.sortObjects===!0&amp;&amp;m.sort(te,ce),Be=V.enabled===!1||V.isPresenting===!1||V.hasDepthSensing()===!1,Be&amp;&amp;Te.addToRenderList(m,x),this.info.render.frame++,$===!0&amp;&amp;Q.beginShadows();const O=p.state.shadowsArray;he.render(O,x,L),$===!0&amp;&amp;Q.endShadows(),this.info.autoReset===!0&amp;&amp;this.info.reset();const B=m.opaque,D=m.transmissive;if(p.setupLights(),L.isArrayCamera){const ee=L.cameras;if(D.length&gt;0)for(let oe=0,pe=ee.length;oe&lt;pe;oe++){const me=ee[oe];eo(B,D,x,me)}Be&amp;&amp;Te.render(x);for(let oe=0,pe=ee.length;oe&lt;pe;oe++){const me=ee[oe];Qa(m,x,me,me.viewport)}}else D.length&gt;0&amp;&amp;eo(B,D,x,L),Be&amp;&amp;Te.render(x),Qa(m,x,L);U!==null&amp;&amp;(T.updateMultisampleRenderTarget(U),T.updateRenderTargetMipmap(U)),x.isScene===!0&amp;&amp;x.onAfterRender(M,x,L),Qe.resetDefaultState(),E=-1,S=null,y.pop(),y.length&gt;0?(p=y[y.length-1],$===!0&amp;&amp;Q.setGlobalState(M.clippingPlanes,p.state.camera)):p=null,b.pop(),b.length&gt;0?m=b[b.length-1]:m=null};function rs(x,L,O,B){if(x.visible===!1)return;if(x.layers.test(L.layers)){if(x.isGroup)O=x.renderOrder;else if(x.isLOD)x.autoUpdate===!0&amp;&amp;x.update(L);else if(x.isLight)p.pushLight(x),x.castShadow&amp;&amp;p.pushShadow(x);else if(x.isSprite){if(!x.frustumCulled||W.intersectsSprite(x)){B&amp;&amp;Fe.setFromMatrixPosition(x.matrixWorld).applyMatrix4(ye);const oe=q.update(x),pe=x.material;pe.visible&amp;&amp;m.push(x,oe,pe,O,Fe.z,null)}}else if((x.isMesh||x.isLine||x.isPoints)&amp;&amp;(!x.frustumCulled||W.intersectsObject(x))){const oe=q.update(x),pe=x.material;if(B&amp;&amp;(x.boundingSphere!==void 0?(x.boundingSphere===null&amp;&amp;x.computeBoundingSphere(),Fe.copy(x.boundingSphere.center)):(oe.boundingSphere===null&amp;&amp;oe.computeBoundingSphere(),Fe.copy(oe.boundingSphere.center)),Fe.applyMatrix4(x.matrixWorld).applyMatrix4(ye)),Array.isArray(pe)){const me=oe.groups;for(let Re=0,De=me.length;Re&lt;De;Re++){const ge=me[Re],qe=pe[ge.materialIndex];qe&amp;&amp;qe.visible&amp;&amp;m.push(x,oe,qe,O,Fe.z,ge)}}else pe.visible&amp;&amp;m.push(x,oe,pe,O,Fe.z,null)}}const ee=x.children;for(let oe=0,pe=ee.length;oe&lt;pe;oe++)rs(ee[oe],L,O,B)}function Qa(x,L,O,B){const D=x.opaque,ee=x.transmissive,oe=x.transparent;p.setupLightsView(O),$===!0&amp;&amp;Q.setGlobalState(M.clippingPlanes,O),B&amp;&amp;Ee.viewport(A.copy(B)),D.length&gt;0&amp;&amp;rr(D,L,O),ee.length&gt;0&amp;&amp;rr(ee,L,O),oe.length&gt;0&amp;&amp;rr(oe,L,O),Ee.buffers.depth.setTest(!0),Ee.buffers.depth.setMask(!0),Ee.buffers.color.setMask(!0),Ee.setPolygonOffset(!1)}function eo(x,L,O,B){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[B.id]===void 0&amp;&amp;(p.state.transmissionRenderTarget[B.id]=new qn(1,1,{generateMipmaps:!0,type:He.has("EXT_color_buffer_half_float")||He.has("EXT_color_buffer_float")?tr:mn,minFilter:Wn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ie.workingColorSpace}));const ee=p.state.transmissionRenderTarget[B.id],oe=B.viewport||A;ee.setSize(oe.z,oe.w);const pe=M.getRenderTarget();M.setRenderTarget(ee),M.getClearColor(X),j=M.getClearAlpha(),j&lt;1&amp;&amp;M.setClearColor(16777215,.5),M.clear(),Be&amp;&amp;Te.render(O);const me=M.toneMapping;M.toneMapping=Rn;const Re=B.viewport;if(B.viewport!==void 0&amp;&amp;(B.viewport=void 0),p.setupLightsView(B),$===!0&amp;&amp;Q.setGlobalState(M.clippingPlanes,B),rr(x,O,B),T.updateMultisampleRenderTarget(ee),T.updateRenderTargetMipmap(ee),He.has("WEBGL_multisampled_render_to_texture")===!1){let De=!1;for(let ge=0,qe=L.length;ge&lt;qe;ge++){const et=L[ge],it=et.object,At=et.geometry,Ze=et.material,ve=et.group;if(Ze.side===hn&amp;&amp;it.layers.test(B.layers)){const nn=Ze.side;Ze.side=Ct,Ze.needsUpdate=!0,to(it,O,B,At,Ze,ve),Ze.side=nn,Ze.needsUpdate=!0,De=!0}}De===!0&amp;&amp;(T.updateMultisampleRenderTarget(ee),T.updateRenderTargetMipmap(ee))}M.setRenderTarget(pe),M.setClearColor(X,j),Re!==void 0&amp;&amp;(B.viewport=Re),M.toneMapping=me}function rr(x,L,O){const B=L.isScene===!0?L.overrideMaterial:null;for(let D=0,ee=x.length;D&lt;ee;D++){const oe=x[D],pe=oe.object,me=oe.geometry,Re=B===null?oe.material:B,De=oe.group;pe.layers.test(O.layers)&amp;&amp;to(pe,L,O,me,Re,De)}}function to(x,L,O,B,D,ee){x.onBeforeRender(M,L,O,B,D,ee),x.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,x.matrixWorld),x.normalMatrix.getNormalMatrix(x.modelViewMatrix),D.onBeforeRender(M,L,O,B,x,ee),D.transparent===!0&amp;&amp;D.side===hn&amp;&amp;D.forceSinglePass===!1?(D.side=Ct,D.needsUpdate=!0,M.renderBufferDirect(O,L,B,D,x,ee),D.side=Cn,D.needsUpdate=!0,M.renderBufferDirect(O,L,B,D,x,ee),D.side=hn):M.renderBufferDirect(O,L,B,D,x,ee),x.onAfterRender(M,L,O,B,D,ee)}function sr(x,L,O){L.isScene!==!0&amp;&amp;(L=Je);const B=Se.get(x),D=p.state.lights,ee=p.state.shadowsArray,oe=D.state.version,pe=_e.getParameters(x,D.state,ee,L,O),me=_e.getProgramCacheKey(pe);let Re=B.programs;B.environment=x.isMeshStandardMaterial?L.environment:null,B.fog=L.fog,B.envMap=(x.isMeshStandardMaterial?F:v).get(x.envMap||B.environment),B.envMapRotation=B.environment!==null&amp;&amp;x.envMap===null?L.environmentRotation:x.envMapRotation,Re===void 0&amp;&amp;(x.addEventListener("dispose",Le),Re=new Map,B.programs=Re);let De=Re.get(me);if(De!==void 0){if(B.currentProgram===De&amp;&amp;B.lightsStateVersion===oe)return io(x,pe),De}else pe.uniforms=_e.getUniforms(x),x.onBeforeCompile(pe,M),De=_e.acquireProgram(pe,me),Re.set(me,De),B.uniforms=pe.uniforms;const ge=B.uniforms;return(!x.isShaderMaterial&amp;&amp;!x.isRawShaderMaterial||x.clipping===!0)&amp;&amp;(ge.clippingPlanes=Q.uniform),io(x,pe),B.needsLights=Ac(x),B.lightsStateVersion=oe,B.needsLights&amp;&amp;(ge.ambientLightColor.value=D.state.ambient,ge.lightProbe.value=D.state.probe,ge.directionalLights.value=D.state.directional,ge.directionalLightShadows.value=D.state.directionalShadow,ge.spotLights.value=D.state.spot,ge.spotLightShadows.value=D.state.spotShadow,ge.rectAreaLights.value=D.state.rectArea,ge.ltc_1.value=D.state.rectAreaLTC1,ge.ltc_2.value=D.state.rectAreaLTC2,ge.pointLights.value=D.state.point,ge.pointLightShadows.value=D.state.pointShadow,ge.hemisphereLights.value=D.state.hemi,ge.directionalShadowMap.value=D.state.directionalShadowMap,ge.directionalShadowMatrix.value=D.state.directionalShadowMatrix,ge.spotShadowMap.value=D.state.spotShadowMap,ge.spotLightMatrix.value=D.state.spotLightMatrix,ge.spotLightMap.value=D.state.spotLightMap,ge.pointShadowMap.value=D.state.pointShadowMap,ge.pointShadowMatrix.value=D.state.pointShadowMatrix),B.currentProgram=De,B.uniformsList=null,De}function no(x){if(x.uniformsList===null){const L=x.currentProgram.getUniforms();x.uniformsList=Vr.seqWithValue(L.seq,x.uniforms)}return x.uniformsList}function io(x,L){const O=Se.get(x);O.outputColorSpace=L.outputColorSpace,O.batching=L.batching,O.batchingColor=L.batchingColor,O.instancing=L.instancing,O.instancingColor=L.instancingColor,O.instancingMorph=L.instancingMorph,O.skinning=L.skinning,O.morphTargets=L.morphTargets,O.morphNormals=L.morphNormals,O.morphColors=L.morphColors,O.morphTargetsCount=L.morphTargetsCount,O.numClippingPlanes=L.numClippingPlanes,O.numIntersection=L.numClipIntersection,O.vertexAlphas=L.vertexAlphas,O.vertexTangents=L.vertexTangents,O.toneMapping=L.toneMapping}function Tc(x,L,O,B,D){L.isScene!==!0&amp;&amp;(L=Je),T.resetTextureUnits();const ee=L.fog,oe=B.isMeshStandardMaterial?L.environment:null,pe=U===null?M.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:Ri,me=(B.isMeshStandardMaterial?F:v).get(B.envMap||oe),Re=B.vertexColors===!0&amp;&amp;!!O.attributes.color&amp;&amp;O.attributes.color.itemSize===4,De=!!O.attributes.tangent&amp;&amp;(!!B.normalMap||B.anisotropy&gt;0),ge=!!O.morphAttributes.position,qe=!!O.morphAttributes.normal,et=!!O.morphAttributes.color;let it=Rn;B.toneMapped&amp;&amp;(U===null||U.isXRRenderTarget===!0)&amp;&amp;(it=M.toneMapping);const At=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,Ze=At!==void 0?At.length:0,ve=Se.get(B),nn=p.state.lights;if($===!0&amp;&amp;(de===!0||x!==S)){const Nt=x===S&amp;&amp;B.id===E;Q.setState(B,x,Nt)}let Ke=!1;B.version===ve.__version?(ve.needsLights&amp;&amp;ve.lightsStateVersion!==nn.state.version||ve.outputColorSpace!==pe||D.isBatchedMesh&amp;&amp;ve.batching===!1||!D.isBatchedMesh&amp;&amp;ve.batching===!0||D.isBatchedMesh&amp;&amp;ve.batchingColor===!0&amp;&amp;D.colorTexture===null||D.isBatchedMesh&amp;&amp;ve.batchingColor===!1&amp;&amp;D.colorTexture!==null||D.isInstancedMesh&amp;&amp;ve.instancing===!1||!D.isInstancedMesh&amp;&amp;ve.instancing===!0||D.isSkinnedMesh&amp;&amp;ve.skinning===!1||!D.isSkinnedMesh&amp;&amp;ve.skinning===!0||D.isInstancedMesh&amp;&amp;ve.instancingColor===!0&amp;&amp;D.instanceColor===null||D.isInstancedMesh&amp;&amp;ve.instancingColor===!1&amp;&amp;D.instanceColor!==null||D.isInstancedMesh&amp;&amp;ve.instancingMorph===!0&amp;&amp;D.morphTexture===null||D.isInstancedMesh&amp;&amp;ve.instancingMorph===!1&amp;&amp;D.morphTexture!==null||ve.envMap!==me||B.fog===!0&amp;&amp;ve.fog!==ee||ve.numClippingPlanes!==void 0&amp;&amp;(ve.numClippingPlanes!==Q.numPlanes||ve.numIntersection!==Q.numIntersection)||ve.vertexAlphas!==Re||ve.vertexTangents!==De||ve.morphTargets!==ge||ve.morphNormals!==qe||ve.morphColors!==et||ve.toneMapping!==it||ve.morphTargetsCount!==Ze)&amp;&amp;(Ke=!0):(Ke=!0,ve.__version=B.version);let Vt=ve.currentProgram;Ke===!0&amp;&amp;(Vt=sr(B,L,D));let jn=!1,Pt=!1,Ii=!1;const rt=Vt.getUniforms(),Kt=ve.uniforms;if(Ee.useProgram(Vt.program)&amp;&amp;(jn=!0,Pt=!0,Ii=!0),B.id!==E&amp;&amp;(E=B.id,Pt=!0),jn||S!==x){Ee.buffers.depth.getReversed()?(ne.copy(x.projectionMatrix),Uu(ne),Nu(ne),rt.setValue(I,"projectionMatrix",ne)):rt.setValue(I,"projectionMatrix",x.projectionMatrix),rt.setValue(I,"viewMatrix",x.matrixWorldInverse);const _n=rt.map.cameraPosition;_n!==void 0&amp;&amp;_n.setValue(I,Ae.setFromMatrixPosition(x.matrixWorld)),Ge.logarithmicDepthBuffer&amp;&amp;rt.setValue(I,"logDepthBufFC",2/(Math.log(x.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&amp;&amp;rt.setValue(I,"isOrthographic",x.isOrthographicCamera===!0),S!==x&amp;&amp;(S=x,Pt=!0,Ii=!0)}if(D.isSkinnedMesh){rt.setOptional(I,D,"bindMatrix"),rt.setOptional(I,D,"bindMatrixInverse");const Nt=D.skeleton;Nt&amp;&amp;(Nt.boneTexture===null&amp;&amp;Nt.computeBoneTexture(),rt.setValue(I,"boneTexture",Nt.boneTexture,T))}D.isBatchedMesh&amp;&amp;(rt.setOptional(I,D,"batchingTexture"),rt.setValue(I,"batchingTexture",D._matricesTexture,T),rt.setOptional(I,D,"batchingIdTexture"),rt.setValue(I,"batchingIdTexture",D._indirectTexture,T),rt.setOptional(I,D,"batchingColorTexture"),D._colorsTexture!==null&amp;&amp;rt.setValue(I,"batchingColorTexture",D._colorsTexture,T));const Ui=O.morphAttributes;if((Ui.position!==void 0||Ui.normal!==void 0||Ui.color!==void 0)&amp;&amp;we.update(D,O,Vt),(Pt||ve.receiveShadow!==D.receiveShadow)&amp;&amp;(ve.receiveShadow=D.receiveShadow,rt.setValue(I,"receiveShadow",D.receiveShadow)),B.isMeshGouraudMaterial&amp;&amp;B.envMap!==null&amp;&amp;(Kt.envMap.value=me,Kt.flipEnvMap.value=me.isCubeTexture&amp;&amp;me.isRenderTargetTexture===!1?-1:1),B.isMeshStandardMaterial&amp;&amp;B.envMap===null&amp;&amp;L.environment!==null&amp;&amp;(Kt.envMapIntensity.value=L.environmentIntensity),Pt&amp;&amp;(rt.setValue(I,"toneMappingExposure",M.toneMappingExposure),ve.needsLights&amp;&amp;bc(Kt,Ii),ee&amp;&amp;B.fog===!0&amp;&amp;se.refreshFogUniforms(Kt,ee),se.refreshMaterialUniforms(Kt,B,k,J,p.state.transmissionRenderTarget[x.id]),Vr.upload(I,no(ve),Kt,T)),B.isShaderMaterial&amp;&amp;B.uniformsNeedUpdate===!0&amp;&amp;(Vr.upload(I,no(ve),Kt,T),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&amp;&amp;rt.setValue(I,"center",D.center),rt.setValue(I,"modelViewMatrix",D.modelViewMatrix),rt.setValue(I,"normalMatrix",D.normalMatrix),rt.setValue(I,"modelMatrix",D.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const Nt=B.uniformsGroups;for(let _n=0,vn=Nt.length;_n&lt;vn;_n++){const ro=Nt[_n];C.update(ro,Vt),C.bind(ro,Vt)}}return Vt}function bc(x,L){x.ambientLightColor.needsUpdate=L,x.lightProbe.needsUpdate=L,x.directionalLights.needsUpdate=L,x.directionalLightShadows.needsUpdate=L,x.pointLights.needsUpdate=L,x.pointLightShadows.needsUpdate=L,x.spotLights.needsUpdate=L,x.spotLightShadows.needsUpdate=L,x.rectAreaLights.needsUpdate=L,x.hemisphereLights.needsUpdate=L}function Ac(x){return x.isMeshLambertMaterial||x.isMeshToonMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isShadowMaterial||x.isShaderMaterial&amp;&amp;x.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(x,L,O){Se.get(x.texture).__webglTexture=L,Se.get(x.depthTexture).__webglTexture=O;const B=Se.get(x);B.__hasExternalTextures=!0,B.__autoAllocateDepthBuffer=O===void 0,B.__autoAllocateDepthBuffer||He.has("WEBGL_multisampled_render_to_texture")===!0&amp;&amp;(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),B.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(x,L){const O=Se.get(x);O.__webglFramebuffer=L,O.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(x,L=0,O=0){U=x,w=L,R=O;let B=!0,D=null,ee=!1,oe=!1;if(x){const me=Se.get(x);if(me.__useDefaultFramebuffer!==void 0)Ee.bindFramebuffer(I.FRAMEBUFFER,null),B=!1;else if(me.__webglFramebuffer===void 0)T.setupRenderTarget(x);else if(me.__hasExternalTextures)T.rebindTextures(x,Se.get(x.texture).__webglTexture,Se.get(x.depthTexture).__webglTexture);else if(x.depthBuffer){const ge=x.depthTexture;if(me.__boundDepthTexture!==ge){if(ge!==null&amp;&amp;Se.has(ge)&amp;&amp;(x.width!==ge.image.width||x.height!==ge.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");T.setupDepthRenderbuffer(x)}}const Re=x.texture;(Re.isData3DTexture||Re.isDataArrayTexture||Re.isCompressedArrayTexture)&amp;&amp;(oe=!0);const De=Se.get(x).__webglFramebuffer;x.isWebGLCubeRenderTarget?(Array.isArray(De[L])?D=De[L][O]:D=De[L],ee=!0):x.samples&gt;0&amp;&amp;T.useMultisampledRTT(x)===!1?D=Se.get(x).__webglMultisampledFramebuffer:Array.isArray(De)?D=De[O]:D=De,A.copy(x.viewport),G.copy(x.scissor),z=x.scissorTest}else A.copy(Me).multiplyScalar(k).floor(),G.copy(Pe).multiplyScalar(k).floor(),z=Ve;if(Ee.bindFramebuffer(I.FRAMEBUFFER,D)&amp;&amp;B&amp;&amp;Ee.drawBuffers(x,D),Ee.viewport(A),Ee.scissor(G),Ee.setScissorTest(z),ee){const me=Se.get(x.texture);I.framebufferTexture2D(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,I.TEXTURE_CUBE_MAP_POSITIVE_X+L,me.__webglTexture,O)}else if(oe){const me=Se.get(x.texture),Re=L||0;I.framebufferTextureLayer(I.FRAMEBUFFER,I.COLOR_ATTACHMENT0,me.__webglTexture,O||0,Re)}E=-1},this.readRenderTargetPixels=function(x,L,O,B,D,ee,oe){if(!(x&amp;&amp;x.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pe=Se.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&amp;&amp;oe!==void 0&amp;&amp;(pe=pe[oe]),pe){Ee.bindFramebuffer(I.FRAMEBUFFER,pe);try{const me=x.texture,Re=me.format,De=me.type;if(!Ge.textureFormatReadable(Re)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ge.textureTypeReadable(De)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L&gt;=0&amp;&amp;L&lt;=x.width-B&amp;&amp;O&gt;=0&amp;&amp;O&lt;=x.height-D&amp;&amp;I.readPixels(L,O,B,D,Ue.convert(Re),Ue.convert(De),ee)}finally{const me=U!==null?Se.get(U).__webglFramebuffer:null;Ee.bindFramebuffer(I.FRAMEBUFFER,me)}}},this.readRenderTargetPixelsAsync=async function(x,L,O,B,D,ee,oe){if(!(x&amp;&amp;x.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let pe=Se.get(x).__webglFramebuffer;if(x.isWebGLCubeRenderTarget&amp;&amp;oe!==void 0&amp;&amp;(pe=pe[oe]),pe){const me=x.texture,Re=me.format,De=me.type;if(!Ge.textureFormatReadable(Re))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ge.textureTypeReadable(De))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(L&gt;=0&amp;&amp;L&lt;=x.width-B&amp;&amp;O&gt;=0&amp;&amp;O&lt;=x.height-D){Ee.bindFramebuffer(I.FRAMEBUFFER,pe);const ge=I.createBuffer();I.bindBuffer(I.PIXEL_PACK_BUFFER,ge),I.bufferData(I.PIXEL_PACK_BUFFER,ee.byteLength,I.STREAM_READ),I.readPixels(L,O,B,D,Ue.convert(Re),Ue.convert(De),0);const qe=U!==null?Se.get(U).__webglFramebuffer:null;Ee.bindFramebuffer(I.FRAMEBUFFER,qe);const et=I.fenceSync(I.SYNC_GPU_COMMANDS_COMPLETE,0);return I.flush(),await Iu(I,et,4),I.bindBuffer(I.PIXEL_PACK_BUFFER,ge),I.getBufferSubData(I.PIXEL_PACK_BUFFER,0,ee),I.deleteBuffer(ge),I.deleteSync(et),ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(x,L=null,O=0){x.isTexture!==!0&amp;&amp;(Vi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),L=arguments[0]||null,x=arguments[1]);const B=Math.pow(2,-O),D=Math.floor(x.image.width*B),ee=Math.floor(x.image.height*B),oe=L!==null?L.x:0,pe=L!==null?L.y:0;T.setTexture2D(x,0),I.copyTexSubImage2D(I.TEXTURE_2D,O,0,0,oe,pe,D,ee),Ee.unbindTexture()},this.copyTextureToTexture=function(x,L,O=null,B=null,D=0){x.isTexture!==!0&amp;&amp;(Vi("WebGLRenderer: copyTextureToTexture function signature has changed."),B=arguments[0]||null,x=arguments[1],L=arguments[2],D=arguments[3]||0,O=null);let ee,oe,pe,me,Re,De,ge,qe,et;const it=x.isCompressedTexture?x.mipmaps[D]:x.image;O!==null?(ee=O.max.x-O.min.x,oe=O.max.y-O.min.y,pe=O.isBox3?O.max.z-O.min.z:1,me=O.min.x,Re=O.min.y,De=O.isBox3?O.min.z:0):(ee=it.width,oe=it.height,pe=it.depth||1,me=0,Re=0,De=0),B!==null?(ge=B.x,qe=B.y,et=B.z):(ge=0,qe=0,et=0);const At=Ue.convert(L.format),Ze=Ue.convert(L.type);let ve;L.isData3DTexture?(T.setTexture3D(L,0),ve=I.TEXTURE_3D):L.isDataArrayTexture||L.isCompressedArrayTexture?(T.setTexture2DArray(L,0),ve=I.TEXTURE_2D_ARRAY):(T.setTexture2D(L,0),ve=I.TEXTURE_2D),I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL,L.flipY),I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),I.pixelStorei(I.UNPACK_ALIGNMENT,L.unpackAlignment);const nn=I.getParameter(I.UNPACK_ROW_LENGTH),Ke=I.getParameter(I.UNPACK_IMAGE_HEIGHT),Vt=I.getParameter(I.UNPACK_SKIP_PIXELS),jn=I.getParameter(I.UNPACK_SKIP_ROWS),Pt=I.getParameter(I.UNPACK_SKIP_IMAGES);I.pixelStorei(I.UNPACK_ROW_LENGTH,it.width),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,it.height),I.pixelStorei(I.UNPACK_SKIP_PIXELS,me),I.pixelStorei(I.UNPACK_SKIP_ROWS,Re),I.pixelStorei(I.UNPACK_SKIP_IMAGES,De);const Ii=x.isDataArrayTexture||x.isData3DTexture,rt=L.isDataArrayTexture||L.isData3DTexture;if(x.isRenderTargetTexture||x.isDepthTexture){const Kt=Se.get(x),Ui=Se.get(L),Nt=Se.get(Kt.__renderTarget),_n=Se.get(Ui.__renderTarget);Ee.bindFramebuffer(I.READ_FRAMEBUFFER,Nt.__webglFramebuffer),Ee.bindFramebuffer(I.DRAW_FRAMEBUFFER,_n.__webglFramebuffer);for(let vn=0;vn&lt;pe;vn++)Ii&amp;&amp;I.framebufferTextureLayer(I.READ_FRAMEBUFFER,I.COLOR_ATTACHMENT0,Se.get(x).__webglTexture,D,De+vn),x.isDepthTexture?(rt&amp;&amp;I.framebufferTextureLayer(I.DRAW_FRAMEBUFFER,I.COLOR_ATTACHMENT0,Se.get(L).__webglTexture,D,et+vn),I.blitFramebuffer(me,Re,ee,oe,ge,qe,ee,oe,I.DEPTH_BUFFER_BIT,I.NEAREST)):rt?I.copyTexSubImage3D(ve,D,ge,qe,et+vn,me,Re,ee,oe):I.copyTexSubImage2D(ve,D,ge,qe,et+vn,me,Re,ee,oe);Ee.bindFramebuffer(I.READ_FRAMEBUFFER,null),Ee.bindFramebuffer(I.DRAW_FRAMEBUFFER,null)}else rt?x.isDataTexture||x.isData3DTexture?I.texSubImage3D(ve,D,ge,qe,et,ee,oe,pe,At,Ze,it.data):L.isCompressedArrayTexture?I.compressedTexSubImage3D(ve,D,ge,qe,et,ee,oe,pe,At,it.data):I.texSubImage3D(ve,D,ge,qe,et,ee,oe,pe,At,Ze,it):x.isDataTexture?I.texSubImage2D(I.TEXTURE_2D,D,ge,qe,ee,oe,At,Ze,it.data):x.isCompressedTexture?I.compressedTexSubImage2D(I.TEXTURE_2D,D,ge,qe,it.width,it.height,At,it.data):I.texSubImage2D(I.TEXTURE_2D,D,ge,qe,ee,oe,At,Ze,it);I.pixelStorei(I.UNPACK_ROW_LENGTH,nn),I.pixelStorei(I.UNPACK_IMAGE_HEIGHT,Ke),I.pixelStorei(I.UNPACK_SKIP_PIXELS,Vt),I.pixelStorei(I.UNPACK_SKIP_ROWS,jn),I.pixelStorei(I.UNPACK_SKIP_IMAGES,Pt),D===0&amp;&amp;L.generateMipmaps&amp;&amp;I.generateMipmap(ve),Ee.unbindTexture()},this.copyTextureToTexture3D=function(x,L,O=null,B=null,D=0){return x.isTexture!==!0&amp;&amp;(Vi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),O=arguments[0]||null,B=arguments[1]||null,x=arguments[2],L=arguments[3],D=arguments[4]||0),Vi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(x,L,O,B,D)},this.initRenderTarget=function(x){Se.get(x).__webglFramebuffer===void 0&amp;&amp;T.setupRenderTarget(x)},this.initTexture=function(x){x.isCubeTexture?T.setTextureCube(x,0):x.isData3DTexture?T.setTexture3D(x,0):x.isDataArrayTexture||x.isCompressedArrayTexture?T.setTexture2DArray(x,0):T.setTexture2D(x,0),Ee.unbindTexture()},this.resetState=function(){w=0,R=0,U=null,Ee.reset(),Qe.reset()},typeof __THREE_DEVTOOLS__&lt;"u"&amp;&amp;__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return dn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Ie._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ie._getUnpackColorSpace()}}class L_ extends at{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ft,this.environmentIntensity=1,this.environmentRotation=new ft,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__&lt;"u"&amp;&amp;__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&amp;&amp;(this.background=e.background.clone()),e.environment!==null&amp;&amp;(this.environment=e.environment.clone()),e.fog!==null&amp;&amp;(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&amp;&amp;(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&amp;&amp;(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness&gt;0&amp;&amp;(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&amp;&amp;(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&amp;&amp;(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const cl=new P,ul=new ze,hl=new ze,Xm=new P,fl=new xe,wr=new P,Us=new Kn,dl=new xe,Ns=new Jr;class qm extends Zt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=co,this.bindMatrix=new xe,this.bindMatrixInverse=new xe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&amp;&amp;(this.boundingBox=new Ci),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n&lt;t.count;n++)this.getVertexPosition(n,wr),this.boundingBox.expandByPoint(wr)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&amp;&amp;(this.boundingSphere=new Kn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n&lt;t.count;n++)this.getVertexPosition(n,wr),this.boundingSphere.expandByPoint(wr)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&amp;&amp;(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&amp;&amp;(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,r=this.matrixWorld;n!==void 0&amp;&amp;(this.boundingSphere===null&amp;&amp;this.computeBoundingSphere(),Us.copy(this.boundingSphere),Us.applyMatrix4(r),e.ray.intersectsSphere(Us)!==!1&amp;&amp;(dl.copy(r).invert(),Ns.copy(e.ray).applyMatrix4(dl),!(this.boundingBox!==null&amp;&amp;Ns.intersectsBox(this.boundingBox)===!1)&amp;&amp;this._computeIntersections(e,t,Ns)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&amp;&amp;(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ze,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n&lt;r;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===co?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===iu?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;ul.fromBufferAttribute(r.attributes.skinIndex,e),hl.fromBufferAttribute(r.attributes.skinWeight,e),cl.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s&lt;4;s++){const a=hl.getComponent(s);if(a!==0){const o=ul.getComponent(s);fl.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Xm.copy(cl).applyMatrix4(fl),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Ca extends at{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ym extends _t{constructor(e=null,t=1,n=1,r,s,a,o,l,c=It,u=It,h,f){super(null,a,o,l,c,u,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const pl=new xe,Zm=new xe;class qa{constructor(e=[],t=[]){this.uuid=Dn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n&lt;r;n++)this.boneInverses.push(new xe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e&lt;t;e++){const n=new xe;this.bones[e]&amp;&amp;n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e&lt;t;e++){const n=this.bones[e];n&amp;&amp;n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e&lt;t;e++){const n=this.bones[e];n&amp;&amp;(n.parent&amp;&amp;n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s&lt;a;s++){const o=e[s]?e[s].matrixWorld:Zm;pl.multiplyMatrices(o,t[s]),pl.toArray(n,s*16)}r!==null&amp;&amp;(r.needsUpdate=!0)}clone(){return new qa(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Ym(t,e,e,Bt,Jt);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t&lt;n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&amp;&amp;(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n&lt;r;n++){const s=e.bones[n];let a=t[s];a===void 0&amp;&amp;(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new Ca),this.bones.push(a),this.boneInverses.push(new xe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r&lt;s;r++){const a=t[r];e.bones.push(a.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class ac extends gn{static get type(){return"LineBasicMaterial"}constructor(e){super(),this.isLineBasicMaterial=!0,this.color=new be(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Xr=new P,qr=new P,ml=new xe,zi=new Jr,Rr=new Kn,Fs=new P,gl=new P;class oc extends at{constructor(e=new zt,t=new ac){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r&lt;s;r++)Xr.fromBufferAttribute(t,r-1),qr.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Xr.distanceTo(qr);e.setAttribute("lineDistance",new bt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&amp;&amp;n.computeBoundingSphere(),Rr.copy(n.boundingSphere),Rr.applyMatrix4(r),Rr.radius+=s,e.ray.intersectsSphere(Rr)===!1)return;ml.copy(r).invert(),zi.copy(e.ray).applyMatrix4(ml);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,u=n.index,f=n.attributes.position;if(u!==null){const d=Math.max(0,a.start),g=Math.min(u.count,a.start+a.count);for(let _=d,m=g-1;_&lt;m;_+=c){const p=u.getX(_),b=u.getX(_+1),y=Cr(this,e,zi,l,p,b);y&amp;&amp;t.push(y)}if(this.isLineLoop){const _=u.getX(g-1),m=u.getX(d),p=Cr(this,e,zi,l,_,m);p&amp;&amp;t.push(p)}}else{const d=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let _=d,m=g-1;_&lt;m;_+=c){const p=Cr(this,e,zi,l,_,_+1);p&amp;&amp;t.push(p)}if(this.isLineLoop){const _=Cr(this,e,zi,l,g-1,d);_&amp;&amp;t.push(_)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length&gt;0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s&lt;a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Cr(i,e,t,n,r,s){const a=i.geometry.attributes.position;if(Xr.fromBufferAttribute(a,r),qr.fromBufferAttribute(a,s),t.distanceSqToSegment(Xr,qr,Fs,gl)&gt;n)return;Fs.applyMatrix4(i.matrixWorld);const l=e.ray.origin.distanceTo(Fs);if(!(l&lt;e.near||l&gt;e.far))return{distance:l,point:gl.clone().applyMatrix4(i.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:i}}const _l=new P,vl=new P;class D_ extends oc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r&lt;s;r+=2)_l.fromBufferAttribute(t,r),vl.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+_l.distanceTo(vl);e.setAttribute("lineDistance",new bt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Km extends gn{static get type(){return"PointsMaterial"}constructor(e){super(),this.isPointsMaterial=!0,this.color=new be(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const xl=new xe,Pa=new Jr,Pr=new Kn,Lr=new P;class I_ extends at{constructor(e=new zt,t=new Km){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&amp;&amp;n.computeBoundingSphere(),Pr.copy(n.boundingSphere),Pr.applyMatrix4(r),Pr.radius+=s,e.ray.intersectsSphere(Pr)===!1)return;xl.copy(r).invert(),Pa.copy(e.ray).applyMatrix4(xl);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,h=n.attributes.position;if(c!==null){const f=Math.max(0,a.start),d=Math.min(c.count,a.start+a.count);for(let g=f,_=d;g&lt;_;g++){const m=c.getX(g);Lr.fromBufferAttribute(h,m),Ml(Lr,m,l,r,e,t,this)}}else{const f=Math.max(0,a.start),d=Math.min(h.count,a.start+a.count);for(let g=f,_=d;g&lt;_;g++)Lr.fromBufferAttribute(h,g),Ml(Lr,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length&gt;0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s&lt;a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Ml(i,e,t,n,r,s,a){const o=Pa.distanceSqToPoint(i);if(o&lt;t){const l=new P;Pa.closestPointToPoint(i,l),l.applyMatrix4(n);const c=r.ray.origin.distanceTo(l);if(c&lt;r.near||c&gt;r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class jm{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n&lt;=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n&lt;=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&amp;&amp;this.cacheArcLengths.length===e+1&amp;&amp;!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a&lt;=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,l=s-1,c;for(;o&lt;=l;)if(r=Math.floor(o+(l-o)/2),c=n[r]-a,c&lt;0)o=r+1;else if(c&gt;0)l=r-1;else{l=r;break}if(r=l,n[r]===a)return r/(s-1);const u=n[r],f=n[r+1]-u,d=(a-u)/f;return(r+d)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r&lt;0&amp;&amp;(r=0),s&gt;1&amp;&amp;(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new ke:new P);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new P,r=[],s=[],a=[],o=new P,l=new xe;for(let d=0;d&lt;=e;d++){const g=d/e;r[d]=this.getTangentAt(g,new P)}s[0]=new P,a[0]=new P;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u&lt;=c&amp;&amp;(c=u,n.set(1,0,0)),h&lt;=c&amp;&amp;(c=h,n.set(0,1,0)),f&lt;=c&amp;&amp;n.set(0,0,1),o.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let d=1;d&lt;=e;d++){if(s[d]=s[d-1].clone(),a[d]=a[d-1].clone(),o.crossVectors(r[d-1],r[d]),o.length()&gt;Number.EPSILON){o.normalize();const g=Math.acos(gt(r[d-1].dot(r[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(o,g))}a[d].crossVectors(r[d],s[d])}if(t===!0){let d=Math.acos(gt(s[0].dot(s[e]),-1,1));d/=e,r[0].dot(o.crossVectors(s[0],s[e]))&gt;0&amp;&amp;(d=-d);for(let g=1;g&lt;=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],d*g)),a[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}const $m={triangulate:function(i,e,t=2){const n=e&amp;&amp;e.length,r=n?e[0]*t:i.length;let s=lc(i,0,r,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c,u,h,f,d;if(n&amp;&amp;(s=ng(i,e,s,t)),i.length&gt;80*t){o=c=i[0],l=u=i[1];for(let g=t;g&lt;r;g+=t)h=i[g],f=i[g+1],h&lt;o&amp;&amp;(o=h),f&lt;l&amp;&amp;(l=f),h&gt;c&amp;&amp;(c=h),f&gt;u&amp;&amp;(u=f);d=Math.max(c-o,u-l),d=d!==0?32767/d:0}return Ki(s,a,t,o,l,d,0),a}};function lc(i,e,t,n,r){let s,a;if(r===dg(i,e,t,n)&gt;0)for(s=e;s&lt;t;s+=n)a=yl(s,i[s],i[s+1],a);else for(s=t-n;s&gt;=e;s-=n)a=yl(s,i[s],i[s+1],a);return a&amp;&amp;ts(a,a.next)&amp;&amp;($i(a),a=a.next),a}function Yn(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&amp;&amp;(ts(t,t.next)||lt(t.prev,t,t.next)===0)){if($i(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ki(i,e,t,n,r,s,a){if(!i)return;!a&amp;&amp;s&amp;&amp;og(i,n,r,s);let o=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?Qm(i,n,r,s):Jm(i)){e.push(l.i/t|0),e.push(i.i/t|0),e.push(c.i/t|0),$i(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=eg(Yn(i),e,t),Ki(i,e,t,n,r,s,2)):a===2&amp;&amp;tg(i,e,t,n,r,s):Ki(Yn(i),e,t,n,r,s,1);break}}}function Jm(i){const e=i.prev,t=i,n=i.next;if(lt(e,t,n)&gt;=0)return!1;const r=e.x,s=t.x,a=n.x,o=e.y,l=t.y,c=n.y,u=r&lt;s?r&lt;a?r:a:s&lt;a?s:a,h=o&lt;l?o&lt;c?o:c:l&lt;c?l:c,f=r&gt;s?r&gt;a?r:a:s&gt;a?s:a,d=o&gt;l?o&gt;c?o:c:l&gt;c?l:c;let g=n.next;for(;g!==e;){if(g.x&gt;=u&amp;&amp;g.x&lt;=f&amp;&amp;g.y&gt;=h&amp;&amp;g.y&lt;=d&amp;&amp;mi(r,o,s,l,a,c,g.x,g.y)&amp;&amp;lt(g.prev,g,g.next)&gt;=0)return!1;g=g.next}return!0}function Qm(i,e,t,n){const r=i.prev,s=i,a=i.next;if(lt(r,s,a)&gt;=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,h=s.y,f=a.y,d=o&lt;l?o&lt;c?o:c:l&lt;c?l:c,g=u&lt;h?u&lt;f?u:f:h&lt;f?h:f,_=o&gt;l?o&gt;c?o:c:l&gt;c?l:c,m=u&gt;h?u&gt;f?u:f:h&gt;f?h:f,p=La(d,g,e,t,n),b=La(_,m,e,t,n);let y=i.prevZ,M=i.nextZ;for(;y&amp;&amp;y.z&gt;=p&amp;&amp;M&amp;&amp;M.z&lt;=b;){if(y.x&gt;=d&amp;&amp;y.x&lt;=_&amp;&amp;y.y&gt;=g&amp;&amp;y.y&lt;=m&amp;&amp;y!==r&amp;&amp;y!==a&amp;&amp;mi(o,u,l,h,c,f,y.x,y.y)&amp;&amp;lt(y.prev,y,y.next)&gt;=0||(y=y.prevZ,M.x&gt;=d&amp;&amp;M.x&lt;=_&amp;&amp;M.y&gt;=g&amp;&amp;M.y&lt;=m&amp;&amp;M!==r&amp;&amp;M!==a&amp;&amp;mi(o,u,l,h,c,f,M.x,M.y)&amp;&amp;lt(M.prev,M,M.next)&gt;=0))return!1;M=M.nextZ}for(;y&amp;&amp;y.z&gt;=p;){if(y.x&gt;=d&amp;&amp;y.x&lt;=_&amp;&amp;y.y&gt;=g&amp;&amp;y.y&lt;=m&amp;&amp;y!==r&amp;&amp;y!==a&amp;&amp;mi(o,u,l,h,c,f,y.x,y.y)&amp;&amp;lt(y.prev,y,y.next)&gt;=0)return!1;y=y.prevZ}for(;M&amp;&amp;M.z&lt;=b;){if(M.x&gt;=d&amp;&amp;M.x&lt;=_&amp;&amp;M.y&gt;=g&amp;&amp;M.y&lt;=m&amp;&amp;M!==r&amp;&amp;M!==a&amp;&amp;mi(o,u,l,h,c,f,M.x,M.y)&amp;&amp;lt(M.prev,M,M.next)&gt;=0)return!1;M=M.nextZ}return!0}function eg(i,e,t){let n=i;do{const r=n.prev,s=n.next.next;!ts(r,s)&amp;&amp;cc(r,n,n.next,s)&amp;&amp;ji(r,s)&amp;&amp;ji(s,r)&amp;&amp;(e.push(r.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),$i(n),$i(n.next),n=i=s),n=n.next}while(n!==i);return Yn(n)}function tg(i,e,t,n,r,s){let a=i;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&amp;&amp;ug(a,o)){let l=uc(a,o);a=Yn(a,a.next),l=Yn(l,l.next),Ki(a,e,t,n,r,s,0),Ki(l,e,t,n,r,s,0);return}o=o.next}a=a.next}while(a!==i)}function ng(i,e,t,n){const r=[];let s,a,o,l,c;for(s=0,a=e.length;s&lt;a;s++)o=e[s]*n,l=s&lt;a-1?e[s+1]*n:i.length,c=lc(i,o,l,n,!1),c===c.next&amp;&amp;(c.steiner=!0),r.push(cg(c));for(r.sort(ig),s=0;s&lt;r.length;s++)t=rg(r[s],t);return t}function ig(i,e){return i.x-e.x}function rg(i,e){const t=sg(i,e);if(!t)return e;const n=uc(t,i);return Yn(n,n.next),Yn(t,t.next)}function sg(i,e){let t=e,n=-1/0,r;const s=i.x,a=i.y;do{if(a&lt;=t.y&amp;&amp;a&gt;=t.next.y&amp;&amp;t.next.y!==t.y){const f=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f&lt;=s&amp;&amp;f&gt;n&amp;&amp;(n=f,r=t.x&lt;t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;const o=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s&gt;=t.x&amp;&amp;t.x&gt;=l&amp;&amp;s!==t.x&amp;&amp;mi(a&lt;c?s:n,a,l,c,a&lt;c?n:s,a,t.x,t.y)&amp;&amp;(h=Math.abs(a-t.y)/(s-t.x),ji(t,i)&amp;&amp;(h&lt;u||h===u&amp;&amp;(t.x&gt;r.x||t.x===r.x&amp;&amp;ag(r,t)))&amp;&amp;(r=t,u=h)),t=t.next;while(t!==o);return r}function ag(i,e){return lt(i.prev,i,e.prev)&lt;0&amp;&amp;lt(e.next,i,i.next)&lt;0}function og(i,e,t,n){let r=i;do r.z===0&amp;&amp;(r.z=La(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,lg(r)}function lg(i){let e,t,n,r,s,a,o,l,c=1;do{for(t=i,i=null,s=null,a=0;t;){for(a++,n=t,o=0,e=0;e&lt;c&amp;&amp;(o++,n=n.nextZ,!!n);e++);for(l=c;o&gt;0||l&gt;0&amp;&amp;n;)o!==0&amp;&amp;(l===0||!n||t.z&lt;=n.z)?(r=t,t=t.nextZ,o--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;t=n}s.nextZ=null,c*=2}while(a&gt;1);return i}function La(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i&lt;&lt;8)&amp;16711935,i=(i|i&lt;&lt;4)&amp;252645135,i=(i|i&lt;&lt;2)&amp;858993459,i=(i|i&lt;&lt;1)&amp;1431655765,e=(e|e&lt;&lt;8)&amp;16711935,e=(e|e&lt;&lt;4)&amp;252645135,e=(e|e&lt;&lt;2)&amp;858993459,e=(e|e&lt;&lt;1)&amp;1431655765,i|e&lt;&lt;1}function cg(i){let e=i,t=i;do(e.x&lt;t.x||e.x===t.x&amp;&amp;e.y&lt;t.y)&amp;&amp;(t=e),e=e.next;while(e!==i);return t}function mi(i,e,t,n,r,s,a,o){return(r-a)*(e-o)&gt;=(i-a)*(s-o)&amp;&amp;(i-a)*(n-o)&gt;=(t-a)*(e-o)&amp;&amp;(t-a)*(s-o)&gt;=(r-a)*(n-o)}function ug(i,e){return i.next.i!==e.i&amp;&amp;i.prev.i!==e.i&amp;&amp;!hg(i,e)&amp;&amp;(ji(i,e)&amp;&amp;ji(e,i)&amp;&amp;fg(i,e)&amp;&amp;(lt(i.prev,i,e.prev)||lt(i,e.prev,e))||ts(i,e)&amp;&amp;lt(i.prev,i,i.next)&gt;0&amp;&amp;lt(e.prev,e,e.next)&gt;0)}function lt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ts(i,e){return i.x===e.x&amp;&amp;i.y===e.y}function cc(i,e,t,n){const r=Ir(lt(i,e,t)),s=Ir(lt(i,e,n)),a=Ir(lt(t,n,i)),o=Ir(lt(t,n,e));return!!(r!==s&amp;&amp;a!==o||r===0&amp;&amp;Dr(i,t,e)||s===0&amp;&amp;Dr(i,n,e)||a===0&amp;&amp;Dr(t,i,n)||o===0&amp;&amp;Dr(t,e,n))}function Dr(i,e,t){return e.x&lt;=Math.max(i.x,t.x)&amp;&amp;e.x&gt;=Math.min(i.x,t.x)&amp;&amp;e.y&lt;=Math.max(i.y,t.y)&amp;&amp;e.y&gt;=Math.min(i.y,t.y)}function Ir(i){return i&gt;0?1:i&lt;0?-1:0}function hg(i,e){let t=i;do{if(t.i!==i.i&amp;&amp;t.next.i!==i.i&amp;&amp;t.i!==e.i&amp;&amp;t.next.i!==e.i&amp;&amp;cc(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function ji(i,e){return lt(i.prev,i,i.next)&lt;0?lt(i,e,i.next)&gt;=0&amp;&amp;lt(i,i.prev,e)&gt;=0:lt(i,e,i.prev)&lt;0||lt(i,i.next,e)&lt;0}function fg(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y&gt;s!=t.next.y&gt;s&amp;&amp;t.next.y!==t.y&amp;&amp;r&lt;(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&amp;&amp;(n=!n),t=t.next;while(t!==i);return n}function uc(i,e){const t=new Da(i.i,i.x,i.y),n=new Da(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function yl(i,e,t,n){const r=new Da(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $i(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&amp;&amp;(i.prevZ.nextZ=i.nextZ),i.nextZ&amp;&amp;(i.nextZ.prevZ=i.prevZ)}function Da(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dg(i,e,t,n){let r=0;for(let s=e,a=t-n;s&lt;t;s+=n)r+=(i[a]-i[s])*(i[s+1]+i[a+1]),a=s;return r}class Ya{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s&lt;t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return Ya.area(e)&lt;0}static triangulateShape(e,t){const n=[],r=[],s=[];Sl(e),El(n,e);let a=e.length;t.forEach(Sl);for(let l=0;l&lt;t.length;l++)r.push(a),a+=t[l].length,El(n,t[l]);const o=$m.triangulate(n,r);for(let l=0;l&lt;o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Sl(i){const e=i.length;e&gt;2&amp;&amp;i[e-1].equals(i[0])&amp;&amp;i.pop()}function El(i,e){for(let t=0;t&lt;e.length;t++)i.push(e[t].x),i.push(e[t].y)}class U_ extends gn{static get type(){return"MeshStandardMaterial"}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.color=new be(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=jr,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ft,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(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.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Os extends gn{static get type(){return"MeshPhongMaterial"}constructor(e){super(),this.isMeshPhongMaterial=!0,this.color=new be(16777215),this.specular=new be(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=jr,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ft,this.combine=Zr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(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.envMapRotation.copy(e.envMapRotation),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.flatShading=e.flatShading,this.fog=e.fog,this}}class pg extends gn{static get type(){return"MeshLambertMaterial"}constructor(e){super(),this.isMeshLambertMaterial=!0,this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=jr,this.normalScale=new ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ft,this.combine=Zr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(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.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.envMapRotation.copy(e.envMapRotation),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.flatShading=e.flatShading,this.fog=e.fog,this}}function Ur(i,e,t){return!i||!t&amp;&amp;i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function mg(i){return ArrayBuffer.isView(i)&amp;&amp;!(i instanceof DataView)}function gg(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Tl(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=i[o+l]}return r}function hc(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&amp;&amp;s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&amp;&amp;(e.push(s.time),t.push.apply(t,a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&amp;&amp;(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&amp;&amp;(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}class ns{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],s=t[n-1];n:{e:{let a;t:{i:if(!(e&lt;r)){for(let o=n+2;;){if(r===void 0){if(e&lt;s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=r,r=t[++n],e&lt;r)break e}a=t.length;break t}if(!(e&gt;=s)){const o=t[1];e&lt;o&amp;&amp;(n=2,s=o);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e&gt;=s)break e}a=n,n=0;break t}break n}for(;n&lt;a;){const o=n+a&gt;&gt;&gt;1;e&lt;t[o]?a=o:n=o+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class _g extends ns{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:uo,endingEnd:uo}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,a=e+1,o=r[s],l=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case ho:s=e,o=2*t-n;break;case fo:s=r.length-2,o=t+r[s]-r[s+1];break;default:s=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ho:a=e,l=2*n-t;break;case fo:a=1,l=n+r[1]-r[0];break;default:a=e-1,l=t}const c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,g=(n-t)/(r-t),_=g*g,m=_*g,p=-f*m+2*f*_-f*g,b=(1+f)*m+(-1.5-2*f)*_+(-.5+f)*g+1,y=(-1-d)*m+(1.5+d)*_+.5*g,M=d*m-d*_;for(let N=0;N!==o;++N)s[N]=p*a[u+N]+b*a[c+N]+y*a[l+N]+M*a[h+N];return s}}class vg extends ns{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(n-t)/(r-t),h=1-u;for(let f=0;f!==o;++f)s[f]=a[c+f]*h+a[l+f]*u;return s}}class xg extends ns{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class en{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ur(t,this.TimeBufferType),this.values=Ur(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ur(e.times,Array),values:Ur(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&amp;&amp;(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new xg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new vg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new _g(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Gr:t=this.InterpolantFactoryMethodDiscrete;break;case wa:t=this.InterpolantFactoryMethodLinear;break;case as:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gr;case this.InterpolantFactoryMethodLinear:return wa;case this.InterpolantFactoryMethodSmooth:return as}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,a=r-1;for(;s!==r&amp;&amp;n[s]&lt;e;)++s;for(;a!==-1&amp;&amp;n[a]&gt;t;)--a;if(++a,s!==0||a!==r){s&gt;=a&amp;&amp;(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&amp;&amp;(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,s=n.length;s===0&amp;&amp;(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&amp;&amp;isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&amp;&amp;a&gt;l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&amp;&amp;mg(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===as,s=e.length-1;let a=1;for(let o=1;o&lt;s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&amp;&amp;(o!==1||c!==e[0]))if(r)l=!0;else{const h=o*n,f=h-n,d=h+n;for(let g=0;g!==n;++g){const _=t[h+g];if(_!==t[f+g]||_!==t[d+g]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*n,f=a*n;for(let d=0;d!==n;++d)t[f+d]=t[h+d]}++a}}if(s&gt;0){e[a]=e[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}en.prototype.TimeBufferType=Float32Array;en.prototype.ValueBufferType=Float32Array;en.prototype.DefaultInterpolation=wa;class Li extends en{constructor(e,t,n){super(e,t,n)}}Li.prototype.ValueTypeName="bool";Li.prototype.ValueBufferType=Array;Li.prototype.DefaultInterpolation=Gr;Li.prototype.InterpolantFactoryMethodLinear=void 0;Li.prototype.InterpolantFactoryMethodSmooth=void 0;class fc extends en{}fc.prototype.ValueTypeName="color";class Ji extends en{}Ji.prototype.ValueTypeName="number";class Mg extends ns{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)wt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class wi extends en{InterpolantFactoryMethodLinear(e){return new Mg(this.times,this.values,this.getValueSize(),e)}}wi.prototype.ValueTypeName="quaternion";wi.prototype.InterpolantFactoryMethodSmooth=void 0;class Di extends en{constructor(e,t,n){super(e,t,n)}}Di.prototype.ValueTypeName="string";Di.prototype.ValueBufferType=Array;Di.prototype.DefaultInterpolation=Gr;Di.prototype.InterpolantFactoryMethodLinear=void 0;Di.prototype.InterpolantFactoryMethodSmooth=void 0;class Qi extends en{}Qi.prototype.ValueTypeName="vector";class yg{constructor(e="",t=-1,n=[],r=su){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Dn(),this.duration&lt;0&amp;&amp;this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Eg(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=n.length;s!==a;++s)t.push(en.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let o=0;o&lt;s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=gg(l);l=Tl(l,1,u),c=Tl(c,1,u),!r&amp;&amp;l[0]===0&amp;&amp;(l.push(s),c.push(c[0])),a.push(new Ji(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&amp;&amp;r.geometry.animations||r.animations}for(let r=0;r&lt;n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o&lt;l;o++){const c=e[o],u=c.name.match(s);if(u&amp;&amp;u.length&gt;1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,g,_){if(d.length!==0){const m=[],p=[];hc(d,m,p,g),m.length!==0&amp;&amp;_.push(new h(f,m,p))}},r=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h&lt;c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const d={};let g;for(g=0;g&lt;f.length;g++)if(f[g].morphTargets)for(let _=0;_&lt;f[g].morphTargets.length;_++)d[f[g].morphTargets[_]]=-1;for(const _ in d){const m=[],p=[];for(let b=0;b!==f[g].morphTargets.length;++b){const y=f[g];m.push(y.time),p.push(y.morphTarget===_?1:0)}r.push(new Ji(".morphTargetInfluence["+_+"]",m,p))}l=d.length*a}else{const d=".bones["+t[h].name+"]";n(Qi,d+".position",f,"pos",r),n(wi,d+".quaternion",f,"rot",r),n(Qi,d+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e&lt;this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t&lt;this.tracks.length;t++)e=e&amp;&amp;this.tracks[t].validate();return e}optimize(){for(let e=0;e&lt;this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t&lt;this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Sg(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ji;case"vector":case"vector2":case"vector3":case"vector4":return Qi;case"color":return fc;case"quaternion":return wi;case"bool":case"boolean":return Li;case"string":return Di}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function Eg(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Sg(i.type);if(i.times===void 0){const t=[],n=[];hc(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const Yr={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&amp;&amp;(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class Tg{constructor(e,t,n){const r=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(u){o++,s===!1&amp;&amp;r.onStart!==void 0&amp;&amp;r.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,r.onProgress!==void 0&amp;&amp;r.onProgress(u,a,o),a===o&amp;&amp;(s=!1,r.onLoad!==void 0&amp;&amp;r.onLoad())},this.itemError=function(u){r.onError!==void 0&amp;&amp;r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&amp;&amp;c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h&lt;f;h+=2){const d=c[h],g=c[h+1];if(d.global&amp;&amp;(d.lastIndex=0),d.test(u))return g}return null}}}const bg=new Tg;class Ln{constructor(e){this.manager=e!==void 0?e:bg,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Ln.DEFAULT_MATERIAL_NAME="__DEFAULT";const cn={};class Ag extends Error{constructor(e,t){super(e),this.response=t}}class wg extends Ln{constructor(e){super(e)}load(e,t,n,r){e===void 0&amp;&amp;(e=""),this.path!==void 0&amp;&amp;(e=this.path+e),e=this.manager.resolveURL(e);const s=Yr.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=&gt;{t&amp;&amp;t(s),this.manager.itemEnd(e)},0),s;if(cn[e]!==void 0){cn[e].push({onLoad:t,onProgress:n,onError:r});return}cn[e]=[],cn[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).then(c=&gt;{if(c.status===200||c.status===0){if(c.status===0&amp;&amp;console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream&gt;"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=cn[e],h=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),d=f?parseInt(f):0,g=d!==0;let _=0;const m=new ReadableStream({start(p){b();function b(){h.read().then(({done:y,value:M})=&gt;{if(y)p.close();else{_+=M.byteLength;const N=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:d});for(let w=0,R=u.length;w&lt;R;w++){const U=u[w];U.onProgress&amp;&amp;U.onProgress(N)}p.enqueue(M),b()}},y=&gt;{p.error(y)})}}});return new Response(m)}else throw new Ag(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=&gt;{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=&gt;new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),f=h&amp;&amp;h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(g=&gt;d.decode(g))}}}).then(c=&gt;{Yr.add(e,c);const u=cn[e];delete cn[e];for(let h=0,f=u.length;h&lt;f;h++){const d=u[h];d.onLoad&amp;&amp;d.onLoad(c)}}).catch(c=&gt;{const u=cn[e];if(u===void 0)throw this.manager.itemError(e),c;delete cn[e];for(let h=0,f=u.length;h&lt;f;h++){const d=u[h];d.onError&amp;&amp;d.onError(c)}this.manager.itemError(e)}).finally(()=&gt;{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class dc extends Ln{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&amp;&amp;(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Yr.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&amp;&amp;t(a),s.manager.itemEnd(e)},0),a;const o=Zi("img");function l(){u(),Yr.add(e,this),t&amp;&amp;t(this),s.manager.itemEnd(e)}function c(h){u(),r&amp;&amp;r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&amp;&amp;this.crossOrigin!==void 0&amp;&amp;(o.crossOrigin=this.crossOrigin),s.manager.itemStart(e),o.src=e,o}}class N_ extends Ln{constructor(e){super(e)}load(e,t,n,r){const s=new Ga;s.colorSpace=tt;const a=new dc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(u){s.images[c]=u,o++,o===6&amp;&amp;(s.needsUpdate=!0,t&amp;&amp;t(s))},void 0,r)}for(let c=0;c&lt;e.length;++c)l(c);return s}}class Rg extends Ln{constructor(e){super(e)}load(e,t,n,r){const s=new _t,a=new dc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&amp;&amp;t(s)},n,r),s}}class is extends at{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new be(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&amp;&amp;(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&amp;&amp;(t.object.distance=this.distance),this.angle!==void 0&amp;&amp;(t.object.angle=this.angle),this.decay!==void 0&amp;&amp;(t.object.decay=this.decay),this.penumbra!==void 0&amp;&amp;(t.object.penumbra=this.penumbra),this.shadow!==void 0&amp;&amp;(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&amp;&amp;(t.object.target=this.target.uuid),t}}const Bs=new xe,bl=new P,Al=new P;class Za{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ke(512,512),this.map=null,this.mapPass=null,this.matrix=new xe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Wa,this._frameExtents=new ke(1,1),this._viewportCount=1,this._viewports=[new ze(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;bl.setFromMatrixPosition(e.matrixWorld),t.position.copy(bl),Al.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Al),t.updateMatrixWorld(),Bs.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bs),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Bs)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&amp;&amp;this.map.dispose(),this.mapPass&amp;&amp;this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&amp;&amp;(e.intensity=this.intensity),this.bias!==0&amp;&amp;(e.bias=this.bias),this.normalBias!==0&amp;&amp;(e.normalBias=this.normalBias),this.radius!==1&amp;&amp;(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&amp;&amp;(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Cg extends Za{constructor(){super(new Rt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=bi*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&amp;&amp;(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Pg extends is{constructor(e,t,n=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.distance=n,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Cg}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),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}}const wl=new xe,ki=new P,zs=new P;class Lg extends Za{constructor(){super(new Rt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ke(4,2),this._viewportCount=6,this._viewports=[new ze(2,1,1,1),new ze(0,1,1,1),new ze(3,1,1,1),new ze(1,1,1,1),new ze(3,0,1,1),new ze(1,0,1,1)],this._cubeDirections=[new P(1,0,0),new P(-1,0,0),new P(0,0,1),new P(0,0,-1),new P(0,1,0),new P(0,-1,0)],this._cubeUps=[new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,1,0),new P(0,0,1),new P(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&amp;&amp;(n.far=s,n.updateProjectionMatrix()),ki.setFromMatrixPosition(e.matrixWorld),n.position.copy(ki),zs.copy(n.position),zs.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(zs),n.updateMatrixWorld(),r.makeTranslation(-ki.x,-ki.y,-ki.z),wl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(wl)}}class Rl extends is{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Lg}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Dg extends Za{constructor(){super(new ec(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ig extends is{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(at.DEFAULT_UP),this.updateMatrix(),this.target=new at,this.shadow=new Dg}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Ug extends is{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Ng{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder&lt;"u")return new TextDecoder().decode(e);let t="";for(let n=0,r=e.length;n&lt;r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&amp;&amp;/^\//.test(e)&amp;&amp;(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}const Ka="\\[\\]\\.:\\/",Fg=new RegExp("["+Ka+"]","g"),ja="[^"+Ka+"]",Og="[^"+Ka.replace("\\.","")+"]",Bg=/((?:WC+[\/:])*)/.source.replace("WC",ja),zg=/(WCOD+)?/.source.replace("WCOD",Og),kg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ja),Vg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ja),Hg=new RegExp("^"+Bg+zg+kg+Vg+"$"),Gg=["material","materials","bones","map"];class Wg{constructor(e,t,n){const r=n||Ye.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&amp;&amp;r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Ye{constructor(e,t,n){this.path=t,this.parsedPath=n||Ye.parseTrackName(t),this.node=Ye.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&amp;&amp;e.isAnimationObjectGroup?new Ye.Composite(e,t,n):new Ye(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Fg,"")}static parseTrackName(e){const t=Hg.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&amp;&amp;n.nodeName.lastIndexOf(".");if(r!==void 0&amp;&amp;r!==-1){const s=n.nodeName.substring(r+1);Gg.indexOf(s)!==-1&amp;&amp;(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a&lt;s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=n(o.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Ye.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u&lt;e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[r];if(a===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?o=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&amp;&amp;(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&amp;&amp;(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&amp;&amp;a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ye.Composite=Wg;Ye.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Ye.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Ye.prototype.GetterByBindingType=[Ye.prototype._getValue_direct,Ye.prototype._getValue_array,Ye.prototype._getValue_arrayElement,Ye.prototype._getValue_toArray];Ye.prototype.SetterByBindingTypeAndVersioning=[[Ye.prototype._setValue_direct,Ye.prototype._setValue_direct_setNeedsUpdate,Ye.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ye.prototype._setValue_array,Ye.prototype._setValue_array_setNeedsUpdate,Ye.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ye.prototype._setValue_arrayElement,Ye.prototype._setValue_arrayElement_setNeedsUpdate,Ye.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ye.prototype._setValue_fromArray,Ye.prototype._setValue_fromArray_setNeedsUpdate,Ye.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class F_{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(gt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class O_ extends Zn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}typeof __THREE_DEVTOOLS__&lt;"u"&amp;&amp;__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ua}}));typeof window&lt;"u"&amp;&amp;(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ua);/*!
fflate - fast JavaScript compression/decompression
&lt;https://101arrowz.github.io/fflate&gt;
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
*/var Ot=Uint8Array,gi=Uint16Array,Xg=Int32Array,pc=new Ot([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mc=new Ot([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qg=new Ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gc=function(i,e){for(var t=new gi(31),n=0;n&lt;31;++n)t[n]=e+=1&lt;&lt;i[n-1];for(var r=new Xg(t[30]),n=1;n&lt;30;++n)for(var s=t[n];s&lt;t[n+1];++s)r[s]=s-t[n]&lt;&lt;5|n;return{b:t,r}},_c=gc(pc,2),vc=_c.b,Yg=_c.r;vc[28]=258,Yg[258]=28;var Zg=gc(mc,0),Kg=Zg.b,Ia=new gi(32768);for(var st=0;st&lt;32768;++st){var bn=(st&amp;43690)&gt;&gt;1|(st&amp;21845)&lt;&lt;1;bn=(bn&amp;52428)&gt;&gt;2|(bn&amp;13107)&lt;&lt;2,bn=(bn&amp;61680)&gt;&gt;4|(bn&amp;3855)&lt;&lt;4,Ia[st]=((bn&amp;65280)&gt;&gt;8|(bn&amp;255)&lt;&lt;8)&gt;&gt;1}var Xi=function(i,e,t){for(var n=i.length,r=0,s=new gi(e);r&lt;n;++r)i[r]&amp;&amp;++s[i[r]-1];var a=new gi(e);for(r=1;r&lt;e;++r)a[r]=a[r-1]+s[r-1]&lt;&lt;1;var o;if(t){o=new gi(1&lt;&lt;e);var l=15-e;for(r=0;r&lt;n;++r)if(i[r])for(var c=r&lt;&lt;4|i[r],u=e-i[r],h=a[i[r]-1]++&lt;&lt;u,f=h|(1&lt;&lt;u)-1;h&lt;=f;++h)o[Ia[h]&gt;&gt;l]=c}else for(o=new gi(n),r=0;r&lt;n;++r)i[r]&amp;&amp;(o[r]=Ia[a[i[r]-1]++]&gt;&gt;15-i[r]);return o},ir=new Ot(288);for(var st=0;st&lt;144;++st)ir[st]=8;for(var st=144;st&lt;256;++st)ir[st]=9;for(var st=256;st&lt;280;++st)ir[st]=7;for(var st=280;st&lt;288;++st)ir[st]=8;var xc=new Ot(32);for(var st=0;st&lt;32;++st)xc[st]=5;var jg=Xi(ir,9,1),$g=Xi(xc,5,1),ks=function(i){for(var e=i[0],t=1;t&lt;i.length;++t)i[t]&gt;e&amp;&amp;(e=i[t]);return e},Xt=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]&lt;&lt;8)&gt;&gt;(e&amp;7)&amp;t},Vs=function(i,e){var t=e/8|0;return(i[t]|i[t+1]&lt;&lt;8|i[t+2]&lt;&lt;16)&gt;&gt;(e&amp;7)},Jg=function(i){return(i+7)/8|0},Qg=function(i,e,t){return(t==null||t&gt;i.length)&amp;&amp;(t=i.length),new Ot(i.subarray(e,t))},e_=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],qt=function(i,e,t){var n=new Error(e||e_[i]);if(n.code=i,Error.captureStackTrace&amp;&amp;Error.captureStackTrace(n,qt),!t)throw n;return n},t_=function(i,e,t,n){var r=i.length,s=0;if(!r||e.f&amp;&amp;!e.l)return t||new Ot(0);var a=!t,o=a||e.i!=2,l=e.i;a&amp;&amp;(t=new Ot(r*3));var c=function(Je){var Be=t.length;if(Je&gt;Be){var ot=new Ot(Math.max(Be*2,Je));ot.set(t),t=ot}},u=e.f||0,h=e.p||0,f=e.b||0,d=e.l,g=e.d,_=e.m,m=e.n,p=r*8;do{if(!d){u=Xt(i,h,1);var b=Xt(i,h+1,3);if(h+=3,b)if(b==1)d=jg,g=$g,_=9,m=5;else if(b==2){var w=Xt(i,h,31)+257,R=Xt(i,h+10,15)+4,U=w+Xt(i,h+5,31)+1;h+=14;for(var E=new Ot(U),S=new Ot(19),A=0;A&lt;R;++A)S[qg[A]]=Xt(i,h+A*3,7);h+=R*3;for(var G=ks(S),z=(1&lt;&lt;G)-1,X=Xi(S,G,1),A=0;A&lt;U;){var j=X[Xt(i,h,z)];h+=j&amp;15;var y=j&gt;&gt;4;if(y&lt;16)E[A++]=y;else{var H=0,J=0;for(y==16?(J=3+Xt(i,h,3),h+=2,H=E[A-1]):y==17?(J=3+Xt(i,h,7),h+=3):y==18&amp;&amp;(J=11+Xt(i,h,127),h+=7);J--;)E[A++]=H}}var k=E.subarray(0,w),te=E.subarray(w);_=ks(k),m=ks(te),d=Xi(k,_,1),g=Xi(te,m,1)}else qt(1);else{var y=Jg(h)+4,M=i[y-4]|i[y-3]&lt;&lt;8,N=y+M;if(N&gt;r){l&amp;&amp;qt(0);break}o&amp;&amp;c(f+M),t.set(i.subarray(y,N),f),e.b=f+=M,e.p=h=N*8,e.f=u;continue}if(h&gt;p){l&amp;&amp;qt(0);break}}o&amp;&amp;c(f+131072);for(var ce=(1&lt;&lt;_)-1,Me=(1&lt;&lt;m)-1,Pe=h;;Pe=h){var H=d[Vs(i,h)&amp;ce],Ve=H&gt;&gt;4;if(h+=H&amp;15,h&gt;p){l&amp;&amp;qt(0);break}if(H||qt(2),Ve&lt;256)t[f++]=Ve;else if(Ve==256){Pe=h,d=null;break}else{var W=Ve-254;if(Ve&gt;264){var A=Ve-257,$=pc[A];W=Xt(i,h,(1&lt;&lt;$)-1)+vc[A],h+=$}var de=g[Vs(i,h)&amp;Me],ne=de&gt;&gt;4;de||qt(3),h+=de&amp;15;var te=Kg[ne];if(ne&gt;3){var $=mc[ne];te+=Vs(i,h)&amp;(1&lt;&lt;$)-1,h+=$}if(h&gt;p){l&amp;&amp;qt(0);break}o&amp;&amp;c(f+131072);var ye=f+W;if(f&lt;te){var Ae=s-te,Fe=Math.min(te,ye);for(Ae+f&lt;0&amp;&amp;qt(3);f&lt;Fe;++f)t[f]=n[Ae+f]}for(;f&lt;ye;++f)t[f]=t[f-te]}}e.l=d,e.p=Pe,e.b=f,e.f=u,d&amp;&amp;(u=1,e.m=_,e.d=g,e.n=m)}while(!u);return f!=t.length&amp;&amp;a?Qg(t,0,f):t.subarray(0,f)},n_=new Ot(0),i_=function(i,e){return((i[0]&amp;15)!=8||i[0]&gt;&gt;4&gt;7||(i[0]&lt;&lt;8|i[1])%31)&amp;&amp;qt(6,"invalid zlib data"),(i[1]&gt;&gt;5&amp;1)==1&amp;&amp;qt(6,"invalid zlib data: "+(i[1]&amp;32?"need":"unexpected")+" dictionary"),(i[1]&gt;&gt;3&amp;4)+2};function r_(i,e){return t_(i.subarray(i_(i),-4),{i:2},e,e)}var s_=typeof TextDecoder&lt;"u"&amp;&amp;new TextDecoder,a_=0;try{s_.decode(n_,{stream:!0}),a_=1}catch{}function Mc(i,e,t){const n=t.length-i-1;if(e&gt;=t[n])return n-1;if(e&lt;=t[i])return i;let r=i,s=n,a=Math.floor((r+s)/2);for(;e&lt;t[a]||e&gt;=t[a+1];)e&lt;t[a]?s=a:r=a,a=Math.floor((r+s)/2);return a}function o_(i,e,t,n){const r=[],s=[],a=[];r[0]=1;for(let o=1;o&lt;=t;++o){s[o]=e-n[i+1-o],a[o]=n[i+o]-e;let l=0;for(let c=0;c&lt;o;++c){const u=a[c+1],h=s[o-c],f=r[c]/(u+h);r[c]=l+u*f,l=h*f}r[o]=l}return r}function l_(i,e,t,n){const r=Mc(i,n,e),s=o_(r,n,i,e),a=new ze(0,0,0,0);for(let o=0;o&lt;=i;++o){const l=t[r-i+o],c=s[o],u=l.w*c;a.x+=l.x*u,a.y+=l.y*u,a.z+=l.z*u,a.w+=l.w*c}return a}function c_(i,e,t,n,r){const s=[];for(let h=0;h&lt;=t;++h)s[h]=0;const a=[];for(let h=0;h&lt;=n;++h)a[h]=s.slice(0);const o=[];for(let h=0;h&lt;=t;++h)o[h]=s.slice(0);o[0][0]=1;const l=s.slice(0),c=s.slice(0);for(let h=1;h&lt;=t;++h){l[h]=e-r[i+1-h],c[h]=r[i+h]-e;let f=0;for(let d=0;d&lt;h;++d){const g=c[d+1],_=l[h-d];o[h][d]=g+_;const m=o[d][h-1]/o[h][d];o[d][h]=f+g*m,f=_*m}o[h][h]=f}for(let h=0;h&lt;=t;++h)a[0][h]=o[h][t];for(let h=0;h&lt;=t;++h){let f=0,d=1;const g=[];for(let _=0;_&lt;=t;++_)g[_]=s.slice(0);g[0][0]=1;for(let _=1;_&lt;=n;++_){let m=0;const p=h-_,b=t-_;h&gt;=_&amp;&amp;(g[d][0]=g[f][0]/o[b+1][p],m=g[d][0]*o[p][b]);const y=p&gt;=-1?1:-p,M=h-1&lt;=b?_-1:t-h;for(let w=y;w&lt;=M;++w)g[d][w]=(g[f][w]-g[f][w-1])/o[b+1][p+w],m+=g[d][w]*o[p+w][b];h&lt;=b&amp;&amp;(g[d][_]=-g[f][_-1]/o[b+1][h],m+=g[d][_]*o[h][b]),a[_][h]=m;const N=f;f=d,d=N}}let u=t;for(let h=1;h&lt;=n;++h){for(let f=0;f&lt;=t;++f)a[h][f]*=u;u*=t-h}return a}function u_(i,e,t,n,r){const s=r&lt;i?r:i,a=[],o=Mc(i,n,e),l=c_(o,n,i,s,e),c=[];for(let u=0;u&lt;t.length;++u){const h=t[u].clone(),f=h.w;h.x*=f,h.y*=f,h.z*=f,c[u]=h}for(let u=0;u&lt;=s;++u){const h=c[o-i].clone().multiplyScalar(l[u][0]);for(let f=1;f&lt;=i;++f)h.add(c[o-i+f].clone().multiplyScalar(l[u][f]));a[u]=h}for(let u=s+1;u&lt;=r+1;++u)a[u]=new ze(0,0,0);return a}function h_(i,e){let t=1;for(let r=2;r&lt;=i;++r)t*=r;let n=1;for(let r=2;r&lt;=e;++r)n*=r;for(let r=2;r&lt;=i-e;++r)n*=r;return t/n}function f_(i){const e=i.length,t=[],n=[];for(let s=0;s&lt;e;++s){const a=i[s];t[s]=new P(a.x,a.y,a.z),n[s]=a.w}const r=[];for(let s=0;s&lt;e;++s){const a=t[s].clone();for(let o=1;o&lt;=s;++o)a.sub(r[s-o].clone().multiplyScalar(h_(s,o)*n[o]));r[s]=a.divideScalar(n[0])}return r}function d_(i,e,t,n,r){const s=u_(i,e,t,n,r);return f_(s)}class p_ extends jm{constructor(e,t,n,r,s){super();const a=t?t.length-1:0,o=n?n.length:0;this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||a;for(let l=0;l&lt;o;++l){const c=n[l];this.controlPoints[l]=new ze(c.x,c.y,c.z,c.w)}}getPoint(e,t=new P){const n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=l_(this.degree,this.knots,this.controlPoints,r);return s.w!==1&amp;&amp;s.divideScalar(s.w),n.set(s.x,s.y,s.z)}getTangent(e,t=new P){const n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=d_(this.degree,this.knots,this.controlPoints,r,1);return n.copy(s[1]).normalize(),n}toJSON(){const e=super.toJSON();return e.degree=this.degree,e.knots=[...this.knots],e.controlPoints=this.controlPoints.map(t=&gt;t.toArray()),e.startKnot=this.startKnot,e.endKnot=this.endKnot,e}fromJSON(e){return super.fromJSON(e),this.degree=e.degree,this.knots=[...e.knots],this.controlPoints=e.controlPoints.map(t=&gt;new ze(t[0],t[1],t[2],t[3])),this.startKnot=e.startKnot,this.endKnot=e.endKnot,this}}let Oe,ut,Et;class B_ extends Ln{constructor(e){super(e)}load(e,t,n,r){const s=this,a=s.path===""?Ng.extractUrlBase(e):s.path,o=new wg(this.manager);o.setPath(s.path),o.setResponseType("arraybuffer"),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(l,a))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},n,r)}parse(e,t){if(M_(e))Oe=new x_().parse(e);else{const r=Ec(e);if(!y_(r))throw new Error("THREE.FBXLoader: Unknown format.");if(Pl(r)&lt;7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Pl(r));Oe=new v_().parse(r)}const n=new Rg(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new m_(n,this.manager).parse(Oe)}}class m_{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){ut=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),s=new g_().parse(r);return this.parseScene(r,s,n),Et}parseConnections(){const e=new Map;return"Connections"in Oe&amp;&amp;Oe.Connections.connections.forEach(function(n){const r=n[0],s=n[1],a=n[2];e.has(r)||e.set(r,{parents:[],children:[]});const o={ID:s,relationship:a};e.get(r).parents.push(o),e.has(s)||e.set(s,{parents:[],children:[]});const l={ID:r,relationship:a};e.get(s).children.push(l)}),e}parseImages(){const e={},t={};if("Video"in Oe.Objects){const n=Oe.Objects.Video;for(const r in n){const s=n[r],a=parseInt(r);if(e[a]=s.RelativeFilename||s.Filename,"Content"in s){const o=s.Content instanceof ArrayBuffer&amp;&amp;s.Content.byteLength&gt;0,l=typeof s.Content=="string"&amp;&amp;s.Content!=="";if(o||l){const c=this.parseImage(n[r]);t[s.RelativeFilename||s.Filename]=c}}}}for(const n in e){const r=e[n];t[r]!==void 0?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&amp;&amp;console.warn("FBXLoader: TGA loader not found, skipping ",n),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in Oe.Objects){const n=Oe.Objects.Texture;for(const r in n){const s=this.parseTexture(n[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,a=r!==void 0?r.value:0,o=s!==void 0?s.value:0;if(n.wrapS=a===0?qi:fn,n.wrapT=o===0?qi:fn,"Scaling"in e){const l=e.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;n.offset.x=l[0],n.offset.y=l[1]}return n}loadTexture(e,t){const n=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),r=e.FileName.split(".").pop().toLowerCase(),s=n.has(r)?this.manager.getHandler(`.${r}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${r.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new _t;const a=s.path;a||s.setPath(this.textureLoader.path);const o=ut.get(e.id).children;let l;o!==void 0&amp;&amp;o.length&gt;0&amp;&amp;t[o[0].ID]!==void 0&amp;&amp;(l=t[o[0].ID],(l.indexOf("blob:")===0||l.indexOf("data:")===0)&amp;&amp;s.setPath(void 0));const c=s.load(l);return s.setPath(a),c}parseMaterials(e){const t=new Map;if("Material"in Oe.Objects){const n=Oe.Objects.Material;for(const r in n){const s=this.parseMaterial(n[r],e);s!==null&amp;&amp;t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&amp;&amp;(s=s.value),!ut.has(n))return null;const a=this.parseParameters(e,t,n);let o;switch(s.toLowerCase()){case"phong":o=new Os;break;case"lambert":o=new pg;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),o=new Os;break}return o.setValues(a),o.name=r,o}parseParameters(e,t,n){const r={};e.BumpFactor&amp;&amp;(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=Ie.toWorkingColorSpace(new be().fromArray(e.Diffuse.value),tt):e.DiffuseColor&amp;&amp;(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&amp;&amp;(r.color=Ie.toWorkingColorSpace(new be().fromArray(e.DiffuseColor.value),tt)),e.DisplacementFactor&amp;&amp;(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=Ie.toWorkingColorSpace(new be().fromArray(e.Emissive.value),tt):e.EmissiveColor&amp;&amp;(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&amp;&amp;(r.emissive=Ie.toWorkingColorSpace(new be().fromArray(e.EmissiveColor.value),tt)),e.EmissiveFactor&amp;&amp;(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),r.opacity=1-(e.TransparencyFactor?parseFloat(e.TransparencyFactor.value):0),(r.opacity===1||r.opacity===0)&amp;&amp;(r.opacity=e.Opacity?parseFloat(e.Opacity.value):null,r.opacity===null&amp;&amp;(r.opacity=1-(e.TransparentColor?parseFloat(e.TransparentColor.value[0]):0))),r.opacity&lt;1&amp;&amp;(r.transparent=!0),e.ReflectionFactor&amp;&amp;(r.reflectivity=e.ReflectionFactor.value),e.Shininess&amp;&amp;(r.shininess=e.Shininess.value),e.Specular?r.specular=Ie.toWorkingColorSpace(new be().fromArray(e.Specular.value),tt):e.SpecularColor&amp;&amp;e.SpecularColor.type==="Color"&amp;&amp;(r.specular=Ie.toWorkingColorSpace(new be().fromArray(e.SpecularColor.value),tt));const s=this;return ut.get(n).children.forEach(function(a){const o=a.relationship;switch(o){case"Bump":r.bumpMap=s.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,a.ID),r.map!==void 0&amp;&amp;(r.map.colorSpace=tt);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,a.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,a.ID),r.emissiveMap!==void 0&amp;&amp;(r.emissiveMap.colorSpace=tt);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,a.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,a.ID),r.envMap!==void 0&amp;&amp;(r.envMap.mapping=Hr,r.envMap.colorSpace=tt);break;case"SpecularColor":r.specularMap=s.getTexture(t,a.ID),r.specularMap!==void 0&amp;&amp;(r.specularMap.colorSpace=tt);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,a.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",o);break}}),r}getTexture(e,t){return"LayeredTexture"in Oe.Objects&amp;&amp;t in Oe.Objects.LayeredTexture&amp;&amp;(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ut.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Oe.Objects){const n=Oe.Objects.Deformer;for(const r in n){const s=n[r],a=ut.get(parseInt(r));if(s.attrType==="Skin"){const o=this.parseSkeleton(a,n);o.ID=r,a.parents.length&gt;1&amp;&amp;console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[r]=o}else if(s.attrType==="BlendShape"){const o={id:r};o.rawTargets=this.parseMorphTargets(a,n),o.id=r,a.parents.length&gt;1&amp;&amp;console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=o}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const a={ID:r.ID,indices:[],weights:[],transformLink:new xe().fromArray(s.TransformLink.a)};"Indexes"in s&amp;&amp;(a.indices=s.Indexes.a,a.weights=s.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r&lt;e.children.length;r++){const s=e.children[r],a=t[s.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;o.geoID=ut.get(parseInt(s.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,n.push(o)}return n}parseScene(e,t,n){Et=new pi;const r=this.parseModels(e.skeletons,t,n),s=Oe.Objects.Model,a=this;r.forEach(function(l){const c=s[l.ID];a.setLookAtProperties(l,c),ut.get(l.ID).parents.forEach(function(h){const f=r.get(h.ID);f!==void 0&amp;&amp;f.add(l)}),l.parent===null&amp;&amp;Et.add(l)}),this.bindSkeleton(e.skeletons,t,r),this.addGlobalSceneSettings(),Et.traverse(function(l){if(l.userData.transformData){l.parent&amp;&amp;(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const c=Sc(l.userData.transformData);l.applyMatrix4(c),l.updateWorldMatrix()}});const o=new __().parse();Et.children.length===1&amp;&amp;Et.children[0].isGroup&amp;&amp;(Et.children[0].animations=o,Et=Et.children[0]),Et.animations=o}parseModels(e,t,n){const r=new Map,s=Oe.Objects.Model;for(const a in s){const o=parseInt(a),l=s[a],c=ut.get(o);let u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,n);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new Ca;break;case"Null":default:u=new pi;break}u.name=l.attrName?Ye.sanitizeNodeName(l.attrName):"",u.userData.originalName=l.attrName,u.ID=o}this.getTransformData(u,l),r.set(o,u)}return r}buildSkeleton(e,t,n,r){let s=null;return e.parents.forEach(function(a){for(const o in t){const l=t[o];l.rawBones.forEach(function(c,u){if(c.ID===a.ID){const h=s;s=new Ca,s.matrixWorld.copy(c.transformLink),s.name=r?Ye.sanitizeNodeName(r):"",s.userData.originalName=r,s.ID=n,l.bones[u]=s,h!==null&amp;&amp;s.add(h)}})}}),s}createCamera(e){let t,n;if(e.children.forEach(function(r){const s=Oe.Objects.NodeAttribute[r.ID];s!==void 0&amp;&amp;(n=s)}),n===void 0)t=new at;else{let r=0;n.CameraProjectionType!==void 0&amp;&amp;n.CameraProjectionType.value===1&amp;&amp;(r=1);let s=1;n.NearPlane!==void 0&amp;&amp;(s=n.NearPlane.value/1e3);let a=1e3;n.FarPlane!==void 0&amp;&amp;(a=n.FarPlane.value/1e3);let o=window.innerWidth,l=window.innerHeight;n.AspectWidth!==void 0&amp;&amp;n.AspectHeight!==void 0&amp;&amp;(o=n.AspectWidth.value,l=n.AspectHeight.value);const c=o/l;let u=45;n.FieldOfView!==void 0&amp;&amp;(u=n.FieldOfView.value);const h=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:t=new Rt(u,c,s,a),h!==null&amp;&amp;t.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new at;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new at;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(r){const s=Oe.Objects.NodeAttribute[r.ID];s!==void 0&amp;&amp;(n=s)}),n===void 0)t=new at;else{let r;n.LightType===void 0?r=0:r=n.LightType.value;let s=16777215;n.Color!==void 0&amp;&amp;(s=Ie.toWorkingColorSpace(new be().fromArray(n.Color.value),tt));let a=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&amp;&amp;n.CastLightOnObject.value===0&amp;&amp;(a=0);let o=0;n.FarAttenuationEnd!==void 0&amp;&amp;(n.EnableFarAttenuation!==void 0&amp;&amp;n.EnableFarAttenuation.value===0?o=0:o=n.FarAttenuationEnd.value);const l=1;switch(r){case 0:t=new Rl(s,a,o,l);break;case 1:t=new Ig(s,a);break;case 2:let c=Math.PI/3;n.InnerAngle!==void 0&amp;&amp;(c=Tt.degToRad(n.InnerAngle.value));let u=0;n.OuterAngle!==void 0&amp;&amp;(u=Tt.degToRad(n.OuterAngle.value),u=Math.max(u,1)),t=new Pg(s,a,o,c,u,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new Rl(s,a);break}n.CastShadows!==void 0&amp;&amp;n.CastShadows.value===1&amp;&amp;(t.castShadow=!0)}return t}createMesh(e,t,n){let r,s=null,a=null;const o=[];return e.children.forEach(function(l){t.has(l.ID)&amp;&amp;(s=t.get(l.ID)),n.has(l.ID)&amp;&amp;o.push(n.get(l.ID))}),o.length&gt;1?a=o:o.length&gt;0?a=o[0]:(a=new Os({name:Ln.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in s.attributes&amp;&amp;o.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(r=new qm(s,a),r.normalizeSkinWeights()):r=new Zt(s,a),r}createCurve(e,t){const n=e.children.reduce(function(s,a){return t.has(a.ID)&amp;&amp;(s=t.get(a.ID)),s},null),r=new ac({name:Ln.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new oc(n,r)}getTransformData(e,t){const n={};"InheritType"in t&amp;&amp;(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=er(t.RotationOrder.value):n.eulerOrder=er(0),"Lcl_Translation"in t&amp;&amp;(n.translation=t.Lcl_Translation.value),"PreRotation"in t&amp;&amp;(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&amp;&amp;(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&amp;&amp;(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&amp;&amp;(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&amp;&amp;(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&amp;&amp;(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&amp;&amp;(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&amp;&amp;(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&amp;&amp;ut.get(e.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const s=Oe.Objects.Model[r.ID];if("Lcl_Translation"in s){const a=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(a),Et.add(e.target)):e.lookAt(new P().fromArray(a))}}})}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const s in e){const a=e[s];ut.get(parseInt(a.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;ut.get(c).parents.forEach(function(h){n.has(h.ID)&amp;&amp;n.get(h.ID).bind(new qa(a.bones),r[h.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Oe.Objects){const t=Oe.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&amp;&amp;t[n].NbPoseNodes&gt;0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new xe().fromArray(s.Matrix.a)}):e[r.Node]=new xe().fromArray(r.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in Oe){if("AmbientColor"in Oe.GlobalSettings){const e=Oe.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(t!==0||n!==0||r!==0){const s=new be().setRGB(t,n,r,tt);Et.add(new Ug(s,1))}}"UnitScaleFactor"in Oe.GlobalSettings&amp;&amp;(Et.userData.unitScaleFactor=Oe.GlobalSettings.UnitScaleFactor.value)}}}class g_{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Oe.Objects){const n=Oe.Objects.Geometry;for(const r in n){const s=ut.get(parseInt(r)),a=this.parseGeometry(s,n[r],e);t.set(parseInt(r),a)}}return this.negativeMaterialIndices===!0&amp;&amp;console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,s=[],a=e.parents.map(function(h){return Oe.Objects.Model[h.ID]});if(a.length===0)return;const o=e.children.reduce(function(h,f){return r[f.ID]!==void 0&amp;&amp;(h=r[f.ID]),h},null);e.children.forEach(function(h){n.morphTargets[h.ID]!==void 0&amp;&amp;s.push(n.morphTargets[h.ID])});const l=a[0],c={};"RotationOrder"in l&amp;&amp;(c.eulerOrder=er(l.RotationOrder.value)),"InheritType"in l&amp;&amp;(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&amp;&amp;(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&amp;&amp;(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&amp;&amp;(c.scale=l.GeometricScaling.value);const u=Sc(c);return this.genGeometry(t,o,s,u)}genGeometry(e,t,n,r){const s=new zt;e.attrName&amp;&amp;(s.name=e.attrName);const a=this.parseGeoNode(e,t),o=this.genBuffers(a),l=new bt(o.vertex,3);if(l.applyMatrix4(r),s.setAttribute("position",l),o.colors.length&gt;0&amp;&amp;s.setAttribute("color",new bt(o.colors,3)),t&amp;&amp;(s.setAttribute("skinIndex",new Ha(o.weightsIndices,4)),s.setAttribute("skinWeight",new bt(o.vertexWeights,4)),s.FBX_Deformer=t),o.normal.length&gt;0){const c=new Ce().getNormalMatrix(r),u=new bt(o.normal,3);u.applyNormalMatrix(c),s.setAttribute("normal",u)}if(o.uvs.forEach(function(c,u){const h=u===0?"uv":`uv${u}`;s.setAttribute(h,new bt(o.uvs[u],2))}),a.material&amp;&amp;a.material.mappingType!=="AllSame"){let c=o.materialIndex[0],u=0;if(o.materialIndex.forEach(function(h,f){h!==c&amp;&amp;(s.addGroup(u,f-u,c),c=h,u=f)}),s.groups.length&gt;0){const h=s.groups[s.groups.length-1],f=h.start+h.count;f!==o.materialIndex.length&amp;&amp;s.addGroup(f,o.materialIndex.length-f,c)}s.groups.length===0&amp;&amp;s.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(s,e,n,r),s}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&amp;&amp;(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&amp;&amp;(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&amp;&amp;(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&amp;&amp;n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},t!==null&amp;&amp;(n.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(a,o){n.weightTable[a]===void 0&amp;&amp;(n.weightTable[a]=[]),n.weightTable[a].push({id:s,weight:r.weights[o]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,s=!1,a=[],o=[],l=[],c=[],u=[],h=[];const f=this;return e.vertexIndices.forEach(function(d,g){let _,m=!1;d&lt;0&amp;&amp;(d=d^-1,m=!0);let p=[],b=[];if(a.push(d*3,d*3+1,d*3+2),e.color){const y=Nr(g,n,d,e.color);l.push(y[0],y[1],y[2])}if(e.skeleton){if(e.weightTable[d]!==void 0&amp;&amp;e.weightTable[d].forEach(function(y){b.push(y.weight),p.push(y.id)}),b.length&gt;4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const y=[0,0,0,0],M=[0,0,0,0];b.forEach(function(N,w){let R=N,U=p[w];M.forEach(function(E,S,A){if(R&gt;E){A[S]=R,R=E;const G=y[S];y[S]=U,U=G}})}),p=y,b=M}for(;b.length&lt;4;)b.push(0),p.push(0);for(let y=0;y&lt;4;++y)u.push(b[y]),h.push(p[y])}if(e.normal){const y=Nr(g,n,d,e.normal);o.push(y[0],y[1],y[2])}e.material&amp;&amp;e.material.mappingType!=="AllSame"&amp;&amp;(_=Nr(g,n,d,e.material)[0],_&lt;0&amp;&amp;(f.negativeMaterialIndices=!0,_=0)),e.uv&amp;&amp;e.uv.forEach(function(y,M){const N=Nr(g,n,d,y);c[M]===void 0&amp;&amp;(c[M]=[]),c[M].push(N[0]),c[M].push(N[1])}),r++,m&amp;&amp;(f.genFace(t,e,a,_,o,l,c,u,h,r),n++,r=0,a=[],o=[],l=[],c=[],u=[],h=[])}),t}getNormalNewell(e){const t=new P(0,0,0);for(let n=0;n&lt;e.length;n++){const r=e[n],s=e[(n+1)%e.length];t.x+=(r.y-s.y)*(r.z+s.z),t.y+=(r.z-s.z)*(r.x+s.x),t.z+=(r.x-s.x)*(r.y+s.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),r=(Math.abs(t.z)&gt;.5?new P(0,1,0):new P(0,0,1)).cross(t).normalize(),s=t.clone().cross(r).normalize();return{normal:t,tangent:r,bitangent:s}}flattenVertex(e,t,n){return new ke(e.dot(t),e.dot(n))}genFace(e,t,n,r,s,a,o,l,c,u){let h;if(u&gt;3){const f=[],d=t.baseVertexPositions||t.vertexPositions;for(let p=0;p&lt;n.length;p+=3)f.push(new P(d[n[p]],d[n[p+1]],d[n[p+2]]));const{tangent:g,bitangent:_}=this.getNormalTangentAndBitangent(f),m=[];for(const p of f)m.push(this.flattenVertex(p,g,_));h=Ya.triangulateShape(m,[])}else h=[[0,1,2]];for(const[f,d,g]of h)e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),e.vertex.push(t.vertexPositions[n[g*3]]),e.vertex.push(t.vertexPositions[n[g*3+1]]),e.vertex.push(t.vertexPositions[n[g*3+2]]),t.skeleton&amp;&amp;(e.vertexWeights.push(l[f*4]),e.vertexWeights.push(l[f*4+1]),e.vertexWeights.push(l[f*4+2]),e.vertexWeights.push(l[f*4+3]),e.vertexWeights.push(l[d*4]),e.vertexWeights.push(l[d*4+1]),e.vertexWeights.push(l[d*4+2]),e.vertexWeights.push(l[d*4+3]),e.vertexWeights.push(l[g*4]),e.vertexWeights.push(l[g*4+1]),e.vertexWeights.push(l[g*4+2]),e.vertexWeights.push(l[g*4+3]),e.weightsIndices.push(c[f*4]),e.weightsIndices.push(c[f*4+1]),e.weightsIndices.push(c[f*4+2]),e.weightsIndices.push(c[f*4+3]),e.weightsIndices.push(c[d*4]),e.weightsIndices.push(c[d*4+1]),e.weightsIndices.push(c[d*4+2]),e.weightsIndices.push(c[d*4+3]),e.weightsIndices.push(c[g*4]),e.weightsIndices.push(c[g*4+1]),e.weightsIndices.push(c[g*4+2]),e.weightsIndices.push(c[g*4+3])),t.color&amp;&amp;(e.colors.push(a[f*3]),e.colors.push(a[f*3+1]),e.colors.push(a[f*3+2]),e.colors.push(a[d*3]),e.colors.push(a[d*3+1]),e.colors.push(a[d*3+2]),e.colors.push(a[g*3]),e.colors.push(a[g*3+1]),e.colors.push(a[g*3+2])),t.material&amp;&amp;t.material.mappingType!=="AllSame"&amp;&amp;(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&amp;&amp;(e.normal.push(s[f*3]),e.normal.push(s[f*3+1]),e.normal.push(s[f*3+2]),e.normal.push(s[d*3]),e.normal.push(s[d*3+1]),e.normal.push(s[d*3+2]),e.normal.push(s[g*3]),e.normal.push(s[g*3+1]),e.normal.push(s[g*3+2])),t.uv&amp;&amp;t.uv.forEach(function(_,m){e.uvs[m]===void 0&amp;&amp;(e.uvs[m]=[]),e.uvs[m].push(o[m][f*2]),e.uvs[m].push(o[m][f*2+1]),e.uvs[m].push(o[m][d*2]),e.uvs[m].push(o[m][d*2+1]),e.uvs[m].push(o[m][g*2]),e.uvs[m].push(o[m][g*2+1])})}addMorphTargets(e,t,n,r){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;n.forEach(function(a){a.rawTargets.forEach(function(o){const l=Oe.Objects.Geometry[o.geoID];l!==void 0&amp;&amp;s.genMorphGeometry(e,t,l,r,o.name)})})}genMorphGeometry(e,t,n,r,s){const a=t.Vertices!==void 0?t.Vertices.a:[],o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],l=n.Vertices!==void 0?n.Vertices.a:[],c=n.Indexes!==void 0?n.Indexes.a:[],u=e.attributes.position.count*3,h=new Float32Array(u);for(let _=0;_&lt;c.length;_++){const m=c[_]*3;h[m]=l[_*3],h[m+1]=l[_*3+1],h[m+2]=l[_*3+2]}const f={vertexIndices:o,vertexPositions:h,baseVertexPositions:a},d=this.genBuffers(f),g=new bt(d.vertex,3);g.name=s||n.attrName,g.applyMatrix4(r),e.morphAttributes.position.push(g)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a;let s=[];return n==="IndexToDirect"&amp;&amp;("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&amp;&amp;(s=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a;let s=[];return n==="IndexToDirect"&amp;&amp;(s=e.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a;let s=[];n==="IndexToDirect"&amp;&amp;(s=e.ColorIndex.a);for(let a=0,o=new be;a&lt;r.length;a+=4)o.fromArray(r,a),Ie.toWorkingColorSpace(o,tt),o.toArray(r,a);return{dataSize:4,buffer:r,indices:s,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=e.Materials.a,s=[];for(let a=0;a&lt;r.length;++a)s.push(a);return{dataSize:1,buffer:r,indices:s,mappingType:t,referenceType:n}}parseNurbsGeometry(e){const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new zt;const n=t-1,r=e.KnotVector.a,s=[],a=e.Points.a;for(let h=0,f=a.length;h&lt;f;h+=4)s.push(new ze().fromArray(a,h));let o,l;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){o=n,l=r.length-1-o;for(let h=0;h&lt;n;++h)s.push(s[h])}const u=new p_(n,r,s,o,l).getPoints(s.length*12);return new zt().setFromPoints(u)}}class __{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const r=t[n],s=this.addClip(r);e.push(s)}return e}parseClips(){if(Oe.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=Oe.Objects.AnimationCurveNode,t=new Map;for(const n in e){const r=e[n];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=Oe.Objects.AnimationCurve;for(const n in t){const r={id:t[n].id,times:t[n].KeyTime.a.map(S_),values:t[n].KeyValueFloat.a},s=ut.get(r.id);if(s!==void 0){const a=s.parents[0].ID,o=s.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=r:o.match(/Y/)?e.get(a).curves.y=r:o.match(/Z/)?e.get(a).curves.z=r:o.match(/DeformPercent/)&amp;&amp;e.has(a)&amp;&amp;(e.get(a).curves.morph=r)}}}parseAnimationLayers(e){const t=Oe.Objects.AnimationLayer,n=new Map;for(const r in t){const s=[],a=ut.get(parseInt(r));a!==void 0&amp;&amp;(a.children.forEach(function(l,c){if(e.has(l.ID)){const u=e.get(l.ID);if(u.curves.x!==void 0||u.curves.y!==void 0||u.curves.z!==void 0){if(s[c]===void 0){const h=ut.get(l.ID).parents.filter(function(f){return f.relationship!==void 0})[0].ID;if(h!==void 0){const f=Oe.Objects.Model[h.toString()];if(f===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}const d={modelName:f.attrName?Ye.sanitizeNodeName(f.attrName):"",ID:f.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Et.traverse(function(g){g.ID===f.id&amp;&amp;(d.transform=g.matrix,g.userData.transformData&amp;&amp;(d.eulerOrder=g.userData.transformData.eulerOrder))}),d.transform||(d.transform=new xe),"PreRotation"in f&amp;&amp;(d.preRotation=f.PreRotation.value),"PostRotation"in f&amp;&amp;(d.postRotation=f.PostRotation.value),s[c]=d}}s[c]&amp;&amp;(s[c][u.attr]=u)}else if(u.curves.morph!==void 0){if(s[c]===void 0){const h=ut.get(l.ID).parents.filter(function(p){return p.relationship!==void 0})[0].ID,f=ut.get(h).parents[0].ID,d=ut.get(f).parents[0].ID,g=ut.get(d).parents[0].ID,_=Oe.Objects.Model[g],m={modelName:_.attrName?Ye.sanitizeNodeName(_.attrName):"",morphName:Oe.Objects.Deformer[h].attrName};s[c]=m}s[c][u.attr]=u}}}),n.set(parseInt(r),s))}return n}parseAnimStacks(e){const t=Oe.Objects.AnimationStack,n={};for(const r in t){const s=ut.get(parseInt(r)).children;s.length&gt;1&amp;&amp;console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(s[0].ID);n[r]={name:t[r].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(r){t=t.concat(n.generateTracks(r))}),new yg(e.name,-1,t)}generateTracks(e){const t=[];let n=new P,r=new P;if(e.transform&amp;&amp;e.transform.decompose(n,new wt,r),n=n.toArray(),r=r.toArray(),e.T!==void 0&amp;&amp;Object.keys(e.T.curves).length&gt;0){const s=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");s!==void 0&amp;&amp;t.push(s)}if(e.R!==void 0&amp;&amp;Object.keys(e.R.curves).length&gt;0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&amp;&amp;t.push(s)}if(e.S!==void 0&amp;&amp;Object.keys(e.S.curves).length&gt;0){const s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");s!==void 0&amp;&amp;t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&amp;&amp;t.push(s)}return t}generateVectorTrack(e,t,n,r){const s=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(s,t,n);return new Qi(e+"."+r,s,a)}generateRotationTrack(e,t,n,r,s){let a,o;if(t.x!==void 0&amp;&amp;t.y!==void 0&amp;&amp;t.z!==void 0){const f=this.interpolateRotations(t.x,t.y,t.z,s);a=f[0],o=f[1]}const l=er(0);n!==void 0&amp;&amp;(n=n.map(Tt.degToRad),n.push(l),n=new ft().fromArray(n),n=new wt().setFromEuler(n)),r!==void 0&amp;&amp;(r=r.map(Tt.degToRad),r.push(l),r=new ft().fromArray(r),r=new wt().setFromEuler(r).invert());const c=new wt,u=new ft,h=[];if(!o||!a)return new wi(e+".quaternion",[0],[0]);for(let f=0;f&lt;o.length;f+=3)u.set(o[f],o[f+1],o[f+2],s),c.setFromEuler(u),n!==void 0&amp;&amp;c.premultiply(n),r!==void 0&amp;&amp;c.multiply(r),f&gt;2&amp;&amp;new wt().fromArray(h,(f-3)/3*4).dot(c)&lt;0&amp;&amp;c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(h,f/3*4);return new wi(e+".quaternion",a,h)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(s){return s/100}),r=Et.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Ji(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&amp;&amp;(t=t.concat(e.x.times)),e.y!==void 0&amp;&amp;(t=t.concat(e.y.times)),e.z!==void 0&amp;&amp;(t=t.concat(e.z.times)),t=t.sort(function(n,r){return n-r}),t.length&gt;1){let n=1,r=t[0];for(let s=1;s&lt;t.length;s++){const a=t[s];a!==r&amp;&amp;(t[n]=a,r=a,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const r=n,s=[];let a=-1,o=-1,l=-1;return e.forEach(function(c){if(t.x&amp;&amp;(a=t.x.times.indexOf(c)),t.y&amp;&amp;(o=t.y.times.indexOf(c)),t.z&amp;&amp;(l=t.z.times.indexOf(c)),a!==-1){const u=t.x.values[a];s.push(u),r[0]=u}else s.push(r[0]);if(o!==-1){const u=t.y.values[o];s.push(u),r[1]=u}else s.push(r[1]);if(l!==-1){const u=t.z.values[l];s.push(u),r[2]=u}else s.push(r[2])}),s}interpolateRotations(e,t,n,r){const s=[],a=[];s.push(e.times[0]),a.push(Tt.degToRad(e.values[0])),a.push(Tt.degToRad(t.values[0])),a.push(Tt.degToRad(n.values[0]));for(let o=1;o&lt;e.values.length;o++){const l=[e.values[o-1],t.values[o-1],n.values[o-1]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;const c=l.map(Tt.degToRad),u=[e.values[o],t.values[o],n.values[o]];if(isNaN(u[0])||isNaN(u[1])||isNaN(u[2]))continue;const h=u.map(Tt.degToRad),f=[u[0]-l[0],u[1]-l[1],u[2]-l[2]],d=[Math.abs(f[0]),Math.abs(f[1]),Math.abs(f[2])];if(d[0]&gt;=180||d[1]&gt;=180||d[2]&gt;=180){const _=Math.max(...d)/180,m=new ft(...c,r),p=new ft(...h,r),b=new wt().setFromEuler(m),y=new wt().setFromEuler(p);b.dot(y)&amp;&amp;y.set(-y.x,-y.y,-y.z,-y.w);const M=e.times[o-1],N=e.times[o]-M,w=new wt,R=new ft;for(let U=0;U&lt;1;U+=1/_)w.copy(b.clone().slerp(y.clone(),U)),s.push(M+U*N),R.setFromQuaternion(w,r),a.push(R.x),a.push(R.y),a.push(R.z)}else s.push(e.times[o]),a.push(Tt.degToRad(e.values[o])),a.push(Tt.degToRad(t.values[o])),a.push(Tt.degToRad(n.values[o]))}return[s,a]}}class v_{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new yc,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(r,s){const a=r.match(/^[\s\t]*;/),o=r.match(/^[\s\t]*$/);if(a||o)return;const l=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=r.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(r,l):c?t.parseNodeProperty(r,c,n[++s]):u?t.popStack():r.match(/^[^\s\t}]/)&amp;&amp;t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,s):n in o?(n==="PoseNode"?o.PoseNode.push(s):o[n].id!==void 0&amp;&amp;(o[n]={},o[n][o[n].id]=o[n]),a.id!==""&amp;&amp;(o[n][a.id]=s)):typeof a.id=="number"?(o[n]={},o[n][a.id]=s):n!=="Properties70"&amp;&amp;(n==="PoseNode"?o[n]=[s]:o[n]=s),typeof a.id=="number"&amp;&amp;(s.id=a.id),a.name!==""&amp;&amp;(s.attrName=a.name),a.type!==""&amp;&amp;(s.attrType=a.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&amp;&amp;(t=parseInt(e[0]),isNaN(t)&amp;&amp;(t=e[0]));let n="",r="";return e.length&gt;1&amp;&amp;(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}parseNodeProperty(e,t,n){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&amp;&amp;s===","&amp;&amp;(s=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),u=parseInt(l[1]);let h=s.split(",").slice(3);h=h.map(function(f){return f.trim().replace(/^"/,"")}),r="connections",s=[c,u],T_(s,h),a[r]===void 0&amp;&amp;(a[r]=[])}r==="Node"&amp;&amp;(a.id=s),r in a&amp;&amp;Array.isArray(a[r])?a[r].push(s):r!=="a"?a[r]=s:a.a=s,this.setCurrentProp(a,r),r==="a"&amp;&amp;s.slice(-1)!==","&amp;&amp;(a.a=Gs(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&amp;&amp;(t.a=Gs(t.a))}parseNodeSpecialProperty(e,t,n){const r=n.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],a=r[1],o=r[2],l=r[3];let c=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=Gs(c);break}this.getPrevNode()[s]={type:a,type2:o,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class x_{parse(e){const t=new Cl(e);t.skip(23);const n=t.getUint32();if(n&lt;6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new yc;for(;!this.endOfContent(t);){const s=this.parseNode(t,n);s!==null&amp;&amp;r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&amp;-16)&gt;=e.size():e.getOffset()+160+16&gt;=e.size()}parseNode(e,t){const n={},r=t&gt;=7500?e.getUint64():e.getUint32(),s=t&gt;=7500?e.getUint64():e.getUint32();t&gt;=7500?e.getUint64():e.getUint32();const a=e.getUint8(),o=e.getString(a);if(r===0)return null;const l=[];for(let f=0;f&lt;s;f++)l.push(this.parseProperty(e));const c=l.length&gt;0?l[0]:"",u=l.length&gt;1?l[1]:"",h=l.length&gt;2?l[2]:"";for(n.singleProperty=s===1&amp;&amp;e.getOffset()===r;r&gt;e.getOffset();){const f=this.parseNode(e,t);f!==null&amp;&amp;this.parseSubNode(o,n,f)}return n.propertyList=l,typeof c=="number"&amp;&amp;(n.id=c),u!==""&amp;&amp;(n.attrName=u),h!==""&amp;&amp;(n.attrType=h),o!==""&amp;&amp;(n.name=o),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if(e==="Connections"&amp;&amp;n.name==="C"){const r=[];n.propertyList.forEach(function(s,a){a!==0&amp;&amp;r.push(s)}),t.connections===void 0&amp;&amp;(t.connections=[]),t.connections.push(r)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&amp;&amp;n.name==="P"){let r=n.propertyList[0],s=n.propertyList[1];const a=n.propertyList[2],o=n.propertyList[3];let l;r.indexOf("Lcl ")===0&amp;&amp;(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&amp;&amp;(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:l=n.propertyList[4],t[r]={type:s,type2:a,flag:o,value:l}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&amp;&amp;(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),a=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const o=r_(new Uint8Array(e.getArrayBuffer(a))),l=new Cl(o.buffer);switch(t){case"b":case"c":return l.getBooleanArray(r);case"d":return l.getFloat64Array(r);case"f":return l.getFloat32Array(r);case"i":return l.getInt32Array(r);case"l":return l.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Cl{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&amp;1)===1}getBooleanArray(e){const t=[];for(let n=0;n&lt;e;n++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let n=0;n&lt;e;n++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&amp;2147483648?(t=~t&amp;4294967295,e=~e&amp;4294967295,e===4294967295&amp;&amp;(t=t+1&amp;4294967295),e=e+1&amp;4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let n=0;n&lt;e;n++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let n=0;n&lt;e;n++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let n=0;n&lt;e;n++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const r=n.indexOf(0);return r&gt;=0&amp;&amp;(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}class yc{add(e,t){this[e]=t}}function M_(i){const e="Kaydara FBX Binary  \0";return i.byteLength&gt;=e.length&amp;&amp;e===Ec(i,0,e.length)}function y_(i){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(r){const s=i[r-1];return i=i.slice(t+r),t++,s}for(let r=0;r&lt;e.length;++r)if(n(1)===e[r])return!1;return!0}function Pl(i){const e=/FBXVersion: (\d+)/,t=i.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function S_(i){return i/46186158e3}const E_=[];function Nr(i,e,t,n){let r;switch(n.mappingType){case"ByPolygonVertex":r=i;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&amp;&amp;(r=n.indices[r]);const s=r*n.dataSize,a=s+n.dataSize;return b_(E_,n.buffer,s,a)}const Hs=new ft,hi=new P;function Sc(i){const e=new xe,t=new xe,n=new xe,r=new xe,s=new xe,a=new xe,o=new xe,l=new xe,c=new xe,u=new xe,h=new xe,f=new xe,d=i.inheritType?i.inheritType:0;i.translation&amp;&amp;e.setPosition(hi.fromArray(i.translation));const g=er(0);if(i.preRotation){const A=i.preRotation.map(Tt.degToRad);A.push(g),t.makeRotationFromEuler(Hs.fromArray(A))}if(i.rotation){const A=i.rotation.map(Tt.degToRad);A.push(i.eulerOrder||g),n.makeRotationFromEuler(Hs.fromArray(A))}if(i.postRotation){const A=i.postRotation.map(Tt.degToRad);A.push(g),r.makeRotationFromEuler(Hs.fromArray(A)),r.invert()}i.scale&amp;&amp;s.scale(hi.fromArray(i.scale)),i.scalingOffset&amp;&amp;o.setPosition(hi.fromArray(i.scalingOffset)),i.scalingPivot&amp;&amp;a.setPosition(hi.fromArray(i.scalingPivot)),i.rotationOffset&amp;&amp;l.setPosition(hi.fromArray(i.rotationOffset)),i.rotationPivot&amp;&amp;c.setPosition(hi.fromArray(i.rotationPivot)),i.parentMatrixWorld&amp;&amp;(h.copy(i.parentMatrix),u.copy(i.parentMatrixWorld));const _=t.clone().multiply(n).multiply(r),m=new xe;m.extractRotation(u);const p=new xe;p.copyPosition(u);const b=p.clone().invert().multiply(u),y=m.clone().invert().multiply(b),M=s,N=new xe;if(d===0)N.copy(m).multiply(_).multiply(y).multiply(M);else if(d===1)N.copy(m).multiply(y).multiply(_).multiply(M);else{const G=new xe().scale(new P().setFromMatrixScale(h)).clone().invert(),z=y.clone().multiply(G);N.copy(m).multiply(_).multiply(z).multiply(M)}const w=c.clone().invert(),R=a.clone().invert();let U=e.clone().multiply(l).multiply(c).multiply(t).multiply(n).multiply(r).multiply(w).multiply(o).multiply(a).multiply(s).multiply(R);const E=new xe().copyPosition(U),S=u.clone().multiply(E);return f.copyPosition(S),U=f.clone().multiply(N),U.premultiply(u.invert()),U}function er(i){i=i||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return i===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[i]}function Gs(i){return i.split(",").map(function(t){return parseFloat(t)})}function Ec(i,e,t){return e===void 0&amp;&amp;(e=0),t===void 0&amp;&amp;(t=i.byteLength),new TextDecoder().decode(new Uint8Array(i,e,t))}function T_(i,e){for(let t=0,n=i.length,r=e.length;t&lt;r;t++,n++)i[n]=e[t]}function b_(i,e,t,n){for(let r=t,s=0;r&lt;n;r++,s++)i[s]=e[r];return i}export{Ug as A,Ci as B,be as C,Ig as D,ft as E,B_ as F,pi as G,C_ as H,Pn as I,Ln as L,gn as M,Rt as P,wt as Q,Jr as R,L_ as S,R_ as T,mn as U,P as V,P_ as W,N_ as a,wg as b,tt as c,zt as d,bt as e,ac as f,Km as g,Os as h,D_ as i,I_ as j,Zt as k,O_ as l,w_ as m,F_ as n,ke as o,kn as p,Tt as q,nr as r,U_ as s,xe as t,A_ as u,Ym as v,Bt as w,Dl as x,qi as y,$t as z};
</pre></body></html>