PageSourceSearch

https://voicerr.ai/assets/three.module-D8cF2hvG.js

js voicerr.ai collected 2026-10-05 13:15:23 UTC 704,196 bytes, 3,840 lines download raw bytes

vendor: 4,317 bytes, lines 1-5
1/**
2 * @license
3 * Copyright 2010-2025 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const so="180",Tf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Af={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},gu=0,Ll=1,_u=2,wf=3,Cf=0,Zl=1,xu=2,xn=3,Bn=0,Be=1,vn=2,Nn=0,Ai=1,Dl=2,Ul=3,Nl=4,vu=5,$n=100,yu=101,Mu=102,Su=103,bu=104,Eu=200,Tu=201,Au=202,wu=203,ga=204,_a=205,Cu=206,Ru=207,Iu=208,Pu=209,Lu=210,Du=211,Uu=212,Nu=213,Fu=214,xa=0,va=1,ya=2,Ri=3,Ma=4,Sa=5,ba=6,Ea=7,ur=0,Ou=1,Bu=2,Fn=0,zu=1,ku=2,Vu=3,Hu=4,Gu=5,Wu=6,Xu=7,Fl="attached",qu="detached",ro=300,zn=301,Qn=302,Zs=303,Js=304,xs=306,$s=1e3,rn=1001,Ks=1002,Ae=1003,Jl=1004,Rf=1004,ss=1005,If=1005,Me=1006,ks=1007,Pf=1007,yn=1008,Lf=1008,dn=1009,$l=1010,Kl=1011,cs=1012,ao=1013,kn=1014,Xe=1015,vs=1016,oo=1017,lo=1018,hs=1020,Ql=35902,jl=35899,tc=1021,ec=1022,Oe=1023,us=1026,ds=1027,co=1028,dr=1029,nc=1030,ho=1031,Df=1032,uo=1033,Vs=33776,Hs=33777,Gs=33778,Ws=33779,Ta=35840,Aa=35841,wa=35842,Ca=35843,Ra=36196,Ia=37492,Pa=37496,La=37808,Da=37809,Ua=37810,Na=37811,Fa=37812,Oa=37813,Ba=37814,za=37815,ka=37816,Va=37817,Ha=37818,Ga=37819,Wa=37820,Xa=37821,qa=36492,Ya=36494,Za=36495,Ja=36283,$a=36284,Ka=36285,Qa=36286,Yu=2200,Zu=2201,Ju=2202,Qs=2300,ja=2301,fa=2302,bi=2400,Ei=2401,js=2402,fo=2500,ic=2501,Uf=0,Nf=1,Ff=2,$u=3200,Ku=3201,Of=3202,Bf=3203,ti=0,Qu=1,Dn="",Ge="srgb",Ii="srgb-linear",tr="linear",re="srgb",zf=0,yi=7680,kf=7681,Vf=7682,Hf=7683,Gf=34055,Wf=34056,Xf=5386,qf=512,Yf=513,Zf=514,Jf=515,$f=516,Kf=517,Qf=518,Ol=519,ju=512,td=513,ed=514,sc=515,nd=516,id=517,sd=518,rd=519,er=35044,jf=35048,tp=35040,ep=35045,np=35049,ip=35041,sp=35046,rp=35050,ap=35042,op="100",Bl="300 es",Qe=2e3,fs=2001,lp={COMPUTE:"compute",RENDER:"render"},cp={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},hp={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class En{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){const n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){const n=this._listeners;if(n===void 0)return;const i=n[t];if(i!==void 0){const s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){const e=this._listeners;if(e===void 0)return;const n=e[t.type];if(n!==void 0){t.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,t);t.target=null}}}const Ce=["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 kc=1234567;const wi=Math.PI/180,ps=180/Math.PI;function je(){const r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ce[r&255]+Ce[r>>8&255]+Ce[r>>16&255]+Ce[r>>24&255]+"-"+Ce[t&255]+Ce[t>>8&255]+"-"+Ce[t>>16&15|64]+Ce[t>>24&255]+"-"+Ce[e&63|128]+Ce[e>>8&255]+"-"+Ce[e>>16&255]+Ce[e>>24&255]+Ce[n&255]+Ce[n>>8&255]+Ce[n>>16&255]+Ce[n>>24&255]).toLowerCase()}function Nt(r,t,e){return Math.max(t,Math.min(e,r))}function rc(r,t){return(r%t+t)%t}function up(r,t,e,n,i){return n+(r-t)*(i-n)/(e-t)}
vendor: 4,302 bytes, line 5
5function dp(r,t,e){return r!==t?(e-r)/(t-r):0}function Xs(r,t,e){return(1-e)*r+e*t}function fp(r,t,e,n){return Xs(r,t,1-Math.exp(-e*n))}function pp(r,t=1){return t-Math.abs(rc(r,t*2)-t)}function mp(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*(3-2*r))}function gp(r,t,e){return r<=t?0:r>=e?1:(r=(r-t)/(e-t),r*r*r*(r*(r*6-15)+10))}function _p(r,t){return r+Math.floor(Math.random()*(t-r+1))}function xp(r,t){return r+Math.random()*(t-r)}function vp(r){return r*(.5-Math.random())}function yp(r){r!==void 0&&(kc=r);let t=kc+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Mp(r){return r*wi}function Sp(r){return r*ps}function bp(r){return(r&r-1)===0&&r!==0}function Ep(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Tp(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Ap(r,t,e,n,i){const s=Math.cos,a=Math.sin,o=s(e/2),l=a(e/2),c=s((t+n)/2),h=a((t+n)/2),u=s((t-n)/2),d=a((t-n)/2),f=s((n-t)/2),m=a((n-t)/2);switch(i){case"XYX":r.set(o*h,l*u,l*d,o*c);break;case"YZY":r.set(l*d,o*h,l*u,o*c);break;case"ZXZ":r.set(l*u,l*d,o*h,o*c);break;case"XZX":r.set(o*h,l*m,l*f,o*c);break;case"YXY":r.set(l*f,o*h,l*m,o*c);break;case"ZYZ":r.set(l*m,l*f,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Fe(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Wt(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const wp={DEG2RAD:wi,RAD2DEG:ps,generateUUID:je,clamp:Nt,euclideanModulo:rc,mapLinear:up,inverseLerp:dp,lerp:Xs,damp:fp,pingpong:pp,smoothstep:mp,smootherstep:gp,randInt:_p,randFloat:xp,randFloatSpread:vp,seededRandom:yp,degToRad:Mp,radToDeg:Sp,isPowerOfTwo:bp,ceilPowerOfTwo:Ep,floorPowerOfTwo:Tp,setQuaternionFromProperEuler:Ap,normalize:Wt,denormalize:Fe};class Q{constructor(t=0,e=0){Q.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Nt(this.x,t.x,e.x),this.y=Nt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Nt(this.x,t,e),this.y=Nt(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Nt(n,t,e))}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}
vendor: 5,025 bytes, line 5
5round(){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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Nt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,a=this.y-t.y;return this.x=s*n-a*i+t.x,this.y=s*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qe{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,s,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],u=n[i+3];const d=s[a+0],f=s[a+1],m=s[a+2],_=s[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u;return}if(o===1){t[e+0]=d,t[e+1]=f,t[e+2]=m,t[e+3]=_;return}if(u!==_||l!==d||c!==f||h!==m){let g=1-o;const p=l*d+c*f+h*m+u*_,y=p>=0?1:-1,v=1-p*p;if(v>Number.EPSILON){const A=Math.sqrt(v),T=Math.atan2(A,p*y);g=Math.sin(g*T)/A,o=Math.sin(o*T)/A}const x=o*y;if(l=l*g+d*x,c=c*g+f*x,h=h*g+m*x,u=u*g+_*x,g===1-o){const A=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=A,c*=A,h*=A,u*=A}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],u=s[a],d=s[a+1],f=s[a+2],m=s[a+3];return t[e]=o*m+h*u+l*f-c*d,t[e+1]=l*m+h*d+c*u-o*f,t[e+2]=c*m+h*f+o*d-l*u,t[e+3]=h*m-o*u-l*d-c*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,s=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),u=o(s/2),d=l(n/2),f=l(i/2),m=l(s/2);switch(a){case"XYZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"YXZ":this._x=d*h*u+c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"ZXY":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u-d*f*m;break;case"ZYX":this._x=d*h*u-c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u+d*f*m;break;case"YZX":this._x=d*h*u+c*f*m,this._y=c*f*u+d*h*m,this._z=c*h*m-d*f*u,this._w=c*h*u-d*f*m;break;case"XZY":this._x=d*h*u-c*f*m,this._y=c*f*u-d*h*m,this._z=c*h*m+d*f*u,this._w=c*h*u+d*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],s=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],u=e[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-l)*f,this._y=(s-c)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(s-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(s+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Nt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(n===0)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}
vendor: 12,704 bytes, line 5
5conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,s=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+i*c-s*l,this._y=i*h+a*l+s*o-n*c,this._z=s*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-s*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const n=this._x,i=this._y,s=this._z,a=this._w;let o=a*t._w+n*t._x+i*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const f=1-e;return this._w=f*a+e*this._w,this._x=f*n+e*this._x,this._y=f*i+e*this._y,this._z=f*s+e*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,o),u=Math.sin((1-e)*h)/c,d=Math.sin(e*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=s*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class C{constructor(t=0,e=0,n=0){C.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Vc.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Vc.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,s=t.elements,a=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,s=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*i-o*n),h=2*(o*e-s*i),u=2*(s*n-a*e);return this.x=e+l*c+a*u-o*h,this.y=n+l*h+o*c-s*u,this.z=i+l*u+s*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Nt(this.x,t.x,e.x),this.y=Nt(this.y,t.y,e.y),this.z=Nt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Nt(this.x,t,e),this.y=Nt(this.y,t,e),this.z=Nt(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Nt(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,s=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-s*o,this.y=s*a-n*l,this.z=n*o-i*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Ho.copy(this).projectOnVector(t),this.sub(Ho)}reflect(t){return this.sub(Ho.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Nt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ho=new C,Vc=new qe;class Ht{constructor(t,e,n,i,s,a,o,l,c){Ht.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,a,o,l,c)}set(t,e,n,i,s,a,o,l,c){const h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=s,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,s=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],u=n[7],d=n[2],f=n[5],m=n[8],_=i[0],g=i[3],p=i[6],y=i[1],v=i[4],x=i[7],A=i[2],T=i[5],R=i[8];return s[0]=a*_+o*y+l*A,s[3]=a*g+o*v+l*T,s[6]=a*p+o*x+l*R,s[1]=c*_+h*y+u*A,s[4]=c*g+h*v+u*T,s[7]=c*p+h*x+u*R,s[2]=d*_+f*y+m*A,s[5]=d*g+f*v+m*T,s[8]=d*p+f*x+m*R,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*s*h+n*o*l+i*s*c-i*a*l}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=h*a-o*c,d=o*l-h*s,f=c*s-a*l,m=e*u+n*d+i*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/m;return t[0]=u*_,t[1]=(i*c-h*n)*_,t[2]=(o*n-i*a)*_,t[3]=d*_,t[4]=(h*e-i*l)*_,t[5]=(i*s-o*e)*_,t[6]=f*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*s)*_,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,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+t,-i*c,i*l,-i*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Go.makeScale(t,e)),this}rotate(t){return this.premultiply(Go.makeRotation(-t)),this}translate(t,e){return this.premultiply(Go.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const Go=new Ht;function ad(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}const Cp={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function rs(r,t){return new Cp[r](t)}function nr(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function od(){const r=nr("canvas");return r.style.display="block",r}const Hc={};function ir(r){r in Hc||(Hc[r]=!0,console.warn(r))}function Rp(r,t,e){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(t,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,e);break;default:n()}}setTimeout(s,e)})}const Gc=new Ht().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Wc=new Ht().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 32,797 bytes, line 5
57,1.0569715);function Ip(){const r={enabled:!0,workingColorSpace:Ii,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===re&&(i.r=On(i.r),i.g=On(i.g),i.b=On(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===re&&(i.r=ls(i.r),i.g=ls(i.g),i.b=ls(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Dn?tr:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return ir("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return ir("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Ii]:{primaries:t,whitePoint:n,transfer:tr,toXYZ:Gc,fromXYZ:Wc,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Ge},outputColorSpaceConfig:{drawingBufferColorSpace:Ge}},[Ge]:{primaries:t,whitePoint:n,transfer:re,toXYZ:Gc,fromXYZ:Wc,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Ge}}}),r}const Kt=Ip();function On(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function ls(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Oi;class ld{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{Oi===void 0&&(Oi=nr("canvas")),Oi.width=t.width,Oi.height=t.height;const i=Oi.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=Oi}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=nr("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=On(s[a]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){const e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(On(e[n]/255)*255):e[n]=On(e[n]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Pp=0;class Kn{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Pp++}),this.uuid=je(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(Wo(i[a].image)):s.push(Wo(i[a]))}else s=Wo(i);n.url=s}return e||(t.images[this.uuid]=n),n}}function Wo(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?ld.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Lp=0;const Xo=new C;class _e extends En{constructor(t=_e.DEFAULT_IMAGE,e=_e.DEFAULT_MAPPING,n=rn,i=rn,s=Me,a=yn,o=Oe,l=dn,c=_e.DEFAULT_ANISOTROPY,h=Dn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Lp++}),this.uuid=je(),this.name="",this.source=new Kn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Q(0,0),this.repeat=new Q(1,1),this.center=new Q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ht,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Xo).x}get height(){return this.source.getSize(Xo).y}get depth(){return this.source.getSize(Xo).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${e}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ro)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case $s:t.x=t.x-Math.floor(t.x);break;case rn:t.x=t.x<0?0:1;break;case Ks:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case $s:t.y=t.y-Math.floor(t.y);break;case rn:t.y=t.y<0?0:1;break;case Ks:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}_e.DEFAULT_IMAGE=null;_e.DEFAULT_MAPPING=ro;_e.DEFAULT_ANISOTROPY=1;class te{constructor(t=0,e=0,n=0,i=1){te.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,s=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s;const l=t.elements,c=l[0],h=l[4],u=l[8],d=l[1],f=l[5],m=l[9],_=l[2],g=l[6],p=l[10];if(Math.abs(h-d)<.01&&Math.abs(u-_)<.01&&Math.abs(m-g)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+_)<.1&&Math.abs(m+g)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const v=(c+1)/2,x=(f+1)/2,A=(p+1)/2,T=(h+d)/4,R=(u+_)/4,I=(m+g)/4;return v>x&&v>A?v<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(v),i=T/n,s=R/n):x>A?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=T/i,s=I/i):A<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(A),n=R/s,i=I/s),this.set(n,i,s,e),this}let y=Math.sqrt((g-m)*(g-m)+(u-_)*(u-_)+(d-h)*(d-h));return Math.abs(y)<.001&&(y=1),this.x=(g-m)/y,this.y=(u-_)/y,this.z=(d-h)/y,this.w=Math.acos((c+f+p-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Nt(this.x,t.x,e.x),this.y=Nt(this.y,t.y,e.y),this.z=Nt(this.z,t.z,e.z),this.w=Nt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Nt(this.x,t,e),this.y=Nt(this.y,t,e),this.z=Nt(this.z,t,e),this.w=Nt(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Nt(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 ac extends En{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Me,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new te(0,0,t,e),this.scissorTest=!1,this.viewport=new te(0,0,t,e);const i={width:t,height:e,depth:n.depth},s=new _e(i);this.textures=[];const a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(t={}){const e={minFilter:Me,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n,this.textures[i].isArrayTexture=this.textures[i].image.depth>1;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const i=Object.assign({},t.textures[e].image);this.textures[e].source=new Kn(i)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class bn extends ac{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class po extends _e{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Ae,this.minFilter=Ae,this.wrapR=rn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Dp extends bn{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new po(null,t,e,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class mo extends _e{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Ae,this.minFilter=Ae,this.wrapR=rn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Up extends bn{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new mo(null,t,e,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Pe{constructor(t=new C(1/0,1/0,1/0),e=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(on.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(on.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=on.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(n!==void 0){const s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,on):on.fromBufferAttribute(s,a),on.applyMatrix4(t.matrixWorld),this.expandByPoint(on);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Sr.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Sr.copy(n.boundingBox)),Sr.applyMatrix4(t.matrixWorld),this.union(Sr)}const i=t.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,on),on.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ts),br.subVectors(this.max,Ts),Bi.subVectors(t.a,Ts),zi.subVectors(t.b,Ts),ki.subVectors(t.c,Ts),Hn.subVectors(zi,Bi),Gn.subVectors(ki,zi),ai.subVectors(Bi,ki);let e=[0,-Hn.z,Hn.y,0,-Gn.z,Gn.y,0,-ai.z,ai.y,Hn.z,0,-Hn.x,Gn.z,0,-Gn.x,ai.z,0,-ai.x,-Hn.y,Hn.x,0,-Gn.y,Gn.x,0,-ai.y,ai.x,0];return!qo(e,Bi,zi,ki,br)||(e=[1,0,0,0,1,0,0,0,1],!qo(e,Bi,zi,ki,br))?!1:(Er.crossVectors(Hn,Gn),e=[Er.x,Er.y,Er.z],qo(e,Bi,zi,ki,br))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,on).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(on).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(wn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const wn=[new C,new C,new C,new C,new C,new C,new C,new C],on=new C,Sr=new Pe,Bi=new C,zi=new C,ki=new C,Hn=new C,Gn=new C,ai=new C,Ts=new C,br=new C,Er=new C,oi=new C;function qo(r,t,e,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){oi.fromArray(r,s);const o=i.x*Math.abs(oi.x)+i.y*Math.abs(oi.y)+i.z*Math.abs(oi.z),l=t.dot(oi),c=e.dot(oi),h=n.dot(oi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Np=new Pe,As=new C,Yo=new C;class we{constructor(t=new C,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;e!==void 0?n.copy(e):Np.setFromPoints(t).getCenter(n);let i=0;for(let s=0,a=t.length;s<a;s++)i=Math.max(i,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;As.subVectors(t,this.center);const e=As.lengthSq();if(e>this.radius*this.radius){const n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(As,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Yo.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(As.copy(t.center).add(Yo)),this.expandByPoint(As.copy(t.center).sub(Yo))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const Cn=new C,Zo=new C,Tr=new C,Wn=new C,Jo=new C,Ar=new C,$o=new C;class ys{constructor(t=new C,e=new C(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Cn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Cn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Cn.copy(this.origin).addScaledVector(this.direction,e),Cn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Zo.copy(t).add(e).multiplyScalar(.5),Tr.copy(e).sub(t).normalize(),Wn.copy(this.origin).sub(Zo);const s=t.distanceTo(e)*.5,a=-this.direction.dot(Tr),o=Wn.dot(this.direction),l=-Wn.dot(Tr),c=Wn.lengthSq(),h=Math.abs(1-a*a);let u,d,f,m;if(h>0)if(u=a*l-o,d=a*o-l,m=s*h,u>=0)if(d>=-m)if(d<=m){const _=1/h;u*=_,d*=_,f=u*(u+a*d+2*o)+d*(a*u+d+2*l)+c}else d=s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d=-s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;else d<=-m?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c):d<=m?(u=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-l),s),f=-u*u+d*(d+2*l)+c);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Zo).addScaledVector(Tr,d),f}intersectSphere(t,e){Cn.subVectors(t.center,this.origin);const n=Cn.dot(this.direction),i=Cn.dot(Cn)-n*n,s=t.radius*t.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,s,a,o,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(t.min.x-d.x)*c,i=(t.max.x-d.x)*c):(n=(t.max.x-d.x)*c,i=(t.min.x-d.x)*c),h>=0?(s=(t.min.y-d.y)*h,a=(t.max.y-d.y)*h):(s=(t.max.y-d.y)*h,a=(t.min.y-d.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),u>=0?(o=(t.min.z-d.z)*u,l=(t.max.z-d.z)*u):(o=(t.max.z-d.z)*u,l=(t.min.z-d.z)*u),n>l||o>i)||((o>n||n!==n)&&(n=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,Cn)!==null}intersectTriangle(t,e,n,i,s){Jo.subVectors(e,t),Ar.subVectors(n,t),$o.crossVectors(Jo,Ar);let a=this.direction.dot($o),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Wn.subVectors(this.origin,t);const l=o*this.direction.dot(Ar.crossVectors(Wn,Ar));if(l<0)return null;const c=o*this.direction.dot(Jo.cross(Wn));if(c<0||l+c>a)return null;const h=-o*Wn.dot($o);return h<0?null:this.at(h/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ot{constructor(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g){Ot.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g)}set(t,e,n,i,s,a,o,l,c,h,u,d,f,m,_,g){const p=this.elements;return p[0]=t,p[4]=e,p[8]=n,p[12]=i,p[1]=s,p[5]=a,p[9]=o,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=d,p[3]=f,p[7]=m,p[11]=_,p[15]=g,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 Ot().fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Vi.setFromMatrixColumn(t,0).length(),s=1/Vi.setFromMatrixColumn(t,1).length(),a=1/Vi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,s=t.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(t.order==="XYZ"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=-l*u,e[8]=c,e[1]=f+m*c,e[5]=d-_*c,e[9]=-o*l,e[2]=_-d*c,e[6]=m+f*c,e[10]=a*l}else if(t.order==="YXZ"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d+_*o,e[4]=m*o-f,e[8]=a*c,e[1]=a*u,e[5]=a*h,e[9]=-o,e[2]=f*o-m,e[6]=_+d*o,e[10]=a*l}else if(t.order==="ZXY"){const d=l*h,f=l*u,m=c*h,_=c*u;e[0]=d-_*o,e[4]=-a*u,e[8]=m+f*o,e[1]=f+m*o,e[5]=a*h,e[9]=_-d*o,e[2]=-a*c,e[6]=o,e[10]=a*l}else if(t.order==="ZYX"){const d=a*h,f=a*u,m=o*h,_=o*u;e[0]=l*h,e[4]=m*c-f,e[8]=d*c+_,e[1]=l*u,e[5]=_*c+d,e[9]=f*c-m,e[2]=-c,e[6]=o*l,e[10]=a*l}else if(t.order==="YZX"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=_-d*u,e[8]=m*u+f,e[1]=u,e[5]=a*h,e[9]=-o*h,e[2]=-c*h,e[6]=f*u+m,e[10]=d-_*u}else if(t.order==="XZY"){const d=a*l,f=a*c,m=o*l,_=o*c;e[0]=l*h,e[4]=-u,e[8]=c*h,e[1]=d*u+_,e[5]=a*h,e[9]=f*u-m,e[2]=m*u-f,e[6]=o*h,e[10]=_*u+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Fp,t,Op)}lookAt(t,e,n){const i=this.elements;return $e.subVectors(t,e),$e.lengthSq()===0&&($e.z=1),$e.normalize(),Xn.crossVectors(n,$e),Xn.lengthSq()===0&&(Math.abs(n.z)===1?$e.x+=1e-4:$e.z+=1e-4,$e.normalize(),Xn.crossVectors(n,$e)),Xn.normalize(),wr.crossVectors($e,Xn),i[0]=Xn.x,i[4]=wr.x,i[8]=$e.x,i[1]=Xn.y,i[5]=wr.y,i[9]=$e.y,i[2]=Xn.z,i[6]=wr.z,i[10]=$e.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,s=this.elements,a=n[0],o=n[4],l=n[8],c=n[12],h=n[1],u=n[5],d=n[9],f=n[13],m=n[2],_=n[6],g=n[10],p=n[14],y=n[3],v=n[7],x=n[11],A=n[15],T=i[0],R=i[4],I=i[8],b=i[12],S=i[1],L=i[5],F=i[9],z=i[13],G=i[2],q=i[6],W=i[10],nt=i[14],H=i[3],ut=i[7],_t=i[11],St=i[15];
vendor: 4,469 bytes, line 5
5return s[0]=a*T+o*S+l*G+c*H,s[4]=a*R+o*L+l*q+c*ut,s[8]=a*I+o*F+l*W+c*_t,s[12]=a*b+o*z+l*nt+c*St,s[1]=h*T+u*S+d*G+f*H,s[5]=h*R+u*L+d*q+f*ut,s[9]=h*I+u*F+d*W+f*_t,s[13]=h*b+u*z+d*nt+f*St,s[2]=m*T+_*S+g*G+p*H,s[6]=m*R+_*L+g*q+p*ut,s[10]=m*I+_*F+g*W+p*_t,s[14]=m*b+_*z+g*nt+p*St,s[3]=y*T+v*S+x*G+A*H,s[7]=y*R+v*L+x*q+A*ut,s[11]=y*I+v*F+x*W+A*_t,s[15]=y*b+v*z+x*nt+A*St,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],a=t[1],o=t[5],l=t[9],c=t[13],h=t[2],u=t[6],d=t[10],f=t[14],m=t[3],_=t[7],g=t[11],p=t[15];return m*(+s*l*u-i*c*u-s*o*d+n*c*d+i*o*f-n*l*f)+_*(+e*l*f-e*c*d+s*a*d-i*a*f+i*c*h-s*l*h)+g*(+e*c*u-e*o*f-s*a*u+n*a*f+s*o*h-n*c*h)+p*(-i*o*h-e*l*u+e*o*d+i*a*u-n*a*d+n*l*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],f=t[11],m=t[12],_=t[13],g=t[14],p=t[15],y=u*g*c-_*d*c+_*l*f-o*g*f-u*l*p+o*d*p,v=m*d*c-h*g*c-m*l*f+a*g*f+h*l*p-a*d*p,x=h*_*c-m*u*c+m*o*f-a*_*f-h*o*p+a*u*p,A=m*u*l-h*_*l-m*o*d+a*_*d+h*o*g-a*u*g,T=e*y+n*v+i*x+s*A;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/T;return t[0]=y*R,t[1]=(_*d*s-u*g*s-_*i*f+n*g*f+u*i*p-n*d*p)*R,t[2]=(o*g*s-_*l*s+_*i*c-n*g*c-o*i*p+n*l*p)*R,t[3]=(u*l*s-o*d*s-u*i*c+n*d*c+o*i*f-n*l*f)*R,t[4]=v*R,t[5]=(h*g*s-m*d*s+m*i*f-e*g*f-h*i*p+e*d*p)*R,t[6]=(m*l*s-a*g*s-m*i*c+e*g*c+a*i*p-e*l*p)*R,t[7]=(a*d*s-h*l*s+h*i*c-e*d*c-a*i*f+e*l*f)*R,t[8]=x*R,t[9]=(m*u*s-h*_*s-m*n*f+e*_*f+h*n*p-e*u*p)*R,t[10]=(a*_*s-m*o*s+m*n*c-e*_*c-a*n*p+e*o*p)*R,t[11]=(h*o*s-a*u*s-h*n*c+e*u*c+a*n*f-e*o*f)*R,t[12]=A*R,t[13]=(h*_*i-m*u*i+m*n*d-e*_*d-h*n*g+e*u*g)*R,t[14]=(m*o*i-a*_*i-m*n*l+e*_*l+a*n*g-e*o*g)*R,t[15]=(a*u*i-h*o*i+h*n*l-e*u*l-a*n*d+e*o*d)*R,this}scale(t){const e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),s=1-n,a=t.x,o=t.y,l=t.z,c=s*a,h=s*o;return this.set(c*a+n,c*o-i*l,c*l+i*o,0,c*o+i*l,h*o+n,h*l-i*a,0,c*l-i*o,h*l+i*a,s*l*l+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,a){return this.set(1,n,s,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,s=e._x,a=e._y,o=e._z,l=e._w,c=s+s,h=a+a,u=o+o,d=s*c,f=s*h,m=s*u,_=a*h,g=a*u,p=o*u,y=l*c,v=l*h,x=l*u,A=n.x,T=n.y,R=n.z;return i[0]=(1-(_+p))*A,i[1]=(f+x)*A,i[2]=(m-v)*A,i[3]=0,i[4]=(f-x)*T,i[5]=(1-(d+p))*T,i[6]=(g+y)*T,i[7]=0,i[8]=(m+v)*R,i[9]=(g-y)*R,i[10]=(1-(d+_))*R,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let s=Vi.set(i[0],i[1],i[2]).length();const a=Vi.set(i[4],i[5],i[6]).length(),o=Vi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),t.x=i[12],t.y=i[13],t.z=i[14],ln.copy(this);const c=1/s,h=1/a,u=1/o;return ln.elements[0]*=c,ln.elements[1]*=c,ln.elements[2]*=c,ln.elements[4]*=h,ln.elements[5]*=h,ln.elements[6]*=h,ln.elements[8]*=u,ln.elements[9]*=u,ln.elements[10]*=u,e.setFromRotationMatrix(ln),n.x=s,n.y=a,n.z=o,this}makePerspective(t,e,n,i,s,a,o=Qe,l=!1){const c=this.elements,h=2*s/(e-t),u=2*s/(n-i),d=(e+t)/(e-t),f=(n+i)/(n-i);let m,_;if(l)m=s/(a-s),_=a*s/(a-s);else if(o===Qe)m=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===fs)m=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);
vendor: 4,233 bytes, line 5
5return c[0]=h,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,n,i,s,a,o=Qe,l=!1){const c=this.elements,h=2/(e-t),u=2/(n-i),d=-(e+t)/(e-t),f=-(n+i)/(n-i);let m,_;if(l)m=1/(a-s),_=a/(a-s);else if(o===Qe)m=-2/(a-s),_=-(a+s)/(a-s);else if(o===fs)m=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=h,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=m,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Vi=new C,ln=new Ot,Fp=new C(0,0,0),Op=new C(1,1,1),Xn=new C,wr=new C,$e=new C,Xc=new Ot,qc=new qe;class tn{constructor(t=0,e=0,n=0,i=tn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(e){case"XYZ":this._y=Math.asin(Nt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Nt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Nt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Xc.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Xc,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return qc.setFromEuler(this),this.setFromQuaternion(qc,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}tn.DEFAULT_ORDER="XYZ";class go{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let Bp=0;const Yc=new C,Hi=new qe,Rn=new Ot,Cr=new C,ws=new C,zp=new C,kp=new qe,Zc=new C(1,0,0),Jc=new C(0,1,0),$c=new C(0,0,1),Kc={type:"added"},Vp={type:"removed"},Gi={type:"childadded",child:null},Ko={type:"childremoved",child:null};
vendor: 5,360 bytes, line 5
5class ee extends En{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Bp++}),this.uuid=je(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ee.DEFAULT_UP.clone();const t=new C,e=new tn,n=new qe,i=new C(1,1,1);function s(){n.setFromEuler(e,!1)}function a(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ot},normalMatrix:{value:new Ht}}),this.matrix=new Ot,this.matrixWorld=new Ot,this.matrixAutoUpdate=ee.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ee.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new go,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Hi.setFromAxisAngle(t,e),this.quaternion.multiply(Hi),this}rotateOnWorldAxis(t,e){return Hi.setFromAxisAngle(t,e),this.quaternion.premultiply(Hi),this}rotateX(t){return this.rotateOnAxis(Zc,t)}rotateY(t){return this.rotateOnAxis(Jc,t)}rotateZ(t){return this.rotateOnAxis($c,t)}translateOnAxis(t,e){return Yc.copy(t).applyQuaternion(this.quaternion),this.position.add(Yc.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Zc,t)}translateY(t){return this.translateOnAxis(Jc,t)}translateZ(t){return this.translateOnAxis($c,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Rn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Cr.copy(t):Cr.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),ws.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Rn.lookAt(ws,Cr,this.up):Rn.lookAt(Cr,ws,this.up),this.quaternion.setFromRotationMatrix(Rn),i&&(Rn.extractRotation(i.matrixWorld),Hi.setFromRotationMatrix(Rn),this.quaternion.premultiply(Hi.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Kc),Gi.child=t,this.dispatchEvent(Gi),Gi.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Vp),Ko.child=t,this.dispatchEvent(Ko),Ko.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Rn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Rn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Rn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Kc),Gi.child=t,this.dispatchEvent(Gi),Gi.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ws,t,zp),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ws,kp,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 11,944 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c<h;c++){const u=l[c];s(t.shapes,u)}else s(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(t.materials,this.material[l]));i.material=o}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(t.animations,l))}}if(e){const o=a(t.geometries),l=a(t.materials),c=a(t.textures),h=a(t.images),u=a(t.shapes),d=a(t.skeletons),f=a(t.animations),m=a(t.nodes);o.length>0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),m.length>0&&(n.nodes=m)}return n.object=i,n;function a(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){const i=t.children[n];this.add(i.clone())}return this}}ee.DEFAULT_UP=new C(0,1,0);ee.DEFAULT_MATRIX_AUTO_UPDATE=!0;ee.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const cn=new C,In=new C,Qo=new C,Pn=new C,Wi=new C,Xi=new C,Qc=new C,jo=new C,tl=new C,el=new C,nl=new te,il=new te,sl=new te;class We{constructor(t=new C,e=new C,n=new C){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),cn.subVectors(t,e),i.cross(cn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){cn.subVectors(i,e),In.subVectors(n,e),Qo.subVectors(t,e);const a=cn.dot(cn),o=cn.dot(In),l=cn.dot(Qo),c=In.dot(In),h=In.dot(Qo),u=a*c-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(c*l-o*h)*d,m=(a*h-o*l)*d;return s.set(1-f-m,m,f)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Pn)===null?!1:Pn.x>=0&&Pn.y>=0&&Pn.x+Pn.y<=1}static getInterpolation(t,e,n,i,s,a,o,l){return this.getBarycoord(t,e,n,i,Pn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Pn.x),l.addScaledVector(a,Pn.y),l.addScaledVector(o,Pn.z),l)}static getInterpolatedAttribute(t,e,n,i,s,a){return nl.setScalar(0),il.setScalar(0),sl.setScalar(0),nl.fromBufferAttribute(t,e),il.fromBufferAttribute(t,n),sl.fromBufferAttribute(t,i),a.setScalar(0),a.addScaledVector(nl,s.x),a.addScaledVector(il,s.y),a.addScaledVector(sl,s.z),a}static isFrontFacing(t,e,n,i){return cn.subVectors(n,e),In.subVectors(t,e),cn.cross(In).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return cn.subVectors(this.c,this.b),In.subVectors(this.a,this.b),cn.cross(In).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return We.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return We.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return We.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return We.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return We.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,s=this.c;let a,o;Wi.subVectors(i,n),Xi.subVectors(s,n),jo.subVectors(t,n);const l=Wi.dot(jo),c=Xi.dot(jo);if(l<=0&&c<=0)return e.copy(n);tl.subVectors(t,i);const h=Wi.dot(tl),u=Xi.dot(tl);if(h>=0&&u<=h)return e.copy(i);const d=l*u-h*c;if(d<=0&&l>=0&&h<=0)return a=l/(l-h),e.copy(n).addScaledVector(Wi,a);el.subVectors(t,s);const f=Wi.dot(el),m=Xi.dot(el);if(m>=0&&f<=m)return e.copy(s);const _=f*c-l*m;if(_<=0&&c>=0&&m<=0)return o=c/(c-m),e.copy(n).addScaledVector(Xi,o);const g=h*m-f*u;if(g<=0&&u-h>=0&&f-m>=0)return Qc.subVectors(s,i),o=(u-h)/(u-h+(f-m)),e.copy(i).addScaledVector(Qc,o);const p=1/(g+_+d);return a=_*p,o=d*p,e.copy(n).addScaledVector(Wi,a).addScaledVector(Xi,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const cd={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},qn={h:0,s:0,l:0},Rr={h:0,s:0,l:0};function rl(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}class xt{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){const i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ge){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Kt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=Kt.workingColorSpace){return this.r=t,this.g=e,this.b=n,Kt.colorSpaceToWorking(this,i),this}
vendor: 4,416 bytes, line 5
5setHSL(t,e,n,i=Kt.workingColorSpace){if(t=rc(t,1),e=Nt(e,0,1),n=Nt(n,0,1),e===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+e):n+e-n*e,a=2*n-s;this.r=rl(a,s,t+1/3),this.g=rl(a,s,t),this.b=rl(a,s,t-1/3)}return Kt.colorSpaceToWorking(this,i),this}setStyle(t,e=Ge){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const a=i[1],o=i[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,e);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,e);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,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[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,e);if(a===6)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ge){const n=cd[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=On(t.r),this.g=On(t.g),this.b=On(t.b),this}copyLinearToSRGB(t){return this.r=ls(t.r),this.g=ls(t.g),this.b=ls(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ge){return Kt.workingToColorSpace(Re.copy(this),t),Math.round(Nt(Re.r*255,0,255))*65536+Math.round(Nt(Re.g*255,0,255))*256+Math.round(Nt(Re.b*255,0,255))}getHexString(t=Ge){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Kt.workingColorSpace){Kt.workingToColorSpace(Re.copy(this),e);const n=Re.r,i=Re.g,s=Re.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let l,c;const h=(o+a)/2;if(o===a)l=0,c=0;else{const u=a-o;switch(c=h<=.5?u/(a+o):u/(2-a-o),a){case n:l=(i-s)/u+(i<s?6:0);break;case i:l=(s-n)/u+2;break;case s:l=(n-i)/u+4;break}l/=6}return t.h=l,t.s=c,t.l=h,t}getRGB(t,e=Kt.workingColorSpace){return Kt.workingToColorSpace(Re.copy(this),e),t.r=Re.r,t.g=Re.g,t.b=Re.b,t}getStyle(t=Ge){Kt.workingToColorSpace(Re.copy(this),t);const e=Re.r,n=Re.g,i=Re.b;return t!==Ge?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(t,e,n){return this.getHSL(qn),this.setHSL(qn.h+t,qn.s+e,qn.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(qn),t.getHSL(Rr);const n=Xs(qn.h,Rr.h,e),i=Xs(qn.s,Rr.s,e),s=Xs(qn.l,Rr.l,e);return this.setHSL(n,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*i,this.g=s[1]*e+s[4]*n+s[7]*i,this.b=s[2]*e+s[5]*n+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Re=new xt;xt.NAMES=cd;let Hp=0;
vendor: 1,792 bytes, line 5
5class Le extends En{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Hp++}),this.uuid=je(),this.name="",this.type="Material",this.blending=Ai,this.side=Bn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ga,this.blendDst=_a,this.blendEquation=$n,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new xt(0,0,0),this.blendAlpha=0,this.depthFunc=Ri,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ol,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yi,this.stencilZFail=yi,this.stencilZPass=yi,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.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];if(i===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 13,049 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ai&&(n.blending=this.blending),this.side!==Bn&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==ga&&(n.blendSrc=this.blendSrc),this.blendDst!==_a&&(n.blendDst=this.blendDst),this.blendEquation!==$n&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ri&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Ol&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yi&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(e){const s=i(t.textures),a=i(t.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(e!==null){const i=e.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=e[s].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class ei extends Le{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xt(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 tn,this.combine=ur,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Un=Gp();function Gp(){const r=new ArrayBuffer(4),t=new Float32Array(r),e=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function He(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Nt(r,-65504,65504),Un.floatView[0]=r;const t=Un.uint32View[0],e=t>>23&511;return Un.baseTable[e]+((t&8388607)>>Un.shiftTable[e])}function Os(r){const t=r>>10;return Un.uint32View[0]=Un.mantissaTable[Un.offsetTable[t]+(r&1023)]+Un.exponentTable[t],Un.floatView[0]}class Wp{static toHalfFloat(t){return He(t)}static fromHalfFloat(t){return Os(t)}}const ve=new C,Ir=new Q;let Xp=0;class oe{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Xp++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=er,this.updateRanges=[],this.gpuType=Xe,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;
vendor: 4,753 bytes, line 5
5for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)Ir.fromBufferAttribute(this,e),Ir.applyMatrix3(t),this.setXY(e,Ir.x,Ir.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyMatrix3(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyMatrix4(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.applyNormalMatrix(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ve.fromBufferAttribute(this,e),ve.transformDirection(t),this.setXYZ(e,ve.x,ve.y,ve.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Fe(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Wt(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Fe(e,this.array)),e}setX(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Fe(e,this.array)),e}setY(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Fe(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Fe(e,this.array)),e}setW(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array),i=Wt(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array),i=Wt(i,this.array),s=Wt(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==er&&(t.usage=this.usage),t}}class qp extends oe{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Yp extends oe{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class Zp extends oe{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class Jp extends oe{constructor(t,e,n){super(new Int16Array(t),e,n)}}class oc extends oe{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class $p extends oe{constructor(t,e,n){super(new Int32Array(t),e,n)}}class lc extends oe{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Kp extends oe{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=Os(this.array[t*this.itemSize]);return this.normalized&&(e=Fe(e,this.array)),e}setX(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize]=He(e),this}getY(t){let e=Os(this.array[t*this.itemSize+1]);return this.normalized&&(e=Fe(e,this.array)),e}setY(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+1]=He(e),this}getZ(t){let e=Os(this.array[t*this.itemSize+2]);return this.normalized&&(e=Fe(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+2]=He(e),this}getW(t){let e=Os(this.array[t*this.itemSize+3]);return this.normalized&&(e=Fe(e,this.array)),e}setW(t,e){return this.normalized&&(e=Wt(e,this.array)),this.array[t*this.itemSize+3]=He(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array)),this.array[t+0]=He(e),this.array[t+1]=He(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array),i=Wt(i,this.array)),this.array[t+0]=He(e),this.array[t+1]=He(n),this.array[t+2]=He(i),this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array),i=Wt(i,this.array),s=Wt(s,this.array)),this.array[t+0]=He(e),this.array[t+1]=He(n),this.array[t+2]=He(i),this.array[t+3]=He(s),this}}class Mt extends oe{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Qp=0;const sn=new Ot,al=new ee,qi=new C,Ke=new Pe,Cs=new Pe,Ee=new C;
vendor: 6,524 bytes, line 5
5class Xt extends En{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qp++}),this.uuid=je(),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(t){return Array.isArray(t)?this.index=new(ad(t)?lc:oc)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ht().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return sn.makeRotationFromQuaternion(t),this.applyMatrix4(sn),this}rotateX(t){return sn.makeRotationX(t),this.applyMatrix4(sn),this}rotateY(t){return sn.makeRotationY(t),this.applyMatrix4(sn),this}rotateZ(t){return sn.makeRotationZ(t),this.applyMatrix4(sn),this}translate(t,e,n){return sn.makeTranslation(t,e,n),this.applyMatrix4(sn),this}scale(t,e,n){return sn.makeScale(t,e,n),this.applyMatrix4(sn),this}lookAt(t){return al.lookAt(t),al.updateMatrix(),this.applyMatrix4(al.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(qi).negate(),this.translate(qi.x,qi.y,qi.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const n=[];for(let i=0,s=t.length;i<s;i++){const a=t[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Mt(n,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Pe);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){const s=e[n];Ke.setFromBufferAttribute(s),this.morphTargetsRelative?(Ee.addVectors(this.boundingBox.min,Ke.min),this.boundingBox.expandByPoint(Ee),Ee.addVectors(this.boundingBox.max,Ke.max),this.boundingBox.expandByPoint(Ee)):(this.boundingBox.expandByPoint(Ke.min),this.boundingBox.expandByPoint(Ke.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new we);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new C,1/0);return}if(t){const n=this.boundingSphere.center;if(Ke.setFromBufferAttribute(t),e)for(let s=0,a=e.length;s<a;s++){const o=e[s];Cs.setFromBufferAttribute(o),this.morphTargetsRelative?(Ee.addVectors(Ke.min,Cs.min),Ke.expandByPoint(Ee),Ee.addVectors(Ke.max,Cs.max),Ke.expandByPoint(Ee)):(Ke.expandByPoint(Cs.min),Ke.expandByPoint(Cs.max))}Ke.getCenter(n);let i=0;for(let s=0,a=t.count;s<a;s++)Ee.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(Ee));if(e)for(let s=0,a=e.length;s<a;s++){const o=e[s],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Ee.fromBufferAttribute(o,c),l&&(qi.fromBufferAttribute(t,c),Ee.add(qi)),i=Math.max(i,n.distanceToSquared(Ee))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new oe(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let I=0;I<n.count;I++)o[I]=new C,l[I]=new C;const c=new C,h=new C,u=new C,d=new Q,f=new Q,m=new Q,_=new C,g=new C;function p(I,b,S){c.fromBufferAttribute(n,I),h.fromBufferAttribute(n,b),u.fromBufferAttribute(n,S),d.fromBufferAttribute(s,I),f.fromBufferAttribute(s,b),m.fromBufferAttribute(s,S),h.sub(c),u.sub(c),f.sub(d),m.sub(d);const L=1/(f.x*m.y-m.x*f.y);isFinite(L)&&(_.copy(h).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(L),g.copy(u).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(L),o[I].add(_),o[b].add(_),o[S].add(_),l[I].add(g),l[b].add(g),l[S].add(g))}let y=this.groups;y.length===0&&(y=[{start:0,count:t.count}]);for(let I=0,b=y.length;I<b;++I){const S=y[I],L=S.start,F=S.count;for(let z=L,G=L+F;z<G;z+=3)p(t.getX(z+0),t.getX(z+1),t.getX(z+2))}const v=new C,x=new C,A=new C,T=new C;function R(I){A.fromBufferAttribute(i,I),T.copy(A);const b=o[I];v.copy(b),v.sub(A.multiplyScalar(A.dot(b))).normalize(),x.crossVectors(T,b);const L=x.dot(l[I])<0?-1:1;a.setXYZW(I,v.x,v.y,v.z,L)}for(let I=0,b=y.length;I<b;++I){const S=y[I],L=S.start,F=S.count;for(let z=L,G=L+F;z<G;z+=3)R(t.getX(z+0)),R(t.getX(z+1)),R(t.getX(z+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new oe(new Float32Array(e.count*3),3),this.setAttribute("normal",n
vendor: 4,485 bytes, line 5
5);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new C,s=new C,a=new C,o=new C,l=new C,c=new C,h=new C,u=new C;if(t)for(let d=0,f=t.count;d<f;d+=3){const m=t.getX(d+0),_=t.getX(d+1),g=t.getX(d+2);i.fromBufferAttribute(e,m),s.fromBufferAttribute(e,_),a.fromBufferAttribute(e,g),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),o.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(m,o.x,o.y,o.z),n.setXYZ(_,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(let d=0,f=e.count;d<f;d+=3)i.fromBufferAttribute(e,d+0),s.fromBufferAttribute(e,d+1),a.fromBufferAttribute(e,d+2),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Ee.fromBufferAttribute(t,e),Ee.normalize(),t.setXYZ(e,Ee.x,Ee.y,Ee.z)}toNonIndexed(){function t(o,l){const c=o.array,h=o.itemSize,u=o.normalized,d=new c.constructor(l.length*h);let f=0,m=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*h;for(let p=0;p<h;p++)d[m++]=c[f++]}return new oe(d,h,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Xt,n=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=t(l,n);e.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let h=0,u=c.length;h<u;h++){const d=c[h],f=t(d,n);l.push(f)}e.morphAttributes[o]=l}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const l in n){const c=n[l];t.data.attributes[l]=c.toJSON(t.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u];h.push(f.toJSON(t.data))}h.length>0&&(i[l]=h,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;n!==null&&this.setIndex(n.clone());const i=t.attributes;for(const c in i){const h=i[c];this.setAttribute(c,h.clone(e))}const s=t.morphAttributes;for(const c in s){const h=[],u=s[c];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let c=0,h=a.length;c<h;c++){const u=a[c];this.addGroup(u.start,u.count,u.materialIndex)}const o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const jc=new Ot,li=new ys,Pr=new we,th=new C,Lr=new C,Dr=new C,Ur=new C,ol=new C,Nr=new C,eh=new C,Fr=new C;class ye extends ee{constructor(t=new Xt,e=new ei){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>
vendor: 8,953 bytes, lines 5-9
50){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(s&&o){Nr.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const h=o[l],u=s[l];h!==0&&(ol.fromBufferAttribute(u,t),a?Nr.addScaledVector(ol,h):Nr.addScaledVector(ol.sub(e),h))}e.add(Nr)}return e}raycast(t,e){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Pr.copy(n.boundingSphere),Pr.applyMatrix4(s),li.copy(t.ray).recast(t.near),!(Pr.containsPoint(li.origin)===!1&&(li.intersectSphere(Pr,th)===null||li.origin.distanceToSquared(th)>(t.far-t.near)**2))&&(jc.copy(s).invert(),li.copy(t.ray).applyMatrix4(jc),!(n.boundingBox!==null&&li.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,li)))}_computeIntersections(t,e,n){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],y=Math.max(g.start,f.start),v=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,A=v;x<A;x+=3){const T=o.getX(x),R=o.getX(x+1),I=o.getX(x+2);i=Or(this,p,t,n,c,h,u,T,R,I),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,e.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const y=o.getX(g),v=o.getX(g+1),x=o.getX(g+2);i=Or(this,a,t,n,c,h,u,y,v,x),i&&(i.faceIndex=Math.floor(g/3),e.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let m=0,_=d.length;m<_;m++){const g=d[m],p=a[g.materialIndex],y=Math.max(g.start,f.start),v=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let x=y,A=v;x<A;x+=3){const T=x,R=x+1,I=x+2;i=Or(this,p,t,n,c,h,u,T,R,I),i&&(i.faceIndex=Math.floor(x/3),i.face.materialIndex=g.materialIndex,e.push(i))}}else{const m=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=m,p=_;g<p;g+=3){const y=g,v=g+1,x=g+2;i=Or(this,a,t,n,c,h,u,y,v,x),i&&(i.faceIndex=Math.floor(g/3),e.push(i))}}}}function jp(r,t,e,n,i,s,a,o){let l;if(t.side===Be?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,t.side===Bn,o),l===null)return null;Fr.copy(o),Fr.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(Fr);return c<e.near||c>e.far?null:{distance:c,point:Fr.clone(),object:r}}function Or(r,t,e,n,i,s,a,o,l,c){r.getVertexPosition(o,Lr),r.getVertexPosition(l,Dr),r.getVertexPosition(c,Ur);const h=jp(r,t,e,n,Lr,Dr,Ur,eh);if(h){const u=new C;We.getBarycoord(eh,Lr,Dr,Ur,u),i&&(h.uv=We.getInterpolatedAttribute(i,o,l,c,u,new Q)),s&&(h.uv1=We.getInterpolatedAttribute(s,o,l,c,u,new Q)),a&&(h.normal=We.getInterpolatedAttribute(a,o,l,c,u,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:l,c,normal:new C,materialIndex:0};We.getNormal(Lr,Dr,Ur,d.normal),h.face=d,h.barycoord=u}return h}class Di extends Xt{constructor(t=1,e=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],h=[],u=[];let d=0,f=0;m("z","y","x",-1,-1,n,e,t,a,s,0),m("z","y","x",1,-1,n,e,-t,a,s,1),m("x","z","y",1,1,t,n,e,i,a,2),m("x","z","y",1,-1,t,n,-e,i,a,3),m("x","y","z",1,-1,t,e,n,i,s,4),m("x","y","z",-1,-1,t,e,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new Mt(c,3)),this.setAttribute("normal",new Mt(h,3)),this.setAttribute("uv",new Mt(u,2));function m(_,g,p,y,v,x,A,T,R,I,b){const S=x/R,L=A/I,F=x/2,z=A/2,G=T/2,q=R+1,W=I+1;let nt=0,H=0;const ut=new C;for(let _t=0;_t<W;_t++){const St=_t*L-z;for(let Gt=0;Gt<q;Gt++){const $t=Gt*S-F;ut[_]=$t*y,ut[g]=St*v,ut[p]=G,c.push(ut.x,ut.y,ut.z),ut[_]=0,ut[g]=0,ut[p]=T>0?1:-1,h.push(ut.x,ut.y,ut.z),u.push(Gt/R),u.push(1-_t/I),nt+=1}}for(let _t=0;_t<I;_t++)for(let St=0;St<R;St++){const Gt=d+St+q*_t,$t=d+St+q*(_t+1),se=d+(St+1)+q*(_t+1),Qt=d+(St+1)+q*_t;l.push(Gt,$t,Qt),l.push($t,se,Qt),H+=6}o.addGroup(f,H,b),f+=H,d+=nt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Di(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function ms(r){const t={};for(const e in r){t[e]={};for(const n in r[e]){const i=r[e][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone():Array.isArray(i)?t[e][n]=i.slice():t[e][n]=i}}return t}function Ne(r){const t={};for(let e=0;e<r.length;e++){const n=ms(r[e]);for(const i in n)t[i]=n[i]}return t}function tm(r){const t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function hd(r){const t=r.getRenderTarget();return t===null?r.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Kt.workingColorSpace}const ud={clone:ms,merge:Ne};var em=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,nm=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class fn extends Le{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=em,this.fragmentShader=nm,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,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ms(t.uniforms),this.uniformsGroups=tm(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?e.uniforms[i]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[i]={type:"m4",value:a.toArray()}:e.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class _o extends ee{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ot,this.projectionMatrix=new Ot,this.projectionMatrixInverse=new Ot,this.coordinateSystem=Qe,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Yn=new C,nh=new Q,ih=new Q;class Te extends _o{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=ps*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(wi*.5*this.fov);return .5*this.getFilmHeight()/t}
vendor: 4,175 bytes, line 9
9getEffectiveFOV(){return ps*2*Math.atan(Math.tan(wi*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Yn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Yn.x,Yn.y).multiplyScalar(-t/Yn.z),Yn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Yn.x,Yn.y).multiplyScalar(-t/Yn.z)}getViewSize(t,e){return this.getViewBounds(t,nh,ih),e.subVectors(ih,nh)}setViewOffset(t,e,n,i,s,a){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(wi*.5*this.fov)/this.zoom,n=2*e,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,e-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(s+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Yi=-90,Zi=1;class dd extends ee{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Te(Yi,Zi,t,e);i.layers=this.layers,this.add(i);const s=new Te(Yi,Zi,t,e);s.layers=this.layers,this.add(s);const a=new Te(Yi,Zi,t,e);a.layers=this.layers,this.add(a);const o=new Te(Yi,Zi,t,e);o.layers=this.layers,this.add(o);const l=new Te(Yi,Zi,t,e);l.layers=this.layers,this.add(l);const c=new Te(Yi,Zi,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,s,a,o,l]=e;for(const c of e)this.remove(c);if(t===Qe)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.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(t===fs)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.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: "+t);for(const c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,h]=this.children,u=t.getRenderTarget(),d=t.getActiveCubeFace(),f=t.getActiveMipmapLevel(),m=t.xr.enabled;t.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,s),t.setRenderTarget(n,1,i),t.render(e,a),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,l),t.setRenderTarget(n,4,i),t.render(e,c),n.texture.generateMipmaps=_,t.setRenderTarget(n,5,i),t.render(e,h),t.setRenderTarget(u,d,f),t.xr.enabled=m,n.texture.needsPMREMUpdate=!0}}class fr extends _e{constructor(t=[],e=zn,n,i,s,a,o,l,c,h){super(t,e,n,i,s,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class fd extends bn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new fr(i),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace
vendor: 23,425 bytes, lines 9-44
9=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
10
11				varying vec3 vWorldDirection;
12
13				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
14
15					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
16
17				}
18
19				void main() {
20
21					vWorldDirection = transformDirection( position, modelMatrix );
22
23					#include <begin_vertex>
24					#include <project_vertex>
25
26				}
27			`,fragmentShader:`
28
29				uniform sampler2D tEquirect;
30
31				varying vec3 vWorldDirection;
32
33				#include <common>
34
35				void main() {
36
37					vec3 direction = normalize( vWorldDirection );
38
39					vec2 sampleUV = equirectUv( direction );
40
41					gl_FragColor = texture2D( tEquirect, sampleUV );
42
43				}
44			`},i=new Di(5,5,5),s=new fn({name:"CubemapFromEquirect",uniforms:ms(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Be,blending:Nn});s.uniforms.tEquirect.value=e;const a=new ye(i,s),o=e.minFilter;return e.minFilter===yn&&(e.minFilter=Me),new dd(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e=!0,n=!0,i=!0){const s=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(s)}}class as extends ee{constructor(){super(),this.isGroup=!0,this.type="Group"}}const im={type:"move"};class pa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new as,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new as,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new C,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new C),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new as,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new C,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new C),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(c&&t.hand){a=!0;for(const _ of t.hand.values()){const g=e.getJointPose(_,n),p=this._getHandJoint(c,_);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,m=.005;c.inputState.pinching&&d>f+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&d<=f-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(s=e.getPose(t.gripSpace,n),s!==null&&(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&&(i=e.getPose(t.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(im)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const n=new as;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class xo{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new xt(t),this.density=e}clone(){return new xo(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class vo{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new xt(t),this.near=e,this.far=n}clone(){return new vo(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class pd extends ee{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 tn,this.environmentIntensity=1,this.environmentRotation=new tn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class yo{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=er,this.updateRanges=[],this.version=0,this.uuid=je()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,s=this.stride;i<s;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=je()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=je()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ue=new C;class Pi{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ue.fromBufferAttribute(this,e),Ue.applyMatrix4(t),this.setXYZ(e,Ue.x,Ue.y,Ue.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ue.fromBufferAttribute(this,e),Ue.applyNormalMatrix(t),this.setXYZ(e,Ue.x,Ue.y,Ue.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ue.fromBufferAttribute(this,e),Ue.transformDirection(t),this.setXYZ(e,Ue.x,Ue.y,Ue.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Fe(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Wt(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Wt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Wt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Wt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Wt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Fe(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Fe(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Fe(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Fe(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array),i=Wt(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=Wt(e,this.array),n=Wt(n,this.array),i=Wt(i,this.array),s=Wt(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=s,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[i+s])}return new oe(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Pi(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)e.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class cc extends Le{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new xt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Ji;const Rs=new C,$i=new C,Ki=new C,Qi=new Q,Is=new Q,md=new Ot,Br=new C,Ps=new C,zr=new C,sh=new Q,ll=new Q,rh=new Q;class gd extends ee{constructor(t=new cc){if(super(),this.isSprite=!0,this.type="Sprite",Ji===void 0){Ji=new Xt;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new yo(e,5);Ji.setIndex([0,1,2,0,2,3]),Ji.setAttribute("position",new Pi(n,3,0,!1)),Ji.setAttribute("uv",new Pi(n,2,3,!1))}this.geometry=Ji,this.material=t,this.center=new Q(.5,.5),this.count=1}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),$i.setFromMatrixScale(this.matrixWorld),md.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ki.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&$i.multiplyScalar(-Ki.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;kr(Br.set(-.5,-.5,0),Ki,a,$i,i,s),kr(Ps.set(.5,-.5,0),Ki,a,$i,i,s),kr(zr.set(.5,.5,0),Ki,a,$i,i,s),sh.set(0,0),ll.set(1,0),rh.set(1,1);let o=t.ray.intersectTriangle(Br,Ps,zr,!1,Rs);if(o===null&&(kr(Ps.set(-.5,.5,0),Ki,a,$i,i,s),ll.set(0,1),o=t.ray.intersectTriangle(Br,zr,Ps,!1,Rs),o===null))return;const l=t.ray.origin.distanceTo(Rs);l<t.near||l>t.far||e.push({distance:l,point:Rs.clone(),uv:We.getInterpolation(Rs,Br,Ps,zr,sh,ll,rh,new Q),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function kr(r,t,e,n,i,s){Qi.subVectors(r,e).addScalar(.5).multiply(n),i!==void 0?(Is.x=s*Qi.x-i*Qi.y,Is.y=i*Qi.x+s*Qi.y):Is.copy(Qi),r.copy(t),r.x+=Is.x,r.y+=Is.y,r.applyMatrix4(md)}const Vr=new C,ah=new C;class _d extends ee{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,i=e.length;n<i;n++){const s=e[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let s;for(s=0;s<i.length&&!(e<i[s].distance);s++);return i.splice(s,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){const i=e.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let s=e[n].distance;if(e[n].object.visible&&(s-=s*e[n].hysteresis),t<s)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Vr.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(Vr);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Vr.setFromMatrixPosition(t.matrixWorld),ah.setFromMatrixPosition(this.matrixWorld);const n=Vr.distanceTo(ah)/t.zoom;e[0].object.visible=!0;let i,s;for(i=1,s=e.length;i<s;i++){let a=e[i].distance;if(e[i].object.visible&&(a-=a*e[i].hysteresis),n>=a)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const a=n[i];e.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return e}}const oh=new C,lh=new te,ch=new te,sm=new C,hh=new Ot,Hr=new C,cl=new we,uh=new Ot,hl=new ys;class xd extends ye{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Fl,this.bindMatrix=new Ot,this.bindMatrixInverse=new Ot,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;this.boundingBox===null&&(this.boundingBox=new Pe),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,Hr),this.boundingBox.expandByPoint(Hr)}computeBoundingSphere(){const t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new we),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let n=0;n<e.count;n++)this.getVertexPosition(n,Hr),this.boundingSphere.expandByPoint(Hr)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),cl.copy(this.boundingSphere),cl.applyMatrix4(i),t.ray.intersectsSphere(cl)!==!1&&(uh.copy(i).invert(),hl.copy(t.ray).applyMatrix4(uh),!(this.boundingBox!==null&&hl.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,hl)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new te,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const s=1/t.manhattanLength();s!==1/0?t.multiplyScalar(s):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Fl?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===qu?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;lh.fromBufferAttribute(i.attributes.skinIndex,t),ch.fromBufferAttribute(i.attributes.skinWeight,t),oh.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let s=0;s<4;s++){const a=ch.getComponent(s);if(a!==0){const o=lh.getComponent(s);hh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(sm.copy(oh).applyMatrix4(hh),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}class hc extends ee{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Sn extends _e{constructor(t=null,e=1,n=1,i,s,a,o,l,c=Ae,h=Ae,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const dh=new Ot,rm=new Ot;class Mo{constructor(t=[],e=[]){this.uuid=je(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ot)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const n=new Ot;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const n=this.bones[t];n&&(n.parent&&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 t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=t.length;s<a;s++){const o=t[s]?t[s].matrixWorld:rm;dh.multiplyMatrices(o,e[s]),dh.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Mo(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Sn(e,t,t,Oe,Xe);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const s=t.bones[n];let a=e[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new hc),this.bones.push(a),this.boneInverses.push(new Ot().fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,s=e.length;i<s;i++){const a=e[i];t.bones.push(a.uuid);const o=n[i];t.boneInverses.push(o.toArray())}return t}}class gs extends oe{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const ji=new Ot,fh=new Ot,Gr=[],ph=new Pe,am=new Ot,Ls=new ye,Ds=new we;class vd extends ye{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new gs(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,am)}computeBoundingBox(){const t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Pe),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,ji),ph.copy(t.boundingBox).applyMatrix4(ji),this.boundingBox.union(ph)}computeBoundingSphere(){const t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new we),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,ji),Ds.copy(t.boundingSphere).applyMatrix4(ji),this.boundingSphere.union(Ds)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=t*s+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Ls.geometry=this.geometry,Ls.material=this.material,Ls.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ds.
vendor: 4,089 bytes, line 44
44copy(this.boundingSphere),Ds.applyMatrix4(n),t.ray.intersectsSphere(Ds)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,ji),fh.multiplyMatrices(n,ji),Ls.matrixWorld=fh,Ls.raycast(t,Gr);for(let a=0,o=Gr.length;a<o;a++){const l=Gr[a];l.instanceId=s,l.object=this,e.push(l)}Gr.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new gs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Sn(new Float32Array(i*this.count),i,this.count,co,Xe));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<n.length;c++)a+=n[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*t;s[l]=o,s.set(n,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const ul=new C,om=new C,lm=new Ht;class Jn{constructor(t=new C(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=ul.subVectors(n,e).cross(om.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(ul),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const s=-(t.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||lm.getNormalMatrix(t),i=this.coplanarPoint(ul).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ci=new we,cm=new Q(.5,.5),Wr=new C;class Ms{constructor(t=new Jn,e=new Jn,n=new Jn,i=new Jn,s=new Jn,a=new Jn){this.planes=[t,e,n,i,s,a]}set(t,e,n,i,s,a){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Qe,n=!1){const i=this.planes,s=t.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],u=s[5],d=s[6],f=s[7],m=s[8],_=s[9],g=s[10],p=s[11],y=s[12],v=s[13],x=s[14],A=s[15];if(i[0].setComponents(c-a,f-h,p-m,A-y).normalize(),i[1].setComponents(c+a,f+h,p+m,A+y).normalize(),i[2].setComponents(c+o,f+u,p+_,A+v).normalize(),i[3].setComponents(c-o,f-u,p-_,A-v).normalize(),n)i[4].setComponents(l,d,g,x).normalize(),i[5].setComponents(c-l,f-d,p-g,A-x).normalize();else if(i[4].setComponents(c-l,f-d,p-g,A-x).normalize(),e===Qe)i[5].setComponents(c+l,f+d,p+g,A+x).normalize();else if(e===fs)i[5].setComponents(l,d,g,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ci.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;
vendor: 4,883 bytes, line 44
44e.boundingSphere===null&&e.computeBoundingSphere(),ci.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ci)}intersectsSprite(t){ci.center.set(0,0,0);const e=cm.distanceTo(t.center);return ci.radius=.7071067811865476+e,ci.applyMatrix4(t.matrixWorld),this.intersectsSphere(ci)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let s=0;s<6;s++)if(e[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Wr.x=i.normal.x>0?t.max.x:t.min.x,Wr.y=i.normal.y>0?t.max.y:t.min.y,Wr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Wr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const gn=new Ot,_n=new Ms;class So{constructor(){this.coordinateSystem=Qe}intersectsObject(t,e){if(!e.isArrayCamera||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(gn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),_n.setFromProjectionMatrix(gn,i.coordinateSystem,i.reversedDepth),_n.intersectsObject(t))return!0}return!1}intersectsSprite(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(gn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),_n.setFromProjectionMatrix(gn,i.coordinateSystem,i.reversedDepth),_n.intersectsSprite(t))return!0}return!1}intersectsSphere(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(gn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),_n.setFromProjectionMatrix(gn,i.coordinateSystem,i.reversedDepth),_n.intersectsSphere(t))return!0}return!1}intersectsBox(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(gn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),_n.setFromProjectionMatrix(gn,i.coordinateSystem,i.reversedDepth),_n.intersectsBox(t))return!0}return!1}containsPoint(t,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let n=0;n<e.cameras.length;n++){const i=e.cameras[n];if(gn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),_n.setFromProjectionMatrix(gn,i.coordinateSystem,i.reversedDepth),_n.containsPoint(t))return!0}return!1}clone(){return new So}}function dl(r,t){return r-t}function hm(r,t){return r.z-t.z}function um(r,t){return t.z-r.z}class dm{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const Ve=new Ot,fm=new xt(1,1,1),mh=new Ms,pm=new So,Xr=new Pe,hi=new we,Us=new C,gh=new C,mm=new C,fl=new dm,Ie=new ye,qr=[];function gm(r,t,e=0){const n=t.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==t.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let a=0;a<n;a++)t.setComponent(s+e,a,r.getComponent(s,a))}else t.array.set(r.array,e*n);t.needsUpdate=!0}function ui(r,t){if(r.constructor!==t.constructor){const e=Math.min(r.length,t.length);for(let n=0;n<e;n++)t[n]=r[n]}else{const e=Math.min(r.length,t.length);t.set(new r.constructor(r.buffer,0,e))}}class yd extends ye{constructor(t,e,n=e*2,i){super(new Xt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let t=Math.sqrt(this._maxInstanceCount*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new Sn(e,t,t,Oe,Xe);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),n=new Sn(e,t,t,dr,kn);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new Sn(e,t,t,Oe,Xe);
44n.colorSpace=Kt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in t.attributes){const a=t.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),u=new oe(h,l,c);e.setAttribute(s,u)}if(t.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new oe(s,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),s=e.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Pe);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(e[n].active===!1)continue;const s=e[n].geometryIndex;this.getMatrixAt(n,Ve),this.getBoundingBoxAt(s,Xr).applyMatrix4(Ve),t.union(Xr)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new we);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(e[n].active===!1)continue;const s=e[n].geometryIndex;this.getMatrixAt(n,Ve),this.getBoundingSphereAt(s,hi).applyMatrix4(Ve),t.union(hi)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:t};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(dl),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Ve.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(fm.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=e===-1?t.getAttribute("position").count:e;const a=t.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(dl),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),a=e.getIndex(),o=this._geometryInfo[t];if(i&&a.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const h in n.attributes){const u=e.getAttribute(h),d=n.getAttribute(h);gm(u,d,l);const f=u.itemSize;
vendor: 10,190 bytes, line 44
44for(let m=u.count,_=c;m<_;m++){const g=l+m;for(let p=0;p<f;p++)d.setComponent(g,p,0)}d.needsUpdate=!0,d.addUpdateRange(l*f,c*f)}if(i){const h=o.indexStart,u=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let d=0;d<a.count;d++)s.setX(h+d,l+a.getX(d));for(let d=a.count,f=u;d<f;d++)s.setX(h+d,l);s.needsUpdate=!0,s.addUpdateRange(h,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,e.boundingBox!==null&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,e.boundingSphere!==null&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||e[t].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===t&&this.deleteInstance(i);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0;const n=this._geometryInfo,i=n.map((a,o)=>o).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),s=this.geometry;for(let a=0,o=n.length;a<o;a++){const l=i[a],c=n[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==e){const{indexStart:h,vertexStart:u,reservedIndexCount:d}=c,f=s.index,m=f.array,_=t-u;for(let g=h;g<h+d;g++)m[g]=m[g]+_;f.array.copyWithin(e,h,h+d),f.addUpdateRange(e,d),c.indexStart=e}e+=c.reservedIndexCount}if(c.vertexStart!==t){const{vertexStart:h,reservedVertexCount:u}=c,d=s.attributes;for(const f in d){const m=d[f],{array:_,itemSize:g}=m;_.copyWithin(t*g,h*g,(h+u)*g),m.addUpdateRange(t*g,u*g)}c.vertexStart=t}t+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart,this._nextIndexStart=s.index?c.indexStart+c.reservedIndexCount:0,this._nextVertexStart=c.vertexStart+c.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(i.boundingBox===null){const s=new Pe,a=n.index,o=n.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let h=l;a&&(h=a.getX(h)),s.expandByPoint(Us.fromBufferAttribute(o,h))}i.boundingBox=s}return e.copy(i.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(i.boundingSphere===null){const s=new we;this.getBoundingBoxAt(t,Xr),Xr.getCenter(s.center);const a=n.index,o=n.attributes.position;let l=0;for(let c=i.start,h=i.start+i.count;c<h;c++){let u=c;a&&(u=a.getX(u)),Us.fromBufferAttribute(o,u),l=Math.max(l,s.center.distanceToSquared(Us))}s.radius=Math.sqrt(l),i.boundingSphere=s}return e.copy(i.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);const n=this._matricesTexture,i=this._matricesTexture.image.data;return e.toArray(i,t*16),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,t*16)}setColorAt(t,e){return this.validateInstanceId(t),this._colorsTexture===null&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,t*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,t*4)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e?this:(this._instanceInfo[t].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);const n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){const e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(dl);e[e.length-1]===n.length-1;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const i=new Int32Array(t),s=new Int32Array(t);ui(this._multiDrawCounts,i),ui(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=t;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),ui(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ui(o.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),ui(l.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const n=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Xt,this._initializeGeometry(s));const a=this.geometry;s.index&&ui(s.index.array,a.index.array);for(const o in s.attributes)ui(s.attributes[o].array,a.attributes[o].array)}raycast(t,e){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;Ie.material=this.material,Ie.geometry.index=a.index,Ie.geometry.attributes=a.attributes,Ie.geometry.boundingBox===null&&(Ie.geometry.boundingBox=new Pe),Ie.geometry.boundingSphere===null&&(Ie.geometry.boundingSphere=new we);for(let o=0,l=n.length;o<l;o++){if(!n[o].visible||!n[o].active)continue;const c=n[o].geometryIndex,h=i[c];Ie.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,Ie.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Ie.geometry.boundingBox),this.getBoundingSphereAt(c,Ie.geometry.boundingSphere),Ie.raycast(t,qr);for(let u=0,d=qr.length;u<d;u++){const f=qr[u];f.object=this,f.batchId=o,e.push(f)}qr.length=0}Ie.material=null,Ie.geometry.index=null,Ie.geometry.attributes={},Ie.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=t.boundingBox!==null?t.boundingBox.clone():null,this.boundingSphere=t.boundingSphere!==null?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(t,e,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,u=this._geometryInfo,d=this.perObjectFrustumCulled,f=this._indirectTexture,m=f.image.data,_=n.isArrayCamera?pm:mh;d&&!n.isArrayCamera&&(Ve.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),mh.setFromProjectionMatrix(Ve,n.coordinateSystem,n.reversedDepth));let g=0;if(this.sortObjects){Ve.copy(this.matrixWorld).invert(),Us.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ve),gh.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ve);for(let v=0,x=l.length;v<x;v++)if(l[v].visible&&l[v].active){const A=l[v].geometryIndex;this.getMatrixAt(v,Ve),this.getBoundingSphereAt(A,hi).applyMatrix4(Ve);let T=!1;if(d&&(T=!_.intersectsSphere(hi,n)),!T){const R=u[A],I=mm.subVectors(hi.center,Us).dot(gh);fl.push(R.start,R.count,I,v)}}const p=fl.list,y=this.customSort;y===null?p.sort(s.transparent?um:hm):y.call(this,p,n);for(let v=0,x=p.length;v<x;v++){const A=p[v];c[g]=A.start*o,h[g]=A.count,m[g]=A.index,g++}fl.reset()}else for(let p=0,y=l.length;p<y;p++)if(l[p].visible&&l[p].active){const v=l[p].geometryIndex;let x=!1;if(d&&(this.getMatrixAt(p,Ve),this.getBoundingSphereAt(v,hi).applyMatrix4(Ve),x=!_.intersectsSphere(hi,n)),!x){const A=u[v];c[g]=A.start*o,h[g]=A.count,m[g]=p,g++}}f.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,s,a){this.onBeforeRender(t,null,i,s,a)}}class ze extends Le{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new xt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const to=new C,eo=new C,_h=new Ot,Ns=new ys,Yr=new we,pl=new C,xh=new C;
vendor: 4,549 bytes, line 44
44class jn extends ee{constructor(t=new Xt,e=new ze){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[0];for(let i=1,s=e.count;i<s;i++)to.fromBufferAttribute(e,i-1),eo.fromBufferAttribute(e,i),n[i]=n[i-1],n[i]+=to.distanceTo(eo);t.setAttribute("lineDistance",new Mt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,s=t.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Yr.copy(n.boundingSphere),Yr.applyMatrix4(i),Yr.radius+=s,t.ray.intersectsSphere(Yr)===!1)return;_h.copy(i).invert(),Ns.copy(t.ray).applyMatrix4(_h);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const f=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=h.getX(_),y=h.getX(_+1),v=Zr(this,t,Ns,l,p,y,_);v&&e.push(v)}if(this.isLineLoop){const _=h.getX(m-1),g=h.getX(f),p=Zr(this,t,Ns,l,_,g,m-1);p&&e.push(p)}}else{const f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count);for(let _=f,g=m-1;_<g;_+=c){const p=Zr(this,t,Ns,l,_,_+1,_);p&&e.push(p)}if(this.isLineLoop){const _=Zr(this,t,Ns,l,m-1,f,m-1);_&&e.push(_)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Zr(r,t,e,n,i,s,a){const o=r.geometry.attributes.position;if(to.fromBufferAttribute(o,i),eo.fromBufferAttribute(o,s),e.distanceSqToSegment(to,eo,pl,xh)>n)return;pl.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(pl);if(!(c<t.near||c>t.far))return{distance:c,point:xh.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const vh=new C,yh=new C;class Tn extends jn{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,n=[];for(let i=0,s=e.count;i<s;i+=2)vh.fromBufferAttribute(e,i),yh.fromBufferAttribute(e,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+vh.distanceTo(yh);t.setAttribute("lineDistance",new Mt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Md extends jn{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class uc extends Le{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new xt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Mh=new Ot,zl=new ys,Jr=new we,$r=new C;class Sd extends ee{constructor(t=new Xt,e=new uc){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,s=t.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Jr.copy(n.boundingSphere),Jr.applyMatrix4(i),Jr.radius+=s,t.ray.intersectsSphere(Jr)===!1)return;Mh.copy(i).invert(),zl.copy(t.ray).applyMatrix4(Mh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,u=n.attributes.position;if(c!==null){const d=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let m=d,_=f;m<_;m++){const g=c.getX(m);$r.fromBufferAttribute(u,g),Sh($r,g,l,i,t,e,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let m=d,_=f;m<_;m++)$r.fromBufferAttribute(u,m),Sh($r,m,l,i,t,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>
vendor: 4,507 bytes, line 44
440){const i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Sh(r,t,e,n,i,s,a){const o=zl.distanceSqToPoint(r);if(o<e){const l=new C;zl.closestPointToPoint(r,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class bd extends _e{constructor(t,e,n,i,s=Me,a=Me,o,l,c){super(t,e,n,i,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function u(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=t.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;"requestVideoFrameCallback"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class _m extends bd{constructor(t,e,n,i,s,a,o,l){super({},t,e,n,i,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class xm extends _e{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Ae,this.minFilter=Ae,this.generateMipmaps=!1,this.needsUpdate=!0}}class bo extends _e{constructor(t,e,n,i,s,a,o,l,c,h,u,d){super(null,a,o,l,c,h,i,s,u,d),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class vm extends bo{constructor(t,e,n,i,s,a){super(t,e,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=rn,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ym extends bo{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,zn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Mm extends _e{constructor(t,e,n,i,s,a,o,l,c){super(t,e,n,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class dc extends _e{constructor(t,e,n=kn,i,s,a,o=Ae,l=Ae,c,h=us,u=1){if(h!==us&&h!==ds)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:t,height:e,depth:u};super(d,i,s,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new Kn(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class fc extends _e{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class Eo extends Xt{constructor(t=1,e=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:n,radialSegments:i,heightSegments:s},e=Math.max(0,e),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const a=[],o=[],l=[],c=[],h=e/2,u=Math.PI/2*t,d=e,f=2*u+d,m=n*2+s,_=i+1,g=new C,p=new C;for(let y=0;y<=m;y++){let v=0,x=0,A=0,T=0;if(y<=n){const b=y/n,S=b*Math.PI/2;x=-h-t*Math.cos(S),A=t*Math.sin(S),T=-t*Math.cos(S),v=b*u}else if(y<=n+s){const b=(y-n)/s;x=-h+b*e,A=t,T=0,v=u+b*d}else{const b=(y-n-s)/n,S=b*Math.PI/2;x=h+t*Math.sin(S),A=t*Math.cos(S),T=t*Math.sin(S),v=u+d+b*u}const R=Math.max(0,Math.min(1,v/f));let I=0;y===0?I=.5/i:y===m&&(I=-.5/i);for(let b=0;b<=i;b++){const S=b/i,L=S*Math.PI*2,F=Math.sin(L),z=Math.cos(L);p.x=-A*z,p.y=x,p.z=A*F,o.push(p.x,p.y,p.z),g.set(-A*z,T,A*F),g.normalize(),l.push(g.x,g.y,g.z),c.push(S+I,R)}if(y>0){const b=(y-1)*_;for(let S=0;S<i;S++){const L=b+S,F=b+S+1,z=y*_+S,G=y*_+S+1;a.push(L,F,z),a.push(F,G,z)}}}this.setIndex(a),this.setAttribute("position",new Mt(o,3)),this.setAttribute("normal",new Mt(l,3)),this.setAttribute("uv",new Mt(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Eo(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}}class To extends Xt{constructor(t=1,e=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radiu
vendor: 2,436 bytes, line 44
44s:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const s=[],a=[],o=[],l=[],c=new C,h=new Q;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let u=0,d=3;u<=e;u++,d+=3){const f=n+u/e*i;c.x=t*Math.cos(f),c.y=t*Math.sin(f),a.push(c.x,c.y,c.z),o.push(0,0,1),h.x=(a[d]/t+1)/2,h.y=(a[d+1]/t+1)/2,l.push(h.x,h.y)}for(let u=1;u<=e;u++)s.push(u,u+1,0);this.setIndex(s),this.setAttribute("position",new Mt(a,3)),this.setAttribute("normal",new Mt(o,3)),this.setAttribute("uv",new Mt(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new To(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class pr extends Xt{constructor(t=1,e=1,n=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const h=[],u=[],d=[],f=[];let m=0;const _=[],g=n/2;let p=0;y(),a===!1&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new Mt(u,3)),this.setAttribute("normal",new Mt(d,3)),this.setAttribute("uv",new Mt(f,2));function y(){const x=new C,A=new C;let T=0;const R=(e-t)/n;for(let I=0;I<=s;I++){const b=[],S=I/s,L=S*(e-t)+t;for(let F=0;F<=i;F++){const z=F/i,G=z*l+o,q=Math.sin(G),W=Math.cos(G);A.x=L*q,A.y=-S*n+g,A.z=L*W,u.push(A.x,A.y,A.z),x.set(q,R,W).normalize(),d.push(x.x,x.y,x.z),f.push(z,1-S),b.push(m++)}_.push(b)}for(let I=0;I<i;I++)for(let b=0;b<s;b++){const S=_[b][I],L=_[b+1][I],F=_[b+1][I+1],z=_[b][I+1];(t>0||b!==0)&&(h.push(S,L,z),T+=3),(e>0||b!==s-1)&&(h.push(L,F,z),T+=3)}c.addGroup(p,T,0),p+=T}function v(x){const A=m,T=new Q,R=new C;let I=0;const b=x===!0?t:e,S=x===!0?1:-1;for(let F=1;F<=i;F++)u.push(0,g*S,0),d.push(0,S,0),f.push(.5,.5),m++;const L=m;for(let F=0;F<=i;F++){const G=F/i*l+o,q=Math.cos(G),W=Math.sin(G);R.x=b*W,R.y=g*S,R.z=b*q,u.push(R.x,R.y,R.z),d.push(0,S,0),T.x=q*.5+.5,T.y=W*.5*S+.5,f.push(T.x,T.y),m++}for(let F=0;F<i;F++){const z=A+F,G=L+F;x===!0?h.push(G,G+1,z):h.push(G+1,G,z),I+=3}c.addGroup(p,I,x===!0?1:2),p+=I}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new pr(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class mr extends pr{constructor(t=1,e=1,n=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,t,e,n,i,s,a,o),this.type="C
44oneGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(t){return new mr(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ni extends Xt{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const s=[],a=[];o(i),c(n),h(),this.setAttribute("position",new Mt(s,3)),this.setAttribute("normal",new Mt(s.slice(),3)),this.setAttribute("uv",new Mt(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(y){const v=new C,x=new C,A=new C;for(let T=0;T<e.length;T+=3)f(e[T+0],v),f(e[T+1],x),f(e[T+2],A),l(v,x,A,y)}function l(y,v,x,A){const T=A+1,R=[];for(let I=0;I<=T;I++){R[I]=[];const b=y.clone().lerp(x,I/T),S=v.clone().lerp(x,I/T),L=T-I;for(let F=0;F<=L;F++)F===0&&I===T?R[I][F]=b:R[I][F]=b.clone().lerp(S,F/L)}for(let I=0;I<T;I++)for(let b=0;b<2*(T-I)-1;b++){const S=Math.floor(b/2);b%2===0?(d(R[I][S+1]),d(R[I+1][S]),d(R[I][S])):(d(R[I][S+1]),d(R[I+1][S+1]),d(R[I+1][S]))}}function c(y){const v=new C;for(let x=0;x<s.length;x+=3)v.x=s[x+0],v.y=s[x+1],v.z=s[x+2],v.normalize().multiplyScalar(y),s[x+0]=v.x,s[x+1]=v.y,s[x+2]=v.z}function h(){const y=new C;for(let v=0;v<s.length;v+=3){y.x=s[v+0],y.y=s[v+1],y.z=s[v+2];const x=g(y)/2/Math.PI+.5,A=p(y)/Math.PI+.5;a.push(x,1-A)}m(),u()}function u(){for(let y=0;y<a.length;y+=6){const v=a[y+0],x=a[y+2],A=a[y+4],T=Math.max(v,x,A),R=Math.min(v,x,A);T>.9&&R<.1&&(v<.2&&(a[y+0]+=1),x<.2&&(a[y+2]+=1),A<.2&&(a[y+4]+=1))}}function d(y){s.push(y.x,y.y,y.z)}function f(y,v){const x=y*3;v.x=t[x+0],v.y=t[x+1],v.z=t[x+2]}function m(){const y=new C,v=new C,x=new C,A=new C,T=new Q,R=new Q,I=new Q;for(let b=0,S=0;b<s.length;b+=9,S+=6){y.set(s[b+0],s[b+1],s[b+2]),v.set(s[b+3],s[b+4],s[b+5]),x.set(s[b+6],s[b+7],s[b+8]),T.set(a[S+0],a[S+1]),R.set(a[S+2],a[S+3]),I.set(a[S+4],a[S+5]),A.copy(y).add(v).add(x).divideScalar(3);const L=g(A);_(T,S+0,y,L),_(R,S+2,v,L),_(I,S+4,x,L)}}function _(y,v,x,A){A<0&&y.x===1&&(a[v]=y.x-1),x.x===0&&x.z===0&&(a[v]=A/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function p(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ni(t.vertices,t.indices,t.radius,t.details)}}class Ao extends ni{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 4,103 bytes, line 44
4419,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Ao(t.radius,t.detail)}}const Kr=new C,Qr=new C,ml=new C,jr=new We;class Ed extends Xt{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},t!==null){const i=Math.pow(10,4),s=Math.cos(wi*e),a=t.getIndex(),o=t.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],u=new Array(3),d={},f=[];for(let m=0;m<l;m+=3){a?(c[0]=a.getX(m),c[1]=a.getX(m+1),c[2]=a.getX(m+2)):(c[0]=m,c[1]=m+1,c[2]=m+2);const{a:_,b:g,c:p}=jr;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),p.fromBufferAttribute(o,c[2]),jr.getNormal(ml),u[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,u[1]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,u[2]=`${Math.round(p.x*i)},${Math.round(p.y*i)},${Math.round(p.z*i)}`,!(u[0]===u[1]||u[1]===u[2]||u[2]===u[0]))for(let y=0;y<3;y++){const v=(y+1)%3,x=u[y],A=u[v],T=jr[h[y]],R=jr[h[v]],I=`${x}_${A}`,b=`${A}_${x}`;b in d&&d[b]?(ml.dot(d[b].normal)<=s&&(f.push(T.x,T.y,T.z),f.push(R.x,R.y,R.z)),d[b]=null):I in d||(d[I]={index0:c[y],index1:c[v],normal:ml.clone()})}}for(const m in d)if(d[m]){const{index0:_,index1:g}=d[m];Kr.fromBufferAttribute(o,_),Qr.fromBufferAttribute(o,g),f.push(Kr.x,Kr.y,Kr.z),f.push(Qr.x,Qr.y,Qr.z)}this.setAttribute("position",new Mt(f,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class pn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),s=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),s+=n.distanceTo(i),e.push(s),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const n=this.getLengths();let i=0;const s=n.length;let a;e?a=e:a=t*n[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=n[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(s-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(s-1)}getTangent(t,e){let i=t-1e-4,s=t+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=e||(a.isVector2?new Q:new C);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){const n=new C,i=[],s=[],a=[],o=new C,l=new Ot;for(let f=0;f<=t;f++){const m=f/t;i[f]=this.getTangentAt(m,new C)}s[0]=new C,a[0]=new C;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=t;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(Nt(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,m))}a[f].crossVectors(i[f],s[f])}if(e===!0){let f=Math.acos(Nt(s[0].dot(s[t]),-1,1));f/=t,i[0].dot(o.crossVectors(s[0],s[t]))>0&&(f=-f);for(let m=1;m<=t;m++)s[m].applyMatrix4(l.makeRotationAxis(i[m],f*m)),a[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.t
vendor: 14,949 bytes, line 44
44ype,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class wo extends pn{constructor(t=0,e=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new Q){const n=e,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+t*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*h-f*u+this.aX,c=d*u+f*h+this.aY}return n.set(l,c)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Td extends wo{constructor(t,e,n,i,s,a){super(t,e,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function pc(){let r=0,t=0,e=0,n=0;function i(s,a,o,l){r=s,t=o,e=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,u){let d=(a-s)/c-(o-s)/(c+h)+(o-a)/h,f=(o-a)/h-(l-a)/(h+u)+(l-o)/u;d*=h,f*=h,i(a,o,d,f)},calc:function(s){const a=s*s,o=a*s;return r+t*s+e*a+n*o}}}const ta=new C,gl=new pc,_l=new pc,xl=new pc;class Ad extends pn{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new C){const n=e,i=this.points,s=i.length,a=(s-(this.closed?0:1))*t;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%s]:(ta.subVectors(i[0],i[1]).add(i[0]),c=ta);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(ta.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=ta),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let m=Math.pow(c.distanceToSquared(u),f),_=Math.pow(u.distanceToSquared(d),f),g=Math.pow(d.distanceToSquared(h),f);_<1e-4&&(_=1),m<1e-4&&(m=_),g<1e-4&&(g=_),gl.initNonuniformCatmullRom(c.x,u.x,d.x,h.x,m,_,g),_l.initNonuniformCatmullRom(c.y,u.y,d.y,h.y,m,_,g),xl.initNonuniformCatmullRom(c.z,u.z,d.z,h.z,m,_,g)}else this.curveType==="catmullrom"&&(gl.initCatmullRom(c.x,u.x,d.x,h.x,this.tension),_l.initCatmullRom(c.y,u.y,d.y,h.y,this.tension),xl.initCatmullRom(c.z,u.z,d.z,h.z,this.tension));return n.set(gl.calc(l),_l.calc(l),xl.calc(l)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new C().fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function bh(r,t,e,n,i){const s=(n-t)*.5,a=(i-e)*.5,o=r*r,l=r*o;return(2*e-2*n+s+a)*l+(-3*e+3*n-2*s-a)*o+s*r+e}function Sm(r,t){const e=1-r;return e*e*t}function bm(r,t){return 2*(1-r)*r*t}function Em(r,t){return r*r*t}function qs(r,t,e,n){return Sm(r,t)+bm(r,e)+Em(r,n)}function Tm(r,t){const e=1-r;return e*e*e*t}function Am(r,t){const e=1-r;return 3*e*e*r*t}function wm(r,t){return 3*(1-r)*r*r*t}function Cm(r,t){return r*r*r*t}function Ys(r,t,e,n,i){return Tm(r,t)+Am(r,e)+wm(r,n)+Cm(r,i)}class mc extends pn{constructor(t=new Q,e=new Q,n=new Q,i=new Q){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Q){const n=e,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Ys(t,i.x,s.x,a.x,o.x),Ys(t,i.y,s.y,a.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class wd extends pn{constructor(t=new C,e=new C,n=new C,i=new C){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new C){const n=e,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Ys(t,i.x,s.x,a.x,o.x),Ys(t,i.y,s.y,a.y,o.y),Ys(t,i.z,s.z,a.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class gc extends pn{constructor(t=new Q,e=new Q){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Q){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Q){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Cd extends pn{constructor(t=new C,e=new C){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new C){const n=e;return t===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new C){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class _c extends pn{constructor(t=new Q,e=new Q,n=new Q){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Q){const n=e,i=this.v0,s=this.v1,a=this.v2;return n.set(qs(t,i.x,s.x,a.x),qs(t,i.y,s.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class xc extends pn{constructor(t=new C,e=new C,n=new C){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new C){const n=e,i=this.v0,s=this.v1,a=this.v2;return n.set(qs(t,i.x,s.x,a.x),qs(t,i.y,s.y,a.y),qs(t,i.z,s.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class vc extends pn{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Q){const n=e,i=this.points,s=(i.length-1)*t,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(bh(o,l.x,c.x,h.x,u.x),bh(o,l.y,c.y,h.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const i=t.points[e];this.points.push(new Q().fromArray(i))}return this}}var no=Object.freeze({__proto__:null,ArcCurve:Td,CatmullRomCurve3:Ad,CubicBezierCurve:mc,CubicBezierCurve3:wd,EllipseCurve:wo,LineCurve:gc,LineCurve3:Cd,QuadraticBezierCurve:_c,QuadraticBezierCurve3:xc,SplineCurve:vc});class Rd extends pn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new no[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?t*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,l=a.getPoints(o);for(let c=0;c<l.length;c++){const h=l[c];n&&n.equals(h)||(e.push(h),n=h)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const i=t.curves[e];this.curves.push(new no[i.type]().fromJSON(i))}return this}}class io extends Rd{constructor(t){super(),this.type="Path",this.currentPoint=new Q,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new gc(this.currentPoint.clone(),new Q(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const s=new _c(this.currentPoint.clone(),new Q(t,e),new Q(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,s,a){const o=new mc(this.currentPoint.clone(),new Q(t,e),new Q(n,i),new Q(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new vc(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(t+o,e+l,n,i,s,a),this}absarc(t,e,n,i,s,a){return this.absellipse(t,e,n,n,i,s,a),this}ellipse(t,e,n,i,s,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+c,e+h,n,i,s,a,o,l),this}absellipse(t,e,n,i,s,a,o,l){const c=new wo(t,e,n,i,s,a,o,l);if(this.curves.length>0){const u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);const h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Ci extends io{constructor(t){super(t),this.uuid=je(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const i=t.holes[e];this.holes.push(new io().fromJSON(i))}return this}}function Rm(r,t,e=2){const n=t&&t.length,i=n?t[0]*e:r.length;let s=Id(r,0,i,e,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=Um(r,t,s,e)),r.length>80*e){o=1/0,l=1/0;let h=-1/0,u=-1/0;for(let d=e;d<i;d+=e){const f=r[d],m=r[d+1];f<o&&(o=f),m<l&&(l=m),f>h&&(h=f),m>u&&(u=m)}c=Math.max(h-o,u-l),c=c!==0?32767/c:0}return sr(s,a,e,o,l,c,0),a}function Id(r,t,e,n,i){let s;if(i===Xm(r,t,e,n)>0)for(let a=t;a<e;a+=n)s=Eh(a/n|0,r[a],r[a+1],s);else for(let a=e-n;a>=t;a-=n)s=Eh(a/n|0,r[a],r[a+1],s);return s&&_s(s,s.next)&&(ar(s),s=s.next),s}function Li(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(_s(e,e.next)||pe(e.prev,e,e.next)===0)){if(ar(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function sr(r,t,e,n,i,s,a){if(!r)return;!a&&s&&zm(r,n,i,s);let o=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(s?Pm(r,n,i,s):Im(r)){t.push(l.i,r.i,c.i),ar(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=Lm(Li(r),t),sr(r,t,e,n,i,s,2)):a===2&&Dm(r,t,e,n,i,s):sr(Li(r),t,e,n,i,s,1);break}}}function Im(r){const t=r.prev,e=r,n=r.next;if(pe(t,e,n)>=0)return!1;const i=t.x,s=e.x,a=n.x,o=t.y,l=e.y,c=n.y,h=Math.min(i,s,a),u=Math.min(o,l,c),d=Math.max(i,s,a),f=Math.max(o,l,c);let m=n.next;for(;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&Bs(i,o,s,l,a,c,m.x,m.y)&&pe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Pm(r,t,e,n){const i=r.prev,s=r,a=r.next;if(pe(i,s,a)>=0)return!1;
vendor: 1,346 bytes, line 44
44const o=i.x,l=s.x,c=a.x,h=i.y,u=s.y,d=a.y,f=Math.min(o,l,c),m=Math.min(h,u,d),_=Math.max(o,l,c),g=Math.max(h,u,d),p=kl(f,m,t,e,n),y=kl(_,g,t,e,n);let v=r.prevZ,x=r.nextZ;for(;v&&v.z>=p&&x&&x.z<=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&Bs(o,h,l,u,c,d,v.x,v.y)&&pe(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Bs(o,h,l,u,c,d,x.x,x.y)&&pe(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=p;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&Bs(o,h,l,u,c,d,v.x,v.y)&&pe(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=_&&x.y>=m&&x.y<=g&&x!==i&&x!==a&&Bs(o,h,l,u,c,d,x.x,x.y)&&pe(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Lm(r,t){let e=r;do{const n=e.prev,i=e.next.next;!_s(n,i)&&Ld(n,e,e.next,i)&&rr(n,i)&&rr(i,n)&&(t.push(n.i,e.i,i.i),ar(e),ar(e.next),e=r=i),e=e.next}while(e!==r);return Li(e)}function Dm(r,t,e,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Hm(a,o)){let l=Dd(a,o);a=Li(a,a.next),l=Li(l,l.next),sr(a,t,e,n,i,s,0),sr(l,t,e,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function Um(r,t,e,n){const i=[];for(let s=0,a=t.length;s<a;s++){const o=t[s]*n,l=s<a-1?t[s+1]*n:r.length,c=Id(r,o,l,n,!1);c===c.next&&(c.steiner=!0),i.push(Vm(c))}i.sort(Nm);for(let s=0;s<i.length;s++)e=Fm(i[s],e);return e}function Nm(r,t){let e=r.x-t.x;
vendor: 4,301 bytes, line 44
44if(e===0&&(e=r.y-t.y,e===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=n-i}return e}function Fm(r,t){const e=Om(r,t);if(!e)return t;const n=Dd(e,r);return Li(n,n.next),Li(e,e.next)}function Om(r,t){let e=t;const n=r.x,i=r.y;let s=-1/0,a;if(_s(r,e))return e;do{if(_s(r,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const u=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=n&&u>s&&(s=u,a=e.x<e.next.x?e:e.next,u===n))return a}e=e.next}while(e!==t);if(!a)return null;const o=a,l=a.x,c=a.y;let h=1/0;e=a;do{if(n>=e.x&&e.x>=l&&n!==e.x&&Pd(i<c?n:s,i,l,c,i<c?s:n,i,e.x,e.y)){const u=Math.abs(i-e.y)/(n-e.x);rr(e,r)&&(u<h||u===h&&(e.x>a.x||e.x===a.x&&Bm(a,e)))&&(a=e,h=u)}e=e.next}while(e!==o);return a}function Bm(r,t){return pe(r.prev,r,t.prev)<0&&pe(t.next,r,r.next)<0}function zm(r,t,e,n){let i=r;do i.z===0&&(i.z=kl(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,km(i)}function km(r){let t,e=1;do{let n=r,i;r=null;let s=null;for(t=0;n;){t++;let a=n,o=0;for(let c=0;c<e&&(o++,a=a.nextZ,!!a);c++);let l=e;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=a}s.nextZ=null,e*=2}while(t>1);return r}function kl(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Vm(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Pd(r,t,e,n,i,s,a,o){return(i-a)*(t-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(e-a)*(t-o)&&(e-a)*(s-o)>=(i-a)*(n-o)}function Bs(r,t,e,n,i,s,a,o){return!(r===a&&t===o)&&Pd(r,t,e,n,i,s,a,o)}function Hm(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Gm(r,t)&&(rr(r,t)&&rr(t,r)&&Wm(r,t)&&(pe(r.prev,r,t.prev)||pe(r,t.prev,t))||_s(r,t)&&pe(r.prev,r,r.next)>0&&pe(t.prev,t,t.next)>0)}function pe(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function _s(r,t){return r.x===t.x&&r.y===t.y}function Ld(r,t,e,n){const i=na(pe(r,t,e)),s=na(pe(r,t,n)),a=na(pe(e,n,r)),o=na(pe(e,n,t));return!!(i!==s&&a!==o||i===0&&ea(r,e,t)||s===0&&ea(r,n,t)||a===0&&ea(e,r,n)||o===0&&ea(e,t,n))}function ea(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function na(r){return r>0?1:r<0?-1:0}function Gm(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Ld(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function rr(r,t){return pe(r.prev,r,r.next)<0?pe(r,t,r.next)>=0&&pe(r,r.prev,t)>=0:pe(r,t,r.prev)<0||pe(r,r.next,t)<0}function Wm(r,t){let e=r,n=!1;const i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Dd(r,t){const e=Vl(r.i,r.x,r.y),n=Vl(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Eh(r,t,e,n){const i=Vl(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ar(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Vl(r,t,e){return{i:r,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Xm(r,t,e,n){let i=0;for(let s=t,a=e-n;s<e;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class qm{static triangulate(t,e,n=2){return Rm(t,e,n)}}class un{static area(t){const e=t.length;let n=0;for(let i=e-1,s=0;s<e;i=s++)n+=t[i].x*t[s].y-t[s].x*t[i].y;return n*.5}static isClockWise(t){return un.area(t)<0}static triangulateShape(t,e){const n=[],i=[],s=[];Th(t),Ah(n,t);let a=t.length;e.forEach(Th);for(let l=0;l<e.length;l++)i.push(a),a+=e[l].length,Ah(n,e[l]);const o=qm.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Th(r){const t=r.length;t>2&&r[t-1].equals(r[0])&&r.pop()}function Ah(r,t){for(let e=0;e<t.length;e++)r.push(t[e].x),r.push(t[e].y)}class Co extends Xt{constructor(t=new Ci([new Q(.5,.5),new Q(-.5,.5),new Q(-.5,-.5),new Q(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],s=[];for(let o=0,l=t.length;o<l;
44o++){const c=t[o];a(c)}this.setAttribute("position",new Mt(i,3)),this.setAttribute("uv",new Mt(s,2)),this.computeVertexNormals();function a(o){const l=[],c=e.curveSegments!==void 0?e.curveSegments:12,h=e.steps!==void 0?e.steps:1,u=e.depth!==void 0?e.depth:1;let d=e.bevelEnabled!==void 0?e.bevelEnabled:!0,f=e.bevelThickness!==void 0?e.bevelThickness:.2,m=e.bevelSize!==void 0?e.bevelSize:f-.1,_=e.bevelOffset!==void 0?e.bevelOffset:0,g=e.bevelSegments!==void 0?e.bevelSegments:3;const p=e.extrudePath,y=e.UVGenerator!==void 0?e.UVGenerator:Ym;let v,x=!1,A,T,R,I;p&&(v=p.getSpacedPoints(h),x=!0,d=!1,A=p.computeFrenetFrames(h,!1),T=new C,R=new C,I=new C),d||(g=0,f=0,m=0,_=0);const b=o.extractPoints(c);let S=b.shape;const L=b.holes;if(!un.isClockWise(S)){S=S.reverse();for(let tt=0,$=L.length;tt<$;tt++){const J=L[tt];un.isClockWise(J)&&(L[tt]=J.reverse())}}function z(tt){const J=10000000000000001e-36;let Z=tt[0];for(let ct=1;ct<=tt.length;ct++){const it=ct%tt.length,ht=tt[it],kt=ht.x-Z.x,zt=ht.y-Z.y,w=kt*kt+zt*zt,M=Math.max(Math.abs(ht.x),Math.abs(ht.y),Math.abs(Z.x),Math.abs(Z.y)),O=J*M*M;if(w<=O){tt.splice(it,1),ct--;continue}Z=ht}}z(S),L.forEach(z);const G=L.length,q=S;for(let tt=0;tt<G;tt++){const $=L[tt];S=S.concat($)}function W(tt,$,J){return $||console.error("THREE.ExtrudeGeometry: vec does not exist"),tt.clone().addScaledVector($,J)}const nt=S.length;function H(tt,$,J){let Z,ct,it;const ht=tt.x-$.x,kt=tt.y-$.y,zt=J.x-tt.x,w=J.y-tt.y,M=ht*ht+kt*kt,O=ht*w-kt*zt;if(Math.abs(O)>Number.EPSILON){const V=Math.sqrt(M),j=Math.sqrt(zt*zt+w*w),X=$.x-kt/V,Rt=$.y+ht/V,lt=J.x-w/j,At=J.y+zt/j,wt=((lt-X)*w-(At-Rt)*zt)/(ht*w-kt*zt);Z=X+ht*wt-tt.x,ct=Rt+kt*wt-tt.y;const st=Z*Z+ct*ct;if(st<=2)return new Q(Z,ct);it=Math.sqrt(st/2)}else{let V=!1;ht>Number.EPSILON?zt>Number.EPSILON&&(V=!0):ht<-Number.EPSILON?zt<-Number.EPSILON&&(V=!0):Math.sign(kt)===Math.sign(w)&&(V=!0),V?(Z=-kt,ct=ht,it=Math.sqrt(M)):(Z=ht,ct=kt,it=Math.sqrt(M/2))}return new Q(Z/it,ct/it)}const ut=[];for(let tt=0,$=q.length,J=$-1,Z=tt+1;tt<$;tt++,J++,Z++)J===$&&(J=0),Z===$&&(Z=0),ut[tt]=H(q[tt],q[J],q[Z]);const _t=[];let St,Gt=ut.concat();for(let tt=0,$=G;tt<$;tt++){const J=L[tt];St=[];for(let Z=0,ct=J.length,it=ct-1,ht=Z+1;Z<ct;Z++,it++,ht++)it===ct&&(it=0),ht===ct&&(ht=0),St[Z]=H(J[Z],J[it],J[ht]);_t.push(St),Gt=Gt.concat(St)}let $t;if(g===0)$t=un.triangulateShape(q,L);else{const tt=[],$=[];for(let J=0;J<g;J++){const Z=J/g,ct=f*Math.cos(Z*Math.PI/2),it=m*Math.sin(Z*Math.PI/2)+_;for(let ht=0,kt=q.length;ht<kt;
vendor: 40,273 bytes, line 44
44ht++){const zt=W(q[ht],ut[ht],it);Pt(zt.x,zt.y,-ct),Z===0&&tt.push(zt)}for(let ht=0,kt=G;ht<kt;ht++){const zt=L[ht];St=_t[ht];const w=[];for(let M=0,O=zt.length;M<O;M++){const V=W(zt[M],St[M],it);Pt(V.x,V.y,-ct),Z===0&&w.push(V)}Z===0&&$.push(w)}}$t=un.triangulateShape(tt,$)}const se=$t.length,Qt=m+_;for(let tt=0;tt<nt;tt++){const $=d?W(S[tt],Gt[tt],Qt):S[tt];x?(R.copy(A.normals[0]).multiplyScalar($.x),T.copy(A.binormals[0]).multiplyScalar($.y),I.copy(v[0]).add(R).add(T),Pt(I.x,I.y,I.z)):Pt($.x,$.y,0)}for(let tt=1;tt<=h;tt++)for(let $=0;$<nt;$++){const J=d?W(S[$],Gt[$],Qt):S[$];x?(R.copy(A.normals[tt]).multiplyScalar(J.x),T.copy(A.binormals[tt]).multiplyScalar(J.y),I.copy(v[tt]).add(R).add(T),Pt(I.x,I.y,I.z)):Pt(J.x,J.y,u/h*tt)}for(let tt=g-1;tt>=0;tt--){const $=tt/g,J=f*Math.cos($*Math.PI/2),Z=m*Math.sin($*Math.PI/2)+_;for(let ct=0,it=q.length;ct<it;ct++){const ht=W(q[ct],ut[ct],Z);Pt(ht.x,ht.y,u+J)}for(let ct=0,it=L.length;ct<it;ct++){const ht=L[ct];St=_t[ct];for(let kt=0,zt=ht.length;kt<zt;kt++){const w=W(ht[kt],St[kt],Z);x?Pt(w.x,w.y+v[h-1].y,v[h-1].x+J):Pt(w.x,w.y,u+J)}}}Y(),et();function Y(){const tt=i.length/3;if(d){let $=0,J=nt*$;for(let Z=0;Z<se;Z++){const ct=$t[Z];Tt(ct[2]+J,ct[1]+J,ct[0]+J)}$=h+g*2,J=nt*$;for(let Z=0;Z<se;Z++){const ct=$t[Z];Tt(ct[0]+J,ct[1]+J,ct[2]+J)}}else{for(let $=0;$<se;$++){const J=$t[$];Tt(J[2],J[1],J[0])}for(let $=0;$<se;$++){const J=$t[$];Tt(J[0]+nt*h,J[1]+nt*h,J[2]+nt*h)}}n.addGroup(tt,i.length/3-tt,0)}function et(){const tt=i.length/3;let $=0;yt(q,$),$+=q.length;for(let J=0,Z=L.length;J<Z;J++){const ct=L[J];yt(ct,$),$+=ct.length}n.addGroup(tt,i.length/3-tt,1)}function yt(tt,$){let J=tt.length;for(;--J>=0;){const Z=J;let ct=J-1;ct<0&&(ct=tt.length-1);for(let it=0,ht=h+g*2;it<ht;it++){const kt=nt*it,zt=nt*(it+1),w=$+Z+kt,M=$+ct+kt,O=$+ct+zt,V=$+Z+zt;Zt(w,M,O,V)}}}function Pt(tt,$,J){l.push(tt),l.push($),l.push(J)}function Tt(tt,$,J){ce(tt),ce($),ce(J);const Z=i.length/3,ct=y.generateTopUV(n,i,Z-3,Z-2,Z-1);P(ct[0]),P(ct[1]),P(ct[2])}function Zt(tt,$,J,Z){ce(tt),ce($),ce(Z),ce($),ce(J),ce(Z);const ct=i.length/3,it=y.generateSideWallUV(n,i,ct-6,ct-3,ct-2,ct-1);P(it[0]),P(it[1]),P(it[3]),P(it[1]),P(it[2]),P(it[3])}function ce(tt){i.push(l[tt*3+0]),i.push(l[tt*3+1]),i.push(l[tt*3+2])}function P(tt){s.push(tt.x),s.push(tt.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return Zm(e,n,t)}static fromJSON(t,e){const n=[];for(let s=0,a=t.shapes.length;s<a;s++){const o=e[t.shapes[s]];n.push(o)}const i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new no[i.type]().fromJSON(i)),new Co(n,t.options)}}const Ym={generateTopUV:function(r,t,e,n,i){const s=t[e*3],a=t[e*3+1],o=t[n*3],l=t[n*3+1],c=t[i*3],h=t[i*3+1];return[new Q(s,a),new Q(o,l),new Q(c,h)]},generateSideWallUV:function(r,t,e,n,i,s){const a=t[e*3],o=t[e*3+1],l=t[e*3+2],c=t[n*3],h=t[n*3+1],u=t[n*3+2],d=t[i*3],f=t[i*3+1],m=t[i*3+2],_=t[s*3],g=t[s*3+1],p=t[s*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new Q(a,1-l),new Q(c,1-u),new Q(d,1-m),new Q(_,1-p)]:[new Q(o,1-l),new Q(h,1-u),new Q(f,1-m),new Q(g,1-p)]}};function Zm(r,t,e){if(e.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];e.shapes.push(s.uuid)}else e.shapes.push(r.uuid);return e.options=Object.assign({},t),t.extrudePath!==void 0&&(e.options.extrudePath=t.extrudePath.toJSON()),e}class Ro extends ni{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Ro(t.radius,t.detail)}}class Io extends Xt{constructor(t=[new Q(0,-.5),new Q(.5,0),new Q(0,.5)],e=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Nt(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/e,u=new C,d=new Q,f=new C,m=new C,_=new C;let g=0,p=0;for(let y=0;y<=t.length-1;y++)switch(y){case 0:g=t[y+1].x-t[y].x,p=t[y+1].y-t[y].y,f.x=p*1,f.y=-g,f.z=p*0,_.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case t.length-1:l.push(_.x,_.y,_.z);break;default:g=t[y+1].x-t[y].x,p=t[y+1].y-t[y].y,f.x=p*1,f.y=-g,f.z=p*0,m.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),l.push(f.x,f.y,f.z),_.copy(m)}for(let y=0;y<=e;y++){const v=n+y*h*i,x=Math.sin(v),A=Math.cos(v);for(let T=0;T<=t.length-1;T++){u.x=t[T].x*x,u.y=t[T].y,u.z=t[T].x*A,a.push(u.x,u.y,u.z),d.x=y/e,d.y=T/(t.length-1),o.push(d.x,d.y);const R=l[3*T+0]*x,I=l[3*T+1],b=l[3*T+0]*A;c.push(R,I,b)}}for(let y=0;y<e;y++)for(let v=0;v<t.length-1;v++){const x=v+y*t.length,A=x,T=x+t.length,R=x+t.length+1,I=x+1;s.push(A,T,I),s.push(R,I,T)}this.setIndex(s),this.setAttribute("position",new Mt(a,3)),this.setAttribute("uv",new Mt(o,2)),this.setAttribute("normal",new Mt(c,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Io(t.points,t.segments,t.phiStart,t.phiLength)}}class gr extends ni{constructor(t=1,e=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new gr(t.radius,t.detail)}}class Ss extends Xt{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const s=t/2,a=e/2,o=Math.floor(n),l=Math.floor(i),c=o+1,h=l+1,u=t/o,d=e/l,f=[],m=[],_=[],g=[];for(let p=0;p<h;p++){const y=p*d-a;for(let v=0;v<c;v++){const x=v*u-s;m.push(x,-y,0),_.push(0,0,1),g.push(v/o),g.push(1-p/l)}}for(let p=0;p<l;p++)for(let y=0;y<o;y++){const v=y+c*p,x=y+c*(p+1),A=y+1+c*(p+1),T=y+1+c*p;f.push(v,x,T),f.push(x,A,T)}this.setIndex(f),this.setAttribute("position",new Mt(m,3)),this.setAttribute("normal",new Mt(_,3)),this.setAttribute("uv",new Mt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ss(t.width,t.height,t.widthSegments,t.heightSegments)}}class Po extends Xt{constructor(t=.5,e=1,n=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const o=[],l=[],c=[],h=[];let u=t;const d=(e-t)/i,f=new C,m=new Q;for(let _=0;_<=i;_++){for(let g=0;g<=n;g++){const p=s+g/n*a;f.x=u*Math.cos(p),f.y=u*Math.sin(p),l.push(f.x,f.y,f.z),c.push(0,0,1),m.x=(f.x/e+1)/2,m.y=(f.y/e+1)/2,h.push(m.x,m.y)}u+=d}for(let _=0;_<i;_++){const g=_*(n+1);for(let p=0;p<n;p++){const y=p+g,v=y,x=y+n+1,A=y+n+2,T=y+1;o.push(v,x,T),o.push(x,A,T)}}this.setIndex(o),this.setAttribute("position",new Mt(l,3)),this.setAttribute("normal",new Mt(c,3)),this.setAttribute("uv",new Mt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Po(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Lo extends Xt{constructor(t=new Ci([new Q(0,.5),new Q(-.5,-.5),new Q(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(t)===!1)c(t);else for(let h=0;h<t.length;h++)c(t[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(n),this.setAttribute("position",new Mt(i,3)),this.setAttribute("normal",new Mt(s,3)),this.setAttribute("uv",new Mt(a,2));function c(h){const u=i.length/3,d=h.extractPoints(e);let f=d.shape;const m=d.holes;un.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,p=m.length;g<p;g++){const y=m[g];un.isClockWise(y)===!0&&(m[g]=y.reverse())}const _=un.triangulateShape(f,m);for(let g=0,p=m.length;g<p;g++){const y=m[g];f=f.concat(y)}for(let g=0,p=f.length;g<p;g++){const y=f[g];i.push(y.x,y.y,0),s.push(0,0,1),a.push(y.x,y.y)}for(let g=0,p=_.length;g<p;g++){const y=_[g],v=y[0]+u,x=y[1]+u,A=y[2]+u;n.push(v,x,A),l+=3}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON(),e=this.parameters.shapes;return Jm(e,t)}static fromJSON(t,e){const n=[];for(let i=0,s=t.shapes.length;i<s;i++){const a=e[t.shapes[i]];n.push(a)}return new Lo(n,t.curveSegments)}}function Jm(r,t){if(t.shapes=[],Array.isArray(r))for(let e=0,n=r.length;e<n;e++){const i=r[e];t.shapes.push(i.uuid)}else t.shapes.push(r.uuid);return t}class _r extends Xt{constructor(t=1,e=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const l=Math.min(a+o,Math.PI);let c=0;const h=[],u=new C,d=new C,f=[],m=[],_=[],g=[];for(let p=0;p<=n;p++){const y=[],v=p/n;let x=0;p===0&&a===0?x=.5/e:p===n&&l===Math.PI&&(x=-.5/e);for(let A=0;A<=e;A++){const T=A/e;u.x=-t*Math.cos(i+T*s)*Math.sin(a+v*o),u.y=t*Math.cos(a+v*o),u.z=t*Math.sin(i+T*s)*Math.sin(a+v*o),m.push(u.x,u.y,u.z),d.copy(u).normalize(),_.push(d.x,d.y,d.z),g.push(T+x,1-v),y.push(c++)}h.push(y)}for(let p=0;p<n;p++)for(let y=0;y<e;y++){const v=h[p][y+1],x=h[p][y],A=h[p+1][y],T=h[p+1][y+1];(p!==0||a>0)&&f.push(v,x,T),(p!==n-1||l<Math.PI)&&f.push(x,A,T)}this.setIndex(f),this.setAttribute("position",new Mt(m,3)),this.setAttribute("normal",new Mt(_,3)),this.setAttribute("uv",new Mt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new _r(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Do extends ni{constructor(t=1,e=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Do(t.radius,t.detail)}}class Uo extends Xt{constructor(t=1,e=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const a=[],o=[],l=[],c=[],h=new C,u=new C,d=new C;for(let f=0;f<=n;f++)for(let m=0;m<=i;m++){const _=m/i*s,g=f/n*Math.PI*2;u.x=(t+e*Math.cos(g))*Math.cos(_),u.y=(t+e*Math.cos(g))*Math.sin(_),u.z=e*Math.sin(g),o.push(u.x,u.y,u.z),h.x=t*Math.cos(_),h.y=t*Math.sin(_),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(m/i),c.push(f/n)}for(let f=1;f<=n;f++)for(let m=1;m<=i;m++){const _=(i+1)*f+m-1,g=(i+1)*(f-1)+m-1,p=(i+1)*(f-1)+m,y=(i+1)*f+m;a.push(_,g,y),a.push(g,p,y)}this.setIndex(a),this.setAttribute("position",new Mt(o,3)),this.setAttribute("normal",new Mt(l,3)),this.setAttribute("uv",new Mt(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Uo(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class No extends Xt{constructor(t=1,e=.4,n=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:s,q:a},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],c=[],h=[],u=new C,d=new C,f=new C,m=new C,_=new C,g=new C,p=new C;for(let v=0;v<=n;++v){const x=v/n*s*Math.PI*2;y(x,s,a,t,f),y(x+.01,s,a,t,m),g.subVectors(m,f),p.addVectors(m,f),_.crossVectors(g,p),p.crossVectors(_,g),_.normalize(),p.normalize();for(let A=0;A<=i;++A){const T=A/i*Math.PI*2,R=-e*Math.cos(T),I=e*Math.sin(T);u.x=f.x+(R*p.x+I*_.x),u.y=f.y+(R*p.y+I*_.y),u.z=f.z+(R*p.z+I*_.z),l.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),h.push(v/n),h.push(A/i)}}for(let v=1;v<=n;v++)for(let x=1;x<=i;x++){const A=(i+1)*(v-1)+(x-1),T=(i+1)*v+(x-1),R=(i+1)*v+x,I=(i+1)*(v-1)+x;o.push(A,T,I),o.push(T,R,I)}this.setIndex(o),this.setAttribute("position",new Mt(l,3)),this.setAttribute("normal",new Mt(c,3)),this.setAttribute("uv",new Mt(h,2));function y(v,x,A,T,R){const I=Math.cos(v),b=Math.sin(v),S=A/x*v,L=Math.cos(S);R.x=T*(2+L)*.5*I,R.y=T*(2+L)*b*.5,R.z=T*Math.sin(S)*.5}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new No(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Fo extends Xt{constructor(t=new xc(new C(-1,-1,0),new C(-1,1,0),new C(1,1,0)),e=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:s};const a=t.computeFrenetFrames(e,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new C,l=new C,c=new Q;let h=new C;const u=[],d=[],f=[],m=[];_(),this.setIndex(m),this.setAttribute("position",new Mt(u,3)),this.setAttribute("normal",new Mt(d,3)),this.setAttribute("uv",new Mt(f,2));function _(){for(let v=0;v<e;v++)g(v);g(s===!1?e:0),y(),p()}function g(v){h=t.getPointAt(v/e,h);const x=a.normals[v],A=a.binormals[v];for(let T=0;T<=i;T++){const R=T/i*Math.PI*2,I=Math.sin(R),b=-Math.cos(R);l.x=b*x.x+I*A.x,l.y=b*x.y+I*A.y,l.z=b*x.z+I*A.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=h.x+n*l.x,o.y=h.y+n*l.y,o.z=h.z+n*l.z,u.push(o.x,o.y,o.z)}}function p(){for(let v=1;v<=e;v++)for(let x=1;x<=i;x++){const A=(i+1)*(v-1)+(x-1),T=(i+1)*v+(x-1),R=(i+1)*v+x,I=(i+1)*(v-1)+x;m.push(A,T,I),m.push(T,R,I)}}function y(){for(let v=0;v<=e;v++)for(let x=0;x<=i;x++)c.x=v/e,c.y=x/i,f.push(c.x,c.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Fo(new no[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Ud extends Xt{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},t!==null){const e=[],n=new Set,i=new C,s=new C;if(t.index!==null){const a=t.attributes.position,o=t.index;let l=t.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,h=l.length;c<h;++c){const u=l[c],d=u.start,f=u.count;for(let m=d,_=d+f;m<_;m+=3)for(let g=0;g<3;g++){const p=o.getX(m+g),y=o.getX(m+(g+1)%3);i.fromBufferAttribute(a,p),s.fromBufferAttribute(a,y),wh(i,s,n)===!0&&(e.push(i.x,i.y,i.z),e.push(s.x,s.y,s.z))}}}else{const a=t.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const h=3*o+c,u=3*o+(c+1)%3;i.fromBufferAttribute(a,h),s.fromBufferAttribute(a,u),wh(i,s,n)===!0&&(e.push(i.x,i.y,i.z),e.push(s.x,s.y,s.z))}}this.setAttribute("position",new Mt(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function wh(r,t,e){const n=`${r.x},${r.y},${r.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${r.x},${r.y},${r.z}`;return e.has(n)===!0||e.has(i)===!0?!1:(e.add(n),e.add(i),!0)}var Ch=Object.freeze({__proto__:null,BoxGeometry:Di,CapsuleGeometry:Eo,CircleGeometry:To,ConeGeometry:mr,CylinderGeometry:pr,DodecahedronGeometry:Ao,EdgesGeometry:Ed,ExtrudeGeometry:Co,IcosahedronGeometry:Ro,LatheGeometry:Io,OctahedronGeometry:gr,PlaneGeometry:Ss,PolyhedronGeometry:ni,RingGeometry:Po,ShapeGeometry:Lo,SphereGeometry:_r,TetrahedronGeometry:Do,TorusGeometry:Uo,TorusKnotGeometry:No,TubeGeometry:Fo,WireframeGeometry:Ud});class Nd extends Le{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new xt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class Fd extends fn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class yc extends Le{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new xt(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 xt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ti,this.normalScale=new Q(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 tn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Od extends yc{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Q(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new xt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new xt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Bd extends Le{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new xt(16777215),this.specular=new xt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ti,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tn,this.combine=ur,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class zd extends Le{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ti,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class kd extends Le{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ti,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Vd extends Le{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new xt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ti,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tn,this.combine=ur,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Mc extends Le{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$u,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Sc extends Le{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class Hd extends Le{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ti,this.normalScale=new Q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Gd extends ze{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function Ti(r,t){return!r||r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function Wd(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Xd(r){function t(i,s){return r[i]-r[s]}const e=r.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(t),n}function Hl(r,t,e){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=e[s]*t;for(let l=0;l!==t;++l)i[a++]=r[o+l]}return i}function bc(r,t,e,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(t.push(s.time),e.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(t.push(s.time),a.toArray(e,e.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(t.push(s.time),e.push(a)),s=r[i++];while(s!==void 0)}function $m(r,t,e,n,i=30){const s=r.clone();s.name=t;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],h=c.getValueSize(),u=[],d=[];for(let f=0;f<c.times.length;++f){const m=c.times[f]*i;if(!(m<e||m>=n)){u.push(c.times[f]);for(let _=0;_<h;++_)d.push(c.values[f*h+_])}}u.length!==0&&(c.times=Ti(u,c.times.constructor),c.values=Ti(d,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function Km(r,t=0,e=r,n=30){n<=0&&(n=30);const i=e.tracks.length,s=t/n;for(let a=0;a<i;++a){const o=e.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(p){return p.name===o.name&&p.ValueTypeName===l});if(c===void 0)continue;let h=0;const u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=u/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const m=o.times.length-1;let _;if(s<=o.times[0]){const p=h,y=u-h;_=o.values.slice(p,y)}else if(s>=o.times[m]){const p=m*u+h,y=p+u-h;_=o.values.slice(p,y)}else{const p=o.createInterpolant(),y=h,v=u-h;p.evaluate(s),_=p.resultBuffer.slice(y,v)}l==="quaternion"&&new qe().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let p=0;p<g;++p){const y=p*f+d;if(l==="quaternion")qe.multiplyQuaternionsFlat(c.values,y,_,0,c.values,y);else{const v=f-d*2;for(let x=0;x<v;++x)c.values[y+x]-=_[x]}}}return r.blendMode=ic,r}class Qm{static convertArray(t,e){return Ti(t,e)}static isTypedArray(t){return Wd(t)}static getKeyframeOrder(t){return Xd(t)}static sortedArray(t,e,n){return Hl(t,e,n)}static flattenJSON(t,e,n,i){bc(t,e,n,i)}static subclip(t,e,n,i,s=30){return $m(t,e,n,i,s)}static makeClipAdditive(t,e=0,n=t,i=30){return Km(t,e,n,i)}}class xr{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],s=e[n-1];t:{e:{let a;n:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=e[++n],t<i)break e}a=e.length;break n}if(!(t>=s)){const o=e[1];t<o&&(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(i=s,s=e[--n-1],t>=s)break e}a=n,n=0;break n}break t}for(;n<a;){const o=n+a>>>1;t<e[o]?a=o:n=o+1}if(i=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=t*i;for(let a=0;a!==i;++a)e[a]=n[s+a];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class qd extends xr{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:bi,endingEnd:bi}}intervalChanged_(t,e,n){const i=this.parameterPositions;let s=t-2,a=t+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Ei:s=t,o=2*e-n;break;case js:s=i.length-2,o=e+i[s]-i[s+1];break;default:s=t,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case Ei:a=t,l=2*n-e;break;case js:a=1,l=n+i[1]-i[0];break;default:a=t-1,l=e}const c=(n-e)*.5,h=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(l-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,m=(n-e)/(i-e),_=m*m,g=_*m,p=-d*g+2*d*_-d*m,y=(1+d)*g+(-1.5-2*d)*_+(-.5+d)*m+1,v=(-1-f)*g+(1.5+f)*_+.5*m,x=f*g-f*_;for(let A=0;A!==o;++A)s[A]=p*a[h+A]+y*a[c+A]+v*a[l+A]+x*a[u+A];return s}}class Ec extends xr{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=t*o,c=l-o,h=(n-e)/(i-e),u=1-h;for(let d=0;d!==o;++d)s[d]=a[c+d]*u+a[l+d]*h;return s}}class Yd extends xr{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class an{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ti(e,this.TimeBufferType),this.values=Ti(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Ti(t.times,Array),values:Ti(t.values,Array)};const i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Yd(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ec(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new qd(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Qs:e=this.InterpolantFactoryMethodDiscrete;break;case ja:e=this.InterpolantFactoryMethodLinear;break;case fa:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Qs;case this.InterpolantFactoryMethodLinear:return ja;case this.InterpolantFactoryMethodSmooth:return fa}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<t;)++s;for(;a!==-1&&n[a]>e;)--a;if(++a,s!==0||a!==i){s>=a&&(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 t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==s;o++){const l=n[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),t=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),t=!1;break}a=l}if(i!==void 0&&Wd(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===fa,s=t.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=t[o],h=t[o+1];if(c!==h&&(o!==1||c!==t[0]))if(i)l=!0;else{const u=o*n,d=u-n,f=u+n;for(let m=0;m!==n;++m){const _=e[u+m];if(_!==e[d+m]||_!==e[f+m]){l=!0;break}}}if(l){if(o!==a){t[a]=t[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)e[d+f]=e[u+f]}++a}}if(s>0){t[a]=t[s];for(let o=s*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}an.prototype.ValueTypeName="";an.prototype.TimeBufferType=Float32Array;an.prototype.ValueBufferType=Float32Array;an.prototype.DefaultInterpolation=ja;class Ui extends an{constructor(t,e,n){super(t,e,n)}}Ui.prototype.ValueTypeName="bool";Ui.prototype.ValueBufferType=Array;Ui.prototype.DefaultInterpolation=Qs;Ui.prototype.InterpolantFactoryMethodLinear=void 0;Ui.prototype.InterpolantFactoryMethodSmooth=void 0;class Tc extends an{constructor(t,e,n,i){super(t,e,n,i)}}Tc.prototype.ValueTypeName="color";class or extends an{constructor(t,e,n,i){super(t,e,n,i)}}or.prototype.ValueTypeName="number";class Zd extends xr{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(i-e);let c=t*o;for(let h=c+o;c!==h;c+=4)qe.slerpFlat(s,0,a,c-o,a,c,l);return s}}class vr extends an{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new Zd(this.times,this.values,this.getValueSize(),t)}}vr.prototype.ValueTypeName="quaternion";vr.prototype.InterpolantFactoryMethodSmooth=void 0;class Ni extends an{constructor(t,e,n){super(t,e,n)}}Ni.prototype.ValueTypeName="string";Ni.prototype.ValueBufferType=Array;Ni.prototype.DefaultInterpolation=Qs;Ni.prototype.InterpolantFactoryMethodLinear=void 0;Ni.prototype.InterpolantFactoryMethodSmooth=void 0;class lr extends an{constructor(t,e,n,i){super(t,e,n,i)}}lr.prototype.ValueTypeName="vector";class cr{constructor(t="",e=-1,n=[],i=fo){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=je(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,o=n.length;a!==o;++a)e.push(tg(n[a]).scale(i));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s.userData=JSON.parse(t.userData||"{}"),s}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let s=0,a=n.length;s!==a;++s)e.push(an.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const s=e.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const h=Xd(l);l=Hl(l,1,h),c=Hl(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new or(".morphTargetInfluences["+e[o].name+"]",l,c).scale(1/n))}return new this(t,-1,a)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const i=t;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=t.length;o<l;
vendor: 4,296 bytes, line 44
44o++){const c=t[o],h=c.name.match(s);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],e,n));return a}static parseAnimation(t,e){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,m,_){if(f.length!==0){const g=[],p=[];bc(f,g,p,m),g.length!==0&&_.push(new u(d,g,p))}},i=[],s=t.name||"default",a=t.fps||30,o=t.blendMode;let l=t.length||-1;const c=t.hierarchy||[];for(let u=0;u<c.length;u++){const d=c[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let m;for(m=0;m<d.length;m++)if(d[m].morphTargets)for(let _=0;_<d[m].morphTargets.length;_++)f[d[m].morphTargets[_]]=-1;for(const _ in f){const g=[],p=[];for(let y=0;y!==d[m].morphTargets.length;++y){const v=d[m];g.push(v.time),p.push(v.morphTarget===_?1:0)}i.push(new or(".morphTargetInfluence["+_+"]",g,p))}l=f.length*a}else{const f=".bones["+e[u].name+"]";n(lr,f+".position",d,"pos",i),n(vr,f+".quaternion",d,"rot",i),n(lr,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const t=this.tracks;let e=0;for(let n=0,i=t.length;n!==i;++n){const s=this.tracks[n];e=Math.max(e,s.times[s.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let n=0;n<this.tracks.length;n++)t.push(this.tracks[n].clone());const e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}function jm(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return or;case"vector":case"vector2":case"vector3":case"vector4":return lr;case"color":return Tc;case"quaternion":return vr;case"bool":case"boolean":return Ui;case"string":return Ni}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function tg(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=jm(r.type);if(r.times===void 0){const e=[],n=[];bc(r.keys,e,n,"value"),r.times=e,r.values=n}return t.parse!==void 0?t.parse(r):new t(r.name,r.times,r.values,r.interpolation)}const Mn={enabled:!1,files:{},add:function(r,t){this.enabled!==!1&&(this.files[r]=t)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Ac{constructor(t,e,n){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.abortController=new AbortController,this.itemStart=function(h){o++,s===!1&&i.onStart!==void 0&&i.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return l?l(h):h},this.setURLModifier=function(h){return l=h,this},this.addHandler=function(h,u){return c.push(h,u),this},this.removeHandler=function(h){const u=c.indexOf(h);return u!==-1&&c.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=c.length;u<d;u+=2){const f=c[u],m=c[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return m}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const Jd=new Ac;class Ye{constructor(t){this.manager=t!==void 0?t:Jd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise(function(i,s){n.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}Ye.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ln={};
vendor: 5,091 bytes, line 44
44class eg extends Error{constructor(t,e){super(t),this.response=e}}class Vn extends Ye{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=Mn.get(`file:${t}`);if(s!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(s),this.manager.itemEnd(t)},0),s;if(Ln[t]!==void 0){Ln[t].push({onLoad:e,onProgress:n,onError:i});return}Ln[t]=[],Ln[t].push({onLoad:e,onProgress:n,onError:i});const a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Ln[t],u=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,m=f!==0;let _=0;const g=new ReadableStream({start(p){y();function y(){u.read().then(({done:v,value:x})=>{if(v)p.close();else{_+=x.byteLength;const A=new ProgressEvent("progress",{lengthComputable:m,loaded:_,total:f});for(let T=0,R=h.length;T<R;T++){const I=h[T];I.onProgress&&I.onProgress(A)}p.enqueue(x),y()}},v=>{p.error(v)})}}});return new Response(g)}else throw new eg(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return c.json();default:if(o==="")return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(m=>f.decode(m))}}}).then(c=>{Mn.add(`file:${t}`,c);const h=Ln[t];delete Ln[t];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=Ln[t];if(h===void 0)throw this.manager.itemError(t),c;delete Ln[t];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(c)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class ng extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Vn(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=cr.parse(t[n]);e.push(i)}return e}}class ig extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=this,a=[],o=new bo,l=new Vn(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(u){l.load(t[u],function(d){const f=s.parse(d,!0);a[u]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(o.minFilter=Me),o.image=a,o.format=f.format,o.needsUpdate=!0,e&&e(o))},n,i)}if(Array.isArray(t))for(let u=0,d=t.length;u<d;++u)h(u);else l.load(t,function(u){const d=s.parse(u,!0);if(d.isCubemap){const f=d.mipmaps.length/d.mipmapCount;for(let m=0;m<f;m++){a[m]={mipmaps:[]};for(let _=0;_<d.mipmapCount;_++)a[m].mipmaps.push(d.mipmaps[m*d.mipmapCount+_]),a[m].format=d.format,a[m].width=d.width,a[m].height=d.height}o.image=a}else o.image.width=d.width,o.image.height=d.height,o.mipmaps=d.mipmaps;d.mipmapCount===1&&(o.minFilter=Me),o.format=d.format,o.needsUpdate=!0,e&&e(o)},n,i);return o}}const ts=new WeakMap;class hr extends Ye{constructor(t){super(t)}load(t,e,n,i){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=Mn.get(`image:${t}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(t),setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0);else{let u=ts.get(a);u===void 0&&(u=[],ts.set(a,u)),u.push({onLoad:e,onError:i})}return a}const o=nr("img");function l(){h(),e&&e(this);const u=ts.get(this)||[];for(let d=0;d<u.length;d++){const f=u[d];f.onLoad&&f.onLoad(this)}ts.delete(this),s.manager.itemEnd(t)}function c(u){h(),i&&i(u),Mn.remove(`image:${t}`);const d=ts.get(this)||[];for(let f=0;f<d.length;f++){const m=d[f];m.onError&&m.onError(u)}ts.delete(this),s.manager.itemError(t),s.manager.itemEnd(t)}function h(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Mn.add(`image:${t}`,o),s.manager.itemStart(t),o.src=t,o}}class sg extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=new fr;
vendor: 6,723 bytes, line 44
44s.colorSpace=Ge;const a=new hr(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(t[c],function(h){s.images[c]=h,o++,o===6&&(s.needsUpdate=!0,e&&e(s))},void 0,i)}for(let c=0;c<t.length;++c)l(c);return s}}class rg extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Sn,o=new Vn(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(t,function(l){let c;try{c=s.parse(l)}catch(h){if(i!==void 0)i(h);else{console.error(h);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:rn,a.wrapT=c.wrapT!==void 0?c.wrapT:rn,a.magFilter=c.magFilter!==void 0?c.magFilter:Me,a.minFilter=c.minFilter!==void 0?c.minFilter:Me,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=yn),c.mipmapCount===1&&(a.minFilter=Me),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,e&&e(a,c)},n,i),a}}class ag extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=new _e,a=new hr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,function(o){s.image=o,s.needsUpdate=!0,e!==void 0&&e(s)},n,i),s}}class ii extends ee{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new xt(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}}class $d extends ii{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ee.DEFAULT_UP),this.updateMatrix(),this.groundColor=new xt(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const vl=new Ot,Rh=new C,Ih=new C;class wc{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Q(512,512),this.mapType=dn,this.map=null,this.mapPass=null,this.matrix=new Ot,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ms,this._frameExtents=new Q(1,1),this._viewportCount=1,this._viewports=[new te(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Rh.setFromMatrixPosition(t.matrixWorld),e.position.copy(Rh),Ih.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Ih),e.updateMatrixWorld(),vl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vl,e.coordinateSystem,e.reversedDepth),e.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(vl)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class og extends wc{constructor(){super(new Te(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,n=ps*2*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=t.distance||e.far;(n!==e.fov||i!==e.aspect||s!==e.far)&&(e.fov=n,e.aspect=i,e.far=s,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Kd extends ii{constructor(t,e,n=0,i=Math.PI/3,s=0,a=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ee.DEFAULT_UP),this.updateMatrix(),this.target=new ee,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new og}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Ph=new Ot,Fs=new C,yl=new C;class lg extends wc{constructor(){super(new Te(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Q(4,2),this._viewportCount=6,this._viewports=[new te(2,1,1,1),new te(0,1,1,1),new te(3,1,1,1),new te(1,1,1,1),new te(3,0,1,1),new te(1,0,1,1)],this._cubeDirections=[new C(1,0,0),new C(-1,0,0),new C(0,0,1),new C(0,0,-1),new C(0,1,0),new C(0,-1,0)],this._cubeUps=[new C(0,1,0),new C(0,1,0),new C(0,1,0),new C(0,1,0),new C(0,0,1),new C(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,s=t.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),Fs.setFromMatrixPosition(t.matrixWorld),n.position.copy(Fs),yl.copy(n.position),yl.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(yl),n.updateMatrixWorld(),i.makeTranslation(-Fs.x,-Fs.y,-Fs.z),Ph.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ph,n.coordinateSystem,n.reversedDepth)}}class Qd extends ii{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new lg}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class Oo extends _o{constructor(t=-1,e=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
44phicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-t,a=n+t,o=i+e,l=i-e;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}class cg extends wc{constructor(){super(new Oo(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class jd extends ii{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ee.DEFAULT_UP),this.updateMatrix(),this.target=new ee,this.shadow=new cg}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class tf extends ii{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class ef extends ii{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class nf{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new C)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,s=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*i),e.addScaledVector(a[2],.488603*s),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],1.092548*(n*i)),e.addScaledVector(a[5],1.092548*(i*s)),e.addScaledVector(a[6],.315392*(3*s*s-1)),e.addScaledVector(a[7],1.092548*(n*s)),e.addScaledVector(a[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,s=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],2*.511664*i),e.addScaledVector(a[2],2*.511664*s),e.addScaledVector(a[3],2*.511664*n),e.addScaledVector(a[4],2*.429043*n*i),e.addScaledVector(a[5],2*.429043*i*s),e.addScaledVector(a[6],.743125*s*s-.247708),e.addScaledVector(a[7],2*.429043*n*s),e.addScaledVector(a[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+i*3);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+i*3);return t}static getBasisAt(t,e){const n=t.x,i=t.y,s=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*s,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*s,e[6]=.315392*(3*s*s-1),e[7]=1.092548*n*s,e[8]=.546274*(n*n-i*i)}}class sf extends ii{constructor(t=new nf,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class Bo extends Ye{constructor(t){super(t),this.textures={}}load(t,e,n,i){const s=this,a=new Vn(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e=this.textures;function n(s){return e[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),e[s]}const i=this.createMaterialFromType(t.type);if(t.uuid!==void 0&&(i.uuid=t.uuid),t.name!==void 0&&(i.name=t.name),t.color!==void 0&&i.color!==void 0&&i.color.setHex(t.color),t.roughness!==void 0&&(i.roughness=t.roughness),t.metalness!==void 0&&(i.metalness=t.metalness),t.sheen!==void 0&&(i.sheen=t.sheen),t.sheenColor!==void 0&&(i.sheenColor=new xt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(i.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(t.emissive),t.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(t.specular),t.specularIntensity!==void 0&&(i.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(i.shininess=t.shininess),t.clearcoat!==void 0&&(i.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(i.dispersion=t.dispersion),t.iridescence!==void 0&&(i.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(i.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(i.transmission=t.transmission),t.thickness!==void 0&&(i.thickness=t.thickness),t.attenuationDistance!==void 0&&(i.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(i.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(i.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(i.fog=t.fog),t.flatShading!==void 0&&(i.flatShading=t.flatShading),t.blending!==void 0&&(i.blending=t.blending),t.combine!==void 0&&(i.combine=t.combine),t.side!==void 0&&(i.side=t.side),t.shadowSide!==void 0&&(i.shadowSide=t.shadowSide),t.opacity!==void 0&&(i.opacity=t.opacity),t.transparent!==void 0&&(i.transparent=t.transparent),t.alphaTest!==void 0&&(i.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(i.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(i.depthFunc=t.depthFunc),t.depthTest!==void 0&&(i.depthTest=t.depthTest),t.depthWrite!==void 0&&(i.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(i.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(i.blendSrc=t.blendSrc),t.blendDst!==void 0&&(i.blendDst=t.blendDst),t.blendEquation!==void 0&&(i.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(i.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(i.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(i.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(i.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(i.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(i.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(i.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(i.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(i.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(i.stencilWrite=t.stencilWrite),t.wireframe
vendor: 17,079 bytes, line 44
44!==void 0&&(i.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(i.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(i.rotation=t.rotation),t.linewidth!==void 0&&(i.linewidth=t.linewidth),t.dashSize!==void 0&&(i.dashSize=t.dashSize),t.gapSize!==void 0&&(i.gapSize=t.gapSize),t.scale!==void 0&&(i.scale=t.scale),t.polygonOffset!==void 0&&(i.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(i.dithering=t.dithering),t.alphaToCoverage!==void 0&&(i.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(i.forceSinglePass=t.forceSinglePass),t.visible!==void 0&&(i.visible=t.visible),t.toneMapped!==void 0&&(i.toneMapped=t.toneMapped),t.userData!==void 0&&(i.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const s in t.uniforms){const a=t.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=n(a.value);break;case"c":i.uniforms[s].value=new xt().setHex(a.value);break;case"v2":i.uniforms[s].value=new Q().fromArray(a.value);break;case"v3":i.uniforms[s].value=new C().fromArray(a.value);break;case"v4":i.uniforms[s].value=new te().fromArray(a.value);break;case"m3":i.uniforms[s].value=new Ht().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Ot().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(t.defines!==void 0&&(i.defines=t.defines),t.vertexShader!==void 0&&(i.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(i.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(i.glslVersion=t.glslVersion),t.extensions!==void 0)for(const s in t.extensions)i.extensions[s]=t.extensions[s];if(t.lights!==void 0&&(i.lights=t.lights),t.clipping!==void 0&&(i.clipping=t.clipping),t.size!==void 0&&(i.size=t.size),t.sizeAttenuation!==void 0&&(i.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(i.map=n(t.map)),t.matcap!==void 0&&(i.matcap=n(t.matcap)),t.alphaMap!==void 0&&(i.alphaMap=n(t.alphaMap)),t.bumpMap!==void 0&&(i.bumpMap=n(t.bumpMap)),t.bumpScale!==void 0&&(i.bumpScale=t.bumpScale),t.normalMap!==void 0&&(i.normalMap=n(t.normalMap)),t.normalMapType!==void 0&&(i.normalMapType=t.normalMapType),t.normalScale!==void 0){let s=t.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Q().fromArray(s)}return t.displacementMap!==void 0&&(i.displacementMap=n(t.displacementMap)),t.displacementScale!==void 0&&(i.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(i.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(i.roughnessMap=n(t.roughnessMap)),t.metalnessMap!==void 0&&(i.metalnessMap=n(t.metalnessMap)),t.emissiveMap!==void 0&&(i.emissiveMap=n(t.emissiveMap)),t.emissiveIntensity!==void 0&&(i.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(i.specularMap=n(t.specularMap)),t.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(t.specularIntensityMap)),t.specularColorMap!==void 0&&(i.specularColorMap=n(t.specularColorMap)),t.envMap!==void 0&&(i.envMap=n(t.envMap)),t.envMapRotation!==void 0&&i.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(i.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(i.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(i.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(i.lightMap=n(t.lightMap)),t.lightMapIntensity!==void 0&&(i.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(i.aoMap=n(t.aoMap)),t.aoMapIntensity!==void 0&&(i.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(i.gradientMap=n(t.gradientMap)),t.clearcoatMap!==void 0&&(i.clearcoatMap=n(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Q().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(i.iridescenceMap=n(t.iridescenceMap)),t.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),t.transmissionMap!==void 0&&(i.transmissionMap=n(t.transmissionMap)),t.thicknessMap!==void 0&&(i.thicknessMap=n(t.thicknessMap)),t.anisotropyMap!==void 0&&(i.anisotropyMap=n(t.anisotropyMap)),t.sheenColorMap!==void 0&&(i.sheenColorMap=n(t.sheenColorMap)),t.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return Bo.createMaterialFromType(t)}static createMaterialFromType(t){const e={ShadowMaterial:Nd,SpriteMaterial:cc,RawShaderMaterial:Fd,ShaderMaterial:fn,PointsMaterial:uc,MeshPhysicalMaterial:Od,MeshStandardMaterial:yc,MeshPhongMaterial:Bd,MeshToonMaterial:zd,MeshNormalMaterial:kd,MeshLambertMaterial:Vd,MeshDepthMaterial:Mc,MeshDistanceMaterial:Sc,MeshBasicMaterial:ei,MeshMatcapMaterial:Hd,LineDashedMaterial:Gd,LineBasicMaterial:ze,Material:Le};return new e[t]}}class Gl{static extractUrlBase(t){const e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||t===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class rf extends Xt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class af extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Vn(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(t,function(o){try{e(s.parse(JSON.parse(o)))}catch(l){i?i(l):console.error(l),s.manager.itemError(t)}},n,i)}parse(t){const e={},n={};function i(f,m){if(e[m]!==void 0)return e[m];const g=f.interleavedBuffers[m],p=s(f,g.buffer),y=rs(g.type,p),v=new yo(y,g.stride);return v.uuid=g.uuid,e[m]=v,v}function s(f,m){if(n[m]!==void 0)return n[m];const g=f.arrayBuffers[m],p=new Uint32Array(g).buffer;return n[m]=p,p}const a=t.isInstancedBufferGeometry?new rf:new Xt,o=t.data.index;if(o!==void 0){const f=rs(o.type,o.array);a.setIndex(new oe(f,1))}const l=t.data.attributes;for(const f in l){const m=l[f];let _;if(m.isInterleavedBufferAttribute){const g=i(t.data,m.data);_=new Pi(g,m.itemSize,m.offset,m.normalized)}else{const g=rs(m.type,m.array),p=m.isInstancedBufferAttribute?gs:oe;_=new p(g,m.itemSize,m.normalized)}m.name!==void 0&&(_.name=m.name),m.usage!==void 0&&_.setUsage(m.usage),a.setAttribute(f,_)}const c=t.data.morphAttributes;if(c)for(const f in c){const m=c[f],_=[];for(let g=0,p=m.length;g<p;g++){const y=m[g];let v;if(y.isInterleavedBufferAttribute){const x=i(t.data,y.data);v=new Pi(x,y.itemSize,y.offset,y.normalized)}else{const x=rs(y.type,y.array);v=new oe(x,y.itemSize,y.normalized)}y.name!==void 0&&(v.name=y.name),_.push(v)}a.morphAttributes[f]=_}t.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const u=t.data.groups||t.data.drawcalls||t.data.offsets;if(u!==void 0)for(let f=0,m=u.length;f!==m;++f){const _=u[f];a.addGroup(_.start,_.count,_.materialIndex)}const d=t.data.boundingSphere;return d!==void 0&&(a.boundingSphere=new we().fromJSON(d)),t.name&&(a.name=t.name),t.userData&&(a.userData=t.userData),a}}class hg extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=this,a=this.path===""?Gl.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const o=new Vn(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(l){let c=null;try{c=JSON.parse(l)}catch(u){i!==void 0&&i(u),console.error("THREE:ObjectLoader: Can't parse "+t+".",u.message);return}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+t)),console.error("THREE.ObjectLoader: Can't load "+t);return}s.parse(c,e)},n,i)}async loadAsync(t,e){const n=this,i=this.path===""?Gl.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const s=new Vn(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(t,e),o=JSON.parse(a),l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,i),a=this.parseImages(t.images,function(){e!==void 0&&e(c)}),o=this.parseTextures(t.textures,a),l=this.parseMaterials(t.materials,o),c=this.parseObject(t.object,s,l,o,n),h=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,h),this.bindLightTargets(c),e!==void 0){let u=!1;for(const d in a)if(a[d].data instanceof HTMLImageElement){u=!0;break}u===!1&&e(c)}return c}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),s=await this.parseImagesAsync(t.images),a=this.parseTextures(t.textures,s),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,i,o,a,e),c=this.parseSkeletons(t.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(t){const e={};if(t!==void 0)for(let n=0,i=t.length;n<i;n++){const s=new Ci().fromJSON(t[n]);e[s.uuid]=s}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),t!==void 0)for(let s=0,a=t.length;s<a;s++){const o=new Mo().fromJSON(t[s],i);n[o.uuid]=o}return n}parseGeometries(t,e){const n={};if(t!==void 0){const i=new af;for(let s=0,a=t.length;s<a;s++){let o;const l=t[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in Ch?o=Ch[l.type].fromJSON(l,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),n[l.uuid]=o}}return n}parseMaterials(t,e){const n={},i={};if(t!==void 0){const s=new Bo;s.setTextures(e);for(let a=0,o=t.length;a<o;a++){const l=t[a];n[l.uuid]===void 0&&(n[l.uuid]=s.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(t){const e={};if(t!==void 0)for(let n=0;n<t.length;n++){const i=t[n],s=cr.parse(i);e[s.uuid]=s}return e}parseImages(t,e){const n=this,i={};let s;function a(l){return n.manager.itemStart(l),s.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:n.resourcePath+c;return a(h)}else return l.data?{data:rs(l.type,l.data),width:l.width,height:l.height}:null}if(t!==void 0&&t.length>0){const l=new Ac(e);s=new hr(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=t.length;c<h;c++){const u=t[c],d=u.url;if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m],p=o(g);p!==null&&(p instanceof HTMLImageElement?f.push(p):f.push(new Sn(p.data,p.width,p.height)))}i[u.uuid]=new Kn(f)}else{const f=o(u.url);i[u.uuid]=new Kn(f)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:e.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:rs(a.type,a.data),width:a.width,height:a.height}:null}if(t!==void 0&&t.length>0){i=new hr(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=t.length;a<o;a++){const l=t[a],c=l.url;if(Array.isArray(c)){const h=[];for(let u=0,d=c.length;u<d;u++){const f=c[u],m=await s(f);m!==null&&(m instanceof HTMLImageElement?h.push(m):h.push(new Sn(m.data,m.width,m.height)))}n[l.uuid]=new Kn(h)}else{const h=await s(l.url);n[l.uuid]=new Kn(h)}}}return n}parseTextures(t,e){function n(s,a){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(t!==void 0)for(let s=0,a=t.length;s<a;s++){const o=t[s];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),e[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const l=e[o.image],c=l.data;let h;Array.isArray(c)?(h=new fr,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new Sn:h=new _e,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,ug)),o.channel!==void 0&&(h.channel=o.channel),o.offset!==void 0&&h.offset.fromArray(o.offset),o.repeat!==void 0&&h.repeat.fromArray(o.repeat),o.center!==void 0&&h.center.fromArray(o.center),o.rotation!==void 0&&(h.rotation=o.rotation),o.wrap!==void 0&&(h.wrapS=n(o.wrap[0],Lh),h.wrapT=n(o.wrap[1],Lh)),o.format!==void 0&&(h.format=o.format),o.internalFormat!==void 0&&(h.internalFormat=o.internalFormat),o.type!==void 0&&(h.type=o.type),o.colorSpace!==void 0&&(h.colorSpace=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,Dh)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,Dh)),o.anisotropy!==void 0&&(h.anisotropy=o.anisotropy),o.flipY!==void 0&&(h.flipY=o.flipY),o.generateMipmaps!==void 0&&(h.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(h.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(h.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(h.compareFunction=o.compareFunction),o.userData!==void 0&&(h.userData=o.userData),i[o.uuid]=h}return i}parseObject(t,e,n,i,s){let a;function o(d){return e[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),e[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const f=[];for(let m=0,_=d.length;m<_;m++){const g=d[m];n[g]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),n[d]}}function c(d){return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),i[d]}let h,u;switch(t.type){case"Scene":a=new pd,t.background!==void 0&&(Number.isInteger(t.background)?a.background=new xt(t.background):a.background=c(t.background)),t.environment!==void 0&&(a.environment=c(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?a.fog=new vo(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(a.fog=new xo(t.fog.color,t.fog.density)),t.fog.name!==""&&(a.fog.name=t.fog.name)),t.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=t.backgroundBlurriness),t.backgroundIntensity!==void 0&&(a.backgroundIntensity=t.backgroundIntensity),t.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(t.backgroundRotation),t.environmentIntensity!==void 0&&(a.environmentIntensity=t.environmentIntensity),t.environmentRotation!==void 0&&a.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":a=new Te(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(a.focus=t.focus),t.zoom!==void 0&&(a.zoom=t.zoom),t.filmGauge!==void 0&&(a.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(a.filmOffset=t.filmOffset),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new Oo(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(a.zoom=t.zoom),t.view!==void 0&&(a.view=Object.assign({},t.view));break;case"AmbientLight":a=new tf(t.color,t.intensity);break;case"DirectionalLight":a=new jd(t.color,t.intensity),a.target=t.target||"";break;case"PointLight":a=new Qd(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":a=new ef(t.color,t.intensity,t.width,t.height);break;case"SpotLight":a=new Kd(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),a.target=t.target||"";break;case"HemisphereLight":a=new $d(t.color,t.groundColor,t.intensity);break;case"LightProbe":a=new sf().fromJSON(t);break;case"SkinnedMesh":h=o(t.geometry),u=l(t.material),a=new xd(h,u),t.bindMode!==void 0&&(a.bindMode=t.bindMode),t.bindMatrix!==void 0&&a.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(a.skeleton=t.skeleton);break;case"Mesh":h=o(t.geometry),u=l(t.material),a=new ye(h,u);break;case"InstancedMesh":h=o(t.geometry),u=l(t.material);const d=t.count,f=t.instanceMatrix,m=t.instanceColor;a=new vd(h,u,d),a.instanceMatrix=new gs(new Float32Array(f.array),16),m!==void 0&&(a.instanceColor=new gs(new Float32Array(m.array),m.itemSize));break;case"BatchedMesh":h=o(t.geometry),u=l(t.material),a=new yd(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,u),a.geometry=h,a.perObjectFrustumCulled=t.perObjectFrustumCulled,a.sortObjects=t.sortObjects,a._drawRanges=t.drawRanges,a._reservedRanges=t.reservedRanges,a._geometryInfo=t.geometryInfo.map(_=>{let g=null,p=null;
vendor: 6,491 bytes, line 44
44return _.boundingBox!==void 0&&(g=new Pe().fromJSON(_.boundingBox)),_.boundingSphere!==void 0&&(p=new we().fromJSON(_.boundingSphere)),{..._,boundingBox:g,boundingSphere:p}}),a._instanceInfo=t.instanceInfo,a._availableInstanceIds=t._availableInstanceIds,a._availableGeometryIds=t._availableGeometryIds,a._nextIndexStart=t.nextIndexStart,a._nextVertexStart=t.nextVertexStart,a._geometryCount=t.geometryCount,a._maxInstanceCount=t.maxInstanceCount,a._maxVertexCount=t.maxVertexCount,a._maxIndexCount=t.maxIndexCount,a._geometryInitialized=t.geometryInitialized,a._matricesTexture=c(t.matricesTexture.uuid),a._indirectTexture=c(t.indirectTexture.uuid),t.colorsTexture!==void 0&&(a._colorsTexture=c(t.colorsTexture.uuid)),t.boundingSphere!==void 0&&(a.boundingSphere=new we().fromJSON(t.boundingSphere)),t.boundingBox!==void 0&&(a.boundingBox=new Pe().fromJSON(t.boundingBox));break;case"LOD":a=new _d;break;case"Line":a=new jn(o(t.geometry),l(t.material));break;case"LineLoop":a=new Md(o(t.geometry),l(t.material));break;case"LineSegments":a=new Tn(o(t.geometry),l(t.material));break;case"PointCloud":case"Points":a=new Sd(o(t.geometry),l(t.material));break;case"Sprite":a=new gd(l(t.material));break;case"Group":a=new as;break;case"Bone":a=new hc;break;default:a=new ee}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.matrix!==void 0?(a.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.up!==void 0&&a.up.fromArray(t.up),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(a.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(a.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.frustumCulled!==void 0&&(a.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(a.renderOrder=t.renderOrder),t.userData!==void 0&&(a.userData=t.userData),t.layers!==void 0&&(a.layers.mask=t.layers),t.children!==void 0){const d=t.children;for(let f=0;f<d.length;f++)a.add(this.parseObject(d[f],e,n,i,s))}if(t.animations!==void 0){const d=t.animations;for(let f=0;f<d.length;f++){const m=d[f];a.animations.push(s[m])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(a.autoUpdate=t.autoUpdate);const d=t.levels;for(let f=0;f<d.length;f++){const m=d[f],_=a.getObjectByProperty("uuid",m.object);_!==void 0&&a.addLevel(_,m.distance,m.hysteresis)}}return a}bindSkeletons(t,e){Object.keys(e).length!==0&&t.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const i=e[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(t){t.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){const n=e.target,i=t.getObjectByProperty("uuid",n);i!==void 0?e.target=i:e.target=new ee}})}}const ug={UVMapping:ro,CubeReflectionMapping:zn,CubeRefractionMapping:Qn,EquirectangularReflectionMapping:Zs,EquirectangularRefractionMapping:Js,CubeUVReflectionMapping:xs},Lh={RepeatWrapping:$s,ClampToEdgeWrapping:rn,MirroredRepeatWrapping:Ks},Dh={NearestFilter:Ae,NearestMipmapNearestFilter:Jl,NearestMipmapLinearFilter:ss,LinearFilter:Me,LinearMipmapNearestFilter:ks,LinearMipmapLinearFilter:yn},Ml=new WeakMap;class dg extends Ye{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,i){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,a=Mn.get(`image-bitmap:${t}`);if(a!==void 0){if(s.manager.itemStart(t),a.then){a.then(c=>{if(Ml.has(a)===!0)i&&i(Ml.get(a)),s.manager.itemError(t),s.manager.itemEnd(t);else return e&&e(c),s.manager.itemEnd(t),c});return}return setTimeout(function(){e&&e(a),s.manager.itemEnd(t)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(t,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Mn.add(`image-bitmap:${t}`,c),e&&e(c),s.manager.itemEnd(t),c}).catch(function(c){i&&i(c),Ml.set(l,c),Mn.remove(`image-bitmap:${t}`),s.manager.itemError(t),s.manager.itemEnd(t)});Mn.add(`image-bitmap:${t}`,l),s.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let ia;class Cc{static getContext(){return ia===void 0&&(ia=new(window.AudioContext||window.webkitAudioContext)),ia}static setContext(t){ia=t}}class fg extends Ye{constructor(t){super(t)}load(t,e,n,i){const s=this,a=new Vn(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){try{const c=l.slice(0);Cc.getContext().decodeAudioData(c,function(u){e(u)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):console.error(l),s.manager.itemError(t)}}}const Uh=new Ot,Nh=new Ot,di=new Ot;class pg{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Te,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Te,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov
vendor: 4,559 bytes, line 44
44=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,di.copy(t.projectionMatrix);const i=e.eyeSep/2,s=i*e.near/e.focus,a=e.near*Math.tan(wi*e.fov*.5)/e.zoom;let o,l;Nh.elements[12]=-i,Uh.elements[12]=i,o=-a*e.aspect+s,l=a*e.aspect+s,di.elements[0]=2*e.near/(l-o),di.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(di),o=-a*e.aspect-s,l=a*e.aspect-s,di.elements[0]=2*e.near/(l-o),di.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(di)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Nh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Uh)}}class of extends Te{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class lf{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}const fi=new C,Sl=new qe,mg=new C,pi=new C,mi=new C;class gg extends ee{constructor(){super(),this.type="AudioListener",this.context=Cc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new lf}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(fi,Sl,mg),pi.set(0,0,-1).applyQuaternion(Sl),mi.set(0,1,0).applyQuaternion(Sl),e.positionX){const n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(fi.x,n),e.positionY.linearRampToValueAtTime(fi.y,n),e.positionZ.linearRampToValueAtTime(fi.z,n),e.forwardX.linearRampToValueAtTime(pi.x,n),e.forwardY.linearRampToValueAtTime(pi.y,n),e.forwardZ.linearRampToValueAtTime(pi.z,n),e.upX.linearRampToValueAtTime(mi.x,n),e.upY.linearRampToValueAtTime(mi.y,n),e.upZ.linearRampToValueAtTime(mi.z,n)}else e.setPosition(fi.x,fi.y,fi.z),e.setOrientation(pi.x,pi.y,pi.z,mi.x,mi.y,mi.z)}}class cf extends ee{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}
vendor: 4,122 bytes, line 44
44pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(t=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),t.sourceType!=="buffer"?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}}const gi=new C,Fh=new qe,_g=new C,_i=new C;class xg extends cf{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl
vendor: 27,677 bytes, line 44
44===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(gi,Fh,_g),_i.set(0,0,1).applyQuaternion(Fh);const e=this.panner;if(e.positionX){const n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(gi.x,n),e.positionY.linearRampToValueAtTime(gi.y,n),e.positionZ.linearRampToValueAtTime(gi.z,n),e.orientationX.linearRampToValueAtTime(_i.x,n),e.orientationY.linearRampToValueAtTime(_i.y,n),e.orientationZ.linearRampToValueAtTime(_i.z,n)}else e.setPosition(gi.x,gi.y,gi.z),e.setOrientation(_i.x,_i.y,_i.z)}}class vg{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class hf{constructor(t,e,n){this.binding=t,this.valueSize=n;let i,s,a;switch(e){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,s=t*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=e}else{a+=e;const o=e/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=e*this._origIndex;this._mixBufferRegion(n,i,l,1-s,e)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){o.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let s=n,a=i;s!==a;++s)e[s]=e[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)t[e+a]=t[n+a]}_slerp(t,e,n,i){qe.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,s){const a=this._workIndex*s;qe.multiplyQuaternionsFlat(t,a,t,e,t,n),qe.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=e+o;t[l]=t[l]*a+t[n+o]*i}}_lerpAdditive(t,e,n,i,s){for(let a=0;a!==s;++a){const o=e+a;t[o]=t[o]+t[n+a]*i}}}const Rc="\\[\\]\\.:\\/",yg=new RegExp("["+Rc+"]","g"),Ic="[^"+Rc+"]",Mg="[^"+Rc.replace("\\.","")+"]",Sg=/((?:WC+[\/:])*)/.source.replace("WC",Ic),bg=/(WCOD+)?/.source.replace("WCOD",Mg),Eg=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ic),Tg=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ic),Ag=new RegExp("^"+Sg+bg+Eg+Tg+"$"),wg=["material","materials","bones","map"];class Cg{constructor(t,e,n){const i=n||jt.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}class jt{constructor(t,e,n){this.path=e,this.parsedPath=n||jt.parseTrackName(e),this.node=jt.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new jt.Composite(t,e,n):new jt(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(yg,"")}static parseTrackName(t){const e=Ag.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);wg.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===e||o.uuid===e)return o;const l=n(o.children);if(l)return l}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let s=e.propertyIndex;if(t||(t=jt.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=e.objectIndex;switch(n){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let h=0;h<t.length;h++)if(t[h].name===c){c=h;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(c!==void 0){if(t[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[c]}}const a=t[i];if(a===void 0){const c=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;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}}jt.Composite=Cg;jt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};jt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};jt.prototype.GetterByBindingType=[jt.prototype._getValue_direct,jt.prototype._getValue_array,jt.prototype._getValue_arrayElement,jt.prototype._getValue_toArray];jt.prototype.SetterByBindingTypeAndVersioning=[[jt.prototype._setValue_direct,jt.prototype._setValue_direct_setNeedsUpdate,jt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[jt.prototype._setValue_array,jt.prototype._setValue_array_setNeedsUpdate,jt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[jt.prototype._setValue_arrayElement,jt.prototype._setValue_arrayElement_setNeedsUpdate,jt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[jt.prototype._setValue_fromArray,jt.prototype._setValue_fromArray_setNeedsUpdate,jt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Rg{constructor(){this.isAnimationObjectGroup=!0,this.uuid=je(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,i=arguments.length;n!==i;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=t.length,c=this.nCachedObjects_;for(let h=0,u=arguments.length;h!==u;++h){const d=arguments[h],f=d.uuid;let m=e[f];if(m===void 0){m=l++,e[f]=m,t.push(d);for(let _=0,g=a;_!==g;++_)s[_].push(new jt(d,n[_],i[_]))}else if(m<c){o=t[m];const _=--c,g=t[_];e[g.uuid]=m,t[m]=g,e[f]=_,t[_]=d;for(let p=0,y=a;p!==y;++p){const v=s[p],x=v[_];let A=v[m];v[m]=x,A===void 0&&(A=new jt(d,n[p],i[p])),v[_]=A}}else t[m]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,h=e[c];if(h!==void 0&&h>=s){const u=s++,d=t[u];e[d.uuid]=h,t[h]=d,e[c]=u,t[u]=l;for(let f=0,m=i;f!==m;++f){const _=n[f],g=_[u],p=_[h];_[h]=g,_[u]=p}}}this.nCachedObjects_=s}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,a=t.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],h=c.uuid,u=e[h];if(u!==void 0)if(delete e[h],u<s){const d=--s,f=t[d],m=--a,_=t[m];e[f.uuid]=u,t[u]=f,e[_.uuid]=d,t[d]=_,t.pop();for(let g=0,p=i;g!==p;++g){const y=n[g],v=y[d],x=y[m];y[u]=v,y[d]=x,y.pop()}}else{const d=--a,f=t[d];d>0&&(e[f.uuid]=u),t[u]=f,t.pop();for(let m=0,_=i;m!==_;++m){const g=n[m];g[u]=g[d],g.pop()}}}this.nCachedObjects_=s}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,u=new Array(c);i=s.length,n[t]=i,a.push(t),o.push(e),s.push(u);for(let d=h,f=l.length;d!==f;++d){const m=l[d];u[d]=new jt(m,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(n!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=t[o];e[c]=n,a[n]=l,a.pop(),s[n]=s[o],s.pop(),i[n]=i[o],i.pop()}}}class uf{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const s=e.tracks,a=s.length,o=new Array(a),l={endingStart:bi,endingEnd:bi};for(let c=0;c!==a;++c){const h=s[c].createInterpolant(null);o[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Zu,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n=!1){if(t.fadeOut(e),this.fadeIn(e),n===!0){const i=this._clip.duration,s=t._clip.duration,a=s/i,o=i/s;t.warp(1,a,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n=!1){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+n,c[0]=t/a,c[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled){this._updateWeight(t);return}const s=this._startTime;if(s!==null){const l=(t-s)*n;l<0||n===0?e=0:(this._startTime=null,e=n*l)}e*=this._updateTimeScale(t);const a=this._updateTime(e),o=this._updateWeight(t);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case ic:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case fo:default:for(let h=0,u=l.length;h!==u;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,s=this._loopCount;const a=n===Ju;if(t===0)return s===-1?i:a&&(s&1)===1?e-i:i;if(n===Yu){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else if(i<0)i=0;else{this.time=i;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(s===-1&&(t>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=e||i<0){const o=Math.floor(i/e);i-=e*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(l===1){const c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Ei,i.endingEnd=Ei):(t?i.endingStart=this.zeroSlopeAtStart?Ei:bi:i.endingStart=js,e?i.endingEnd=this.zeroSlopeAtEnd?Ei:bi:i.endingEnd=js)}_scheduleFading(t,e,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=e,o[1]=s+t,l[1]=n,this}}const Ig=new Float32Array(1);class Pg extends En{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,s=i.length,a=t._propertyBindings,o=t._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let h=c[l];h===void 0&&(h={},c[l]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let m=h[f];if(m!==void 0)++m.referenceCount,a[u]=m;else{if(m=a[u],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,f));continue}const _=e&&e._propertyBindings[u].binding.parsedPath;m=new hf(jt.create(n,f,_),d.ValueTypeName,d.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,f),a[u]=m}o[u].resultBuffer=m.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const n=(t._localRoot||this._root).uuid,i=t._clip.uuid,s=this._actionsByClip[i];this._bindAction(t,s&&s.knownActions[0]),this._addInactiveAction(t,i,n)}const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,s=this._actionsByClip;let a=s[e];if(a===void 0)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=a;else{const o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=i.length,i.push(t),a.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const s=t._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],h=t._byClipCacheIndex;c._byClipCacheIndex=h,l[h]=c,l.pop(),t._byClipCacheIndex=null;const u=o.actionByRoot,d=(t._localRoot||this._root).uuid;delete u[d],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){const s=e[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[e];a===void 0&&(a={},i[e]=a),a[n]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],l=e[e.length-1],c=t._cacheIndex;l._cacheIndex=c,e[c]=l,e.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,s=e[i];t._cacheIndex=i,e[i]=t,s._cacheIndex=n,e[n]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return n===void 0&&(n=new Ec(new Float32Array(2),new Float32Array(2),1,Ig),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,s=e[i];t.__cacheIndex=i,e[i]=t,s.__cacheIndex=n,e[n]=s}clipAction(t,e,n){const i=e||this._root,s=i.uuid;let a=typeof t=="string"?cr.findByName(i,t):t;const o=a!==null?a.uuid:t,l=this._actionsByClip[o];let c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=fo),l!==void 0){const u=l.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new uf(this,a,e,n);return this._bindAction(h,c),this._addInactiveAction(h,o,s),h}existingAction(t,e){const n=e||this._root,i=n.uuid,s=typeof t=="string"?cr.findByName(n,t):t,a=s?s.uuid:t,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,s=Math.sign(t),a=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(i,t,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const h=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=h,e[h]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,l=o[e];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[e];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(t,e){const n=this.existingAction(t,e);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Lg extends ac{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new mo(null,t,e,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Pc{constructor(t){this.value=t}clone(){return new Pc(this.value.clone===void 0?this.value:this.value.clone())}}let Dg=0;class Ug extends En{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Dg++}),this.name="",this.usage=er,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return e!==-1&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let n=0,i=e.length;n<i;n++){const s=Array.isArray(e[n])?e[n]:[e[n]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Ng extends yo{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class Fg{constructor(t,e,n,i,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=s,this.normalized=a,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const Oh=new Ot;class Og{constructor(t,e,n=0,i=1/0){this.ray=new ys(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new go,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: 
44Unsupported camera type: "+e.type)}setFromXRController(t){return Oh.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Oh),this}intersectObject(t,e=!0,n=[]){return Wl(t,this,n,e),n.sort(Bh),n}intersectObjects(t,e=!0,n=[]){for(let i=0,s=t.length;i<s;i++)Wl(t[i],this,n,e);return n.sort(Bh),n}}function Bh(r,t){return r.distance-t.distance}function Wl(r,t,e,n){let i=!0;if(r.layers.test(t.layers)&&r.raycast(t,e)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)Wl(s[a],t,e,!0)}}class Bg{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=zg.bind(this),t.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function zg(){this._document.hidden===!1&&this.reset()}class kg{constructor(t=1,e=0,n=0){this.radius=t,this.phi=e,this.theta=n}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Nt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Nt(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Vg{constructor(t=1,e=0,n=0){this.radius=t,this.theta=e,this.y=n}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return new this.constructor().copy(this)}}class Lc{constructor(t,e,n,i){Lc.prototype.isMatrix2=!0,this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){const s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=i,this}}const zh=new Q;class Hg{constructor(t=new Q(1/0,1/0),e=new Q(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=zh.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,zh).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const kh=new C,sa=new C,es=new C,ns=new C,bl=new C,Gg=new C,Wg=new C;class Xg{constructor(t=new C,e=new C){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){kh.subVectors(t,this.start),sa.subVectors(this.end,this.start);const n=sa.dot(sa);let s=sa.dot(kh)/n;return e&&(s=Nt(s,0,1)),s}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=Gg,n=Wg){const i=10000000000000001e-32;let s,a;const o=this.start,l=t.start,c=this.end,h=t.end;es.subVectors(c,o),ns.subVectors(h,l),bl.subVectors(o,l);const u=es.dot(es),d=ns.dot(ns),f=ns.dot(bl);if(u<=i&&d<=i)return e.copy(o),n.copy(l),e.sub(n),e.dot(e);
vendor: 5,134 bytes, line 44
44if(u<=i)s=0,a=f/d,a=Nt(a,0,1);else{const m=es.dot(bl);if(d<=i)a=0,s=Nt(-m/u,0,1);else{const _=es.dot(ns),g=u*d-_*_;g!==0?s=Nt((_*f-m*d)/g,0,1):s=0,a=(_*s+f)/d,a<0?(a=0,s=Nt(-m/u,0,1)):a>1&&(a=1,s=Nt((_-m)/u,0,1))}}return e.copy(o).add(es.multiplyScalar(s)),n.copy(l).add(ns.multiplyScalar(a)),e.sub(n),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Vh=new C;class qg extends ee{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new Xt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,h=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}n.setAttribute("position",new Mt(i,3));const s=new ze({fog:!1,toneMapped:!1});this.cone=new Tn(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Vh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Vh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Zn=new C,ra=new Ot,El=new Ot;class Yg extends Tn{constructor(t){const e=df(t),n=new Xt,i=[],s=[];for(let c=0;c<e.length;c++){const h=e[c];h.parent&&h.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}n.setAttribute("position",new Mt(i,3)),n.setAttribute("color",new Mt(s,3));const a=new ze({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;const o=new xt(255),l=new xt(65280);this.setColors(o,l)}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");El.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<e.length;s++){const o=e[s];o.parent&&o.parent.isBone&&(ra.multiplyMatrices(El,o.matrixWorld),Zn.setFromMatrixPosition(ra),i.setXYZ(a,Zn.x,Zn.y,Zn.z),ra.multiplyMatrices(El,o.parent.matrixWorld),Zn.setFromMatrixPosition(ra),i.setXYZ(a+1,Zn.x,Zn.y,Zn.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}setColors(t,e){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,t.r,t.g,t.b),i.setXYZ(s+1,e.r,e.g,e.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function df(r){const t=[];r.isBone===!0&&t.push(r);for(let e=0;e<r.children.length;e++)t.push(...df(r.children[e]));return t}class Zg extends ye{constructor(t,e,n){const i=new _r(e,4,2),s=new ei({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Jg=new C,Hh=new xt,Gh=new xt;class $g extends ee{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new gr(e);i.rotateY(Math.PI*.5),this.material=new ei({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new oe(a,3)),this.add(new ye(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Hh.copy(this.light.color),Gh.copy(this.light.groundColor);for(let n=0,i=e.count;n<i;n++){const s=n<i/2?Hh:Gh;e.setXYZ(n,s.r,s.g,s.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(Jg.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Kg extends Tn{constructor(t=10,e=10,n=4473924,i=8947848){n=new xt(n),i=new xt(i);const s=e/2,a=t/e,o=t/2,l=[],c=[];for(let d=0,f=0,m=-o;d<=e;d++,m+=a){l.push(-o,0,m,o,0,m),l.push(m,0,-o,m,0,o);const _=d===s?n:i;_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3,_.toArray(c,f),f+=3}const h=new Xt;h.setAttribute("position",new Mt(l,3)),h.setAttribute("color",new Mt(c,3));const u=new ze({vertexColors:!0,toneMapped:!1});super(h,u),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Qg extends Tn{constructor(t=10,e=16,n=8,i=64,s=4473924,a=8947848){s=new xt(s),a=new xt(a);const o=[],l=[];
vendor: 10,249 bytes, line 44
44if(e>1)for(let u=0;u<e;u++){const d=u/e*(Math.PI*2),f=Math.sin(d)*t,m=Math.cos(d)*t;o.push(0,0,0),o.push(f,0,m);const _=u&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let u=0;u<n;u++){const d=u&1?s:a,f=t-t/n*u;for(let m=0;m<i;m++){let _=m/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f;o.push(g,0,p),l.push(d.r,d.g,d.b),_=(m+1)/i*(Math.PI*2),g=Math.sin(_)*f,p=Math.cos(_)*f,o.push(g,0,p),l.push(d.r,d.g,d.b)}}const c=new Xt;c.setAttribute("position",new Mt(o,3)),c.setAttribute("color",new Mt(l,3));const h=new ze({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Wh=new C,aa=new C,Xh=new C;class jg extends ee{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",e===void 0&&(e=1);let i=new Xt;i.setAttribute("position",new Mt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new ze({fog:!1,toneMapped:!1});this.lightPlane=new jn(i,s),this.add(this.lightPlane),i=new Xt,i.setAttribute("position",new Mt([0,0,0,0,0,1],3)),this.targetLine=new jn(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Wh.setFromMatrixPosition(this.light.matrixWorld),aa.setFromMatrixPosition(this.light.target.matrixWorld),Xh.subVectors(aa,Wh),this.lightPlane.lookAt(aa),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(aa),this.targetLine.scale.z=Xh.length()}}const oa=new C,ge=new _o;class t_ extends Tn{constructor(t){const e=new Xt,n=new ze({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(m,_){l(m),l(_)}function l(m){i.push(0,0,0),s.push(0,0,0),a[m]===void 0&&(a[m]=[]),a[m].push(i.length/3-1)}e.setAttribute("position",new Mt(i,3)),e.setAttribute("color",new Mt(s,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new xt(16755200),h=new xt(16711680),u=new xt(43775),d=new xt(16777215),f=new xt(3355443);this.setColors(c,h,u,d,f)}setColors(t,e,n,i,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,t.r,t.g,t.b),o.setXYZ(1,t.r,t.g,t.b),o.setXYZ(2,t.r,t.g,t.b),o.setXYZ(3,t.r,t.g,t.b),o.setXYZ(4,t.r,t.g,t.b),o.setXYZ(5,t.r,t.g,t.b),o.setXYZ(6,t.r,t.g,t.b),o.setXYZ(7,t.r,t.g,t.b),o.setXYZ(8,t.r,t.g,t.b),o.setXYZ(9,t.r,t.g,t.b),o.setXYZ(10,t.r,t.g,t.b),o.setXYZ(11,t.r,t.g,t.b),o.setXYZ(12,t.r,t.g,t.b),o.setXYZ(13,t.r,t.g,t.b),o.setXYZ(14,t.r,t.g,t.b),o.setXYZ(15,t.r,t.g,t.b),o.setXYZ(16,t.r,t.g,t.b),o.setXYZ(17,t.r,t.g,t.b),o.setXYZ(18,t.r,t.g,t.b),o.setXYZ(19,t.r,t.g,t.b),o.setXYZ(20,t.r,t.g,t.b),o.setXYZ(21,t.r,t.g,t.b),o.setXYZ(22,t.r,t.g,t.b),o.setXYZ(23,t.r,t.g,t.b),o.setXYZ(24,e.r,e.g,e.b),o.setXYZ(25,e.r,e.g,e.b),o.setXYZ(26,e.r,e.g,e.b),o.setXYZ(27,e.r,e.g,e.b),o.setXYZ(28,e.r,e.g,e.b),o.setXYZ(29,e.r,e.g,e.b),o.setXYZ(30,e.r,e.g,e.b),o.setXYZ(31,e.r,e.g,e.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const t=this.geometry,e=this.pointMap,n=1,i=1;let s,a;if(ge.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===Qe)s=-1,a=1;else if(this.camera.coordinateSystem===fs)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);xe("c",e,t,ge,0,0,s),xe("t",e,t,ge,0,0,a),xe("n1",e,t,ge,-n,-i,s),xe("n2",e,t,ge,n,-i,s),xe("n3",e,t,ge,-n,i,s),xe("n4",e,t,ge,n,i,s),xe("f1",e,t,ge,-n,-i,a),xe("f2",e,t,ge,n,-i,a),xe("f3",e,t,ge,-n,i,a),xe("f4",e,t,ge,n,i,a),xe("u1",e,t,ge,n*.7,i*1.1,s),xe("u2",e,t,ge,-n*.7,i*1.1,s),xe("u3",e,t,ge,0,i*2,s),xe("cf1",e,t,ge,-n,0,a),xe("cf2",e,t,ge,n,0,a),xe("cf3",e,t,ge,0,-i,a),xe("cf4",e,t,ge,0,i,a),xe("cn1",e,t,ge,-n,0,s),xe("cn2",e,t,ge,n,0,s),xe("cn3",e,t,ge,0,-i,s),xe("cn4",e,t,ge,0,i,s),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function xe(r,t,e,n,i,s,a){oa.set(i,s,a).unproject(n);const o=t[r];if(o!==void 0){const l=e.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],oa.x,oa.y,oa.z)}}const la=new Pe;class e_ extends Tn{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new Xt;s.setIndex(new oe(n,1)),s.setAttribute("position",new oe(i,3)),super(s,new ze({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&la.setFromObject(this.object),la.isEmpty())return;const t=la.min,e=la.max,n=this.geometry.attributes.position,i=n.array;i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=t.x,i[4]=e.y,i[5]=e.z,i[6]=t.x,i[7]=t.y,i[8]=e.z,i[9]=e.x,i[10]=t.y,i[11]=e.z,i[12]=e.x,i[13]=e.y,i[14]=t.z,i[15]=t.x,i[16]=e.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=e.x,i[22]=t.y,i[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class n_ extends Tn{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Xt;s.setIndex(new oe(n,1)),s.setAttribute("position",new Mt(i,3)),super(s,new ze({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class i_ extends jn{constructor(t,e=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new Xt;a.setAttribute("position",new Mt(s,3)),a.computeBoundingSphere(),super(a,new ze({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Xt;l.setAttribute("position",new Mt(o,3)),l.computeBoundingSphere(),this.add(new ye(l,new ei({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const qh=new C;let ca,Tl;class s_ extends ee{constructor(t=new C(0,0,1),e=new C(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",ca===void 0&&(ca=new Xt,ca.setAttribute("position",new Mt([0,0,0,0,1,0],3)),Tl=new mr(.5,1,5,1),Tl.translate(0,-.5,0)),this.position.copy(e),this.line=new jn(ca,new ze({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ye(Tl,new ei({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,s,a)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{qh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(qh,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class r_ extends Tn{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Xt;i.setAttribute("position",new Mt(e,3)),i.setAttribute("color",new Mt(n,3));const s=new ze({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(t,e,n){const i=new xt,s=this.geometry.attributes.color.array;return i.set(t),i.toArray(s,0),i.toArray(s,3),i.set(e),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class a_{constructor(){this.type="ShapePath",this.color=new xt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new io,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,s,a){return this.currentPath.bezierCurveTo(t,e,n,i,s,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(p){const y=[];for(let v=0,x=p.length;v<x;v++){const A=p[v],T=new Ci;T.curves=A.curves,y.push(T)}return y}function n(p,y){const v=y.length;let x=!1;for(let A=v-1,T=0;T<v;A=T++){let R=y[A],I=y[T],b=I.x-R.x,S=I.y-R.y;if(Math.abs(S)>
vendor: 9,210 bytes, lines 44-107
44Number.EPSILON){if(S<0&&(R=y[T],b=-b,I=y[A],S=-S),p.y<R.y||p.y>I.y)continue;if(p.y===R.y){if(p.x===R.x)return!0}else{const L=S*(p.x-R.x)-b*(p.y-R.y);if(L===0)return!0;if(L<0)continue;x=!x}}else{if(p.y!==R.y)continue;if(I.x<=p.x&&p.x<=R.x||R.x<=p.x&&p.x<=I.x)return!0}}return x}const i=un.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Ci,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],d=[];let f=[],m=0,_;d[m]=void 0,f[m]=[];for(let p=0,y=s.length;p<y;p++)o=s[p],_=o.getPoints(),a=i(_),a=t?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new Ci,p:_},d[m].s.curves=o.curves,h&&m++,f[m]=[]):f[m].push({h:o,p:_[0]});if(!d[0])return e(s);if(d.length>1){let p=!1,y=0;for(let v=0,x=d.length;v<x;v++)u[v]=[];for(let v=0,x=d.length;v<x;v++){const A=f[v];for(let T=0;T<A.length;T++){const R=A[T];let I=!0;for(let b=0;b<d.length;b++)n(R.p,d[b].p)&&(v!==b&&y++,I?(I=!1,u[b].push(R)):p=!0);I&&u[v].push(R)}}y>0&&p===!1&&(f=u)}let g;for(let p=0,y=d.length;p<y;p++){l=d[p].s,c.push(l),g=f[p];for(let v=0,x=g.length;v<x;v++)l.holes.push(g[v].h)}return c}}class o_ extends En{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){if(t===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=t}disconnect(){}dispose(){}update(){}}function l_(r,t){const e=r.image&&r.image.width?r.image.width/r.image.height:1;return e>t?(r.repeat.x=1,r.repeat.y=e/t,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=t/e,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function c_(r,t){const e=r.image&&r.image.width?r.image.width/r.image.height:1;return e>t?(r.repeat.x=t/e,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=e/t,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function h_(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Xl(r,t,e,n){const i=u_(n);switch(e){case tc:return r*t;case co:return r*t/i.components*i.byteLength;case dr:return r*t/i.components*i.byteLength;case nc:return r*t*2/i.components*i.byteLength;case ho:return r*t*2/i.components*i.byteLength;case ec:return r*t*3/i.components*i.byteLength;case Oe:return r*t*4/i.components*i.byteLength;case uo:return r*t*4/i.components*i.byteLength;case Vs:case Hs:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case Gs:case Ws:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Aa:case Ca:return Math.max(r,16)*Math.max(t,8)/4;case Ta:case wa:return Math.max(r,8)*Math.max(t,8)/2;case Ra:case Ia:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case Pa:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case La:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Da:return Math.floor((r+4)/5)*Math.floor((t+3)/4)*16;case Ua:return Math.floor((r+4)/5)*Math.floor((t+4)/5)*16;case Na:return Math.floor((r+5)/6)*Math.floor((t+4)/5)*16;case Fa:return Math.floor((r+5)/6)*Math.floor((t+5)/6)*16;case Oa:return Math.floor((r+7)/8)*Math.floor((t+4)/5)*16;case Ba:return Math.floor((r+7)/8)*Math.floor((t+5)/6)*16;case za:return Math.floor((r+7)/8)*Math.floor((t+7)/8)*16;case ka:return Math.floor((r+9)/10)*Math.floor((t+4)/5)*16;case Va:return Math.floor((r+9)/10)*Math.floor((t+5)/6)*16;case Ha:return Math.floor((r+9)/10)*Math.floor((t+7)/8)*16;case Ga:return Math.floor((r+9)/10)*Math.floor((t+9)/10)*16;case Wa:return Math.floor((r+11)/12)*Math.floor((t+9)/10)*16;case Xa:return Math.floor((r+11)/12)*Math.floor((t+11)/12)*16;case qa:case Ya:case Za:return Math.ceil(r/4)*Math.ceil(t/4)*16;case Ja:case $a:return Math.ceil(r/4)*Math.ceil(t/4)*8;case Ka:case Qa:return Math.ceil(r/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function u_(r){switch(r){case dn:case $l:return{byteLength:1,components:1};case cs:case Kl:case vs:return{byteLength:2,components:1};case oo:case lo:return{byteLength:2,components:4};case kn:case ao:case Xe:return{byteLength:4,components:1};case Ql:case jl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class d_{static contain(t,e){return l_(t,e)}static cover(t,e){return c_(t,e)}static fill(t){return h_(t)}static getByteLength(t,e,n,i){return Xl(t,e,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:so}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=so);/**
45 * @license
46 * Copyright 2010-2025 Three.js Authors
47 * SPDX-License-Identifier: MIT
48 */function ff(){let r=null,t=!1,e=null,n=null;function i(s,a){e(s,a),n=r.requestAnimationFrame(i)}return{start:function(){t!==!0&&e!==null&&(n=r.requestAnimationFrame(i),t=!0)},stop:function(){r.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(s){e=s},setContext:function(s){r=s}}}function f_(r){const t=new WeakMap;function e(o,l){const c=o.array,h=o.usage,u=c.byteLength,d=r.createBuffer();r.bindBuffer(l,d),r.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=r.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,l,c){const h=l.array,u=l.updateRanges;if(r.bindBuffer(c,o),u.length===0)r.bufferSubData(c,0,h);else{u.sort((f,m)=>f.start-m.start);let d=0;for(let f=1;f<u.length;f++){const m=u[d],_=u[f];_.start<=m.start+m.count+1?m.count=Math.max(m.count,_.start+_.count-m.start):(++d,u[d]=_)}u.length=d+1;for(let f=0,m=u.length;f<m;f++){const _=u[f];r.bufferSubData(c,_.start*h.BYTES_PER_ELEMENT,h,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),t.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=t.get(o);l&&(r.deleteBuffer(l.buffer),t.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=t.get(o);(!h||h.version<o.version)&&t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=t.get(o);if(c===void 0)t.set(o,e(o,l));else if(c.version<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:i,remove:s,update:a}}var p_=`#ifdef USE_ALPHAHASH
49	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
50#endif`,m_=`#ifdef USE_ALPHAHASH
51	const float ALPHA_HASH_SCALE = 0.05;
52	float hash2D( vec2 value ) {
53		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
54	}
55	float hash3D( vec3 value ) {
56		return hash2D( vec2( hash2D( value.xy ), value.z ) );
57	}
58	float getAlphaHashThreshold( vec3 position ) {
59		float maxDeriv = max(
60			length( dFdx( position.xyz ) ),
61			length( dFdy( position.xyz ) )
62		);
63		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
64		vec2 pixScales = vec2(
65			exp2( floor( log2( pixScale ) ) ),
66			exp2( ceil( log2( pixScale ) ) )
67		);
68		vec2 alpha = vec2(
69			hash3D( floor( pixScales.x * position.xyz ) ),
70			hash3D( floor( pixScales.y * position.xyz ) )
71		);
72		float lerpFactor = fract( log2( pixScale ) );
73		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
74		float a = min( lerpFactor, 1.0 - lerpFactor );
75		vec3 cases = vec3(
76			x * x / ( 2.0 * a * ( 1.0 - a ) ),
77			( x - 0.5 * a ) / ( 1.0 - a ),
78			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
79		);
80		float threshold = ( x < ( 1.0 - a ) )
81			? ( ( x < a ) ? cases.x : cases.y )
82			: cases.z;
83		return clamp( threshold , 1.0e-6, 1.0 );
84	}
85#endif`,g_=`#ifdef USE_ALPHAMAP
86	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
87#endif`,__=`#ifdef USE_ALPHAMAP
88	uniform sampler2D alphaMap;
89#endif`,x_=`#ifdef USE_ALPHATEST
90	#ifdef ALPHA_TO_COVERAGE
91	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
92	if ( diffuseColor.a == 0.0 ) discard;
93	#else
94	if ( diffuseColor.a < alphaTest ) discard;
95	#endif
96#endif`,v_=`#ifdef USE_ALPHATEST
97	uniform float alphaTest;
98#endif`,y_=`#ifdef USE_AOMAP
99	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
100	reflectedLight.indirectDiffuse *= ambientOcclusion;
101	#if defined( USE_CLEARCOAT ) 
102		clearcoatSpecularIndirect *= ambientOcclusion;
103	#endif
104	#if defined( USE_SHEEN ) 
105		sheenSpecularIndirect *= ambientOcclusion;
106	#endif
107	#if defined( USE_ENVMAP ) && defined( STANDARD )
108		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
109		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
110	#endif
111#endif`,M_=`#ifdef USE_AOMAP
112	uniform sampler2D aoMap;
113	uniform float aoMapIntensity;
114#endif`,S_=`#ifdef USE_BATCHING
115	#if ! defined( GL_ANGLE_multi_draw )
116	#define gl_DrawID _gl_DrawID
117	uniform int _gl_DrawID;
118	#endif
119	uniform highp sampler2D batchingTexture;
120	uniform highp usampler2D batchingIdTexture;
121	mat4 getBatchingMatrix( const in float i ) {
122		int size = textureSize( batchingTexture, 0 ).x;
123		int j = int( i ) * 4;
124		int x = j % size;
125		int y = j / size;
126		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
127		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
128		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
129		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
130		return mat4( v1, v2, v3, v4 );
131	}
132	float getIndirectIndex( const in int i ) {
133		int size = textureSize( batchingIdTexture, 0 ).x;
134		int x = i % size;
135		int y = i / size;
136		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
137	}
138#endif
139#ifdef USE_BATCHING_COLOR
140	uniform sampler2D batchingColorTexture;
141	vec3 getBatchingColor( const in float i ) {
142		int size = textureSize( batchingColorTexture, 0 ).x;
143		int j = int( i );
144		int x = j % size;
145		int y = j / size;
146		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
147	}
148#endif`,b_=`#ifdef USE_BATCHING
149	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
150#endif`,E_=`vec3 transformed = vec3( position );
151#ifdef USE_ALPHAHASH
152	vPosition = vec3( position );
153#endif`,T_=`vec3 objectNormal = vec3( normal );
154#ifdef USE_TANGENT
155	vec3 objectTangent = vec3( tangent.xyz );
156#endif`,A_=`float G_BlinnPhong_Implicit( ) {
157	return 0.25;
158}
159float D_BlinnPhong( const in float shininess, const in float dotNH ) {
160	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
161}
162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
163	vec3 halfDir = normalize( lightDir + viewDir );
164	float dotNH = saturate( dot( normal, halfDir ) );
165	float dotVH = saturate( dot( viewDir, halfDir ) );
166	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
167	float G = G_BlinnPhong_Implicit( );
168	float D = D_BlinnPhong( shininess, dotNH );
169	return F * ( G * D );
170} // validated`,w_=`#ifdef USE_IRIDESCENCE
171	const mat3 XYZ_TO_REC709 = mat3(
172		 3.2404542, -0.9692660,  0.0556434,
173		-1.5371385,  1.8760108, -0.2040259,
174		-0.4985314,  0.0415560,  1.0572252
175	);
176	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
177		vec3 sqrtF0 = sqrt( fresnel0 );
178		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
179	}
180	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
181		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
182	}
183	float IorToFresnel0( float transmittedIor, float incidentIor ) {
184		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
185	}
186	vec3 evalSensitivity( float OPD, vec3 shift ) {
187		float phase = 2.0 * PI * OPD * 1.0e-9;
188		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
189		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
190		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
191		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
192		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 ) );
193		xyz /= 1.0685e-7;
194		vec3 rgb = XYZ_TO_REC709 * xyz;
195		return rgb;
196	}
197	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
198		vec3 I;
199		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
200		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
201		float cosTheta2Sq = 1.0 - sinTheta2Sq;
202		if ( cosTheta2Sq < 0.0 ) {
203			return vec3( 1.0 );
204		}
205		float cosTheta2 = sqrt( cosTheta2Sq );
206		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
208		float T121 = 1.0 - R12;
209		float phi12 = 0.0;
210		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
211		float phi21 = PI - phi12;
212		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
213		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
214		vec3 phi23 = vec3( 0.0 );
215		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
216		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
217		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
218		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
219		vec3 phi = vec3( phi21 ) + phi23;
220		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
221		vec3 r123 = sqrt( R123 );
222		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
223		vec3 C0 = R12 + Rs;
224		I = C0;
225		vec3 Cm = Rs - T121;
226		for ( int m = 1; m <= 2; ++ m ) {
227			Cm *= r123;
228			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
229			I += Cm * Sm;
230		}
231		return max( I, vec3( 0.0 ) );
232	}
233#endif`,C_=`#ifdef USE_BUMPMAP
234	uniform sampler2D bumpMap;
235	uniform float bumpScale;
236	vec2 dHdxy_fwd() {
237		vec2 dSTdx = dFdx( vBumpMapUv );
238		vec2 dSTdy = dFdy( vBumpMapUv );
239		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
240		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
241		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
242		return vec2( dBx, dBy );
243	}
244	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
245		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
246		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
247		vec3 vN = surf_norm;
248		vec3 R1 = cross( vSigmaY, vN );
249		vec3 R2 = cross( vN, vSigmaX );
250		float fDet = dot( vSigmaX, R1 ) * faceDirection;
251		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
252		return normalize( abs( fDet ) * surf_norm - vGrad );
253	}
254#endif`,R_=`#if NUM_CLIPPING_PLANES > 0
255	vec4 plane;
256	#ifdef ALPHA_TO_COVERAGE
257		float distanceToPlane, distanceGradient;
258		float clipOpacity = 1.0;
259		#pragma unroll_loop_start
260		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
261			plane = clippingPlanes[ i ];
262			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
263			distanceGradient = fwidth( distanceToPlane ) / 2.0;
264			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
265			if ( clipOpacity == 0.0 ) discard;
266		}
267		#pragma unroll_loop_end
268		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
269			float unionClipOpacity = 1.0;
270			#pragma unroll_loop_start
271			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
272				plane = clippingPlanes[ i ];
273				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
274				distanceGradient = fwidth( distanceToPlane ) / 2.0;
275				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
276			}
277			#pragma unroll_loop_end
278			clipOpacity *= 1.0 - unionClipOpacity;
279		#endif
280		diffuseColor.a *= clipOpacity;
281		if ( diffuseColor.a == 0.0 ) discard;
282	#else
283		#pragma unroll_loop_start
284		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
285			plane = clippingPlanes[ i ];
286			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
287		}
288		#pragma unroll_loop_end
289		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
290			bool clipped = true;
291			#pragma unroll_loop_start
292			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
293				plane = clippingPlanes[ i ];
294				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
295			}
296			#pragma unroll_loop_end
297			if ( clipped ) discard;
298		#endif
299	#endif
300#endif`,I_=`#if NUM_CLIPPING_PLANES > 0
301	varying vec3 vClipPosition;
302	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
303#endif`,P_=`#if NUM_CLIPPING_PLANES > 0
304	varying vec3 vClipPosition;
305#endif`,L_=`#if NUM_CLIPPING_PLANES > 0
306	vClipPosition = - mvPosition.xyz;
307#endif`,D_=`#if defined( USE_COLOR_ALPHA )
308	diffuseColor *= vColor;
309#elif defined( USE_COLOR )
310	diffuseColor.rgb *= vColor;
311#endif`,U_=`#if defined( USE_COLOR_ALPHA )
312	varying vec4 vColor;
313#elif defined( USE_COLOR )
314	varying vec3 vColor;
315#endif`,N_=`#if defined( USE_COLOR_ALPHA )
316	varying vec4 vColor;
317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
318	varying vec3 vColor;
319#endif`,F_=`#if defined( USE_COLOR_ALPHA )
320	vColor = vec4( 1.0 );
321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
322	vColor = vec3( 1.0 );
323#endif
324#ifdef USE_COLOR
325	vColor *= color;
326#endif
327#ifdef USE_INSTANCING_COLOR
328	vColor.xyz *= instanceColor.xyz;
329#endif
330#ifdef USE_BATCHING_COLOR
331	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
332	vColor.xyz *= batchingColor.xyz;
333#endif`,O_=`#define PI 3.141592653589793
334#define PI2 6.283185307179586
335#define PI_HALF 1.5707963267948966
336#define RECIPROCAL_PI 0.3183098861837907
337#define RECIPROCAL_PI2 0.15915494309189535
338#define EPSILON 1e-6
339#ifndef saturate
340#define saturate( a ) clamp( a, 0.0, 1.0 )
341#endif
342#define whiteComplement( a ) ( 1.0 - saturate( a ) )
343float pow2( const in float x ) { return x*x; }
344vec3 pow2( const in vec3 x ) { return x*x; }
345float pow3( const in float x ) { return x*x*x; }
346float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
349highp float rand( const in vec2 uv ) {
350	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
351	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
352	return fract( sin( sn ) * c );
353}
354#ifdef HIGH_PRECISION
355	float precisionSafeLength( vec3 v ) { return length( v ); }
356#else
357	float precisionSafeLength( vec3 v ) {
358		float maxComponent = max3( abs( v ) );
359		return length( v / maxComponent ) * maxComponent;
360	}
361#endif
362struct IncidentLight {
363	vec3 color;
364	vec3 direction;
365	bool visible;
366};
367struct ReflectedLight {
368	vec3 directDiffuse;
369	vec3 directSpecular;
370	vec3 indirectDiffuse;
371	vec3 indirectSpecular;
372};
373#ifdef USE_ALPHAHASH
374	varying vec3 vPosition;
375#endif
376vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
377	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
378}
379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
380	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
381}
382mat3 transposeMat3( const in mat3 m ) {
383	mat3 tmp;
384	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
385	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
386	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
387	return tmp;
388}
389bool isPerspectiveMatrix( mat4 m ) {
390	return m[ 2 ][ 3 ] == - 1.0;
391}
392vec2 equirectUv( in vec3 dir ) {
393	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
394	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
395	return vec2( u, v );
396}
397vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
398	return RECIPROCAL_PI * diffuseColor;
399}
400vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
401	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
402	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
403}
404float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
405	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
406	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
407} // validated`,B_=`#ifdef ENVMAP_TYPE_CUBE_UV
408	#define cubeUV_minMipLevel 4.0
409	#define cubeUV_minTileSize 16.0
410	float getFace( vec3 direction ) {
411		vec3 absDirection = abs( direction );
412		float face = - 1.0;
413		if ( absDirection.x > absDirection.z ) {
414			if ( absDirection.x > absDirection.y )
415				face = direction.x > 0.0 ? 0.0 : 3.0;
416			else
417				face = direction.y > 0.0 ? 1.0 : 4.0;
418		} else {
419			if ( absDirection.z > absDirection.y )
420				face = direction.z > 0.0 ? 2.0 : 5.0;
421			else
422				face = direction.y > 0.0 ? 1.0 : 4.0;
423		}
424		return face;
425	}
426	vec2 getUV( vec3 direction, float face ) {
427		vec2 uv;
428		if ( face == 0.0 ) {
429			uv = vec2( direction.z, direction.y ) / abs( direction.x );
430		} else if ( face == 1.0 ) {
431			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
432		} else if ( face == 2.0 ) {
433			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
434		} else if ( face == 3.0 ) {
435			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
436		} else if ( face == 4.0 ) {
437			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
438		} else {
439			uv = vec2( direction.x, direction.y ) / abs( direction.z );
440		}
441		return 0.5 * ( uv + 1.0 );
442	}
443	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
444		float face = getFace( direction );
445		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
446		mipInt = max( mipInt, cubeUV_minMipLevel );
447		float faceSize = exp2( mipInt );
448		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
449		if ( face > 2.0 ) {
450			uv.y += faceSize;
451			face -= 3.0;
452		}
453		uv.x += face * faceSize;
454		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
455		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
456		uv.x *= CUBEUV_TEXEL_WIDTH;
457		uv.y *= CUBEUV_TEXEL_HEIGHT;
458		#ifdef texture2DGradEXT
459			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
460		#else
461			return texture2D( envMap, uv ).rgb;
462		#endif
463	}
464	#define cubeUV_r0 1.0
465	#define cubeUV_m0 - 2.0
466	#define cubeUV_r1 0.8
467	#define cubeUV_m1 - 1.0
468	#define cubeUV_r4 0.4
469	#define cubeUV_m4 2.0
470	#define cubeUV_r5 0.305
471	#define cubeUV_m5 3.0
472	#define cubeUV_r6 0.21
473	#define cubeUV_m6 4.0
474	float roughnessToMip( float roughness ) {
475		float mip = 0.0;
476		if ( roughness >= cubeUV_r1 ) {
477			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
478		} else if ( roughness >= cubeUV_r4 ) {
479			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
480		} else if ( roughness >= cubeUV_r5 ) {
481			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
482		} else if ( roughness >= cubeUV_r6 ) {
483			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
484		} else {
485			mip = - 2.0 * log2( 1.16 * roughness );		}
486		return mip;
487	}
488	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
489		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
490		float mipF = fract( mip );
491		float mipInt = floor( mip );
492		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
493		if ( mipF == 0.0 ) {
494			return vec4( color0, 1.0 );
495		} else {
496			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
497			return vec4( mix( color0, color1, mipF ), 1.0 );
498		}
499	}
500#endif`,z_=`vec3 transformedNormal = objectNormal;
501#ifdef USE_TANGENT
502	vec3 transformedTangent = objectTangent;
503#endif
504#ifdef USE_BATCHING
505	mat3 bm = mat3( batchingMatrix );
506	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
507	transformedNormal = bm * transformedNormal;
508	#ifdef USE_TANGENT
509		transformedTangent = bm * transformedTangent;
510	#endif
511#endif
512#ifdef USE_INSTANCING
513	mat3 im = mat3( instanceMatrix );
514	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
515	transformedNormal = im * transformedNormal;
516	#ifdef USE_TANGENT
517		transformedTangent = im * transformedTangent;
518	#endif
519#endif
520transformedNormal = normalMatrix * transformedNormal;
521#ifdef FLIP_SIDED
522	transformedNormal = - transformedNormal;
523#endif
524#ifdef USE_TANGENT
525	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
526	#ifdef FLIP_SIDED
527		transformedTangent = - transformedTangent;
528	#endif
529#endif`,k_=`#ifdef USE_DISPLACEMENTMAP
530	uniform sampler2D displacementMap;
531	uniform float displacementScale;
532	uniform float displacementBias;
533#endif`,V_=`#ifdef USE_DISPLACEMENTMAP
534	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
534placementBias );
535#endif`,H_=`#ifdef USE_EMISSIVEMAP
536	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
537	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
538		emissiveColor = sRGBTransferEOTF( emissiveColor );
539	#endif
540	totalEmissiveRadiance *= emissiveColor.rgb;
541#endif`,G_=`#ifdef USE_EMISSIVEMAP
542	uniform sampler2D emissiveMap;
543#endif`,W_="gl_FragColor = linearToOutputTexel( gl_FragColor );",X_=`vec4 LinearTransferOETF( in vec4 value ) {
544	return value;
545}
546vec4 sRGBTransferEOTF( in vec4 value ) {
547	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 );
548}
549vec4 sRGBTransferOETF( in vec4 value ) {
550	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 );
551}`,q_=`#ifdef USE_ENVMAP
552	#ifdef ENV_WORLDPOS
553		vec3 cameraToFrag;
554		if ( isOrthographic ) {
555			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
556		} else {
557			cameraToFrag = normalize( vWorldPosition - cameraPosition );
558		}
559		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
560		#ifdef ENVMAP_MODE_REFLECTION
561			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
562		#else
563			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
564		#endif
565	#else
566		vec3 reflectVec = vReflect;
567	#endif
568	#ifdef ENVMAP_TYPE_CUBE
569		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
570	#else
571		vec4 envColor = vec4( 0.0 );
572	#endif
573	#ifdef ENVMAP_BLENDING_MULTIPLY
574		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
575	#elif defined( ENVMAP_BLENDING_MIX )
576		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
577	#elif defined( ENVMAP_BLENDING_ADD )
578		outgoingLight += envColor.xyz * specularStrength * reflectivity;
579	#endif
580#endif`,Y_=`#ifdef USE_ENVMAP
581	uniform float envMapIntensity;
582	uniform float flipEnvMap;
583	uniform mat3 envMapRotation;
584	#ifdef ENVMAP_TYPE_CUBE
585		uniform samplerCube envMap;
586	#else
587		uniform sampler2D envMap;
588	#endif
589	
590#endif`,Z_=`#ifdef USE_ENVMAP
591	uniform float reflectivity;
592	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
593		#define ENV_WORLDPOS
594	#endif
595	#ifdef ENV_WORLDPOS
596		varying vec3 vWorldPosition;
597		uniform float refractionRatio;
598	#else
599		varying vec3 vReflect;
600	#endif
601#endif`,J_=`#ifdef USE_ENVMAP
602	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
603		#define ENV_WORLDPOS
604	#endif
605	#ifdef ENV_WORLDPOS
606		
607		varying vec3 vWorldPosition;
608	#else
609		varying vec3 vReflect;
610		uniform float refractionRatio;
611	#endif
612#endif`,$_=`#ifdef USE_ENVMAP
613	#ifdef ENV_WORLDPOS
614		vWorldPosition = worldPosition.xyz;
615	#else
616		vec3 cameraToVertex;
617		if ( isOrthographic ) {
618			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
619		} else {
620			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
621		}
622		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
623		#ifdef ENVMAP_MODE_REFLECTION
624			vReflect = reflect( cameraToVertex, worldNormal );
625		#else
626			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
627		#endif
628	#endif
629#endif`,K_=`#ifdef USE_FOG
630	vFogDepth = - mvPosition.z;
631#endif`,Q_=`#ifdef USE_FOG
632	varying float vFogDepth;
633#endif`,j_=`#ifdef USE_FOG
634	#ifdef FOG_EXP2
635		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
636	#else
637		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
638	#endif
639	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
640#endif`,t0=`#ifdef USE_FOG
641	uniform vec3 fogColor;
642	varying float vFogDepth;
643	#ifdef FOG_EXP2
644		uniform float fogDensity;
645	#else
646		uniform float fogNear;
647		uniform float fogFar;
648	#endif
649#endif`,e0=`#ifdef USE_GRADIENTMAP
650	uniform sampler2D gradientMap;
651#endif
652vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
653	float dotNL = dot( normal, lightDirection );
654	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
655	#ifdef USE_GRADIENTMAP
656		return vec3( texture2D( gradientMap, coord ).r );
657	#else
658		vec2 fw = fwidth( coord ) * 0.5;
659		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
660	#endif
661}`,n0=`#ifdef USE_LIGHTMAP
662	uniform sampler2D lightMap;
663	uniform float lightMapIntensity;
664#endif`,i0=`LambertMaterial material;
665material.diffuseColor = diffuseColor.rgb;
666material.specularStrength = specularStrength;`,s0=`varying vec3 vViewPosition;
667struct LambertMaterial {
668	vec3 diffuseColor;
669	float specularStrength;
670};
671void 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 ) {
672	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
673	vec3 irradiance = dotNL * directLight.color;
674	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
675}
676void 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 ) {
677	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
678}
679#define RE_Direct				RE_Direct_Lambert
680#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,r0=`uniform bool receiveShadow;
681uniform vec3 ambientLightColor;
682#if defined( USE_LIGHT_PROBES )
683	uniform vec3 lightProbe[ 9 ];
684#endif
685vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
686	float x = normal.x, y = normal.y, z = normal.z;
687	vec3 result = shCoefficients[ 0 ] * 0.886227;
688	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
689	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
690	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
691	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
692	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
693	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
694	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
695	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
696	return result;
697}
698vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
699	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
700	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
701	return irradiance;
702}
703vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
704	vec3 irradiance = ambientLightColor;
705	return irradiance;
706}
707float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
708	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
709	if ( cutoffDistance > 0.0 ) {
710		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
711	}
712	return distanceFalloff;
713}
714float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
715	return smoothstep( coneCosine, penumbraCosine, angleCosine );
716}
717#if NUM_DIR_LIGHTS > 0
718	struct DirectionalLight {
719		vec3 direction;
720		vec3 color;
721	};
722	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
723	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
724		light.color = directionalLight.color;
725		light.direction = directionalLight.direction;
726		light.visible = true;
727	}
728#endif
729#if NUM_POINT_LIGHTS > 0
730	struct PointLight {
731		vec3 position;
732		vec3 color;
733		float distance;
734		float decay;
735	};
736	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
737	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
738		vec3 lVector = pointLight.position - geometryPosition;
739		light.direction = normalize( lVector );
740		float lightDistance = length( lVector );
741		light.color = pointLight.color;
742		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
743		light.visible = ( light.color != vec3( 0.0 ) );
744	}
745#endif
746#if NUM_SPOT_LIGHTS > 0
747	struct SpotLight {
748		vec3 position;
749		vec3 direction;
750		vec3 color;
751		float distance;
752		float decay;
753		float coneCos;
754		float penumbraCos;
755	};
756	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
757	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
758		vec3 lVector = spotLight.position - geometryPosition;
759		light.direction = normalize( lVector );
760		float angleCos = dot( light.direction, spotLight.direction );
761		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
762		if ( spotAttenuation > 0.0 ) {
763			float lightDistance = length( lVector );
764			light.color = spotLight.color * spotAttenuation;
765			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
766			light.visible = ( light.color != vec3( 0.0 ) );
767		} else {
768			light.color = vec3( 0.0 );
769			light.visible = false;
770		}
771	}
772#endif
773#if NUM_RECT_AREA_LIGHTS > 0
774	struct RectAreaLight {
775		vec3 color;
776		vec3 position;
777		vec3 halfWidth;
778		vec3 halfHeight;
779	};
780	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
781	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
782#endif
783#if NUM_HEMI_LIGHTS > 0
784	struct HemisphereLight {
785		vec3 direction;
786		vec3 skyColor;
787		vec3 groundColor;
788	};
789	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
790	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
791		float dotNL = dot( normal, hemiLight.direction );
792		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
793		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
794		return irradiance;
795	}
796#endif`,a0=`#ifdef USE_ENVMAP
797	vec3 getIBLIrradiance( const in vec3 normal ) {
798		#ifdef ENVMAP_TYPE_CUBE_UV
799			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
800			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
801			return PI * envMapColor.rgb * envMapIntensity;
802		#else
803			return vec3( 0.0 );
804		#endif
805	}
806	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
807		#ifdef ENVMAP_TYPE_CUBE_UV
808			vec3 reflectVec = reflect( - viewDir, normal );
809			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
810			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
811			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
812			return envMapColor.rgb * envMapIntensity;
813		#else
814			return vec3( 0.0 );
815		#endif
816	}
817	#ifdef USE_ANISOTROPY
818		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
819			#ifdef ENVMAP_TYPE_CUBE_UV
820				vec3 bentNormal = cross( bitangent, viewDir );
821				bentNormal = normalize( cross( bentNormal, bitangent ) );
822				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
823				return getIBLRadiance( viewDir, bentNormal, roughness );
824			#else
825				return vec3( 0.0 );
826			#endif
827		}
828	#endif
829#endif`,o0=`ToonMaterial material;
830material.diffuseColor = diffuseColor.rgb;`,l0=`varying vec3 vViewPosition;
831struct ToonMaterial {
832	vec3 diffuseColor;
833};
834void 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 ) {
835	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
836	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
837}
838void 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 ) {
839	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
840}
841#define RE_Direct				RE_Direct_Toon
842#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,c0=`BlinnPhongMaterial material;
843material.diffuseColor = diffuseColor.rgb;
844material.specularColor = specular;
845material.specularShininess = shininess;
846material.specularStrength = specularStrength;`,h0=`varying vec3 vViewPosition;
847struct BlinnPhongMaterial {
848	vec3 diffuseColor;
849	vec3 specularColor;
850	float specularShininess;
851	float specularStrength;
852};
853void 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 ) {
854	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
855	vec3 irradiance = dotNL * directLight.color;
856	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
857	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
858}
859void 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 ) {
860	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
861}
862#define RE_Direct				RE_Direct_BlinnPhong
863#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,u0=`PhysicalMaterial material;
864material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
865vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
866float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
867material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
868material.roughness = min( material.roughness, 1.0 );
869#ifdef IOR
870	material.ior = ior;
871	#ifdef USE_SPECULAR
872		float specularIntensityFactor = specularIntensity;
873		vec3 specularColorFactor = specularColor;
874		#ifdef USE_SPECULAR_COLORMAP
875			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
876		#endif
877		#ifdef USE_SPECULAR_INTENSITYMAP
878			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
879		#endif
880		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
881	#else
882		float specularIntensityFactor = 1.0;
883		vec3 specularColorFactor = vec3( 1.0 );
884		material.specularF90 = 1.0;
885	#endif
886	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
887#else
888	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
889	material.specularF90 = 1.0;
890#endif
891#ifdef USE_CLEARCOAT
892	material.clearcoat = clearcoat;
893	material.clearcoatRoughness = clearcoatRoughness;
894	material.clearcoatF0 = vec3( 0.04 );
895	material.clearcoatF90 = 1.0;
896	#ifdef USE_CLEARCOATMAP
897		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
898	#endif
899	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
900		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
901	#endif
902	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
903	material.clearcoatRoughness += geometryRoughness;
904	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
905#endif
906#ifdef USE_DISPERSION
907	material.dispersion = dispersion;
908#endif
909#ifdef USE_IRIDESCENCE
910	material.iridescence = iridescence;
911	material.iridescenceIOR = iridescenceIOR;
912	#ifdef USE_IRIDESCENCEMAP
913		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
914	#endif
915	#ifdef USE_IRIDESCENCE_THICKNESSMAP
916		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
917	#else
918		material.iridescenceThickness = iridescenceThicknessMaximum;
919	#endif
920#endif
921#ifdef USE_SHEEN
922	material.sheenColor = sheenColor;
923	#ifdef USE_SHEEN_COLORMAP
924		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
925	#endif
926	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
927	#ifdef USE_SHEEN_ROUGHNESSMAP
928		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
929	#endif
930#endif
931#ifdef USE_ANISOTROPY
932	#ifdef USE_ANISOTROPYMAP
933		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
934		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
935		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
936	#else
937		vec2 anisotropyV = anisotropyVector;
938	#endif
939	material.anisotropy = length( anisotropyV );
940	if( material.anisotropy == 0.0 ) {
941		anisotropyV = vec2( 1.0, 0.0 );
942	} else {
943		anisotropyV /= material.anisotropy;
944		material.anisotropy = saturate( material.anisotropy );
945	}
946	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
948	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
949#endif`,d0
vendor: 14,687 bytes, lines 949-1250
949=`struct PhysicalMaterial {
950	vec3 diffuseColor;
951	float roughness;
952	vec3 specularColor;
953	float specularF90;
954	float dispersion;
955	#ifdef USE_CLEARCOAT
956		float clearcoat;
957		float clearcoatRoughness;
958		vec3 clearcoatF0;
959		float clearcoatF90;
960	#endif
961	#ifdef USE_IRIDESCENCE
962		float iridescence;
963		float iridescenceIOR;
964		float iridescenceThickness;
965		vec3 iridescenceFresnel;
966		vec3 iridescenceF0;
967	#endif
968	#ifdef USE_SHEEN
969		vec3 sheenColor;
970		float sheenRoughness;
971	#endif
972	#ifdef IOR
973		float ior;
974	#endif
975	#ifdef USE_TRANSMISSION
976		float transmission;
977		float transmissionAlpha;
978		float thickness;
979		float attenuationDistance;
980		vec3 attenuationColor;
981	#endif
982	#ifdef USE_ANISOTROPY
983		float anisotropy;
984		float alphaT;
985		vec3 anisotropyT;
986		vec3 anisotropyB;
987	#endif
988};
989vec3 clearcoatSpecularDirect = vec3( 0.0 );
990vec3 clearcoatSpecularIndirect = vec3( 0.0 );
991vec3 sheenSpecularDirect = vec3( 0.0 );
992vec3 sheenSpecularIndirect = vec3(0.0 );
993vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
994    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
995    float x2 = x * x;
996    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
997    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
998}
999float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1000	float a2 = pow2( alpha );
1001	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1002	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1003	return 0.5 / max( gv + gl, EPSILON );
1004}
1005float D_GGX( const in float alpha, const in float dotNH ) {
1006	float a2 = pow2( alpha );
1007	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1008	return RECIPROCAL_PI * a2 / pow2( denom );
1009}
1010#ifdef USE_ANISOTROPY
1011	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 ) {
1012		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1013		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1014		float v = 0.5 / ( gv + gl );
1015		return saturate(v);
1016	}
1017	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1018		float a2 = alphaT * alphaB;
1019		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1020		highp float v2 = dot( v, v );
1021		float w2 = a2 / v2;
1022		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1023	}
1024#endif
1025#ifdef USE_CLEARCOAT
1026	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1027		vec3 f0 = material.clearcoatF0;
1028		float f90 = material.clearcoatF90;
1029		float roughness = material.clearcoatRoughness;
1030		float alpha = pow2( roughness );
1031		vec3 halfDir = normalize( lightDir + viewDir );
1032		float dotNL = saturate( dot( normal, lightDir ) );
1033		float dotNV = saturate( dot( normal, viewDir ) );
1034		float dotNH = saturate( dot( normal, halfDir ) );
1035		float dotVH = saturate( dot( viewDir, halfDir ) );
1036		vec3 F = F_Schlick( f0, f90, dotVH );
1037		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1038		float D = D_GGX( alpha, dotNH );
1039		return F * ( V * D );
1040	}
1041#endif
1042vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1043	vec3 f0 = material.specularColor;
1044	float f90 = material.specularF90;
1045	float roughness = material.roughness;
1046	float alpha = pow2( roughness );
1047	vec3 halfDir = normalize( lightDir + viewDir );
1048	float dotNL = saturate( dot( normal, lightDir ) );
1049	float dotNV = saturate( dot( normal, viewDir ) );
1050	float dotNH = saturate( dot( normal, halfDir ) );
1051	float dotVH = saturate( dot( viewDir, halfDir ) );
1052	vec3 F = F_Schlick( f0, f90, dotVH );
1053	#ifdef USE_IRIDESCENCE
1054		F = mix( F, material.iridescenceFresnel, material.iridescence );
1055	#endif
1056	#ifdef USE_ANISOTROPY
1057		float dotTL = dot( material.anisotropyT, lightDir );
1058		float dotTV = dot( material.anisotropyT, viewDir );
1059		float dotTH = dot( material.anisotropyT, halfDir );
1060		float dotBL = dot( material.anisotropyB, lightDir );
1061		float dotBV = dot( material.anisotropyB, viewDir );
1062		float dotBH = dot( material.anisotropyB, halfDir );
1063		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1064		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1065	#else
1066		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1067		float D = D_GGX( alpha, dotNH );
1068	#endif
1069	return F * ( V * D );
1070}
1071vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1072	const float LUT_SIZE = 64.0;
1073	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1074	const float LUT_BIAS = 0.5 / LUT_SIZE;
1075	float dotNV = saturate( dot( N, V ) );
1076	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1077	uv = uv * LUT_SCALE + LUT_BIAS;
1078	return uv;
1079}
1080float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1081	float l = length( f );
1082	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1083}
1084vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1085	float x = dot( v1, v2 );
1086	float y = abs( x );
1087	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1088	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1089	float v = a / b;
1090	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1091	return cross( v1, v2 ) * theta_sintheta;
1092}
1093vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1094	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1095	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1096	vec3 lightNormal = cross( v1, v2 );
1097	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1098	vec3 T1, T2;
1099	T1 = normalize( V - N * dot( V, N ) );
1100	T2 = - cross( N, T1 );
1101	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1102	vec3 coords[ 4 ];
1103	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1104	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1105	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1106	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1107	coords[ 0 ] = normalize( coords[ 0 ] );
1108	coords[ 1 ] = normalize( coords[ 1 ] );
1109	coords[ 2 ] = normalize( coords[ 2 ] );
1110	coords[ 3 ] = normalize( coords[ 3 ] );
1111	vec3 vectorFormFactor = vec3( 0.0 );
1112	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1113	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1114	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1115	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1116	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1117	return vec3( result );
1118}
1119#if defined( USE_SHEEN )
1120float D_Charlie( float roughness, float dotNH ) {
1121	float alpha = pow2( roughness );
1122	float invAlpha = 1.0 / alpha;
1123	float cos2h = dotNH * dotNH;
1124	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1125	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1126}
1127float V_Neubelt( float dotNV, float dotNL ) {
1128	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1129}
1130vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1131	vec3 halfDir = normalize( lightDir + viewDir );
1132	float dotNL = saturate( dot( normal, lightDir ) );
1133	float dotNV = saturate( dot( normal, viewDir ) );
1134	float dotNH = saturate( dot( normal, halfDir ) );
1135	float D = D_Charlie( sheenRoughness, dotNH );
1136	float V = V_Neubelt( dotNV, dotNL );
1137	return sheenColor * ( D * V );
1138}
1139#endif
1140float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1141	float dotNV = saturate( dot( normal, viewDir ) );
1142	float r2 = roughness * roughness;
1143	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1144	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1145	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1146	return saturate( DG * RECIPROCAL_PI );
1147}
1148vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1149	float dotNV = saturate( dot( normal, viewDir ) );
1150	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1151	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1152	vec4 r = roughness * c0 + c1;
1153	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1154	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1155	return fab;
1156}
1157vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1158	vec2 fab = DFGApprox( normal, viewDir, roughness );
1159	return specularColor * fab.x + specularF90 * fab.y;
1160}
1161#ifdef USE_IRIDESCENCE
1162void 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 ) {
1163#else
1164void 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 ) {
1165#endif
1166	vec2 fab = DFGApprox( normal, viewDir, roughness );
1167	#ifdef USE_IRIDESCENCE
1168		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1169	#else
1170		vec3 Fr = specularColor;
1171	#endif
1172	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1173	float Ess = fab.x + fab.y;
1174	float Ems = 1.0 - Ess;
1175	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1176	singleScatter += FssEss;
1177	multiScatter += Fms * Ems;
1178}
1179#if NUM_RECT_AREA_LIGHTS > 0
1180	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 ) {
1181		vec3 normal = geometryNormal;
1182		vec3 viewDir = geometryViewDir;
1183		vec3 position = geometryPosition;
1184		vec3 lightPos = rectAreaLight.position;
1185		vec3 halfWidth = rectAreaLight.halfWidth;
1186		vec3 halfHeight = rectAreaLight.halfHeight;
1187		vec3 lightColor = rectAreaLight.color;
1188		float roughness = material.roughness;
1189		vec3 rectCoords[ 4 ];
1190		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1191		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1192		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1193		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1194		vec4 t1 = texture2D( ltc_1, uv );
1195		vec4 t2 = texture2D( ltc_2, uv );
1196		mat3 mInv = mat3(
1197			vec3( t1.x, 0, t1.y ),
1198			vec3(    0, 1,    0 ),
1199			vec3( t1.z, 0, t1.w )
1200		);
1201		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1202		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1203		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1204	}
1205#endif
1206void 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 ) {
1207	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1208	vec3 irradiance = dotNL * directLight.color;
1209	#ifdef USE_CLEARCOAT
1210		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1211		vec3 ccIrradiance = dotNLcc * directLight.color;
1212		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1213	#endif
1214	#ifdef USE_SHEEN
1215		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1216	#endif
1217	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1218	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1219}
1220void 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 ) {
1221	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1222}
1223void 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) {
1224	#ifdef USE_CLEARCOAT
1225		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1226	#endif
1227	#ifdef USE_SHEEN
1228		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1229	#endif
1230	vec3 singleScattering = vec3( 0.0 );
1231	vec3 multiScattering = vec3( 0.0 );
1232	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1233	#ifdef USE_IRIDESCENCE
1234		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1235	#else
1236		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1237	#endif
1238	vec3 totalScattering = singleScattering + multiScattering;
1239	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1240	reflectedLight.indirectSpecular += radiance * singleScattering;
1241	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1242	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1243}
1244#define RE_Direct				RE_Direct_Physical
1245#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1246#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1247#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1248float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1249	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1250}`,
1250f0=`
1251vec3 geometryPosition = - vViewPosition;
1252vec3 geometryNormal = normal;
1253vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1254vec3 geometryClearcoatNormal = vec3( 0.0 );
1255#ifdef USE_CLEARCOAT
1256	geometryClearcoatNormal = clearcoatNormal;
1257#endif
1258#ifdef USE_IRIDESCENCE
1259	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1260	if ( material.iridescenceThickness == 0.0 ) {
1261		material.iridescence = 0.0;
1262	} else {
1263		material.iridescence = saturate( material.iridescence );
1264	}
1265	if ( material.iridescence > 0.0 ) {
1266		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1267		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1268	}
1269#endif
1270IncidentLight directLight;
1271#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1272	PointLight pointLight;
1273	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1274	PointLightShadow pointLightShadow;
1275	#endif
1276	#pragma unroll_loop_start
1277	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1278		pointLight = pointLights[ i ];
1279		getPointLightInfo( pointLight, geometryPosition, directLight );
1280		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1281		pointLightShadow = pointLightShadows[ i ];
1282		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1283		#endif
1284		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1285	}
1286	#pragma unroll_loop_end
1287#endif
1288#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1289	SpotLight spotLight;
1290	vec4 spotColor;
1291	vec3 spotLightCoord;
1292	bool inSpotLightMap;
1293	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1294	SpotLightShadow spotLightShadow;
1295	#endif
1296	#pragma unroll_loop_start
1297	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1298		spotLight = spotLights[ i ];
1299		getSpotLightInfo( spotLight, geometryPosition, directLight );
1300		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1301		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1302		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1303		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1304		#else
1305		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1306		#endif
1307		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1308			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1309			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1310			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1311			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1312		#endif
1313		#undef SPOT_LIGHT_MAP_INDEX
1314		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1315		spotLightShadow = spotLightShadows[ i ];
1316		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1317		#endif
1318		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1319	}
1320	#pragma unroll_loop_end
1321#endif
1322#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1323	DirectionalLight directionalLight;
1324	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1325	DirectionalLightShadow directionalLightShadow;
1326	#endif
1327	#pragma unroll_loop_start
1328	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1329		directionalLight = directionalLights[ i ];
1330		getDirectionalLightInfo( directionalLight, directLight );
1331		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1332		directionalLightShadow = directionalLightShadows[ i ];
1333		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1334		#endif
1335		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1336	}
1337	#pragma unroll_loop_end
1338#endif
1339#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1340	RectAreaLight rectAreaLight;
1341	#pragma unroll_loop_start
1342	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1343		rectAreaLight = rectAreaLights[ i ];
1344		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1345	}
1346	#pragma unroll_loop_end
1347#endif
1348#if defined( RE_IndirectDiffuse )
1349	vec3 iblIrradiance = vec3( 0.0 );
1350	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1351	#if defined( USE_LIGHT_PROBES )
1352		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1353	#endif
1354	#if ( NUM_HEMI_LIGHTS > 0 )
1355		#pragma unroll_loop_start
1356		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1357			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1358		}
1359		#pragma unroll_loop_end
1360	#endif
1361#endif
1362#if defined( RE_IndirectSpecular )
1363	vec3 radiance = vec3( 0.0 );
1364	vec3 clearcoatRadiance = vec3( 0.0 );
1365#endif`,p0=`#if defined( RE_IndirectDiffuse )
1366	#ifdef USE_LIGHTMAP
1367		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1368		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1369		irradiance += lightMapIrradiance;
1370	#endif
1371	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1372		iblIrradiance += getIBLIrradiance( geometryNormal );
1373	#endif
1374#endif
1375#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1376	#ifdef USE_ANISOTROPY
1377		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1378	#else
1379		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1380	#endif
1381	#ifdef USE_CLEARCOAT
1382		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1383	#endif
1384#endif`,m0=`#if defined( RE_IndirectDiffuse )
1385	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1386#endif
1387#if defined( RE_IndirectSpecular )
1388	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1389#endif`,g0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1390	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1391#endif`,_0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1392	uniform float logDepthBufFC;
1393	varying float vFragDepth;
1394	varying float vIsPerspective;
1395#endif`,x0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1396	varying float vFragDepth;
1397	varying float vIsPerspective;
1398#endif`,v0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1399	vFragDepth = 1.0 + gl_Position.w;
1400	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1401#endif`,y0=`#ifdef USE_MAP
1402	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1403	#ifdef DECODE_VIDEO_TEXTURE
1404		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1405	#endif
1406	diffuseColor *= sampledDiffuseColor;
1407#endif`,M0=`#ifdef USE_MAP
1408	uniform sampler2D map;
1409#endif`,S0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1410	#if defined( USE_POINTS_UV )
1411		vec2 uv = vUv;
1412	#else
1413		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1414	#endif
1415#endif
1416#ifdef USE_MAP
1417	diffuseColor *= texture2D( map, uv );
1418#endif
1419#ifdef USE_ALPHAMAP
1420	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1421#endif`,b0=`#if defined( USE_POINTS_UV )
1422	varying vec2 vUv;
1423#else
1424	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1425		uniform mat3 uvTransform;
1426	#endif
1427#endif
1428#ifdef USE_MAP
1429	uniform sampler2D map;
1430#endif
1431#ifdef USE_ALPHAMAP
1432	uniform sampler2D alphaMap;
1433#endif`,E0=`float metalnessFactor = metalness;
1434#ifdef USE_METALNESSMAP
1435	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1436	metalnessFactor *= texelMetalness.b;
1437#endif`,T0=`#ifdef USE_METALNESSMAP
1438	uniform sampler2D metalnessMap;
1439#endif`,A0=`#ifdef USE_INSTANCING_MORPH
1440	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1441	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1442	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1443		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1444	}
1445#endif`,w0=`#if defined( USE_MORPHCOLORS )
1446	vColor *= morphTargetBaseInfluence;
1447	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1448		#if defined( USE_COLOR_ALPHA )
1449			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1450		#elif defined( USE_COLOR )
1451			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1452		#endif
1453	}
1454#endif`,C0=`#ifdef USE_MORPHNORMALS
1455	objectNormal *= morphTargetBaseInfluence;
1456	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1457		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1458	}
1459#endif`,R0=`#ifdef USE_MORPHTARGETS
1460	#ifndef USE_INSTANCING_MORPH
1461		uniform float morphTargetBaseInfluence;
1462		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1463	#endif
1464	uniform sampler2DArray morphTargetsTexture;
1465	uniform ivec2 morphTargetsTextureSize;
1466	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1467		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1468		int y = texelIndex / morphTargetsTextureSize.x;
1469		int x = texelIndex - y * morphTargetsTextureSize.x;
1470		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1471		return texelFetch( morphTargetsTexture, morphUV, 0 );
1472	}
1473#endif`,I0=`#ifdef USE_MORPHTARGETS
1474	transformed *= morphTargetBaseInfluence;
1475	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1476		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1477	}
1478#endif`,P0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1479#ifdef FLAT_SHADED
1480	vec3 fdx = dFdx( vViewPosition );
1481	vec3 fdy = dFdy( vViewPosition );
1482	vec3 normal = normalize( cross( fdx, fdy ) );
1483#else
1484	vec3 normal = normalize( vNormal );
1485	#ifdef DOUBLE_SIDED
1486		normal *= faceDirection;
1487	#endif
1488#endif
1489#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1490	#ifdef USE_TANGENT
1491		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1492	#else
1493		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1494		#if defined( USE_NORMALMAP )
1495			vNormalMapUv
1496		#elif defined( USE_CLEARCOAT_NORMALMAP )
1497			vClearcoatNormalMapUv
1498		#else
1499			vUv
1500		#endif
1501		);
1502	#endif
1503	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1504		tbn[0] *= faceDirection;
1505		tbn[1] *= faceDirection;
1506	#endif
1507#endif
1508#ifdef USE_CLEARCOAT_NORMALMAP
1509	#ifdef USE_TANGENT
1510		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1511	#else
1512		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1513	#endif
1514	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1515		tbn2[0] *= faceDirection;
1516		tbn2[1] *= faceDirection;
1517	#endif
1518#endif
1519vec3 nonPerturbedNormal = normal;`,L0=`#ifdef USE_NORMALMAP_OBJECTSPACE
1520	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1521	#ifdef FLIP_SIDED
1522		normal = - normal;
1523	#endif
1524	#ifdef DOUBLE_SIDED
1525		normal = normal * faceDirection;
1526	#endif
1527	normal = normalize( normalMatrix * normal );
1528#elif defined( USE_NORMALMAP_TANGENTSPACE )
1529	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1530	mapN.xy *= normalScale;
1531	normal = normalize( tbn * mapN );
1532#elif defined( USE_BUMPMAP )
1533	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1534#endif`,D0=`#ifndef FLAT_SHADED
1535	varying vec3 vNormal;
1536	#ifdef USE_TANGENT
1537		varying vec3 vTangent;
1538		varying vec3 vBitangent;
1539	#endif
1540#endif`,U0=`#ifndef FLAT_SHADED
1541	varying vec3 vNormal;
1542	#ifdef USE_TANGENT
1543		varying vec3 vTangent;
1544		varying vec3 vBitangent;
1545	#endif
1546#endif`,N0=`#ifndef FLAT_SHADED
1547	vNormal = normalize( transformedNormal );
1548	#ifdef USE_TANGENT
1549		vTangent = normalize( transformedTangent );
1550		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1551	#endif
1552#endif`,F0=`#ifdef USE_NORMALMAP
1553	uniform sampler2D normalMap;
1554	uniform vec2 normalScale;
1555#endif
1556#ifdef USE_NORMALMAP_OBJECTSPACE
1557	uniform mat3 normalMatrix;
1558#endif
1559#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1560	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1561		vec3 q0 = dFdx( eye_pos.xyz );
1562		vec3 q1 = dFdy( eye_pos.xyz );
1563		vec2 st0 = dFdx( uv.st );
1564		vec2 st1 = dFdy( uv.st );
1565		vec3 N = surf_norm;
1566		vec3 q1perp = cross( q1, N );
1567		vec3 q0perp = cross( N, q0 );
1568		vec3 T = q1perp * st0.x + q0perp * st1.x;
1569		vec3 B = q1perp * st0.y + q0perp * st1.y;
1570		float det = max( dot( T, T ), dot( B, B ) );
1571		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1572		return mat3( T * scale, B * scale, N );
1573	}
1574#endif`,O0=`#ifdef USE_CLEARCOAT
1575	vec3 clearcoatNormal = nonPerturbedNormal;
1576#endif`,B0=`#ifdef USE_CLEARCOAT_NORMALMAP
1577	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1578	clearcoatMapN.xy *= clearcoatNormalScale;
1579	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1580#endif`,z0=`#ifdef USE_CLEARCOATMAP
1581	uniform sampler2D clearcoatMap;
1582#endif
1583#ifdef USE_CLEARCOAT_NORMALMAP
1584	uniform sampler2D clearcoatNormalMap;
1585	uniform vec2 clearcoatNormalScale;
1586#endif
1587#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1588	uniform sampler2D clearcoatRoughnessMap;
1589#endif`,k0=`#ifdef USE_IRIDESCENCEMAP
1590	uniform sampler2D iridescenceMap;
1591#endif
1592#ifdef USE_IRIDESCENCE_THICKNESSMAP
1593	uniform sampler2D iridescenceThicknessMap;
1594#endif`,V0=`#ifdef OPAQUE
1595diffuseColor.a = 1.0;
1596#endif
1597#ifdef USE_TRANSMISSION
1598diffuseColor.a *= material.transmissionAlpha;
1599#endif
1600gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,H0=`vec3 packNormalToRGB( const in vec3 normal ) {
1601	return normalize( normal ) * 0.5 + 0.5;
1602}
1603vec3 unpackRGBToNormal( const in vec3 rgb ) {
1604	return 2.0 * rgb.xyz - 1.0;
1605}
1606const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1607const float Inv255 = 1. / 255.;
1608const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1609const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1610const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1611const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1612vec4 packDepthToRGBA( const in float v ) {
1613	if( v <= 0.0 )
1614		return vec4( 0., 0., 0., 0. );
1615	if( v >= 1.0 )
1616		return vec4( 1., 1., 1., 1. );
1617	float vuf;
1618	float af = modf( v * PackFactors.a, vuf );
1619	float bf = modf( vuf * ShiftRight8, vuf );
1620	float gf = modf( vuf * ShiftRight8, vuf );
1621	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1622}
1623vec3 packDepthToRGB( const in float v ) {
1624	if( v <= 0.0 )
1625		return vec3( 0., 0., 0. );
1626	if( v >= 1.0 )
1627		return vec3( 1., 1., 1. );
1628	float vuf;
1629	float bf = modf( v * PackFactors.b, vuf );
1630	float gf = modf( vuf * ShiftRight8, vuf );
1631	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1632}
1633vec2 packDepthToRG( const in float v ) {
1634	if( v <= 0.0 )
1635		return vec2( 0., 0. );
1636	if( v >= 1.0 )
1637		return vec2( 1., 1. );
1638	float vuf;
1639	float gf = modf( v * 256., vuf );
1640	return vec2( vuf * Inv255, gf );
1641}
1642float unpackRGBAToDepth( const in vec4 v ) {
1643	return dot( v, UnpackFactors4 );
1644}
1645float unpackRGBToDepth( const in vec3 v ) {
1646	return dot( v, UnpackFactors3 );
1647}
1648float unpackRGToDepth( const in vec2 v ) {
1649	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1650}
1651vec4 pack2HalfToRGBA( const in vec2 v ) {
1652	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1653	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1654}
1655vec2 unpackRGBATo2Half( const in vec4 v ) {
1656	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1657}
1658float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1659	return ( viewZ + near ) / ( near - far );
1660}
1661float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1662	return depth * ( near - far ) - near;
1663}
1664float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1665	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1666}
1667float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1668	return ( near * far ) / ( ( far - near ) * depth - far );
1669}`,G0=`#ifdef PREMULTIPLIED_ALPHA
1670	gl_FragColor.rgb *= gl_FragColor.a;
1671#endif`,W0=`vec4 mvPosition = vec4( transformed, 1.0 );
1672#ifdef USE_BATCHING
1673	mvPosition = batchingMatrix * mvPosition;
1674#endif
1675#ifdef USE_INSTANCING
1676	mvPosition = instanceMatrix * mvPosition;
1677#endif
1678mvPosition = modelViewMatrix * mvPosition;
1679gl_Position = projectionMatrix * mvPosition;`,X0=`#ifdef DITHERING
1680	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1681#endif`,q0=`#ifdef DITHERING
1682	vec3 dithering( vec3 color ) {
1683		float grid_position = rand( gl_FragCoord.xy );
1684		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1685		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1686		return color + dither_shift_RGB;
1687	}
1688#endif`,Y0=`float roughnessFactor = roughness;
1689#ifdef USE_ROUGHNESSMAP
1690	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1691	roughnessFactor *= texelRoughness.g;
1692#endif`,Z0=`#ifdef USE_ROUGHNESSMAP
1693	uniform sampler2D roughnessMap;
1694#endif`,J0=`#if NUM_SPOT_LIGHT_COORDS > 0
1695	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1696#endif
1697#if NUM_SPOT_LIGHT_MAPS > 0
1698	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1699#endif
1700#ifdef USE_SHADOWMAP
1701	#if NUM_DIR_LIGHT_SHADOWS > 0
1702		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1703		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1704		struct DirectionalLightShadow {
1705			float shadowIntensity;
1706			float shadowBias;
1707			float shadowNormalBias;
1708			float shadowRadius;
1709			vec2 shadowMapSize;
1710		};
1711		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1712	#endif
1713	#if NUM_SPOT_LIGHT_SHADOWS > 0
1714		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1715		struct SpotLightShadow {
1716			float shadowIntensity;
1717			float shadowBias;
1718			float shadowNormalBias;
1719			float shadowRadius;
1720			vec2 shadowMapSize;
1721		};
1722		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1723	#endif
1724	#if NUM_POINT_LIGHT_SHADOWS > 0
1725		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1726		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1727		struct PointLightShadow {
1728			float shadowIntensity;
1729			float shadowBias;
1730			float shadowNormalBias;
1731			float shadowRadius;
1732			vec2 shadowMapSize;
1733			float shadowCameraNear;
1734			float shadowCameraFar;
1735		};
1736		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1737	#endif
1738	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1739		float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
1740		#ifdef USE_REVERSED_DEPTH_BUFFER
1741			return step( depth, compare );
1742		#else
1743			return step( compare, depth );
1744		#endif
1745	}
1746	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1747		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1748	}
1749	float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
1750		float occlusion = 1.0;
1751		vec2 distribution = texture2DDistribution( shadow, uv );
1752		#ifdef USE_REVERSED_DEPTH_BUFFER
1753			float hard_shadow = step( distribution.x, compare );
1754		#else
1755			float hard_shadow = step( compare, distribution.x );
1756		#endif
1757		if ( hard_shadow != 1.0 ) {
1758			float distance = compare - distribution.x
vendor: 6,963 bytes, lines 1758-1889
1758;
1759			float variance = max( 0.00000, distribution.y * distribution.y );
1760			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 );
1761		}
1762		return occlusion;
1763	}
1764	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1765		float shadow = 1.0;
1766		shadowCoord.xyz /= shadowCoord.w;
1767		shadowCoord.z += shadowBias;
1768		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1769		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1770		if ( frustumTest ) {
1771		#if defined( SHADOWMAP_TYPE_PCF )
1772			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1773			float dx0 = - texelSize.x * shadowRadius;
1774			float dy0 = - texelSize.y * shadowRadius;
1775			float dx1 = + texelSize.x * shadowRadius;
1776			float dy1 = + texelSize.y * shadowRadius;
1777			float dx2 = dx0 / 2.0;
1778			float dy2 = dy0 / 2.0;
1779			float dx3 = dx1 / 2.0;
1780			float dy3 = dy1 / 2.0;
1781			shadow = (
1782				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1783				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1784				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1785				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1786				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1787				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1788				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1789				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1790				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1791				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1792				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1793				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1794				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1795				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1796				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1797				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1798				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1799			) * ( 1.0 / 17.0 );
1800		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1801			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1802			float dx = texelSize.x;
1803			float dy = texelSize.y;
1804			vec2 uv = shadowCoord.xy;
1805			vec2 f = fract( uv * shadowMapSize + 0.5 );
1806			uv -= f * texelSize;
1807			shadow = (
1808				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1809				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1810				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1811				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1812				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1813					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1814					 f.x ) +
1815				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1816					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1817					 f.x ) +
1818				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1819					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1820					 f.y ) +
1821				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1822					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1823					 f.y ) +
1824				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1825						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1826						  f.x ),
1827					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1828						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1829						  f.x ),
1830					 f.y )
1831			) * ( 1.0 / 9.0 );
1832		#elif defined( SHADOWMAP_TYPE_VSM )
1833			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1834		#else
1835			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1836		#endif
1837		}
1838		return mix( 1.0, shadow, shadowIntensity );
1839	}
1840	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1841		vec3 absV = abs( v );
1842		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1843		absV *= scaleToCube;
1844		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1845		vec2 planar = v.xy;
1846		float almostATexel = 1.5 * texelSizeY;
1847		float almostOne = 1.0 - almostATexel;
1848		if ( absV.z >= almostOne ) {
1849			if ( v.z > 0.0 )
1850				planar.x = 4.0 - v.x;
1851		} else if ( absV.x >= almostOne ) {
1852			float signX = sign( v.x );
1853			planar.x = v.z * signX + 2.0 * signX;
1854		} else if ( absV.y >= almostOne ) {
1855			float signY = sign( v.y );
1856			planar.x = v.x + 2.0 * signY + 2.0;
1857			planar.y = v.z * signY - 2.0;
1858		}
1859		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1860	}
1861	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1862		float shadow = 1.0;
1863		vec3 lightToPosition = shadowCoord.xyz;
1864		
1865		float lightToPositionLength = length( lightToPosition );
1866		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
1867			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
1868			vec3 bd3D = normalize( lightToPosition );
1869			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1870			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1871				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1872				shadow = (
1873					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1874					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1875					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1876					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1877					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1878					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1879					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1880					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1881					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1882				) * ( 1.0 / 9.0 );
1883			#else
1884				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1885			#endif
1886		}
1887		return mix( 1.0, shadow, shadowIntensity );
1888	}
1889#endif`,
1889$0=`#if NUM_SPOT_LIGHT_COORDS > 0
1890	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1891	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1892#endif
1893#ifdef USE_SHADOWMAP
1894	#if NUM_DIR_LIGHT_SHADOWS > 0
1895		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1896		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1897		struct DirectionalLightShadow {
1898			float shadowIntensity;
1899			float shadowBias;
1900			float shadowNormalBias;
1901			float shadowRadius;
1902			vec2 shadowMapSize;
1903		};
1904		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1905	#endif
1906	#if NUM_SPOT_LIGHT_SHADOWS > 0
1907		struct SpotLightShadow {
1908			float shadowIntensity;
1909			float shadowBias;
1910			float shadowNormalBias;
1911			float shadowRadius;
1912			vec2 shadowMapSize;
1913		};
1914		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1915	#endif
1916	#if NUM_POINT_LIGHT_SHADOWS > 0
1917		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1918		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1919		struct PointLightShadow {
1920			float shadowIntensity;
1921			float shadowBias;
1922			float shadowNormalBias;
1923			float shadowRadius;
1924			vec2 shadowMapSize;
1925			float shadowCameraNear;
1926			float shadowCameraFar;
1927		};
1928		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1929	#endif
1930#endif`,K0=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1931	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1932	vec4 shadowWorldPosition;
1933#endif
1934#if defined( USE_SHADOWMAP )
1935	#if NUM_DIR_LIGHT_SHADOWS > 0
1936		#pragma unroll_loop_start
1937		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1938			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1939			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1940		}
1941		#pragma unroll_loop_end
1942	#endif
1943	#if NUM_POINT_LIGHT_SHADOWS > 0
1944		#pragma unroll_loop_start
1945		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1946			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1947			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1948		}
1949		#pragma unroll_loop_end
1950	#endif
1951#endif
1952#if NUM_SPOT_LIGHT_COORDS > 0
1953	#pragma unroll_loop_start
1954	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1955		shadowWorldPosition = worldPosition;
1956		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1957			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1958		#endif
1959		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1960	}
1961	#pragma unroll_loop_end
1962#endif`,Q0=`float getShadowMask() {
1963	float shadow = 1.0;
1964	#ifdef USE_SHADOWMAP
1965	#if NUM_DIR_LIGHT_SHADOWS > 0
1966	DirectionalLightShadow directionalLight;
1967	#pragma unroll_loop_start
1968	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1969		directionalLight = directionalLightShadows[ i ];
1970		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1971	}
1972	#pragma unroll_loop_end
1973	#endif
1974	#if NUM_SPOT_LIGHT_SHADOWS > 0
1975	SpotLightShadow spotLight;
1976	#pragma unroll_loop_start
1977	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1978		spotLight = spotLightShadows[ i ];
1979		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1980	}
1981	#pragma unroll_loop_end
1982	#endif
1983	#if NUM_POINT_LIGHT_SHADOWS > 0
1984	PointLightShadow pointLight;
1985	#pragma unroll_loop_start
1986	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1987		pointLight = pointLightShadows[ i ];
1988		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1989	}
1990	#pragma unroll_loop_end
1991	#endif
1992	#endif
1993	return shadow;
1994}`,j0=`#ifdef USE_SKINNING
1995	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1996	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1997	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1998	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1999#endif`,tx=`#ifdef USE_SKINNING
2000	uniform mat4 bindMatrix;
2001	uniform mat4 bindMatrixInverse;
2002	uniform highp sampler2D boneTexture;
2003	mat4 getBoneMatrix( const in float i ) {
2004		int size = textureSize( boneTexture, 0 ).x;
2005		int j = int( i ) * 4;
2006		int x = j % size;
2007		int y = j / size;
2008		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2009		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2010		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2011		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2012		return mat4( v1, v2, v3, v4 );
2013	}
2014#endif`,ex=`#ifdef USE_SKINNING
2015	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2016	vec4 skinned = vec4( 0.0 );
2017	skinned += boneMatX * skinVertex * skinWeight.x;
2018	skinned += boneMatY * skinVertex * skinWeight.y;
2019	skinned += boneMatZ * skinVertex * skinWeight.z;
2020	skinned += boneMatW * skinVertex * skinWeight.w;
2021	transformed = ( bindMatrixInverse * skinned ).xyz;
2022#endif`,nx=`#ifdef USE_SKINNING
2023	mat4 skinMatrix = mat4( 0.0 );
2024	skinMatrix += skinWeight.x * boneMatX;
2025	skinMatrix += skinWeight.y * boneMatY;
2026	skinMatrix += skinWeight.z * boneMatZ;
2027	skinMatrix += skinWeight.w * boneMatW;
2028	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2029	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2030	#ifdef USE_TANGENT
2031		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2032	#endif
2033#endif`,ix=`float specularStrength;
2034#ifdef USE_SPECULARMAP
2035	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2036	specularStrength = texelSpecular.r;
2037#else
2038	specularStrength = 1.0;
2039#endif`,sx=`#ifdef USE_SPECULARMAP
2040	uniform sampler2D specularMap;
2041#endif`,rx=`#if defined( TONE_MAPPING )
2042	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2043#endif`,ax=`#ifndef saturate
2044#define saturate( a ) clamp( a, 0.0, 1.0 )
2045#endif
2046uniform float toneMappingExposure;
2047vec3 LinearToneMapping( vec3 color ) {
2048	return saturate( toneMappingExposure * color );
2049}
2050vec3 ReinhardToneMapping( vec3 color ) {
2051	color *= toneMappingExposure;
2052	return saturate( color / ( vec3( 1.0 ) + color ) );
2053}
2054vec3 CineonToneMapping( vec3 color ) {
2055	color *= toneMappingExposure;
2056	color = max( vec3( 0.0 ), color - 0.004 );
2057	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2058}
2059vec3 RRTAndODTFit( vec3 v ) {
2060	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2061	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2062	return a / b;
2063}
2064vec3 ACESFilmicToneMapping( vec3 color ) {
2065	const mat3 ACESInputMat = mat3(
2066		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2067		vec3( 0.04823, 0.01566, 0.83777 )
2068	);
2069	const mat3 ACESOutputMat = mat3(
2070		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2071		vec3( -0.07367, -0.00605,  1.07602 )
2072	);
2073	color *= toneMappingExposure / 0.6;
2074	color = ACESInputMat * color;
2075	color = RRTAndODTFit( color );
2076	color = ACESOutputMat * color;
2077	return saturate( color );
2078}
2079const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2080	vec3( 1.6605, - 0.1246, - 0.0182 ),
2081	vec3( - 0.5876, 1.1329, - 0.1006 ),
2082	vec3( - 0.0728, - 0.0083, 1.1187 )
2083);
2084const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2085	vec3( 0.6274, 0.0691, 0.0164 ),
2086	vec3( 0.3293, 0.9195, 0.0880 ),
2087	vec3( 0.0433, 0.0113, 0.8956 )
2088);
2089vec3 agxDefaultContrastApprox( vec3 x ) {
2090	vec3 x2 = x * x;
2091	vec3 x4 = x2 * x2;
2092	return + 15.5 * x4 * x2
2093		- 40.14 * x4 * x
2094		+ 31.96 * x4
2095		- 6.868 * x2 * x
2096		+ 0.4298 * x2
2097		+ 0.1191 * x
2098		- 0.00232;
2099}
2100vec3 AgXToneMapping( vec3 color ) {
2101	const mat3 AgXInsetMatrix = mat3(
2102		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2103		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2104		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2105	);
2106	const mat3 AgXOutsetMatrix = mat3(
2107		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2108		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2109		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2110	);
2111	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2112	color *= toneMappingExposure;
2113	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2114	color = AgXInsetMatrix * color;
2115	color = max( color, 1e-10 );	color = log2( color );
2116	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2117	color = clamp( color, 0.0, 1.0 );
2118	color = agxDefaultContrastApprox( color );
2119	color = AgXOutsetMatrix * color;
2120	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2121	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2122	color = clamp( color, 0.0, 1.0 );
2123	return color;
2124}
2125vec3 NeutralToneMapping( vec3 color ) {
2126	const float StartCompression = 0.8 - 0.04;
2127	const float Desaturation = 0.15;
2128	color *= toneMappingExposure;
2129	float x = min( color.r, min( color.g, color.b ) );
2130	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2131	color -= offset;
2132	float peak = max( color.r, max( color.g, color.b ) );
2133	if ( peak < StartCompression ) return color;
2134	float d = 1. - StartCompression;
2135	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2136	color *= newPeak / peak;
2137	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2138	return mix( color, vec3( newPeak ), g );
2139}
2140vec3 CustomToneMapping( vec3 color ) { return color; }`,ox=`#ifdef USE_TRANSMISSION
2141	material.transmission = transmission;
2142	material.transmissionAlpha = 1.0;
2143	material.thickness = thickness;
2144	material.attenuationDistance = attenuationDistance;
2145	material.attenuationColor = attenuationColor;
2146	#ifdef USE_TRANSMISSIONMAP
2147		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2148	#endif
2149	#ifdef USE_THICKNESSMAP
2150		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2151	#endif
2152	vec3 pos = vWorldPosition;
2153	vec3 v = normalize( cameraPosition - pos );
2154	vec3 n = inverseTransformDirection( normal, viewMatrix );
2155	vec4 transmitted = getIBLVolumeRefraction(
2156		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2157		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2158		material.attenuationColor, material.attenuationDistance );
2159	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2160	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2161#endif`,lx=`#ifdef USE_TRANSMISSION
2162	uniform float transmission;
2163	uniform float thickness;
2164	uniform float attenuationDistance;
2165	uniform vec3 attenuationColor;
2166	#ifdef USE_TRANSMISSIONMAP
2167		uniform sampler2D transmissionMap;
2168	#endif
2169	#ifdef USE_THICKNESSMAP
2170		uniform sampler2D thicknessMap;
2171	#endif
2172	uniform vec2 transmissionSamplerSize;
2173	uniform sampler2D transmissionSamplerMap;
2174	uniform mat4 modelMatrix;
2175	uniform mat4 projectionMatrix;
2176	varying vec3 vWorldPosition;
2177	float w0( float a ) {
2178		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2179	}
2180	float w1( float a ) {
2181		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2182	}
2183	float w2( float a ){
2184		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2185	}
2186	float w3( float a ) {
2187		return ( 1.0 / 6.0 ) * ( a * a * a );
2188	}
2189	float g0( float a ) {
2190		return w0( a ) + w1( a );
2191	}
2192	float g1( float a ) {
2193		return w2( a ) + w3( a );
2194	}
2195	float h0( float a ) {
2196		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2197	}
2198	float h1( float a ) {
2199		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2200	}
2201	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2202		uv = uv * texelSize.zw + 0.5;
2203		vec2 iuv = floor( uv );
2204		vec2 fuv = fract( uv );
2205		float g0x = g0( fuv.x );
2206		float g1x = g1( fuv.x );
2207		float h0x = h0( fuv.x );
2208		float h1x = h1( fuv.x );
2209		float h0y = h0( fuv.y );
2210		float h1y = h1( fuv.y );
2211		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2212		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2213		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2214		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2215		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2216			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2217	}
2218	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2219		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2220		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2221		vec2 fLodSizeInv = 1.0 / fLodSize;
2222		vec2 cLodSizeInv = 1.0 / cLodSize;
2223		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2224		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2225		return mix( fSample, cSample, fract( lod ) );
2226	}
2227	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2228		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2229		vec3 modelScale;
2230		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2231		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2232		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2233		return normalize( refractionVector ) * thickness * modelScale;
2234	}
2235	float applyIorToRoughness( const in float roughness, const in float ior ) {
2236		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2237	}
2238	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2239		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2240		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2241	}
2242	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2243		if ( isinf( attenuationDistance ) ) {
2244			return vec3( 1.0 );
2245		} else {
2246			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2247			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2248		}
2249	}
2250	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2251		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2252		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2253		const in vec3 attenuationColor, const in float attenuationDistance ) {
2254		vec4 transmittedLight;
2255		vec3 transmittance;
2256		#ifdef USE_DISPERSION
2257			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2258			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2259			for ( int i = 0; i < 3; i ++ ) {
2260				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2261				vec3 refractedRayExit = position + transmissionRay;
2262				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2263				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2264				refractionCoords += 1.0;
2265				refractionCoords /= 2.0;
2266				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2267				transmittedLight[ i ] = transmissionSample[ i ];
2268				transmittedLight.a += transmissionSample.a;
2269				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2270			}
2271			transmittedLight.a /= 3.0;
2272		#else
2273			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2274			vec3 refractedRayExit = position + transmissionRay;
2275			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2276			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2277			refractionCoords += 1.0;
2278			refractionCoords /= 2.0;
2279			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2280			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2281		#endif
2282		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2283		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2284		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2285		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2286	}
2287#endif`,cx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2288	varying vec2 vUv;
2289#endif
2290#ifdef USE_MAP
2291	varying vec2 vMapUv;
2292#endif
2293#ifdef USE_ALPHAMAP
2294	varying vec2 vAlphaMapUv;
2295#endif
2296#ifdef USE_LIGHTMAP
2297	varying vec2 vLightMapUv;
2298#endif
2299#ifdef USE_AOMAP
2300	varying vec2 vAoMapUv;
2301#endif
2302#ifdef USE_BUMPMAP
2303	varying vec2 vBumpMapUv;
2304#endif
2305#ifdef USE_NORMALMAP
2306	varying vec2 vNormalMapUv;
2307#endif
2308#ifdef USE_EMISSIVEMAP
2309	varying vec2 vEmissiveMapUv;
2310#endif
2311#ifdef USE_METALNESSMAP
2312	varying vec2 vMetalnessMapUv;
2313#endif
2314#ifdef USE_ROUGHNESSMAP
2315	varying vec2 vRoughnessMapUv;
2316#endif
2317#ifdef USE_ANISOTROPYMAP
2318	varying vec2 vAnisotropyMapUv;
2319#endif
2320#ifdef USE_CLEARCOATMAP
2321	varying vec2 vClearcoatMapUv;
2322#endif
2323#ifdef USE_CLEARCOAT_NORMALMAP
2324	varying vec2 vClearcoatNormalMapUv;
2325#endif
2326#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2327	varying vec2 vClearcoatRoughnessMapUv;
2328#endif
2329#ifdef USE_IRIDESCENCEMAP
2330	varying vec2 vIridescenceMapUv;
2331#endif
2332#ifdef USE_IRIDESCENCE_THICKNESSMAP
2333	varying vec2 vIridescenceThicknessMapUv;
2334#endif
2335#ifdef USE_SHEEN_COLORMAP
2336	varying vec2 vSheenColorMapUv;
2337#endif
2338#ifdef USE_SHEEN_ROUGHNESSMAP
2339	varying vec2 vSheenRoughnessMapUv;
2340#endif
2341#ifdef USE_SPECULARMAP
2342	varying vec2 vSpecularMapUv;
2343#endif
2344#ifdef USE_SPECULAR_COLORMAP
2345	varying vec2 vSpecularColorMapUv;
2346#endif
2347#ifdef USE_SPECULAR_INTENSITYMAP
2348	varying vec2 vSpecularIntensityMapUv;
2349#endif
2350#ifdef USE_TRANSMISSIONMAP
2351	uniform mat3 transmissionMapTransform;
2352	varying vec2 vTransmissionMapUv;
2353#endif
2354#ifdef USE_THICKNESSMAP
2355	uniform mat3 thicknessMapTransform;
2356	varying vec2 vThicknessMapUv;
2357#endif`,hx=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2358	varying vec2 vUv;
2359#endif
2360#ifdef USE_MAP
2361	uniform mat3 mapTransform;
2362	varying vec2 vMapUv;
2363#endif
2364#ifdef USE_ALPHAMAP
2365	uniform mat3 alphaMapTransform;
2366	varying vec2 vAlphaMapUv;
2367#endif
2368#ifdef USE_LIGHTMAP
2369	uniform mat3 lightMapTransform;
2370	varying vec2 vLightMapUv;
2371#endif
2372#ifdef USE_AOMAP
2373	uniform mat3 aoMapTransform;
2374	varying vec2 vAoMapUv;
2375#endif
2376#ifdef USE_BUMPMAP
2377	uniform mat3 bumpMapTransform;
2378	varying vec2 vBumpMapUv;
2379#endif
2380#ifdef USE_NORMALMAP
2381	uniform mat3 normalMapTransform;
2382	varying vec2 vNormalMapUv;
2383#endif
2384#ifdef USE_DISPLACEMENTMAP
2385	uniform mat3 displacementMapTransform;
2386	varying vec2 vDisplacementMapUv;
2387#endif
2388#ifdef USE_EMISSIVEMAP
2389	uniform mat3 emissiveMapTransform;
2390	varying vec2 vEmissiveMapUv;
2391#endif
2392#ifdef USE_METALNESSMAP
2393	uniform mat3 metalnessMapTransform;
2394	varying vec2 vMetalnessMapUv;
2395#endif
2396#ifdef USE_ROUGHNESSMAP
2397	uniform mat3 roughnessMapTransform;
2398	varying vec2 vRoughnessMapUv;
2399#endif
2400#ifdef USE_ANISOTROPYMAP
2401	uniform mat3 anisotropyMapTransform;
2402	varying vec2 vAnisotropyMapUv;
2403#endif
2404#ifdef USE_CLEARCOATMAP
2405	uniform mat3 clearcoatMapTransform;
2406	varying vec2 vClearcoatMapUv;
2407#endif
2408#ifdef USE_CLEARCOAT_NORMALMAP
2409	uniform mat3 clearcoatNormalMapTransform;
2410	varying vec2 vClearcoatNormalMapUv;
2411#endif
2412#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2413	uniform mat3 clearcoatRoughnessMapTransform;
2414	varying vec2 vClearcoatRoughnessMapUv;
2415#endif
2416#ifdef USE_SHEEN_COLORMAP
2417	uniform mat3 sheenColorMapTransform;
2418	varying vec2 vSheenColorMapUv;
2419#endif
2420#ifdef USE_SHEEN_ROUGHNESSMAP
2421	uniform mat3 sheenRoughnessMapTransform;
2422	varying vec2 vSheenRoughnessMapUv;
2423#endif
2424#ifdef USE_IRIDESCENCEMAP
2425	uniform mat3 iridescenceMapTransform;
2426	varying vec2 vIridescenceMapUv;
2427#endif
2428#ifdef USE_IRIDESCENCE_THICKNESSMAP
2429	uniform mat3 iridescenceThicknessMapTransform;
2430	varying vec2 vIridescenceThicknessMapUv;
2431#endif
2432#ifdef USE_SPECULARMAP
2433	uniform mat3 specularMapTransform;
2434	varying vec2 vSpecularMapUv;
2435#endif
2436#ifdef USE_SPECULAR_COLORMAP
2437	uniform mat3 specularColorMapTransform;
2438	varying vec2 vSpecularColorMapUv;
2439#endif
2440#ifdef USE_SPECULAR_INTENSITYMAP
2441	uniform mat3 specularIntensityMapTransform;
2442	varying vec2 vSpecularIntensityMapUv;
2443#endif
2444#ifdef USE_TRANSMISSIONMAP
2445	uniform mat3 transmissionMapTransform;
2446	varying vec2 vTransmissionMapUv;
2447#endif
2448#ifdef USE_THICKNESSMAP
2449	uniform mat3 thicknessMapTransform;
2450	varying vec2 vThicknessMapUv;
2451#endif`,ux=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2452	vUv = vec3( uv, 1 ).xy;
2453#endif
2454#ifdef USE_MAP
2455	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2456#endif
2457#ifdef USE_ALPHAMAP
2458	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2459#endif
2460#ifdef USE_LIGHTMAP
2461	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2462#endif
2463#ifdef USE_AOMAP
2464	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2465#endif
2466#ifdef USE_BUMPMAP
2467	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2468#endif
2469#ifdef USE_NORMALMAP
2470	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2471#endif
2472#ifdef USE_DISPLACEMENTMAP
2473	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2474#endif
2475#ifdef USE_EMISSIVEMAP
2476	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2477#endif
2478#ifdef USE_METALNESSMAP
2479	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2480#endif
2481#ifdef USE_ROUGHNESSMAP
2482	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2483#endif
2484#ifdef USE_ANISOTROPYMAP
2485	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2486#endif
2487#ifdef USE_CLEARCOATMAP
2488	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2489#endif
2490#ifdef USE_CLEARCOAT_NORMALMAP
2491	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2492#endif
2493#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2494	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2495#endif
2496#ifdef USE_IRIDESCENCEMAP
2497	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2498#endif
2499#ifdef USE_IRIDESCENCE_THICKNESSMAP
2500	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2501#endif
2502#ifdef USE_SHEEN_COLORMAP
2503	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2504#endif
2505#ifdef USE_SHEEN_ROUGHNESSMAP
2506	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2507#endif
2508#ifdef USE_SPECULARMAP
2509	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2510#endif
2511#ifdef USE_SPECULAR_COLORMAP
2512	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2513#endif
2514#ifdef USE_SPECULAR_INTENSITYMAP
2515	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2516#endif
2517#ifdef USE_TRANSMISSIONMAP
2518	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2519#endif
2520#ifdef USE_THICKNESSMAP
2521	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2522#endif`,dx=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2523	vec4 worldPosition = vec4( transformed, 1.0 );
2524	#ifdef USE_BATCHING
2525		worldPosition = batchingMatrix * worldPosition;
2526	#endif
2527	#ifdef USE_INSTANCING
2528		worldPosition = instanceMatrix * worldPosition;
2529	#endif
2530	worldPosition = modelMatrix * worldPosition;
2531#endif`;const fx=`varying vec2 vUv;
2532uniform mat3 uvTransform;
2533void main() {
2534	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2535	gl_Position = vec4( position.xy, 1.0, 1.0 );
2536}`,px=`uniform sampler2D t2D;
2537uniform float backgroundIntensity;
2538varying vec2 vUv;
2539void main() {
2540	vec4 texColor = texture2D( t2D, vUv );
2541	#ifdef DECODE_VIDEO_TEXTURE
2542		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 );
2543	#endif
2544	texColor.rgb *= backgroundIntensity;
2545	gl_FragColor = texColor;
2546	#include <tonemapping_fragment>
2547	#include <colorspace_fragment>
2548}`,mx=`varying vec3 vWorldDirection;
2549#include <common>
2550void main() {
2551	vWorldDirection = transformDirection( position, modelMatrix );
2552	#include <begin_vertex>
2553	#include <project_vertex>
2554	gl_Position.z = gl_Position.w;
2555}`,gx=`#ifdef ENVMAP_TYPE_CUBE
2556	uniform samplerCube envMap;
2557#elif defined( ENVMAP_TYPE_CUBE_UV )
2558	uniform sampler2D envMap;
2559#endif
2560uniform float flipEnvMap;
2561uniform float backgroundBlurriness;
2562uniform float backgroundIntensity;
2563uniform mat3 backgroundRotation;
2564varying vec3 vWorldDirection;
2565#include <cube_uv_reflection_fragment>
2566void main() {
2567	#ifdef ENVMAP_TYPE_CUBE
2568		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2569	#elif defined( ENVMAP_TYPE_CUBE_UV )
2570		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2571	#else
2572		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2573	#endif
2574	texColor.rgb *= backgroundIntensity;
2575	gl_FragColor = texColor;
2576	#include <tonemapping_fragment>
2577	#include <colorspace_fragment>
2578}`,_x=`varying vec3 vWorldDirection;
2579#include <common>
2580void main() {
2581	vWorldDirection = transformDirection( position, modelMatrix );
2582	#include <begin_vertex>
2583	#include <project_vertex>
2584	gl_Position.z = gl_Position.w;
2585}`,xx=`uniform samplerCube tCube;
2586uniform float tFlip;
2587uniform float opacity;
2588varying vec3 vWorldDirection;
2589void main() {
2590	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2591	gl_FragColor = texColor;
2592	gl_FragColor.a *= opacity;
2593	#include <tonemapping_fragment>
2594	#include <colorspace_fragment>
2595}`,vx=`#include <common>
2596#include <batching_pars_vertex>
2597#include <uv_pars_vertex>
2598#include <displacementmap_pars_vertex>
2599#include <morphtarget_pars_vertex>
2600#include <skinning_pars_vertex>
2601#include <logdepthbuf_pars_vertex>
2602#include <clipping_planes_pars_vertex>
2603varying vec2 vHighPrecisionZW;
2604void main() {
2605	#include <uv_vertex>
2606	#include <batching_vertex>
2607	#include <skinbase_vertex>
2608	#include <morphinstance_vertex>
2609	#ifdef USE_DISPLACEMENTMAP
2610		#include <beginnormal_vertex>
2611		#include <morphnormal_vertex>
2612		#include <skinnormal_vertex>
2613	#endif
2614	#include <begin_vertex>
2615	#include <morphtarget_vertex>
2616	#include <skinning_vertex>
2617	#include <displacementmap_vertex>
2618	#include <project_vertex>
2619	#include <logdepthbuf_vertex>
2620	#include <clipping_planes_vertex>
2621	vHighPrecisionZW = gl_Position.zw;
2622}`,yx=`#if DEPTH_PACKING == 3200
2623	uniform float opacity;
2624#endif
2625#include <common>
2626#include <packing>
2627#include <uv_pars_fragment>
2628#include <map_pars_fragment>
2629#include <alphamap_pars_fragment>
2630#include <alphatest_pars_fragment>
2631#include <alphahash_pars_fragment>
2632#include <logdepthbuf_pars_fragment>
2633#include <clipping_planes_pars_fragment>
2634varying vec2 vHighPrecisionZW;
2635void main() {
2636	vec4 diffuseColor = vec4( 1.0 );
2637	#include <clipping_planes_fragment>
2638	#if DEPTH_PACKING == 3200
2639		diffuseColor.a = opacity;
2640	#endif
2641	#include <map_fragment>
2642	#include <alphamap_fragment>
2643	#include <alphatest_fragment>
2644	#include <alphahash_fragment>
2645	#include <logdepthbuf_fragment>
2646	#ifdef USE_REVERSED_DEPTH_BUFFER
2647		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2648	#else
2649		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2650	#endif
2651	#if DEPTH_PACKING == 3200
2652		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2653	#elif DEPTH_PACKING == 3201
2654		gl_FragColor = packDepthToRGBA( fragCoordZ );
2655	#elif DEPTH_PACKING == 3202
2656		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2657	#elif DEPTH_PACKING == 3203
2658		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2659	#endif
2660}`,Mx=`#define DISTANCE
2661varying vec3 vWorldPosition;
2662#include <common>
2663#include <batching_pars_vertex>
2664#include <uv_pars_vertex>
2665#include <displacementmap_pars_vertex>
2666#include <morphtarget_pars_vertex>
2667#include <skinning_pars_vertex>
2668#include <clipping_planes_pars_vertex>
2669void main() {
2670	#include <uv_vertex>
2671	#include <batching_vertex>
2672	#include <skinbase_vertex>
2673	#include <morphinstance_vertex>
2674	#ifdef USE_DISPLACEMENTMAP
2675		#include <beginnormal_vertex>
2676		#include <morphnormal_vertex>
2677		#include <skinnormal_vertex>
2678	#endif
2679	#include <begin_vertex>
2680	#include <morphtarget_vertex>
2681	#include <skinning_vertex>
2682	#include <displacementmap_vertex>
2683	#include <project_vertex>
2684	#include <worldpos_vertex>
2685	#include <clipping_planes_vertex>
2686	vWorldPosition = worldPosition.xyz;
2687}`,Sx=`#define DISTANCE
2688uniform vec3 referencePosition;
2689uniform float nearDistance;
2690uniform float farDistance;
2691varying vec3 vWorldPosition;
2692#include <common>
2693#include <packing>
2694#include <uv_pars_fragment>
2695#include <map_pars_fragment>
2696#include <alphamap_pars_fragment>
2697#include <alphatest_pars_fragment>
2698#include <alphahash_pars_fragment>
2699#include <clipping_planes_pars_fragment>
2700void main () {
2701	vec4 diffuseColor = vec4( 1.0 );
2702	#include <clipping_planes_fragment>
2703	#include <map_fragment>
2704	#include <alphamap_fragment>
2705	#include <alphatest_fragment>
2706	#include <alphahash_fragment>
2707	float dist = length( vWorldPosition - referencePosition );
2708	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2709	dist = saturate( dist );
2710	gl_FragColor = packDepthToRGBA( dist );
2711}`,bx=`varying vec3 vWorldDirection;
2712#include <common>
2713void main() {
2714	vWorldDirection = transformDirection( position, modelMatrix );
2715	#include <begin_vertex>
2716	#include <project_vertex>
2717}`,Ex=`uniform sampler2D tEquirect;
2718varying vec3 vWorldDirection;
2719#include <common>
2720void main() {
2721	vec3 direction = normalize( vWorldDirection );
2722	vec2 sampleUV = equirectUv( direction );
2723	gl_FragColor = texture2D( tEquirect, sampleUV );
2724	#include <tonemapping_fragment>
2725	#include <colorspace_fragment>
2726}`,Tx=`uniform float scale;
2727attribute float lineDistance;
2728varying float vLineDistance;
2729#include <common>
2730#include <uv_pars_vertex>
2731#include <color_pars_vertex>
2732#include <fog_pars_vertex>
2733#include <morphtarget_pars_vertex>
2734#include <logdepthbuf_pars_vertex>
2735#include <clipping_planes_pars_vertex>
2736void main() {
2737	vLineDistance = scale * lineDistance;
2738	#include <uv_vertex>
2739	#include <color_vertex>
2740	#include <morphinstance_vertex>
2741	#include <morphcolor_vertex>
2742	#include <begin_vertex>
2743	#include <morphtarget_vertex>
2744	#include <project_vertex>
2745	#include <logdepthbuf_vertex>
2746	#include <clipping_planes_vertex>
2747	#include <fog_vertex>
2748}`,Ax=`uniform vec3 diffuse;
2749uniform float opacity;
2750uniform float dashSize;
2751uniform float totalSize;
2752varying float vLineDistance;
2753#include <common>
2754#include <color_pars_fragment>
2755#include <uv_pars_fragment>
2756#include <map_pars_fragment>
2757#include <fog_pars_fragment>
2758#include <logdepthbuf_pars_fragment>
2759#include <clipping_planes_pars_fragment>
2760void main() {
2761	vec4 diffuseColor = vec4( diffuse, opacity );
2762	#include <clipping_planes_fragment>
2763	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2764		discard;
2765	}
2766	vec3 outgoingLight = vec3( 0.0 );
2767	#include <logdepthbuf_fragment>
2768	#include <map_fragment>
2769	#include <color_fragment>
2770	outgoingLight = diffuseColor.rgb;
2771	#include <opaque_fragment>
2772	#include <tonemapping_fragment>
2773	#include <colorspace_fragment>
2774	#include <fog_fragment>
2775	#include <premultiplied_alpha_fragment>
2776}`,wx=`#include <common>
2777#include <batching_pars_vertex>
2778#include <uv_pars_vertex>
2779#include <envmap_pars_vertex>
2780#include <color_pars_vertex>
2781#include <fog_pars_vertex>
2782#include <morphtarget_pars_vertex>
2783#include <skinning_pars_vertex>
2784#include <logdepthbuf_pars_vertex>
2785#include <clipping_planes_pars_vertex>
2786void main() {
2787	#include <uv_vertex>
2788	#include <color_vertex>
2789	#include <morphinstance_vertex>
2790	#include <morphcolor_vertex>
2791	#include <batching_vertex>
2792	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2793		#include <beginnormal_vertex>
2794		#include <morphnormal_vertex>
2795		#include <skinbase_vertex>
2796		#include <skinnormal_vertex>
2797		#include <defaultnormal_vertex>
2798	#endif
2799	#include <begin_vertex>
2800	#include <morphtarget_vertex>
2801	#include <skinning_vertex>
2802	#include <project_vertex>
2803	#include <logdepthbuf_vertex>
2804	#include <clipping_planes_vertex>
2805	#include <worldpos_vertex>
2806	#include <envmap_vertex>
2807	#include <fog_vertex>
2808}`,Cx=`uniform vec3 diffuse;
2809uniform float opacity;
2810#ifndef FLAT_SHADED
2811	varying vec3 vNormal;
2812#endif
2813#include <common>
2814#include <dithering_pars_fragment>
2815#include <color_pars_fragment>
2816#include <uv_pars_fragment>
2817#include <map_pars_fragment>
2818#include <alphamap_pars_fragment>
2819#include <alphatest_pars_fragment>
2820#include <alphahash_pars_fragment>
2821#include <aomap_pars_fragment>
2822#include <lightmap_pars_fragment>
2823#include <envmap_common_pars_fragment>
2824#include <envmap_pars_fragment>
2825#include <fog_pars_fragment>
2826#include <specularmap_pars_fragment>
2827#include <logdepthbuf_pars_fragment>
2828#include <clipping_planes_pars_fragment>
2829void main() {
2830	vec4 diffuseColor = vec4( diffuse, opacity );
2831	#include <clipping_planes_fragment>
2832	#include <logdepthbuf_fragment>
2833	#include <map_fragment>
2834	#include <color_fragment>
2835	#include <alphamap_fragment>
2836	#include <alphatest_fragment>
2837	#include <alphahash_fragment>
2838	#include <specularmap_fragment>
2839	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2840	#ifdef USE_LIGHTMAP
2841		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2842		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2843	#else
2844		reflectedLight.indirectDiffuse += vec3( 1.0 );
2845	#endif
2846	#include <aomap_fragment>
2847	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2848	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2849	#include <envmap_fragment>
2850	#include <opaque_fragment>
2851	#include <tonemapping_fragment>
2852	#include <colorspace_fragment>
2853	#include <fog_fragment>
2854	#include <premultiplied_alpha_fragment>
2855	#include <dithering_fragment>
2856}`,Rx=`#define LAMBERT
2857varying vec3 vViewPosition;
2858#include <common>
2859#include <batching_pars_vertex>
2860#include <uv_pars_vertex>
2861#include <displacementmap_pars_vertex>
2862#include <envmap_pars_vertex>
2863#include <color_pars_vertex>
2864#include <fog_pars_vertex>
2865#include <normal_pars_vertex>
2866#include <morphtarget_pars_vertex>
2867#include <skinning_pars_vertex>
2868#include <shadowmap_pars_vertex>
2869#include <logdepthbuf_pars_vertex>
2870#include <clipping_planes_pars_vertex>
2871void main() {
2872	#include <uv_vertex>
2873	#include <color_vertex>
2874	#include <morphinstance_vertex>
2875	#include <morphcolor_vertex>
2876	#include <batching_vertex>
2877	#include <beginnormal_vertex>
2878	#include <morphnormal_vertex>
2879	#include <skinbase_vertex>
2880	#include <skinnormal_vertex>
2881	#include <defaultnormal_vertex>
2882	#include <normal_vertex>
2883	#include <begin_vertex>
2884	#include <morphtarget_vertex>
2885	#include <skinning_vertex>
2886	#include <displacementmap_vertex>
2887	#include <project_vertex>
2888	#include <logdepthbuf_vertex>
2889	#include <clipping_planes_vertex>
2890	vViewPosition = - mvPosition.xyz;
2891	#include <worldpos_vertex>
2892	#include <envmap_vertex>
2893	#include <shadowmap_vertex>
2894	#include <fog_vertex>
2895}`,Ix=`#define LAMBERT
2896uniform vec3 diffuse;
2897uniform vec3 emissive;
2898uniform float opacity;
2899#include <common>
2900#include <packing>
2901#include <dithering_pars_fragment>
2902#include <color_pars_fragment>
2903#include <uv_pars_fragment>
2904#include <map_pars_fragment>
2905#include <alphamap_pars_fragment>
2906#include <alphatest_pars_fragment>
2907#include <alphahash_pars_fragment>
2908#include <aomap_pars_fragment>
2909#include <lightmap_pars_fragment>
2910#include <emissivemap_pars_fragment>
2911#include <envmap_common_pars_fragment>
2912#include <envmap_pars_fragment>
2913#include <fog_pars_fragment>
2914#include <bsdfs>
2915#include <lights_pars_begin>
2916#include <normal_pars_fragment>
2917#include <lights_lambert_pars_fragment>
2918#include <shadowmap_pars_fragment>
2919#include <bumpmap_pars_fragment>
2920#include <normalmap_pars_fragment>
2921#include <specularmap_pars_fragment>
2922#include <logdepthbuf_pars_fragment>
2923#include <clipping_planes_pars_fragment>
2924void main() {
2925	vec4 diffuseColor = vec4( diffuse, opacity );
2926	#include <clipping_planes_fragment>
2927	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2928	vec3 totalEmissiveRadiance = emissive;
2929	#include <logdepthbuf_fragment>
2930	#include <map_fragment>
2931	#include <color_fragment>
2932	#include <alphamap_fragment>
2933	#include <alphatest_fragment>
2934	#include <alphahash_fragment>
2935	#include <specularmap_fragment>
2936	#include <normal_fragment_begin>
2937	#include <normal_fragment_maps>
2938	#include <emissivemap_fragment>
2939	#include <lights_lambert_fragment>
2940	#include <lights_fragment_begin>
2941	#include <lights_fragment_maps>
2942	#include <lights_fragment_end>
2943	#include <aomap_fragment>
2944	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2945	#include <envmap_fragment>
2946	#include <opaque_fragment>
2947	#include <tonemapping_fragment>
2948	#include <colorspace_fragment>
2949	#include <fog_fragment>
2950	#include <premultiplied_alpha_fragment>
2951	#include <dithering_fragment>
2952}`,Px=`#define MATCAP
2953varying vec3 vViewPosition;
2954#include <common>
2955#include <batching_pars_vertex>
2956#include <uv_pars_vertex>
2957#include <color_pars_vertex>
2958#include <displacementmap_pars_vertex>
2959#include <fog_pars_vertex>
2960#include <normal_pars_vertex>
2961#include <morphtarget_pars_vertex>
2962#include <skinning_pars_vertex>
2963#include <logdepthbuf_pars_vertex>
2964#include <clipping_planes_pars_vertex>
2965void main() {
2966	#include <uv_vertex>
2967	#include <color_vertex>
2968	#include <morphinstance_vertex>
2969	#include <morphcolor_vertex>
2970	#include <batching_vertex>
2971	#include <beginnormal_vertex>
2972	#include <morphnormal_vertex>
2973	#include <skinbase_vertex>
2974	#include <skinnormal_vertex>
2975	#include <defaultnormal_vertex>
2976	#include <normal_vertex>
2977	#include <begin_vertex>
2978	#include <morphtarget_vertex>
2979	#include <skinning_vertex>
2980	#include <displacementmap_vertex>
2981	#include <project_vertex>
2982	#include <logdepthbuf_vertex>
2983	#include <clipping_planes_vertex>
2984	#include <fog_vertex>
2985	vViewPosition = - mvPosition.xyz;
2986}`,Lx=`#define MATCAP
2987uniform vec3 diffuse;
2988uniform float opacity;
2989uniform sampler2D matcap;
2990varying vec3 vViewPosition;
2991#include <common>
2992#include <dithering_pars_fragment>
2993#include <color_pars_fragment>
2994#include <uv_pars_fragment>
2995#include <map_pars_fragment>
2996#include <alphamap_pars_fragment>
2997#include <alphatest_pars_fragment>
2998#include <alphahash_pars_fragment>
2999#include <fog_pars_fragment>
3000#include <normal_pars_fragment>
3001#include <bumpmap_pars_fragment>
3002#include
3002 <normalmap_pars_fragment>
3003#include <logdepthbuf_pars_fragment>
3004#include <clipping_planes_pars_fragment>
3005void main() {
3006	vec4 diffuseColor = vec4( diffuse, opacity );
3007	#include <clipping_planes_fragment>
3008	#include <logdepthbuf_fragment>
3009	#include <map_fragment>
3010	#include <color_fragment>
3011	#include <alphamap_fragment>
3012	#include <alphatest_fragment>
3013	#include <alphahash_fragment>
3014	#include <normal_fragment_begin>
3015	#include <normal_fragment_maps>
3016	vec3 viewDir = normalize( vViewPosition );
3017	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3018	vec3 y = cross( viewDir, x );
3019	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3020	#ifdef USE_MATCAP
3021		vec4 matcapColor = texture2D( matcap, uv );
3022	#else
3023		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3024	#endif
3025	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3026	#include <opaque_fragment>
3027	#include <tonemapping_fragment>
3028	#include <colorspace_fragment>
3029	#include <fog_fragment>
3030	#include <premultiplied_alpha_fragment>
3031	#include <dithering_fragment>
3032}`,Dx=`#define NORMAL
3033#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3034	varying vec3 vViewPosition;
3035#endif
3036#include <common>
3037#include <batching_pars_vertex>
3038#include <uv_pars_vertex>
3039#include <displacementmap_pars_vertex>
3040#include <normal_pars_vertex>
3041#include <morphtarget_pars_vertex>
3042#include <skinning_pars_vertex>
3043#include <logdepthbuf_pars_vertex>
3044#include <clipping_planes_pars_vertex>
3045void main() {
3046	#include <uv_vertex>
3047	#include <batching_vertex>
3048	#include <beginnormal_vertex>
3049	#include <morphinstance_vertex>
3050	#include <morphnormal_vertex>
3051	#include <skinbase_vertex>
3052	#include <skinnormal_vertex>
3053	#include <defaultnormal_vertex>
3054	#include <normal_vertex>
3055	#include <begin_vertex>
3056	#include <morphtarget_vertex>
3057	#include <skinning_vertex>
3058	#include <displacementmap_vertex>
3059	#include <project_vertex>
3060	#include <logdepthbuf_vertex>
3061	#include <clipping_planes_vertex>
3062#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3063	vViewPosition = - mvPosition.xyz;
3064#endif
3065}`,Ux=`#define NORMAL
3066uniform float opacity;
3067#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3068	varying vec3 vViewPosition;
3069#endif
3070#include <packing>
3071#include <uv_pars_fragment>
3072#include <normal_pars_fragment>
3073#include <bumpmap_pars_fragment>
3074#include <normalmap_pars_fragment>
3075#include <logdepthbuf_pars_fragment>
3076#include <clipping_planes_pars_fragment>
3077void main() {
3078	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3079	#include <clipping_planes_fragment>
3080	#include <logdepthbuf_fragment>
3081	#include <normal_fragment_begin>
3082	#include <normal_fragment_maps>
3083	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3084	#ifdef OPAQUE
3085		gl_FragColor.a = 1.0;
3086	#endif
3087}`,Nx=`#define PHONG
3088varying vec3 vViewPosition;
3089#include <common>
3090#include <batching_pars_vertex>
3091#include <uv_pars_vertex>
3092#include <displacementmap_pars_vertex>
3093#include <envmap_pars_vertex>
3094#include <color_pars_vertex>
3095#include <fog_pars_vertex>
3096#include <normal_pars_vertex>
3097#include <morphtarget_pars_vertex>
3098#include <skinning_pars_vertex>
3099#include <shadowmap_pars_vertex>
3100#include <logdepthbuf_pars_vertex>
3101#include <clipping_planes_pars_vertex>
3102void main() {
3103	#include <uv_vertex>
3104	#include <color_vertex>
3105	#include <morphcolor_vertex>
3106	#include <batching_vertex>
3107	#include <beginnormal_vertex>
3108	#include <morphinstance_vertex>
3109	#include <morphnormal_vertex>
3110	#include <skinbase_vertex>
3111	#include <skinnormal_vertex>
3112	#include <defaultnormal_vertex>
3113	#include <normal_vertex>
3114	#include <begin_vertex>
3115	#include <morphtarget_vertex>
3116	#include <skinning_vertex>
3117	#include <displacementmap_vertex>
3118	#include <project_vertex>
3119	#include <logdepthbuf_vertex>
3120	#include <clipping_planes_vertex>
3121	vViewPosition = - mvPosition.xyz;
3122	#include <worldpos_vertex>
3123	#include <envmap_vertex>
3124	#include <shadowmap_vertex>
3125	#include <fog_vertex>
3126}`,Fx=`#define PHONG
3127uniform vec3 diffuse;
3128uniform vec3 emissive;
3129uniform vec3 specular;
3130uniform float shininess;
3131uniform float opacity;
3132#include <common>
3133#include <packing>
3134#include <dithering_pars_fragment>
3135#include <color_pars_fragment>
3136#include <uv_pars_fragment>
3137#include <map_pars_fragment>
3138#include <alphamap_pars_fragment>
3139#include <alphatest_pars_fragment>
3140#include <alphahash_pars_fragment>
3141#include <aomap_pars_fragment>
3142#include <lightmap_pars_fragment>
3143#include <emissivemap_pars_fragment>
3144#include <envmap_common_pars_fragment>
3145#include <envmap_pars_fragment>
3146#include <fog_pars_fragment>
3147#include <bsdfs>
3148#include <lights_pars_begin>
3149#include <normal_pars_fragment>
3150#include <lights_phong_pars_fragment>
3151#include <shadowmap_pars_fragment>
3152#include <bumpmap_pars_fragment>
3153#include <normalmap_pars_fragment>
3154#include <specularmap_pars_fragment>
3155#include <logdepthbuf_pars_fragment>
3156#include <clipping_planes_pars_fragment>
3157void main() {
3158	vec4 diffuseColor = vec4( diffuse, opacity );
3159	#include <clipping_planes_fragment>
3160	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3161	vec3 totalEmissiveRadiance = emissive;
3162	#include <logdepthbuf_fragment>
3163	#include <map_fragment>
3164	#include <color_fragment>
3165	#include <alphamap_fragment>
3166	#include <alphatest_fragment>
3167	#include <alphahash_fragment>
3168	#include <specularmap_fragment>
3169	#include <normal_fragment_begin>
3170	#include <normal_fragment_maps>
3171	#include <emissivemap_fragment>
3172	#include <lights_phong_fragment>
3173	#include <lights_fragment_begin>
3174	#include <lights_fragment_maps>
3175	#include <lights_fragment_end>
3176	#include <aomap_fragment>
3177	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3178	#include <envmap_fragment>
3179	#include <opaque_fragment>
3180	#include <tonemapping_fragment>
3181	#include <colorspace_fragment>
3182	#include <fog_fragment>
3183	#include <premultiplied_alpha_fragment>
3184	#include <dithering_fragment>
3185}`,Ox=`#define STANDARD
3186varying vec3 vViewPosition;
3187#ifdef USE_TRANSMISSION
3188	varying vec3 vWorldPosition;
3189#endif
3190#include <common>
3191#include <batching_pars_vertex>
3192#include <uv_pars_vertex>
3193#include <displacementmap_pars_vertex>
3194#include <color_pars_vertex>
3195#include <fog_pars_vertex>
3196#include <normal_pars_vertex>
3197#include <morphtarget_pars_vertex>
3198#include <skinning_pars_vertex>
3199#include <shadowmap_pars_vertex>
3200#include <logdepthbuf_pars_vertex>
3201#include <clipping_planes_pars_vertex>
3202void main() {
3203	#include <uv_vertex>
3204	#include <color_vertex>
3205	#include <morphinstance_vertex>
3206	#include <morphcolor_vertex>
3207	#include <batching_vertex>
3208	#include <beginnormal_vertex>
3209	#include <morphnormal_vertex>
3210	#include <skinbase_vertex>
3211	#include <skinnormal_vertex>
3212	#include <defaultnormal_vertex>
3213	#include <normal_vertex>
3214	#include <begin_vertex>
3215	#include <morphtarget_vertex>
3216	#include <skinning_vertex>
3217	#include <displacementmap_vertex>
3218	#include <project_vertex>
3219	#include <logdepthbuf_vertex>
3220	#include <clipping_planes_vertex>
3221	vViewPosition = - mvPosition.xyz;
3222	#include <worldpos_vertex>
3223	#include <shadowmap_vertex>
3224	#include <fog_vertex>
3225#ifdef USE_TRANSMISSION
3226	vWorldPosition = worldPosition.xyz;
3227#endif
3228}`,Bx=`#define STANDARD
3229#ifdef PHYSICAL
3230	#define IOR
3231	#define USE_SPECULAR
3232#endif
3233uniform vec3 diffuse;
3234uniform vec3 emissive;
3235uniform float roughness;
3236uniform float metalness;
3237uniform float opacity;
3238#ifdef IOR
3239	uniform float ior;
3240#endif
3241#ifdef USE_SPECULAR
3242	uniform float specularIntensity;
3243	uniform vec3 specularColor;
3244	#ifdef USE_SPECULAR_COLORMAP
3245		uniform sampler2D specularColorMap;
3246	#endif
3247	#ifdef USE_SPECULAR_INTENSITYMAP
3248		uniform sampler2D specularIntensityMap;
3249	#endif
3250#endif
3251#ifdef USE_CLEARCOAT
3252	uniform float clearcoat;
3253	uniform float clearcoatRoughness;
3254#endif
3255#ifdef USE_DISPERSION
3256	uniform float dispersion;
3257#endif
3258#ifdef USE_IRIDESCENCE
3259	uniform float iridescence;
3260	uniform float iridescenceIOR;
3261	uniform float iridescenceThicknessMinimum;
3262	uniform float iridescenceThicknessMaximum;
3263#endif
3264#ifdef USE_SHEEN
3265	uniform vec3 sheenColor;
3266	uniform float sheenRoughness;
3267	#ifdef USE_SHEEN_COLORMAP
3268		uniform sampler2D sheenColorMap;
3269	#endif
3270	#ifdef USE_SHEEN_ROUGHNESSMAP
3271		uniform sampler2D sheenRoughnessMap;
3272	#endif
3273#endif
3274#ifdef USE_ANISOTROPY
3275	uniform vec2 anisotropyVector;
3276	#ifdef USE_ANISOTROPYMAP
3277		uniform sampler2D anisotropyMap;
3278	#endif
3279#endif
3280varying vec3 vViewPosition;
3281#include <common>
3282#include <packing>
3283#include <dithering_pars_fragment>
3284#include <color_pars_fragment>
3285#include <uv_pars_fragment>
3286#include <map_pars_fragment>
3287#include <alphamap_pars_fragment>
3288#include <alphatest_pars_fragment>
3289#include <alphahash_pars_fragment>
3290#include <aomap_pars_fragment>
3291#include <lightmap_pars_fragment>
3292#include <emissivemap_pars_fragment>
3293#include <iridescence_fragment>
3294#include <cube_uv_reflection_fragment>
3295#include <envmap_common_pars_fragment>
3296#include <envmap_physical_pars_fragment>
3297#include <fog_pars_fragment>
3298#include <lights_pars_begin>
3299#include <normal_pars_fragment>
3300#include <lights_physical_pars_fragment>
3301#include <transmission_pars_fragment>
3302#include <shadowmap_pars_fragment>
3303#include <bumpmap_pars_fragment>
3304#include <normalmap_pars_fragment>
3305#include <clearcoat_pars_fragment>
3306#include <iridescence_pars_fragment>
3307#include <roughnessmap_pars_fragment>
3308#include <metalnessmap_pars_fragment>
3309#include <logdepthbuf_pars_fragment>
3310#include <clipping_planes_pars_fragment>
3311void main() {
3312	vec4 diffuseColor = vec4( diffuse, opacity );
3313	#include <clipping_planes_fragment>
3314	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3315	vec3 totalEmissiveRadiance = emissive;
3316	#include <logdepthbuf_fragment>
3317	#include <map_fragment>
3318	#include <color_fragment>
3319	#include <alphamap_fragment>
3320	#include <alphatest_fragment>
3321	#include <alphahash_fragment>
3322	#include <roughnessmap_fragment>
3323	#include <metalnessmap_fragment>
3324	#include <normal_fragment_begin>
3325	#include <normal_fragment_maps>
3326	#include <clearcoat_normal_fragment_begin>
3327	#include <clearcoat_normal_fragment_maps>
3328	#include <emissivemap_fragment>
3329	#include <lights_physical_fragment>
3330	#include <lights_fragment_begin>
3331	#include <lights_fragment_maps>
3332	#include <lights_fragment_end>
3333	#include <aomap_fragment>
3334	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3335	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3336	#include <transmission_fragment>
3337	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3338	#ifdef USE_SHEEN
3339		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3340		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3341	#endif
3342	#ifdef USE_CLEARCOAT
3343		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3344		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3345		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3346	#endif
3347	#include <opaque_fragment>
3348	#include <tonemapping_fragment>
3349	#include <colorspace_fragment>
3350	#include <fog_fragment>
3351	#include <premultiplied_alpha_fragment>
3352	#include <dithering_fragment>
3353}`,zx=`#define TOON
3354varying vec3 vViewPosition;
3355#include <common>
3356#include <batching_pars_vertex>
3357#include <uv_pars_vertex>
3358#include <displacementmap_pars_vertex>
3359#include <color_pars_vertex>
3360#include <fog_pars_vertex>
3361#include <normal_pars_vertex>
3362#include <morphtarget_pars_vertex>
3363#include <skinning_pars_vertex>
3364#include <shadowmap_pars_vertex>
3365#include <logdepthbuf_pars_vertex>
3366#include <clipping_planes_pars_vertex>
3367void main() {
3368	#include <uv_vertex>
3369	#include <color_vertex>
3370	#include <morphinstance_vertex>
3371	#include <morphcolor_vertex>
3372	#include <batching_vertex>
3373	#include <beginnormal_vertex>
3374	#include <morphnormal_vertex>
3375	#include <skinbase_vertex>
3376	#include <skinnormal_vertex>
3377	#include <defaultnormal_vertex>
3378	#include <normal_vertex>
3379	#include <begin_vertex>
3380	#include <morphtarget_vertex>
3381	#include <skinning_vertex>
3382	#include <displacementmap_vertex>
3383	#include <project_vertex>
3384	#include <logdepthbuf_vertex>
3385	#include <clipping_planes_vertex>
3386	vViewPosition = - mvPosition.xyz;
3387	#include <worldpos_vertex>
3388	#include <shadowmap_vertex>
3389	#include <fog_vertex>
3390}`,kx=`#define TOON
3391uniform vec3 diffuse;
3392uniform vec3 emissive;
3393uniform float opacity;
3394#include <common>
3395#include <packing>
3396#include <dithering_pars_fragment>
3397#include <color_pars_fragment>
3398#include <uv_pars_fragment>
3399#include <map_pars_fragment>
3400#include <alphamap_pars_fragment>
3401#include <alphatest_pars_fragment>
3402#include <alphahash_pars_fragment>
3403#include <aomap_pars_fragment>
3404#include <lightmap_pars_fragment>
3405#include <emissivemap_pars_fragment>
3406#include <gradientmap_pars_fragment>
3407#include <fog_pars_fragment>
3408#include <bsdfs>
3409#include <lights_pars_begin>
3410#include <normal_pars_fragment>
3411#include <lights_toon_pars_fragment>
3412#include <shadowmap_pars_fragment>
3413#include <bumpmap_pars_fragment>
3414#include <normalmap_pars_fragment>
3415#include <logdepthbuf_pars_fragment>
3416#include <clipping_planes_pars_fragment>
3417void main() {
3418	vec4 diffuseColor = vec4( diffuse, opacity );
3419	#include <clipping_planes_fragment>
3420	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3421	vec3 totalEmissiveRadiance = emissive;
3422	#include <logdepthbuf_fragment>
3423	#include <map_fragment>
3424	#include <color_fragment>
3425	#include <alphamap_fragment>
3426	#include <alphatest_fragment>
3427	#include <alphahash_fragment>
3428	#include <normal_fragment_begin>
3429	#include <normal_fragment_maps>
3430	#include <emissivemap_fragment>
3431	#include <lights_toon_fragment>
3432	#include <lights_fragment_begin>
3433	#include <lights_fragment_maps>
3434	#include <lights_fragment_end>
3435	#include <aomap_fragment>
3436	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3437	#include <opaque_fragment>
3438	#include <tonemapping_fragment>
3439	#include <colorspace_fragment>
3440	#include <fog_fragment>
3441	#include <premultiplied_alpha_fragment>
3442	#include <dithering_fragment>
3443}`,Vx=`uniform float size;
3444uniform float scale;
3445#include <common>
3446#include <color_pars_vertex>
3447#include <fog_pars_vertex>
3448#include <morphtarget_pars_vertex>
3449#include <logdepthbuf_pars_vertex>
3450#include <clipping_planes_pars_vertex>
3451#ifdef USE_POINTS_UV
3452	varying vec2 vUv;
3453	uniform mat3 uvTransform;
3454#endif
3455void main() {
3456	#ifdef USE_POINTS_UV
3457		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3458	#endif
3459	#include <color_vertex>
3460	#include <morphinstance_vertex>
3461	#include <morphcolor_vertex>
3462	#include <begin_vertex>
3463	#include <morphtarget_vertex>
3464	#include <project_vertex>
3465	gl_PointSize = size;
3466	#ifdef USE_SIZEATTENUATION
3467		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3468		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3469	#endif
3470	#include <logdepthbuf_vertex>
3471	#include <clipping_planes_vertex>
3472	#include <worldpos_vertex>
3473	#include <fog_vertex>
3474}`,Hx=`uniform vec3 diffuse;
3475uniform float opacity;
3476#include <common>
3477#include <color_pars_fragment>
3478#include <map_particle_pars_fragment>
3479#include <alphatest_pars_fragment>
3480#include <alphahash_pars_fragment>
3481#include <fog_pars_fragment>
3482#include <logdepthbuf_pars_fragment>
3483#include <clipping_planes_pars_fragment>
3484void main() {
3485	vec4 diffuseColor = vec4( diffuse, opacity );
3486	#include <clipping_planes_fragment>
3487	vec3 outgoingLight = vec3( 0.0 );
3488	#include <logdepthbuf_fragment>
3489	#include <map_particle_fragment>
3490	#include <color_fragment>
3491	#include <alphatest_fragment>
3492	#include <alphahash_fragment>
3493	outgoingLight = diffuseColor.rgb;
3494	#include <opaque_fragment>
3495	#include <tonemapping_fragment>
3496	#include <colorspace_fragment>
3497	#include <fog_fragment>
3498	#include <premultiplied_alpha_fragment>
3499}`,Gx=`#include <common>
3500#include <batching_pars_vertex>
3501#include <fog_pars_vertex>
3502#include <morphtarget_pars_vertex>
3503#include <skinning_pars_vertex>
3504#include <logdepthbuf_pars_vertex>
3505#include <shadowmap_pars_vertex>
3506void main() {
3507	#include <batching_vertex>
3508	#include <beginnormal_vertex>
3509	#include <morphinstance_vertex>
3510	#include <morphnormal_vertex>
3511	#include <skinbase_vertex>
3512	#include <skinnormal_vertex>
3513	#include <defaultnormal_vertex>
3514	#include <begin_vertex>
3515	#include <morphtarget_vertex>
3516	#include <skinning_vertex>
3517	#include <project_vertex>
3518	#include <logdepthbuf_vertex>
3519	#include <worldpos_vertex>
3520	#include <shadowmap_vertex>
3521	#include <fog_vertex>
3522}`,Wx=`uniform vec3 color;
3523uniform float opacity;
3524#include <common>
3525#include <packing>
3526#include <fog_pars_fragment>
3527#include <bsdfs>
3528#include <lights_pars_begin>
3529#include <logdepthbuf_pars_fragment>
3530#include <shadowmap_pars_fragment>
3531#include <shadowmask_pars_fragment>
3532void main() {
3533	#include <logdepthbuf_fragment>
3534	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3535	#include <tonemapping_fragment>
3536	#include <colorspace_fragment>
3537	#include <fog_fragment>
3538}`,Xx=`uniform float rotation;
3539uniform vec2 center;
3540#include <common>
3541#include <uv_pars_vertex>
3542#include <fog_pars_vertex>
3543#include <logdepthbuf_pars_vertex>
3544#include <clipping_planes_pars_vertex>
3545void main() {
3546	#include <uv_vertex>
3547	vec4 mvPosition = modelViewMatrix[ 3 ];
3548	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3549	#ifndef USE_SIZEATTENUATION
3550		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3551		if ( isPerspective ) scale *= - mvPosition.z;
3552	#endif
3553	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3554	vec2 rotatedPosition;
3555	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3556	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3557	mvPosition.xy += rotatedPosition;
3558	gl_Position = projectionMatrix * mvPosition;
3559	#include <logdepthbuf_vertex>
3560	#include <clipping_planes_vertex>
3561	#include <fog_vertex>
3562}`,qx=`uniform vec3 diffuse;
3563uniform float opacity;
3564#include <common>
3565#include <uv_pars_fragment>
3566#include <map_pars_fragment>
3567#include <alphamap_pars_fragment>
3568#include <alphatest_pars_fragment>
3569#include <alphahash_pars_fragment>
3570#include <fog_pars_fragment>
3571#include <logdepthbuf_pars_fragment>
3572#include <clipping_planes_pars_fragment>
3573void main() {
3574	vec4 diffuseColor = vec4( diffuse, opacity );
3575	#include <clipping_planes_fragment>
3576	vec3 outgoingLight = vec3( 0.0 );
3577	#include <logdepthbuf_fragment>
3578	#include <map_fragment>
3579	#include <alphamap_fragment>
3580	#include <alphatest_fragment>
3581	#include <alphahash_fragment>
3582	outgoingLight = diffuseColor.rgb;
3583	#include <opaque_fragment>
3584	#include <tonemapping_fragment>
3585	#include <colorspace_fragment>
3586	#include <fog_fragment>
3587}`,Yt={alphahash_fragment:p_,alphahash_pars_fragment:m_,alphamap_fragment:g_,alphamap_pars_fragment:__,alphatest_fragment:x_,alphatest_pars_fragment:v_,aomap_fragment:y_,aomap_pars_fragment:M_,batching_pars_vertex:S_,batching_vertex:b_,begin_vertex:E_,beginnormal_vertex:T_,bsdfs:A_,iridescence_fragment:w_,bumpmap_pars_fragment:C_,clipping_planes_fragment:R_,clipping_planes_pars_fragment:I_,clipping_planes_pars_vertex:P_,clipping_planes_vertex:L_,color_fragment:D_,color_pars_fragment:U_,color_pars_vertex:N_,color_vertex:F_,common:O_,cube_uv_reflection_fragment:B_,defaultnormal_vertex:z_,displacementmap_pars_vertex:k_,dis
vendor: 6,777 bytes, line 3587
3587placementmap_vertex:V_,emissivemap_fragment:H_,emissivemap_pars_fragment:G_,colorspace_fragment:W_,colorspace_pars_fragment:X_,envmap_fragment:q_,envmap_common_pars_fragment:Y_,envmap_pars_fragment:Z_,envmap_pars_vertex:J_,envmap_physical_pars_fragment:a0,envmap_vertex:$_,fog_vertex:K_,fog_pars_vertex:Q_,fog_fragment:j_,fog_pars_fragment:t0,gradientmap_pars_fragment:e0,lightmap_pars_fragment:n0,lights_lambert_fragment:i0,lights_lambert_pars_fragment:s0,lights_pars_begin:r0,lights_toon_fragment:o0,lights_toon_pars_fragment:l0,lights_phong_fragment:c0,lights_phong_pars_fragment:h0,lights_physical_fragment:u0,lights_physical_pars_fragment:d0,lights_fragment_begin:f0,lights_fragment_maps:p0,lights_fragment_end:m0,logdepthbuf_fragment:g0,logdepthbuf_pars_fragment:_0,logdepthbuf_pars_vertex:x0,logdepthbuf_vertex:v0,map_fragment:y0,map_pars_fragment:M0,map_particle_fragment:S0,map_particle_pars_fragment:b0,metalnessmap_fragment:E0,metalnessmap_pars_fragment:T0,morphinstance_vertex:A0,morphcolor_vertex:w0,morphnormal_vertex:C0,morphtarget_pars_vertex:R0,morphtarget_vertex:I0,normal_fragment_begin:P0,normal_fragment_maps:L0,normal_pars_fragment:D0,normal_pars_vertex:U0,normal_vertex:N0,normalmap_pars_fragment:F0,clearcoat_normal_fragment_begin:O0,clearcoat_normal_fragment_maps:B0,clearcoat_pars_fragment:z0,iridescence_pars_fragment:k0,opaque_fragment:V0,packing:H0,premultiplied_alpha_fragment:G0,project_vertex:W0,dithering_fragment:X0,dithering_pars_fragment:q0,roughnessmap_fragment:Y0,roughnessmap_pars_fragment:Z0,shadowmap_pars_fragment:J0,shadowmap_pars_vertex:$0,shadowmap_vertex:K0,shadowmask_pars_fragment:Q0,skinbase_vertex:j0,skinning_pars_vertex:tx,skinning_vertex:ex,skinnormal_vertex:nx,specularmap_fragment:ix,specularmap_pars_fragment:sx,tonemapping_fragment:rx,tonemapping_pars_fragment:ax,transmission_fragment:ox,transmission_pars_fragment:lx,uv_pars_fragment:cx,uv_pars_vertex:hx,uv_vertex:ux,worldpos_vertex:dx,background_vert:fx,background_frag:px,backgroundCube_vert:mx,backgroundCube_frag:gx,cube_vert:_x,cube_frag:xx,depth_vert:vx,depth_frag:yx,distanceRGBA_vert:Mx,distanceRGBA_frag:Sx,equirect_vert:bx,equirect_frag:Ex,linedashed_vert:Tx,linedashed_frag:Ax,meshbasic_vert:wx,meshbasic_frag:Cx,meshlambert_vert:Rx,meshlambert_frag:Ix,meshmatcap_vert:Px,meshmatcap_frag:Lx,meshnormal_vert:Dx,meshnormal_frag:Ux,meshphong_vert:Nx,meshphong_frag:Fx,meshphysical_vert:Ox,meshphysical_frag:Bx,meshtoon_vert:zx,meshtoon_frag:kx,points_vert:Vx,points_frag:Hx,shadow_vert:Gx,shadow_frag:Wx,sprite_vert:Xx,sprite_frag:qx},ft={common:{diffuse:{value:new xt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ht},alphaMap:{value:null},alphaMapTransform:{value:new Ht},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ht}},envmap:{envMap:{value:null},envMapRotation:{value:new Ht},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ht}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ht}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ht},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ht},normalScale:{value:new Q(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ht},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ht}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ht}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ht}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xt(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 xt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ht},alphaTest:{value:0},uvTransform:{value:new Ht}},sprite:{diffuse:{value:new xt(16777215)},opacity:{value:1},center:{value:new Q(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ht},alphaMap:{value:null},alphaMapTransform:{value:new Ht},alphaTest:{value:0}}},hn={basic:{uniforms:Ne([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.fog]),vertexShader:Yt.meshbasic_vert,fragmentShader:Yt.meshbasic_frag},lambert:{uniforms:Ne([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,ft.lights,{emissive:{value:new xt(0)}}]),vertexShader:Yt.meshlambert_vert,fragmentShader:Yt.meshlambert_frag},phong:{uniforms:Ne([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,ft.lights,{emissive:{value:new xt(0)},specular:{value:new xt(1118481)},shininess:{value:30}}]),vertexShader:Yt.meshphong_vert,fragmentShader:Yt.meshphong_frag},standard:{uniforms:Ne([ft.common,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.roughnessmap,ft.metalnessmap,ft.fog,ft.lights,{emissive:{value:new xt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Yt.meshphysical_vert,fragmentShader:Yt.meshphysical_frag},toon:{uniforms:Ne([ft.common,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.gradientmap,ft.fog,ft.lights,{emissive:{value:new xt(0)}}]),vertexShader:Yt.meshtoon_vert,fragmentShader:Yt.meshtoon_frag},matcap:{uniforms:Ne([ft.common,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,{matc
vendor: 5,277 bytes, line 3587
3587ap:{value:null}}]),vertexShader:Yt.meshmatcap_vert,fragmentShader:Yt.meshmatcap_frag},points:{uniforms:Ne([ft.points,ft.fog]),vertexShader:Yt.points_vert,fragmentShader:Yt.points_frag},dashed:{uniforms:Ne([ft.common,ft.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Yt.linedashed_vert,fragmentShader:Yt.linedashed_frag},depth:{uniforms:Ne([ft.common,ft.displacementmap]),vertexShader:Yt.depth_vert,fragmentShader:Yt.depth_frag},normal:{uniforms:Ne([ft.common,ft.bumpmap,ft.normalmap,ft.displacementmap,{opacity:{value:1}}]),vertexShader:Yt.meshnormal_vert,fragmentShader:Yt.meshnormal_frag},sprite:{uniforms:Ne([ft.sprite,ft.fog]),vertexShader:Yt.sprite_vert,fragmentShader:Yt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ht},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Yt.background_vert,fragmentShader:Yt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ht}},vertexShader:Yt.backgroundCube_vert,fragmentShader:Yt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Yt.cube_vert,fragmentShader:Yt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Yt.equirect_vert,fragmentShader:Yt.equirect_frag},distanceRGBA:{uniforms:Ne([ft.common,ft.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Yt.distanceRGBA_vert,fragmentShader:Yt.distanceRGBA_frag},shadow:{uniforms:Ne([ft.lights,ft.fog,{color:{value:new xt(0)},opacity:{value:1}}]),vertexShader:Yt.shadow_vert,fragmentShader:Yt.shadow_frag}};hn.physical={uniforms:Ne([hn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ht},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ht},clearcoatNormalScale:{value:new Q(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ht},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ht},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ht},sheen:{value:0},sheenColor:{value:new xt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ht},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ht},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ht},transmissionSamplerSize:{value:new Q},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ht},attenuationDistance:{value:0},attenuationColor:{value:new xt(0)},specularColor:{value:new xt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ht},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ht},anisotropyVector:{value:new Q},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ht}}]),vertexShader:Yt.meshphysical_vert,fragmentShader:Yt.meshphysical_frag};const ha={r:0,b:0,g:0},xi=new tn,Yx=new Ot;function Zx(r,t,e,n,i,s,a){const o=new xt(0);let l=s===!0?0:1,c,h,u=null,d=0,f=null;function m(v){let x=v.isScene===!0?v.background:null;return x&&x.isTexture&&(x=(v.backgroundBlurriness>0?e:t).get(x)),x}function _(v){let x=!1;const A=m(v);A===null?p(o,l):A&&A.isColor&&(p(A,1),x=!0);const T=r.xr.getEnvironmentBlendMode();T==="additive"?n.buffers.color.setClear(0,0,0,1,a):T==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,a),(r.autoClear||x)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function g(v,x){const A=m(x);A&&(A.isCubeTexture||A.mapping===xs)?(h===void 0&&(h=new ye(new Di(1,1,1),new fn({name:"BackgroundCubeMaterial",uniforms:ms(hn.backgroundCube.uniforms),vertexShader:hn.backgroundCube.vertexShader,fragmentShader:hn.backgroundCube.fragmentShader,side:Be,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,R,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),xi.copy(x.backgroundRotation),xi.x*=-1,xi.y*=-1,xi.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(xi.y*=-1,xi.z*=-1),h.material.uniforms.envMap.value=A,h.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Yx.makeRotationFromEuler(xi)),h.material.toneMapped=Kt.getTransfer(A.colorSpace)!==re,(u!==A||d!==A.version||f!==r.toneMapping)&&(h.material.needsUpdate=!0,u=A,d=A.version,f=r.toneMapping),h.layers.enableAll(),v.unshift(h,h.geometry,h.material,0,0,null)):A&&A.isTexture&&(c===void 0&&(c=new ye(new Ss(2,2),new fn({name:"Backgroun
3587dMaterial",uniforms:ms(hn.background.uniforms),vertexShader:hn.background.vertexShader,fragmentShader:hn.background.fragmentShader,side:Bn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=A,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=Kt.getTransfer(A.colorSpace)!==re,A.matrixAutoUpdate===!0&&A.updateMatrix(),c.material.uniforms.uvTransform.value.copy(A.matrix),(u!==A||d!==A.version||f!==r.toneMapping)&&(c.material.needsUpdate=!0,u=A,d=A.version,f=r.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,x){v.getRGB(ha,hd(r)),n.buffers.color.setClear(ha.r,ha.g,ha.b,x,a)}function y(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(v,x=1){o.set(v),l=x,p(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(o,l)},render:_,addToRenderList:g,dispose:y}}function Jx(r,t){const e=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(S,L,F,z,G){let q=!1;const W=u(z,F,L);s!==W&&(s=W,c(s.object)),q=f(S,z,F,G),q&&m(S,z,F,G),G!==null&&t.update(G,r.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,x(S,L,F,z),G!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(G).buffer))}function l(){return r.createVertexArray()}function c(S){return r.bindVertexArray(S)}function h(S){return r.deleteVertexArray(S)}function u(S,L,F){const z=F.wireframe===!0;let G=n[S.id];G===void 0&&(G={},n[S.id]=G);let q=G[L.id];q===void 0&&(q={},G[L.id]=q);let W=q[z];return W===void 0&&(W=d(l()),q[z]=W),W}function d(S){const L=[],F=[],z=[];for(let G=0;G<e;G++)L[G]=0,F[G]=0,z[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:F,attributeDivisors:z,object:S,attributes:{},index:null}}function f(S,L,F,z){const G=s.attributes,q=L.attributes;let W=0;const nt=F.getAttributes();for(const H in nt)if(nt[H].location>=0){const _t=G[H];let St=q[H];if(St===void 0&&(H==="instanceMatrix"&&S.instanceMatrix&&(St=S.instanceMatrix),H==="instanceColor"&&S.instanceColor&&(St=S.instanceColor)),_t===void 0||_t.attribute!==St||St&&_t.data!==St.data)return!0;W++}return s.attributesNum!==W||s.index!==z}function m(S,L,F,z){const G={},q=L.attributes;let W=0;const nt=F.getAttributes();for(const H in nt)if(nt[H].location>=0){let _t=q[H];_t===void 0&&(H==="instanceMatrix"&&S.instanceMatrix&&(_t=S.instanceMatrix),H==="instanceColor"&&S.instanceColor&&(_t=S.instanceColor));const St={};St.attribute=_t,_t&&_t.data&&(St.data=_t.data),G[H]=St,W++}s.attributes=G,s.attributesNum=W,s.index=z}function _(){const S=s.newAttributes;for(let L=0,F=S.length;L<F;L++)S[L]=0}function g(S){p(S,0)}function p(S,L){const F=s.newAttributes,z=s.enabledAttributes,G=s.attributeDivisors;F[S]=1,z[S]===0&&(r.enableVertexAttribArray(S),z[S]=1),G[S]!==L&&(r.vertexAttribDivisor(S,L),G[S]=L)}function y(){const S=s.newAttributes,L=s.enabledAttributes;for(let F=0,z=L.length;F<z;F++)L[F]!==S[F]&&(r.disableVertexAttribArray(F),L[F]=0)}function v(S,L,F,z,G,q,W){W===!0?r.vertexAttribIPointer(S,L,F,G,q):r.vertexAttribPointer(S,L,F,z,G,q)}function x(S,L,F,z){_();const G=z.attributes,q=F.getAttributes(),W=L.defaultAttributeValues;for(const nt in q){const H=q[nt];if(H.location>=0){let ut=G[nt];if(ut===void 0&&(nt==="instanceMatrix"&&S.instanceMatrix&&(ut=S.instanceMatrix),nt==="instanceColor"&&S.instanceColor&&(ut=S.instanceColor)),ut!==void 0){const _t=ut.normalized,St=ut.itemSize,Gt=t.get(ut);if(Gt===void 0)continue;const $t=Gt.buffer,se=Gt.type,Qt=Gt.bytesPerElement,Y=se===r.INT||se===r.UNSIGNED_INT||ut.gpuType===ao;if(ut.isInterleavedBufferAttribute){const et=ut.data,yt=et.stride,Pt=ut.offset;if(et.isInstancedInterleavedBuffer){for(let Tt=0;Tt<H.locationSize;Tt++)p(H.location+Tt,et.meshPerAttribute);S.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=et.meshPerAttribute*et.count)}else for(let Tt=0;Tt<H.locationSize;Tt++)g(H.location+Tt);r.bindBuffer(r.ARRAY_BUFFER,$t);for(let Tt=0;Tt<H.locationSize;Tt++)v(H.location+Tt,St/H.locationSize,se,_t,yt*Qt,(Pt+St/H.locationSize*Tt)*Qt,Y)}else{if(ut.isInstancedBufferAttribute){for(let et=0;et<H.locationSize;et++)p(H.location+et,ut.meshPerAttribute);S.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=ut.meshPerAttribute*ut.count)}else for(let et=0;et<H.locationSize;et++)g(H.location+et);r.bindBuffer(r.ARRAY_BUFFER,$t);for(let et=0;et<H.locationSize;et++)v(H.location+et,St/H.locationSize,se,_t,St*Qt,St/H.locationSize*et*Qt,Y)}}else if(W!==void 0){const _t=W[nt];if(_t!==void 0)switch(_t.length){case 2:r.vertexAttrib2fv(H.location,_t);break;case 3:r.vertexAttrib3fv(H.location,_t);break;case 4:r.vertexAttrib4fv(H.location,_t);break;default:r.vertexAttrib1fv(H.location,_t)}}}}y()}function A(){I();for(const S in n){const L=n[S];for(const F in L){const z=L[F];for(const G in z)h(z[G].object),delete z[G];delete L[F]}delete n[S]}}function T(S){if(n[S.id]===void 0)return;const L=n[S.id];for(const F in L){const z=L[F];for(const G in z)h(z[G].object),delete z[G];delete L[F]}delete n[S.id]}function R(S){for(const L in n){const F=n[L];if(F[S.id]===void 0)continue;const z=F[S.id];for(const G in z)h(z[G].object),delete z[G];delete F[S.id]}}function I(){b(),a=!0,s!==i&&(s=i,c(s.object))}function b(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:I,resetDefaultState:b,dispose:A,releaseStatesOfGeometry:T,releaseStatesOfProgram:R,initAttributes:_,enableAttribute:g,disableUnusedAttributes:y}}function $x(r,t,e){let n;function i(c){n=c}function s(c,h){r.drawArrays(n,c,h),e.update(h,n,1)}function a(c,h,u){u!==0&&(r.drawArraysInstanced(n,c,h,u),e.update(h,n,u))}function o(c,h,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,u);let f=0;for(let m=0;m<u;m++)f+=h[m];e.update(f,n,1)}
vendor: 12,795 bytes, lines 3587-3662
3587function l(c,h,u,d){if(u===0)return;const f=t.get("WEBGL_multi_draw");if(f===null)for(let m=0;m<c.length;m++)a(c[m],h[m],d[m]);else{f.multiDrawArraysInstancedWEBGL(n,c,0,h,0,d,0,u);let m=0;for(let _=0;_<u;_++)m+=h[_]*d[_];e.update(m,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Kx(r,t,e,n){let i;function s(){if(i!==void 0)return i;if(t.has("EXT_texture_filter_anisotropic")===!0){const R=t.get("EXT_texture_filter_anisotropic");i=r.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(R){return!(R!==Oe&&n.convert(R)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const I=R===vs&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(R!==dn&&n.convert(R)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Xe&&!I)}function l(R){if(R==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=e.precision!==void 0?e.precision:"highp";const h=l(c);h!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const u=e.logarithmicDepthBuffer===!0,d=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),p=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),A=m>0,T=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:m,maxTextureSize:_,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:y,maxVaryings:v,maxFragmentUniforms:x,vertexTextures:A,maxSamples:T}}function Qx(r){const t=this;let e=null,n=0,i=!1,s=!1;const a=new Jn,o=new Ht,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){e=h(u,d,0)},this.setState=function(u,d,f){const m=u.clippingPlanes,_=u.clipIntersection,g=u.clipShadows,p=r.get(u);if(!i||m===null||m.length===0||s&&!g)s?h(null):c();else{const y=s?0:n,v=y*4;let x=p.clippingState||null;l.value=x,x=h(m,d,v,f);for(let A=0;A!==v;++A)x[A]=e[A];p.clippingState=x,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(u,d,f,m){const _=u!==null?u.length:0;let g=null;if(_!==0){if(g=l.value,m!==!0||g===null){const p=f+_*4,y=d.matrixWorldInverse;o.getNormalMatrix(y),(g===null||g.length<p)&&(g=new Float32Array(p));for(let v=0,x=f;v!==_;++v,x+=4)a.copy(u[v]).applyMatrix4(y,o),a.normal.toArray(g,x),g[x+3]=a.constant}l.value=g,l.needsUpdate=!0}return t.numPlanes=_,t.numIntersection=0,g}}function jx(r){let t=new WeakMap;function e(a,o){return o===Zs?a.mapping=zn:o===Js&&(a.mapping=Qn),a}function n(a){if(a&&a.isTexture){const o=a.mapping;if(o===Zs||o===Js)if(t.has(a)){const l=t.get(a).texture;return e(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new fd(l.height);return c.fromEquirectangularTexture(r,a),t.set(a,c),a.addEventListener("dispose",i),e(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function s(){t=new WeakMap}return{get:n,dispose:s}}const os=4,Yh=[.125,.215,.35,.446,.526,.582],Si=20,Al=new Oo,Zh=new xt;let wl=null,Cl=0,Rl=0,Il=!1;const Mi=(1+Math.sqrt(5))/2,is=1/Mi,Jh=[new C(-Mi,is,0),new C(Mi,is,0),new C(-is,0,Mi),new C(is,0,Mi),new C(0,Mi,-is),new C(0,Mi,is),new C(-1,1,-1),new C(1,1,-1),new C(-1,1,1),new C(1,1,1)],tv=new C;class ql{constructor(t){this._renderer=t,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(t,e=0,n=.1,i=100,s={}){const{size:a=256,position:o=tv}=s;wl=this._renderer.getRenderTarget(),Cl=this._renderer.getActiveCubeFace(),Rl=this._renderer.getActiveMipmapLevel(),Il=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,n,i,l,o),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Qh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Kh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(wl,Cl,Rl),this._renderer.xr.enabled=Il,t.scissorTest=!1,ua(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===zn||t.mapping===Qn?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),wl=this._renderer.getRenderTarget(),Cl=this._renderer.getActiveCubeFace(),Rl=this._renderer.getActiveMipmapLevel(),Il=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Me,minFilter:Me,generateMipmaps:!1,type:vs,format:Oe,colorSpace:Ii,depthBuffer:!1},i=$h(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=$h(t,e,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=ev(s)),this._blurMaterial=nv(s,t,e)}return i}_compileMaterial(t){const e=new ye(this._lodPlanes[0],t);this._renderer.compile(e,Al)}_sceneToCubeUV(t,e,n,i,s){const l=new Te(90,1,e,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(Zh),u.toneMapping=Fn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null));const _=new ei({name:"PMREM.Background",side:Be,depthWrite:!1,depthTest:!1}),g=new ye(new Di,_);let p=!1;const y=t.background;y?y.isColor&&(_.color.copy(y),t.background=null,p=!0):(_.color.copy(Zh),p=!0);for(let v=0;v<6;v++){const x=v%3;x===0?(l.up.set(0,c[v],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[v],s.y,s.z)):x===1?(l.up.set(0,0,c[v]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[v],s.z)):(l.up.set(0,c[v],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[v]));const A=this._cubeSize;ua(i,x*A,v>2?A:0,A,A),u.setRenderTarget(i),p&&u.render(g,l),u.render(t,l)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=d,t.background=y}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===zn||t.mapping===Qn;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Qh()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Kh());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new ye(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=t;const l=this._cubeSize;ua(e,0,0,3*l,2*l),n.setRenderTarget(e),n.render(a,Al)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const a=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),o=Jh[(i-s-1)%Jh.length];this._blur(t,s-1,s,a,o)}e.autoClear=n}_blur(t,e,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",s),this._halfBlur(a,t,n,n,i,"longitudinal",s)}_halfBlur(t,e,n,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const h=3,u=new ye(this._lodPlanes[i],c),d=c.uniforms,f=this._sizeLods[n]-1,m=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Si-1),_=s/m,g=isFinite(s)?1+Math.floor(h*_):Si;g>Si&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Si}`);const p=[];let y=0;for(let R=0;R<Si;++R){const I=R/_,b=Math.exp(-I*I/2);p.push(b),R===0?y+=b:R<g&&(y+=2*b)}for(let R=0;R<p.length;R++)p[R]=p[R]/y;d.envMap.value=t.texture,d.samples.value=g,d.weights.value=p,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:v}=this;d.dTheta.value=m,d.mipInt.value=v-n;const x=this._sizeLods[i],A=3*x*(i>v-os?i-v+os:0),T=4*(this._cubeSize-x);ua(e,A,T,3*x,2*x),l.setRenderTarget(e),l.render(u,Al)}}function ev(r){const t=[],e=[],n=[];let i=r;const s=r-os+1+Yh.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>r-os?l=Yh[a-r+os-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),h=-c,u=1+c,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,m=6,_=3,g=2,p=1,y=new Float32Array(_*m*f),v=new Float32Array(g*m*f),x=new Float32Array(p*m*f);for(let T=0;T<f;T++){const R=T%3*2/3-1,I=T>2?0:-1,b=[R,I,0,R+2/3,I,0,R+2/3,I+1,0,R,I,0,R+2/3,I+1,0,R,I+1,0];y.set(b,_*m*T),v.set(d,g*m*T);const S=[T,T,T,T,T,T];x.set(S,p*m*T)}const A=new Xt;A.setAttribute("position",new oe(y,_)),A.setAttribute("uv",new oe(v,g)),A.setAttribute("faceIndex",new oe(x,p)),t.push(A),i>os&&i--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function $h(r,t,e){const n=new bn(r,t,e);return n.texture.mapping=xs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ua(r,t,e,n,i){r.viewport.set(t,e,n,i),r.scissor.set(t,e,n,i)}function nv(r,t,e){const n=new Float32Array(Si),i=new C(0,1,0);return new fn({name:"SphericalGaussianBlur",defines:{n:Si,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Dc(),fragmentShader:`
3588
3589			precision mediump float;
3590			precision mediump int;
3591
3592			varying vec3 vOutputDirection;
3593
3594			uniform sampler2D envMap;
3595			uniform int samples;
3596			uniform float weights[ n ];
3597			uniform bool latitudinal;
3598			uniform float dTheta;
3599			uniform float mipInt;
3600			uniform vec3 poleAxis;
3601
3602			#define ENVMAP_TYPE_CUBE_UV
3603			#include <cube_uv_reflection_fragment>
3604
3605			vec3 getSample( float theta, vec3 axis ) {
3606
3607				float cosTheta = cos( theta );
3608				// Rodrigues' axis-angle rotation
3609				vec3 sampleDirection = vOutputDirection * cosTheta
3610					+ cross( axis, vOutputDirection ) * sin( theta )
3611					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3612
3613				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3614
3615			}
3616
3617			void main() {
3618
3619				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3620
3621				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3622
3623					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3624
3625				}
3626
3627				axis = normalize( axis );
3628
3629				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3630				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3631
3632				for ( int i = 1; i < n; i++ ) {
3633
3634					if ( i >= samples ) {
3635
3636						break;
3637
3638					}
3639
3640					float theta = dTheta * float( i );
3641					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3642					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3643
3644				}
3645
3646			}
3647		`,blending:Nn,depthTest:!1,depthWrite:!1})}function Kh(){return new fn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Dc(),fragmentShader:`
3648
3649			precision mediump float;
3650			precision mediump int;
3651
3652			varying vec3 vOutputDirection;
3653
3654			uniform sampler2D envMap;
3655
3656			#include <common>
3657
3658			void main() {
3659
3660				vec3 outputDirection = normalize( vOutputDirection );
3661				vec2 uv = equirectUv( outputDirection );
3662
3663				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3664
3665			}
3666		`,blending:Nn,depthTest:!1,depthWrite:!1})}function Qh(){return new fn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Dc(),fragmentShader:`
3667
3668			precision mediump float;
3669			precision mediump int;
3670
3671			uniform float flipEnvMap;
3672
3673			varying vec3 vOutputDirection;
3674
3675			uniform samplerCube envMap;
3676
3677			void main() {
3678
3679				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3680
3681			}
3682		`,blending:Nn,depthTest:!1,depthWrite:!1})}function Dc(){return`
3683
3684		precision mediump float;
3685		precision mediump int;
3686
3687		attribute float faceIndex;
3688
3689		varying vec3 vOutputDirection;
3690
3691		// RH coordinate system; PMREM face-indexing convention
3692		vec3 getDirection( vec2 uv, float face ) {
3693
3694			uv = 2.0 * uv - 1.0;
3695
3696			vec3 direction = vec3( uv, 1.0 );
3697
3698			if ( face == 0.0 ) {
3699
3700				direction = direction.zyx; // ( 1, v, u ) pos x
3701
3702			} else if ( face == 1.0 ) {
3703
3704				direction = direction.xzy;
3705				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3706
3707			} else if ( face == 2.0 ) {
3708
3709				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3710
3711			} else if ( face == 3.0 ) {
3712
3713				direction = direction.zyx;
3714				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3715
3716			} else if ( face == 4.0 ) {
3717
3718				direction = direction.xzy;
3719				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3720
3721			} else if ( face == 5.0 ) {
3722
3723				direction.z *= -1.0; // ( u, v, -1 ) neg z
3724
3725			}
3726
3727			return direction;
3728
3729		}
3730
3731		void main() {
3732
3733			vOutputDirection = getDirection( uv, faceIndex );
3734			gl_Position = vec4( position, 1.0 );
3735
3736		}
3737	`}function iv(r){let t=new WeakMap,e=null;function n(o){if(o&&o.isTexture){const l=o.mapping,c=l===Zs||l===Js,h=l===zn||l===Qn;if(c||h){let u=t.get(o);const d=u!==void 0?u.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==d)return e===null&&(e=new ql(r)),u=c?e.fromEquirectangular(o,u):e.fromCubemap(o,u),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),u.texture;if(u!==void 0)return u.texture;{const f=o.image;return c&&f&&f.height>0||h&&f&&i(f)?(e===null&&(e=new ql(r)),u=c?e.fromEquirectangular(o):e.fromCubemap(o),u.texture.pmremVersion=o.pmremVersion,t.set(o,u),o.addEventListener("dispose",s),u.texture):null}}}return o}function i(o){let l=0;const c=6;for(let h=0;h<c;h++)o[h]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=t.get(l);c!==void 0&&(t.delete(l),c.dispose())}function a(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:n,dispose:a}}function sv(r){const t={};function e(n){if(t[n]!==void 0)return t[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return t[n]=i,i}return{has:function(n){return e(n)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(n){const i=e(n);return i===null&&ir("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function rv(r,t,e,n){const i={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&t.remove(d.index);for(const m in d.attributes)t.remove(d.attributes[m]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);f&&(t.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,e.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,e.memory.geometries++),d}function l(u){const d=u.attributes;for(const f in d)t.update(d[f],r.ARRAY_BUFFER)}function c(u){const d=[],f=u.index,m=u.attributes.position;let _=0;if(f!==null){const y=f.array;_=f.version;for(let v=0,x=y.length;v<x;v+=3){const A=y[v+0],T=y[v+1],R=y[v+2];d.push(A,T,T,R,R,A)}}else if(m!==void 0){const y=m.array;_=m.version;for(let v=0,x=y.length/3-1;v<x;v+=3){const A=v+0,T=v+1,R=v+2;d.push(A,T,T,R,R,A)}}else return;const g=new(ad(d)?lc:oc)(d,1);g.version=_;const p=s.get(u);p&&t.remove(p),s.set(u,g)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&c(u)}else c(u);return s.get(u)}return{get:o,update:l,getWireframeAttribute:h}}function av(r,t,e){let n;function i(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,f){r.drawElements(n,f,s,d*a),e.update(f,n,1)}function c(d,f,m){m!==0&&(r.drawElementsInstanced(n,f,s,d*a,m),e.update(f,n,m))}function h(d,f,m){if(m===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,d,0,m);let g=0;for(let p=0;p<m;p++)g+=f[p];e.update(g,n,1)}function u(d,f,m,_){if(m===0)return;const g=t.get("WEBGL_multi_draw");if(g===null)for(let p=0;p<d.length;p++)c(d[p]/a,f[p],_[p]);
vendor: 17,420 bytes, lines 3737-3772
3737else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,_,0,m);let p=0;for(let y=0;y<m;y++)p+=f[y]*_[y];e.update(p,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function ov(r){const t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(e.calls++,a){case r.TRIANGLES:e.triangles+=o*(s/3);break;case r.LINES:e.lines+=o*(s/2);break;case r.LINE_STRIP:e.lines+=o*(s-1);break;case r.LINE_LOOP:e.lines+=o*s;break;case r.POINTS:e.points+=o*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a);break}}function i(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:i,update:n}}function lv(r,t,e){const n=new WeakMap,i=new te;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let b=function(){R.dispose(),n.delete(o),o.removeEventListener("dispose",b)};d!==void 0&&d.texture.dispose();const f=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],p=o.morphAttributes.normal||[],y=o.morphAttributes.color||[];let v=0;f===!0&&(v=1),m===!0&&(v=2),_===!0&&(v=3);let x=o.attributes.position.count*v,A=1;x>t.maxTextureSize&&(A=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const T=new Float32Array(x*A*4*u),R=new po(T,x,A,u);R.type=Xe,R.needsUpdate=!0;const I=v*4;for(let S=0;S<u;S++){const L=g[S],F=p[S],z=y[S],G=x*A*4*S;for(let q=0;q<L.count;q++){const W=q*I;f===!0&&(i.fromBufferAttribute(L,q),T[G+W+0]=i.x,T[G+W+1]=i.y,T[G+W+2]=i.z,T[G+W+3]=0),m===!0&&(i.fromBufferAttribute(F,q),T[G+W+4]=i.x,T[G+W+5]=i.y,T[G+W+6]=i.z,T[G+W+7]=0),_===!0&&(i.fromBufferAttribute(z,q),T[G+W+8]=i.x,T[G+W+9]=i.y,T[G+W+10]=i.z,T[G+W+11]=z.itemSize===4?i.w:1)}}d={count:u,texture:R,size:new Q(x,A)},n.set(o,d),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,e);else{let f=0;for(let _=0;_<c.length;_++)f+=c[_];const m=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",m),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",d.texture,e),l.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function cv(r,t,e,n){let i=new WeakMap;function s(l){const c=n.render.frame,h=l.geometry,u=t.get(l,h);if(i.get(u)!==c&&(t.update(u),i.set(u,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(e.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,r.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;i.get(d)!==c&&(d.update(),i.set(d,c))}return u}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),e.remove(c.instanceMatrix),c.instanceColor!==null&&e.remove(c.instanceColor)}return{update:s,dispose:a}}const pf=new _e,jh=new dc(1,1),mf=new po,gf=new mo,_f=new fr,tu=[],eu=[],nu=new Float32Array(16),iu=new Float32Array(9),su=new Float32Array(4);function bs(r,t,e){const n=r[0];if(n<=0||n>0)return r;const i=t*e;let s=tu[i];if(s===void 0&&(s=new Float32Array(i),tu[i]=s),t!==0){n.toArray(s,0);for(let a=1,o=0;a!==t;++a)o+=e,r[a].toArray(s,o)}return s}function Se(r,t){if(r.length!==t.length)return!1;for(let e=0,n=r.length;e<n;e++)if(r[e]!==t[e])return!1;return!0}function be(r,t){for(let e=0,n=t.length;e<n;e++)r[e]=t[e]}function zo(r,t){let e=eu[t];e===void 0&&(e=new Int32Array(t),eu[t]=e);for(let n=0;n!==t;++n)e[n]=r.allocateTextureUnit();return e}function hv(r,t){const e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function uv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Se(e,t))return;r.uniform2fv(this.addr,t),be(e,t)}}function dv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Se(e,t))return;r.uniform3fv(this.addr,t),be(e,t)}}function fv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Se(e,t))return;r.uniform4fv(this.addr,t),be(e,t)}}function pv(r,t){const e=this.cache,n=t.elements;if(n===void 0){if(Se(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),be(e,t)}else{if(Se(e,n))return;su.set(n),r.uniformMatrix2fv(this.addr,!1,su),be(e,n)}}function mv(r,t){const e=this.cache,n=t.elements;if(n===void 0){if(Se(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),be(e,t)}else{if(Se(e,n))return;iu.set(n),r.uniformMatrix3fv(this.addr,!1,iu),be(e,n)}}function gv(r,t){const e=this.cache,n=t.elements;if(n===void 0){if(Se(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),be(e,t)}else{if(Se(e,n))return;nu.set(n),r.uniformMatrix4fv(this.addr,!1,nu),be(e,n)}}function _v(r,t){const e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function xv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Se(e,t))return;r.uniform2iv(this.addr,t),be(e,t)}}function vv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Se(e,t))return;r.uniform3iv(this.addr,t),be(e,t)}}function yv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Se(e,t))return;r.uniform4iv(this.addr,t),be(e,t)}}function Mv(r,t){const e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function Sv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Se(e,t))return;r.uniform2uiv(this.addr,t),be(e,t)}}function bv(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Se(e,t))return;r.uniform3uiv(this.addr,t),be(e,t)}}function Ev(r,t){const e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(Se(e,t))return;r.uniform4uiv(this.addr,t),be(e,t)}}function Tv(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(jh.compareFunction=sc,s=jh):s=pf,e.setTexture2D(t||s,i)}function Av(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),e.setTexture3D(t||gf,i)}function wv(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),e.setTextureCube(t||_f,i)}function Cv(r,t,e){const n=this.cache,i=e.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),e.setTexture2DArray(t||mf,i)}function Rv(r){switch(r){case 5126:return hv;case 35664:return uv;case 35665:return dv;case 35666:return fv;case 35674:return pv;case 35675:return mv;case 35676:return gv;case 5124:case 35670:return _v;case 35667:case 35671:return xv;case 35668:case 35672:return vv;case 35669:case 35673:return yv;case 5125:return Mv;case 36294:return Sv;case 36295:return bv;case 36296:return Ev;case 35678:case 36198:case 36298:case 36306:case 35682:return Tv;case 35679:case 36299:case 36307:return Av;case 35680:case 36300:case 36308:case 36293:return wv;case 36289:case 36303:case 36311:case 36292:return Cv}}function Iv(r,t){r.uniform1fv(this.addr,t)}function Pv(r,t){const e=bs(t,this.size,2);r.uniform2fv(this.addr,e)}function Lv(r,t){const e=bs(t,this.size,3);r.uniform3fv(this.addr,e)}function Dv(r,t){const e=bs(t,this.size,4);r.uniform4fv(this.addr,e)}function Uv(r,t){const e=bs(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function Nv(r,t){const e=bs(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function Fv(r,t){const e=bs(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function Ov(r,t){r.uniform1iv(this.addr,t)}function Bv(r,t){r.uniform2iv(this.addr,t)}function zv(r,t){r.uniform3iv(this.addr,t)}function kv(r,t){r.uniform4iv(this.addr,t)}function Vv(r,t){r.uniform1uiv(this.addr,t)}function Hv(r,t){r.uniform2uiv(this.addr,t)}function Gv(r,t){r.uniform3uiv(this.addr,t)}function Wv(r,t){r.uniform4uiv(this.addr,t)}function Xv(r,t,e){const n=this.cache,i=t.length,s=zo(e,i);Se(n,s)||(r.uniform1iv(this.addr,s),be(n,s));for(let a=0;a!==i;++a)e.setTexture2D(t[a]||pf,s[a])}function qv(r,t,e){const n=this.cache,i=t.length,s=zo(e,i);Se(n,s)||(r.uniform1iv(this.addr,s),be(n,s));for(let a=0;a!==i;++a)e.setTexture3D(t[a]||gf,s[a])}function Yv(r,t,e){const n=this.cache,i=t.length,s=zo(e,i);Se(n,s)||(r.uniform1iv(this.addr,s),be(n,s));for(let a=0;a!==i;++a)e.setTextureCube(t[a]||_f,s[a])}function Zv(r,t,e){const n=this.cache,i=t.length,s=zo(e,i);Se(n,s)||(r.uniform1iv(this.addr,s),be(n,s));for(let a=0;a!==i;++a)e.setTexture2DArray(t[a]||mf,s[a])}function Jv(r){switch(r){case 5126:return Iv;case 35664:return Pv;case 35665:return Lv;case 35666:return Dv;case 35674:return Uv;case 35675:return Nv;case 35676:return Fv;case 5124:case 35670:return Ov;case 35667:case 35671:return Bv;case 35668:case 35672:return zv;case 35669:case 35673:return kv;case 5125:return Vv;case 36294:return Hv;case 36295:return Gv;case 36296:return Wv;case 35678:case 36198:case 36298:case 36306:case 35682:return Xv;case 35679:case 36299:case 36307:return qv;case 35680:case 36300:case 36308:case 36293:return Yv;case 36289:case 36303:case 36311:case 36292:return Zv}}class $v{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=Rv(e.type)}}class Kv{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=Jv(e.type)}}class Qv{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(t,e[o.id],n)}}}const Pl=/(\w+)(\])?(\[|\.)?/g;function ru(r,t){r.seq.push(t),r.map[t.id]=t}function jv(r,t,e){const n=r.name,i=n.length;for(Pl.lastIndex=0;;){const s=Pl.exec(n),a=Pl.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){ru(e,c===void 0?new $v(o,r,t):new Kv(o,r,t));break}else{let u=e.map[o];u===void 0&&(u=new Qv(o),ru(e,u)),e=u}}}class ma{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=t.getActiveUniform(e,i),a=t.getUniformLocation(e,s.name);jv(s,a,this)}}setValue(t,e,n,i){const s=this.map[e];s!==void 0&&s.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];i!==void 0&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let s=0,a=e.length;s!==a;++s){const o=e[s],l=n[o.id];l.needsUpdate!==!1&&o.setValue(t,l.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,s=t.length;i!==s;++i){const a=t[i];a.id in e&&n.push(a)}return n}}function au(r,t,e){const n=r.createShader(t);return r.shaderSource(n,e),r.compileShader(n),n}const ty=37297;let ey=0;function ny(r,t){const e=r.split(`
3738`),n=[],i=Math.max(t-6,0),s=Math.min(t+6,e.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===t?">":" "} ${o}: ${e[a]}`)}return n.join(`
3739`)}const ou=new Ht;function iy(r){Kt._getMatrix(ou,Kt.workingColorSpace,r);const t=`mat3( ${ou.elements.map(e=>e.toFixed(4))} )`;switch(Kt.getTransfer(r)){case tr:return[t,"LinearTransferOETF"];case re:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[t,"LinearTransferOETF"]}}function lu(r,t,e){const n=r.getShaderParameter(t,r.COMPILE_STATUS),s=(r.getShaderInfoLog(t)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return e.toUpperCase()+`
3740
3741`+s+`
3742
3743`+ny(r.getShaderSource(t),o)}else return s}function sy(r,t){const e=iy(t);return[`vec4 ${r}( vec4 value ) {`,`	return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
3744`)}function ry(r,t){let e;switch(t){case zu:e="Linear";break;case ku:e="Reinhard";break;case Vu:e="Cineon";break;case Hu:e="ACESFilmic";break;case Wu:e="AgX";break;case Xu:e="Neutral";break;case Gu:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const da=new C;function ay(){Kt.getLuminanceCoefficients(da);const r=da.x.toFixed(4),t=da.y.toFixed(4),e=da.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${t}, ${e} );`,"	return dot( weights, rgb );","}"].join(`
3745`)}function oy(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(zs).join(`
3746`)}function ly(r){const t=[];for(const e in r){const n=r[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
3747`)}function cy(r,t){const e={},n=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(t,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),e[a]={type:s.type,location:r.getAttribLocation(t,a),locationSize:o}}return e}function zs(r){return r!==""}function cu(r,t){const e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function hu(r,t){return r.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const hy=/^[ \t]*#include +<([\w\d./]+)>/gm;function Yl(r){return r.replace(hy,dy)}const uy=new Map;function dy(r,t){let e=Yt[t];if(e===void 0){const n=uy.get(t);if(n!==void 0)e=Yt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return Yl(e)}const fy=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function uu(r){return r.replace(fy,py)}function py(r,t,e,n){let i="";for(let s=parseInt(t);s<parseInt(e);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function du(r){let t=`precision ${r.precision} float;
3748	precision ${r.precision} int;
3749	precision ${r.precision} sampler2D;
3750	precision ${r.precision} samplerCube;
3751	precision ${r.precision} sampler3D;
3752	precision ${r.precision} sampler2DArray;
3753	precision ${r.precision} sampler2DShadow;
3754	precision ${r.precision} samplerCubeShadow;
3755	precision ${r.precision} sampler2DArrayShadow;
3756	precision ${r.precision} isampler2D;
3757	precision ${r.precision} isampler3D;
3758	precision ${r.precision} isamplerCube;
3759	precision ${r.precision} isampler2DArray;
3760	precision ${r.precision} usampler2D;
3761	precision ${r.precision} usampler3D;
3762	precision ${r.precision} usamplerCube;
3763	precision ${r.precision} usampler2DArray;
3764	`;return r.precision==="highp"?t+=`
3765#define HIGH_PRECISION`:r.precision==="mediump"?t+=`
3766#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`
3767#define LOW_PRECISION`),t}function my(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Zl?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===xu?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===xn&&(t="SHADOWMAP_TYPE_VSM"),t}function gy(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case zn:case Qn:t="ENVMAP_TYPE_CUBE";break;case xs:t="ENVMAP_TYPE_CUBE_UV";break}return t}function _y(r){let t="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Qn:t="ENVMAP_MODE_REFRACTION";break}return t}function xy(r){let t="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case ur:t="ENVMAP_BLENDING_MULTIPLY";break;case Ou:t="ENVMAP_BLENDING_MIX";break;case Bu:t="ENVMAP_BLENDING_ADD";break}return t}function vy(r){const t=r.envMapCubeUVHeight;if(t===null)return null;const e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:n,maxMip:e}}function yy(r,t,e,n){const i=r.getContext(),s=e.defines;let a=e.vertexShader,o=e.fragmentShader;const l=my(e),c=gy(e),h=_y(e),u=xy(e),d=vy(e),f=oy(e),m=ly(s),_=i.createProgram();let g,p,y=e.glslVersion?"#version "+e.glslVersion+`
3768`:"";e.isRawShaderMaterial?(g=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(zs).join(`
3769`),g.length>0&&(g+=`
3770`),p=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m].filter(zs).join(`
3771`),p.length>0&&(p+=`
3772`)):(g=[du(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.extensionCl
vendor: 6,474 bytes, lines 3772-3774
3772ipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+h:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","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",`
3773`].filter(zs).join(`
3774`),p=[du(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,m,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+c:"",e.envMap?"#define "+h:"",e.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IR
3774IDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+l:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Fn?"#define TONE_MAPPING":"",e.toneMapping!==Fn?Yt.tonemapping_pars_fragment:"",e.toneMapping!==Fn?ry("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Yt.colorspace_pars_fragment,sy("linearToOutputTexel",e.outputColorSpace),ay(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
3775`].filter(zs).join(`
3776`)),a=Yl(a),a=cu(a,e),a=hu(a,e),o=Yl(o),o=cu(o,e),o=hu(o,e),a=uu(a),o=uu(o),e.isRawShaderMaterial!==!0&&(y=`#version 300 es
3777`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3778`)+`
3779`+g,p=["#define varying in",e.glslVersion===Bl?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===Bl?"":"#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(`
3780`)+`
3781`+p);const v=y+g+a,x=y+p+o,A=au(i,i.VERTEX_SHADER,v),T=au(i,i.FRAGMENT_SHADER,x);i.attachShader(_,A),i.attachShader(_,T),e.index0AttributeName!==void 0?i.bindAttribLocation(_,0,e.index0AttributeName):e.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function R(L){if(r.debug.checkShaderErrors){const F=i.getProgramInfoLog(_)||"",z=i.getShaderInfoLog(A)||"",G=i.getShaderInfoLog(T)||"",q=F.trim(),W=z.trim(),nt=G.trim();let H=!0,ut=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(H=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,A,T);else{const _t=lu(i,A,"vertex"),St=lu(i,T,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3782
3783Material Name: `+L.name+`
3784Material Type: `+L.type+`
3785
3786Program Info Log: `+q+`
3787`+_t+`
3788`+St)}else q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",q):(W===""||nt==="")&&(ut=!1);ut&&(L.diagnostics={runnable:H,programLog:q,vertexShader:{log:W,prefix:g},fragmentShader:{log:nt,prefix:p}})}i.deleteShader(A),i.deleteShader(T),I=new ma(i,_),b=cy(i,_)}let I;this.getUniforms=function(){return I===void 0&&R(this),I};let b;this.getAttributes=function(){return b===void 0&&R(this),b};let S=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=i.getProgramParameter(_,ty)),S},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=ey++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=T,this}let My=0;class Sy{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return n===void 0&&(n=new by(t),e.set(t,n)),n}}class by{constructor(t){this.id=My++,this.code=t,this.usedTimes=0}}function Ey(r,t,e,n,i,s,a){const o=new go,l=new Sy,c=new Set,h=[],u=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.precision;const m={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 _(b){return c.add(b),b===0?"uv":`uv${b}`}function g(b,S,L,F,z){const G=F.fog,q=z.geometry,W=b.isMeshStandardMaterial?F.environment:null,nt=(b.isMeshStandardMaterial?e:t).get(b.envMap||W),H=nt&&nt.mapping===xs?nt.image.height:null,ut=m[b.type];b.precision!==null&&(f=i.getMaxPrecision(b.precision),f!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",f,"instead."));const _t=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,St=_t!==void 0?_t.length:0;let Gt=0;q.morphAttributes.position!==void 0&&(Gt=1),q.morphAttributes.normal!==void 0&&(Gt=2),q.morphAttributes.color!==void 0&&(Gt=3);let $t,se,Qt,Y;if(ut){const ie=hn[ut];$t=ie.vertexShader,se=ie.fragmentShader}else $t=b.vertexShader,se=b.fragmentShader,l.update(b),Qt=l.getVertexShaderID(b),Y=l.getFragmentShaderID(b);const et=r.getRenderTarget(),yt=r.state.buffers.depth.getReversed(),Pt=z.isInstancedMesh===!0,Tt=z.isBatchedMesh===!0,Zt=!!b.map,ce=!!b.matcap,P=!!nt,tt=!!b.aoMap,$=!!b.lightMap,J=!!b.bumpMap,Z=!!b.normalMap,ct=!!b.displacementMap,it=!!b.emissiveMap,ht=!!b.metalnessMap,kt=!!b.roughnessMap,zt=b.anisotropy>0,w=b.clearcoat>0,M=b.dispersion>0,O=b.iridescence>0,V=b.sheen>0,j=b.transmission>0,X=zt&&!!b.anisotropyMap,Rt=w&&!!b.clearcoatMap,lt=w&&!!b.clearcoatNormalMap,At=w&&!!b.clearcoatRoughnessMap,wt=O&&!!b.iridescenceMap,st=O&&!!b.iridescenceThicknessMap,gt=V&&!!b.sheenColorMap,Ft=V&&!!b.sheenRoughnessMap,It=!!b.specularMap,pt=!!b.specularColorMap,qt=!!b.specularIntensityMap,D=j&&!!b.transmissionMap,ot=j&&!!b.thicknessMap,dt=!!b.gradientMap,bt=!!b.alphaMap,rt=b.alphaTest>0,K=!!b.alphaHash,Ct=!!b.extensions;let Vt=Fn;b.toneMapped&&(et===null||et.isXRRenderTarget===!0)&&(Vt=r.toneMapping);const he={shaderID:ut,shaderType:b.type,shaderName:b.name,vertexShader:$t,fragmentShader:se,defines:b.defines,customVertexShaderID:Qt,customFragmentShaderID:Y,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:f,batching:Tt,batchingColor:Tt&&z._colorsTexture!==null,instancing:Pt,instancingColor:Pt&&z.instanceColor!==null,instancingMorph:Pt&&z.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:et===null?r.outputColorSpace:et.isXRRenderTarget===!0?et.texture.colorSpace:Ii,alphaToCoverage:!!b.alphaToCoverage,map:Zt,matcap:ce,envMap:P,envMapMode:P&&nt.mapping,envMapCubeUVHeight:H,aoMap:tt,lightMap:$,bumpMap:J,normalMap:Z,displacementMap:d&&ct,emissiveMap:it,normalMapObjectSpace:Z&&b.normalMapType===Qu,normalMapTangentSpace:Z&&b.normalMapType===ti,metalnessMap:ht,roughnessMap:kt,anisotropy:zt,anisotropyMap:X,clearcoat:w,clearcoatMap:Rt,clearcoatNormalMap:lt,clearcoatRoughnessMap:At,dis
vendor: 4,972 bytes, line 3788
3788persion:M,iridescence:O,iridescenceMap:wt,iridescenceThicknessMap:st,sheen:V,sheenColorMap:gt,sheenRoughnessMap:Ft,specularMap:It,specularColorMap:pt,specularIntensityMap:qt,transmission:j,transmissionMap:D,thicknessMap:ot,gradientMap:dt,opaque:b.transparent===!1&&b.blending===Ai&&b.alphaToCoverage===!1,alphaMap:bt,alphaTest:rt,alphaHash:K,combine:b.combine,mapUv:Zt&&_(b.map.channel),aoMapUv:tt&&_(b.aoMap.channel),lightMapUv:$&&_(b.lightMap.channel),bumpMapUv:J&&_(b.bumpMap.channel),normalMapUv:Z&&_(b.normalMap.channel),displacementMapUv:ct&&_(b.displacementMap.channel),emissiveMapUv:it&&_(b.emissiveMap.channel),metalnessMapUv:ht&&_(b.metalnessMap.channel),roughnessMapUv:kt&&_(b.roughnessMap.channel),anisotropyMapUv:X&&_(b.anisotropyMap.channel),clearcoatMapUv:Rt&&_(b.clearcoatMap.channel),clearcoatNormalMapUv:lt&&_(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:At&&_(b.clearcoatRoughnessMap.channel),iridescenceMapUv:wt&&_(b.iridescenceMap.channel),iridescenceThicknessMapUv:st&&_(b.iridescenceThicknessMap.channel),sheenColorMapUv:gt&&_(b.sheenColorMap.channel),sheenRoughnessMapUv:Ft&&_(b.sheenRoughnessMap.channel),specularMapUv:It&&_(b.specularMap.channel),specularColorMapUv:pt&&_(b.specularColorMap.channel),specularIntensityMapUv:qt&&_(b.specularIntensityMap.channel),transmissionMapUv:D&&_(b.transmissionMap.channel),thicknessMapUv:ot&&_(b.thicknessMap.channel),alphaMapUv:bt&&_(b.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(Z||zt),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!q.attributes.uv&&(Zt||bt),fog:!!G,useFog:b.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:b.flatShading===!0&&b.wireframe===!1,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:yt,skinning:z.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:St,morphTextureStride:Gt,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:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:Vt,decodeVideoTexture:Zt&&b.map.isVideoTexture===!0&&Kt.getTransfer(b.map.colorSpace)===re,decodeVideoTextureEmissive:it&&b.emissiveMap.isVideoTexture===!0&&Kt.getTransfer(b.emissiveMap.colorSpace)===re,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===vn,flipSided:b.side===Be,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionClipCullDistance:Ct&&b.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ct&&b.extensions.multiDraw===!0||Tt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:b.customProgramCacheKey()};return he.vertexUv1s=c.has(1),he.vertexUv2s=c.has(2),he.vertexUv3s=c.has(3),c.clear(),he}function p(b){const S=[];if(b.shaderID?S.push(b.shaderID):(S.push(b.customVertexShaderID),S.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)S.push(L),S.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(y(S,b),v(S,b),S.push(r.outputColorSpace)),S.push(b.customProgramCacheKey),S.join()}function y(b,S){b.push(S.precision),b.push(S.outputColorSpace),b.push(S.envMapMode),b.push(S.envMapCubeUVHeight),b.push(S.mapUv),b.push(S.alphaMapUv),b.push(S.lightMapUv),b.push(S.aoMapUv),b.push(S.bumpMapUv),b.push(S.normalMapUv),b.push(S.displacementMapUv),b.push(S.emissiveMapUv),b.push(S.metalnessMapUv),b.push(S.roughnessMapUv),b.push(S.anisotropyMapUv),b.push(S.clearcoatMapUv),b.push(S.clearcoatNormalMapUv),b.push(S.clearcoatRoughnessMapUv),b.push(S.iridescenceMapUv),b.push(S.iridescenceThicknessMapUv),b.push(S.sheenColorMapUv),b.push(S.sheenRoughnessMapUv),b.push(S.specularMapUv),b.push(S.specularColorMapUv),b.push(S.specularIntensityMapUv),b.push(S.transmissionMapUv),b.push(S.thicknessMapUv),b.push(S.combine),b.push(S.fogExp2),b.push(S.sizeAttenuation),b.push(S.morphTargetsCount),b.push(S.morphAttributeCount),b.push(S.numDirLights),b.push(S.numPointLights),b.push(S.numSpotLights),b.push(S.numSpotLightMaps),b.push(S.numHemiLights),b.push(S.numRectAreaLights),b.push(S.numDirLightShadows),b.push(S.numPointLightShadows),b.push(S.numSpotLightShadows),b.push(S.numSpotLightShadowsWithMaps),b.push(S.numLightProbes),b.push(S.shadowMapType),b.push(S.toneMapping),b.push(S.numClippingPlanes),b.pu
vendor: 14,043 bytes, lines 3788-3816
3788sh(S.numClipIntersection),b.push(S.depthPacking)}function v(b,S){o.disableAll(),S.supportsVertexTextures&&o.enable(0),S.instancing&&o.enable(1),S.instancingColor&&o.enable(2),S.instancingMorph&&o.enable(3),S.matcap&&o.enable(4),S.envMap&&o.enable(5),S.normalMapObjectSpace&&o.enable(6),S.normalMapTangentSpace&&o.enable(7),S.clearcoat&&o.enable(8),S.iridescence&&o.enable(9),S.alphaTest&&o.enable(10),S.vertexColors&&o.enable(11),S.vertexAlphas&&o.enable(12),S.vertexUv1s&&o.enable(13),S.vertexUv2s&&o.enable(14),S.vertexUv3s&&o.enable(15),S.vertexTangents&&o.enable(16),S.anisotropy&&o.enable(17),S.alphaHash&&o.enable(18),S.batching&&o.enable(19),S.dispersion&&o.enable(20),S.batchingColor&&o.enable(21),S.gradientMap&&o.enable(22),b.push(o.mask),o.disableAll(),S.fog&&o.enable(0),S.useFog&&o.enable(1),S.flatShading&&o.enable(2),S.logarithmicDepthBuffer&&o.enable(3),S.reversedDepthBuffer&&o.enable(4),S.skinning&&o.enable(5),S.morphTargets&&o.enable(6),S.morphNormals&&o.enable(7),S.morphColors&&o.enable(8),S.premultipliedAlpha&&o.enable(9),S.shadowMapEnabled&&o.enable(10),S.doubleSided&&o.enable(11),S.flipSided&&o.enable(12),S.useDepthPacking&&o.enable(13),S.dithering&&o.enable(14),S.transmission&&o.enable(15),S.sheen&&o.enable(16),S.opaque&&o.enable(17),S.pointsUvs&&o.enable(18),S.decodeVideoTexture&&o.enable(19),S.decodeVideoTextureEmissive&&o.enable(20),S.alphaToCoverage&&o.enable(21),b.push(o.mask)}function x(b){const S=m[b.type];let L;if(S){const F=hn[S];L=ud.clone(F.uniforms)}else L=b.uniforms;return L}function A(b,S){let L;for(let F=0,z=h.length;F<z;F++){const G=h[F];if(G.cacheKey===S){L=G,++L.usedTimes;break}}return L===void 0&&(L=new yy(r,S,b,s),h.push(L)),L}function T(b){if(--b.usedTimes===0){const S=h.indexOf(b);h[S]=h[h.length-1],h.pop(),b.destroy()}}function R(b){l.remove(b)}function I(){l.dispose()}return{getParameters:g,getProgramCacheKey:p,getUniforms:x,acquireProgram:A,releaseProgram:T,releaseShaderCache:R,programs:h,dispose:I}}function Ty(){let r=new WeakMap;function t(a){return r.has(a)}function e(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:t,get:e,remove:n,update:i,dispose:s}}function Ay(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function fu(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function pu(){const r=[];let t=0;const e=[],n=[],i=[];function s(){t=0,e.length=0,n.length=0,i.length=0}function a(u,d,f,m,_,g){let p=r[t];return p===void 0?(p={id:u.id,object:u,geometry:d,material:f,groupOrder:m,renderOrder:u.renderOrder,z:_,group:g},r[t]=p):(p.id=u.id,p.object=u,p.geometry=d,p.material=f,p.groupOrder=m,p.renderOrder=u.renderOrder,p.z=_,p.group=g),t++,p}function o(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.push(p):f.transparent===!0?i.push(p):e.push(p)}function l(u,d,f,m,_,g){const p=a(u,d,f,m,_,g);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):e.unshift(p)}function c(u,d){e.length>1&&e.sort(u||Ay),n.length>1&&n.sort(d||fu),i.length>1&&i.sort(d||fu)}function h(){for(let u=t,d=r.length;u<d;u++){const f=r[u];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:e,transmissive:n,transparent:i,init:s,push:o,unshift:l,finish:h,sort:c}}function wy(){let r=new WeakMap;function t(n,i){const s=r.get(n);let a;return s===void 0?(a=new pu,r.set(n,[a])):i>=s.length?(a=new pu,s.push(a)):a=s[i],a}function e(){r=new WeakMap}return{get:t,dispose:e}}function Cy(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new C,color:new xt};break;case"SpotLight":e={position:new C,direction:new C,color:new xt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new C,color:new xt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new C,skyColor:new xt,groundColor:new xt};break;case"RectAreaLight":e={color:new xt,position:new C,halfWidth:new C,halfHeight:new C};break}return r[t.id]=e,e}}}function Ry(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Q,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}let Iy=0;function Py(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function Ly(r){const t=new Cy,e=Ry(),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<9;c++)n.probe.push(new C);const i=new C,s=new Ot,a=new Ot;function o(c){let h=0,u=0,d=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,m=0,_=0,g=0,p=0,y=0,v=0,x=0,A=0,T=0,R=0;c.sort(Py);for(let b=0,S=c.length;b<S;b++){const L=c[b],F=L.color,z=L.intensity,G=L.distance,q=L.shadow&&L.shadow.map?L.shadow.map.texture:null;if(L.isAmbientLight)h+=F.r*z,u+=F.g*z,d+=F.b*z;else if(L.isLightProbe){for(let W=0;W<9;W++)n.probe[W].addScaledVector(L.sh.coefficients[W],z);R++}else if(L.isDirectionalLight){const W=t.get(L);if(W.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const nt=L.shadow,H=e.get(L);H.shadowIntensity=nt.intensity,H.shadowBias=nt.bias,H.shadowNormalBias=nt.normalBias,H.shadowRadius=nt.radius,H.shadowMapSize=nt.mapSize,n.directionalShadow[f]=H,n.directionalShadowMap[f]=q,n.directionalShadowMatrix[f]=L.shadow.matrix,y++}n.directional[f]=W,f++}else if(L.isSpotLight){const W=t.get(L);W.position.setFromMatrixPosition(L.matrixWorld),W.color.copy(F).multiplyScalar(z),W.distance=G,W.coneCos=Math.cos(L.angle),W.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),W.decay=L.decay,n.spot[_]=W;const nt=L.shadow;if(L.map&&(n.spotLightMap[A]=L.map,A++,nt.updateMatrices(L),L.castShadow&&T++),n.spotLightMatrix[_]=nt.matrix,L.castShadow){const H=e.get(L);H.shadowIntensity=nt.intensity,H.shadowBias=nt.bias,H.shadowNormalBias=nt.normalBias,H.shadowRadius=nt.radius,H.shadowMapSize=nt.mapSize,n.spotShadow[_]=H,n.spotShadowMap[_]=q,x++}_++}else if(L.isRectAreaLight){const W=t.get(L);W.color.copy(F).multiplyScalar(z),W.halfWidth.set(L.width*.5,0,0),W.halfHeight.set(0,L.height*.5,0),n.rectArea[g]=W,g++}else if(L.isPointLight){const W=t.get(L);if(W.color.copy(L.color).multiplyScalar(L.intensity),W.distance=L.distance,W.decay=L.decay,L.castShadow){const nt=L.shadow,H=e.get(L);H.shadowIntensity=nt.intensity,H.shadowBias=nt.bias,H.shadowNormalBias=nt.normalBias,H.shadowRadius=nt.radius,H.shadowMapSize=nt.mapSize,H.shadowCameraNear=nt.camera.near,H.shadowCameraFar=nt.camera.far,n.pointShadow[m]=H,n.pointShadowMap[m]=q,n.pointShadowMatrix[m]=L.shadow.matrix,v++}n.point[m]=W,m++}else if(L.isHemisphereLight){const W=t.get(L);W.skyColor.copy(L.color).multiplyScalar(z),W.groundColor.copy(L.groundColor).multiplyScalar(z),n.hemi[p]=W,p++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=ft.LTC_FLOAT_1,n.rectAreaLTC2=ft.LTC_FLOAT_2):(n.rectAreaLTC1=ft.LTC_HALF_1,n.rectAreaLTC2=ft.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const I=n.hash;(I.directionalLength!==f||I.pointLength!==m||I.spotLength!==_||I.rectAreaLength!==g||I.hemiLength!==p||I.numDirectionalShadows!==y||I.numPointShadows!==v||I.numSpotShadows!==x||I.numSpotMaps!==A||I.numLightProbes!==R)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=m,n.hemi.length=p,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=v,n.pointShadowMap.length=v,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=v,n.spotLightMatrix.length=x+A-T,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=T,n.numLightProbes=R,I.directionalLength=f,I.pointLength=m,I.spotLength=_,I.rectAreaLength=g,I.hemiLength=p,I.numDirectionalShadows=y,I.numPointShadows=v,I.numSpotShadows=x,I.numSpotMaps=A,I.numLightProbes=R,n.version=Iy++)}function l(c,h){let u=0,d=0,f=0,m=0,_=0;const g=h.matrixWorldInverse;for(let p=0,y=c.length;p<y;p++){const v=c[p];if(v.isDirectionalLight){const x=n.directional[u];x.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),u++}else if(v.isSpotLight){const x=n.spot[f];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),x.direction.setFromMatrixPosition(v.matrixWorld),i.setFromMatrixPosition(v.target.matrixWorld),x.direction.sub(i),x.direction.transformDirection(g),f++}else if(v.isRectAreaLight){const x=n.rectArea[m];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),a.identity(),s.copy(v.matrixWorld),s.premultiply(g),a.extractRotation(s),x.halfWidth.set(v.width*.5,0,0),x.halfHeight.set(0,v.height*.5,0),x.halfWidth.applyMatrix4(a),x.halfHeight.applyMatrix4(a),m++}else if(v.isPointLight){const x=n.point[d];x.position.setFromMatrixPosition(v.matrixWorld),x.position.applyMatrix4(g),d++}else if(v.isHemisphereLight){const x=n.hemi[_];x.direction.setFromMatrixPosition(v.matrixWorld),x.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function mu(r){const t=new Ly(r),e=[],n=[];function i(h){c.camera=h,e.length=0,n.length=0}function s(h){e.push(h)}function a(h){n.push(h)}function o(){t.setup(e)}function l(h){t.setupView(e,h)}const c={lightsArray:e,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function Dy(r){let t=new WeakMap;function e(i,s=0){const a=t.get(i);let o;return a===void 0?(o=new mu(r),t.set(i,[o])):s>=a.length?(o=new mu(r),a.push(o)):o=a[s],o}function n(){t=new WeakMap}return{get:e,dispose:n}}const Uy=`void main() {
3789	gl_Position = vec4( position, 1.0 );
3790}`,Ny=`uniform sampler2D shadow_pass;
3791uniform vec2 resolution;
3792uniform float radius;
3793#include <packing>
3794void main() {
3795	const float samples = float( VSM_SAMPLES );
3796	float mean = 0.0;
3797	float squared_mean = 0.0;
3798	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3799	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3800	for ( float i = 0.0; i < samples; i ++ ) {
3801		float uvOffset = uvStart + i * uvStride;
3802		#ifdef HORIZONTAL_PASS
3803			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3804			mean += distribution.x;
3805			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3806		#else
3807			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3808			mean += depth;
3809			squared_mean += depth * depth;
3810		#endif
3811	}
3812	mean = mean / samples;
3813	squared_mean = squared_mean / samples;
3814	float std_dev = sqrt( squared_mean - mean * mean );
3815	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3816}`;function Fy(r,t,e){let n=new Ms;const i=new Q,s=new Q,a=new te,o=new Mc({depthPacking:Ku}),l=new Sc,c={},h=e.maxTextureSize,u={[Bn]:Be,[Be]:Bn,[vn]:vn},d=new fn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Q},radius:{value:4}},vertexShader:Uy,fragmentShader:Ny}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new Xt;m.setAttribute("position",new oe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new ye(m,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Zl;let p=this.type;this.render=function(T,R,I){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||T.length===0)return;const b=r.getRenderTarget(),S=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),F=r.state;F.setBlending(Nn),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const z=p!==xn&&this.type===xn,G=p===xn&&this.type!==xn;for(let q=0,W=T.length;q<W;q++){const nt=T[q],H=nt.shadow;if(H===void 0){console.warn("THREE.WebGLShadowMap:",nt,"has no shadow.");continue}if(H.autoUpdate===!1&&H.needsUpdate===!1)continue;i.copy(H.mapSize);const ut=H.getFrameExtents();if(i.multiply(ut),s.copy(H.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/ut.x),i.x=s.x*ut.x,H.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/ut.y),i.y=s.y*ut.y,H.mapSize.y=s.y)),H.map===null||z===!0||G===!0){const St=this.type!==xn?{minFilter:Ae,magFilter:Ae}:{};H.map!==null&&H.map.dispose(),H.map=new bn(i.x,i.y,St),H.map.texture.name=nt.name+".shadowMap",H.camera.updateProjectionMatrix()}r.setRenderTarget(H.map),r.clear();const _t=H.getViewportCount();for(let St=0;St<_t;St++){const Gt=H.getViewport(St);a.set(s.x*Gt.x,s.y*Gt.y,s.x*Gt.z,s.y*Gt.w),F.viewport(a),H.updateMatrices(nt,St),n=H.getFrustum(),x(R,I,H.camera,nt,this.type)}H.isPointLightShadow!==!0&&this.type===xn&&y(H,I),H.needsUpdate=!1}p=this.type,g.needsUpdate=!1,r.setRenderTarget(b,S,L)};function y(T,R){const I=t.update(_);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new bn(i.x,i.y)),d.uniforms.shadow_pass.value=T.map.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radiu
vendor: 5,706 bytes, line 3816
3816s,r.setRenderTarget(T.mapPass),r.clear(),r.renderBufferDirect(R,null,I,d,_,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,r.setRenderTarget(T.map),r.clear(),r.renderBufferDirect(R,null,I,f,_,null)}function v(T,R,I,b){let S=null;const L=I.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(L!==void 0)S=L;else if(S=I.isPointLight===!0?l:o,r.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const F=S.uuid,z=R.uuid;let G=c[F];G===void 0&&(G={},c[F]=G);let q=G[z];q===void 0&&(q=S.clone(),G[z]=q,R.addEventListener("dispose",A)),S=q}if(S.visible=R.visible,S.wireframe=R.wireframe,b===xn?S.side=R.shadowSide!==null?R.shadowSide:R.side:S.side=R.shadowSide!==null?R.shadowSide:u[R.side],S.alphaMap=R.alphaMap,S.alphaTest=R.alphaToCoverage===!0?.5: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,I.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const F=r.properties.get(S);F.light=I}return S}function x(T,R,I,b,S){if(T.visible===!1)return;if(T.layers.test(R.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&S===xn)&&(!T.frustumCulled||n.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,T.matrixWorld);const z=t.update(T),G=T.material;if(Array.isArray(G)){const q=z.groups;for(let W=0,nt=q.length;W<nt;W++){const H=q[W],ut=G[H.materialIndex];if(ut&&ut.visible){const _t=v(T,ut,b,S);T.onBeforeShadow(r,T,R,I,z,_t,H),r.renderBufferDirect(I,null,z,_t,T,H),T.onAfterShadow(r,T,R,I,z,_t,H)}}}else if(G.visible){const q=v(T,G,b,S);T.onBeforeShadow(r,T,R,I,z,q,null),r.renderBufferDirect(I,null,z,q,T,null),T.onAfterShadow(r,T,R,I,z,q,null)}}const F=T.children;for(let z=0,G=F.length;z<G;z++)x(F[z],R,I,b,S)}function A(T){T.target.removeEventListener("dispose",A);for(const I in c){const b=c[I],S=T.target.uuid;S in b&&(b[S].dispose(),delete b[S])}}}const Oy={[xa]:va,[ya]:ba,[Ma]:Ea,[Ri]:Sa,[va]:xa,[ba]:ya,[Ea]:Ma,[Sa]:Ri};function By(r,t){function e(){let D=!1;const ot=new te;let dt=null;const bt=new te(0,0,0,0);return{setMask:function(rt){dt!==rt&&!D&&(r.colorMask(rt,rt,rt,rt),dt=rt)},setLocked:function(rt){D=rt},setClear:function(rt,K,Ct,Vt,he){he===!0&&(rt*=Vt,K*=Vt,Ct*=Vt),ot.set(rt,K,Ct,Vt),bt.equals(ot)===!1&&(r.clearColor(rt,K,Ct,Vt),bt.copy(ot))},reset:function(){D=!1,dt=null,bt.set(-1,0,0,0)}}}function n(){let D=!1,ot=!1,dt=null,bt=null,rt=null;return{setReversed:function(K){if(ot!==K){const Ct=t.get("EXT_clip_control");K?Ct.clipControlEXT(Ct.LOWER_LEFT_EXT,Ct.ZERO_TO_ONE_EXT):Ct.clipControlEXT(Ct.LOWER_LEFT_EXT,Ct.NEGATIVE_ONE_TO_ONE_EXT),ot=K;const Vt=rt;rt=null,this.setClear(Vt)}},getReversed:function(){return ot},setTest:function(K){K?et(r.DEPTH_TEST):yt(r.DEPTH_TEST)},setMask:function(K){dt!==K&&!D&&(r.depthMask(K),dt=K)},setFunc:function(K){if(ot&&(K=Oy[K]),bt!==K){switch(K){case xa:r.depthFunc(r.NEVER);break;case va:r.depthFunc(r.ALWAYS);break;case ya:r.depthFunc(r.LESS);break;case Ri:r.depthFunc(r.LEQUAL);break;case Ma:r.depthFunc(r.EQUAL);break;case Sa:r.depthFunc(r.GEQUAL);break;case ba:r.depthFunc(r.GREATER);break;case Ea:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}bt=K}},setLocked:function(K){D=K},setClear:function(K){rt!==K&&(ot&&(K=1-K),r.clearDepth(K),rt=K)},reset:function(){D=!1,dt=null,bt=null,rt=null,ot=!1}}}function i(){let D=!1,ot=null,dt=null,bt=null,rt=null,K=null,Ct=null,Vt=null,he=null;return{setTest:function(ie){D||(ie?et(r.STENCIL_TEST):yt(r.STENCIL_TEST))},setMask:function(ie){ot!==ie&&!D&&(r.stencilMask(ie),ot=ie)},setFunc:function(ie,An,mn){(dt!==ie||bt!==An||rt!==mn)&&(r.stencilFunc(ie,An,mn),dt=ie,bt=An,rt=mn)},setOp:function(ie,An,mn){(K!==ie||Ct!==An||Vt!==mn)&&(r.stencilOp(ie,An,mn),K=ie,Ct=An,Vt=mn)},setLocked:function(ie){D=ie},setClear:function(ie){he!==ie&&(r.clearStencil(ie),he=ie)},reset:function(){D=!1,ot=null,dt=null,bt=null,rt=null,K=null,Ct=null,Vt=null,he=null}}}const s=new e,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let h={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,y=null,v=null,x=null,A=null,T=null,R=new xt(0,0,0),I=0,b=!1,S=null,L=null,F=null,z=null,G=null;const q=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,nt=0;const H=r.getParameter(r.VERSION);H.indexOf("WebGL")!==-1?(nt=parseFloat(/^WebGL (\d)/.exec(H)[1]),W=nt>=1):H.indexOf("OpenGL ES")!==-1&&(nt=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),W=nt>=2);let ut=null,_t={};const St=r.getParameter(r.SCISSOR_BOX),Gt=r.getParameter(r.VIEWPORT),$t=new te().fromArray(St),se=new te().fromArray(Gt);function Qt(D,ot,dt,bt){const rt=new Uint8Array(4),K=r.createTexture();r.bindTexture(D,K),r.texParameteri(D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(D,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ct=0;Ct<dt;Ct++)D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY?r.texImage3D(ot,0,r.RGBA,1,1,bt,0,r.RGBA,r.UNSIGNED_BYTE,rt):r.texImage2D(ot+Ct,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,rt);return K}const Y={};Y[r.TEXTURE_2D]=Qt(r.TEXTURE_2D,r.TEXTURE_2D,1),Y[r.TEXTURE_CUBE_MAP]=Qt(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),Y[r.TEXTURE_2D_ARRAY]=Qt(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Y[r.TEXTURE_3D]=Qt(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),et(r.DEPTH_TEST),a.setFunc(Ri),J(!1),Z(Ll),et(r.CULL_FACE),tt(Nn);
vendor: 5,817 bytes, line 3816
3816function et(D){h[D]!==!0&&(r.enable(D),h[D]=!0)}function yt(D){h[D]!==!1&&(r.disable(D),h[D]=!1)}function Pt(D,ot){return u[D]!==ot?(r.bindFramebuffer(D,ot),u[D]=ot,D===r.DRAW_FRAMEBUFFER&&(u[r.FRAMEBUFFER]=ot),D===r.FRAMEBUFFER&&(u[r.DRAW_FRAMEBUFFER]=ot),!0):!1}function Tt(D,ot){let dt=f,bt=!1;if(D){dt=d.get(ot),dt===void 0&&(dt=[],d.set(ot,dt));const rt=D.textures;if(dt.length!==rt.length||dt[0]!==r.COLOR_ATTACHMENT0){for(let K=0,Ct=rt.length;K<Ct;K++)dt[K]=r.COLOR_ATTACHMENT0+K;dt.length=rt.length,bt=!0}}else dt[0]!==r.BACK&&(dt[0]=r.BACK,bt=!0);bt&&r.drawBuffers(dt)}function Zt(D){return m!==D?(r.useProgram(D),m=D,!0):!1}const ce={[$n]:r.FUNC_ADD,[yu]:r.FUNC_SUBTRACT,[Mu]:r.FUNC_REVERSE_SUBTRACT};ce[Su]=r.MIN,ce[bu]=r.MAX;const P={[Eu]:r.ZERO,[Tu]:r.ONE,[Au]:r.SRC_COLOR,[ga]:r.SRC_ALPHA,[Lu]:r.SRC_ALPHA_SATURATE,[Iu]:r.DST_COLOR,[Cu]:r.DST_ALPHA,[wu]:r.ONE_MINUS_SRC_COLOR,[_a]:r.ONE_MINUS_SRC_ALPHA,[Pu]:r.ONE_MINUS_DST_COLOR,[Ru]:r.ONE_MINUS_DST_ALPHA,[Du]:r.CONSTANT_COLOR,[Uu]:r.ONE_MINUS_CONSTANT_COLOR,[Nu]:r.CONSTANT_ALPHA,[Fu]:r.ONE_MINUS_CONSTANT_ALPHA};function tt(D,ot,dt,bt,rt,K,Ct,Vt,he,ie){if(D===Nn){_===!0&&(yt(r.BLEND),_=!1);return}if(_===!1&&(et(r.BLEND),_=!0),D!==vu){if(D!==g||ie!==b){if((p!==$n||x!==$n)&&(r.blendEquation(r.FUNC_ADD),p=$n,x=$n),ie)switch(D){case Ai:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Dl:r.blendFunc(r.ONE,r.ONE);break;case Ul:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Nl:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case Ai:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Dl:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Ul:console.error("THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Nl:console.error("THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}y=null,v=null,A=null,T=null,R.set(0,0,0),I=0,g=D,b=ie}return}rt=rt||ot,K=K||dt,Ct=Ct||bt,(ot!==p||rt!==x)&&(r.blendEquationSeparate(ce[ot],ce[rt]),p=ot,x=rt),(dt!==y||bt!==v||K!==A||Ct!==T)&&(r.blendFuncSeparate(P[dt],P[bt],P[K],P[Ct]),y=dt,v=bt,A=K,T=Ct),(Vt.equals(R)===!1||he!==I)&&(r.blendColor(Vt.r,Vt.g,Vt.b,he),R.copy(Vt),I=he),g=D,b=!1}function $(D,ot){D.side===vn?yt(r.CULL_FACE):et(r.CULL_FACE);let dt=D.side===Be;ot&&(dt=!dt),J(dt),D.blending===Ai&&D.transparent===!1?tt(Nn):tt(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.blendColor,D.blendAlpha,D.premultipliedAlpha),a.setFunc(D.depthFunc),a.setTest(D.depthTest),a.setMask(D.depthWrite),s.setMask(D.colorWrite);const bt=D.stencilWrite;o.setTest(bt),bt&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),it(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?et(r.SAMPLE_ALPHA_TO_COVERAGE):yt(r.SAMPLE_ALPHA_TO_COVERAGE)}function J(D){S!==D&&(D?r.frontFace(r.CW):r.frontFace(r.CCW),S=D)}function Z(D){D!==gu?(et(r.CULL_FACE),D!==L&&(D===Ll?r.cullFace(r.BACK):D===_u?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):yt(r.CULL_FACE),L=D}function ct(D){D!==F&&(W&&r.lineWidth(D),F=D)}function it(D,ot,dt){D?(et(r.POLYGON_OFFSET_FILL),(z!==ot||G!==dt)&&(r.polygonOffset(ot,dt),z=ot,G=dt)):yt(r.POLYGON_OFFSET_FILL)}function ht(D){D?et(r.SCISSOR_TEST):yt(r.SCISSOR_TEST)}function kt(D){D===void 0&&(D=r.TEXTURE0+q-1),ut!==D&&(r.activeTexture(D),ut=D)}function zt(D,ot,dt){dt===void 0&&(ut===null?dt=r.TEXTURE0+q-1:dt=ut);let bt=_t[dt];bt===void 0&&(bt={type:void 0,texture:void 0},_t[dt]=bt),(bt.type!==D||bt.texture!==ot)&&(ut!==dt&&(r.activeTexture(dt),ut=dt),r.bindTexture(D,ot||Y[D]),bt.type=D,bt.texture=ot)}function w(){const D=_t[ut];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function M(){try{r.compressedTexImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function O(){try{r.compressedTexImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function V(){try{r.texSubImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function j(){try{r.texSubImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function X(){try{r.compressedTexSubImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Rt(){try{r.compressedTexSubImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function lt(){try{r.texStorage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function At(){try{r.texStorage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function wt(){try{r.texImage2D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function st(){try{r.texImage3D(...arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function gt(D){$t.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),$t.copy(D))}function Ft(D){se.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),se.copy(D))}function It(D,ot){let dt=c.get(ot);dt===void 0&&(dt=new WeakMap,c.set(ot,dt));let bt=dt.get(D);bt===void 0&&(bt=r.getUniformBlockIndex(ot,D.name),dt.set(D,bt))}function pt(D,ot){const bt=c.get(ot).get(D);l.get(ot)!==bt&&(r.uniformBlockBinding(ot,bt,D.__bindingPointIndex),l.set(ot,bt))}function qt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor
vendor: 4,133 bytes, line 3816
3816(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},ut=null,_t={},u={},d=new WeakMap,f=[],m=null,_=!1,g=null,p=null,y=null,v=null,x=null,A=null,T=null,R=new xt(0,0,0),I=0,b=!1,S=null,L=null,F=null,z=null,G=null,$t.set(0,0,r.canvas.width,r.canvas.height),se.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:et,disable:yt,bindFramebuffer:Pt,drawBuffers:Tt,useProgram:Zt,setBlending:tt,setMaterial:$,setFlipSided:J,setCullFace:Z,setLineWidth:ct,setPolygonOffset:it,setScissorTest:ht,activeTexture:kt,bindTexture:zt,unbindTexture:w,compressedTexImage2D:M,compressedTexImage3D:O,texImage2D:wt,texImage3D:st,updateUBOMapping:It,uniformBlockBinding:pt,texStorage2D:lt,texStorage3D:At,texSubImage2D:V,texSubImage3D:j,compressedTexSubImage2D:X,compressedTexSubImage3D:Rt,scissor:gt,viewport:Ft,reset:qt}}function zy(r,t,e,n,i,s,a){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Q,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function m(w,M){return f?new OffscreenCanvas(w,M):nr("canvas")}function _(w,M,O){let V=1;const j=zt(w);if((j.width>O||j.height>O)&&(V=O/Math.max(j.width,j.height)),V<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const X=Math.floor(V*j.width),Rt=Math.floor(V*j.height);u===void 0&&(u=m(X,Rt));const lt=M?m(X,Rt):u;return lt.width=X,lt.height=Rt,lt.getContext("2d").drawImage(w,0,0,X,Rt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+X+"x"+Rt+")."),lt}else return"data"in w&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),w;return w}function g(w){return w.generateMipmaps}function p(w){r.generateMipmap(w)}function y(w){return w.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:w.isWebGL3DRenderTarget?r.TEXTURE_3D:w.isWebGLArrayRenderTarget||w.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function v(w,M,O,V,j=!1){if(w!==null){if(r[w]!==void 0)return r[w];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let X=M;if(M===r.RED&&(O===r.FLOAT&&(X=r.R32F),O===r.HALF_FLOAT&&(X=r.R16F),O===r.UNSIGNED_BYTE&&(X=r.R8)),M===r.RED_INTEGER&&(O===r.UNSIGNED_BYTE&&(X=r.R8UI),O===r.UNSIGNED_SHORT&&(X=r.R16UI),O===r.UNSIGNED_INT&&(X=r.R32UI),O===r.BYTE&&(X=r.R8I),O===r.SHORT&&(X=r.R16I),O===r.INT&&(X=r.R32I)),M===r.RG&&(O===r.FLOAT&&(X=r.RG32F),O===r.HALF_FLOAT&&(X=r.RG16F),O===r.UNSIGNED_BYTE&&(X=r.RG8)),M===r.RG_INTEGER&&(O===r.UNSIGNED_BYTE&&(X=r.RG8UI),O===r.UNSIGNED_SHORT&&(X=r.RG16UI),O===r.UNSIGNED_INT&&(X=r.RG32UI),O===r.BYTE&&(X=r.RG8I),O===r.SHORT&&(X=r.RG16I),O===r.INT&&(X=r.RG32I)),M===r.RGB_INTEGER&&(O===r.UNSIGNED_BYTE&&(X=r.RGB8UI),O===r.UNSIGNED_SHORT&&(X=r.RGB16UI),O===r.UNSIGNED_INT&&(X=r.RGB32UI),O===r.BYTE&&(X=r.RGB8I),O===r.SHORT&&(X=r.RGB16I),O===r.INT&&(X=r.RGB32I)),M===r.RGBA_INTEGER&&(O===r.UNSIGNED_BYTE&&(X=r.RGBA8UI),O===r.UNSIGNED_SHORT&&(X=r.RGBA16UI),O===r.UNSIGNED_INT&&(X=r.RGBA32UI),O===r.BYTE&&(X=r.RGBA8I),O===r.SHORT&&(X=r.RGBA16I),O===r.INT&&(X=r.RGBA32I)),M===r.RGB&&(O===r.UNSIGNED_INT_5_9_9_9_REV&&(X=r.RGB9_E5),O===r.UNSIGNED_INT_10F_11F_11F_REV&&(X=r.R11F_G11F_B10F)),M===r.RGBA){const Rt=j?tr:Kt.getTransfer(V);
vendor: 12,297 bytes, line 3816
3816O===r.FLOAT&&(X=r.RGBA32F),O===r.HALF_FLOAT&&(X=r.RGBA16F),O===r.UNSIGNED_BYTE&&(X=Rt===re?r.SRGB8_ALPHA8:r.RGBA8),O===r.UNSIGNED_SHORT_4_4_4_4&&(X=r.RGBA4),O===r.UNSIGNED_SHORT_5_5_5_1&&(X=r.RGB5_A1)}return(X===r.R16F||X===r.R32F||X===r.RG16F||X===r.RG32F||X===r.RGBA16F||X===r.RGBA32F)&&t.get("EXT_color_buffer_float"),X}function x(w,M){let O;return w?M===null||M===kn||M===hs?O=r.DEPTH24_STENCIL8:M===Xe?O=r.DEPTH32F_STENCIL8:M===cs&&(O=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):M===null||M===kn||M===hs?O=r.DEPTH_COMPONENT24:M===Xe?O=r.DEPTH_COMPONENT32F:M===cs&&(O=r.DEPTH_COMPONENT16),O}function A(w,M){return g(w)===!0||w.isFramebufferTexture&&w.minFilter!==Ae&&w.minFilter!==Me?Math.log2(Math.max(M.width,M.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?M.mipmaps.length:1}function T(w){const M=w.target;M.removeEventListener("dispose",T),I(M),M.isVideoTexture&&h.delete(M)}function R(w){const M=w.target;M.removeEventListener("dispose",R),S(M)}function I(w){const M=n.get(w);if(M.__webglInit===void 0)return;const O=w.source,V=d.get(O);if(V){const j=V[M.__cacheKey];j.usedTimes--,j.usedTimes===0&&b(w),Object.keys(V).length===0&&d.delete(O)}n.remove(w)}function b(w){const M=n.get(w);r.deleteTexture(M.__webglTexture);const O=w.source,V=d.get(O);delete V[M.__cacheKey],a.memory.textures--}function S(w){const M=n.get(w);if(w.depthTexture&&(w.depthTexture.dispose(),n.remove(w.depthTexture)),w.isWebGLCubeRenderTarget)for(let V=0;V<6;V++){if(Array.isArray(M.__webglFramebuffer[V]))for(let j=0;j<M.__webglFramebuffer[V].length;j++)r.deleteFramebuffer(M.__webglFramebuffer[V][j]);else r.deleteFramebuffer(M.__webglFramebuffer[V]);M.__webglDepthbuffer&&r.deleteRenderbuffer(M.__webglDepthbuffer[V])}else{if(Array.isArray(M.__webglFramebuffer))for(let V=0;V<M.__webglFramebuffer.length;V++)r.deleteFramebuffer(M.__webglFramebuffer[V]);else r.deleteFramebuffer(M.__webglFramebuffer);if(M.__webglDepthbuffer&&r.deleteRenderbuffer(M.__webglDepthbuffer),M.__webglMultisampledFramebuffer&&r.deleteFramebuffer(M.__webglMultisampledFramebuffer),M.__webglColorRenderbuffer)for(let V=0;V<M.__webglColorRenderbuffer.length;V++)M.__webglColorRenderbuffer[V]&&r.deleteRenderbuffer(M.__webglColorRenderbuffer[V]);M.__webglDepthRenderbuffer&&r.deleteRenderbuffer(M.__webglDepthRenderbuffer)}const O=w.textures;for(let V=0,j=O.length;V<j;V++){const X=n.get(O[V]);X.__webglTexture&&(r.deleteTexture(X.__webglTexture),a.memory.textures--),n.remove(O[V])}n.remove(w)}let L=0;function F(){L=0}function z(){const w=L;return w>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+i.maxTextures),L+=1,w}function G(w){const M=[];return M.push(w.wrapS),M.push(w.wrapT),M.push(w.wrapR||0),M.push(w.magFilter),M.push(w.minFilter),M.push(w.anisotropy),M.push(w.internalFormat),M.push(w.format),M.push(w.type),M.push(w.generateMipmaps),M.push(w.premultiplyAlpha),M.push(w.flipY),M.push(w.unpackAlignment),M.push(w.colorSpace),M.join()}function q(w,M){const O=n.get(w);if(w.isVideoTexture&&ht(w),w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&O.__version!==w.version){const V=w.image;if(V===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(V.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Y(O,w,M);return}}else w.isExternalTexture&&(O.__webglTexture=w.sourceTexture?w.sourceTexture:null);e.bindTexture(r.TEXTURE_2D,O.__webglTexture,r.TEXTURE0+M)}function W(w,M){const O=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&O.__version!==w.version){Y(O,w,M);return}e.bindTexture(r.TEXTURE_2D_ARRAY,O.__webglTexture,r.TEXTURE0+M)}function nt(w,M){const O=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&O.__version!==w.version){Y(O,w,M);return}e.bindTexture(r.TEXTURE_3D,O.__webglTexture,r.TEXTURE0+M)}function H(w,M){const O=n.get(w);if(w.version>0&&O.__version!==w.version){et(O,w,M);return}e.bindTexture(r.TEXTURE_CUBE_MAP,O.__webglTexture,r.TEXTURE0+M)}const ut={[$s]:r.REPEAT,[rn]:r.CLAMP_TO_EDGE,[Ks]:r.MIRRORED_REPEAT},_t={[Ae]:r.NEAREST,[Jl]:r.NEAREST_MIPMAP_NEAREST,[ss]:r.NEAREST_MIPMAP_LINEAR,[Me]:r.LINEAR,[ks]:r.LINEAR_MIPMAP_NEAREST,[yn]:r.LINEAR_MIPMAP_LINEAR},St={[ju]:r.NEVER,[rd]:r.ALWAYS,[td]:r.LESS,[sc]:r.LEQUAL,[ed]:r.EQUAL,[sd]:r.GEQUAL,[nd]:r.GREATER,[id]:r.NOTEQUAL};function Gt(w,M){if(M.type===Xe&&t.has("OES_texture_float_linear")===!1&&(M.magFilter===Me||M.magFilter===ks||M.magFilter===ss||M.magFilter===yn||M.minFilter===Me||M.minFilter===ks||M.minFilter===ss||M.minFilter===yn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(w,r.TEXTURE_WRAP_S,ut[M.wrapS]),r.texParameteri(w,r.TEXTURE_WRAP_T,ut[M.wrapT]),(w===r.TEXTURE_3D||w===r.TEXTURE_2D_ARRAY)&&r.texParameteri(w,r.TEXTURE_WRAP_R,ut[M.wrapR]),r.texParameteri(w,r.TEXTURE_MAG_FILTER,_t[M.magFilter]),r.texParameteri(w,r.TEXTURE_MIN_FILTER,_t[M.minFilter]),M.compareFunction&&(r.texParameteri(w,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(w,r.TEXTURE_COMPARE_FUNC,St[M.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(M.magFilter===Ae||M.minFilter!==ss&&M.minFilter!==yn||M.type===Xe&&t.has("OES_texture_float_linear")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){const O=t.get("EXT_texture_filter_anisotropic");r.texParameterf(w,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,i.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function $t(w,M){let O=!1;w.__webglInit===void 0&&(w.__webglInit=!0,M.addEventListener("dispose",T));const V=M.source;let j=d.get(V);j===void 0&&(j={},d.set(V,j));const X=G(M);if(X!==w.__cacheKey){j[X]===void 0&&(j[X]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,O=!0),j[X].usedTimes++;const Rt=j[w.__cacheKey];Rt!==void 0&&(j[w.__cacheKey].usedTimes--,Rt.usedTimes===0&&b(M)),w.__cacheKey=X,w.__webglTexture=j[X].texture}return O}function se(w,M,O){return Math.floor(Math.floor(w/O)/M)}function Qt(w,M,O,V){const X=w.updateRanges;if(X.length===0)e.texSubImage2D(r.TEXTURE_2D,0,0,0,M.width,M.height,O,V,M.data);else{X.sort((st,gt)=>st.start-gt.start);let Rt=0;for(let st=1;st<X.length;st++){const gt=X[Rt],Ft=X[st],It=gt.start+gt.count,pt=se(Ft.start,M.width,4),qt=se(gt.start,M.width,4);Ft.start<=It+1&&pt===qt&&se(Ft.start+Ft.count-1,M.width,4)===pt?gt.count=Math.max(gt.count,Ft.start+Ft.count-gt.start):(++Rt,X[Rt]=Ft)}X.length=Rt+1;const lt=r.getParameter(r.UNPACK_ROW_LENGTH),At=r.getParameter(r.UNPACK_SKIP_PIXELS),wt=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,M.width);for(let st=0,gt=X.length;st<gt;st++){const Ft=X[st],It=Math.floor(Ft.start/4),pt=Math.ceil(Ft.count/4),qt=It%M.width,D=Math.floor(It/M.width),ot=pt,dt=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,qt),r.pixelStorei(r.UNPACK_SKIP_ROWS,D),e.texSubImage2D(r.TEXTURE_2D,0,qt,D,ot,dt,O,V,M.data)}w.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,lt),r.pixelStorei(r.UNPACK_SKIP_PIXELS,At),r.pixelStorei(r.UNPACK_SKIP_ROWS,wt)}}function Y(w,M,O){let V=r.TEXTURE_2D;(M.isDataArrayTexture||M.isCompressedArrayTexture)&&(V=r.TEXTURE_2D_ARRAY),M.isData3DTexture&&(V=r.TEXTURE_3D);const j=$t(w,M),X=M.source;e.bindTexture(V,w.__webglTexture,r.TEXTURE0+O);const Rt=n.get(X);if(X.version!==Rt.__version||j===!0){e.activeTexture(r.TEXTURE0+O);const lt=Kt.getPrimaries(Kt.workingColorSpace),At=M.colorSpace===Dn?null:Kt.getPrimaries(M.colorSpace),wt=M.colorSpace===Dn||lt===At?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,M.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,M.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,wt);let st=_(M.image,!1,i.maxTextureSize);st=kt(M,st);const gt=s.convert(M.format,M.colorSpace),Ft=s.convert(M.type);let It=v(M.internalFormat,gt,Ft,M.colorSpace,M.isVideoTexture);Gt(V,M);let pt;const qt=M.mipmaps,D=M.isVideoTexture!==!0,ot=Rt.__version===void 0||j===!0,dt=X.dataReady,bt=A(M,st);if(M.isDepthTexture)It=x(M.format===ds,M.type),ot&&(D?e.texStorage2D(r.TEXTURE_2D,1,It,st.width,st.height):e.texImage2D(r.TEXTURE_2D,0,It,st.width,st.height,0,gt,Ft,null));else if(M.isDataTexture)if(qt.length>0){D&&ot&&e.texStorage2D(r.TEXTURE_2D,bt,It,qt[0].width,qt[0].height);for(let rt=0,K=qt.length;rt<K;rt++)pt=qt[rt],D?dt&&e.texSubImage2D(r.TEXTURE_2D,rt,0,0,pt.width,pt.height,gt,Ft,pt.data):e.texImage2D(r.TEXTURE_2D,rt,It,pt.width,pt.height,0,gt,Ft,pt.data);M.generateMipmaps=!1}else D?(ot&&e.texStorage2D(r.TEXTURE_2D,bt,It,st.width,st.height),dt&&Qt(M,st,gt,Ft)):e.texImage2D(r.TEXTURE_2D,0,It,st.width,st.height,0,gt,Ft,st.data);else if(M.isCompressedTexture)if(M.isCompressedArrayTexture){D&&ot&&e.texStorage3D(r.TEXTURE_2D_ARRAY,bt,It,qt[0].width,qt[0].height,st.depth);for(let rt=0,K=qt.length;rt<K;rt++)if(pt=qt[rt],M.format!==Oe)if(gt!==null)if(D){if(dt)if(M.layerUpdates.size>0){const Ct=Xl(pt.width,pt.height,M.format,M.type);for(const Vt of M.layerUpdates){const he=pt.data.subarray(Vt*Ct/pt.data.BYTES_PER_ELEMENT,(Vt+1)*Ct/pt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,rt,0,0,Vt,pt.width,pt.height,1,gt,he)}M.clearLayerUpdates()}else e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,rt,0,0,0,pt.width,pt.height,st.depth,gt,pt.data)}else e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,rt,It,pt.width,pt.height,st.depth,0,pt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else D?dt&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,rt,0,0,0,pt.width,pt.height,st.depth,gt,Ft,pt.data):e.texImage3D(r.TEXTURE_2D_ARRAY,rt,It,pt.width,pt.height,st.depth,0,gt,Ft,pt.data)}else{D&&ot&&e.texStorage2D(r.TEXTURE_2D,bt,It,qt[0].width,qt[0].height);for(let rt=0,K=qt.length;rt<K;rt++)pt=qt[rt],M.format!==Oe?gt!==null?D?dt&&e.compressedTexSubImage2D(r.TEXTURE_2D,rt,0,0,pt.width,pt.height,gt,pt.data):e.compressedTexImage2D(r.TEXTURE_2D,rt,It,pt.width,pt.height,0,pt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):D?dt&&e.texSubImage2D(r.TEXTURE_2D,rt,0,0,pt.width,pt.height,gt,Ft,pt.data):e.texImage2D(r.TEXTURE_2D,rt,It,pt.width,pt.height,0,gt,Ft,pt.data)}else if(M.isDataArrayTexture)if(D){if(ot&&e.texStorage3D(r.TEXTURE_2D_ARRAY,bt,It,st.width,st.height,st.depth),dt)if(M.layerUpdates.size>0){const rt=Xl(st.width,st.height,M.format,M.type);for(const K of M.layerUpdates){const Ct=st.data.subarray(K*rt/st.data.BYTES_PER_ELEMENT,(K+1)*rt/st.data.BYTES_PER_ELEMENT);e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,K,st.width,st.height,1,gt,Ft,Ct)}M.clearLayerUpdates()}else e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,st.width,st.height,st.depth,gt,Ft,st.data)}else e.texImage3D(r.TEXTURE_2D_ARRAY,0,It,st.width,st.height,st.depth,0,gt,Ft,st.data);else if(M.isData3DTexture)D?(ot&&e.texStorage3D(r.TEXTURE_3D,bt,It,st.width,st.height,st.depth),dt&&e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,st.width,st.height,st.depth,gt,Ft,st.data)):e.texImage3D(r.TEXTURE_3D,0,It,st.width,st.height,st.depth,0,gt,Ft,st.data);else if(M.isFramebufferTexture){if(ot)if(D)e.texStorage2D(r.TEXTURE_2D,bt,It,st.width,st.height);else{let rt=st.width,K=st.height;for(let Ct=0;Ct<bt;Ct++)e.texImage2D(r.TEXTURE_2D,Ct,It,rt,K,0,gt,Ft,null),rt>>=1,K>>=1}}else if(qt.length>0){if(D&&ot){const rt=zt(qt[0]);e.texStorage2D(r.TEXTURE_2D,bt,It,rt.width,rt.height)}for(let rt=0,K=qt.length;rt<K;rt++)pt=qt[rt],D?dt&&e.texSubImage2D(r.TEXTURE_2D,rt,0,0,gt,Ft,pt):e.texImage2D(r.TEXTURE_2D,rt,It,gt,Ft,pt);M.generateMipmaps=!1}else if(D){if(ot){const rt=zt(st);e.texStorage2D(r.TEXTURE_2D,bt,It,rt.width,rt.height)}dt&&e.texSubImage2D(r.TEXTURE_2D,0,0,0,gt,Ft,st)}else e.texImage2D(r.TEXTURE_2D,0,It,gt,Ft,st);g(M)&&p(V),Rt.__version=X.version,M.onUpdate&&M.onUpdate(M)}w.__version=M.version}function et(w,M,O){if(M.image.length!==6)return;const V=$t(w,M),j=M.source;e.bindTexture(r.TEXTURE_CUBE_MAP,w.__webglTexture,r.TEXTURE0+O);const X=n.get(j);if(j.version!==X.__version||V===!0){e.activeTexture(r.TEXTURE0+O);
vendor: 5,278 bytes, line 3816
3816const Rt=Kt.getPrimaries(Kt.workingColorSpace),lt=M.colorSpace===Dn?null:Kt.getPrimaries(M.colorSpace),At=M.colorSpace===Dn||Rt===lt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,M.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,M.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,M.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,At);const wt=M.isCompressedTexture||M.image[0].isCompressedTexture,st=M.image[0]&&M.image[0].isDataTexture,gt=[];for(let K=0;K<6;K++)!wt&&!st?gt[K]=_(M.image[K],!0,i.maxCubemapSize):gt[K]=st?M.image[K].image:M.image[K],gt[K]=kt(M,gt[K]);const Ft=gt[0],It=s.convert(M.format,M.colorSpace),pt=s.convert(M.type),qt=v(M.internalFormat,It,pt,M.colorSpace),D=M.isVideoTexture!==!0,ot=X.__version===void 0||V===!0,dt=j.dataReady;let bt=A(M,Ft);Gt(r.TEXTURE_CUBE_MAP,M);let rt;if(wt){D&&ot&&e.texStorage2D(r.TEXTURE_CUBE_MAP,bt,qt,Ft.width,Ft.height);for(let K=0;K<6;K++){rt=gt[K].mipmaps;for(let Ct=0;Ct<rt.length;Ct++){const Vt=rt[Ct];M.format!==Oe?It!==null?D?dt&&e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct,0,0,Vt.width,Vt.height,It,Vt.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct,qt,Vt.width,Vt.height,0,Vt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?dt&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct,0,0,Vt.width,Vt.height,It,pt,Vt.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct,qt,Vt.width,Vt.height,0,It,pt,Vt.data)}}}else{if(rt=M.mipmaps,D&&ot){rt.length>0&&bt++;const K=zt(gt[0]);e.texStorage2D(r.TEXTURE_CUBE_MAP,bt,qt,K.width,K.height)}for(let K=0;K<6;K++)if(st){D?dt&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,gt[K].width,gt[K].height,It,pt,gt[K].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,qt,gt[K].width,gt[K].height,0,It,pt,gt[K].data);for(let Ct=0;Ct<rt.length;Ct++){const he=rt[Ct].image[K].image;D?dt&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct+1,0,0,he.width,he.height,It,pt,he.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct+1,qt,he.width,he.height,0,It,pt,he.data)}}else{D?dt&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,It,pt,gt[K]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,qt,It,pt,gt[K]);for(let Ct=0;Ct<rt.length;Ct++){const Vt=rt[Ct];D?dt&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct+1,0,0,It,pt,Vt.image[K]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+K,Ct+1,qt,It,pt,Vt.image[K])}}}g(M)&&p(r.TEXTURE_CUBE_MAP),X.__version=j.version,M.onUpdate&&M.onUpdate(M)}w.__version=M.version}function yt(w,M,O,V,j,X){const Rt=s.convert(O.format,O.colorSpace),lt=s.convert(O.type),At=v(O.internalFormat,Rt,lt,O.colorSpace),wt=n.get(M),st=n.get(O);if(st.__renderTarget=M,!wt.__hasExternalTextures){const gt=Math.max(1,M.width>>X),Ft=Math.max(1,M.height>>X);j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY?e.texImage3D(j,X,At,gt,Ft,M.depth,0,Rt,lt,null):e.texImage2D(j,X,At,gt,Ft,0,Rt,lt,null)}e.bindFramebuffer(r.FRAMEBUFFER,w),it(M)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,V,j,st.__webglTexture,0,ct(M)):(j===r.TEXTURE_2D||j>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,V,j,st.__webglTexture,X),e.bindFramebuffer(r.FRAMEBUFFER,null)}function Pt(w,M,O){if(r.bindRenderbuffer(r.RENDERBUFFER,w),M.depthBuffer){const V=M.depthTexture,j=V&&V.isDepthTexture?V.type:null,X=x(M.stencilBuffer,j),Rt=M.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,lt=ct(M);it(M)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,lt,X,M.width,M.height):O?r.renderbufferStorageMultisample(r.RENDERBUFFER,lt,X,M.width,M.height):r.renderbufferStorage(r.RENDERBUFFER,X,M.width,M.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Rt,r.RENDERBUFFER,w)}else{const V=M.textures;for(let j=0;j<V.length;j++){const X=V[j],Rt=s.convert(X.format,X.colorSpace),lt=s.convert(X.type),At=v(X.internalFormat,Rt,lt,X.colorSpace),wt=ct(M);O&&it(M)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,wt,At,M.width,M.height):it(M)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,wt,At,M.width,M.height):r.renderbufferStorage(r.RENDERBUFFER,At,M.width,M.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Tt(w,M){if(M&&M.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,w),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const V=n.get(M.depthTexture);V.__renderTarget=M,(!V.__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),q(M.depthTexture,0);const j=V.__webglTexture,X=ct(M);if(M.depthTexture.format===us)it(M)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,j,0,X):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,j,0);else if(M.depthTexture.format===ds)it(M)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,j,0,X):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,j,0);else throw new Error("Unknown depthTexture format")}
vendor: 23,433 bytes, lines 3816-3840
3816function Zt(w){const M=n.get(w),O=w.isWebGLCubeRenderTarget===!0;if(M.__boundDepthTexture!==w.depthTexture){const V=w.depthTexture;if(M.__depthDisposeCallback&&M.__depthDisposeCallback(),V){const j=()=>{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,V.removeEventListener("dispose",j)};V.addEventListener("dispose",j),M.__depthDisposeCallback=j}M.__boundDepthTexture=V}if(w.depthTexture&&!M.__autoAllocateDepthBuffer){if(O)throw new Error("target.depthTexture not supported in Cube render targets");const V=w.texture.mipmaps;V&&V.length>0?Tt(M.__webglFramebuffer[0],w):Tt(M.__webglFramebuffer,w)}else if(O){M.__webglDepthbuffer=[];for(let V=0;V<6;V++)if(e.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer[V]),M.__webglDepthbuffer[V]===void 0)M.__webglDepthbuffer[V]=r.createRenderbuffer(),Pt(M.__webglDepthbuffer[V],w,!1);else{const j=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=M.__webglDepthbuffer[V];r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,j,r.RENDERBUFFER,X)}}else{const V=w.texture.mipmaps;if(V&&V.length>0?e.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer[0]):e.bindFramebuffer(r.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=r.createRenderbuffer(),Pt(M.__webglDepthbuffer,w,!1);else{const j=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,X=M.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,X),r.framebufferRenderbuffer(r.FRAMEBUFFER,j,r.RENDERBUFFER,X)}}e.bindFramebuffer(r.FRAMEBUFFER,null)}function ce(w,M,O){const V=n.get(w);M!==void 0&&yt(V.__webglFramebuffer,w,w.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),O!==void 0&&Zt(w)}function P(w){const M=w.texture,O=n.get(w),V=n.get(M);w.addEventListener("dispose",R);const j=w.textures,X=w.isWebGLCubeRenderTarget===!0,Rt=j.length>1;if(Rt||(V.__webglTexture===void 0&&(V.__webglTexture=r.createTexture()),V.__version=M.version,a.memory.textures++),X){O.__webglFramebuffer=[];for(let lt=0;lt<6;lt++)if(M.mipmaps&&M.mipmaps.length>0){O.__webglFramebuffer[lt]=[];for(let At=0;At<M.mipmaps.length;At++)O.__webglFramebuffer[lt][At]=r.createFramebuffer()}else O.__webglFramebuffer[lt]=r.createFramebuffer()}else{if(M.mipmaps&&M.mipmaps.length>0){O.__webglFramebuffer=[];for(let lt=0;lt<M.mipmaps.length;lt++)O.__webglFramebuffer[lt]=r.createFramebuffer()}else O.__webglFramebuffer=r.createFramebuffer();if(Rt)for(let lt=0,At=j.length;lt<At;lt++){const wt=n.get(j[lt]);wt.__webglTexture===void 0&&(wt.__webglTexture=r.createTexture(),a.memory.textures++)}if(w.samples>0&&it(w)===!1){O.__webglMultisampledFramebuffer=r.createFramebuffer(),O.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let lt=0;lt<j.length;lt++){const At=j[lt];O.__webglColorRenderbuffer[lt]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,O.__webglColorRenderbuffer[lt]);const wt=s.convert(At.format,At.colorSpace),st=s.convert(At.type),gt=v(At.internalFormat,wt,st,At.colorSpace,w.isXRRenderTarget===!0),Ft=ct(w);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ft,gt,w.width,w.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+lt,r.RENDERBUFFER,O.__webglColorRenderbuffer[lt])}r.bindRenderbuffer(r.RENDERBUFFER,null),w.depthBuffer&&(O.__webglDepthRenderbuffer=r.createRenderbuffer(),Pt(O.__webglDepthRenderbuffer,w,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(X){e.bindTexture(r.TEXTURE_CUBE_MAP,V.__webglTexture),Gt(r.TEXTURE_CUBE_MAP,M);for(let lt=0;lt<6;lt++)if(M.mipmaps&&M.mipmaps.length>0)for(let At=0;At<M.mipmaps.length;At++)yt(O.__webglFramebuffer[lt][At],w,M,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+lt,At);else yt(O.__webglFramebuffer[lt],w,M,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+lt,0);g(M)&&p(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Rt){for(let lt=0,At=j.length;lt<At;lt++){const wt=j[lt],st=n.get(wt);let gt=r.TEXTURE_2D;(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(gt=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),e.bindTexture(gt,st.__webglTexture),Gt(gt,wt),yt(O.__webglFramebuffer,w,wt,r.COLOR_ATTACHMENT0+lt,gt,0),g(wt)&&p(gt)}e.unbindTexture()}else{let lt=r.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(lt=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),e.bindTexture(lt,V.__webglTexture),Gt(lt,M),M.mipmaps&&M.mipmaps.length>0)for(let At=0;At<M.mipmaps.length;At++)yt(O.__webglFramebuffer[At],w,M,r.COLOR_ATTACHMENT0,lt,At);else yt(O.__webglFramebuffer,w,M,r.COLOR_ATTACHMENT0,lt,0);g(M)&&p(lt),e.unbindTexture()}w.depthBuffer&&Zt(w)}function tt(w){const M=w.textures;for(let O=0,V=M.length;O<V;O++){const j=M[O];if(g(j)){const X=y(w),Rt=n.get(j).__webglTexture;e.bindTexture(X,Rt),p(X),e.unbindTexture()}}}const $=[],J=[];function Z(w){if(w.samples>0){if(it(w)===!1){const M=w.textures,O=w.width,V=w.height;let j=r.COLOR_BUFFER_BIT;const X=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Rt=n.get(w),lt=M.length>1;if(lt)for(let wt=0;wt<M.length;wt++)e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+wt,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+wt,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer);const At=w.texture.mipmaps;At&&At.length>0?e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer[0]):e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Rt.__webglFramebuffer);for(let wt=0;wt<M.length;wt++){if(w.resolveDepthBuffer&&(w.depthBuffer&&(j|=r.DEPTH_BUFFER_BIT),w.stencilBuffer&&w.resolveStencilBuffer&&(j|=r.STENCIL_BUFFER_BIT)),lt){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Rt.__webglColorRenderbuffer[wt]);const st=n.get(M[wt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,st,0)}r.blitFramebuffer(0,0,O,V,0,0,O,V,j,r.NEAREST),l===!0&&($.length=0,J.length=0,$.push(r.COLOR_ATTACHMENT0+wt),w.depthBuffer&&w.resolveDepthBuffer===!1&&($.push(X),J.push(X),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,J)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,$))}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),lt)for(let wt=0;wt<M.length;wt++){e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+wt,r.RENDERBUFFER,Rt.__webglColorRenderbuffer[wt]);const st=n.get(M[wt]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,Rt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+wt,r.TEXTURE_2D,st,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Rt.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&l){const M=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[M])}}}function ct(w){return Math.min(i.maxSamples,w.samples)}function it(w){const M=n.get(w);return w.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function ht(w){const M=a.render.frame;h.get(w)!==M&&(h.set(w,M),w.update())}function kt(w,M){const O=w.colorSpace,V=w.format,j=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||O!==Ii&&O!==Dn&&(Kt.getTransfer(O)===re?(V!==Oe||j!==dn)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",O)),M}function zt(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=z,this.resetTextureUnits=F,this.setTexture2D=q,this.setTexture2DArray=W,this.setTexture3D=nt,this.setTextureCube=H,this.rebindTextures=ce,this.setupRenderTarget=P,this.updateRenderTargetMipmap=tt,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=Zt,this.setupFrameBufferTexture=yt,this.useMultisampledRTT=it}function xf(r,t){function e(n,i=Dn){let s;const a=Kt.getTransfer(i);if(n===dn)return r.UNSIGNED_BYTE;if(n===oo)return r.UNSIGNED_SHORT_4_4_4_4;if(n===lo)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Ql)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===jl)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===$l)return r.BYTE;if(n===Kl)return r.SHORT;if(n===cs)return r.UNSIGNED_SHORT;if(n===ao)return r.INT;if(n===kn)return r.UNSIGNED_INT;if(n===Xe)return r.FLOAT;if(n===vs)return r.HALF_FLOAT;if(n===tc)return r.ALPHA;if(n===ec)return r.RGB;if(n===Oe)return r.RGBA;if(n===us)return r.DEPTH_COMPONENT;if(n===ds)return r.DEPTH_STENCIL;if(n===co)return r.RED;if(n===dr)return r.RED_INTEGER;if(n===nc)return r.RG;if(n===ho)return r.RG_INTEGER;if(n===uo)return r.RGBA_INTEGER;if(n===Vs||n===Hs||n===Gs||n===Ws)if(a===re)if(s=t.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Vs)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Gs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ws)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=t.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Vs)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hs)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Gs)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ws)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ta||n===Aa||n===wa||n===Ca)if(s=t.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Ta)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Aa)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===wa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ca)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Ra||n===Ia||n===Pa)if(s=t.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Ra||n===Ia)return a===re?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Pa)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===La||n===Da||n===Ua||n===Na||n===Fa||n===Oa||n===Ba||n===za||n===ka||n===Va||n===Ha||n===Ga||n===Wa||n===Xa)if(s=t.get("WEBGL_compressed_texture_astc"),s!==null){if(n===La)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Da)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Ua)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Na)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Fa)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Oa)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ba)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===za)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ka)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Va)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ha)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ga)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Wa)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Xa)return a===re?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===qa||n===Ya||n===Za)if(s=t.get("EXT_texture_compression_bptc"),s!==null){if(n===qa)return a===re?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ya)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Za)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ja||n===$a||n===Ka||n===Qa)if(s=t.get("EXT_texture_compression_rgtc"),s!==null){if(n===Ja)return s.COMPRESSED_RED_RGTC1_EXT;if(n===$a)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ka)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Qa)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===hs?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:e}}const ky=`
3817void main() {
3818
3819	gl_Position = vec4( position, 1.0 );
3820
3821}`,Vy=`
3822uniform sampler2DArray depthColor;
3823uniform float depthWidth;
3824uniform float depthHeight;
3825
3826void main() {
3827
3828	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3829
3830	if ( coord.x >= 1.0 ) {
3831
3832		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3833
3834	} else {
3835
3836		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
3837
3838	}
3839
3840}`;class Hy{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){const n=new fc(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){const e=t.cameras[0].viewport,n=new fn({vertexShader:ky,fragmentShader:Vy,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ye(new Ss(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Gy extends En{constructor(t,e){super();const n=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,h=null,u=null,d=null,f=null,m=null;const _=typeof XRWebGLBinding<"u",g=new Hy,p={},y=e.getContextAttributes();let v=null,x=null;const A=[],T=[],R=new Q;let I=null;const b=new Te;b.viewport=new te;const S=new Te;S.viewport=new te;const L=[b,S],F=new of;let z=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getTargetRaySpace()},this.getControllerGrip=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getGripSpace()},this.getHand=function(Y){let et=A[Y];return et===void 0&&(et=new pa,A[Y]=et),et.getHandSpace()};function q(Y){const et=T.indexOf(Y.inputSource);if(et===-1)return;const yt=A[et];yt!==void 0&&(yt.update(Y.inputSource,Y.frame,c||a),yt.dispatchEvent({type:Y.type,data:Y.inputSource}))}function W(){i.removeEventListener("select",q),i.removeEventListener("selectstart",q),i.removeEventListener("selectend",q),i.removeEventListener("squeeze",q),i.removeEventListener("squeezestart",q),i.removeEventListener("squeezeend",q),i.removeEventListener("end",W),i.removeEventListener("inputsourceschange",nt);for(let Y=0;Y<A.length;Y++){const et=T[Y];et!==null&&(T[Y]=null,A[Y].disconnect(et))}z=null,G=null,g.reset();for(const Y in p)delete p[Y];t.setRenderTarget(v),f=null,d=null,u=null,i=null,x=null,Qt.stop(),n.isPresenting=!1,t.setPixelRatio(I),t.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&_&&(u=new XRWebGLBinding(i,e)),u},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(v=t.getRenderTarget(),i.addEventListener("select",q),i.addEventListener("selectstart",q),i.addEventListener("selectend",q),i.addEventListener("squeeze",q),i.addEventListener("squeezestart",q),i.addEventListener("squeezeend",q),i.addEventListener("end",W),i.addEventListener("inputsourceschange",nt),y.xrCompatible!==!0&&await e.makeXRCompatible(),I=t.getPixelRatio(),t.getSize(R),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let yt=null,Pt=null,Tt=null;y.depth&&(Tt=y.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,yt=y.stencil?ds:us,Pt=y.stencil?hs:kn);const Zt={colorFormat:e.RGBA8,depthFormat:Tt,scaleFactor:s};u=this.getBinding(),d=u.createProjectionLayer(Zt),i.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),x=new bn(d.textureWidth,d.textureHeight,{format:Oe,type:dn,depthTexture:new dc(d.textureWidth,d.textureHeight,Pt,void 0,void 0,void 0,void 0,void 0,void 0,yt),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const yt={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,e,yt),i.updateRenderState({baseLayer:f}),t.setPixelRatio(1),t.setSize(f.framebufferWidth,f.framebufferHeight,!1),x=new bn(f.framebufferWidth,f.framebufferHeight,{format:Oe,type:dn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}x.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),Qt.setContext(i),Qt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function nt(Y){for(let et=0;et<Y.removed.length;et++){const yt=Y.removed[et],Pt=T.indexOf(yt);Pt>=0&&(T[Pt]=null,A[Pt].disconnect(yt))}for(let et=0;et<Y.added.length;et++){const yt=Y.added[et];let Pt=T.indexOf(yt);if(Pt===-1){for(let Zt=0;Zt<A.length;Zt++)if(Zt>=T.length){T.push(yt),Pt=Zt;break}else if(T[Zt]===null){T[Zt]=yt,Pt=Zt;break}if(Pt===-1)break}const Tt=A[Pt];Tt&&Tt.connect(yt)}}const H=new C,ut=new C;function _t(Y,et,yt){H.setFromMatrixPosition(et.matrixWorld),ut.setFromMatrixPosition(yt.matrixWorld);const Pt=H.distanceTo(ut),Tt=et.projectionMatrix.elements,Zt=yt.projectionMatrix.elements,ce=Tt[14]/(Tt[10]-1),P=Tt[14]/(Tt[10]+1),tt=(Tt[9]+1)/Tt[5],$=(Tt[9]-1)/Tt[5],J=(Tt[8]-1)/Tt[0],Z=(Zt[8]+1)/Zt[0],ct=ce*J,it=ce*Z,ht=Pt/(-J+Z),kt=ht*-J;if(et.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(kt),Y.translateZ(ht),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert(),Tt[10]===-1)Y.projectionMatrix.copy(et.projectionMatrix),Y.projectionMatrixInverse.copy(et.projectionMatrixInverse);else{const zt=ce+ht,w=P+ht,M=ct-kt,O=it+(Pt-kt),V=tt*P/w*zt,j=$*P/w*zt;Y.projectionMatrix.makePerspective(M,O,V,j,zt,w),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}}function St(Y,et){et===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(et.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let et=Y.near,yt=Y.far;g.texture!==null&&(g.depthNear>0&&(et=g.depthNear),g.depthFar>0&&(yt=g.depthFar)),F.near=S.near=b.near=et,F.far=S.far=b.far=yt,(z!==F.near||G!==F.far)&&(i.updateRenderState({depthNear:F.near,depthFar:F.far}),z=F.near,G=F.far),F.layers.mask=Y.layers.mask|6,b.layers.mask=F.layers.mask&3,S.layers.mask=F.layers.mask&5;const Pt=Y.parent,Tt=F.cameras;St(F,Pt);for(let Zt=0;Zt<Tt.length;Zt++)St(Tt[Zt],Pt);Tt.length===2?_t(F,b,S):F.projectionMatrix.copy(b.projectionMatrix),Gt(Y,F,Pt)};function Gt(Y,et,yt){yt===null?Y.matrix.copy(et.matrixWorld):(Y.matrix.copy(yt.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(et.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(et.projectionMatrix),Y.projectionMatrixInverse.copy(et.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=ps*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(Y){l=Y,d!==null&&(d.fixedFoveation=Y),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Y)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(F)},this.getCameraTexture=function(Y){return p[Y]};let $t=null;function se(Y,et){if(h=et.getViewerPose(c||a),m=et,h!==null){const yt=h.views;f!==null&&(t.setRenderTargetFramebuffer(x,f.framebuffer),t.setRenderTarget(x));let Pt=!1;yt.length!==F.cameras.length&&(F.cameras.length=0,Pt=!0);for(let P=0;P<yt.length;P++){const tt=yt[P];let $=null;if(f!==null)$=f.getViewport(tt);else{const Z=u.getViewSubImage(d,tt);$=Z.viewport,P===0&&(t.setRenderTargetTextures(x,Z.colorTexture,Z.depthStencilTexture),t.setRenderTarget(x))}let J=L[P];J===void 0&&(J=new Te,J.layers.enable(P),J.viewport=new te,L[P]=J),J.matrix.fromArray(tt.transform.matrix),J.matrix.decompose(J.position,J.quaternion,J.scale),J.projectionMatrix.fromArray(tt.projectionMatrix),J.projectionMatrixInverse.copy(J.projectionMatrix).invert(),J.viewport.set($.x,$.y,$.width,$.height),P===0&&(F.matrix.copy(J.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Pt===!0&&F.cameras.push(J)}const Tt=i.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){u=n.getBinding();const P=u.getDepthInformation(yt[0]);P&&P.isValid&&P.texture&&g.init(P,i.renderState)}if(Tt&&Tt.includes("camera-access")&&_){t.state.unbindTexture(),u=n.getBinding();for(let P=0;P<yt.length;P++){const tt=yt[P].camera;if(tt){let $=p[tt];$||($=new fc,p[tt]=$);const J=u.getCameraImage(tt);$.sourceTexture=J}}}}for(let yt=0;yt<A.length;yt++){const Pt=T[yt],Tt=A[yt];Pt!==null&&Tt!==void 0&&Tt.update(Pt,et,c||a)}$t&&$t(Y,et),et.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:et}),m=null}const Qt=new ff;Qt.setAnimationLoop(se),this.setAnimationLoop=function(Y){$t=Y},this.dispose=function(){}}}const vi=new tn,Wy=new Ot;function Xy(r,t){function e(g,p){g.matrixAutoUpdate===!0&&g.updateMatrix(),p.value.copy(g.matrix)}function n(g,p){p.color.getRGB(g.fogColor.value,hd(r)),p.isFog?(g.fogNear.value=p.near,g.fogFar.value=p.far):p.isFogExp2&&(g.fogDensity.value=p.density)}function i(g,p,y,v,x){p.isMeshBasicMaterial||p.isMeshLambertMaterial?s(g,p):p.isMeshToonMaterial?(s(g,p),u(g,p)):p.isMeshPhongMaterial?(s(g,p),h(g,p)):p.isMeshStandardMaterial?(s(g,p),d(g,p),p.isMeshPhysicalMaterial&&f(g,p,x)):p.isMeshMatcapMaterial?(s(g,p),m(g,p)):p.isMeshDepthMaterial?s(g,p):p.isMeshDistanceMaterial?(s(g,p),_(g,p)):p.isMeshNormalMaterial?s(g,p):p.isLineBasicMaterial?(a(g,p),p.isLineDashedMaterial&&o(g,p)):p.isPointsMaterial?l(g,p,y,v):p.isSpriteMaterial?c(g,p):p.isShadowMaterial?(g.color.value.copy(p.color),g.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function s(g,p){g.opacity.value=p.opacity,p.color&&g.diffuse.value.copy(p.color),p.emissive&&g.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.bumpMap&&(g.bumpMap.value=p.bumpMap,e(p.bumpMap,g.bumpMapTransform),g.bumpScale.value=p.bumpScale,p.side===Be&&(g.bumpScale.value*=-1)),p.normalMap&&(g.normalMap.value=p.normalMap,e(p.normalMap,g.normalMapTransform),g.normalScale.value.copy(p.normalScale),p.side===Be&&g.normalScale.value.negate()),p.displacementMap&&(g.displacementMap.value=p.displacementMap,e(p.displacementMap,g.displacementMapTransform),g.dis
vendor: 10,606 bytes, line 3840
3840placementScale.value=p.displacementScale,g.displacementBias.value=p.displacementBias),p.emissiveMap&&(g.emissiveMap.value=p.emissiveMap,e(p.emissiveMap,g.emissiveMapTransform)),p.specularMap&&(g.specularMap.value=p.specularMap,e(p.specularMap,g.specularMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest);const y=t.get(p),v=y.envMap,x=y.envMapRotation;v&&(g.envMap.value=v,vi.copy(x),vi.x*=-1,vi.y*=-1,vi.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(vi.y*=-1,vi.z*=-1),g.envMapRotation.value.setFromMatrix4(Wy.makeRotationFromEuler(vi)),g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,e(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,e(p.aoMap,g.aoMapTransform))}function a(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform))}function o(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,y,v){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*y,g.scale.value=v*.5,p.map&&(g.map.value=p.map,e(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,e(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,e(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function h(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function d(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,e(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,e(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function f(g,p,y){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,e(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,e(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,e(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,e(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,e(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===Be&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,e(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,e(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,e(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,e(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,e(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,e(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,e(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function _(g,p){const y=t.get(p).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function qy(r,t,e,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,v){const x=v.program;n.uniformBlockBinding(y,x)}function c(y,v){let x=i[y.id];x===void 0&&(m(y),x=h(y),i[y.id]=x,y.addEventListener("dispose",g));const A=v.program;n.updateUBOMapping(y,A);const T=t.render.frame;s[y.id]!==T&&(d(y),s[y.id]=T)}function h(y){const v=u();y.__bindingPointIndex=v;const x=r.createBuffer(),A=y.__size,T=y.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,A,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,v,x),x}function u(){for(let y=0;y<o;y++)if(a.indexOf(y)===-1)return a.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){const v=i[y.id],x=y.uniforms,A=y.__cache;r.bindBuffer(r.UNIFORM_BUFFER,v);for(let T=0,R=x.length;T<R;T++){const I=Array.isArray(x[T])?x[T]:[x[T]];for(let b=0,S=I.length;b<S;b++){const L=I[b];if(f(L,T,b,A)===!0){const F=L.__offset,z=Array.isArray(L.value)?L.value:[L.value];let G=0;for(let q=0;q<z.length;q++){const W=z[q],nt=_(W);typeof W=="number"||typeof W=="boolean"?(L.__data[0]=W,r.bufferSubData(r.UNIFORM_BUFFER,F+G,L.__data)):W.isMatrix3?(L.__data[0]=W.elements[0],L.__data[1]=W.elements[1],L.__data[2]=W.elements[2],L.__data[3]=0,L.__data[4]=W.elements[3],L.__data[5]=W.elements[4],L.__data[6]=W.elements[5],L.__data[7]=0,L.__data[8]=W.elements[6],L.__data[9]=W.elements[7],L.__data[10]=W.elements[8],L.__data[11]=0):(W.toArray(L.__data,G),G+=nt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,F,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(y,v,x,A){const T=y.value,R=v+"_"+x;if(A[R]===void 0)return typeof T=="number"||typeof T=="boolean"?A[R]=T:A[R]=T.clone(),!0;{const I=A[R];if(typeof T=="number"||typeof T=="boolean"){if(I!==T)return A[R]=T,!0}else if(I.equals(T)===!1)return I.copy(T),!0}return!1}function m(y){const v=y.uniforms;let x=0;const A=16;for(let R=0,I=v.length;R<I;R++){const b=Array.isArray(v[R])?v[R]:[v[R]];for(let S=0,L=b.length;S<L;S++){const F=b[S],z=Array.isArray(F.value)?F.value:[F.value];for(let G=0,q=z.length;G<q;G++){const W=z[G],nt=_(W),H=x%A,ut=H%nt.boundary,_t=H+ut;x+=ut,_t!==0&&A-_t<nt.storage&&(x+=A-_t),F.__data=new Float32Array(nt.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=x,x+=nt.storage}}}const T=x%A;return T>0&&(x+=A-T),y.__size=x,y.__cache={},this}function _(y){const v={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(v.boundary=4,v.storage=4):y.isVector2?(v.boundary=8,v.storage=8):y.isVector3||y.isColor?(v.boundary=16,v.storage=12):y.isVector4?(v.boundary=16,v.storage=16):y.isMatrix3?(v.boundary=48,v.storage=48):y.isMatrix4?(v.boundary=64,v.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),v}function g(y){const v=y.target;v.removeEventListener("dispose",g);const x=a.indexOf(v.__bindingPointIndex);a.splice(x,1),r.deleteBuffer(i[v.id]),delete i[v.id],delete s[v.id]}function p(){for(const y in i)r.deleteBuffer(i[y]);a=[],i={},s={}}return{bind:l,update:c,dispose:p}}class Yy{constructor(t={}){const{canvas:e=od(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1}=t;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=n.getContextAttributes().alpha}else f=a;const m=new Uint32Array(4),_=new Int32Array(4);let g=null,p=null;const y=[],v=[];this.domElement=e,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.toneMapping=Fn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const x=this;let A=!1;this._outputColorSpace=Ge;let T=0,R=0,I=null,b=-1,S=null;const L=new te,F=new te;let z=null;const G=new xt(0);let q=0,W=e.width,nt=e.height,H=1,ut=null,_t=null;const St=new te(0,0,W,nt),Gt=new te(0,0,W,nt);let $t=!1;const se=new Ms;let Qt=!1,Y=!1;const et=new Ot,yt=new C,Pt=new te,Tt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Zt=!1;function ce(){return I===null?H:1}let P=n;function tt(E,U){return e.getContext(E,U)}try{const E={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${so}`),e.addEventListener("webglcontextlost",dt,!1),e.addEventListener("webglcontextrestored",bt,!1),e.addEventListener("webglcontextcreationerror",rt,!1),P===null){const U="webgl2";if(P=tt(U,E),P===null)throw tt(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(E){throw console.error("THREE.WebGLRenderer: "+E.message),E}let $,J,Z,ct,it,ht,kt,zt,w,M,O,V,j,X,Rt,lt,At,wt,st,gt,Ft,It,pt,qt;function D(){$=new sv(P),$.init(),It=new xf(P,$),J=new Kx(P,$,t,It),Z=new By(P,$),J.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),ct=new ov(P),it=new Ty,ht=new zy(P,$,Z,it,J,It,ct),kt=new jx(x),zt=new iv(x),w=new f_(P),pt=new Jx(P,w),M=new rv(P,w,ct,pt),O=new cv(P,M,w,ct),st=ne
vendor: 12,751 bytes, line 3840
3840w lv(P,J,ht),lt=new Qx(it),V=new Ey(x,kt,zt,$,J,pt,lt),j=new Xy(x,it),X=new wy,Rt=new Dy($),wt=new Zx(x,kt,zt,Z,O,f,l),At=new Fy(x,O,J),qt=new qy(P,ct,J,Z),gt=new $x(P,$,ct),Ft=new av(P,$,ct),ct.programs=V.programs,x.capabilities=J,x.extensions=$,x.properties=it,x.renderLists=X,x.shadowMap=At,x.state=Z,x.info=ct}D();const ot=new Gy(x,P);this.xr=ot,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const E=$.get("WEBGL_lose_context");E&&E.loseContext()},this.forceContextRestore=function(){const E=$.get("WEBGL_lose_context");E&&E.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(E){E!==void 0&&(H=E,this.setSize(W,nt,!1))},this.getSize=function(E){return E.set(W,nt)},this.setSize=function(E,U,B=!0){if(ot.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}W=E,nt=U,e.width=Math.floor(E*H),e.height=Math.floor(U*H),B===!0&&(e.style.width=E+"px",e.style.height=U+"px"),this.setViewport(0,0,E,U)},this.getDrawingBufferSize=function(E){return E.set(W*H,nt*H).floor()},this.setDrawingBufferSize=function(E,U,B){W=E,nt=U,H=B,e.width=Math.floor(E*B),e.height=Math.floor(U*B),this.setViewport(0,0,E,U)},this.getCurrentViewport=function(E){return E.copy(L)},this.getViewport=function(E){return E.copy(St)},this.setViewport=function(E,U,B,k){E.isVector4?St.set(E.x,E.y,E.z,E.w):St.set(E,U,B,k),Z.viewport(L.copy(St).multiplyScalar(H).round())},this.getScissor=function(E){return E.copy(Gt)},this.setScissor=function(E,U,B,k){E.isVector4?Gt.set(E.x,E.y,E.z,E.w):Gt.set(E,U,B,k),Z.scissor(F.copy(Gt).multiplyScalar(H).round())},this.getScissorTest=function(){return $t},this.setScissorTest=function(E){Z.setScissorTest($t=E)},this.setOpaqueSort=function(E){ut=E},this.setTransparentSort=function(E){_t=E},this.getClearColor=function(E){return E.copy(wt.getClearColor())},this.setClearColor=function(){wt.setClearColor(...arguments)},this.getClearAlpha=function(){return wt.getClearAlpha()},this.setClearAlpha=function(){wt.setClearAlpha(...arguments)},this.clear=function(E=!0,U=!0,B=!0){let k=0;if(E){let N=!1;if(I!==null){const at=I.texture.format;N=at===uo||at===ho||at===dr}if(N){const at=I.texture.type,mt=at===dn||at===kn||at===cs||at===hs||at===oo||at===lo,Et=wt.getClearColor(),vt=wt.getClearAlpha(),Ut=Et.r,Bt=Et.g,Lt=Et.b;mt?(m[0]=Ut,m[1]=Bt,m[2]=Lt,m[3]=vt,P.clearBufferuiv(P.COLOR,0,m)):(_[0]=Ut,_[1]=Bt,_[2]=Lt,_[3]=vt,P.clearBufferiv(P.COLOR,0,_))}else k|=P.COLOR_BUFFER_BIT}U&&(k|=P.DEPTH_BUFFER_BIT),B&&(k|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),P.clear(k)},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(){e.removeEventListener("webglcontextlost",dt,!1),e.removeEventListener("webglcontextrestored",bt,!1),e.removeEventListener("webglcontextcreationerror",rt,!1),wt.dispose(),X.dispose(),Rt.dispose(),it.dispose(),kt.dispose(),zt.dispose(),O.dispose(),pt.dispose(),qt.dispose(),V.dispose(),ot.dispose(),ot.removeEventListener("sessionstart",mn),ot.removeEventListener("sessionend",Uc),si.stop()};function dt(E){E.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function bt(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;const E=ct.autoReset,U=At.enabled,B=At.autoUpdate,k=At.needsUpdate,N=At.type;D(),ct.autoReset=E,At.enabled=U,At.autoUpdate=B,At.needsUpdate=k,At.type=N}function rt(E){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",E.statusMessage)}function K(E){const U=E.target;U.removeEventListener("dispose",K),Ct(U)}function Ct(E){Vt(E),it.remove(E)}function Vt(E){const U=it.get(E).programs;U!==void 0&&(U.forEach(function(B){V.releaseProgram(B)}),E.isShaderMaterial&&V.releaseShaderCache(E))}this.renderBufferDirect=function(E,U,B,k,N,at){U===null&&(U=Tt);const mt=N.isMesh&&N.matrixWorld.determinant()<0,Et=vf(E,U,B,k,N);Z.setMaterial(k,mt);let vt=B.index,Ut=1;if(k.wireframe===!0){if(vt=M.getWireframeAttribute(B),vt===void 0)return;Ut=2}const Bt=B.drawRange,Lt=B.attributes.position;let Jt=Bt.start*Ut,ae=(Bt.start+Bt.count)*Ut;at!==null&&(Jt=Math.max(Jt,at.start*Ut),ae=Math.min(ae,(at.start+at.count)*Ut)),vt!==null?(Jt=Math.max(Jt,0),ae=Math.min(ae,vt.count)):Lt!=null&&(Jt=Math.max(Jt,0),ae=Math.min(ae,Lt.count));const me=ae-Jt;if(me<0||me===1/0)return;pt.setup(N,k,Et,B,vt);let ue,le=gt;if(vt!==null&&(ue=w.get(vt),le=Ft,le.setIndex(ue)),N.isMesh)k.wireframe===!0?(Z.setLineWidth(k.wireframeLinewidth*ce()),le.setMode(P.LINES)):le.setMode(P.TRIANGLES);else if(N.isLine){let Dt=k.linewidth;Dt===void 0&&(Dt=1),Z.setLineWidth(Dt*ce()),N.isLineSegments?le.setMode(P.LINES):N.isLineLoop?le.setMode(P.LINE_LOOP):le.setMode(P.LINE_STRIP)}else N.isPoints?le.setMode(P.POINTS):N.isSprite&&le.setMode(P.TRIANGLES);if(N.isBatchedMesh)if(N._multiDrawInstances!==null)ir("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),le.renderMultiDrawInstances(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount,N._multiDrawInstances);else if($.get("WEBGL_multi_draw"))le.renderMultiDraw(N._multiDrawStarts,N._multiDrawCounts,N._multiDrawCount);else{const Dt=N._multiDrawStarts,de=N._multiDrawCounts,ne=N._multiDrawCount,Ze=vt?w.get(vt).bytesPerElement:1,Fi=it.get(k).currentProgram.getUniforms();for(let Je=0;Je<ne;Je++)Fi.setValue(P,"_gl_DrawID",Je),le.render(Dt[Je]/Ze,de[Je])}else if(N.isInstancedMesh)le.renderInstances(Jt,me,N.count);else if(B.isInstancedBufferGeometry){const Dt=B._maxInstanceCount!==void 0?B._maxInstanceCount:1/0,de=Math.min(B.instanceCount,Dt);le.renderInstances(Jt,me,de)}else le.render(Jt,me)};function he(E,U,B){E.transparent===!0&&E.side===vn&&E.forceSinglePass===!1?(E.side=Be,E.needsUpdate=!0,Mr(E,U,B),E.side=Bn,E.needsUpdate=!0,Mr(E,U,B),E.side=vn):Mr(E,U,B)}this.compile=function(E,U,B=null){B===null&&(B=E),p=Rt.get(B),p.init(U),v.push(p),B.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),E!==B&&E.traverseVisible(function(N){N.isLight&&N.layers.test(U.layers)&&(p.pushLight(N),N.castShadow&&p.pushShadow(N))}),p.setupLights();const k=new Set;return E.traverse(function(N){if(!(N.isMesh||N.isPoints||N.isLine||N.isSprite))return;const at=N.material;if(at)if(Array.isArray(at))for(let mt=0;mt<at.length;mt++){const Et=at[mt];he(Et,B,N),k.add(Et)}else he(at,B,N),k.add(at)}),p=v.pop(),k},this.compileAsync=function(E,U,B=null){const k=this.compile(E,U,B);return new Promise(N=>{function at(){if(k.forEach(function(mt){it.get(mt).currentProgram.isReady()&&k.delete(mt)}),k.size===0){N(E);return}setTimeout(at,10)}$.get("KHR_parallel_shader_compile")!==null?at():setTimeout(at,10)})};let ie=null;function An(E){ie&&ie(E)}function mn(){si.stop()}function Uc(){si.start()}const si=new ff;si.setAnimationLoop(An),typeof self<"u"&&si.setContext(self),this.setAnimationLoop=function(E){ie=E,ot.setAnimationLoop(E),E===null?si.stop():si.start()},ot.addEventListener("sessionstart",mn),ot.addEventListener("sessionend",Uc),this.render=function(E,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(E.matrixWorldAutoUpdate===!0&&E.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),ot.enabled===!0&&ot.isPresenting===!0&&(ot.cameraAutoUpdate===!0&&ot.updateCamera(U),U=ot.getCamera()),E.isScene===!0&&E.onBeforeRender(x,E,U,I),p=Rt.get(E,v.length),p.init(U),v.push(p),et.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),se.setFromProjectionMatrix(et,Qe,U.reversedDepth),Y=this.localClippingEnabled,Qt=lt.init(this.clippingPlanes,Y),g=X.get(E,y.length),g.init(),y.push(g),ot.enabled===!0&&ot.isPresenting===!0){const at=x.xr.getDepthSensingMesh();at!==null&&ko(at,U,-1/0,x.sortObjects)}ko(E,U,0,x.sortObjects),g.finish(),x.sortObjects===!0&&g.sort(ut,_t),Zt=ot.enabled===!1||ot.isPresenting===!1||ot.hasDepthSensing()===!1,Zt&&wt.addToRenderList(g,E),this.info.render.frame++,Qt===!0&&lt.beginShadows();const B=p.state.shadowsArray;At.render(B,E,U),Qt===!0&&lt.endShadows(),this.info.autoReset===!0&&this.info.reset();const k=g.opaque,N=g.transmissive;if(p.setupLights(),U.isArrayCamera){const at=U.cameras;if(N.length>0)for(let mt=0,Et=at.length;mt<Et;mt++){const vt=at[mt];Fc(k,N,E,vt)}Zt&&wt.render(E);for(let mt=0,Et=at.length;mt<Et;mt++){const vt=at[mt];Nc(g,E,vt,vt.viewport)}}else N.length>0&&Fc(k,N,E,U),Zt&&wt.render(E),Nc(g,E,U);I!==null&&R===0&&(ht.updateMultisampleRenderTarget(I),ht.updateRenderTargetMipmap(I)),E.isScene===!0&&E.onAfterRender(x,E,U),pt.resetDefaultState(),b=-1,S=null,v.pop(),v.length>0?(p=v[v.length-1],Qt===!0&&lt.setGlobalState(x.clippingPlanes,p.state.camera)):p=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function ko(E,U,B,k){if(E.visible===!1)return;if(E.layers.test(U.layers)){if(E.isGroup)B=E.renderOrder;else if(E.isLOD)E.autoUpdate===!0&&E.update(U);else if(E.isLight)p.pushLight(E),E.castShadow&&p.pushShadow(E);else if(E.isSprite){if(!E.frustumCulled||se.intersectsSprite(E)){k&&Pt.setFromMatrixPosition(E.matrixWorld).applyMatrix4(et);const mt=O.update(E),Et=E.material;Et.visible&&g.push(E,mt,Et,B,Pt.z,null)}}else if((E.isMesh||E.isLine||E.isPoints)&&(!E.frustumCulled||se.intersectsObject(E))){const mt=O.update(E),Et=E.material;if(k&&(E.boundingSphere!==void 0?(E.boundingSphere===null&&E.computeBoundingSphere(),Pt.copy(E.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),Pt.copy(mt.boundingSphere.center)),Pt.applyMatrix4(E.matrixWorld).applyMatrix4(et)),Array.isArray(Et)){const vt=mt.groups;for(let Ut=0,Bt=vt.length;Ut<Bt;Ut++){const Lt=vt[Ut],Jt=Et[Lt.materialIndex];Jt&&Jt.visible&&g.push(E,mt,Jt,B,Pt.z,Lt)}}else Et.visible&&g.push(E,mt,Et,B,Pt.z,null)}}const at=E.children;for(let mt=0,Et=at.length;mt<Et;mt++)ko(at[mt],U,B,k)}function Nc(E,U,B,k){const N=E.opaque,at=E.transmissive,mt=E.transparent;p.setupLightsView(B),Qt===!0&&lt.setGlobalState(x.clippingPlanes,B),k&&Z.viewport(L.copy(k)),N.length>0&&yr(N,U,B),at.length>0&&yr(at,U,B),mt.length>0&&yr(mt,U,B),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Fc(E,U,B,k){if((B.isScene===!0?B.overrideMaterial:null)!==null)return;p.state.transmissionRenderTarget[k.id]===void 0&&(p.state.transmissionRenderTarget[k.id]=new bn(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")||$.has("EXT_color_buffer_float")?vs:dn,minFilter:yn,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kt.workingColorSpace}));const at=p.state.transmissionRenderTarget[k.id],mt=k.viewport||L;at.setSize(mt.z*x.transmissionResolutionScale,mt.w*x.transmissionResolutionScale);const Et=x.getRenderTarget(),vt=x.getActiveCubeFace(),Ut=x.getActiveMipmapLevel();x.setRenderTarget(at),x.getClearColor(G),q=x.getClearAlpha(),q<1&&x.setClearColor(16777215,.5),x.clear(),Zt&&wt.render(B);const Bt=x.toneMapping;x.toneMapping=Fn;const Lt=k.viewport;if(k.viewport!==void 0&&(k.viewport=void 0),p.setupLightsView(k),Qt===!0&&lt.setGlobalState(x.clippingPlanes,k),yr(E,B,k),ht.updateMultisampleRenderTarget(at),ht.updateRenderTargetMipmap(at),$.has("WEBGL_multisampled_render_to_texture")===!1){let Jt=!1;for(let ae=0,me=U.length;ae<me;ae++){const ue=U[ae],le=ue.object,Dt=ue.geometry,de=ue.material,ne=ue.group;if(de.side===vn&&le.layers.test(k.layers)){const Ze=de.side;de.side=Be,de.needsUpdate=!0,Oc(le,B,k,Dt,de,ne),de.side=Ze,de.needsUpdate=!0,Jt=!0}}Jt===!0&&(ht.updateMultisampleRenderTarget(at),ht.updateRenderTargetMipmap(at))}x.setRenderTarget(Et,vt,Ut),x.setClearColor(G,q),Lt!==void 0&&(k.viewport=Lt),x.toneMapping=Bt}function yr(E,U,B){const k=U.isScene===!0?U.overrideMaterial:null;for(let N=0,at=E.length;N<at;N++){const mt=E[N],Et=mt.object,vt=mt.geometry,Ut=mt.group;let Bt=mt.material;Bt.allowOverride===!0&&k!==null&&(Bt=k),Et.layers.test(B.layers)&&Oc(Et,U,B,vt,Bt,Ut)}}function Oc(E,U,B,k,N,at){E.onBeforeRender(x,U,B,k,N,at),E.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,E.matrixWorld),E.normalMatrix.getNormalMatrix(E.modelViewMatrix),N.onBeforeRender(x,U,B,k,E,at),N.transparent===!0&&N.side===vn&&N.forceSinglePass===!1?(N.side=Be,N.needsUpdate=!0,x.renderBufferDirect(B,U,k,N,E,at),N.side=Bn,N.needsUpdate=!0,x.renderBufferDirect(B,U,k,N,E,at),N.side=vn):x.renderBufferDirect(B,U,k,N,E,at),E.onAfterRender(x,U,B,k,N,at)}function Mr(E,U,B){U.isScene!==!0&&(U=Tt);const k=it.get(E),N=p.state.lights,at=p.state.shadowsArray,mt=N.state.ver
vendor: 21,654 bytes, line 3840
3840sion,Et=V.getParameters(E,N.state,at,U,B),vt=V.getProgramCacheKey(Et);let Ut=k.programs;k.environment=E.isMeshStandardMaterial?U.environment:null,k.fog=U.fog,k.envMap=(E.isMeshStandardMaterial?zt:kt).get(E.envMap||k.environment),k.envMapRotation=k.environment!==null&&E.envMap===null?U.environmentRotation:E.envMapRotation,Ut===void 0&&(E.addEventListener("dispose",K),Ut=new Map,k.programs=Ut);let Bt=Ut.get(vt);if(Bt!==void 0){if(k.currentProgram===Bt&&k.lightsStateVersion===mt)return zc(E,Et),Bt}else Et.uniforms=V.getUniforms(E),E.onBeforeCompile(Et,x),Bt=V.acquireProgram(Et,vt),Ut.set(vt,Bt),k.uniforms=Et.uniforms;const Lt=k.uniforms;return(!E.isShaderMaterial&&!E.isRawShaderMaterial||E.clipping===!0)&&(Lt.clippingPlanes=lt.uniform),zc(E,Et),k.needsLights=Mf(E),k.lightsStateVersion=mt,k.needsLights&&(Lt.ambientLightColor.value=N.state.ambient,Lt.lightProbe.value=N.state.probe,Lt.directionalLights.value=N.state.directional,Lt.directionalLightShadows.value=N.state.directionalShadow,Lt.spotLights.value=N.state.spot,Lt.spotLightShadows.value=N.state.spotShadow,Lt.rectAreaLights.value=N.state.rectArea,Lt.ltc_1.value=N.state.rectAreaLTC1,Lt.ltc_2.value=N.state.rectAreaLTC2,Lt.pointLights.value=N.state.point,Lt.pointLightShadows.value=N.state.pointShadow,Lt.hemisphereLights.value=N.state.hemi,Lt.directionalShadowMap.value=N.state.directionalShadowMap,Lt.directionalShadowMatrix.value=N.state.directionalShadowMatrix,Lt.spotShadowMap.value=N.state.spotShadowMap,Lt.spotLightMatrix.value=N.state.spotLightMatrix,Lt.spotLightMap.value=N.state.spotLightMap,Lt.pointShadowMap.value=N.state.pointShadowMap,Lt.pointShadowMatrix.value=N.state.pointShadowMatrix),k.currentProgram=Bt,k.uniformsList=null,Bt}function Bc(E){if(E.uniformsList===null){const U=E.currentProgram.getUniforms();E.uniformsList=ma.seqWithValue(U.seq,E.uniforms)}return E.uniformsList}function zc(E,U){const B=it.get(E);B.outputColorSpace=U.outputColorSpace,B.batching=U.batching,B.batchingColor=U.batchingColor,B.instancing=U.instancing,B.instancingColor=U.instancingColor,B.instancingMorph=U.instancingMorph,B.skinning=U.skinning,B.morphTargets=U.morphTargets,B.morphNormals=U.morphNormals,B.morphColors=U.morphColors,B.morphTargetsCount=U.morphTargetsCount,B.numClippingPlanes=U.numClippingPlanes,B.numIntersection=U.numClipIntersection,B.vertexAlphas=U.vertexAlphas,B.vertexTangents=U.vertexTangents,B.toneMapping=U.toneMapping}function vf(E,U,B,k,N){U.isScene!==!0&&(U=Tt),ht.resetTextureUnits();const at=U.fog,mt=k.isMeshStandardMaterial?U.environment:null,Et=I===null?x.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:Ii,vt=(k.isMeshStandardMaterial?zt:kt).get(k.envMap||mt),Ut=k.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,Bt=!!B.attributes.tangent&&(!!k.normalMap||k.anisotropy>0),Lt=!!B.morphAttributes.position,Jt=!!B.morphAttributes.normal,ae=!!B.morphAttributes.color;let me=Fn;k.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(me=x.toneMapping);const ue=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,le=ue!==void 0?ue.length:0,Dt=it.get(k),de=p.state.lights;if(Qt===!0&&(Y===!0||E!==S)){const De=E===S&&k.id===b;lt.setState(k,E,De)}let ne=!1;k.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==de.state.version||Dt.outputColorSpace!==Et||N.isBatchedMesh&&Dt.batching===!1||!N.isBatchedMesh&&Dt.batching===!0||N.isBatchedMesh&&Dt.batchingColor===!0&&N.colorTexture===null||N.isBatchedMesh&&Dt.batchingColor===!1&&N.colorTexture!==null||N.isInstancedMesh&&Dt.instancing===!1||!N.isInstancedMesh&&Dt.instancing===!0||N.isSkinnedMesh&&Dt.skinning===!1||!N.isSkinnedMesh&&Dt.skinning===!0||N.isInstancedMesh&&Dt.instancingColor===!0&&N.instanceColor===null||N.isInstancedMesh&&Dt.instancingColor===!1&&N.instanceColor!==null||N.isInstancedMesh&&Dt.instancingMorph===!0&&N.morphTexture===null||N.isInstancedMesh&&Dt.instancingMorph===!1&&N.morphTexture!==null||Dt.envMap!==vt||k.fog===!0&&Dt.fog!==at||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==lt.numPlanes||Dt.numIntersection!==lt.numIntersection)||Dt.vertexAlphas!==Ut||Dt.vertexTangents!==Bt||Dt.morphTargets!==Lt||Dt.morphNormals!==Jt||Dt.morphColors!==ae||Dt.toneMapping!==me||Dt.morphTargetsCount!==le)&&(ne=!0):(ne=!0,Dt.__version=k.version);let Ze=Dt.currentProgram;ne===!0&&(Ze=Mr(k,U,N));let Fi=!1,Je=!1,Es=!1;const fe=Ze.getUniforms(),en=Dt.uniforms;if(Z.useProgram(Ze.program)&&(Fi=!0,Je=!0,Es=!0),k.id!==b&&(b=k.id,Je=!0),Fi||S!==E){Z.buffers.depth.getReversed()&&E.reversedDepth!==!0&&(E._reversedDepth=!0,E.updateProjectionMatrix()),fe.setValue(P,"projectionMatrix",E.projectionMatrix),fe.setValue(P,"viewMatrix",E.matrixWorldInverse);const ke=fe.map.cameraPosition;ke!==void 0&&ke.setValue(P,yt.setFromMatrixPosition(E.matrixWorld)),J.logarithmicDepthBuffer&&fe.setValue(P,"logDepthBufFC",2/(Math.log(E.far+1)/Math.LN2)),(k.isMeshPhongMaterial||k.isMeshToonMaterial||k.isMeshLambertMaterial||k.isMeshBasicMaterial||k.isMeshStandardMaterial||k.isShaderMaterial)&&fe.setValue(P,"isOrthographic",E.isOrthographicCamera===!0),S!==E&&(S=E,Je=!0,Es=!0)}if(N.isSkinnedMesh){fe.setOptional(P,N,"bindMatrix"),fe.setOptional(P,N,"bindMatrixInverse");const De=N.skeleton;De&&(De.boneTexture===null&&De.computeBoneTexture(),fe.setValue(P,"boneTexture",De.boneTexture,ht))}N.isBatchedMesh&&(fe.setOptional(P,N,"batchingTexture"),fe.setValue(P,"batchingTexture",N._matricesTexture,ht),fe.setOptional(P,N,"batchingIdTexture"),fe.setValue(P,"batchingIdTexture",N._indirectTexture,ht),fe.setOptional(P,N,"batchingColorTexture"),N._colorsTexture!==null&&fe.setValue(P,"batchingColorTexture",N._colorsTexture,ht));const nn=B.morphAttributes;if((nn.position!==void 0||nn.normal!==void 0||nn.color!==void 0)&&st.update(N,B,Ze),(Je||Dt.receiveShadow!==N.receiveShadow)&&(Dt.receiveShadow=N.receiveShadow,fe.setValue(P,"receiveShadow",N.receiveShadow)),k.isMeshGouraudMaterial&&k.envMap!==null&&(en.envMap.value=vt,en.flipEnvMap.value=vt.isCubeTexture&&vt.isRenderTargetTexture===!1?-1:1),k.isMeshStandardMaterial&&k.envMap===null&&U.environment!==null&&(en.envMapIntensity.value=U.environmentIntensity),Je&&(fe.setValue(P,"toneMappingExposure",x.toneMappingExposure),Dt.needsLights&&yf(en,Es),at&&k.fog===!0&&j.refreshFogUniforms(en,at),j.refreshMaterialUniforms(en,k,H,nt,p.state.transmissionRenderTarget[E.id]),ma.upload(P,Bc(Dt),en,ht)),k.isShaderMaterial&&k.uniformsNeedUpdate===!0&&(ma.upload(P,Bc(Dt),en,ht),k.uniformsNeedUpdate=!1),k.isSpriteMaterial&&fe.setValue(P,"center",N.center),fe.setValue(P,"modelViewMatrix",N.modelViewMatrix),fe.setValue(P,"normalMatrix",N.normalMatrix),fe.setValue(P,"modelMatrix",N.matrixWorld),k.isShaderMaterial||k.isRawShaderMaterial){const De=k.uniformsGroups;for(let ke=0,Vo=De.length;ke<Vo;ke++){const ri=De[ke];qt.update(ri,Ze),qt.bind(ri,Ze)}}return Ze}function yf(E,U){E.ambientLightColor.needsUpdate=U,E.lightProbe.needsUpdate=U,E.directionalLights.needsUpdate=U,E.directionalLightShadows.needsUpdate=U,E.pointLights.needsUpdate=U,E.pointLightShadows.needsUpdate=U,E.spotLights.needsUpdate=U,E.spotLightShadows.needsUpdate=U,E.rectAreaLights.needsUpdate=U,E.hemisphereLights.needsUpdate=U}function Mf(E){return E.isMeshLambertMaterial||E.isMeshToonMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isShadowMaterial||E.isShaderMaterial&&E.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(E,U,B){const k=it.get(E);k.__autoAllocateDepthBuffer=E.resolveDepthBuffer===!1,k.__autoAllocateDepthBuffer===!1&&(k.__useRenderToTexture=!1),it.get(E.texture).__webglTexture=U,it.get(E.depthTexture).__webglTexture=k.__autoAllocateDepthBuffer?void 0:B,k.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(E,U){const B=it.get(E);B.__webglFramebuffer=U,B.__useDefaultFramebuffer=U===void 0};const Sf=P.createFramebuffer();this.setRenderTarget=function(E,U=0,B=0){I=E,T=U,R=B;let k=!0,N=null,at=!1,mt=!1;if(E){const vt=it.get(E);if(vt.__useDefaultFramebuffer!==void 0)Z.bindFramebuffer(P.FRAMEBUFFER,null),k=!1;else if(vt.__webglFramebuffer===void 0)ht.setupRenderTarget(E);else if(vt.__hasExternalTextures)ht.rebindTextures(E,it.get(E.texture).__webglTexture,it.get(E.depthTexture).__webglTexture);else if(E.depthBuffer){const Lt=E.depthTexture;if(vt.__boundDepthTexture!==Lt){if(Lt!==null&&it.has(Lt)&&(E.width!==Lt.image.width||E.height!==Lt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ht.setupDepthRenderbuffer(E)}}const Ut=E.texture;(Ut.isData3DTexture||Ut.isDataArrayTexture||Ut.isCompressedArrayTexture)&&(mt=!0);const Bt=it.get(E).__webglFramebuffer;E.isWebGLCubeRenderTarget?(Array.isArray(Bt[U])?N=Bt[U][B]:N=Bt[U],at=!0):E.samples>0&&ht.useMultisampledRTT(E)===!1?N=it.get(E).__webglMultisampledFramebuffer:Array.isArray(Bt)?N=Bt[B]:N=Bt,L.copy(E.viewport),F.copy(E.scissor),z=E.scissorTest}else L.copy(St).multiplyScalar(H).floor(),F.copy(Gt).multiplyScalar(H).floor(),z=$t;if(B!==0&&(N=Sf),Z.bindFramebuffer(P.FRAMEBUFFER,N)&&k&&Z.drawBuffers(E,N),Z.viewport(L),Z.scissor(F),Z.setScissorTest(z),at){const vt=it.get(E.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+U,vt.__webglTexture,B)}else if(mt){const vt=U;for(let Ut=0;Ut<E.textures.length;Ut++){const Bt=it.get(E.textures[Ut]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Ut,Bt.__webglTexture,B,vt)}}else if(E!==null&&B!==0){const vt=it.get(E.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,vt.__webglTexture,B)}b=-1},this.readRenderTargetPixels=function(E,U,B,k,N,at,mt,Et=0){if(!(E&&E.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let vt=it.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt){Z.bindFramebuffer(P.FRAMEBUFFER,vt);try{const Ut=E.textures[Et],Bt=Ut.format,Lt=Ut.type;if(!J.textureFormatReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!J.textureTypeReadable(Lt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=E.width-k&&B>=0&&B<=E.height-N&&(E.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+Et),P.readPixels(U,B,k,N,It.convert(Bt),It.convert(Lt),at))}finally{const Ut=I!==null?it.get(I).__webglFramebuffer:null;Z.bindFramebuffer(P.FRAMEBUFFER,Ut)}}},this.readRenderTargetPixelsAsync=async function(E,U,B,k,N,at,mt,Et=0){if(!(E&&E.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let vt=it.get(E).__webglFramebuffer;if(E.isWebGLCubeRenderTarget&&mt!==void 0&&(vt=vt[mt]),vt)if(U>=0&&U<=E.width-k&&B>=0&&B<=E.height-N){Z.bindFramebuffer(P.FRAMEBUFFER,vt);const Ut=E.textures[Et],Bt=Ut.format,Lt=Ut.type;if(!J.textureFormatReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!J.textureTypeReadable(Lt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Jt=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Jt),P.bufferData(P.PIXEL_PACK_BUFFER,at.byteLength,P.STREAM_READ),E.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+Et),P.readPixels(U,B,k,N,It.convert(Bt),It.convert(Lt),0);const ae=I!==null?it.get(I).__webglFramebuffer:null;Z.bindFramebuffer(P.FRAMEBUFFER,ae);const me=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Rp(P,me,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,Jt),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,at),P.deleteBuffer(Jt),P.deleteSync(me),at}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(E,U=null,B=0){const k=Math.pow(2,-B),N=Math.floor(E.image.width*k),at=Math.floor(E.image.height*k),mt=U!==null?U.x:0,Et=U!==null?U.y:0;ht.setTexture2D(E,0),P.copyTexSubImage2D(P.TEXTURE_2D,B,0,0,mt,Et,N,at),Z.unbindTexture()};const bf=P.createFramebuffer(),Ef=P.createFramebuffer();this.copyTextureToTexture=function(E,U,B=null,k=null,N=0,at=null){at===null&&(N!==0?(ir("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),at=N,N=0):at=0);let mt,Et,vt,Ut,Bt,Lt,Jt,ae,me;const ue=E.isCompressedTexture?E.mipmaps[at]:E.image;if(B!==null)mt=B.max.x-B.min.x,Et=B.max.y-B.min.y,vt=B.isBox3?B.max.z-B.min.z:1,Ut=B.min.x,Bt=B.min.y,Lt=B.isBox3?B.min.z:0;else{const nn=Math.pow(2,-N);mt=Math.floor(ue.width*nn),Et=Math.floor(ue.height*nn),E.isDataArrayTexture?vt=ue.depth:E.isData3DTexture?vt=Math.floor(ue.depth*nn):vt=1,Ut=0,Bt=0,Lt=0}k!==null?(Jt=k.x,ae=k.y,me=k.z):(Jt=0,ae=0,me=0);const le=It.convert(U.format),Dt=It.convert(U.type);let de;U.isData3DTexture?(ht.setTexture3D(U,0),de=P.TEXTURE_3D):U.isDataArrayTexture||U.isCompressedArrayTexture?(ht.setTexture2DArray(U,0),de=P.TEXTURE_2D_ARRAY):(ht.setTexture2D(U,0),de=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,U.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,U.unpackAlignment);const ne=P.getParameter(P.UNPACK_ROW_LENGTH),Ze=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Fi=P.getParameter(P.UNPACK_SKIP_PIXELS),Je=P.getParameter(P.UNPACK_SKIP_ROWS),Es=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,ue.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,ue.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Ut),P.pixelStorei(P.UNPACK_SKIP_ROWS,Bt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Lt);const fe=E.isDataArrayTexture||E.isData3DTexture,en=U.isDataArrayTexture||U.isData3DTexture;if(E.isDepthTexture){const nn=it.get(E),De=it.get(U),ke=it.get(nn.__renderTarget),Vo=it.get(De.__renderTarget);Z.bindFramebuffer(P.READ_FRAMEBUFFER,ke.__webglFramebuffer),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,Vo.__webglFramebuffer);for(let ri=0;ri<vt;ri++)fe&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,it.get(E).__webglTexture,N,Lt+ri),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,it.get(U).__webglTexture,at,me+ri)),P.blitFramebuffer(Ut,Bt,mt,Et,Jt,ae,mt,Et,P.DEPTH_BUFFER_BIT,P.NEAREST);Z.bindFramebuffer(P.READ_FRAMEBUFFER,null),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(N!==0||E.isRenderTargetTexture||it.has(E)){const nn=it.get(E),De=it.get(U);Z.bindFramebuffer(P.READ_FRAMEBUFFER,bf),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,Ef);for(let ke=0;ke<vt;ke++)fe?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,nn.__webglTexture,N,Lt+ke):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,nn.__webglTexture,N),en?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,De.__webglTexture,at,me+ke):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,De.__webglTexture,at),N!==0?P.blitFramebuffer(Ut,Bt,mt,Et,Jt,ae,mt,Et,P.COLOR_BUFFER_BIT,P.NEAREST):en?P.copyTexSubImage3D(de,at,Jt,ae,me+ke,Ut,Bt,mt,Et):P.copyTexSubImage2D(de,at,Jt,ae,Ut,Bt,mt,Et);Z.bindFramebuffer(P.READ_FRAMEBUFFER,null),Z.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else en?E.isDataTexture||E.isData3DTexture?P.texSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,Dt,ue.data):U.isCompressedArrayTexture?P.compressedTexSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,ue.data):P.texSubImage3D(de,at,Jt,ae,me,mt,Et,vt,le,Dt,ue):E.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,at,Jt,ae,mt,Et,le,Dt,ue.data):E.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,at,Jt,ae,ue.width,ue.height,le,ue.data):P.texSubImage2D(P.TEXTURE_2D,at,Jt,ae,mt,Et,le,Dt,ue);P.pixelStorei(P.UNPACK_ROW_LENGTH,ne),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Ze),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Fi),P.pixelStorei(P.UNPACK_SKIP_ROWS,Je),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Es),at===0&&U.generateMipmaps&&P.generateMipmap(de),Z.unbindTexture()},this.initRenderTarget=function(E){it.get(E).__webglFramebuffer===void 0&&ht.setupRenderTarget(E)},this.initTexture=function(E){E.isCubeTexture?ht.setTextureCube(E,0):E.isData3DTexture?ht.setTexture3D(E,0):E.isDataArrayTexture||E.isCompressedArrayTexture?ht.setTexture2DArray(E,0):ht.setTexture2D(E,0),Z.unbindTexture()},this.resetState=function(){T=0,R=0,I=null,Z.reset(),pt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qe}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Kt._getDrawingBufferColorSpace(t),e.unpackColorSpace=Kt._getUnpackColorSpace()}}const Zy=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Hu,AddEquation:$n,AddOperation:Bu,AdditiveAnimationBlendMode:ic,AdditiveBlending:Dl,AgXToneMapping:Wu,AlphaFormat:tc,AlwaysCompare:rd,AlwaysDepth:va,AlwaysStencilFunc:Ol,AmbientLight:tf,AnimationAction:uf,AnimationClip:cr,AnimationLoader:ng,AnimationMixer:Pg,AnimationObjectGroup:Rg,AnimationUtils:Qm,ArcCurve:Td,ArrayCamera:of,ArrowHelper:s_,AttachedBindMode:Fl,Audio:cf,AudioAnalyser:vg,AudioContext:Cc,AudioListener:gg,AudioLoader:fg,AxesHelper:r_,BackSide:Be,BasicDepthPacking:$u,BasicShadowMap:Cf,BatchedMesh:yd,Bone:hc,BooleanKeyframeTrack:Ui,Box2:Hg,Box3:Pe,Box3Helper:n_,BoxGeometry:Di,BoxHelper:e_,BufferAttribute:oe,BufferGeometry:Xt,BufferGeometryLoader:af,ByteType:$l,Cache:Mn,Camera:_o,CameraHelper:t_,CanvasTexture:Mm,CapsuleGeometry:Eo,CatmullRomCurve3:Ad,CineonToneMapping:Vu,CircleGeometry:To,ClampToEdgeWrapping:rn,Clock:lf,Color:xt,ColorKeyframeTrack:Tc,ColorManagement:Kt,CompressedArrayTexture:vm,CompressedCubeTexture:ym,CompressedTexture:bo,CompressedTextureLoader:ig,ConeGeometry:mr,ConstantAlphaFactor:Nu,ConstantColorFactor:Du,Controls:o_,CubeCamera:dd,CubeReflectionMapping:zn,CubeRefractionMapping:Qn,CubeTexture:fr,CubeTextureLoader:sg,CubeUVReflectionMapping:xs,CubicBezierCurve:mc,CubicBezierCurve3:wd,CubicInterpolant:qd,CullFaceBack:Ll,CullFaceFront:_u,CullFaceFrontBack:wf,CullFaceNone:gu,Curve:pn,CurvePath:Rd,CustomBlending:vu,CustomToneMapping:Gu,CylinderGeometry:pr,Cylindrical:Vg,Data3DTexture:mo,DataArrayTexture:po,DataTexture:Sn,DataTextureLoader:rg,DataUtils:Wp,DecrementStencilOp:Hf,DecrementWrapStencilOp:Wf,DefaultLoadingManager:Jd,DepthFormat:us,DepthStencilFormat:ds,DepthTexture:dc,DetachedBindMode:qu,DirectionalLight:jd,DirectionalLightHelper:jg,DiscreteInterpolant:Yd,DodecahedronGeometry:Ao,DoubleSide:vn,DstAlphaFactor:Cu,DstColorFactor:Iu,DynamicCopyUsage:rp,DynamicDrawUsage:jf,DynamicReadUsage:np,EdgesGeometry:Ed,EllipseCurve:wo,EqualCompare:ed,EqualDepth:Ma,EqualStencilFunc:Zf,EquirectangularReflectionMapping:Zs,EquirectangularRefractionMapping:Js,Euler:tn,EventDispatcher:En,ExternalTexture:fc,ExtrudeGeometry:Co,FileLoader:Vn,Float16BufferAttribute:Kp,Float32BufferAttribute:Mt,FloatType:Xe,Fog:vo,FogExp2:xo,FramebufferTexture:xm,FrontSide:Bn,Frustum:Ms,FrustumArray:So,GLBufferAttribute:Fg,GLSL1:op,GLSL3:Bl,GreaterCompare:nd,GreaterDepth:ba,GreaterEqualCompare:sd,GreaterEqualDepth:Sa,GreaterEqualStencilFunc:Qf,GreaterStencilFunc:$f,GridHelper:Kg,Group:as,HalfFloatType:vs,HemisphereLight:$d,HemisphereLightHelper:$g,IcosahedronGeometry:Ro,ImageBitmapLoader:dg,ImageLoader:hr,ImageUtils:ld,IncrementStencilOp:Vf,IncrementWrapStencilOp:Gf,InstancedBufferAttribute:gs,InstancedBufferGeometry:rf,InstancedInterleavedBuffer:Ng,InstancedMesh:vd,Int16BufferAttribute:Jp,Int32BufferAttribute:$p,Int8BufferAttribute:qp,IntType:ao,InterleavedBuffer:yo,InterleavedBufferAttribute:Pi,Interpolant:xr,InterpolateDiscrete:Qs,InterpolateLinear:ja,InterpolateSmooth:fa,InterpolationSamplingMode:hp,InterpolationSamplingType:cp,InvertStencilOp:Xf,KeepStencilOp:yi,KeyframeTrack:an,LOD:_d,LatheGeometry:Io,Layers:go,LessCompare:td,LessDepth:ya,LessEqualCompare:sc,LessEqualDepth:Ri,LessEqualStencilFunc:Jf,LessStencilFunc:Yf,Light:ii,LightProbe:sf,Line:jn,Line3:Xg,LineBasicMaterial:ze,LineCurve:gc,LineCurve3:Cd,LineDashedMaterial:Gd,LineLoop:Md,LineSegments:Tn,LinearFilter:Me,LinearInterpolant:Ec,LinearMipMapLinearFilter:Lf,LinearMipMapNearestFilter:Pf,LinearMipmapLinearFilter:yn,LinearMipmapNearestFilter:ks,LinearSRGBColorSpace:Ii,LinearToneMapping:zu,LinearTransfer:tr,Loader:Ye,LoaderUtils:Gl,LoadingManager:Ac,LoopOnce:Yu,LoopPingPong:Ju,LoopRepeat:Zu,MOUSE:Tf,Material:Le,MaterialLoader:Bo,MathUtils:wp,Matrix2:Lc,Matrix3:Ht,Matrix4:Ot,MaxEquation:bu,Mesh:ye,MeshBasicMaterial:ei,MeshDepthMaterial:Mc,MeshDistanceMaterial:Sc,MeshLambertMaterial:Vd,MeshMatcapMaterial:Hd,MeshNormalMaterial:kd,MeshPhongMaterial:Bd,MeshPhysicalMaterial:Od,MeshStandardMaterial:yc,MeshToonMaterial:zd,MinEquation:Su,MirroredRepeatWrapping:Ks,MixOperation:Ou,MultiplyBlending:Nl,MultiplyOperation:ur,NearestFilter:Ae,NearestMipMapLinearFilter:If,NearestMipMapNearestFilter:Rf,NearestMipmapLinearFilter:ss,NearestMipmapNearestFilter:Jl,NeutralToneMapping:Xu,NeverCompare:ju,NeverDepth:xa,NeverStencilFunc:qf,NoBlending:Nn,NoColorSpace:Dn,NoToneMapping:Fn,NormalAnimationBlendMode:fo,NormalBlending:Ai,NotEqualCompare:id,NotEqualDepth:Ea,NotEqualStencilFunc:Kf,NumberKeyframeTrack:or,Object3D:ee,ObjectLoader:hg,ObjectSpaceNormalMap:Qu,OctahedronGeometry:gr,OneFactor:Tu,OneMinusConstantAlphaFactor:Fu,OneMinusConstantColorFactor:Uu,OneMinusDstAlphaFactor:Ru,OneMinusDstColorFactor:Pu,OneMinusSrcAlphaFactor:_a,OneMinusSrcColorFactor:wu,Orthogra
3840phicCamera:Oo,PCFShadowMap:Zl,PCFSoftShadowMap:xu,PMREMGenerator:ql,Path:io,PerspectiveCamera:Te,Plane:Jn,PlaneGeometry:Ss,PlaneHelper:i_,PointLight:Qd,PointLightHelper:Zg,Points:Sd,PointsMaterial:uc,PolarGridHelper:Qg,PolyhedronGeometry:ni,PositionalAudio:xg,PropertyBinding:jt,PropertyMixer:hf,QuadraticBezierCurve:_c,QuadraticBezierCurve3:xc,Quaternion:qe,QuaternionKeyframeTrack:vr,QuaternionLinearInterpolant:Zd,RED_GREEN_RGTC2_Format:Ka,RED_RGTC1_Format:Ja,REVISION:so,RGBADepthPacking:Ku,RGBAFormat:Oe,RGBAIntegerFormat:uo,RGBA_ASTC_10x10_Format:Ga,RGBA_ASTC_10x5_Format:ka,RGBA_ASTC_10x6_Format:Va,RGBA_ASTC_10x8_Format:Ha,RGBA_ASTC_12x10_Format:Wa,RGBA_ASTC_12x12_Format:Xa,RGBA_ASTC_4x4_Format:La,RGBA_ASTC_5x4_Format:Da,RGBA_ASTC_5x5_Format:Ua,RGBA_ASTC_6x5_Format:Na,RGBA_ASTC_6x6_Format:Fa,RGBA_ASTC_8x5_Format:Oa,RGBA_ASTC_8x6_Format:Ba,RGBA_ASTC_8x8_Format:za,RGBA_BPTC_Format:qa,RGBA_ETC2_EAC_Format:Pa,RGBA_PVRTC_2BPPV1_Format:Ca,RGBA_PVRTC_4BPPV1_Format:wa,RGBA_S3TC_DXT1_Format:Hs,RGBA_S3TC_DXT3_Format:Gs,RGBA_S3TC_DXT5_Format:Ws,RGBDepthPacking:Of,RGBFormat:ec,RGBIntegerFormat:Df,RGB_BPTC_SIGNED_Format:Ya,RGB_BPTC_UNSIGNED_Format:Za,RGB_ETC1_Format:Ra,RGB_ETC2_Format:Ia,RGB_PVRTC_2BPPV1_Format:Aa,RGB_PVRTC_4BPPV1_Format:Ta,RGB_S3TC_DXT1_Format:Vs,RGDepthPacking:Bf,RGFormat:nc,RGIntegerFormat:ho,RawShaderMaterial:Fd,Ray:ys,Raycaster:Og,RectAreaLight:ef,RedFormat:co,RedIntegerFormat:dr,ReinhardToneMapping:ku,RenderTarget:ac,RenderTarget3D:Lg,RepeatWrapping:$s,ReplaceStencilOp:kf,ReverseSubtractEquation:Mu,RingGeometry:Po,SIGNED_RED_GREEN_RGTC2_Format:Qa,SIGNED_RED_RGTC1_Format:$a,SRGBColorSpace:Ge,SRGBTransfer:re,Scene:pd,ShaderChunk:Yt,ShaderLib:hn,ShaderMaterial:fn,ShadowMaterial:Nd,Shape:Ci,ShapeGeometry:Lo,ShapePath:a_,ShapeUtils:un,ShortType:Kl,Skeleton:Mo,SkeletonHelper:Yg,SkinnedMesh:xd,Source:Kn,Sphere:we,SphereGeometry:_r,Spherical:kg,SphericalHarmonics3:nf,SplineCurve:vc,SpotLight:Kd,SpotLightHelper:qg,Sprite:gd,SpriteMaterial:cc,SrcAlphaFactor:ga,SrcAlphaSaturateFactor:Lu,SrcColorFactor:Au,StaticCopyUsage:sp,StaticDrawUsage:er,StaticReadUsage:ep,StereoCamera:pg,StreamCopyUsage:ap,StreamDrawUsage:tp,StreamReadUsage:ip,StringKeyframeTrack:Ni,SubtractEquation:yu,SubtractiveBlending:Ul,TOUCH:Af,TangentSpaceNormalMap:ti,TetrahedronGeometry:Do,Texture:_e,TextureLoader:ag,TextureUtils:d_,Timer:Bg,TimestampQuery:lp,TorusGeometry:Uo,TorusKnotGeometry:No,Triangle:We,TriangleFanDrawMode:Ff,TriangleStripDrawMode:Nf,TrianglesDrawMode:Uf,TubeGeometry:Fo,UVMapping:ro,Uint16BufferAttribute:oc,Uint32BufferAttribute:lc,Uint8BufferAttribute:Yp,Uint8ClampedBufferAttribute:Zp,Uniform:Pc,UniformsGroup:Ug,UniformsLib:ft,UniformsUtils:ud,UnsignedByteType:dn,UnsignedInt101111Type:jl,UnsignedInt248Type:hs,UnsignedInt5999Type:Ql,UnsignedIntType:kn,UnsignedShort4444Type:oo,UnsignedShort5551Type:lo,UnsignedShortType:cs,VSMShadowMap:xn,Vector2:Q,Vector3:C,Vector4:te,VectorKeyframeTrack:lr,VideoFrameTexture:_m,VideoTexture:bd,WebGL3DRenderTarget:Up,WebGLArrayRenderTarget:Dp,WebGLCoordinateSystem:Qe,WebGLCubeRenderTarget:fd,WebGLRenderTarget:bn,WebGLRenderer:Yy,WebGLUtils:xf,WebGPUCoordinateSystem:fs,WebXRController:pa,WireframeGeometry:Ud,WrapAroundEnding:js,ZeroCurvatureEnding:bi,ZeroFactor:Eu,ZeroSlopeEnding:Ei,ZeroStencilOp:zf,createCanvasElement:od},Symbol.toStringTag,{value:"Module"}));export{Fn as $,Hu as A,Be as B,o_ as C,jd as D,Mm as E,Bn as F,as as G,lf as H,_e as I,Og as J,xu as K,Me as L,Tf as M,xn as N,Oo as O,Jn as P,qe as Q,ys as R,kg as S,Af as T,Pc as U,te as V,Yy as W,Zl as X,Cf as Y,Kt as Z,Ii as _,C as a,go as a0,Oe as a1,dn as a2,Zy as a3,$s as a4,Q as b,wp as c,pd as d,Te as e,Ge as f,tf as g,_r as h,ei as i,ye as j,cc as k,Dl as l,gd as m,ag as n,fn as o,xt as p,yc as q,Xt as r,oe as s,uc as t,Sd as u,Di as v,Ss as w,pr as x,vn as y,Po as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.