PageSourceSearch

https://www.hebbia.com/static/js-bundle/max.js?v=e87320b81f73

js hebbia.com collected 2026-09-24 09:34:57 UTC 545,911 bytes, 4,119 lines download raw bytes

vendor: 64,672 bytes, line 1
1"use strict";(()=>{var Kl=0,Xo=1,Ql=2;var Js=1,jl=2,cs=3,Jn=0,Ye=1,mn=2,zn=0,Ui=1,qo=2,Yo=3,Zo=4,tc=5;var ui=100,ec=101,nc=102,ic=103,sc=104,rc=200,ac=201,oc=202,lc=203,Nr=204,Ur=205,cc=206,hc=207,uc=208,dc=209,fc=210,pc=211,mc=212,gc=213,_c=214,Fr=0,Or=1,Br=2,Fi=3,zr=4,Vr=5,kr=6,Gr=7,Jo=0,xc=1,vc=2,wn=0,$o=1,Ko=2,Qo=3,$s=4,jo=5,tl=6,el=7;var nl=300,xi=301,Vi=302,pa=303,ma=304,Ks=306,Hr=1e3,Nn=1001,Wr=1002,Fe=1003,yc=1004;var Qs=1005;var Oe=1006,ga=1007;var vi=1008;var hn=1009,il=1010,sl=1011,hs=1012,_a=1013,Cn=1014,gn=1015,_n=1016,xa=1017,va=1018,us=1020,rl=35902,al=35899,ol=1021,ll=1022,xn=1023,Un=1026,yi=1027,ya=1028,Ma=1029,Mi=1030,Sa=1031;var ba=1033,js=33776,tr=33777,er=33778,nr=33779,Ea=35840,Ta=35841,Aa=35842,wa=35843,Ca=36196,Ra=37492,Ia=37496,Pa=37488,La=37489,ir=37490,Da=37491,Na=37808,Ua=37809,Fa=37810,Oa=37811,Ba=37812,za=37813,Va=37814,ka=37815,Ga=37816,Ha=37817,Wa=37818,Xa=37819,qa=37820,Ya=37821,Za=36492,Ja=36494,$a=36495,Ka=36283,Qa=36284,sr=36285,ja=36286;var Rs=2300,Xr=2301,Dr=2302,Oo=2303,Bo=2400,zo=2401,Vo=2402;var Mc=3200;var to=0,Sc=1,Qn="",rn="srgb",Is="srgb-linear",Ps="linear",oe="srgb";var Li=7680;var ko=519,bc=512,Ec=513,Tc=514,eo=515,Ac=516,wc=517,no=518,Cc=519,Go=35044;var cl="300 es",Tn=2e3,Ls=2001;function dh(i){for(let t=i.length-1;t>=0;--t)if(i[t]>=65535)return!0;return!1}function fh(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Ds(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function Rc(){let i=Ds("canvas");return i.style.display="block",i}var Pl={},ss=null;function hl(...i){let t="THREE."+i.shift();ss?ss("log",t,...i):console.log(t,...i)}function Ic(i){let t=i[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=i[1];e&&e.isStackTrace?i[0]+=" "+e.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Dt(...i){i=Ic(i);let t="THREE."+i.shift();if(ss)ss("warn",t,...i);else{let e=i[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...i)}}function Ut(...i){i=Ic(i);let t="THREE."+i.shift();if(ss)ss("error",t,...i);else{let e=i[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...i)}}function Ni(...i){let t=i.join(" ");t in Pl||(Pl[t]=!0,Dt(...i))}function Pc(i,t,e){return new Promise(function(n,s){function r(){switch(i.clientWaitSync(t,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:s();break;case i.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}var Lc={[Fr]:Or,[Br]:kr,[zr]:Gr,[Fi]:Vr,[Or]:Fr,[kr]:Br,[Gr]:zr,[Vr]:Fi},Fn=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let s=n[t];if(s!==void 0){let r=s.indexOf(e);r!==-1&&s.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let s=n.slice(0);for(let r=0,a=s.length;r<a;r++)s[r].call(this,t);t.target=null}}},Ge=["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"];var po=Math.PI/180,qr=180/Math.PI;function rr(){let i=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Ge[i&255]+Ge[i>>8&255]+Ge[i>>16&255]+Ge[i>>24&255]+"-"+Ge[t&255]+Ge[t>>8&255]+"-"+Ge[t>>16&15|64]+Ge[t>>24&255]+"-"+Ge[e&63|128]+Ge[e>>8&255]+"-"+Ge[e>>16&255]+Ge[e>>24&255]+Ge[n&255]+Ge[n>>8&255]+Ge[n>>16&255]+Ge[n>>24&255]).toLowerCase()}function Kt(i,t,e){return Math.max(t,Math.min(e,i))}function ph(i,t){return(i%t+t)%t}function mo(i,t,e){return(1-e)*i+e*t}function Ss(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function $e(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var jt=class i{static{i.prototype.isVector2=!0}constructor(t=0,e=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("THREE.Vector2: 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("THREE.Vector2: 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){let e=this.x,n=this.y,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6],this.y=s[1]*e+s[4]*n+s[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=Kt(this.x,t.x,e.x),this.y=Kt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Kt(this.x,t,e),this.y=Kt(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Kt(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}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Kt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let 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){let n=Math.cos(e),s=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*s+t.x,this.y=r*s+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},On=class{constructor(t=0,e=0,n=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=s}static slerpFlat(t,e,n,s,r,a,o){let c=n[s+0],l=n[s+1],u=n[s+2],p=n[s+3],h=r[a+0],g=r[a+1],x=r[a+2],y=r[a+3];if(p!==y||c!==h||l!==g||u!==x){let m=c*h+l*g+u*x+p*y;m<0&&(h=-h,g=-g,x=-x,y=-y,m=-m);let d=1-o;if(m<.9995){let T=Math.acos(m),w=Math.sin(T);d=Math.sin(d*T)/w,o=Math.sin(o*T)/w,c=c*d+h*o,l=l*d+g*o,u=u*d+x*o,p=p*d+y*o}else{c=c*d+h*o,l=l*d+g*o,u=u*d+x*o,p=p*d+y*o;let T=1/Math.sqrt(c*c+l*l+u*u+p*p);c*=T,l*=T,u*=T,p*=T}}t[e]=c,t[e+1]=l,t[e+2]=u,t[e+3]=p}static multiplyQuaternionsFlat(t,e,n,s,r,a){let o=n[s],c=n[s+1],l=n[s+2],u=n[s+3],p=r[a],h=r[a+1],g=r[a+2],x=r[a+3];return t[e]=o*x+u*p+c*g-l*h,t[e+1]=c*x+u*h+l*p-o*g,t[e+2]=l*x+u*g+o*h-c*p,t[e+3]=u*x-o*p-c*h-l*g,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,s){return this._x=t,this._y=e,this._z=n,this._w=s,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){let n=t._x,s=t._y,r=t._z,a=t._order,o=Math.cos,c=Math.sin,l=o(n/2),u=o(s/2),p=o(r/2),h=c(n/2),g=c(s/2),x=c(r/2);switch(a){case"XYZ":this._x=h*u*p+l*g*x,this._y=l*g*p-h*u*x,this._z=l*u*x+h*g*p,this._w=l*u*p-h*g*x;break;case"YXZ":this._x=h*u*p+l*g*x,this._y=l*g*p-h*u*x,this._z=l*u*x-h*g*p,this._w=l*u*p+h*g*x;break;case"ZXY":this._x=h*u*p-l*g*x,this._y=l*g*p+h*u*x,this._z=l*u*x+h*g*p,this._w=l*u*p-h*g*x;break;case"ZYX":this._x=h*u*p-l*g*x,this._y=l*g*p+h*u*x,this._z=l*u*x-h*g*p,this._w=l*u*p+h*g*x;break;case"YZX":this._x=h*u*p+l*g*x,this._y=l*g*p+h*u*x,this._z=l*u*x-h*g*p,this._w=l*u*p-h*g*x;break;case"XZY":this._x=h*u*p-l*g*x,this._y=l*g*p-h*u*x,this._z=l*u*x+h*g*p,this._w=l*u*p+h*g*x;break;default:Dt("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,s=Math.sin(n);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],s=e[4],r=e[8],a=e[1],o=e[5],c=e[9],l=e[2],u=e[6],p=e[10],h=n+o+p;if(h>0){let g=.5/Math.sqrt(h+1);this._w=.25/g,this._x=(u-c)*g,this._y=(r-l)*g,this._z=(a-s)*g}else if(n>o&&n>p){let g=2*Math.sqrt(1+n-o-p);this._w=(u-c)/g,this._x=.25*g,this._y=(s+a)/g,this._z=(r+l)/g}else if(o>p){let g=2*Math.sqrt(1+o-n-p);this._w=(r-l)/g,this._x=(s+a)/g,this._y=.25*g,this._z=(c+u)/g}else{let g=2*Math.sqrt(1+p-n-o);this._w=(a-s)/g,this._x=(r+l)/g,this._y=(c+u)/g,this._z=.25*g}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(Kt(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let s=Math.min(1,e/n);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(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){let n=t._x,s=t._y,r=t._z,a=t._w,o=e._x,c=e._y,l=e._z,u=e._w;return this._x=n*u+a*o+s*l-r*c,this._y=s*u+a*c+r*o-n*l,this._z=r*u+a*l+n*c-s*o,this._w=a*u-n*o-s*c-r*l,this._onChangeCallback(),this}slerp(t,e){let n=t._x,s=t._y,r=t._z,a=t._w,o=this.dot(t);o<0&&(n=-n,s=-s,r=-r,a=-a,o=-o);let c=1-e;if(o<.9995){let l=Math.acos(o),u=Math.sin(l);c=Math.sin(c*l)/u,e=Math.sin(e*l)/u,this._x=this._x*c+n*e,this._y=this._y*c+s*e,this._z=this._z*c+r*e,this._w=this._w*c+a*e,this._onChangeCallback()}else this._x=this._x*c+n*e,this._y=this._y*c+s*e,this._z=this._z*c+r*e,this._w=this._w*c+a*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),s=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(s*Math.sin(t),s*Math.cos(t),r*Math.sin(e),r*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}},F=class i{static{i.prototype.isVector3=!0}constructor(t=0,e=0,n=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("THREE.Vector3: 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("THREE.Vector3: 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(Ll.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Ll.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*s,this.y=r[1]*e+r[4]*n+r[7]*s,this.z=r[2]*e+r[5]*n+r[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,s=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*s+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*s+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*s+r[14])*a,this}applyQuaternion(t){let e=this.x,n=this.y,s=this.z,r=t.x,a=t.y,o=t.z,c=t.w,l=2*(a*s-o*n),u=2*(o*e-r*s),p=2*(r*n-a*e);return this.x=e+c*l+a*p-o*u,this.y=n+c*u+o*l-r*p,this.z=s+c*p+r*u-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*s,this.y=r[1]*e+r[5]*n+r[9]*s,this.z=r[2]*e+r[6]*n+r[10]*s,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=Kt(this.x,t.x,e.x),this.y=Kt(this.y,t.y,e.y),this.z=Kt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Kt(this.x,t,e),this.y=Kt(this.y,t,e),this.z=Kt(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Kt(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){let n=t.x,s=t.y,r=t.z,a=e.x,o=e.y,c=e.z;return this.x=s*c-r*o,this.y=r*a-n*c,this.z=n*o-s*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return go.copy(this).projectOnVector(t),this.sub(go)}reflect(t){return this.sub(go.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Kt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,s=this.z-t.z;return e*e+n*n+s*s}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){let s=Math.sin(e)*t;return this.x=s*Math.sin(n),this.y=Math.cos(e)*t,this.z=s*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){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=s,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(){let 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}},go=new F,Ll=new On,kt=class i{static{i.prototype.isMatrix3=!0}constructor(t,e,n,s,r,a,o,c,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,s,r,a,o,c,l)}set(t,e,n,s,r,a,o,c,l){let u=this.elements;return u[0]=t,u[1]=s,u[2]=o,u[3]=e,u[4]=r,u[5]=c,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let 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){let 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){let n=t.elements,s=e.elements,r=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],u=n[4],p=n[7],h=n[2],g=n[5],x=n[8],y=s[0],m=s[3],d=s[6],T=s[1],w=s[4],M=s[7],A=s[2],b=s[5],C=s[8];return r[0]=a*y+o*T+c*A,r[3]=a*m+o*w+c*b,r[6]=a*d+o*M+c*C,r[1]=l*y+u*T+p*A,r[4]=l*m+u*w+p*b,r[7]=l*d+u*M+p*C,r[2]=h*y+g*T+x*A,r[5]=h*m+g*w+x*b,r[8]=h*d+g*M+x*C,this}multiplyScalar(t){let 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(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8];return e*a*u-e*o*l-n*r*u+n*o*c+s*r*l-s*a*c}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],p=u*a-o*l,h=o*c-u*r,g=l*r-a*c,x=e*p+n*h+s*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/x;return t[0]=p*y,t[1]=(s*l-u*n)*y,t[2]=(o*n-s*a)*y,t[3]=h*y,t[4]=(u*e-s*c)*y,t[5]=(s*r-o*e)*y,t[6]=g*y,t[7]=(n*c-l*e)*y,t[8]=(a*e-n*r)*y,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let 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,s,r,a,o){let c=Math.cos(r),l=Math.sin(r);return this.set(n*c,n*l,-n*(c*a+l*o)+a+t,-s*l,s*c,-s*(-l*a+c*o)+o+e,0,0,1),this}scale(t,e){return Ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(_o.makeScale(t,e)),this}rotate(t){return Ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(_o.makeRotation(-t)),this}translate(t,e){return Ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(_o.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){let 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){let e=this.elements,n=t.elements;for(let s=0;s<9;s++)if(e[s]!==n[s])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){let 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)}},_o=new kt,Dl=new kt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Nl=new kt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function mh(){let i={enabled:!0,workingColorSpace:Is,spaces:{},convert:function(s,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===oe&&(s.r=Zn(s.r),s.g=Zn(s.g),s.b=Zn(s.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===oe&&(s.r=is(s.r),s.g=is(s.g),s.b=is(s.b))),s},workingToColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},colorSpaceToWorking:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Qn?Ps:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,a){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,r){return Ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(s,r)},toWorkingColorSpace:function(s,r){return Ni("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(s,r)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Is]:{primaries:t,whitePoint:n,transfer:Ps,toXYZ:Dl,fromXYZ:Nl,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:rn},outputColorSpaceConfig:{drawingBufferColorSpace:rn}},[rn]:{primaries:t,whitePoint:n,transfer:oe,toXYZ:Dl,fromXYZ:Nl,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:rn}}}),i}var $t=mh();function Zn(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function is(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Wi,Yr=class{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{Wi===void 0&&(Wi=Ds("canvas")),Wi.width=t.width,Wi.height=t.height;let s=Wi.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),n=Wi}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){let e=Ds("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let s=n.getImageData(0,0,t.width,t.height),r=s.data;for(let a=0;a<r.length;a++)r[a]=Zn(r[a]/255)*255;return n.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(Zn(e[n]/255)*255):e[n]=Zn(e[n]);return{data:e,width:t.width,height:t.height}}else return Dt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},gh=0,rs=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gh++}),this.uuid=rr(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,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){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},s=this.data;if(s!==null){let r;if(Array.isArray(s)){r=[];for(let a=0,o=s.length;a<o;a++)s[a].isDataTexture?r.push(xo(s[a].image)):r.push(xo(s[a]))}else r=xo(s);n.url=r}return e||(t.images[this.uuid]=n),n}};function xo(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?Yr.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Dt("Texture: Unable to serialize Texture."),{})}var _h=0,vo=new F,je=class i extends Fn{constructor(t=i.DEFAULT_IMAGE,e=i.DEFAULT_MAPPING,n=Nn,s=Nn,r=Oe,a=vi,o=xn,c=hn,l=i.DEFAULT_ANISOTROPY,u=Qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:_h++}),this.uuid=rr(),this.name="",this.source=new rs(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=s,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new jt(0,0),this.repeat=new jt(1,1),this.center=new jt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new kt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,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,this.normalized=!1}get width(){return this.source.getSize(vo).x}get height(){return this.source.getSize(vo).y}get depth(){return this.source.getSize(vo).z}get image(){return this.source.data}set image(t){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.normalized=t.normalized,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(let e in t){let n=t[e];if(n===void 0){Dt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Dt(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&n&&s.isVector2&&n.isVector2||s&&n&&s.isVector3&&n.isVector3||s&&n&&s.isMatrix3&&n.isMatrix3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let 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,normalized:this.normalized,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!==nl)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Hr:t.x=t.x-Math.floor(t.x);break;case Nn:t.x=t.x<0?0:1;break;case Wr: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 Hr:t.y=t.y-Math.floor(t.y);break;case Nn:t.y=t.y<0?0:1;break;case Wr: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++}};je.DEFAULT_IMAGE=null;je.DEFAULT_MAPPING=nl;je.DEFAULT_ANISOTROPY=1;var Ee=class i{static{i.prototype.isVector4=!0}constructor(t=0,e=0,n=0,s=1){this.x=t,this.y=e,this.z=n,this.w=s}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,s){return this.x=t,this.y=e,this.z=n,this.w=s,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("THREE.Vector4: 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("THREE.Vector4: 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){let e=this.x,n=this.y,s=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*s+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*s+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*s+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*s+a[15]*r,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);let 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,s,r,c=t.elements,l=c[0],u=c[4],p=c[8],h=c[1],g=c[5],x=c[9],y=c[2],m=c[6],d=c[10];if(Math.abs(u-h)<.01&&Math.abs(p-y)<.01&&Math.abs(x-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(p+y)<.1&&Math.abs(x+m)<.1&&Math.abs(l+g+d-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let w=(l+1)/2,M=(g+1)/2,A=(d+1)/2,b=(u+h)/4,C=(p+y)/4,_=(x+m)/4;return w>M&&w>A?w<.01?(n=0,s=.707106781,r=.707106781):(n=Math.sqrt(w),s=b/n,r=C/n):M>A?M<.01?(n=.707106781,s=0,r=.707106781):(s=Math.sqrt(M),n=b/s,r=_/s):A<.01?(n=.707106781,s=.707106781,r=0):(r=Math.sqrt(A),n=C/r,s=_/r),this.set(n,s,r,e),this}let T=Math.sqrt((m-x)*(m-x)+(p-y)*(p-y)+(h-u)*(h-u));return Math.abs(T)<.001&&(T=1),this.x=(m-x)/T,this.y=(p-y)/T,this.z=(h-u)/T,this.w=Math.acos((l+g+d-1)/2),this}setFromMatrixPosition(t){let 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=Kt(this.x,t.x,e.x),this.y=Kt(this.y,t.y,e.y),this.z=Kt(this.z,t.z,e.z),this.w=Kt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Kt(this.x,t,e),this.y=Kt(this.y,t,e),this.z=Kt(this.z,t,e),this.w=Kt(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Kt(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}},Zr=class extends Fn{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Oe,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new Ee(0,0,t,e),this.scissorTest=!1,this.viewport=new Ee(0,0,t,e),this.textures=[];let s={width:t,height:e,depth:n.depth},r=new je(s),a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.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,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:Oe,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 s=0,r=this.textures.length;s<r;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=n,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].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;let s=Object.assign({},t.textures[e].image);this.textures[e].source=new rs(s)}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.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},an=class extends Zr{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}},Ns=class extends je{constructor(t=null,e=1,n=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=Fe,this.minFilter=Fe,this.wrapR=Nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}};var Jr=class extends je{constructor(t=null,e=1,n=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:s},this.magFilter=Fe,this.minFilter=Fe,this.wrapR=Nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var de=class i{static{i.prototype.isMatrix4=!0}constructor(t,e,n,s,r,a,o,c,l,u,p,h,g,x,y,m){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,s,r,a,o,c,l,u,p,h,g,x,y,m)}set(t,e,n,s,r,a,o,c,l,u,p,h,g,x,y,m){let d=this.elements;return d[0]=t,d[4]=e,d[8]=n,d[12]=s,d[1]=r,d[5]=a,d[9]=o,d[13]=c,d[2]=l,d[6]=u,d[10]=p,d[14]=h,d[3]=g,d[7]=x,d[11]=y,d[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new i().fromArray(this.elements)}copy(t){let 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){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let 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 this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(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){if(t.determinantAffine()===0)return this.identity();let e=this.elements,n=t.elements,s=1/Xi.setFromMatrixColumn(t,0).length(),r=1/Xi.setFromMatrixColumn(t,1).length(),a=1/Xi.setFromMatrixColumn(t,2).length();return e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,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){let e=this.elements,n=t.x,s=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(s),l=Math.sin(s),u=Math.cos(r),p=Math.sin(r);if(t.order==="XYZ"){let h=a*u,g=a*p,x=o*u,y=o*p;e[0]=c*u,e[4]=-c*p,e[8]=l,e[1]=g+x*l,e[5]=h-y*l,e[9]=-o*c,e[2]=y-h*l,e[6]=x+g*l,e[10]=a*c}else if(t.order==="YXZ"){let h=c*u,g=c*p,x=l*u,y=l*p;e[0]=h+y*o,e[4]=x*o-g,e[8]=a*l,e[1]=a*p,e[5]=a*u,e[9]=-o,e[2]=g*o-x,e[6]=y+h*o,e[10]=a*c}else if(t.order==="ZXY"){let h=c*u,g=c*p,x=l*u,y=l*p;e[0]=h-y*o,e[4]=-a*p,e[8]=x+g*o,e[1]=g+x*o,e[5]=a*u,e[9]=y-h*o,e[2]=-a*l,e[6]=o,e[10]=a*c}else if(t.order==="ZYX"){let h=a*u,g=a*p,x=o*u,y=o*p;e[0]=c*u,e[4]=x*l-g,e[8]=h*l+y,e[1]=c*p,e[5]=y*l+h,e[9]=g*l-x,e[2]=-l,e[6]=o*c,e[10]=a*c}else if(t.order==="YZX"){let h=a*c,g=a*l,x=o*c,y=o*l;e[0]=c*u,e[4]=y-h*p,e[8]=x*p+g,e[1]=p,e[5]=a*u,e[9]=-o*u,e[2]=-l*u,e[6]=g*p+x,e[10]=h-y*p}else if(t.order==="XZY"){let h=a*c,g=a*l,x=o*c,y=o*l;e[0]=c*u,e[4]=-p,e[8]=l*u,e[1]=h*p+y,e[5]=a*u,e[9]=g*p-x,e[2]=x*p-g,e[6]=o*u,e[10]=y*p+h}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(xh,t,vh)}lookAt(t,e,n){let s=this.elements;return nn.subVectors(t,e),nn.lengthSq()===0&&(nn.z=1),nn.normalize(),si.crossVectors(n,nn),si.lengthSq()===0&&(Math.abs(n.z)===1?nn.x+=1e-4:nn.z+=1e-4,nn.normalize(),si.crossVectors(n,nn)),si.normalize(),dr.crossVectors(nn,si),s[0]=si.x,s[4]=dr.x,s[8]=nn.x,s[1]=si.y,s[5]=dr.y,s[9]=nn.y,s[2]=si.z,s[6]=dr.z,s[10]=nn.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,s=e.elements,r=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],u=n[1],p=n[5],h=n[9],g=n[13],x=n[2],y=n[6],m=n[10],d=n[14],T=n[3],w=n[7],M=n[11],A=n[15],b=s[0],C=s[4],_=s[8],E=s[12],D=s[1],I=s[5],O=s[9],q=s[13],Y=s[2],z=s[6],X=s[10],G=s[14],K=s[3],tt=s[7],ft=s[11],xt=s[15];return r[0]=a*b+o*D+c*Y+l*K,r[4]=a*C+o*I+c*z+l*tt,r[8]=a*_+o*O+c*X+l*ft,r[12]=a*E+o*q+c*G+l*xt,r[1]=u*b+p*D+h*Y+g*K,r[5]=u*C+p*I+h*z+g*tt,r[9]=u*_+p*O+h*X+g*ft,r[13]=u*E+p*q+h*G+g*xt,r[2]=x*b+y*D+m*Y+d*K,r[6]=x*C+y*I+m*z+d*tt,r[10]=x*_+y*O+m*X+d*ft,r[14]=x*E+y*q+m*G+d*xt,r[3]=T*b+w*D+M*Y+A*K,r[7]=T*C+w*I+M*z+A*tt,r[11]=T*_+w*O+M*X+A*ft,r[15]=T*E+w*q+M*G+A*xt,this}multiplyScalar(t){let 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(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[12],a=t[1],o=t[5],c=t[9],l=t[13],u=t[2],p=t[6],h=t[10],g=t[14],x=t[3],y=t[7],m=t[11],d=t[15],T=c*g-l*h,w=o*g-l*p,M=o*h-c*p,A=a*g-l*u,b=a*h-c*u,C=a*p-o*u;return e*(y*T-m*w+d*M)-n*(x*T-m*A+d*b)+s*(x*w-y*A+d*C)-r*(x*M-y*b+m*C)}determinantAffine(){let t=this.elements,e=t[0],n=t[4],s=t[8],r=t[1],a=t[5],o=t[9],c=t[2],l=t[6],u=t[10];return e*(a*u-o*l)-n*(r*u-o*c)+s*(r*l-a*c)}transpose(){let t=this.elements,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){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],s=t[2],r=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],p=t[9],h=t[10],g=t[11],x=t[12],y=t[13],m=t[14],d=t[15],T=e*o-n*a,w=e*c-s*a,M=e*l-r*a,A=n*c-s*o,b=n*l-r*o,C=s*l-r*c,_=u*y-p*x,E=u*m-h*x,D=u*d-g*x,I=p*m-h*y,O=p*d-g*y,q=h*d-g*m,Y=T*q-w*O+M*I+A*D-b*E+C*_;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let z=1/Y;return t[0]=(o*q-c*O+l*I)*z,t[1]=(s*O-n*q-r*I)*z,t[2]=(y*C-m*b+d*A)*z,t[3]=(h*b-p*C-g*A)*z,t[4]=(c*D-a*q-l*E)*z,t[5]=(e*q-s*D+r*E)*z,t[6]=(m*M-x*C-d*w)*z,t[7]=(u*C-h*M+g*w)*z,t[8]=(a*O-o*D+l*_)*z,t[9]=(n*D-e*O-r*_)*z,t[10]=(x*b-y*M+d*T)*z,t[11]=(p*M-u*b-g*T)*z,t[12]=(o*E-a*I-c*_)*z,t[13]=(e*I-n*E+s*_)*z,t[14]=(y*w-x*A-m*T)*z,t[15]=(u*A-p*w+h*T)*z,this}scale(t){let e=this.elements,n=t.x,s=t.y,r=t.z;return e[0]*=n,e[4]*=s,e[8]*=r,e[1]*=n,e[5]*=s,e[9]*=r,e[2]*=n,e[6]*=s,e[10]*=r,e[3]*=n,e[7]*=s,e[11]*=r,this}getMaxScaleOnAxis(){let 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],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,s))}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){let 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){let 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){let 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){let n=Math.cos(e),s=Math.sin(e),r=1-n,a=t.x,o=t.y,c=t.z,l=r*a,u=r*o;return this.set(l*a+n,l*o-s*c,l*c+s*o,0,l*o+s*c,u*o+n,u*c-s*a,0,l*c-s*o,u*c+s*a,r*c*c+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,s,r,a){return this.set(1,n,r,0,t,1,a,0,e,s,1,0,0,0,0,1),this}compose(t,e,n){let s=this.elements,r=e._x,a=e._y,o=e._z,c=e._w,l=r+r,u=a+a,p=o+o,h=r*l,g=r*u,x=r*p,y=a*u,m=a*p,d=o*p,T=c*l,w=c*u,M=c*p,A=n.x,b=n.y,C=n.z;return s[0]=(1-(y+d))*A,s[1]=(g+M)*A,s[2]=(x-w)*A,s[3]=0,s[4]=(g-M)*b,s[5]=(1-(h+d))*b,s[6]=(m+T)*b,s[7]=0,s[8]=(x+w)*C,s[9]=(m-T)*C,s[10]=(1-(h+y))*C,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,n){let s=this.elements;t.x=s[12],t.y=s[13],t.z=s[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),e.identity(),this;let a=Xi.set(s[0],s[1],s[2]).length(),o=Xi.set(s[4],s[5],s[6]).length(),c=Xi.set(s[8],s[9],s[10]).length();r<0&&(a=-a),Sn.copy(this);let l=1/a,u=1/o,p=1/c;return Sn.elements[0]*=l,Sn.elements[1]*=l,Sn.elements[2]*=l,Sn.elements[4]*=u,Sn.elements[5]*=u,Sn.elements[6]*=u,Sn.elements[8]*=p,Sn.elements[9]*=p,Sn.elements[10]*=p,e.setFromRotationMatrix(Sn),n.x=a,n.y=o,n.z=c,this}makePerspective(t,e,n,s,r,a,o=Tn,c=!1){let l=this.elements,u=2*r/(e-t),p=2*r/(n-s),h=(e+t)/(e-t),g=(n+s)/(n-s),x,y;if(c)x=r/(a-r),y=a*r/(a-r);else if(o===Tn)x=-(a+r)/(a-r),y=-2*a*r/(a-r);else if(o===Ls)x=-a/(a-r),y=-a*r/(a-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=p,l[9]=g,l[13]=0,l[2]=0,l[6]=0,l[10]=x,l[14]=y,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,s,r,a,o=Tn,c=!1){let l=this.elements,u=2/(e-t),p=2/(n-s),h=-(e+t)/(e-t),g=-(n+s)/(n-s),x,y;if(c)x=1/(a-r),y=a/(a-r);else if(o===Tn)x=-2/(a-r),y=-(a+r)/(a-r);else if(o===Ls)x=-1/(a-r),y=-r/(a-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=p,l[9]=0,l[13]=g,l[2]=0,l[6]=0,l[10]=x,l[14]=y,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let s=0;s<16;s++)if(e[s]!==n[s])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){let 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}},Xi=new F,Sn=new de,xh=new F(0,0,0),vh=new F(1,1,1),si=new F,dr=new F,nn=new F,Ul=new de,Fl=new On,$n=class i{constructor(t=0,e=0,n=0,s=i.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=s}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,s=this._order){return this._x=t,this._y=e,this._z=n,this._order=s,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){let s=t.elements,r=s[0],a=s[4],o=s[8],c=s[1],l=s[5],u=s[9],p=s[2],h=s[6],g=s[10];switch(e){case"XYZ":this._y=Math.asin(Kt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,g),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Kt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,g),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-p,r),this._z=0);break;case"ZXY":this._x=Math.asin(Kt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-p,g),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-Kt(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(h,g),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Kt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-p,r)):(this._x=0,this._y=Math.atan2(o,g));break;case"XZY":this._z=Math.asin(-Kt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,g),this._y=0);break;default:Dt("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ul.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ul,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Fl.setFromEuler(this),this.setFromQuaternion(Fl,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}};$n.DEFAULT_ORDER="XYZ";var Us=class{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}},yh=0,Ol=new F,qi=new On,Hn=new de,fr=new F,bs=new F,Mh=new F,Sh=new On,Bl=new F(1,0,0),zl=new F(0,1,0),Vl=new F(0,0,1),kl={type:"added"},bh={type:"removed"},Yi={type:"childadded",child:null},yo={type:"childremoved",child:null},on=class i extends Fn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:yh++}),this.uuid=rr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let t=new F,e=new $n,n=new On,s=new F(1,1,1);function r(){n.setFromEuler(e,!1)}function a(){e.setFromQuaternion(n,void 0,!1)}e._onChange(r),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:s},modelViewMatrix:{value:new de},normalMatrix:{value:new kt}}),this.matrix=new de,this.matrixWorld=new de,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Us,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.static=!1,this.userData={},this.pivot=null}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 qi.setFromAxisAngle(t,e),this.quaternion.multiply(qi),this}rotateOnWorldAxis(t,e){return qi.setFromAxisAngle(t,e),this.quaternion.premultiply(qi),this}rotateX(t){return this.rotateOnAxis(Bl,t)}rotateY(t){return this.rotateOnAxis(zl,t)}rotateZ(t){return this.rotateOnAxis(Vl,t)}translateOnAxis(t,e){return Ol.copy(t).applyQuaternion(this.quaternion),this.position.add(Ol.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Bl,t)}translateY(t){return this.translateOnAxis(zl,t)}translateZ(t){return this.translateOnAxis(Vl,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Hn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?fr.copy(t):fr.set(t,e,n);let s=this.parent;this.updateWorldMatrix(!0,!1),bs.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Hn.lookAt(bs,fr,this.up):Hn.lookAt(fr,bs,this.up),this.quaternion.setFromRotationMatrix(Hn),s&&(Hn.extractRotation(s.matrixWorld),qi.setFromRotationMatrix(Hn),this.quaternion.premultiply(qi.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(Ut("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(kl),Yi.child=t,this.dispatchEvent(Yi),Yi.child=null):Ut("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}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(bh),yo.child=t,this.dispatchEvent(yo),yo.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Hn.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Hn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Hn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(kl),Yi.child=t,this.dispatchEvent(Yi),Yi.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,s=this.children.length;n<s;n++){let a=this.children[n].getObjectByProperty(t,e);if(a!==void 0)return a}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let s=this.children;for(let r=0,a=s.length;r<a;r++)s[r].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(bs,t,Mh),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bs,Sh,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,s=t.z,r=this.matrix.elements;r[12]+=e-r[0]*e-r[4]*n-r[8]*s,r[13]+=n-r[1]*e-r[5]*n-r[9]*s,r[14]+=s-r[2]*e-r[6]*n-r[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,s=e.length;n<s;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e,n=!1){let s=this.parent;if(t===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),e===!0){let r=this.children;for(let a=0,o=r.length;a<o;a++)r[a].updateWorldMatrix(!1,!0,n)}}toJSON(t){let 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"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),this.static!==!1&&(s.static=this.static),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(o=>({...o})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function r(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(t)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let c=o.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){let p=c[l];r(t.shapes,p)}else r(t.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(r(t.materials,this.material[c]));s.material=o}else s.material=r(t.materials,this.material);if(this.children.length>0){s.children=[];for(let o=0;o<this.children.length;o++)s.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let o=0;o<this.animations.length;o++){let c=this.animations[o];s.animations.push(r(t.animations,c))}}if(e){let o=a(t.geometries),c=a(t.materials),l=a(t.textures),u=a(t.images),p=a(t.shapes),h=a(t.skeletons),g=a(t.animations),x=a(t.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),p.length>
vendor: 8,056 bytes, line 1
10&&(n.shapes=p),h.length>0&&(n.skeletons=h),g.length>0&&(n.animations=g),x.length>0&&(n.nodes=x)}return n.object=s,n;function a(o){let c=[];for(let l in o){let u=o[l];delete u.metadata,c.push(u)}return c}}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.pivot=t.pivot!==null?t.pivot.clone():null,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.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}};on.DEFAULT_UP=new F(0,1,0);on.DEFAULT_MATRIX_AUTO_UPDATE=!0;on.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Di=class extends on{constructor(){super(),this.isGroup=!0,this.type="Group"}},Eh={type:"move"},as=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Di,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 Di,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Di,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F,this._grip.eventsEnabled=!1),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){let e=this._hand;if(e)for(let 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 s=null,r=null,a=null,o=this._targetRay,c=this._grip,l=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(l&&t.hand){a=!0;for(let y of t.hand.values()){let m=e.getJointPose(y,n),d=this._getHandJoint(l,y);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=m.radius),d.visible=m!==null}let u=l.joints["index-finger-tip"],p=l.joints["thumb-tip"],h=u.position.distanceTo(p.position),g=.02,x=.005;l.inputState.pinching&&h>g+x?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&h<=g-x&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else c!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,c.eventsEnabled&&c.dispatchEvent({type:"gripUpdated",data:t,target:this})));o!==null&&(s=e.getPose(t.targetRaySpace,n),s===null&&r!==null&&(s=r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Eh)))}return o!==null&&(o.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new Di;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},Dc={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},ri={h:0,s:0,l:0},pr={h:0,s:0,l:0};function Mo(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?i+(t-i)*6*e:e<1/2?t:e<2/3?i+(t-i)*6*(2/3-e):i}var Xt=class{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){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=rn){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,$t.colorSpaceToWorking(this,e),this}setRGB(t,e,n,s=$t.workingColorSpace){return this.r=t,this.g=e,this.b=n,$t.colorSpaceToWorking(this,s),this}
vendor: 73,299 bytes, lines 1-5
1setHSL(t,e,n,s=$t.workingColorSpace){if(t=ph(t,1),e=Kt(e,0,1),n=Kt(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,a=2*n-r;this.r=Mo(a,r,t+1/3),this.g=Mo(a,r,t),this.b=Mo(a,r,t-1/3)}return $t.colorSpaceToWorking(this,s),this}setStyle(t,e=rn){function n(r){r!==void 0&&parseFloat(r)<1&&Dt("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,a=s[1],o=s[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:Dt("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=s[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(r,16),e);Dt("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=rn){let n=Dc[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Dt("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=Zn(t.r),this.g=Zn(t.g),this.b=Zn(t.b),this}copyLinearToSRGB(t){return this.r=is(t.r),this.g=is(t.g),this.b=is(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=rn){return $t.workingToColorSpace(He.copy(this),t),Math.round(Kt(He.r*255,0,255))*65536+Math.round(Kt(He.g*255,0,255))*256+Math.round(Kt(He.b*255,0,255))}getHexString(t=rn){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=$t.workingColorSpace){$t.workingToColorSpace(He.copy(this),e);let n=He.r,s=He.g,r=He.b,a=Math.max(n,s,r),o=Math.min(n,s,r),c,l,u=(o+a)/2;if(o===a)c=0,l=0;else{let p=a-o;switch(l=u<=.5?p/(a+o):p/(2-a-o),a){case n:c=(s-r)/p+(s<r?6:0);break;case s:c=(r-n)/p+2;break;case r:c=(n-s)/p+4;break}c/=6}return t.h=c,t.s=l,t.l=u,t}getRGB(t,e=$t.workingColorSpace){return $t.workingToColorSpace(He.copy(this),e),t.r=He.r,t.g=He.g,t.b=He.b,t}getStyle(t=rn){$t.workingToColorSpace(He.copy(this),t);let e=He.r,n=He.g,s=He.b;return t!==rn?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(t,e,n){return this.getHSL(ri),this.setHSL(ri.h+t,ri.s+e,ri.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(ri),t.getHSL(pr);let n=mo(ri.h,pr.h,e),s=mo(ri.s,pr.s,e),r=mo(ri.l,pr.l,e);return this.setHSL(n,s,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,s=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*s,this.g=r[1]*e+r[4]*n+r[7]*s,this.b=r[2]*e+r[5]*n+r[8]*s,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}},He=new Xt;Xt.NAMES=Dc;var os=class extends on{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 $n,this.environmentIntensity=1,this.environmentRotation=new $n,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){let 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}},bn=new F,Wn=new F,So=new F,Xn=new F,Zi=new F,Ji=new F,Gl=new F,bo=new F,Eo=new F,To=new F,Ao=new Ee,wo=new Ee,Co=new Ee,hi=class i{constructor(t=new F,e=new F,n=new F){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,s){s.subVectors(n,e),bn.subVectors(t,e),s.cross(bn);let r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(t,e,n,s,r){bn.subVectors(s,e),Wn.subVectors(n,e),So.subVectors(t,e);let a=bn.dot(bn),o=bn.dot(Wn),c=bn.dot(So),l=Wn.dot(Wn),u=Wn.dot(So),p=a*l-o*o;if(p===0)return r.set(0,0,0),null;let h=1/p,g=(l*c-o*u)*h,x=(a*u-o*c)*h;return r.set(1-g-x,x,g)}static containsPoint(t,e,n,s){return this.getBarycoord(t,e,n,s,Xn)===null?!1:Xn.x>=0&&Xn.y>=0&&Xn.x+Xn.y<=1}static getInterpolation(t,e,n,s,r,a,o,c){return this.getBarycoord(t,e,n,s,Xn)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(r,Xn.x),c.addScaledVector(a,Xn.y),c.addScaledVector(o,Xn.z),c)}static getInterpolatedAttribute(t,e,n,s,r,a){return Ao.setScalar(0),wo.setScalar(0),Co.setScalar(0),Ao.fromBufferAttribute(t,e),wo.fromBufferAttribute(t,n),Co.fromBufferAttribute(t,s),a.setScalar(0),a.addScaledVector(Ao,r.x),a.addScaledVector(wo,r.y),a.addScaledVector(Co,r.z),a}static isFrontFacing(t,e,n,s){return bn.subVectors(n,e),Wn.subVectors(t,e),bn.cross(Wn).dot(s)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,s){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,n,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,s),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 bn.subVectors(this.c,this.b),Wn.subVectors(this.a,this.b),bn.cross(Wn).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return i.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return i.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,s,r){return i.getInterpolation(t,this.a,this.b,this.c,e,n,s,r)}containsPoint(t){return i.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return i.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,s=this.b,r=this.c,a,o;Zi.subVectors(s,n),Ji.subVectors(r,n),bo.subVectors(t,n);let c=Zi.dot(bo),l=Ji.dot(bo);if(c<=0&&l<=0)return e.copy(n);Eo.subVectors(t,s);let u=Zi.dot(Eo),p=Ji.dot(Eo);if(u>=0&&p<=u)return e.copy(s);let h=c*p-u*l;if(h<=0&&c>=0&&u<=0)return a=c/(c-u),e.copy(n).addScaledVector(Zi,a);To.subVectors(t,r);let g=Zi.dot(To),x=Ji.dot(To);if(x>=0&&g<=x)return e.copy(r);let y=g*l-c*x;if(y<=0&&l>=0&&x<=0)return o=l/(l-x),e.copy(n).addScaledVector(Ji,o);let m=u*x-g*p;if(m<=0&&p-u>=0&&g-x>=0)return Gl.subVectors(r,s),o=(p-u)/(p-u+(g-x)),e.copy(s).addScaledVector(Gl,o);let d=1/(m+y+h);return a=y*d,o=h*d,e.copy(n).addScaledVector(Zi,a).addScaledVector(Ji,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Bn=class{constructor(t=new F(1/0,1/0,1/0),e=new F(-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(En.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(En.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){let n=En.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);let n=t.geometry;if(n!==void 0){let r=n.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)t.isMesh===!0?t.getVertexPosition(a,En):En.fromBufferAttribute(r,a),En.applyMatrix4(t.matrixWorld),this.expandByPoint(En);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),mr.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),mr.copy(n.boundingBox)),mr.applyMatrix4(t.matrixWorld),this.union(mr)}let s=t.children;for(let r=0,a=s.length;r<a;r++)this.expandByObject(s[r],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,En),En.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(Es),gr.subVectors(this.max,Es),$i.subVectors(t.a,Es),Ki.subVectors(t.b,Es),Qi.subVectors(t.c,Es),ai.subVectors(Ki,$i),oi.subVectors(Qi,Ki),Ci.subVectors($i,Qi);let e=[0,-ai.z,ai.y,0,-oi.z,oi.y,0,-Ci.z,Ci.y,ai.z,0,-ai.x,oi.z,0,-oi.x,Ci.z,0,-Ci.x,-ai.y,ai.x,0,-oi.y,oi.x,0,-Ci.y,Ci.x,0];return!Ro(e,$i,Ki,Qi,gr)||(e=[1,0,0,0,1,0,0,0,1],!Ro(e,$i,Ki,Qi,gr))?!1:(_r.crossVectors(ai,oi),e=[_r.x,_r.y,_r.z],Ro(e,$i,Ki,Qi,gr))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,En).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(En).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:(qn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),qn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),qn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),qn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),qn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),qn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),qn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),qn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(qn),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}},qn=[new F,new F,new F,new F,new F,new F,new F,new F],En=new F,mr=new Bn,$i=new F,Ki=new F,Qi=new F,ai=new F,oi=new F,Ci=new F,Es=new F,gr=new F,_r=new F,Ri=new F;function Ro(i,t,e,n,s){for(let r=0,a=i.length-3;r<=a;r+=3){Ri.fromArray(i,r);let o=s.x*Math.abs(Ri.x)+s.y*Math.abs(Ri.y)+s.z*Math.abs(Ri.z),c=t.dot(Ri),l=e.dot(Ri),u=n.dot(Ri);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>o)return!1}return!0}var Ie=new F,xr=new jt,Th=0,Qe=class extends Fn{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Th++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Go,this.updateRanges=[],this.gpuType=gn,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;for(let s=0,r=this.itemSize;s<r;s++)this.array[t+s]=e.array[n+s];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++)xr.fromBufferAttribute(this,e),xr.applyMatrix3(t),this.setXY(e,xr.x,xr.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)Ie.fromBufferAttribute(this,e),Ie.applyMatrix3(t),this.setXYZ(e,Ie.x,Ie.y,Ie.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Ie.fromBufferAttribute(this,e),Ie.applyMatrix4(t),this.setXYZ(e,Ie.x,Ie.y,Ie.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ie.fromBufferAttribute(this,e),Ie.applyNormalMatrix(t),this.setXYZ(e,Ie.x,Ie.y,Ie.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ie.fromBufferAttribute(this,e),Ie.transformDirection(t),this.setXYZ(e,Ie.x,Ie.y,Ie.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=Ss(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=$e(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ss(e,this.array)),e}setX(t,e){return this.normalized&&(e=$e(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ss(e,this.array)),e}setY(t,e){return this.normalized&&(e=$e(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=Ss(e,this.array)),e}setZ(t,e){return this.normalized&&(e=$e(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=Ss(e,this.array)),e}setW(t,e){return this.normalized&&(e=$e(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=$e(e,this.array),n=$e(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,s){return t*=this.itemSize,this.normalized&&(e=$e(e,this.array),n=$e(n,this.array),s=$e(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this}setXYZW(t,e,n,s,r){return t*=this.itemSize,this.normalized&&(e=$e(e,this.array),n=$e(n,this.array),s=$e(s,this.array),r=$e(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=s,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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!==Go&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}};var Fs=class extends Qe{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var Os=class extends Qe{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var qe=class extends Qe{constructor(t,e,n){super(new Float32Array(t),e,n)}},Ah=new Bn,Ts=new F,Io=new F,di=class{constructor(t=new F,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){let n=this.center;e!==void 0?n.copy(e):Ah.setFromPoints(t).getCenter(n);let s=0;for(let r=0,a=t.length;r<a;r++)s=Math.max(s,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(s),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){let 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){let 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;Ts.subVectors(t,this.center);let e=Ts.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),s=(n-this.radius)*.5;this.center.addScaledVector(Ts,s/n),this.radius+=s}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):(Io.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ts.copy(t.center).add(Io)),this.expandByPoint(Ts.copy(t.center).sub(Io))),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}},wh=0,pn=new de,Po=new on,ji=new F,sn=new Bn,As=new Bn,Ue=new F,An=class i extends Fn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:wh++}),this.uuid=rr(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(dh(t)?Os:Fs)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,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){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new kt().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return pn.makeRotationFromQuaternion(t),this.applyMatrix4(pn),this}rotateX(t){return pn.makeRotationX(t),this.applyMatrix4(pn),this}rotateY(t){return pn.makeRotationY(t),this.applyMatrix4(pn),this}rotateZ(t){return pn.makeRotationZ(t),this.applyMatrix4(pn),this}translate(t,e,n){return pn.makeTranslation(t,e,n),this.applyMatrix4(pn),this}scale(t,e,n){return pn.makeScale(t,e,n),this.applyMatrix4(pn),this}lookAt(t){return Po.lookAt(t),Po.updateMatrix(),this.applyMatrix4(Po.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ji).negate(),this.translate(ji.x,ji.y,ji.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let s=0,r=t.length;s<r;s++){let a=t[s];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new qe(n,3))}else{let n=Math.min(t.length,e.count);for(let s=0;s<n;s++){let r=t[s];e.setXYZ(s,r.x,r.y,r.z||0)}t.length>e.count&&Dt("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 Bn);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ut("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,s=e.length;n<s;n++){let r=e[n];sn.setFromBufferAttribute(r),this.morphTargetsRelative?(Ue.addVectors(this.boundingBox.min,sn.min),this.boundingBox.expandByPoint(Ue),Ue.addVectors(this.boundingBox.max,sn.max),this.boundingBox.expandByPoint(Ue)):(this.boundingBox.expandByPoint(sn.min),this.boundingBox.expandByPoint(sn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ut('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 di);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ut("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new F,1/0);return}if(t){let n=this.boundingSphere.center;if(sn.setFromBufferAttribute(t),e)for(let r=0,a=e.length;r<a;r++){let o=e[r];As.setFromBufferAttribute(o),this.morphTargetsRelative?(Ue.addVectors(sn.min,As.min),sn.expandByPoint(Ue),Ue.addVectors(sn.max,As.max),sn.expandByPoint(Ue)):(sn.expandByPoint(As.min),sn.expandByPoint(As.max))}sn.getCenter(n);let s=0;for(let r=0,a=t.count;r<a;r++)Ue.fromBufferAttribute(t,r),s=Math.max(s,n.distanceToSquared(Ue));if(e)for(let r=0,a=e.length;r<a;r++){let o=e[r],c=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)Ue.fromBufferAttribute(o,l),c&&(ji.fromBufferAttribute(t,l),Ue.add(ji)),s=Math.max(s,n.distanceToSquared(Ue))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Ut('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){Ut("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,s=e.normal,r=e.uv,a=this.getAttribute("tangent");(a===void 0||a.count!==n.count)&&(a=new Qe(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));let o=[],c=[];for(let _=0;_<n.count;_++)o[_]=new F,c[_]=new F;let l=new F,u=new F,p=new F,h=new jt,g=new jt,x=new jt,y=new F,m=new F;function d(_,E,D){l.fromBufferAttribute(n,_),u.fromBufferAttribute(n,E),p.fromBufferAttribute(n,D),h.fromBufferAttribute(r,_),g.fromBufferAttribute(r,E),x.fromBufferAttribute(r,D),u.sub(l),p.sub(l),g.sub(h),x.sub(h);let I=1/(g.x*x.y-x.x*g.y);isFinite(I)&&(y.copy(u).multiplyScalar(x.y).addScaledVector(p,-g.y).multiplyScalar(I),m.copy(p).multiplyScalar(g.x).addScaledVector(u,-x.x).multiplyScalar(I),o[_].add(y),o[E].add(y),o[D].add(y),c[_].add(m),c[E].add(m),c[D].add(m))}let T=this.groups;T.length===0&&(T=[{start:0,count:t.count}]);for(let _=0,E=T.length;_<E;++_){let D=T[_],I=D.start,O=D.count;for(let q=I,Y=I+O;q<Y;q+=3)d(t.getX(q+0),t.getX(q+1),t.getX(q+2))}let w=new F,M=new F,A=new F,b=new F;function C(_){A.fromBufferAttribute(s,_),b.copy(A);let E=o[_];w.copy(E),w.sub(A.multiplyScalar(A.dot(E))).normalize(),M.crossVectors(b,E);let I=M.dot(c[_])<0?-1:1;a.setXYZW(_,w.x,w.y,w.z,I)}for(let _=0,E=T.length;_<E;++_){let D=T[_],I=D.start,O=D.count;for(let q=I,Y=I+O;q<Y;q+=3)C(t.getX(q+0)),C(t.getX(q+1)),C(t.getX(q+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==e.count)n=new Qe(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let h=0,g=n.count;h<g;h++)n.setXYZ(h,0,0,0);let s=new F,r=new F,a=new F,o=new F,c=new F,l=new F,u=new F,p=new F;if(t)for(let h=0,g=t.count;h<g;h+=3){let x=t.getX(h+0),y=t.getX(h+1),m=t.getX(h+2);s.fromBufferAttribute(e,x),r.fromBufferAttribute(e,y),a.fromBufferAttribute(e,m),u.subVectors(a,r),p.subVectors(s,r),u.cross(p),o.fromBufferAttribute(n,x),c.fromBufferAttribute(n,y),l.fromBufferAttribute(n,m),o.add(u),c.add(u),l.add(u),n.setXYZ(x,o.x,o.y,o.z),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let h=0,g=e.count;h<g;h+=3)s.fromBufferAttribute(e,h+0),r.fromBufferAttribute(e,h+1),a.fromBufferAttribute(e,h+2),u.subVectors(a,r),p.subVectors(s,r),u.cross(p),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Ue.fromBufferAttribute(t,e),Ue.normalize(),t.setXYZ(e,Ue.x,Ue.y,Ue.z)}toNonIndexed(){function t(o,c){let l=o.array,u=o.itemSize,p=o.normalized,h=new l.constructor(c.length*u),g=0,x=0;for(let y=0,m=c.length;y<m;y++){o.isInterleavedBufferAttribute?g=c[y]*o.data.stride+o.offset:g=c[y]*u;for(let d=0;d<u;d++)h[x++]=l[g++]}return new Qe(h,u,p)}if(this.index===null)return Dt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new i,n=this.index.array,s=this.attributes;for(let o in s){let c=s[o],l=t(c,n);e.setAttribute(o,l)}let r=this.morphAttributes;for(let o in r){let c=[],l=r[o];for(let u=0,p=l.length;u<p;u++){let h=l[u],g=t(h,n);c.push(g)}e.morphAttributes[o]=c}e.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let o=0,c=a.length;o<c;o++){let l=a[o];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(t[l]=c[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let c in n){let l=n[c];t.data.attributes[c]=l.toJSON(t.data)}let s={},r=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],u=[];for(let p=0,h=l.length;p<h;p++){let g=l[p];u.push(g.toJSON(t.data))}u.length>0&&(s[c]=u,r=!0)}r&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));let 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;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let s=t.attributes;for(let l in s){let u=s[l];this.setAttribute(l,u.clone(e))}let r=t.morphAttributes;for(let l in r){let u=[],p=r[l];for(let h=0,g=p.length;h<g;h++)u.push(p[h].clone(e));this.morphAttributes[l]=u}this.morphTargetsRelative=t.morphTargetsRelative;let a=t.groups;for(let l=0,u=a.length;l<u;l++){let p=a[l];this.addGroup(p.start,p.count,p.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let c=t.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}};var Ch=0,fi=class extends Fn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ch++}),this.uuid=rr(),this.name="",this.type="Material",this.blending=Ui,this.side=Jn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Nr,this.blendDst=Ur,this.blendEquation=ui,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xt(0,0,0),this.blendAlpha=0,this.depthFunc=Fi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ko,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Li,this.stencilZFail=Li,this.stencilZPass=Li,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(let e in t){let n=t[e];if(n===void 0){Dt(`Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){Dt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(n):s&&s.isVector2&&n&&n.isVector2||s&&s.isEuler&&n&&n.isEuler||s&&s.isVector3&&n&&n.isVector3?s.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.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!==Ui&&(n.blending=this.blending),this.side!==Jn&&(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!==Nr&&(n.blendSrc=this.blendSrc),this.blendDst!==Ur&&(n.blendDst=this.blendDst),this.blendEquation!==ui&&(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!==Fi&&(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!==ko&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Li&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Li&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Li&&(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.allowOverride===!1&&(n.allowOverride=!1),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 s(r){let a=[];for(let o in r){let c=r[o];delete c.metadata,a.push(c)}return a}if(e){let r=s(t.textures),a=s(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new Xt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let n=t.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new jt().fromArray(n)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new jt().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}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;let e=t.clippingPlanes,n=null;if(e!==null){let s=e.length;n=new Array(s);for(let r=0;r!==s;++r)n[r]=e[r].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.allowOverride=t.allowOverride,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++}};var Yn=new F,Lo=new F,vr=new F,li=new F,Do=new F,yr=new F,No=new F,$r=class{constructor(t=new F,e=new F(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,Yn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let 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){let e=Yn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Yn.copy(this.origin).addScaledVector(this.direction,e),Yn.distanceToSquared(t))}distanceSqToSegment(t,e,n,s){Lo.copy(t).add(e).multiplyScalar(.5),vr.copy(e).sub(t).normalize(),li.copy(this.origin).sub(Lo);let r=t.distanceTo(e)*.5,a=-this.direction.dot(vr),o=li.dot(this.direction),c=-li.dot(vr),l=li.lengthSq(),u=Math.abs(1-a*a),p,h,g,x;if(u>0)if(p=a*c-o,h=a*o-c,x=r*u,p>=0)if(h>=-x)if(h<=x){let y=1/u;p*=y,h*=y,g=p*(p+a*h+2*o)+h*(a*p+h+2*c)+l}else h=r,p=Math.max(0,-(a*h+o)),g=-p*p+h*(h+2*c)+l;else h=-r,p=Math.max(0,-(a*h+o)),g=-p*p+h*(h+2*c)+l;else h<=-x?(p=Math.max(0,-(-a*r+o)),h=p>0?-r:Math.min(Math.max(-r,-c),r),g=-p*p+h*(h+2*c)+l):h<=x?(p=0,h=Math.min(Math.max(-r,-c),r),g=h*(h+2*c)+l):(p=Math.max(0,-(a*r+o)),h=p>0?r:Math.min(Math.max(-r,-c),r),g=-p*p+h*(h+2*c)+l);else h=a>0?-r:r,p=Math.max(0,-(a*h+o)),g=-p*p+h*(h+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,p),s&&s.copy(Lo).addScaledVector(vr,h),g}intersectSphere(t,e){Yn.subVectors(t.center,this.origin);let n=Yn.dot(this.direction),s=Yn.dot(Yn)-n*n,r=t.radius*t.radius;if(s>r)return null;let a=Math.sqrt(r-s),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,e):this.at(o,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,s,r,a,o,c,l=1/this.direction.x,u=1/this.direction.y,p=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,s=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,s=(t.min.x-h.x)*l),u>=0?(r=(t.min.y-h.y)*u,a=(t.max.y-h.y)*u):(r=(t.max.y-h.y)*u,a=(t.min.y-h.y)*u),n>a||r>s||((r>n||isNaN(n))&&(n=r),(a<s||isNaN(s))&&(s=a),p>=0?(o=(t.min.z-h.z)*p,c=(t.max.z-h.z)*p):(o=(t.max.z-h.z)*p,c=(t.min.z-h.z)*p),n>c||o>s)||((o>n||n!==n)&&(n=o),(c<s||s!==s)&&(s=c),s<0)?null:this.at(n>=0?n:s,e)}intersectsBox(t){return this.intersectBox(t,Yn)!==null}intersectTriangle(t,e,n,s,r){Do.subVectors(e,t),yr.subVectors(n,t),No.crossVectors(Do,yr);let a=this.direction.dot(No),o;if(a>0){if(s)return null;o=1}else if(a<0)o=-1,a=-a;else return null;li.subVectors(this.origin,t);let c=o*this.direction.dot(yr.crossVectors(li,yr));if(c<0)return null;let l=o*this.direction.dot(Do.cross(li));if(l<0||c+l>a)return null;let u=-o*li.dot(No);return u<0?null:this.at(u/a,r)}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)}},Oi=class extends fi{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 $n,this.combine=Jo,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}},Hl=new de,Ii=new $r,Mr=new di,Wl=new F,Sr=new F,br=new F,Er=new F,Uo=new F,Tr=new F,Xl=new F,Ar=new F,We=class extends on{constructor(t=new An,e=new Oi){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(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let s=e[n[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=s.length;r<a;r++){let o=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(t,e){let n=this.geometry,s=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(s,t);let o=this.morphTargetInfluences;if(r&&o){Tr.set(0,0,0);for(let c=0,l=r.length;c<l;c++){let u=o[c],p=r[c];u!==0&&(Uo.fromBufferAttribute(p,t),a?Tr.addScaledVector(Uo,u):Tr.addScaledVector(Uo.sub(e),u))}e.add(Tr)}return e}raycast(t,e){let n=this.geometry,s=this.material,r=this.matrixWorld;s!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Mr.copy(n.boundingSphere),Mr.applyMatrix4(r),Ii.copy(t.ray).recast(t.near),!(Mr.containsPoint(Ii.origin)===!1&&(Ii.intersectSphere(Mr,Wl)===null||Ii.origin.distanceToSquared(Wl)>(t.far-t.near)**2))&&(Hl.copy(r).invert(),Ii.copy(t.ray).applyMatrix4(Hl),!(n.boundingBox!==null&&Ii.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,Ii)))}_computeIntersections(t,e,n){let s,r=this.geometry,a=this.material,o=r.index,c=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,p=r.attributes.normal,h=r.groups,g=r.drawRange;if(o!==null)if(Array.isArray(a))for(let x=0,y=h.length;x<y;x++){let m=h[x],d=a[m.materialIndex],T=Math.max(m.start,g.start),w=Math.min(o.count,Math.min(m.start+m.count,g.start+g.count));for(let M=T,A=w;M<A;M+=3){let b=o.getX(M),C=o.getX(M+1),_=o.getX(M+2);s=wr(this,d,t,n,l,u,p,b,C,_),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=m.materialIndex,e.push(s))}}else{let x=Math.max(0,g.start),y=Math.min(o.count,g.start+g.count);for(let m=x,d=y;m<d;m+=3){let T=o.getX(m),w=o.getX(m+1),M=o.getX(m+2);s=wr(this,a,t,n,l,u,p,T,w,M),s&&(s.faceIndex=Math.floor(m/3),e.push(s))}}else if(c!==void 0)if(Array.isArray(a))for(let x=0,y=h.length;x<y;x++){let m=h[x],d=a[m.materialIndex],T=Math.max(m.start,g.start),w=Math.min(c.count,Math.min(m.start+m.count,g.start+g.count));for(let M=T,A=w;M<A;M+=3){let b=M,C=M+1,_=M+2;s=wr(this,d,t,n,l,u,p,b,C,_),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=m.materialIndex,e.push(s))}}else{let x=Math.max(0,g.start),y=Math.min(c.count,g.start+g.count);for(let m=x,d=y;m<d;m+=3){let T=m,w=m+1,M=m+2;s=wr(this,a,t,n,l,u,p,T,w,M),s&&(s.faceIndex=Math.floor(m/3),e.push(s))}}}};function Rh(i,t,e,n,s,r,a,o){let c;if(t.side===Ye?c=n.intersectTriangle(a,r,s,!0,o):c=n.intersectTriangle(s,r,a,t.side===Jn,o),c===null)return null;Ar.copy(o),Ar.applyMatrix4(i.matrixWorld);let l=e.ray.origin.distanceTo(Ar);return l<e.near||l>e.far?null:{distance:l,point:Ar.clone(),object:i}}function wr(i,t,e,n,s,r,a,o,c,l){i.getVertexPosition(o,Sr),i.getVertexPosition(c,br),i.getVertexPosition(l,Er);let u=Rh(i,t,e,n,Sr,br,Er,Xl);if(u){let p=new F;hi.getBarycoord(Xl,Sr,br,Er,p),s&&(u.uv=hi.getInterpolatedAttribute(s,o,c,l,p,new jt)),r&&(u.uv1=hi.getInterpolatedAttribute(r,o,c,l,p,new jt)),a&&(u.normal=hi.getInterpolatedAttribute(a,o,c,l,p,new F),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let h={a:o,b:c,c:l,normal:new F,materialIndex:0};hi.getNormal(Sr,br,Er,h.normal),u.face=h,u.barycoord=p}return u}var Bs=class extends je{constructor(t=null,e=1,n=1,s,r,a,o,c,l=Fe,u=Fe,p,h){super(null,a,o,c,l,u,s,r,p,h),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var zs=class extends Qe{constructor(t,e,n,s=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},ts=new de,ql=new de,Cr=[],Yl=new Bn,Ih=new de,ws=new We,Cs=new di,Vs=class extends We{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new zs(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<n;s++)this.setMatrixAt(s,Ih)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Bn),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,ts),Yl.copy(t.boundingBox).applyMatrix4(ts),this.boundingBox.union(Yl)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new di),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,ts),Cs.copy(t.boundingSphere).applyMatrix4(ts),this.boundingSphere.union(Cs)}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){return this.instanceColor===null?e.setRGB(1,1,1):e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){return e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){let n=e.morphTargetInfluences,s=this.morphTexture.source.data.data,r=n.length+1,a=t*r+1;for(let o=0;o<n.length;o++)n[o]=s[a+o]}raycast(t,e){let n=this.matrixWorld,s=this.count;if(ws.geometry=this.geometry,ws.material=this.material,ws.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Cs.copy(this.boundingSphere),Cs.applyMatrix4(n),t.ray.intersectsSphere(Cs)!==!1))for(let r=0;r<s;r++){this.getMatrixAt(r,ts),ql.multiplyMatrices(n,ts),ws.matrixWorld=ql,ws.raycast(t,Cr);for(let a=0,o=Cr.length;a<o;a++){let c=Cr[a];c.instanceId=r,c.object=this,e.push(c)}Cr.length=0}}setColorAt(t,e){return this.instanceColor===null&&(this.instanceColor=new zs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3),this}setMatrixAt(t,e){return e.toArray(this.instanceMatrix.array,t*16),this}setMorphAt(t,e){let n=e.morphTargetInfluences,s=n.length+1;this.morphTexture===null&&(this.morphTexture=new Bs(new Float32Array(s*this.count),s,this.count,ya,gn));let r=this.morphTexture.source.data.data,a=0;for(let l=0;l<n.length;l++)a+=n[l];let o=this.geometry.morphTargetsRelative?1:1-a,c=s*t;return r[c]=o,r.set(n,c+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Fo=new F,Ph=new F,Lh=new kt,Dn=class{constructor(t=new F(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,s){return this.normal.set(t,e,n),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let s=Fo.subVectors(n,e).cross(Ph.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let 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,n=!0){let s=t.delta(Fo),r=this.normal.dot(s);if(r===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let a=-(t.start.dot(this.normal)+this.constant)/r;return n===!0&&(a<0||a>1)?null:e.copy(t.start).addScaledVector(s,a)}intersectsLine(t){let 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){let n=e||Lh.getNormalMatrix(t),s=this.coplanarPoint(Fo).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-s.dot(r),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)}},Pi=new di,Dh=new jt(.5,.5),Rr=new F,ks=class{constructor(t=new Dn,e=new Dn,n=new Dn,s=new Dn,r=new Dn,a=new Dn){this.planes=[t,e,n,s,r,a]}set(t,e,n,s,r,a){let o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(s),o[4].copy(r),o[5].copy(a),this}copy(t){let e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Tn,n=!1){let s=this.planes,r=t.elements,a=r[0],o=r[1],c=r[2],l=r[3],u=r[4],p=r[5],h=r[6],g=r[7],x=r[8],y=r[9],m=r[10],d=r[11],T=r[12],w=r[13],M=r[14],A=r[15];if(s[0].setComponents(l-a,g-u,d-x,A-T).normalize(),s[1].setComponents(l+a,g+u,d+x,A+T).normalize(),s[2].setComponents(l+o,g+p,d+y,A+w).normalize(),s[3].setComponents(l-o,g-p,d-y,A-w).normalize(),n)s[4].setComponents(c,h,m,M).normalize(),s[5].setComponents(l-c,g-h,d-m,A-M).normalize();else if(s[4].setComponents(l-c,g-h,d-m,A-M).normalize(),e===Tn)s[5].setComponents(l+c,g+h,d+m,A+M).normalize();else if(e===Ls)s[5].setComponents(c,h,m,M).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(),Pi.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Pi.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Pi)}intersectsSprite(t){Pi.center.set(0,0,0);let e=Dh.distanceTo(t.center);return Pi.radius=.7071067811865476+e,Pi.applyMatrix4(t.matrixWorld),this.intersectsSphere(Pi)}intersectsSphere(t){let e=this.planes,n=t.center,s=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(n)<s)return!1;return!0}intersectsBox(t){let e=this.planes;for(let n=0;n<6;n++){let s=e[n];if(Rr.x=s.normal.x>0?t.max.x:t.min.x,Rr.y=s.normal.y>0?t.max.y:t.min.y,Rr.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Rr)<0)return!1}return!0}containsPoint(t){let 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)}};var Gs=class extends je{constructor(t=[],e=xi,n,s,r,a,o,c,l,u){super(t,e,n,s,r,a,o,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}};var Kn=class extends je{constructor(t,e,n=Cn,s,r,a,o=Fe,c=Fe,l,u=Un,p=1){if(u!==Un&&u!==yi)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let h={width:t,height:e,depth:p};super(h,s,r,a,o,c,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new rs(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},Kr=class extends Kn{constructor(t,e=Cn,n=xi,s,r,a=Fe,o=Fe,c,l=Un){let u={width:t,height:t,depth:1},p=[u,u,u,u,u,u];super(t,t,e,n,s,r,a,o,c,l),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},Hs=class extends je{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},pi=class i extends An{constructor(t=1,e=1,n=1,s=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:s,heightSegments:r,depthSegments:a};let o=this;s=Math.floor(s),r=Math.floor(r),a=Math.floor(a);let c=[],l=[],u=[],p=[],h=0,g=0;x("z","y","x",-1,-1,n,e,t,a,r,0),x("z","y","x",1,-1,n,e,-t,a,r,1),x("x","z","y",1,1,t,n,e,s,a,2),x("x","z","y",1,-1,t,n,-e,s,a,3),x("x","y","z",1,-1,t,e,n,s,r,4),x("x","y","z",-1,-1,t,e,-n,s,r,5),this.setIndex(c),this.setAttribute("position",new qe(l,3)),this.setAttribute("normal",new qe(u,3)),this.setAttribute("uv",new qe(p,2));function x(y,m,d,T,w,M,A,b,C,_,E){let D=M/C,I=A/_,O=M/2,q=A/2,Y=b/2,z=C+1,X=_+1,G=0,K=0,tt=new F;for(let ft=0;ft<X;ft++){let xt=ft*I-q;for(let Mt=0;Mt<z;Mt++){let te=Mt*D-O;tt[y]=te*T,tt[m]=xt*w,tt[d]=Y,l.push(tt.x,tt.y,tt.z),tt[y]=0,tt[m]=0,tt[d]=b>0?1:-1,u.push(tt.x,tt.y,tt.z),p.push(Mt/C),p.push(1-ft/_),G+=1}}for(let ft=0;ft<_;ft++)for(let xt=0;xt<C;xt++){let Mt=h+xt+z*ft,te=h+xt+z*(ft+1),Qt=h+(xt+1)+z*(ft+1),Ft=h+(xt+1)+z*ft;c.push(Mt,te,Ft),c.push(te,Qt,Ft),K+=6}o.addGroup(g,K,E),g+=K,h+=G}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};var Bi=class i extends An{constructor(t=1,e=1,n=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:s};let r=t/2,a=e/2,o=Math.floor(n),c=Math.floor(s),l=o+1,u=c+1,p=t/o,h=e/c,g=[],x=[],y=[],m=[];for(let d=0;d<u;d++){let T=d*h-a;for(let w=0;w<l;w++){let M=w*p-r;x.push(M,-T,0),y.push(0,0,1),m.push(w/o),m.push(1-d/c)}}for(let d=0;d<c;d++)for(let T=0;T<o;T++){let w=T+l*d,M=T+l*(d+1),A=T+1+l*(d+1),b=T+1+l*d;g.push(w,M,b),g.push(M,A,b)}this.setIndex(g),this.setAttribute("position",new qe(x,3)),this.setAttribute("normal",new qe(y,3)),this.setAttribute("uv",new qe(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.width,t.height,t.widthSegments,t.heightSegments)}},Ws=class i extends An{constructor(t=.5,e=1,n=32,s=1,r=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:s,thetaStart:r,thetaLength:a},n=Math.max(3,n),s=Math.max(1,s);let o=[],c=[],l=[],u=[],p=t,h=(e-t)/s,g=new F,x=new jt;for(let y=0;y<=s;y++){for(let m=0;m<=n;m++){let d=r+m/n*a;g.x=p*Math.cos(d),g.y=p*Math.sin(d),c.push(g.x,g.y,g.z),l.push(0,0,1),x.x=(g.x/e+1)/2,x.y=(g.y/e+1)/2,u.push(x.x,x.y)}p+=h}for(let y=0;y<s;y++){let m=y*(n+1);for(let d=0;d<n;d++){let T=d+m,w=T,M=T+n+1,A=T+n+2,b=T+1;o.push(w,M,b),o.push(M,A,b)}}this.setIndex(o),this.setAttribute("position",new qe(c,3)),this.setAttribute("normal",new qe(l,3)),this.setAttribute("uv",new qe(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new i(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}};function ki(i){let t={};for(let e in i){t[e]={};for(let n in i[e]){let s=i[e][n];if(Zl(s))s.isRenderTargetTexture?(Dt("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=s.clone();else if(Array.isArray(s))if(Zl(s[0])){let r=[];for(let a=0,o=s.length;a<o;a++)r[a]=s[a].clone();t[e][n]=r}else t[e][n]=s.slice();else t[e][n]=s}}return t}function Xe(i){let t={};for(let e=0;e<i.length;e++){let n=ki(i[e]);for(let s in n)t[s]=n[s]}return t}function Zl(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Nh(i){let t=[];for(let e=0;e<i.length;e++)t.push(i[e].clone());return t}function ul(i){let t=i.getRenderTarget();return t===null?i.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:$t.workingColorSpace}var Nc={clone:ki,merge:Xe},Uh=`void main() {
2	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3}`,Fh=`void main() {
4	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5}`,ln=class extends fi{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Uh,this.fragmentShader=Fh,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=ki(t.uniforms),this.uniformsGroups=Nh(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.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let s in this.uniforms){let a=this.uniforms[s].value;a&&a.isTexture?e.uniforms[s]={type:"t",value:a.toJSON(t).uuid}:a&&a.isColor?e.uniforms[s]={type:"c",value:a.getHex()}:a&&a.isVector2?e.uniforms[s]={type:"v2",value:a.toArray()}:a&&a.isVector3?e.uniforms[s]={type:"v3",value:a.toArray()}:a&&a.isVector4?e.uniforms[s]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?e.uniforms[s]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?e.uniforms[s]={type:"m4",value:a.toArray()}:e.uniforms[s]={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;let n={};for(let s in this.extensions)this.extensions[s]===!0&&(n[s]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}fromJSON(t,e){if(super.fromJSON(t,e),t.uniforms!==void 0)for(let n in t.uniforms){let s=t.uniforms[n];switch(this.uniforms[n]={},s.type){case"t":this.uniforms[n].value=e[s.value]||null;break;case"c":this.uniforms[n].value=new Xt().setHex(s.value);break;case"v2":this.uniforms[n].value=new jt().fromArray(s.value);break;case"v3":this.uniforms[n].value=new F().fromArray(s.value);break;case"v4":this.uniforms[n].value=new Ee().fromArray(s.value);break;case"m3":this.uniforms[n].value=new kt().fromArray(s.value);break;
5case"m4":this.uniforms[n].value=new de().fromArray(s.value);break;default:this.uniforms[n].value=s.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(let n in t.extensions)this.extensions[n]=t.extensions[n];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}},Qr=class extends ln{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},jr=class extends fi{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=to,this.normalScale=new jt(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 $n,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}},Xs=class extends jr{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 jt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Kt(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}};var ta=class extends fi{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Mc,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}},ea=class extends fi{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}};function Ir(i,t){return!i||i.constructor===t?i:typeof t.BYTES_PER_ELEMENT=="number"?new t(i):Array.prototype.slice.call(i)}var mi=class{constructor(t,e,n,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,s=e[n],r=e[n-1];n:{t:{let a;e:{i:if(!(t<s)){for(let o=n+2;;){if(s===void 0){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=s,s=e[++n],t<s)break t}a=e.length;break e}if(!(t>=r)){let o=e[1];t<o&&(n=2,r=o);for(let c=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(s=r,r=e[--n-1],t>=r)break t}a=n,n=0;break e}break n}for(;n<a;){let o=n+a>>>1;t<e[o]?a=o:n=o+1}
vendor: 11,643 bytes, line 5
5if(s=e[n],r=e[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,s)}return this.interpolate_(n,r,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s;for(let a=0;a!==s;++a)e[a]=n[r+a];return e}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},na=class extends mi{constructor(t,e,n,s){super(t,e,n,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Bo,endingEnd:Bo}}intervalChanged_(t,e,n){let s=this.parameterPositions,r=t-2,a=t+1,o=s[r],c=s[a];if(o===void 0)switch(this.getSettings_().endingStart){case zo:r=t,o=2*e-n;break;case Vo:r=s.length-2,o=e+s[r]-s[r+1];break;default:r=t,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case zo:a=t,c=2*n-e;break;case Vo:a=1,c=n+s[1]-s[0];break;default:a=t-1,c=e}let l=(n-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(c-n),this._offsetPrev=r*u,this._offsetNext=a*u}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=t*o,l=c-o,u=this._offsetPrev,p=this._offsetNext,h=this._weightPrev,g=this._weightNext,x=(n-e)/(s-e),y=x*x,m=y*x,d=-h*m+2*h*y-h*x,T=(1+h)*m+(-1.5-2*h)*y+(-.5+h)*x+1,w=(-1-g)*m+(1.5+g)*y+.5*x,M=g*m-g*y;for(let A=0;A!==o;++A)r[A]=d*a[u+A]+T*a[l+A]+w*a[c+A]+M*a[p+A];return r}},ia=class extends mi{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=t*o,l=c-o,u=(n-e)/(s-e),p=1-u;for(let h=0;h!==o;++h)r[h]=a[l+h]*p+a[c+h]*u;return r}},sa=class extends mi{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t){return this.copySampleValue_(t-1)}},ra=class extends mi{interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=t*o,l=c-o,u=this.inTangents,p=this.outTangents;if(!u||!p){let x=(n-e)/(s-e),y=1-x;for(let m=0;m!==o;++m)r[m]=a[l+m]*y+a[c+m]*x;return r}let h=o*2,g=t-1;for(let x=0;x!==o;++x){let y=a[l+x],m=a[c+x],d=g*h+x*2,T=p[d],w=p[d+1],M=t*h+x*2,A=u[M],b=u[M+1],C=(n-e)/(s-e),_,E,D,I,O;for(let q=0;q<8;q++){_=C*C,E=_*C,D=1-C,I=D*D,O=I*D;let z=O*e+3*I*C*T+3*D*_*A+E*s-n;if(Math.abs(z)<1e-10)break;let X=3*I*(T-e)+6*D*C*(A-T)+3*_*(s-A);if(Math.abs(X)<1e-10)break;C=C-z/X,C=Math.max(0,Math.min(1,C))}r[x]=O*y+3*I*C*w+3*D*_*b+E*m}return r}},cn=class{constructor(t,e,n,s){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=Ir(e,this.TimeBufferType),this.values=Ir(n,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Ir(t.times,Array),values:Ir(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(n.interpolation=s)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new sa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new ia(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new na(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new ra(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.inTangents=this.settings.inTangents,e.outTangents=this.settings.outTangents),e}setInterpolation(t){let e;switch(t){case Rs:e=this.InterpolantFactoryMethodDiscrete;break;case Xr:e=this.InterpolantFactoryMethodLinear;break;case Dr:e=this.InterpolantFactoryMethodSmooth;break;case Oo:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let 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 Dt("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rs;case this.InterpolantFactoryMethodLinear:return Xr;case this.InterpolantFactoryMethodSmooth:return Dr;case this.InterpolantFactoryMethodBezier:return Oo}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,s=e.length;n!==s;++n)e[n]*=t}return this}trim(t,e){let n=this.times,s=n.length,r=0,a=s-1;for(;r!==s&&n[r]<t;)++r;for(;a!==-1&&n[a]>e;)--a;if(++a,r!==0||a!==s){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(Ut("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,s=this.values,r=n.length;r===0&&(Ut("KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let o=0;o!==r;o++){let c=n[o];if(typeof c=="number"&&isNaN(c)){Ut("KeyframeTrack: Time is not a valid number.",this,o,c),t=!1;break}if(a!==null&&a>c){Ut("KeyframeTrack: Out of order keys.",this,o,c,a),t=!1;break}a=c}if(s!==void 0&&fh(s))for(let o=0,c=s.length;o!==c;++o){let l=s[o];if(isNaN(l)){Ut("KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),s=this.getInterpolation()===Dr,r=t.length-1,a=1;for(let o=1;o<r;++o){let c=!1,l=t[o],u=t[o+1];if(l!==u&&(o!==1||l!==t[0]))if(s)c=!0;else{let p=o*n,h=p-n,g=p+n;for(let x=0;x!==n;++x){let y=e[p+x];if(y!==e[h+x]||y!==e[g+x]){c=!0;break}}}if(c){if(o!==a){t[a]=t[o];let p=o*n,h=a*n;for(let g=0;g!==n;++g)e[h+g]=e[p+g]}++a}}if(r>0){t[a]=t[r];for(let o=r*n,c=a*n,l=0;l!==n;++l)e[c+l]=e[o+l];++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(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,s=new n(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};cn.prototype.ValueTypeName="";cn.prototype.TimeBufferType=Float32Array;cn.prototype.ValueBufferType=Float32Array;cn.prototype.DefaultInterpolation=Xr;var gi=class extends cn{constructor(t,e,n){super(t,e,n)}};gi.prototype.ValueTypeName="bool";gi.prototype.ValueBufferType=Array;gi.prototype.DefaultInterpolation=Rs;gi.prototype.InterpolantFactoryMethodLinear=void 0;gi.prototype.InterpolantFactoryMethodSmooth=void 0;var aa=class extends cn{constructor(t,e,n,s){super(t,e,n,s)}};aa.prototype.ValueTypeName="color";var oa=class extends cn{constructor(t,e,n,s){super(t,e,n,s)}};oa.prototype.ValueTypeName="number";var la=class extends mi{constructor(t,e,n,s){super(t,e,n,s)}interpolate_(t,e,n,s){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-e)/(s-e),l=t*o;for(let u=l+o;l!==u;l+=4)On.slerpFlat(r,0,a,l-o,a,l,c);return r}},qs=class extends cn{constructor(t,e,n,s){super(t,e,n,s)}InterpolantFactoryMethodLinear(t){return new la(this.times,this.values,this.getValueSize(),t)}};qs.prototype.ValueTypeName="quaternion";qs.prototype.InterpolantFactoryMethodSmooth=void 0;var _i=class extends cn{constructor(t,e,n){super(t,e,n)}};_i.prototype.ValueTypeName="string";_i.prototype.ValueBufferType=Array;_i.prototype.DefaultInterpolation=Rs;_i.prototype.InterpolantFactoryMethodLinear=void 0;_i.prototype.InterpolantFactoryMethodSmooth=void 0;var ca=class extends cn{constructor(t,e,n,s){super(t,e,n,s)}};ca.prototype.ValueTypeName="vector";var ha=class{constructor(t,e,n){let s=this,r=!1,a=0,o=0,c,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,r===!1&&s.onStart!==void 0&&s.onStart(u,a,o),r=!0},this.itemEnd=function(u){a++,s.onProgress!==void 0&&s.onProgress(u,a,o),a===o&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(u){s.onError!==void 0&&s.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,p){return l.push(u,p),this},this.removeHandler=function(u){let p=l.indexOf(u);return p!==-1&&l.splice(p,2),this},this.getHandler=function(u){for(let p=0,h=l.length;p<h;p+=2){let g=l[p],x=l[p+1];if(g.global&&(g.lastIndex=0),g.test(u))return x}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Uc=new ha,ua=class{constructor(t){this.manager=t!==void 0?t:Uc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){let n=this;return new Promise(function(s,r){n.load(t,s,e,r)})}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}};ua.DEFAULT_MATERIAL_NAME="__DEFAULT";var da=class extends on{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Xt(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}};var Pr=new F,Lr=new On,Ln=new F,Ys=class extends on{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new de,this.projectionMatrix=new de,this.projectionMatrixInverse=new de,this.coordinateSystem=Tn,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.matrixWorld.decompose(Pr,Lr,Ln),Ln.x===1&&Ln.y===1&&Ln.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Pr,Lr,Ln.set(1,1,1)).invert()}updateWorldMatrix(t,e,n=!1){super.updateWorldMatrix(t,e,n),this.matrixWorld.decompose(Pr,Lr,Ln),Ln.x===1&&Ln.y===1&&Ln.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Pr,Lr,Ln.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},ci=new F,Jl=new jt,$l=new jt,Ke=class extends Ys{constructor(t=50,e=1,n=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=s,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){let e=.5*this.getFilmHeight()/t;this.fov=qr*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(po*.5*this.fov);return .5*this.getFilmHeight()/t}
vendor: 9,013 bytes, line 5
5getEffectiveFOV(){return qr*2*Math.atan(Math.tan(po*.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){ci.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(ci.x,ci.y).multiplyScalar(-t/ci.z),ci.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ci.x,ci.y).multiplyScalar(-t/ci.z)}getViewSize(t,e){return this.getViewBounds(t,Jl,$l),e.subVectors($l,Jl)}setViewOffset(t,e,n,s,r,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=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(po*.5*this.fov)/this.zoom,n=2*e,s=this.aspect*n,r=-.5*s,a=this.view;if(this.view!==null&&this.view.enabled){let c=a.fullWidth,l=a.fullHeight;r+=a.offsetX*s/c,e-=a.offsetY*n/l,s*=a.width/c,n*=a.height/l}let o=this.filmOffset;o!==0&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,e,e-n,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let 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}};var zi=class extends Ys{constructor(t=-1,e=1,n=1,s=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=s,this.near=r,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,s,r,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=s,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,s=(this.top+this.bottom)/2,r=n-t,a=n+t,o=s+e,c=s-e;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,a=r+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let 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}};var Zs=class extends da{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}};var es=-90,ns=1,ls=class extends on{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let s=new Ke(es,ns,t,e);s.layers=this.layers,this.add(s);let r=new Ke(es,ns,t,e);r.layers=this.layers,this.add(r);let a=new Ke(es,ns,t,e);a.layers=this.layers,this.add(a);let o=new Ke(es,ns,t,e);o.layers=this.layers,this.add(o);let c=new Ke(es,ns,t,e);c.layers=this.layers,this.add(c);let l=new Ke(es,ns,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,s,r,a,o,c]=e;for(let l of e)this.remove(l);if(t===Tn)n.up.set(0,1,0),n.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(t===Ls)n.up.set(0,-1,0),n.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let l of e)this.add(l),l.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,c,l,u]=this.children,p=t.getRenderTarget(),h=t.getActiveCubeFace(),g=t.getActiveMipmapLevel(),x=t.xr.enabled;t.xr.enabled=!1;let y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;t.isWebGLRenderer===!0?m=t.state.buffers.depth.getReversed():m=t.reversedDepthBuffer,t.setRenderTarget(n,0,s),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,r),t.setRenderTarget(n,1,s),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,a),t.setRenderTarget(n,2,s),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,o),t.setRenderTarget(n,3,s),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,c),t.setRenderTarget(n,4,s),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,l),n.texture.generateMipmaps=y,t.setRenderTarget(n,5,s),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,u),t.setRenderTarget(p,h,g),t.xr.enabled=x,n.texture.needsPMREMUpdate=!0}},fa=class extends Ke{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}};var dl="\\[\\]\\.:\\/",Oh=new RegExp("["+dl+"]","g"),fl="[^"+dl+"]",Bh="[^"+dl.replace("\\.","")+"]",zh=/((?:WC+[\/:])*)/.source.replace("WC",fl),Vh=/(WCOD+)?/.source.replace("WCOD",Bh),kh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",fl),Gh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",fl),Hh=new RegExp("^"+zh+Vh+kh+Gh+"$"),Wh=["material","materials","bones","map"],Ho=class{constructor(t,e,n){let s=n||ve.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,s=this._bindings[n];s!==void 0&&s.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=n.length;s!==r;++s)n[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},ve=class i{constructor(t,e,n){this.path=e,this.parsedPath=n||i.parseTrackName(e),this.node=i.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 i.Composite(t,e,n):new i(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Oh,"")}static parseTrackName(t){let e=Hh.exec(t);if(e===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=n.nodeName&&n.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let r=n.nodeName.substring(s+1);Wh.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,s),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.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){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let a=0;a<r.length;a++){let o=r[a];if(o.name===e||o.uuid===e)return o;let c=n(o.children);if(c)return c}return null},s=n(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)t[e++]=n[s]}_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){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=t[e++];this.targetObject.needsUpdate=!0}
vendor: 8,582 bytes, line 5
5_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let s=0,r=n.length;s!==r;++s)n[s]=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,e=this.parsedPath,n=e.objectName,s=e.propertyName,r=e.propertyIndex;if(t||(t=i.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Dt("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=e.objectIndex;switch(n){case"materials":if(!t.material){Ut("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){Ut("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){Ut("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let u=0;u<t.length;u++)if(t[u].name===l){l=u;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){Ut("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){Ut("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){Ut("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(l!==void 0){if(t[l]===void 0){Ut("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[l]}}let a=t[s];if(a===void 0){let l=e.nodeName;Ut("PropertyBinding: Trying to update property for track: "+l+"."+s+" 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 c=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){Ut("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){Ut("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[r]!==void 0&&(r=t.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=s;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ve.Composite=Ho;ve.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ve.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ve.prototype.GetterByBindingType=[ve.prototype._getValue_direct,ve.prototype._getValue_array,ve.prototype._getValue_arrayElement,ve.prototype._getValue_toArray];ve.prototype.SetterByBindingTypeAndVersioning=[[ve.prototype._setValue_direct,ve.prototype._setValue_direct_setNeedsUpdate,ve.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ve.prototype._setValue_array,ve.prototype._setValue_array_setNeedsUpdate,ve.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ve.prototype._setValue_arrayElement,ve.prototype._setValue_arrayElement_setNeedsUpdate,ve.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ve.prototype._setValue_fromArray,ve.prototype._setValue_fromArray_setNeedsUpdate,ve.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Fm=new Float32Array(1);var Wo=class i{static{i.prototype.isMatrix2=!0}constructor(t,e,n,s){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,s)}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,s){let r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=s,this}};function pl(i,t,e,n){let s=Xh(n);switch(e){case ol:return i*t;case ya:return i*t/s.components*s.byteLength;case Ma:return i*t/s.components*s.byteLength;case Mi:return i*t*2/s.components*s.byteLength;case Sa:return i*t*2/s.components*s.byteLength;case ll:return i*t*3/s.components*s.byteLength;case xn:return i*t*4/s.components*s.byteLength;case ba:return i*t*4/s.components*s.byteLength;case js:case tr:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case er:case nr:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case Ta:case wa:return Math.max(i,16)*Math.max(t,8)/4;case Ea:case Aa:return Math.max(i,8)*Math.max(t,8)/2;case Ca:case Ra:case Pa:case La:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*8;case Ia:case ir:case Da:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case Na:return Math.floor((i+3)/4)*Math.floor((t+3)/4)*16;case Ua:return Math.floor((i+4)/5)*Math.floor((t+3)/4)*16;case Fa:return Math.floor((i+4)/5)*Math.floor((t+4)/5)*16;case Oa:return Math.floor((i+5)/6)*Math.floor((t+4)/5)*16;case Ba:return Math.floor((i+5)/6)*Math.floor((t+5)/6)*16;case za:return Math.floor((i+7)/8)*Math.floor((t+4)/5)*16;case Va:return Math.floor((i+7)/8)*Math.floor((t+5)/6)*16;case ka:return Math.floor((i+7)/8)*Math.floor((t+7)/8)*16;case Ga:return Math.floor((i+9)/10)*Math.floor((t+4)/5)*16;case Ha:return Math.floor((i+9)/10)*Math.floor((t+5)/6)*16;case Wa:return Math.floor((i+9)/10)*Math.floor((t+7)/8)*16;case Xa:return Math.floor((i+9)/10)*Math.floor((t+9)/10)*16;case qa:return Math.floor((i+11)/12)*Math.floor((t+9)/10)*16;case Ya:return Math.floor((i+11)/12)*Math.floor((t+11)/12)*16;case Za:case Ja:case $a:return Math.ceil(i/4)*Math.ceil(t/4)*16;case Ka:case Qa:return Math.ceil(i/4)*Math.ceil(t/4)*8;case sr:case ja:return Math.ceil(i/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function Xh(i){switch(i){case hn:case il:return{byteLength:1,components:1};case hs:case sl:case _n:return{byteLength:2,components:1};case xa:case va:return{byteLength:2,components:4};case Cn:case _a:case gn:return{byteLength:4,components:1};case rl:case al:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Dt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function sh(){let i=null,t=!1,e=null,n=null;function s(r,a){e(r,a),n=i.requestAnimationFrame(s)}return{start:function(){t!==!0&&e!==null&&i!==null&&(n=i.requestAnimationFrame(s),t=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){i=r}}}function Yh(i){let t=new WeakMap;function e(o,c){let l=o.array,u=o.usage,p=l.byteLength,h=i.createBuffer();i.bindBuffer(c,h),i.bufferData(c,l,u),o.onUploadCallback();let g;if(l instanceof Float32Array)g=i.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)g=i.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?g=i.HALF_FLOAT:g=i.UNSIGNED_SHORT;else if(l instanceof Int16Array)g=i.SHORT;else if(l instanceof Uint32Array)g=i.UNSIGNED_INT;else if(l instanceof Int32Array)g=i.INT;else if(l instanceof Int8Array)g=i.BYTE;else if(l instanceof Uint8Array)g=i.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)g=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:h,type:g,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:p}}function n(o,c,l){let u=c.array,p=c.updateRanges;if(i.bindBuffer(l,o),p.length===0)i.bufferSubData(l,0,u);else{p.sort((g,x)=>g.start-x.start);let h=0;for(let g=1;g<p.length;g++){let x=p[h],y=p[g];
vendor: 5,150 bytes, lines 5-118
5y.start<=x.start+x.count+1?x.count=Math.max(x.count,y.start+y.count-x.start):(++h,p[h]=y)}p.length=h+1;for(let g=0,x=p.length;g<x;g++){let y=p[g];i.bufferSubData(l,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}c.clearUpdateRanges()}c.onUploadCallback()}function s(o){return o.isInterleavedBufferAttribute&&(o=o.data),t.get(o)}function r(o){o.isInterleavedBufferAttribute&&(o=o.data);let c=t.get(o);c&&(i.deleteBuffer(c.buffer),t.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){let u=t.get(o);(!u||u.version<o.version)&&t.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}let l=t.get(o);if(l===void 0)t.set(o,e(o,c));else if(l.version<o.version){if(l.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(l.buffer,o,c),l.version=o.version}}return{get:s,remove:r,update:a}}var Zh=`#ifdef USE_ALPHAHASH
6	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7#endif`,Jh=`#ifdef USE_ALPHAHASH
8	const float ALPHA_HASH_SCALE = 0.05;
9	float hash2D( vec2 value ) {
10		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
11	}
12	float hash3D( vec3 value ) {
13		return hash2D( vec2( hash2D( value.xy ), value.z ) );
14	}
15	float getAlphaHashThreshold( vec3 position ) {
16		float maxDeriv = max(
17			length( dFdx( position.xyz ) ),
18			length( dFdy( position.xyz ) )
19		);
20		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
21		vec2 pixScales = vec2(
22			exp2( floor( log2( pixScale ) ) ),
23			exp2( ceil( log2( pixScale ) ) )
24		);
25		vec2 alpha = vec2(
26			hash3D( floor( pixScales.x * position.xyz ) ),
27			hash3D( floor( pixScales.y * position.xyz ) )
28		);
29		float lerpFactor = fract( log2( pixScale ) );
30		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
31		float a = min( lerpFactor, 1.0 - lerpFactor );
32		vec3 cases = vec3(
33			x * x / ( 2.0 * a * ( 1.0 - a ) ),
34			( x - 0.5 * a ) / ( 1.0 - a ),
35			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
36		);
37		float threshold = ( x < ( 1.0 - a ) )
38			? ( ( x < a ) ? cases.x : cases.y )
39			: cases.z;
40		return clamp( threshold , 1.0e-6, 1.0 );
41	}
42#endif`,$h=`#ifdef USE_ALPHAMAP
43	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44#endif`,Kh=`#ifdef USE_ALPHAMAP
45	uniform sampler2D alphaMap;
46#endif`,Qh=`#ifdef USE_ALPHATEST
47	#ifdef ALPHA_TO_COVERAGE
48	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49	if ( diffuseColor.a == 0.0 ) discard;
50	#else
51	if ( diffuseColor.a < alphaTest ) discard;
52	#endif
53#endif`,jh=`#ifdef USE_ALPHATEST
54	uniform float alphaTest;
55#endif`,tu=`#ifdef USE_AOMAP
56	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57	reflectedLight.indirectDiffuse *= ambientOcclusion;
58	#if defined( USE_CLEARCOAT ) 
59		clearcoatSpecularIndirect *= ambientOcclusion;
60	#endif
61	#if defined( USE_SHEEN ) 
62		sheenSpecularIndirect *= ambientOcclusion;
63	#endif
64	#if defined( USE_ENVMAP ) && defined( STANDARD )
65		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67	#endif
68#endif`,eu=`#ifdef USE_AOMAP
69	uniform sampler2D aoMap;
70	uniform float aoMapIntensity;
71#endif`,nu=`#ifdef USE_BATCHING
72	#if ! defined( GL_ANGLE_multi_draw )
73	#define gl_DrawID _gl_DrawID
74	uniform int _gl_DrawID;
75	#endif
76	uniform highp sampler2D batchingTexture;
77	uniform highp usampler2D batchingIdTexture;
78	mat4 getBatchingMatrix( const in float i ) {
79		int size = textureSize( batchingTexture, 0 ).x;
80		int j = int( i ) * 4;
81		int x = j % size;
82		int y = j / size;
83		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
84		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
85		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
86		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
87		return mat4( v1, v2, v3, v4 );
88	}
89	float getIndirectIndex( const in int i ) {
90		int size = textureSize( batchingIdTexture, 0 ).x;
91		int x = i % size;
92		int y = i / size;
93		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
94	}
95#endif
96#ifdef USE_BATCHING_COLOR
97	uniform sampler2D batchingColorTexture;
98	vec4 getBatchingColor( const in float i ) {
99		int size = textureSize( batchingColorTexture, 0 ).x;
100		int j = int( i );
101		int x = j % size;
102		int y = j / size;
103		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104	}
105#endif`,iu=`#ifdef USE_BATCHING
106	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107#endif`,su=`vec3 transformed = vec3( position );
108#ifdef USE_ALPHAHASH
109	vPosition = vec3( position );
110#endif`,ru=`vec3 objectNormal = vec3( normal );
111#ifdef USE_TANGENT
112	vec3 objectTangent = vec3( tangent.xyz );
113#endif`,au=`float G_BlinnPhong_Implicit( ) {
114	return 0.25;
115}
116float D_BlinnPhong( const in float shininess, const in float dotNH ) {
117	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
118}
119vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
120	vec3 halfDir = normalize( lightDir + viewDir );
121	float dotNH = saturate( dot( normal, halfDir ) );
122	float dotVH = saturate( dot( viewDir, halfDir ) );
123	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
124	float G = G_BlinnPhong_Implicit( );
125	float D = D_BlinnPhong( shininess, dotNH );
126	return F * ( G * D );
127} // validated`,ou=`#ifdef USE_IRIDESCENCE
128	const mat3 XYZ_TO_REC709 = mat3(
129		 3.2404542, -0.9692660,  0.0556434,
130		-1.5371385,  1.8760108, -0.2040259,
131		-0.4985314,  0.0415560,  1.0572252
132	);
133	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
134		vec3 sqrtF0 = sqrt( fresnel0 );
135		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
136	}
137	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
138		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
139	}
140	float IorToFresnel0( float transmittedIor, float incidentIor ) {
141		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
142	}
143	vec3 evalSensitivity( float OPD, vec3 shift ) {
144		float phase = 2.0 * PI * OPD * 1.0e-9;
145		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
146		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
147		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
148		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
149		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 ) );
150		xyz /= 1.0685e-7;
151		vec3 rgb = XYZ_TO_REC709 * xyz;
152		return rgb;
153	}
154	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
155		vec3 I;
156		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
157		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
158		float cosTheta2Sq = 1.0 - sinTheta2Sq;
159		if ( cosTheta2Sq < 0.0 ) {
160			return vec3( 1.0 );
161		}
162		float cosTheta2 = sqrt( cosTheta2Sq );
163		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
164		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
165		float T121 = 1.0 - R12;
166		float phi12 = 0.0;
167		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
168		float phi21 = PI - phi12;
169		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
170		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
171		vec3 phi23 = vec3( 0.0 );
172		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
173		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
174		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
175		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
176		vec3 phi = vec3( phi21 ) + phi23;
177		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
178		vec3 r123 = sqrt( R123 );
179		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
180		vec3 C0 = R12 + Rs;
181		I = C0;
182		vec3 Cm = Rs - T121;
183		for ( int m = 1; m <= 2; ++ m ) {
184			Cm *= r123;
185			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
186			I += Cm * Sm;
187		}
188		return max( I, vec3( 0.0 ) );
189	}
190#endif`,lu=`#ifdef USE_BUMPMAP
191	uniform sampler2D bumpMap;
192	uniform float bumpScale;
193	vec2 dHdxy_fwd() {
194		vec2 dSTdx = dFdx( vBumpMapUv );
195		vec2 dSTdy = dFdy( vBumpMapUv );
196		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
197		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
198		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
199		return vec2( dBx, dBy );
200	}
201	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
202		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
203		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
204		vec3 vN = surf_norm;
205		vec3 R1 = cross( vSigmaY, vN );
206		vec3 R2 = cross( vN, vSigmaX );
207		float fDet = dot( vSigmaX, R1 ) * faceDirection;
208		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209		return normalize( abs( fDet ) * surf_norm - vGrad );
210	}
211#endif`,cu=`#if NUM_CLIPPING_PLANES > 0
212	vec4 plane;
213	#ifdef ALPHA_TO_COVERAGE
214		float distanceToPlane, distanceGradient;
215		float clipOpacity = 1.0;
216		#pragma unroll_loop_start
217		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
218			plane = clippingPlanes[ i ];
219			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
220			distanceGradient = fwidth( distanceToPlane ) / 2.0;
221			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
222			if ( clipOpacity == 0.0 ) discard;
223		}
224		#pragma unroll_loop_end
225		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
226			float unionClipOpacity = 1.0;
227			#pragma unroll_loop_start
228			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
229				plane = clippingPlanes[ i ];
230				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
231				distanceGradient = fwidth( distanceToPlane ) / 2.0;
232				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
233			}
234			#pragma unroll_loop_end
235			clipOpacity *= 1.0 - unionClipOpacity;
236		#endif
237		diffuseColor.a *= clipOpacity;
238		if ( diffuseColor.a == 0.0 ) discard;
239	#else
240		#pragma unroll_loop_start
241		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
242			plane = clippingPlanes[ i ];
243			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
244		}
245		#pragma unroll_loop_end
246		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
247			bool clipped = true;
248			#pragma unroll_loop_start
249			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
250				plane = clippingPlanes[ i ];
251				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
252			}
253			#pragma unroll_loop_end
254			if ( clipped ) discard;
255		#endif
256	#endif
257#endif`,hu=`#if NUM_CLIPPING_PLANES > 0
258	varying vec3 vClipPosition;
259	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260#endif`,uu=`#if NUM_CLIPPING_PLANES > 0
261	varying vec3 vClipPosition;
262#endif`,du=`#if NUM_CLIPPING_PLANES > 0
263	vClipPosition = - mvPosition.xyz;
264#endif`,fu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265	diffuseColor *= vColor;
266#endif`,pu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267	varying vec4 vColor;
268#endif`,mu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269	varying vec4 vColor;
270#endif`,gu=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271	vColor = vec4( 1.0 );
272#endif
273#ifdef USE_COLOR_ALPHA
274	vColor *= color;
275#elif defined( USE_COLOR )
276	vColor.rgb *= color;
277#endif
278#ifdef USE_INSTANCING_COLOR
279	vColor.rgb *= instanceColor.rgb;
280#endif
281#ifdef USE_BATCHING_COLOR
282	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283#endif`,_u=`#define PI 3.141592653589793
284#define PI2 6.283185307179586
285#define PI_HALF 1.5707963267948966
286#define RECIPROCAL_PI 0.3183098861837907
287#define RECIPROCAL_PI2 0.15915494309189535
288#define EPSILON 1e-6
289#ifndef saturate
290#define saturate( a ) clamp( a, 0.0, 1.0 )
291#endif
292#define whiteComplement( a ) ( 1.0 - saturate( a ) )
293float pow2( const in float x ) { return x*x; }
294vec3 pow2( const in vec3 x ) { return x*x; }
295float pow3( const in float x ) { return x*x*x; }
296float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
297float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
298float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
299highp float rand( const in vec2 uv ) {
300	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
301	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
302	return fract( sin( sn ) * c );
303}
304#ifdef HIGH_PRECISION
305	float precisionSafeLength( vec3 v ) { return length( v ); }
306#else
307	float precisionSafeLength( vec3 v ) {
308		float maxComponent = max3( abs( v ) );
309		return length( v / maxComponent ) * maxComponent;
310	}
311#endif
312struct IncidentLight {
313	vec3 color;
314	vec3 direction;
315	bool visible;
316};
317struct ReflectedLight {
318	vec3 directDiffuse;
319	vec3 directSpecular;
320	vec3 indirectDiffuse;
321	vec3 indirectSpecular;
322};
323#ifdef USE_ALPHAHASH
324	varying vec3 vPosition;
325#endif
326vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
327	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
328}
329#define inverseTransformDirection transformDirectionByInverseViewMatrix
330vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
331	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
332}
333vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
334	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
335}
336bool isPerspectiveMatrix( mat4 m ) {
337	return m[ 2 ][ 3 ] == - 1.0;
338}
339vec2 equirectUv( in vec3 dir ) {
340	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
341	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
342	return vec2( u, v );
343}
344vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
345	return RECIPROCAL_PI * diffuseColor;
346}
347vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
348	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350}
351float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
352	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
353	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
354} // validated`,xu=`#ifdef ENVMAP_TYPE_CUBE_UV
355	#define cubeUV_minMipLevel 4.0
356	#define cubeUV_minTileSize 16.0
357	float getFace( vec3 direction ) {
358		vec3 absDirection = abs( direction );
359		float face = - 1.0;
360		if ( absDirection.x > absDirection.z ) {
361			if ( absDirection.x > absDirection.y )
362				face = direction.x > 0.0 ? 0.0 : 3.0;
363			else
364				face = direction.y > 0.0 ? 1.0 : 4.0;
365		} else {
366			if ( absDirection.z > absDirection.y )
367				face = direction.z > 0.0 ? 2.0 : 5.0;
368			else
369				face = direction.y > 0.0 ? 1.0 : 4.0;
370		}
371		return face;
372	}
373	vec2 getUV( vec3 direction, float face ) {
374		vec2 uv;
375		if ( face == 0.0 ) {
376			uv = vec2( direction.z, direction.y ) / abs( direction.x );
377		} else if ( face == 1.0 ) {
378			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
379		} else if ( face == 2.0 ) {
380			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
381		} else if ( face == 3.0 ) {
382			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
383		} else if ( face == 4.0 ) {
384			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
385		} else {
386			uv = vec2( direction.x, direction.y ) / abs( direction.z );
387		}
388		return 0.5 * ( uv + 1.0 );
389	}
390	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
391		float face = getFace( direction );
392		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
393		mipInt = max( mipInt, cubeUV_minMipLevel );
394		float faceSize = exp2( mipInt );
395		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
396		if ( face > 2.0 ) {
397			uv.y += faceSize;
398			face -= 3.0;
399		}
400		uv.x += face * faceSize;
401		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
402		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
403		uv.x *= CUBEUV_TEXEL_WIDTH;
404		uv.y *= CUBEUV_TEXEL_HEIGHT;
405		#ifdef texture2DGradEXT
406			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
407		#else
408			return texture2D( envMap, uv ).rgb;
409		#endif
410	}
411	#define cubeUV_r0 1.0
412	#define cubeUV_m0 - 2.0
413	#define cubeUV_r1 0.8
414	#define cubeUV_m1 - 1.0
415	#define cubeUV_r4 0.4
416	#define cubeUV_m4 2.0
417	#define cubeUV_r5 0.305
418	#define cubeUV_m5 3.0
419	#define cubeUV_r6 0.21
420	#define cubeUV_m6 4.0
421	float roughnessToMip( float roughness ) {
422		float mip = 0.0;
423		if ( roughness >= cubeUV_r1 ) {
424			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
425		} else if ( roughness >= cubeUV_r4 ) {
426			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
427		} else if ( roughness >= cubeUV_r5 ) {
428			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
429		} else if ( roughness >= cubeUV_r6 ) {
430			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
431		} else {
432			mip = - 2.0 * log2( 1.16 * roughness );		}
433		return mip;
434	}
435	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
436		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
437		float mipF = fract( mip );
438		float mipInt = floor( mip );
439		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
440		if ( mipF == 0.0 ) {
441			return vec4( color0, 1.0 );
442		} else {
443			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
444			return vec4( mix( color0, color1, mipF ), 1.0 );
445		}
446	}
447#endif`,vu=`vec3 transformedNormal = objectNormal;
448#ifdef USE_TANGENT
449	vec3 transformedTangent = objectTangent;
450#endif
451#ifdef USE_BATCHING
452	mat3 bm = mat3( batchingMatrix );
453	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
454	transformedNormal = bm * transformedNormal;
455	#ifdef USE_TANGENT
456		transformedTangent = bm * transformedTangent;
457	#endif
458#endif
459#ifdef USE_INSTANCING
460	mat3 im = mat3( instanceMatrix );
461	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
462	transformedNormal = im * transformedNormal;
463	#ifdef USE_TANGENT
464		transformedTangent = im * transformedTangent;
465	#endif
466#endif
467transformedNormal = normalMatrix * transformedNormal;
468#ifdef FLIP_SIDED
469	transformedNormal = - transformedNormal;
470#endif
471#ifdef USE_TANGENT
472	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
473#endif`,yu=`#ifdef USE_DISPLACEMENTMAP
474	uniform sampler2D displacementMap;
475	uniform float displacementScale;
476	uniform float displacementBias;
477#endif`,Mu=`#ifdef USE_DISPLACEMENTMAP
478	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
478placementBias );
479#endif`,Su=`#ifdef USE_EMISSIVEMAP
480	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
481	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
482		emissiveColor = sRGBTransferEOTF( emissiveColor );
483	#endif
484	totalEmissiveRadiance *= emissiveColor.rgb;
485#endif`,bu=`#ifdef USE_EMISSIVEMAP
486	uniform sampler2D emissiveMap;
487#endif`,Eu="gl_FragColor = linearToOutputTexel( gl_FragColor );",Tu=`vec4 LinearTransferOETF( in vec4 value ) {
488	return value;
489}
490vec4 sRGBTransferEOTF( in vec4 value ) {
491	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 );
492}
493vec4 sRGBTransferOETF( in vec4 value ) {
494	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 );
495}`,Au=`#ifdef USE_ENVMAP
496	#ifdef ENV_WORLDPOS
497		vec3 cameraToFrag;
498		if ( isOrthographic ) {
499			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
500		} else {
501			cameraToFrag = normalize( vWorldPosition - cameraPosition );
502		}
503		vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
504		#ifdef ENVMAP_MODE_REFLECTION
505			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
506		#else
507			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
508		#endif
509	#else
510		vec3 reflectVec = vReflect;
511	#endif
512	#ifdef ENVMAP_TYPE_CUBE
513		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
514		#ifdef ENVMAP_BLENDING_MULTIPLY
515			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
516		#elif defined( ENVMAP_BLENDING_MIX )
517			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
518		#elif defined( ENVMAP_BLENDING_ADD )
519			outgoingLight += envColor.xyz * specularStrength * reflectivity;
520		#endif
521	#endif
522#endif`,wu=`#ifdef USE_ENVMAP
523	uniform float envMapIntensity;
524	uniform mat3 envMapRotation;
525	#ifdef ENVMAP_TYPE_CUBE
526		uniform samplerCube envMap;
527	#else
528		uniform sampler2D envMap;
529	#endif
530#endif`,Cu=`#ifdef USE_ENVMAP
531	uniform float reflectivity;
532	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
533		#define ENV_WORLDPOS
534	#endif
535	#ifdef ENV_WORLDPOS
536		varying vec3 vWorldPosition;
537		uniform float refractionRatio;
538	#else
539		varying vec3 vReflect;
540	#endif
541#endif`,Ru=`#ifdef USE_ENVMAP
542	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
543		#define ENV_WORLDPOS
544	#endif
545	#ifdef ENV_WORLDPOS
546		
547		varying vec3 vWorldPosition;
548	#else
549		varying vec3 vReflect;
550		uniform float refractionRatio;
551	#endif
552#endif`,Iu=`#ifdef USE_ENVMAP
553	#ifdef ENV_WORLDPOS
554		vWorldPosition = worldPosition.xyz;
555	#else
556		vec3 cameraToVertex;
557		if ( isOrthographic ) {
558			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
559		} else {
560			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
561		}
562		vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
563		#ifdef ENVMAP_MODE_REFLECTION
564			vReflect = reflect( cameraToVertex, worldNormal );
565		#else
566			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
567		#endif
568	#endif
569#endif`,Pu=`#ifdef USE_FOG
570	vFogDepth = - mvPosition.z;
571#endif`,Lu=`#ifdef USE_FOG
572	varying float vFogDepth;
573#endif`,Du=`#ifdef USE_FOG
574	#ifdef FOG_EXP2
575		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
576	#else
577		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
578	#endif
579	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
580#endif`,Nu=`#ifdef USE_FOG
581	uniform vec3 fogColor;
582	varying float vFogDepth;
583	#ifdef FOG_EXP2
584		uniform float fogDensity;
585	#else
586		uniform float fogNear;
587		uniform float fogFar;
588	#endif
589#endif`,Uu=`#ifdef USE_GRADIENTMAP
590	uniform sampler2D gradientMap;
591#endif
592vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
593	float dotNL = dot( normal, lightDirection );
594	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
595	#ifdef USE_GRADIENTMAP
596		return vec3( texture2D( gradientMap, coord ).r );
597	#else
598		vec2 fw = fwidth( coord ) * 0.5;
599		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
600	#endif
601}`,Fu=`#ifdef USE_LIGHTMAP
602	uniform sampler2D lightMap;
603	uniform float lightMapIntensity;
604#endif`,Ou=`LambertMaterial material;
605material.diffuseColor = diffuseColor.rgb;
606material.specularStrength = specularStrength;`,Bu=`varying vec3 vViewPosition;
607struct LambertMaterial {
608	vec3 diffuseColor;
609	float specularStrength;
610};
611void 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 ) {
612	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
613	vec3 irradiance = dotNL * directLight.color;
614	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
615}
616void 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 ) {
617	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
618}
619#define RE_Direct				RE_Direct_Lambert
620#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,zu=`uniform bool receiveShadow;
621uniform vec3 ambientLightColor;
622#if defined( USE_LIGHT_PROBES )
623	uniform vec3 lightProbe[ 9 ];
624#endif
625vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
626	float x = normal.x, y = normal.y, z = normal.z;
627	vec3 result = shCoefficients[ 0 ] * 0.886227;
628	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
629	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
630	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
631	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
632	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
633	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
634	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
635	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
636	return result;
637}
638vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
639	vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
640	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
641	return irradiance;
642}
643vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
644	vec3 irradiance = ambientLightColor;
645	return irradiance;
646}
647float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
648	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
649	if ( cutoffDistance > 0.0 ) {
650		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
651	}
652	return distanceFalloff;
653}
654float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
655	return smoothstep( coneCosine, penumbraCosine, angleCosine );
656}
657#if NUM_DIR_LIGHTS > 0
658	struct DirectionalLight {
659		vec3 direction;
660		vec3 color;
661	};
662	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
663	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
664		light.color = directionalLight.color;
665		light.direction = directionalLight.direction;
666		light.visible = true;
667	}
668#endif
669#if NUM_POINT_LIGHTS > 0
670	struct PointLight {
671		vec3 position;
672		vec3 color;
673		float distance;
674		float decay;
675	};
676	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
677	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
678		vec3 lVector = pointLight.position - geometryPosition;
679		light.direction = normalize( lVector );
680		float lightDistance = length( lVector );
681		light.color = pointLight.color;
682		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
683		light.visible = ( light.color != vec3( 0.0 ) );
684	}
685#endif
686#if NUM_SPOT_LIGHTS > 0
687	struct SpotLight {
688		vec3 position;
689		vec3 direction;
690		vec3 color;
691		float distance;
692		float decay;
693		float coneCos;
694		float penumbraCos;
695	};
696	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
697	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
698		vec3 lVector = spotLight.position - geometryPosition;
699		light.direction = normalize( lVector );
700		float angleCos = dot( light.direction, spotLight.direction );
701		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
702		if ( spotAttenuation > 0.0 ) {
703			float lightDistance = length( lVector );
704			light.color = spotLight.color * spotAttenuation;
705			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
706			light.visible = ( light.color != vec3( 0.0 ) );
707		} else {
708			light.color = vec3( 0.0 );
709			light.visible = false;
710		}
711	}
712#endif
713#if NUM_RECT_AREA_LIGHTS > 0
714	struct RectAreaLight {
715		vec3 color;
716		vec3 position;
717		vec3 halfWidth;
718		vec3 halfHeight;
719	};
720	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
721	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
722#endif
723#if NUM_HEMI_LIGHTS > 0
724	struct HemisphereLight {
725		vec3 direction;
726		vec3 skyColor;
727		vec3 groundColor;
728	};
729	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
730	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
731		float dotNL = dot( normal, hemiLight.direction );
732		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
733		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
734		return irradiance;
735	}
736#endif
737#include <lightprobes_pars_fragment>`,Vu=`#ifdef USE_ENVMAP
738	vec3 getIBLIrradiance( const in vec3 normal ) {
739		#ifdef ENVMAP_TYPE_CUBE_UV
740			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
741			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
742			return PI * envMapColor.rgb * envMapIntensity;
743		#else
744			return vec3( 0.0 );
745		#endif
746	}
747	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
748		#ifdef ENVMAP_TYPE_CUBE_UV
749			vec3 reflectVec = reflect( - viewDir, normal );
750			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
751			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
752			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
753			return envMapColor.rgb * envMapIntensity;
754		#else
755			return vec3( 0.0 );
756		#endif
757	}
758	#ifdef USE_ANISOTROPY
759		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
760			#ifdef ENVMAP_TYPE_CUBE_UV
761				vec3 bentNormal = cross( bitangent, viewDir );
762				bentNormal = normalize( cross( bentNormal, bitangent ) );
763				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
764				return getIBLRadiance( viewDir, bentNormal, roughness );
765			#else
766				return vec3( 0.0 );
767			#endif
768		}
769	#endif
770#endif`,ku=`ToonMaterial material;
771material.diffuseColor = diffuseColor.rgb;`,Gu=`varying vec3 vViewPosition;
772struct ToonMaterial {
773	vec3 diffuseColor;
774};
775void 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 ) {
776	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
777	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
778}
779void 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 ) {
780	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
781}
782#define RE_Direct				RE_Direct_Toon
783#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Hu=`BlinnPhongMaterial material;
784material.diffuseColor = diffuseColor.rgb;
785material.specularColor = specular;
786material.specularShininess = shininess;
787material.specularStrength = specularStrength;`,Wu=`varying vec3 vViewPosition;
788struct BlinnPhongMaterial {
789	vec3 diffuseColor;
790	vec3 specularColor;
791	float specularShininess;
792	float specularStrength;
793};
794void 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 ) {
795	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
796	vec3 irradiance = dotNL * directLight.color;
797	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
798	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
799}
800void 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 ) {
801	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
802}
803#define RE_Direct				RE_Direct_BlinnPhong
804#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Xu=`PhysicalMaterial material;
805material.diffuseColor = diffuseColor.rgb;
806material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
807material.metalness = metalnessFactor;
808vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
809float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
810material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
811material.roughness = min( material.roughness, 1.0 );
812#ifdef IOR
813	material.ior = ior;
814	#ifdef USE_SPECULAR
815		float specularIntensityFactor = specularIntensity;
816		vec3 specularColorFactor = specularColor;
817		#ifdef USE_SPECULAR_COLORMAP
818			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
819		#endif
820		#ifdef USE_SPECULAR_INTENSITYMAP
821			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
822		#endif
823		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
824	#else
825		float specularIntensityFactor = 1.0;
826		vec3 specularColorFactor = vec3( 1.0 );
827		material.specularF90 = 1.0;
828	#endif
829	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
830	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
831#else
832	material.specularColor = vec3( 0.04 );
833	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
834	material.specularF90 = 1.0;
835#endif
836#ifdef USE_CLEARCOAT
837	material.clearcoat = clearcoat;
838	material.clearcoatRoughness = clearcoatRoughness;
839	material.clearcoatF0 = vec3( 0.04 );
840	material.clearcoatF90 = 1.0;
841	#ifdef USE_CLEARCOATMAP
842		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
843	#endif
844	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
845		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
846	#endif
847	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
848	material.clearcoatRoughness += geometryRoughness;
849	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
850#endif
851#ifdef USE_DISPERSION
852	material.dispersion = dispersion;
853#endif
854#ifdef USE_IRIDESCENCE
855	material.iridescence = iridescence;
856	material.iridescenceIOR = iridescenceIOR;
857	#ifdef USE_IRIDESCENCEMAP
858		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
859	#endif
860	#ifdef USE_IRIDESCENCE_THICKNESSMAP
861		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
862	#else
863		material.iridescenceThickness = iridescenceThicknessMaximum;
864	#endif
865#endif
866#ifdef USE_SHEEN
867	material.sheenColor = sheenColor;
868	#ifdef USE_SHEEN_COLORMAP
869		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
870	#endif
871	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
872	#ifdef USE_SHEEN_ROUGHNESSMAP
873		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
874	#endif
875#endif
876#ifdef USE_ANISOTROPY
877	#ifdef USE_ANISOTROPYMAP
878		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
879		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
880		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
881	#else
882		vec2 anisotropyV = anisotropyVector;
883	#endif
884	material.anisotropy = length( anisotropyV );
885	if( material.anisotropy == 0.0 ) {
886		anisotropyV = vec2( 1.0, 0.0 );
887	} else {
888		anisotropyV /= material.anisotropy;
889		material.anisotropy = saturate( material.anisotropy );
890	}
891	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
892	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
893	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
894#endif`,qu=`uniform sampler2D dfgLUT;
895struct PhysicalMaterial {
896	vec3 diffuseColor;
897	vec3 diffuseContribution;
898	vec3 specularColor;
899	vec3 specularColorBlended;
900	float roughness;
901	float metalness;
902	float specularF90;
903	float dispersion;
904	#ifdef USE_CLEARCOAT
905		float clearcoat;
906		float clearcoatRoughness;
907		vec3 clearcoatF0;
908		float clearcoatF90;
909	#endif
910	#ifdef USE_IRIDESCENCE
911		float iridescence;
912		float iridescenceIOR;
913		float iridescenceThickness;
914		vec3 iridescenceFresnel;
915		vec3 iridescenceF0;
916		vec3 iridescenceFresnelDielectric;
917		vec3 iridescenceFresnelMetallic;
918	#endif
919	#ifdef USE_SHEEN
920		vec3 sheenColor;
921		float sheenRoughness;
922	#endif
923	#ifdef IOR
924		float ior;
925	#endif
926	#ifdef USE_TRANSMISSION
927		float transmission;
928		float transmissionAlpha;
929		float thickness;
930		float attenuationDistance;
931		vec3 attenuationColor;
932	#endif
933	#ifdef USE_ANISOTROPY
934		float anisotropy;
935		float alphaT;
936		vec3 anisotropyT;
937		vec3 anisotropyB;
938	#endif
939};
940vec3 clearcoatSpecularDirect = vec3( 0.0 );
941vec3 clearcoatSpecularIndirect = vec3( 0.0 );
942vec3 sheenSpecularDirect = vec3( 0.0 );
943vec3 sheenSpecularIndirect = vec3(0.0 );
944vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
945    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
946    float x2 = x * x;
947    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
948    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
949}
950float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
951	float a2 = pow2( alpha );
952	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
953	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
954	return 0.5 / max( gv + gl, EPSILON );
955}
956float D_GGX( const in float alpha, const in float dotNH ) {
957	float a2 = pow2( alpha );
958	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
959	return RECIPROCAL_PI * a2 / pow2( denom );
960}
961#ifdef USE_ANISOTROPY
962	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 ) {
963		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
964		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
965		return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 965-1124
965;
966	}
967	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
968		float a2 = alphaT * alphaB;
969		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
970		highp float v2 = dot( v, v );
971		float w2 = a2 / v2;
972		return RECIPROCAL_PI * a2 * pow2 ( w2 );
973	}
974#endif
975#ifdef USE_CLEARCOAT
976	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
977		vec3 f0 = material.clearcoatF0;
978		float f90 = material.clearcoatF90;
979		float roughness = material.clearcoatRoughness;
980		float alpha = pow2( roughness );
981		vec3 halfDir = normalize( lightDir + viewDir );
982		float dotNL = saturate( dot( normal, lightDir ) );
983		float dotNV = saturate( dot( normal, viewDir ) );
984		float dotNH = saturate( dot( normal, halfDir ) );
985		float dotVH = saturate( dot( viewDir, halfDir ) );
986		vec3 F = F_Schlick( f0, f90, dotVH );
987		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
988		float D = D_GGX( alpha, dotNH );
989		return F * ( V * D );
990	}
991#endif
992vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
993	vec3 f0 = material.specularColorBlended;
994	float f90 = material.specularF90;
995	float roughness = material.roughness;
996	float alpha = pow2( roughness );
997	vec3 halfDir = normalize( lightDir + viewDir );
998	float dotNL = saturate( dot( normal, lightDir ) );
999	float dotNV = saturate( dot( normal, viewDir ) );
1000	float dotNH = saturate( dot( normal, halfDir ) );
1001	float dotVH = saturate( dot( viewDir, halfDir ) );
1002	vec3 F = F_Schlick( f0, f90, dotVH );
1003	#ifdef USE_IRIDESCENCE
1004		F = mix( F, material.iridescenceFresnel, material.iridescence );
1005	#endif
1006	#ifdef USE_ANISOTROPY
1007		float dotTL = dot( material.anisotropyT, lightDir );
1008		float dotTV = dot( material.anisotropyT, viewDir );
1009		float dotTH = dot( material.anisotropyT, halfDir );
1010		float dotBL = dot( material.anisotropyB, lightDir );
1011		float dotBV = dot( material.anisotropyB, viewDir );
1012		float dotBH = dot( material.anisotropyB, halfDir );
1013		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1014		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1015	#else
1016		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1017		float D = D_GGX( alpha, dotNH );
1018	#endif
1019	return F * ( V * D );
1020}
1021vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1022	const float LUT_SIZE = 64.0;
1023	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1024	const float LUT_BIAS = 0.5 / LUT_SIZE;
1025	float dotNV = saturate( dot( N, V ) );
1026	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1027	uv = uv * LUT_SCALE + LUT_BIAS;
1028	return uv;
1029}
1030float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1031	float l = length( f );
1032	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1033}
1034vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1035	float x = dot( v1, v2 );
1036	float y = abs( x );
1037	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1038	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1039	float v = a / b;
1040	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1041	return cross( v1, v2 ) * theta_sintheta;
1042}
1043vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1044	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1045	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1046	vec3 lightNormal = cross( v1, v2 );
1047	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1048	vec3 T1, T2;
1049	T1 = normalize( V - N * dot( V, N ) );
1050	T2 = - cross( N, T1 );
1051	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1052	vec3 coords[ 4 ];
1053	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1054	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1055	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1056	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1057	coords[ 0 ] = normalize( coords[ 0 ] );
1058	coords[ 1 ] = normalize( coords[ 1 ] );
1059	coords[ 2 ] = normalize( coords[ 2 ] );
1060	coords[ 3 ] = normalize( coords[ 3 ] );
1061	vec3 vectorFormFactor = vec3( 0.0 );
1062	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1063	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1064	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1065	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1066	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1067	return vec3( result );
1068}
1069#if defined( USE_SHEEN )
1070float D_Charlie( float roughness, float dotNH ) {
1071	float alpha = pow2( roughness );
1072	float invAlpha = 1.0 / alpha;
1073	float cos2h = dotNH * dotNH;
1074	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1075	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1076}
1077float V_Neubelt( float dotNV, float dotNL ) {
1078	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1079}
1080vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1081	vec3 halfDir = normalize( lightDir + viewDir );
1082	float dotNL = saturate( dot( normal, lightDir ) );
1083	float dotNV = saturate( dot( normal, viewDir ) );
1084	float dotNH = saturate( dot( normal, halfDir ) );
1085	float D = D_Charlie( sheenRoughness, dotNH );
1086	float V = V_Neubelt( dotNV, dotNL );
1087	return sheenColor * ( D * V );
1088}
1089#endif
1090float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1091	float dotNV = saturate( dot( normal, viewDir ) );
1092	float r2 = roughness * roughness;
1093	float rInv = 1.0 / ( roughness + 0.1 );
1094	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1095	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1096	float DG = exp( a * dotNV + b );
1097	return saturate( DG );
1098}
1099vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1100	float dotNV = saturate( dot( normal, viewDir ) );
1101	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1102	return specularColor * fab.x + specularF90 * fab.y;
1103}
1104#ifdef USE_IRIDESCENCE
1105void 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 ) {
1106#else
1107void 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 ) {
1108#endif
1109	float dotNV = saturate( dot( normal, viewDir ) );
1110	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1111	#ifdef USE_IRIDESCENCE
1112		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1113	#else
1114		vec3 Fr = specularColor;
1115	#endif
1116	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1117	float Ess = fab.x + fab.y;
1118	float Ems = 1.0 - Ess;
1119	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1120	singleScatter += FssEss;
1121	multiScatter += Fms * Ems;
1122}
1123vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1124	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1125-1254
1125	float dotNL = saturate( dot( normal, lightDir ) );
1126	float dotNV = saturate( dot( normal, viewDir ) );
1127	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1128	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1129	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1130	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1131	float Ess_V = dfgV.x + dfgV.y;
1132	float Ess_L = dfgL.x + dfgL.y;
1133	float Ems_V = 1.0 - Ess_V;
1134	float Ems_L = 1.0 - Ess_L;
1135	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1136	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1137	float compensationFactor = Ems_V * Ems_L;
1138	vec3 multiScatter = Fms * compensationFactor;
1139	return singleScatter + multiScatter;
1140}
1141#if NUM_RECT_AREA_LIGHTS > 0
1142	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 ) {
1143		vec3 normal = geometryNormal;
1144		vec3 viewDir = geometryViewDir;
1145		vec3 position = geometryPosition;
1146		vec3 lightPos = rectAreaLight.position;
1147		vec3 halfWidth = rectAreaLight.halfWidth;
1148		vec3 halfHeight = rectAreaLight.halfHeight;
1149		vec3 lightColor = rectAreaLight.color;
1150		float roughness = material.roughness;
1151		vec3 rectCoords[ 4 ];
1152		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1153		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1154		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1155		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1156		vec4 t1 = texture2D( ltc_1, uv );
1157		vec4 t2 = texture2D( ltc_2, uv );
1158		mat3 mInv = mat3(
1159			vec3( t1.x, 0, t1.y ),
1160			vec3(    0, 1,    0 ),
1161			vec3( t1.z, 0, t1.w )
1162		);
1163		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1164		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1165		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1166		#ifdef USE_CLEARCOAT
1167			vec3 Ncc = geometryClearcoatNormal;
1168			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1169			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1170			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1171			mat3 mInvClearcoat = mat3(
1172				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1173				vec3(             0, 1,             0 ),
1174				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1175			);
1176			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1177			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1178		#endif
1179	}
1180#endif
1181void 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 ) {
1182	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1183	vec3 irradiance = dotNL * directLight.color;
1184	#ifdef USE_CLEARCOAT
1185		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1186		vec3 ccIrradiance = dotNLcc * directLight.color;
1187		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1188	#endif
1189	#ifdef USE_SHEEN
1190 
1191 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1192 
1193 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1194 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1195 
1196 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1197 
1198 		irradiance *= sheenEnergyComp;
1199 
1200 	#endif
1201	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1202	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1203}
1204void 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 ) {
1205	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1206	#ifdef USE_SHEEN
1207		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1208		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1209		diffuse *= sheenEnergyComp;
1210	#endif
1211	reflectedLight.indirectDiffuse += diffuse;
1212}
1213void 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) {
1214	#ifdef USE_CLEARCOAT
1215		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1216	#endif
1217	#ifdef USE_SHEEN
1218		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1219 	#endif
1220	vec3 singleScatteringDielectric = vec3( 0.0 );
1221	vec3 multiScatteringDielectric = vec3( 0.0 );
1222	vec3 singleScatteringMetallic = vec3( 0.0 );
1223	vec3 multiScatteringMetallic = vec3( 0.0 );
1224	#ifdef USE_IRIDESCENCE
1225		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1226		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1227	#else
1228		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1229		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1230	#endif
1231	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1232	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1233	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1234	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1235	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1236	vec3 indirectSpecular = radiance * singleScattering;
1237	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1238	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1239	#ifdef USE_SHEEN
1240		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1241		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1242		indirectSpecular *= sheenEnergyComp;
1243		indirectDiffuse *= sheenEnergyComp;
1244	#endif
1245	reflectedLight.indirectSpecular += indirectSpecular;
1246	reflectedLight.indirectDiffuse += indirectDiffuse;
1247}
1248#define RE_Direct				RE_Direct_Physical
1249#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1250#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1251#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1252float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1253	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1254}`,
1254Yu=`
1255vec3 geometryPosition = - vViewPosition;
1256vec3 geometryNormal = normal;
1257vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1258vec3 geometryClearcoatNormal = vec3( 0.0 );
1259#ifdef USE_CLEARCOAT
1260	geometryClearcoatNormal = clearcoatNormal;
1261#endif
1262#ifdef USE_IRIDESCENCE
1263	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1264	if ( material.iridescenceThickness == 0.0 ) {
1265		material.iridescence = 0.0;
1266	} else {
1267		material.iridescence = saturate( material.iridescence );
1268	}
1269	if ( material.iridescence > 0.0 ) {
1270		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1271		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1272		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1273		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1274	}
1275#endif
1276IncidentLight directLight;
1277#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1278	PointLight pointLight;
1279	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1280	PointLightShadow pointLightShadow;
1281	#endif
1282	#pragma unroll_loop_start
1283	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1284		pointLight = pointLights[ i ];
1285		getPointLightInfo( pointLight, geometryPosition, directLight );
1286		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1287		pointLightShadow = pointLightShadows[ i ];
1288		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1289		#endif
1290		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1291	}
1292	#pragma unroll_loop_end
1293#endif
1294#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1295	SpotLight spotLight;
1296	vec4 spotColor;
1297	vec3 spotLightCoord;
1298	bool inSpotLightMap;
1299	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1300	SpotLightShadow spotLightShadow;
1301	#endif
1302	#pragma unroll_loop_start
1303	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1304		spotLight = spotLights[ i ];
1305		getSpotLightInfo( spotLight, geometryPosition, directLight );
1306		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1307		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1308		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1309		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1310		#else
1311		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1312		#endif
1313		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1314			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1315			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1316			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1317			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1318		#endif
1319		#undef SPOT_LIGHT_MAP_INDEX
1320		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1321		spotLightShadow = spotLightShadows[ i ];
1322		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1323		#endif
1324		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1325	}
1326	#pragma unroll_loop_end
1327#endif
1328#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1329	DirectionalLight directionalLight;
1330	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1331	DirectionalLightShadow directionalLightShadow;
1332	#endif
1333	#pragma unroll_loop_start
1334	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1335		directionalLight = directionalLights[ i ];
1336		getDirectionalLightInfo( directionalLight, directLight );
1337		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1338		directionalLightShadow = directionalLightShadows[ i ];
1339		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1340		#endif
1341		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1342	}
1343	#pragma unroll_loop_end
1344#endif
1345#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1346	RectAreaLight rectAreaLight;
1347	#pragma unroll_loop_start
1348	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1349		rectAreaLight = rectAreaLights[ i ];
1350		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1351	}
1352	#pragma unroll_loop_end
1353#endif
1354#if defined( RE_IndirectDiffuse )
1355	vec3 iblIrradiance = vec3( 0.0 );
1356	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1357	#if defined( USE_LIGHT_PROBES )
1358		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1359	#endif
1360	#if ( NUM_HEMI_LIGHTS > 0 )
1361		#pragma unroll_loop_start
1362		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1363			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1364		}
1365		#pragma unroll_loop_end
1366	#endif
1367	#ifdef USE_LIGHT_PROBES_GRID
1368		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1369		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
1370		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1371	#endif
1372#endif
1373#if defined( RE_IndirectSpecular )
1374	vec3 radiance = vec3( 0.0 );
1375	vec3 clearcoatRadiance = vec3( 0.0 );
1376#endif`,Zu=`#if defined( RE_IndirectDiffuse )
1377	#ifdef USE_LIGHTMAP
1378		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1379		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1380		irradiance += lightMapIrradiance;
1381	#endif
1382	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1383		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1384			iblIrradiance += getIBLIrradiance( geometryNormal );
1385		#endif
1386	#endif
1387#endif
1388#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1389	#ifdef USE_ANISOTROPY
1390		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1391	#else
1392		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1393	#endif
1394	#ifdef USE_CLEARCOAT
1395		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1396	#endif
1397#endif`,Ju=`#if defined( RE_IndirectDiffuse )
1398	#if defined( LAMBERT ) || defined( PHONG )
1399		irradiance += iblIrradiance;
1400	#endif
1401	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1402#endif
1403#if defined( RE_IndirectSpecular )
1404	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1405#endif`,$u=`#ifdef USE_LIGHT_PROBES_GRID
1406uniform highp sampler3D probesSH;
1407uniform vec3 probesMin;
1408uniform vec3 probesMax;
1409uniform vec3 probesResolution;
1410vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1411	vec3 res = probesResolution;
1412	vec3 gridRange = probesMax - probesMin;
1413	vec3 resMinusOne = res - 1.0;
1414	vec3 probeSpacing = gridRange / resMinusOne;
1415	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1416	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1417	uvw = uvw * resMinusOne / res + 0.5 / res;
1418	float nz          = res.z;
1419	float paddedSlices = nz + 2.0;
1420	float atlasDepth  = 7.0 * paddedSlices;
1421	float uvZBase     = uvw.z * nz + 1.0;
1422	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
1423	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
1424	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
1425	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
1426	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
1427	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
1428	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
1429	vec3 c0 = s0.xyz;
1430	vec3 c1 = vec3( s0.w, s1.xy );
1431	vec3 c2 = vec3( s1.zw, s2.x );
1432	vec3 c3 = s2.yzw;
1433	vec3 c4 = s3.xyz;
1434	vec3 c5 = vec3( s3.w, s4.xy );
1435	vec3 c6 = vec3( s4.zw, s5.x );
1436	vec3 c7 = s5.yzw;
1437	vec3 c8 = s6.xyz;
1438	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1439	vec3 result = c0 * 0.886227;
1440	result += c1 * 2.0 * 0.511664 * y;
1441	result += c2 * 2.0 * 0.511664 * z;
1442	result += c3 * 2.0 * 0.511664 * x;
1443	result += c4 * 2.0 * 0.429043 * x * y;
1444	result += c5 * 2.0 * 0.429043 * y * z;
1445	result += c6 * ( 0.743125 * z * z - 0.247708 );
1446	result += c7 * 2.0 * 0.429043 * x * z;
1447	result += c8 * 0.429043 * ( x * x - y * y );
1448	return max( result, vec3( 0.0 ) );
1449}
1450#endif`,Ku=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1451	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1452#endif`,Qu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1453	uniform float logDepthBufFC;
1454	varying float vFragDepth;
1455	varying float vIsPerspective;
1456#endif`,ju=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1457	varying float vFragDepth;
1458	varying float vIsPerspective;
1459#endif`,td=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1460	vFragDepth = 1.0 + gl_Position.w;
1461	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1462#endif`,ed=`#ifdef USE_MAP
1463	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1464	#ifdef DECODE_VIDEO_TEXTURE
1465		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1466	#endif
1467	diffuseColor *= sampledDiffuseColor;
1468#endif`,nd=`#ifdef USE_MAP
1469	uniform sampler2D map;
1470#endif`,id=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1471	#if defined( USE_POINTS_UV )
1472		vec2 uv = vUv;
1473	#else
1474		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1475	#endif
1476#endif
1477#ifdef USE_MAP
1478	diffuseColor *= texture2D( map, uv );
1479#endif
1480#ifdef USE_ALPHAMAP
1481	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1482#endif`,sd=`#if defined( USE_POINTS_UV )
1483	varying vec2 vUv;
1484#else
1485	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1486		uniform mat3 uvTransform;
1487	#endif
1488#endif
1489#ifdef USE_MAP
1490	uniform sampler2D map;
1491#endif
1492#ifdef USE_ALPHAMAP
1493	uniform sampler2D alphaMap;
1494#endif`,rd=`float metalnessFactor = metalness;
1495#ifdef USE_METALNESSMAP
1496	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1497	metalnessFactor *= texelMetalness.b;
1498#endif`,ad=`#ifdef USE_METALNESSMAP
1499	uniform sampler2D metalnessMap;
1500#endif`,od=`#ifdef USE_INSTANCING_MORPH
1501	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1502	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1503	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1504		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1505	}
1506#endif`,ld=`#if defined( USE_MORPHCOLORS )
1507	vColor *= morphTargetBaseInfluence;
1508	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1509		#if defined( USE_COLOR_ALPHA )
1510			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1511		#elif defined( USE_COLOR )
1512			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1513		#endif
1514	}
1515#endif`,cd=`#ifdef USE_MORPHNORMALS
1516	objectNormal *= morphTargetBaseInfluence;
1517	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1518		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1519	}
1520#endif`,hd=`#ifdef USE_MORPHTARGETS
1521	#ifndef USE_INSTANCING_MORPH
1522		uniform float morphTargetBaseInfluence;
1523		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1524	#endif
1525	uniform sampler2DArray morphTargetsTexture;
1526	uniform ivec2 morphTargetsTextureSize;
1527	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1528		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1529		int y = texelIndex / morphTargetsTextureSize.x;
1530		int x = texelIndex - y * morphTargetsTextureSize.x;
1531		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1532		return texelFetch( morphTargetsTexture, morphUV, 0 );
1533	}
1534#endif`,ud=`#ifdef USE_MORPHTARGETS
1535	transformed *= morphTargetBaseInfluence;
1536	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1537		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1538	}
1539#endif`,dd=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1540#ifdef FLAT_SHADED
1541	vec3 fdx = dFdx( vViewPosition );
1542	vec3 fdy = dFdy( vViewPosition );
1543	vec3 normal = normalize( cross( fdx, fdy ) );
1544#else
1545	vec3 normal = normalize( vNormal );
1546	#ifdef DOUBLE_SIDED
1547		normal *= faceDirection;
1548	#endif
1549#endif
1550#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1551	#ifdef USE_TANGENT
1552		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1553	#else
1554		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1555		#if defined( USE_NORMALMAP )
1556			vNormalMapUv
1557		#elif defined( USE_CLEARCOAT_NORMALMAP )
1558			vClearcoatNormalMapUv
1559		#else
1560			vUv
1561		#endif
1562		);
1563	#endif
1564	#ifdef DOUBLE_SIDED
1565		tbn[0] *= faceDirection;
1566		tbn[1] *= faceDirection;
1567	#endif
1568#endif
1569#ifdef USE_CLEARCOAT_NORMALMAP
1570	#ifdef USE_TANGENT
1571		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1572	#else
1573		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1574	#endif
1575	#ifdef DOUBLE_SIDED
1576		tbn2[0] *= faceDirection;
1577		tbn2[1] *= faceDirection;
1578	#endif
1579#endif
1580vec3 nonPerturbedNormal = normal;`,fd=`#ifdef USE_NORMALMAP_OBJECTSPACE
1581	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1582	#ifdef FLIP_SIDED
1583		normal = - normal;
1584	#endif
1585	#ifdef DOUBLE_SIDED
1586		normal = normal * faceDirection;
1587	#endif
1588	normal = normalize( normalMatrix * normal );
1589#elif defined( USE_NORMALMAP_TANGENTSPACE )
1590	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1591	#if defined( USE_PACKED_NORMALMAP )
1592		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1593	#endif
1594	mapN.xy *= normalScale;
1595	normal = normalize( tbn * mapN );
1596#elif defined( USE_BUMPMAP )
1597	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1598#endif`,pd=`#ifndef FLAT_SHADED
1599	varying vec3 vNormal;
1600	#ifdef USE_TANGENT
1601		varying vec3 vTangent;
1602		varying vec3 vBitangent;
1603	#endif
1604#endif`,md=`#ifndef FLAT_SHADED
1605	varying vec3 vNormal;
1606	#ifdef USE_TANGENT
1607		varying vec3 vTangent;
1608		varying vec3 vBitangent;
1609	#endif
1610#endif`,gd=`#ifndef FLAT_SHADED
1611	vNormal = normalize( transformedNormal );
1612	#ifdef USE_TANGENT
1613		vTangent = normalize( transformedTangent );
1614		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1615		#ifdef FLIP_SIDED
1616			vBitangent = - vBitangent;
1617		#endif
1618	#endif
1619#endif`,_d=`#ifdef USE_NORMALMAP
1620	uniform sampler2D normalMap;
1621	uniform vec2 normalScale;
1622#endif
1623#ifdef USE_NORMALMAP_OBJECTSPACE
1624	uniform mat3 normalMatrix;
1625#endif
1626#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1627	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1628		vec3 q0 = dFdx( eye_pos.xyz );
1629		vec3 q1 = dFdy( eye_pos.xyz );
1630		vec2 st0 = dFdx( uv.st );
1631		vec2 st1 = dFdy( uv.st );
1632		vec3 N = surf_norm;
1633		vec3 q1perp = cross( q1, N );
1634		vec3 q0perp = cross( N, q0 );
1635		vec3 T = q1perp * st0.x + q0perp * st1.x;
1636		vec3 B = q1perp * st0.y + q0perp * st1.y;
1637		float det = max( dot( T, T ), dot( B, B ) );
1638		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1639		return mat3( T * scale, B * scale, N );
1640	}
1641#endif`,xd=`#ifdef USE_CLEARCOAT
1642	vec3 clearcoatNormal = nonPerturbedNormal;
1643#endif`,vd=`#ifdef USE_CLEARCOAT_NORMALMAP
1644	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1645	clearcoatMapN.xy *= clearcoatNormalScale;
1646	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1647#endif`,yd=`#ifdef USE_CLEARCOATMAP
1648	uniform sampler2D clearcoatMap;
1649#endif
1650#ifdef USE_CLEARCOAT_NORMALMAP
1651	uniform sampler2D clearcoatNormalMap;
1652	uniform vec2 clearcoatNormalScale;
1653#endif
1654#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1655	uniform sampler2D clearcoatRoughnessMap;
1656#endif`,Md=`#ifdef USE_IRIDESCENCEMAP
1657	uniform sampler2D iridescenceMap;
1658#endif
1659#ifdef USE_IRIDESCENCE_THICKNESSMAP
1660	uniform sampler2D iridescenceThicknessMap;
1661#endif`,Sd=`#ifdef OPAQUE
1662diffuseColor.a = 1.0;
1663#endif
1664#ifdef USE_TRANSMISSION
1665diffuseColor.a *= material.transmissionAlpha;
1666#endif
1667gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,bd=`vec3 packNormalToRGB( const in vec3 normal ) {
1668	return normalize( normal ) * 0.5 + 0.5;
1669}
1670vec3 unpackRGBToNormal( const in vec3 rgb ) {
1671	return 2.0 * rgb.xyz - 1.0;
1672}
1673const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1674const float Inv255 = 1. / 255.;
1675const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1676const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1677const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1678const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1679vec4 packDepthToRGBA( const in float v ) {
1680	if( v <= 0.0 )
1681		return vec4( 0., 0., 0., 0. );
1682	if( v >= 1.0 )
1683		return vec4( 1., 1., 1., 1. );
1684	float vuf;
1685	float af = modf( v * PackFactors.a, vuf );
1686	float bf = modf( vuf * ShiftRight8, vuf );
1687	float gf = modf( vuf * ShiftRight8, vuf );
1688	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1689}
1690vec3 packDepthToRGB( const in float v ) {
1691	if( v <= 0.0 )
1692		return vec3( 0., 0., 0. );
1693	if( v >= 1.0 )
1694		return vec3( 1., 1., 1. );
1695	float vuf;
1696	float bf = modf( v * PackFactors.b, vuf );
1697	float gf = modf( vuf * ShiftRight8, vuf );
1698	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1699}
1700vec2 packDepthToRG( const in float v ) {
1701	if( v <= 0.0 )
1702		return vec2( 0., 0. );
1703	if( v >= 1.0 )
1704		return vec2( 1., 1. );
1705	float vuf;
1706	float gf = modf( v * 256., vuf );
1707	return vec2( vuf * Inv255, gf );
1708}
1709float unpackRGBAToDepth( const in vec4 v ) {
1710	return dot( v, UnpackFactors4 );
1711}
1712float unpackRGBToDepth( const in vec3 v ) {
1713	return dot( v, UnpackFactors3 );
1714}
1715float unpackRGToDepth( const in vec2 v ) {
1716	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1717}
1718vec4 pack2HalfToRGBA( const in vec2 v ) {
1719	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1720	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1721}
1722vec2 unpackRGBATo2Half( const in vec4 v ) {
1723	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1724}
1725float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1726	return ( viewZ + near ) / ( near - far );
1727}
1728float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1729	#ifdef USE_REVERSED_DEPTH_BUFFER
1730	
1731		return depth * ( far - near ) - far;
1732	#else
1733		return depth * ( near - far ) - near;
1734	#endif
1735}
1736float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1737	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1738}
1739float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1740	
1741	#ifdef USE_REVERSED_DEPTH_BUFFER
1742		return ( near * far ) / ( ( near - far ) * depth - near );
1743	#else
1744		return ( near * far ) / ( ( far - near ) * depth - far );
1745	#endif
1746}`,Ed=`#ifdef PREMULTIPLIED_ALPHA
1747	gl_FragColor.rgb *= gl_FragColor.a;
1748#endif`,Td=`vec4 mvPosition = vec4( transformed, 1.0 );
1749#ifdef USE_BATCHING
1750	mvPosition = batchingMatrix * mvPosition;
1751#endif
1752#ifdef USE_INSTANCING
1753	mvPosition = instanceMatrix * mvPosition;
1754#endif
1755mvPosition = modelViewMatrix * mvPosition;
1756gl_Position = projectionMatrix * mvPosition;`,Ad=`#ifdef DITHERING
1757	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1758#endif`,wd=`#ifdef DITHERING
1759	vec3 dithering( vec3 color ) {
1760		float grid_position = rand( gl_FragCoord.xy );
1761		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1762		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1763		return color + dither_shift_RGB;
1764	}
1765#endif`,Cd=`float roughnessFactor = roughness;
1766#ifdef USE_ROUGHNESSMAP
1767	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1768	roughnessFactor *= texelRoughness.g;
1769#endif`,Rd=`#ifdef USE_ROUGHNESSMAP
1770	uniform sampler2D roughnessMap;
1771#endif`,Id=`#if NUM_SPOT_LIGHT_COORDS > 0
1772	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1773#endif
1774#if NUM_SPOT_LIGHT_MAPS > 0
1775	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1776#endif
1777#ifdef USE_SHADOWMAP
1778	#if NUM_DIR_LIGHT_SHADOWS > 0
1779		#if defined( SHADOWMAP_TYPE_PCF )
1780			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1781		#else
1782			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1783		#endif
1784		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1785		struct DirectionalLightShadow {
1786			float shadowIntensity;
1787			float shadowBias;
1788			float shadowNormalBias;
1789			float shadowRadius;
1790			vec2 shadowMapSize;
1791		};
1792		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1793	#endif
1794	#if NUM_SPOT_LIGHT_SHADOWS > 0
1795		#if defined( SHADOWMAP_TYPE_PCF )
1796			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1797		#else
1798			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1799		#endif
1800		struct SpotLightShadow {
1801			float shadowIntensity;
1802			float shadowBias;
1803			float shadowNormalBias;
1804			float shadowRadius;
1805			vec2 shadowMapSize;
1806		};
1807		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1808	#endif
1809	#if NUM_POINT_LIGHT_SHADOWS > 0
1810		#if defined( SHADOWMAP_TYPE_PCF )
1811			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1812		#elif defined( SHADOWMAP_TYPE_BASIC )
1813			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1814		#endif
1815		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1816		struct PointLightShadow {
1817			float shadowIntensity;
1818			float shadowBias;
1819			float shadowNormalBias;
1820			float shadowRadius;
1821			vec2 shadowMapSize;
1822			float shadowCameraNear;
1823			float shadowCameraFar;
1824		};
1825		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1826	#endif
1827	#if defined( SHADOWMAP_TYPE_PCF )
1828		float interleavedGradientNoise( vec2 position ) {
1829			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1830		}
1831		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1832			const float goldenAngle = 2.399963229728653;
1833			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1834			float theta = float( sampleIndex ) * goldenAngle + phi;
1835			return vec2( cos( theta ), sin( theta ) ) * r;
1836		}
1837	#endif
1838	#if defined( SHADOWMAP_TYPE_PCF )
1839		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1840			float shadow = 1.0;
1841			shadowCoord.xyz /= shadowCoord.w;
1842			shadowCoord.z += shadowBias;
1843			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1844			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1845			if ( frustumTest ) {
1846				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1847				float radius = shadowRadius * texelSize.x;
1848				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1849				shadow = (
1850					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1851					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1852					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1853					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1854					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1855				) * 0.2;
1856			}
1857			return mix( 1.0, shadow, shadowIntensity );
1858		}
1859	#elif defined( SHADOWMAP_TYPE_VSM )
1860		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1861			float shadow = 1.0;
1862			shadowCoord.xyz /= shadowCoord.w;
1863			#ifdef USE_REVERSED_DEPTH_BUFFER
1864				shadowCoord.z -= shadowBias;
1865			#else
1866				shadowCoord.z += shadowBias;
1867			#endif
1868			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1869			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1870			if ( frustumTest ) {
1871				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1872				float mean = distribution.x;
1873				float variance = distribution.y * distribution.y;
1874				#ifdef USE_REVERSED_DEPTH_BUFFER
1875					float hard_shadow = step( mean, shadowCoord.z );
1876				#else
1877					float hard_shadow = step( shadowCoord.z, mean );
1878				#endif
1879				
1880				if ( hard_shadow == 1.0 ) {
1881					shadow = 1.0;
1882				} else {
1883					variance = max( variance, 0.0000001 );
1884					float d = shadowCoord.z - mean;
1885					float p_max = variance / ( variance + d * d );
1886					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1887					shadow = max( hard_shadow, p_max );
1888				}
1889			}
1890			return mix( 1.0, shadow, shadowIntensity );
1891		}
1892	#else
1893		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1894			float shadow = 1.0;
1895			shadowCoord.xyz /= shadowCoord.w;
1896			#ifdef USE_REVERSED_DEPTH_BUFFER
1897				shadowCoord.z -= shadowBias;
1898			#else
1899				shadowCoord.z += shadowBias;
1900			#endif
1901			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1902			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1903			if ( frustumTest ) {
1904				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1905				#ifdef USE_REVERSED_DEPTH_BUFFER
1906					shadow = step( depth, shadowCoord.z );
1907				#else
1908					shadow = step( shadowCoord.z, depth );
1909				#endif
1910			}
1911			return mix( 1.0, shadow, shadowIntensity );
1912		}
1913	#endif
1914	#if NUM_POINT_LIGHT_SHADOWS > 0
1915	#if defined( SHADOWMAP_TYPE_PCF )
1916	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1917		float shadow = 1.0;
1918		vec3 lightToPosition = shadowCoord.xyz;
1919		vec3 bd3D = normalize( lightToPosition );
1920		vec3 absVec = abs( lightToPosition );
1921		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1922		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1923			#ifdef USE_REVERSED_DEPTH_BUFFER
1924				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1925				dp -= shadowBias;
1926			#else
1927				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1928				dp += shadowBias;
1929			#endif
1930			float texelSize = shadowRadius / shadowMapSize.x;
1931			vec3 absDir = abs( bd3D );
1932			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1933			tangent = normalize( cross( bd3D, tangent ) );
1934			vec3 bitangent = cross( bd3D, tangent );
1935			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1936			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1937			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1938			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1939			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1940			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1941			shadow = (
1942				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1943				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1944				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1945				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1946				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1947			) * 0.2;
1948		}
1949		return mix( 1.0, shadow, shadowIntensity );
1950	}
1951	#elif defined( SHADOWMAP_TYPE_BASIC )
1952	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1953		float shadow = 1.0;
1954		vec3 lightToPosition = shadowCoord.xyz;
1955		vec3 absVec = abs( lightToPosition );
1956		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1957		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1958			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1959			dp += shadowBias;
1960			vec3 bd3D = normalize( lightToPosition );
1961			float depth = textureCube( shadowMap, bd3D ).r;
1962			#ifdef USE_REVERSED_DEPTH_BUFFER
1963				depth = 1.0 - depth;
1964			#endif
1965			shadow = step( dp, depth );
1966		}
1967		return mix( 1.0, shadow, shadowIntensity );
1968	}
1969	#endif
1970	#endif
1971#endif`,Pd=`#if NUM_SPOT_LIGHT_COORDS > 0
1972	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1973	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1974#endif
1975#ifdef USE_SHADOWMAP
1976	#if NUM_DIR_LIGHT_SHADOWS > 0
1977		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1978		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1979		struct DirectionalLightShadow {
1980			float shadowIntensity;
1981			float shadowBias;
1982			float shadowNormalBias;
1983			float shadowRadius;
1984			vec2 shadowMapSize;
1985		};
1986		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1987	#endif
1988	#if NUM_SPOT_LIGHT_SHADOWS > 0
1989		struct SpotLightShadow {
1990			float shadowIntensity;
1991			float shadowBias;
1992			float shadowNormalBias;
1993			float shadowRadius;
1994			vec2 shadowMapSize;
1995		};
1996		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1997	#endif
1998	#if NUM_POINT_LIGHT_SHADOWS > 0
1999		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2000		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2001		struct PointLightShadow {
2002			float shadowIntensity;
2003			float shadowBias;
2004			float shadowNormalBias;
2005			float shadowRadius;
2006			vec2 shadowMapSize;
2007			float shadowCameraNear;
2008			float shadowCameraFar;
2009		};
2010		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2011	#endif
2012#endif`,Ld=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2013	#ifdef HAS_NORMAL
2014		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
2015	#else
2016		vec3 shadowWorldNormal = vec3( 0.0 );
2017	#endif
2018	vec4 shadowWorldPosition;
2019#endif
2020#if defined( USE_SHADOWMAP )
2021	#if NUM_DIR_LIGHT_SHADOWS > 0
2022		#pragma unroll_loop_start
2023		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2024			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2025			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2026		}
2027		#pragma unroll_loop_end
2028	#endif
2029	#if NUM_POINT_LIGHT_SHADOWS > 0
2030		#pragma unroll_loop_start
2031		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2032			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2033			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2034		}
2035		#pragma unroll_loop_end
2036	#endif
2037#endif
2038#if NUM_SPOT_LIGHT_COORDS > 0
2039	#pragma unroll_loop_start
2040	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2041		shadowWorldPosition = worldPosition;
2042		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2043			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2044		#endif
2045		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2046	}
2047	#pragma unroll_loop_end
2048#endif`,Dd=`float getShadowMask() {
2049	float shadow = 1.0;
2050	#ifdef USE_SHADOWMAP
2051	#if NUM_DIR_LIGHT_SHADOWS > 0
2052	DirectionalLightShadow directionalLight;
2053	#pragma unroll_loop_start
2054	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2055		directionalLight = directionalLightShadows[ i ];
2056		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2057	}
2058	#pragma unroll_loop_end
2059	#endif
2060	#if NUM_SPOT_LIGHT_SHADOWS > 0
2061	SpotLightShadow spotLight;
2062	#pragma unroll_loop_start
2063	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2064		spotLight = spotLightShadows[ i ];
2065		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2066	}
2067	#pragma unroll_loop_end
2068	#endif
2069	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2070	PointLightShadow pointLight;
2071	#pragma unroll_loop_start
2072	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2073		pointLight = pointLightShadows[ i ];
2074		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2075	}
2076	#pragma unroll_loop_end
2077	#endif
2078	#endif
2079	return shadow;
2080}`,Nd=`#ifdef USE_SKINNING
2081	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2082	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2083	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2084	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2085#endif`,Ud=`#ifdef USE_SKINNING
2086	uniform mat4 bindMatrix;
2087	uniform mat4 bindMatrixInverse;
2088	uniform highp sampler2D boneTexture;
2089	mat4 getBoneMatrix( const in float i ) {
2090		int size = textureSize( boneTexture, 0 ).x;
2091		int j = int( i ) * 4;
2092		int x = j % size;
2093		int y = j / size;
2094		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2095		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2096		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2097		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2098		return mat4( v1, v2, v3, v4 );
2099	}
2100#endif`,Fd=`#ifdef USE_SKINNING
2101	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2102	vec4 skinned = vec4( 0.0 );
2103	skinned += boneMatX * skinVertex * skinWeight.x;
2104	skinned += boneMatY * skinVertex * skinWeight.y;
2105	skinned += boneMatZ * skinVertex * skinWeight.z;
2106	skinned += boneMatW * skinVertex * skinWeight.w;
2107	transformed = ( bindMatrixInverse * skinned ).xyz;
2108#endif`,Od=`#ifdef USE_SKINNING
2109	mat4 skinMatrix = mat4( 0.0 );
2110	skinMatrix += skinWeight.x * boneMatX;
2111	skinMatrix += skinWeight.y * boneMatY;
2112	skinMatrix += skinWeight.z * boneMatZ;
2113	skinMatrix += skinWeight.w * boneMatW;
2114	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2115	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2116	#ifdef USE_TANGENT
2117		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2118	#endif
2119#endif`,Bd=`float specularStrength;
2120#ifdef USE_SPECULARMAP
2121	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2122	specularStrength = texelSpecular.r;
2123#else
2124	specularStrength = 1.0;
2125#endif`,zd=`#ifdef USE_SPECULARMAP
2126	uniform sampler2D specularMap;
2127#endif`,Vd=`#if defined( TONE_MAPPING )
2128	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2129#endif`,kd=`#ifndef saturate
2130#define saturate( a ) clamp( a, 0.0, 1.0 )
2131#endif
2132uniform float toneMappingExposure;
2133vec3 LinearToneMapping( vec3 color ) {
2134	return saturate( toneMappingExposure * color );
2135}
2136vec3 ReinhardToneMapping( vec3 color ) {
2137	color *= toneMappingExposure;
2138	return saturate( color / ( vec3( 1.0 ) + color ) );
2139}
2140vec3 CineonToneMapping( vec3 color ) {
2141	color *= toneMappingExposure;
2142	color = max( vec3( 0.0 ), color - 0.004 );
2143	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2144}
2145vec3 RRTAndODTFit( vec3 v ) {
2146	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2147	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2148	return a / b;
2149}
2150vec3 ACESFilmicToneMapping( vec3 color ) {
2151	const mat3 ACESInputMat = mat3(
2152		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2153		vec3( 0.04823, 0.01566, 0.83777 )
2154	);
2155	const mat3 ACESOutputMat = mat3(
2156		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2157		vec3( -0.07367, -0.00605,  1.07602 )
2158	);
2159	color *= toneMappingExposure / 0.6;
2160	color = ACESInputMat * color;
2161	color = RRTAndODTFit( color );
2162	color = ACESOutputMat * color;
2163	return saturate( color );
2164}
2165const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2166	vec3( 1.6605, - 0.1246, - 0.0182 ),
2167	vec3( - 0.5876, 1.1329, - 0.1006 ),
2168	vec3( - 0.0728, - 0.0083, 1.1187 )
2169);
2170const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2171	vec3( 0.6274, 0.0691, 0.0164 ),
2172	vec3( 0.3293, 0.9195, 0.0880 ),
2173	vec3( 0.0433, 0.0113, 0.8956 )
2174);
2175vec3 agxDefaultContrastApprox( vec3 x ) {
2176	vec3 x2 = x * x;
2177	vec3 x4 = x2 * x2;
2178	return + 15.5 * x4 * x2
2179		- 40.14 * x4 * x
2180		+ 31.96 * x4
2181		- 6.868 * x2 * x
2182		+ 0.4298 * x2
2183		+ 0.1191 * x
2184		- 0.00232;
2185}
2186vec3 AgXToneMapping( vec3 color ) {
2187	const mat3 AgXInsetMatrix = mat3(
2188		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2189		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2190		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2191	);
2192	const mat3 AgXOutsetMatrix = mat3(
2193		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2194		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2195		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2196	);
2197	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2198	color *= toneMappingExposure;
2199	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2200	color = AgXInsetMatrix * color;
2201	color = max( color, 1e-10 );	color = log2( color );
2202	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2203	color = clamp( color, 0.0, 1.0 );
2204	color = agxDefaultContrastApprox( color );
2205	color = AgXOutsetMatrix * color;
2206	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2207	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2208	color = clamp( color, 0.0, 1.0 );
2209	return color;
2210}
2211vec3 NeutralToneMapping( vec3 color ) {
2212	const float StartCompression = 0.8 - 0.04;
2213	const float Desaturation = 0.15;
2214	color *= toneMappingExposure;
2215	float x = min( color.r, min( color.g, color.b ) );
2216	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2217	color -= offset;
2218	float peak = max( color.r, max( color.g, color.b ) );
2219	if ( peak < StartCompression ) return color;
2220	float d = 1. - StartCompression;
2221	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2222	color *= newPeak / peak;
2223	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2224	return mix( color, vec3( newPeak ), g );
2225}
2226vec3 CustomToneMapping( vec3 color ) { return color; }`,Gd=`#ifdef USE_TRANSMISSION
2227	material.transmission = transmission;
2228	material.transmissionAlpha = 1.0;
2229	material.thickness = thickness;
2230	material.attenuationDistance = attenuationDistance;
2231	material.attenuationColor = attenuationColor;
2232	#ifdef USE_TRANSMISSIONMAP
2233		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2234	#endif
2235	#ifdef USE_THICKNESSMAP
2236		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2237	#endif
2238	vec3 pos = vWorldPosition;
2239	vec3 v = normalize( cameraPosition - pos );
2240	vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
2241	vec4 transmitted = getIBLVolumeRefraction(
2242		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2243		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2244		material.attenuationColor, material.attenuationDistance );
2245	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2246	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2247#endif`,Hd=`#ifdef USE_TRANSMISSION
2248	uniform float transmission;
2249	uniform float thickness;
2250	uniform float attenuationDistance;
2251	uniform vec3 attenuationColor;
2252	#ifdef USE_TRANSMISSIONMAP
2253		uniform sampler2D transmissionMap;
2254	#endif
2255	#ifdef USE_THICKNESSMAP
2256		uniform sampler2D thicknessMap;
2257	#endif
2258	uniform vec2 transmissionSamplerSize;
2259	uniform sampler2D transmissionSamplerMap;
2260	uniform mat4 modelMatrix;
2261	uniform mat4 projectionMatrix;
2262	varying vec3 vWorldPosition;
2263	float w0( float a ) {
2264		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2265	}
2266	float w1( float a ) {
2267		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2268	}
2269	float w2( float a ){
2270		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2271	}
2272	float w3( float a ) {
2273		return ( 1.0 / 6.0 ) * ( a * a * a );
2274	}
2275	float g0( float a ) {
2276		return w0( a ) + w1( a );
2277	}
2278	float g1( float a ) {
2279		return w2( a ) + w3( a );
2280	}
2281	float h0( float a ) {
2282		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2283	}
2284	float h1( float a ) {
2285		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2286	}
2287	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2288		uv = uv * texelSize.zw + 0.5;
2289		vec2 iuv = floor( uv );
2290		vec2 fuv = fract( uv );
2291		float g0x = g0( fuv.x );
2292		float g1x = g1( fuv.x );
2293		float h0x = h0( fuv.x );
2294		float h1x = h1( fuv.x );
2295		float h0y = h0( fuv.y );
2296		float h1y = h1( fuv.y );
2297		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2298		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2299		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2300		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2301		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2302			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2303	}
2304	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2305		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2306		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2307		vec2 fLodSizeInv = 1.0 / fLodSize;
2308		vec2 cLodSizeInv = 1.0 / cLodSize;
2309		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2310		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2311		return mix( fSample, cSample, fract( lod ) );
2312	}
2313	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2314		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2315		vec3 modelScale;
2316		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2317		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2318		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2319		return normalize( refractionVector ) * thickness * modelScale;
2320	}
2321	float applyIorToRoughness( const in float roughness, const in float ior ) {
2322		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2323	}
2324	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2325		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2326		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2327	}
2328	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2329		if ( isinf( attenuationDistance ) ) {
2330			return vec3( 1.0 );
2331		} else {
2332			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2333			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2334		}
2335	}
2336	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2337		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2338		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2339		const in vec3 attenuationColor, const in float attenuationDistance ) {
2340		vec4 transmittedLight;
2341		vec3 transmittance;
2342		#ifdef USE_DISPERSION
2343			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2344			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2345			for ( int i = 0; i < 3; i ++ ) {
2346				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2347				vec3 refractedRayExit = position + transmissionRay;
2348				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2349				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2350				refractionCoords += 1.0;
2351				refractionCoords /= 2.0;
2352				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2353				transmittedLight[ i ] = transmissionSample[ i ];
2354				transmittedLight.a += transmissionSample.a;
2355				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2356			}
2357			transmittedLight.a /= 3.0;
2358		#else
2359			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2360			vec3 refractedRayExit = position + transmissionRay;
2361			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2362			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2363			refractionCoords += 1.0;
2364			refractionCoords /= 2.0;
2365			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2366			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2367		#endif
2368		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2369		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2370		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2371		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2372	}
2373#endif`,Wd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2374	varying vec2 vUv;
2375#endif
2376#ifdef USE_MAP
2377	varying vec2 vMapUv;
2378#endif
2379#ifdef USE_ALPHAMAP
2380	varying vec2 vAlphaMapUv;
2381#endif
2382#ifdef USE_LIGHTMAP
2383	varying vec2 vLightMapUv;
2384#endif
2385#ifdef USE_AOMAP
2386	varying vec2 vAoMapUv;
2387#endif
2388#ifdef USE_BUMPMAP
2389	varying vec2 vBumpMapUv;
2390#endif
2391#ifdef USE_NORMALMAP
2392	varying vec2 vNormalMapUv;
2393#endif
2394#ifdef USE_EMISSIVEMAP
2395	varying vec2 vEmissiveMapUv;
2396#endif
2397#ifdef USE_METALNESSMAP
2398	varying vec2 vMetalnessMapUv;
2399#endif
2400#ifdef USE_ROUGHNESSMAP
2401	varying vec2 vRoughnessMapUv;
2402#endif
2403#ifdef USE_ANISOTROPYMAP
2404	varying vec2 vAnisotropyMapUv;
2405#endif
2406#ifdef USE_CLEARCOATMAP
2407	varying vec2 vClearcoatMapUv;
2408#endif
2409#ifdef USE_CLEARCOAT_NORMALMAP
2410	varying vec2 vClearcoatNormalMapUv;
2411#endif
2412#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2413	varying vec2 vClearcoatRoughnessMapUv;
2414#endif
2415#ifdef USE_IRIDESCENCEMAP
2416	varying vec2 vIridescenceMapUv;
2417#endif
2418#ifdef USE_IRIDESCENCE_THICKNESSMAP
2419	varying vec2 vIridescenceThicknessMapUv;
2420#endif
2421#ifdef USE_SHEEN_COLORMAP
2422	varying vec2 vSheenColorMapUv;
2423#endif
2424#ifdef USE_SHEEN_ROUGHNESSMAP
2425	varying vec2 vSheenRoughnessMapUv;
2426#endif
2427#ifdef USE_SPECULARMAP
2428	varying vec2 vSpecularMapUv;
2429#endif
2430#ifdef USE_SPECULAR_COLORMAP
2431	varying vec2 vSpecularColorMapUv;
2432#endif
2433#ifdef USE_SPECULAR_INTENSITYMAP
2434	varying vec2 vSpecularIntensityMapUv;
2435#endif
2436#ifdef USE_TRANSMISSIONMAP
2437	uniform mat3 transmissionMapTransform;
2438	varying vec2 vTransmissionMapUv;
2439#endif
2440#ifdef USE_THICKNESSMAP
2441	uniform mat3 thicknessMapTransform;
2442	varying vec2 vThicknessMapUv;
2443#endif`,Xd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2444	varying vec2 vUv;
2445#endif
2446#ifdef USE_MAP
2447	uniform mat3 mapTransform;
2448	varying vec2 vMapUv;
2449#endif
2450#ifdef USE_ALPHAMAP
2451	uniform mat3 alphaMapTransform;
2452	varying vec2 vAlphaMapUv;
2453#endif
2454#ifdef USE_LIGHTMAP
2455	uniform mat3 lightMapTransform;
2456	varying vec2 vLightMapUv;
2457#endif
2458#ifdef USE_AOMAP
2459	uniform mat3 aoMapTransform;
2460	varying vec2 vAoMapUv;
2461#endif
2462#ifdef USE_BUMPMAP
2463	uniform mat3 bumpMapTransform;
2464	varying vec2 vBumpMapUv;
2465#endif
2466#ifdef USE_NORMALMAP
2467	uniform mat3 normalMapTransform;
2468	varying vec2 vNormalMapUv;
2469#endif
2470#ifdef USE_DISPLACEMENTMAP
2471	uniform mat3 displacementMapTransform;
2472	varying vec2 vDisplacementMapUv;
2473#endif
2474#ifdef USE_EMISSIVEMAP
2475	uniform mat3 emissiveMapTransform;
2476	varying vec2 vEmissiveMapUv;
2477#endif
2478#ifdef USE_METALNESSMAP
2479	uniform mat3 metalnessMapTransform;
2480	varying vec2 vMetalnessMapUv;
2481#endif
2482#ifdef USE_ROUGHNESSMAP
2483	uniform mat3 roughnessMapTransform;
2484	varying vec2 vRoughnessMapUv;
2485#endif
2486#ifdef USE_ANISOTROPYMAP
2487	uniform mat3 anisotropyMapTransform;
2488	varying vec2 vAnisotropyMapUv;
2489#endif
2490#ifdef USE_CLEARCOATMAP
2491	uniform mat3 clearcoatMapTransform;
2492	varying vec2 vClearcoatMapUv;
2493#endif
2494#ifdef USE_CLEARCOAT_NORMALMAP
2495	uniform mat3 clearcoatNormalMapTransform;
2496	varying vec2 vClearcoatNormalMapUv;
2497#endif
2498#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2499	uniform mat3 clearcoatRoughnessMapTransform;
2500	varying vec2 vClearcoatRoughnessMapUv;
2501#endif
2502#ifdef USE_SHEEN_COLORMAP
2503	uniform mat3 sheenColorMapTransform;
2504	varying vec2 vSheenColorMapUv;
2505#endif
2506#ifdef USE_SHEEN_ROUGHNESSMAP
2507	uniform mat3 sheenRoughnessMapTransform;
2508	varying vec2 vSheenRoughnessMapUv;
2509#endif
2510#ifdef USE_IRIDESCENCEMAP
2511	uniform mat3 iridescenceMapTransform;
2512	varying vec2 vIridescenceMapUv;
2513#endif
2514#ifdef USE_IRIDESCENCE_THICKNESSMAP
2515	uniform mat3 iridescenceThicknessMapTransform;
2516	varying vec2 vIridescenceThicknessMapUv;
2517#endif
2518#ifdef USE_SPECULARMAP
2519	uniform mat3 specularMapTransform;
2520	varying vec2 vSpecularMapUv;
2521#endif
2522#ifdef USE_SPECULAR_COLORMAP
2523	uniform mat3 specularColorMapTransform;
2524	varying vec2 vSpecularColorMapUv;
2525#endif
2526#ifdef USE_SPECULAR_INTENSITYMAP
2527	uniform mat3 specularIntensityMapTransform;
2528	varying vec2 vSpecularIntensityMapUv;
2529#endif
2530#ifdef USE_TRANSMISSIONMAP
2531	uniform mat3 transmissionMapTransform;
2532	varying vec2 vTransmissionMapUv;
2533#endif
2534#ifdef USE_THICKNESSMAP
2535	uniform mat3 thicknessMapTransform;
2536	varying vec2 vThicknessMapUv;
2537#endif`,qd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2538	vUv = vec3( uv, 1 ).xy;
2539#endif
2540#ifdef USE_MAP
2541	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2542#endif
2543#ifdef USE_ALPHAMAP
2544	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2545#endif
2546#ifdef USE_LIGHTMAP
2547	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2548#endif
2549#ifdef USE_AOMAP
2550	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2551#endif
2552#ifdef USE_BUMPMAP
2553	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2554#endif
2555#ifdef USE_NORMALMAP
2556	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2557#endif
2558#ifdef USE_DISPLACEMENTMAP
2559	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2560#endif
2561#ifdef USE_EMISSIVEMAP
2562	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2563#endif
2564#ifdef USE_METALNESSMAP
2565	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2566#endif
2567#ifdef USE_ROUGHNESSMAP
2568	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2569#endif
2570#ifdef USE_ANISOTROPYMAP
2571	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2572#endif
2573#ifdef USE_CLEARCOATMAP
2574	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2575#endif
2576#ifdef USE_CLEARCOAT_NORMALMAP
2577	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2578#endif
2579#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2580	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2581#endif
2582#ifdef USE_IRIDESCENCEMAP
2583	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2584#endif
2585#ifdef USE_IRIDESCENCE_THICKNESSMAP
2586	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2587#endif
2588#ifdef USE_SHEEN_COLORMAP
2589	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2590#endif
2591#ifdef USE_SHEEN_ROUGHNESSMAP
2592	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2593#endif
2594#ifdef USE_SPECULARMAP
2595	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2596#endif
2597#ifdef USE_SPECULAR_COLORMAP
2598	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2599#endif
2600#ifdef USE_SPECULAR_INTENSITYMAP
2601	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2602#endif
2603#ifdef USE_TRANSMISSIONMAP
2604	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2605#endif
2606#ifdef USE_THICKNESSMAP
2607	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2608#endif`,Yd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2609	vec4 worldPosition = vec4( transformed, 1.0 );
2610	#ifdef USE_BATCHING
2611		worldPosition = batchingMatrix * worldPosition;
2612	#endif
2613	#ifdef USE_INSTANCING
2614		worldPosition = instanceMatrix * worldPosition;
2615	#endif
2616	worldPosition = modelMatrix * worldPosition;
2617#endif`,Zd=`varying vec2 vUv;
2618uniform mat3 uvTransform;
2619void main() {
2620	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2621	gl_Position = vec4( position.xy, 1.0, 1.0 );
2622}`,Jd=`uniform sampler2D t2D;
2623uniform float backgroundIntensity;
2624varying vec2 vUv;
2625void main() {
2626	vec4 texColor = texture2D( t2D, vUv );
2627	#ifdef DECODE_VIDEO_TEXTURE
2628		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 );
2629	#endif
2630	texColor.rgb *= backgroundIntensity;
2631	gl_FragColor = texColor;
2632	#include <tonemapping_fragment>
2633	#include <colorspace_fragment>
2634}`,$d=`varying vec3 vWorldDirection;
2635#include <common>
2636void main() {
2637	vWorldDirection = transformDirection( position, modelMatrix );
2638	#include <begin_vertex>
2639	#include <project_vertex>
2640	gl_Position.z = gl_Position.w;
2641}`,Kd=`#ifdef ENVMAP_TYPE_CUBE
2642	uniform samplerCube envMap;
2643#elif defined( ENVMAP_TYPE_CUBE_UV )
2644	uniform sampler2D envMap;
2645#endif
2646uniform float backgroundBlurriness;
2647uniform float backgroundIntensity;
2648uniform mat3 backgroundRotation;
2649varying vec3 vWorldDirection;
2650#include <cube_uv_reflection_fragment>
2651void main() {
2652	#ifdef ENVMAP_TYPE_CUBE
2653		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2654	#elif defined( ENVMAP_TYPE_CUBE_UV )
2655		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2656	#else
2657		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2658	#endif
2659	texColor.rgb *= backgroundIntensity;
2660	gl_FragColor = texColor;
2661	#include <tonemapping_fragment>
2662	#include <colorspace_fragment>
2663}`,Qd=`varying vec3 vWorldDirection;
2664#include <common>
2665void main() {
2666	vWorldDirection = transformDirection( position, modelMatrix );
2667	#include <begin_vertex>
2668	#include <project_vertex>
2669	gl_Position.z = gl_Position.w;
2670}`,jd=`uniform samplerCube tCube;
2671uniform float tFlip;
2672uniform float opacity;
2673varying vec3 vWorldDirection;
2674void main() {
2675	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2676	gl_FragColor = texColor;
2677	gl_FragColor.a *= opacity;
2678	#include <tonemapping_fragment>
2679	#include <colorspace_fragment>
2680}`,tf=`#include <common>
2681#include <batching_pars_vertex>
2682#include <uv_pars_vertex>
2683#include <displacementmap_pars_vertex>
2684#include <morphtarget_pars_vertex>
2685#include <skinning_pars_vertex>
2686#include <logdepthbuf_pars_vertex>
2687#include <clipping_planes_pars_vertex>
2688varying vec2 vHighPrecisionZW;
2689void main() {
2690	#include <uv_vertex>
2691	#include <batching_vertex>
2692	#include <skinbase_vertex>
2693	#include <morphinstance_vertex>
2694	#ifdef USE_DISPLACEMENTMAP
2695		#include <beginnormal_vertex>
2696		#include <morphnormal_vertex>
2697		#include <skinnormal_vertex>
2698	#endif
2699	#include <begin_vertex>
2700	#include <morphtarget_vertex>
2701	#include <skinning_vertex>
2702	#include <displacementmap_vertex>
2703	#include <project_vertex>
2704	#include <logdepthbuf_vertex>
2705	#include <clipping_planes_vertex>
2706	vHighPrecisionZW = gl_Position.zw;
2707}`,ef=`#if DEPTH_PACKING == 3200
2708	uniform float opacity;
2709#endif
2710#include <common>
2711#include <packing>
2712#include <uv_pars_fragment>
2713#include <map_pars_fragment>
2714#include <alphamap_pars_fragment>
2715#include <alphatest_pars_fragment>
2716#include <alphahash_pars_fragment>
2717#include <logdepthbuf_pars_fragment>
2718#include <clipping_planes_pars_fragment>
2719varying vec2 vHighPrecisionZW;
2720void main() {
2721	vec4 diffuseColor = vec4( 1.0 );
2722	#include <clipping_planes_fragment>
2723	#if DEPTH_PACKING == 3200
2724		diffuseColor.a = opacity;
2725	#endif
2726	#include <map_fragment>
2727	#include <alphamap_fragment>
2728	#include <alphatest_fragment>
2729	#include <alphahash_fragment>
2730	#include <logdepthbuf_fragment>
2731	#ifdef USE_REVERSED_DEPTH_BUFFER
2732		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2733	#else
2734		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2735	#endif
2736	#if DEPTH_PACKING == 3200
2737		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2738	#elif DEPTH_PACKING == 3201
2739		gl_FragColor = packDepthToRGBA( fragCoordZ );
2740	#elif DEPTH_PACKING == 3202
2741		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2742	#elif DEPTH_PACKING == 3203
2743		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2744	#endif
2745}`,nf=`#define DISTANCE
2746varying vec3 vWorldPosition;
2747#include <common>
2748#include <batching_pars_vertex>
2749#include <uv_pars_vertex>
2750#include <displacementmap_pars_vertex>
2751#include <morphtarget_pars_vertex>
2752#include <skinning_pars_vertex>
2753#include <clipping_planes_pars_vertex>
2754void main() {
2755	#include <uv_vertex>
2756	#include <batching_vertex>
2757	#include <skinbase_vertex>
2758	#include <morphinstance_vertex>
2759	#ifdef USE_DISPLACEMENTMAP
2760		#include <beginnormal_vertex>
2761		#include <morphnormal_vertex>
2762		#include <skinnormal_vertex>
2763	#endif
2764	#include <begin_vertex>
2765	#include <morphtarget_vertex>
2766	#include <skinning_vertex>
2767	#include <displacementmap_vertex>
2768	#include <project_vertex>
2769	#include <worldpos_vertex>
2770	#include <clipping_planes_vertex>
2771	vWorldPosition = worldPosition.xyz;
2772}`,sf=`#define DISTANCE
2773uniform vec3 referencePosition;
2774uniform float nearDistance;
2775uniform float farDistance;
2776varying vec3 vWorldPosition;
2777#include <common>
2778#include <uv_pars_fragment>
2779#include <map_pars_fragment>
2780#include <alphamap_pars_fragment>
2781#include <alphatest_pars_fragment>
2782#include <alphahash_pars_fragment>
2783#include <clipping_planes_pars_fragment>
2784void main() {
2785	vec4 diffuseColor = vec4( 1.0 );
2786	#include <clipping_planes_fragment>
2787	#include <map_fragment>
2788	#include <alphamap_fragment>
2789	#include <alphatest_fragment>
2790	#include <alphahash_fragment>
2791	float dist = length( vWorldPosition - referencePosition );
2792	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2793	dist = saturate( dist );
2794	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2795}`,rf=`varying vec3 vWorldDirection;
2796#include <common>
2797void main() {
2798	vWorldDirection = transformDirection( position, modelMatrix );
2799	#include <begin_vertex>
2800	#include <project_vertex>
2801}`,af=`uniform sampler2D tEquirect;
2802varying vec3 vWorldDirection;
2803#include <common>
2804void main() {
2805	vec3 direction = normalize( vWorldDirection );
2806	vec2 sampleUV = equirectUv( direction );
2807	gl_FragColor = texture2D( tEquirect, sampleUV );
2808	#include <tonemapping_fragment>
2809	#include <colorspace_fragment>
2810}`,of=`uniform float scale;
2811attribute float lineDistance;
2812varying float vLineDistance;
2813#include <common>
2814#include <uv_pars_vertex>
2815#include <color_pars_vertex>
2816#include <fog_pars_vertex>
2817#include <morphtarget_pars_vertex>
2818#include <logdepthbuf_pars_vertex>
2819#include <clipping_planes_pars_vertex>
2820void main() {
2821	vLineDistance = scale * lineDistance;
2822	#include <uv_vertex>
2823	#include <color_vertex>
2824	#include <morphinstance_vertex>
2825	#include <morphcolor_vertex>
2826	#include <begin_vertex>
2827	#include <morphtarget_vertex>
2828	#include <project_vertex>
2829	#include <logdepthbuf_vertex>
2830	#include <clipping_planes_vertex>
2831	#include <fog_vertex>
2832}`,lf=`uniform vec3 diffuse;
2833uniform float opacity;
2834uniform float dashSize;
2835uniform float totalSize;
2836varying float vLineDistance;
2837#include <common>
2838#include <color_pars_fragment>
2839#include <uv_pars_fragment>
2840#include <map_pars_fragment>
2841#include <fog_pars_fragment>
2842#include <logdepthbuf_pars_fragment>
2843#include <clipping_planes_pars_fragment>
2844void main() {
2845	vec4 diffuseColor = vec4( diffuse, opacity );
2846	#include <clipping_planes_fragment>
2847	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2848		discard;
2849	}
2850	vec3 outgoingLight = vec3( 0.0 );
2851	#include <logdepthbuf_fragment>
2852	#include <map_fragment>
2853	#include <color_fragment>
2854	outgoingLight = diffuseColor.rgb;
2855	#include <opaque_fragment>
2856	#include <tonemapping_fragment>
2857	#include <colorspace_fragment>
2858	#include <fog_fragment>
2859	#include <premultiplied_alpha_fragment>
2860}`,cf=`#include <common>
2861#include <batching_pars_vertex>
2862#include <uv_pars_vertex>
2863#include <envmap_pars_vertex>
2864#include <color_pars_vertex>
2865#include <fog_pars_vertex>
2866#include <morphtarget_pars_vertex>
2867#include <skinning_pars_vertex>
2868#include <logdepthbuf_pars_vertex>
2869#include <clipping_planes_pars_vertex>
2870void main() {
2871	#include <uv_vertex>
2872	#include <color_vertex>
2873	#include <morphinstance_vertex>
2874	#include <morphcolor_vertex>
2875	#include <batching_vertex>
2876	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2877		#include <beginnormal_vertex>
2878		#include <morphnormal_vertex>
2879		#include <skinbase_vertex>
2880		#include <skinnormal_vertex>
2881		#include <defaultnormal_vertex>
2882	#endif
2883	#include <begin_vertex>
2884	#include <morphtarget_vertex>
2885	#include <skinning_vertex>
2886	#include <project_vertex>
2887	#include <logdepthbuf_vertex>
2888	#include <clipping_planes_vertex>
2889	#include <worldpos_vertex>
2890	#include <envmap_vertex>
2891	#include <fog_vertex>
2892}`,hf=`uniform vec3 diffuse;
2893uniform float opacity;
2894#ifndef FLAT_SHADED
2895	varying vec3 vNormal;
2896#endif
2897#include <common>
2898#include <dithering_pars_fragment>
2899#include <color_pars_fragment>
2900#include <uv_pars_fragment>
2901#include <map_pars_fragment>
2902#include <alphamap_pars_fragment>
2903#include <alphatest_pars_fragment>
2904#include <alphahash_pars_fragment>
2905#include <aomap_pars_fragment>
2906#include <lightmap_pars_fragment>
2907#include <envmap_common_pars_fragment>
2908#include <envmap_pars_fragment>
2909#include <fog_pars_fragment>
2910#include <specularmap_pars_fragment>
2911#include <logdepthbuf_pars_fragment>
2912#include <clipping_planes_pars_fragment>
2913void main() {
2914	vec4 diffuseColor = vec4( diffuse, opacity );
2915	#include <clipping_planes_fragment>
2916	#include <logdepthbuf_fragment>
2917	#include <map_fragment>
2918	#include <color_fragment>
2919	#include <alphamap_fragment>
2920	#include <alphatest_fragment>
2921	#include <alphahash_fragment>
2922	#include <specularmap_fragment>
2923	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2924	#ifdef USE_LIGHTMAP
2925		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2926		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2927	#else
2928		reflectedLight.indirectDiffuse += vec3( 1.0 );
2929	#endif
2930	#include <aomap_fragment>
2931	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2932	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2933	#include <envmap_fragment>
2934	#include <opaque_fragment>
2935	#include <tonemapping_fragment>
2936	#include <colorspace_fragment>
2937	#include <fog_fragment>
2938	#include <premultiplied_alpha_fragment>
2939	#include <dithering_fragment>
2940}`,uf=`#define LAMBERT
2941varying vec3 vViewPosition;
2942#include <common>
2943#include <batching_pars_vertex>
2944#include <uv_pars_vertex>
2945#include <displacementmap_pars_vertex>
2946#include <envmap_pars_vertex>
2947#include <color_pars_vertex>
2948#include <fog_pars_vertex>
2949#include <normal_pars_vertex>
2950#include <morphtarget_pars_vertex>
2951#include <skinning_pars_vertex>
2952#include <shadowmap_pars_vertex>
2953#include <logdepthbuf_pars_vertex>
2954#include <clipping_planes_pars_vertex>
2955void main() {
2956	#include <uv_vertex>
2957	#include <color_vertex>
2958	#include <morphinstance_vertex>
2959	#include <morphcolor_vertex>
2960	#include <batching_vertex>
2961	#include <beginnormal_vertex>
2962	#include <morphnormal_vertex>
2963	#include <skinbase_vertex>
2964	#include <skinnormal_vertex>
2965	#include <defaultnormal_vertex>
2966	#include <normal_vertex>
2967	#include <begin_vertex>
2968	#include <morphtarget_vertex>
2969	#include <skinning_vertex>
2970	#include <displacementmap_vertex>
2971	#include <project_vertex>
2972	#include <logdepthbuf_vertex>
2973	#include <clipping_planes_vertex>
2974	vViewPosition = - mvPosition.xyz;
2975	#include <worldpos_vertex>
2976	#include <envmap_vertex>
2977	#include <shadowmap_vertex>
2978	#include <fog_vertex>
2979}`,df=`#define LAMBERT
2980uniform vec3 diffuse;
2981uniform vec3 emissive;
2982uniform float opacity;
2983#include <common>
2984#include <dithering_pars_fragment>
2985#include <color_pars_fragment>
2986#include <uv_pars_fragment>
2987#include <map_pars_fragment>
2988#include <alphamap_pars_fragment>
2989#include <alphatest_pars_fragment>
2990#include <alphahash_pars_fragment>
2991#include <aomap_pars_fragment>
2992#include <lightmap_pars_fragment>
2993#include <emissivemap_pars_fragment>
2994#include <cube_uv_reflection_fragment>
2995#include <envmap_common_pars_fragment>
2996#include <envmap_pars_fragment>
2997#include <envmap_physical_pars_fragment>
2998#include <fog_pars_fragment>
2999#include <bsdfs>
3000#include <lights_pars_begin>
3001#include <normal_pars_fragment>
3002#include <lights_lambert_pars_fragment>
3003#include <shadowmap_pars_fragment>
3004#include <bumpmap_pars_fragment>
3005#include <normalmap_pars_fragment>
3006#include <specularmap_pars_fragment>
3007#include <logdepthbuf_pars_fragment>
3008#include <clipping_planes_pars_fragment>
3009void main() {
3010	vec4 diffuseColor = vec4( diffuse, opacity );
3011	#include <clipping_planes_fragment>
3012	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3013	vec3 totalEmissiveRadiance = emissive;
3014	#include <logdepthbuf_fragment>
3015	#include <map_fragment>
3016	#include <color_fragment>
3017	#include <alphamap_fragment>
3018	#include <alphatest_fragment>
3019	#include <alphahash_fragment>
3020	#include <specularmap_fragment>
3021	#include <normal_fragment_begin>
3022	#include <normal_fragment_maps>
3023	#include <emissivemap_fragment>
3024	#include <lights_lambert_fragment>
3025	#include <lights_fragment_begin>
3026	#include <lights_fragment_maps>
3027	#include <lights_fragment_end>
3028	#include <aomap_fragment>
3029	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3030	#include <envmap_fragment>
3031	#include <opaque_fragment>
3032	#include <tonemapping_fragment>
3033	#include <colorspace_fragment>
3034	#include <fog_fragment>
3035	#include <premultiplied_alpha_fragment>
3036	#include <dithering_fragment>
3037}`,ff=`#define MATCAP
3038varying vec3 vViewPosition;
3039#include <common>
3040#include <batching_pars_vertex>
3041#include <uv_pars_vertex>
3042#include <color_pars_vertex>
3043#include <displacementmap_pars_vertex>
3044#include <fog_pars_vertex>
3045#include <normal_pars_vertex>
3046#include <morphtarget_pars_vertex>
3047#include <skinning_pars_vertex>
3048#include <logdepthbuf_pars_vertex>
3049#include <clipping_planes_pars_vertex>
3050void main() {
3051	#include <uv_vertex>
3052	#include <color_vertex>
3053	#include <morphinstance_vertex>
3054	#include <morphcolor_vertex>
3055	#include <batching_vertex>
3056	#include <beginnormal_vertex>
3057	#include <morphnormal_vertex>
3058	#include <skinbase_vertex>
3059	#include <skinnormal_vertex>
3060	#include <defaultnormal_vertex>
3061	#include <normal_vertex>
3062	#include <begin_vertex>
3063	#include <morphtarget_vertex>
3064	#include <skinning_vertex>
3065	#include <displacementmap_vertex>
3066	#include <project_vertex>
3067	#include <logdepthbuf_vertex>
3068	#include <clipping_planes_vertex>
3069	#include <fog_vertex>
3070	vViewPosition = - mvPosition.xyz;
3071}`,pf=`#define MATCAP
3072uniform vec3 diffuse;
3073uniform float opacity;
3074uniform sampler2D matcap;
3075varying vec3 vViewPosition;
3076#include <common>
3077#include <dithering_pars_fragment>
3078#include <color_pars_fragment>
3079#include <uv_pars_fragment>
3080#include <map_pars_fragment>
3081#include <alphamap_pars_fragment>
3082#include <alphatest_pars_fragment>
3083#include <alphahash_pars_fragment>
3084#include <fog_pars_fragment>
3085#include <normal_pars_fragment>
3086#include <bumpmap_pars_fragment>
3087#include <normalmap_pars_fragment>
3088#in
3088clude <logdepthbuf_pars_fragment>
3089#include <clipping_planes_pars_fragment>
3090void main() {
3091	vec4 diffuseColor = vec4( diffuse, opacity );
3092	#include <clipping_planes_fragment>
3093	#include <logdepthbuf_fragment>
3094	#include <map_fragment>
3095	#include <color_fragment>
3096	#include <alphamap_fragment>
3097	#include <alphatest_fragment>
3098	#include <alphahash_fragment>
3099	#include <normal_fragment_begin>
3100	#include <normal_fragment_maps>
3101	vec3 viewDir = normalize( vViewPosition );
3102	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3103	vec3 y = cross( viewDir, x );
3104	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3105	#ifdef USE_MATCAP
3106		vec4 matcapColor = texture2D( matcap, uv );
3107	#else
3108		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3109	#endif
3110	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3111	#include <opaque_fragment>
3112	#include <tonemapping_fragment>
3113	#include <colorspace_fragment>
3114	#include <fog_fragment>
3115	#include <premultiplied_alpha_fragment>
3116	#include <dithering_fragment>
3117}`,mf=`#define NORMAL
3118#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3119	varying vec3 vViewPosition;
3120#endif
3121#include <common>
3122#include <batching_pars_vertex>
3123#include <uv_pars_vertex>
3124#include <displacementmap_pars_vertex>
3125#include <normal_pars_vertex>
3126#include <morphtarget_pars_vertex>
3127#include <skinning_pars_vertex>
3128#include <logdepthbuf_pars_vertex>
3129#include <clipping_planes_pars_vertex>
3130void main() {
3131	#include <uv_vertex>
3132	#include <batching_vertex>
3133	#include <beginnormal_vertex>
3134	#include <morphinstance_vertex>
3135	#include <morphnormal_vertex>
3136	#include <skinbase_vertex>
3137	#include <skinnormal_vertex>
3138	#include <defaultnormal_vertex>
3139	#include <normal_vertex>
3140	#include <begin_vertex>
3141	#include <morphtarget_vertex>
3142	#include <skinning_vertex>
3143	#include <displacementmap_vertex>
3144	#include <project_vertex>
3145	#include <logdepthbuf_vertex>
3146	#include <clipping_planes_vertex>
3147#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3148	vViewPosition = - mvPosition.xyz;
3149#endif
3150}`,gf=`#define NORMAL
3151uniform float opacity;
3152#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3153	varying vec3 vViewPosition;
3154#endif
3155#include <uv_pars_fragment>
3156#include <normal_pars_fragment>
3157#include <bumpmap_pars_fragment>
3158#include <normalmap_pars_fragment>
3159#include <logdepthbuf_pars_fragment>
3160#include <clipping_planes_pars_fragment>
3161void main() {
3162	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3163	#include <clipping_planes_fragment>
3164	#include <logdepthbuf_fragment>
3165	#include <normal_fragment_begin>
3166	#include <normal_fragment_maps>
3167	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3168	#ifdef OPAQUE
3169		gl_FragColor.a = 1.0;
3170	#endif
3171}`,_f=`#define PHONG
3172varying vec3 vViewPosition;
3173#include <common>
3174#include <batching_pars_vertex>
3175#include <uv_pars_vertex>
3176#include <displacementmap_pars_vertex>
3177#include <envmap_pars_vertex>
3178#include <color_pars_vertex>
3179#include <fog_pars_vertex>
3180#include <normal_pars_vertex>
3181#include <morphtarget_pars_vertex>
3182#include <skinning_pars_vertex>
3183#include <shadowmap_pars_vertex>
3184#include <logdepthbuf_pars_vertex>
3185#include <clipping_planes_pars_vertex>
3186void main() {
3187	#include <uv_vertex>
3188	#include <color_vertex>
3189	#include <morphcolor_vertex>
3190	#include <batching_vertex>
3191	#include <beginnormal_vertex>
3192	#include <morphinstance_vertex>
3193	#include <morphnormal_vertex>
3194	#include <skinbase_vertex>
3195	#include <skinnormal_vertex>
3196	#include <defaultnormal_vertex>
3197	#include <normal_vertex>
3198	#include <begin_vertex>
3199	#include <morphtarget_vertex>
3200	#include <skinning_vertex>
3201	#include <displacementmap_vertex>
3202	#include <project_vertex>
3203	#include <logdepthbuf_vertex>
3204	#include <clipping_planes_vertex>
3205	vViewPosition = - mvPosition.xyz;
3206	#include <worldpos_vertex>
3207	#include <envmap_vertex>
3208	#include <shadowmap_vertex>
3209	#include <fog_vertex>
3210}`,xf=`#define PHONG
3211uniform vec3 diffuse;
3212uniform vec3 emissive;
3213uniform vec3 specular;
3214uniform float shininess;
3215uniform float opacity;
3216#include <common>
3217#include <dithering_pars_fragment>
3218#include <color_pars_fragment>
3219#include <uv_pars_fragment>
3220#include <map_pars_fragment>
3221#include <alphamap_pars_fragment>
3222#include <alphatest_pars_fragment>
3223#include <alphahash_pars_fragment>
3224#include <aomap_pars_fragment>
3225#include <lightmap_pars_fragment>
3226#include <emissivemap_pars_fragment>
3227#include <cube_uv_reflection_fragment>
3228#include <envmap_common_pars_fragment>
3229#include <envmap_pars_fragment>
3230#include <envmap_physical_pars_fragment>
3231#include <fog_pars_fragment>
3232#include <bsdfs>
3233#include <lights_pars_begin>
3234#include <normal_pars_fragment>
3235#include <lights_phong_pars_fragment>
3236#include <shadowmap_pars_fragment>
3237#include <bumpmap_pars_fragment>
3238#include <normalmap_pars_fragment>
3239#include <specularmap_pars_fragment>
3240#include <logdepthbuf_pars_fragment>
3241#include <clipping_planes_pars_fragment>
3242void main() {
3243	vec4 diffuseColor = vec4( diffuse, opacity );
3244	#include <clipping_planes_fragment>
3245	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3246	vec3 totalEmissiveRadiance = emissive;
3247	#include <logdepthbuf_fragment>
3248	#include <map_fragment>
3249	#include <color_fragment>
3250	#include <alphamap_fragment>
3251	#include <alphatest_fragment>
3252	#include <alphahash_fragment>
3253	#include <specularmap_fragment>
3254	#include <normal_fragment_begin>
3255	#include <normal_fragment_maps>
3256	#include <emissivemap_fragment>
3257	#include <lights_phong_fragment>
3258	#include <lights_fragment_begin>
3259	#include <lights_fragment_maps>
3260	#include <lights_fragment_end>
3261	#include <aomap_fragment>
3262	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3263	#include <envmap_fragment>
3264	#include <opaque_fragment>
3265	#include <tonemapping_fragment>
3266	#include <colorspace_fragment>
3267	#include <fog_fragment>
3268	#include <premultiplied_alpha_fragment>
3269	#include <dithering_fragment>
3270}`,vf=`#define STANDARD
3271varying vec3 vViewPosition;
3272#ifdef USE_TRANSMISSION
3273	varying vec3 vWorldPosition;
3274#endif
3275#include <common>
3276#include <batching_pars_vertex>
3277#include <uv_pars_vertex>
3278#include <displacementmap_pars_vertex>
3279#include <color_pars_vertex>
3280#include <fog_pars_vertex>
3281#include <normal_pars_vertex>
3282#include <morphtarget_pars_vertex>
3283#include <skinning_pars_vertex>
3284#include <shadowmap_pars_vertex>
3285#include <logdepthbuf_pars_vertex>
3286#include <clipping_planes_pars_vertex>
3287void main() {
3288	#include <uv_vertex>
3289	#include <color_vertex>
3290	#include <morphinstance_vertex>
3291	#include <morphcolor_vertex>
3292	#include <batching_vertex>
3293	#include <beginnormal_vertex>
3294	#include <morphnormal_vertex>
3295	#include <skinbase_vertex>
3296	#include <skinnormal_vertex>
3297	#include <defaultnormal_vertex>
3298	#include <normal_vertex>
3299	#include <begin_vertex>
3300	#include <morphtarget_vertex>
3301	#include <skinning_vertex>
3302	#include <displacementmap_vertex>
3303	#include <project_vertex>
3304	#include <logdepthbuf_vertex>
3305	#include <clipping_planes_vertex>
3306	vViewPosition = - mvPosition.xyz;
3307	#include <worldpos_vertex>
3308	#include <shadowmap_vertex>
3309	#include <fog_vertex>
3310#ifdef USE_TRANSMISSION
3311	vWorldPosition = worldPosition.xyz;
3312#endif
3313}`,yf=`#define STANDARD
3314#ifdef PHYSICAL
3315	#define IOR
3316	#define USE_SPECULAR
3317#endif
3318uniform vec3 diffuse;
3319uniform vec3 emissive;
3320uniform float roughness;
3321uniform float metalness;
3322uniform float opacity;
3323#ifdef IOR
3324	uniform float ior;
3325#endif
3326#ifdef USE_SPECULAR
3327	uniform float specularIntensity;
3328	uniform vec3 specularColor;
3329	#ifdef USE_SPECULAR_COLORMAP
3330		uniform sampler2D specularColorMap;
3331	#endif
3332	#ifdef USE_SPECULAR_INTENSITYMAP
3333		uniform sampler2D specularIntensityMap;
3334	#endif
3335#endif
3336#ifdef USE_CLEARCOAT
3337	uniform float clearcoat;
3338	uniform float clearcoatRoughness;
3339#endif
3340#ifdef USE_DISPERSION
3341	uniform float dispersion;
3342#endif
3343#ifdef USE_IRIDESCENCE
3344	uniform float iridescence;
3345	uniform float iridescenceIOR;
3346	uniform float iridescenceThicknessMinimum;
3347	uniform float iridescenceThicknessMaximum;
3348#endif
3349#ifdef USE_SHEEN
3350	uniform vec3 sheenColor;
3351	uniform float sheenRoughness;
3352	#ifdef USE_SHEEN_COLORMAP
3353		uniform sampler2D sheenColorMap;
3354	#endif
3355	#ifdef USE_SHEEN_ROUGHNESSMAP
3356		uniform sampler2D sheenRoughnessMap;
3357	#endif
3358#endif
3359#ifdef USE_ANISOTROPY
3360	uniform vec2 anisotropyVector;
3361	#ifdef USE_ANISOTROPYMAP
3362		uniform sampler2D anisotropyMap;
3363	#endif
3364#endif
3365varying vec3 vViewPosition;
3366#include <common>
3367#include <dithering_pars_fragment>
3368#include <color_pars_fragment>
3369#include <uv_pars_fragment>
3370#include <map_pars_fragment>
3371#include <alphamap_pars_fragment>
3372#include <alphatest_pars_fragment>
3373#include <alphahash_pars_fragment>
3374#include <aomap_pars_fragment>
3375#include <lightmap_pars_fragment>
3376#include <emissivemap_pars_fragment>
3377#include <iridescence_fragment>
3378#include <cube_uv_reflection_fragment>
3379#include <envmap_common_pars_fragment>
3380#include <envmap_physical_pars_fragment>
3381#include <fog_pars_fragment>
3382#include <lights_pars_begin>
3383#include <normal_pars_fragment>
3384#include <lights_physical_pars_fragment>
3385#include <transmission_pars_fragment>
3386#include <shadowmap_pars_fragment>
3387#include <bumpmap_pars_fragment>
3388#include <normalmap_pars_fragment>
3389#include <clearcoat_pars_fragment>
3390#include <iridescence_pars_fragment>
3391#include <roughnessmap_pars_fragment>
3392#include <metalnessmap_pars_fragment>
3393#include <logdepthbuf_pars_fragment>
3394#include <clipping_planes_pars_fragment>
3395void main() {
3396	vec4 diffuseColor = vec4( diffuse, opacity );
3397	#include <clipping_planes_fragment>
3398	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3399	vec3 totalEmissiveRadiance = emissive;
3400	#include <logdepthbuf_fragment>
3401	#include <map_fragment>
3402	#include <color_fragment>
3403	#include <alphamap_fragment>
3404	#include <alphatest_fragment>
3405	#include <alphahash_fragment>
3406	#include <roughnessmap_fragment>
3407	#include <metalnessmap_fragment>
3408	#include <normal_fragment_begin>
3409	#include <normal_fragment_maps>
3410	#include <clearcoat_normal_fragment_begin>
3411	#include <clearcoat_normal_fragment_maps>
3412	#include <emissivemap_fragment>
3413	#include <lights_physical_fragment>
3414	#include <lights_fragment_begin>
3415	#include <lights_fragment_maps>
3416	#include <lights_fragment_end>
3417	#include <aomap_fragment>
3418	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3419	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3420	#include <transmission_fragment>
3421	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3422	#ifdef USE_SHEEN
3423 
3424		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3425 
3426 	#endif
3427	#ifdef USE_CLEARCOAT
3428		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3429		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3430		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3431	#endif
3432	#include <opaque_fragment>
3433	#include <tonemapping_fragment>
3434	#include <colorspace_fragment>
3435	#include <fog_fragment>
3436	#include <premultiplied_alpha_fragment>
3437	#include <dithering_fragment>
3438}`,Mf=`#define TOON
3439varying vec3 vViewPosition;
3440#include <common>
3441#include <batching_pars_vertex>
3442#include <uv_pars_vertex>
3443#include <displacementmap_pars_vertex>
3444#include <color_pars_vertex>
3445#include <fog_pars_vertex>
3446#include <normal_pars_vertex>
3447#include <morphtarget_pars_vertex>
3448#include <skinning_pars_vertex>
3449#include <shadowmap_pars_vertex>
3450#include <logdepthbuf_pars_vertex>
3451#include <clipping_planes_pars_vertex>
3452void main() {
3453	#include <uv_vertex>
3454	#include <color_vertex>
3455	#include <morphinstance_vertex>
3456	#include <morphcolor_vertex>
3457	#include <batching_vertex>
3458	#include <beginnormal_vertex>
3459	#include <morphnormal_vertex>
3460	#include <skinbase_vertex>
3461	#include <skinnormal_vertex>
3462	#include <defaultnormal_vertex>
3463	#include <normal_vertex>
3464	#include <begin_vertex>
3465	#include <morphtarget_vertex>
3466	#include <skinning_vertex>
3467	#include <displacementmap_vertex>
3468	#include <project_vertex>
3469	#include <logdepthbuf_vertex>
3470	#include <clipping_planes_vertex>
3471	vViewPosition = - mvPosition.xyz;
3472	#include <worldpos_vertex>
3473	#include <shadowmap_vertex>
3474	#include <fog_vertex>
3475}`,Sf=`#define TOON
3476uniform vec3 diffuse;
3477uniform vec3 emissive;
3478uniform float opacity;
3479#include <common>
3480#include <dithering_pars_fragment>
3481#include <color_pars_fragment>
3482#include <uv_pars_fragment>
3483#include <map_pars_fragment>
3484#include <alphamap_pars_fragment>
3485#include <alphatest_pars_fragment>
3486#include <alphahash_pars_fragment>
3487#include <aomap_pars_fragment>
3488#include <lightmap_pars_fragment>
3489#include <emissivemap_pars_fragment>
3490#include <gradientmap_pars_fragment>
3491#include <fog_pars_fragment>
3492#include <bsdfs>
3493#include <lights_pars_begin>
3494#include <normal_pars_fragment>
3495#include <lights_toon_pars_fragment>
3496#include <shadowmap_pars_fragment>
3497#include <bumpmap_pars_fragment>
3498#include <normalmap_pars_fragment>
3499#include <logdepthbuf_pars_fragment>
3500#include <clipping_planes_pars_fragment>
3501void main() {
3502	vec4 diffuseColor = vec4( diffuse, opacity );
3503	#include <clipping_planes_fragment>
3504	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3505	vec3 totalEmissiveRadiance = emissive;
3506	#include <logdepthbuf_fragment>
3507	#include <map_fragment>
3508	#include <color_fragment>
3509	#include <alphamap_fragment>
3510	#include <alphatest_fragment>
3511	#include <alphahash_fragment>
3512	#include <normal_fragment_begin>
3513	#include <normal_fragment_maps>
3514	#include <emissivemap_fragment>
3515	#include <lights_toon_fragment>
3516	#include <lights_fragment_begin>
3517	#include <lights_fragment_maps>
3518	#include <lights_fragment_end>
3519	#include <aomap_fragment>
3520	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3521	#include <opaque_fragment>
3522	#include <tonemapping_fragment>
3523	#include <colorspace_fragment>
3524	#include <fog_fragment>
3525	#include <premultiplied_alpha_fragment>
3526	#include <dithering_fragment>
3527}`,bf=`uniform float size;
3528uniform float scale;
3529#include <common>
3530#include <color_pars_vertex>
3531#include <fog_pars_vertex>
3532#include <morphtarget_pars_vertex>
3533#include <logdepthbuf_pars_vertex>
3534#include <clipping_planes_pars_vertex>
3535#ifdef USE_POINTS_UV
3536	varying vec2 vUv;
3537	uniform mat3 uvTransform;
3538#endif
3539void main() {
3540	#ifdef USE_POINTS_UV
3541		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3542	#endif
3543	#include <color_vertex>
3544	#include <morphinstance_vertex>
3545	#include <morphcolor_vertex>
3546	#include <begin_vertex>
3547	#include <morphtarget_vertex>
3548	#include <project_vertex>
3549	gl_PointSize = size;
3550	#ifdef USE_SIZEATTENUATION
3551		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3552		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3553	#endif
3554	#include <logdepthbuf_vertex>
3555	#include <clipping_planes_vertex>
3556	#include <worldpos_vertex>
3557	#include <fog_vertex>
3558}`,Ef=`uniform vec3 diffuse;
3559uniform float opacity;
3560#include <common>
3561#include <color_pars_fragment>
3562#include <map_particle_pars_fragment>
3563#include <alphatest_pars_fragment>
3564#include <alphahash_pars_fragment>
3565#include <fog_pars_fragment>
3566#include <logdepthbuf_pars_fragment>
3567#include <clipping_planes_pars_fragment>
3568void main() {
3569	vec4 diffuseColor = vec4( diffuse, opacity );
3570	#include <clipping_planes_fragment>
3571	vec3 outgoingLight = vec3( 0.0 );
3572	#include <logdepthbuf_fragment>
3573	#include <map_particle_fragment>
3574	#include <color_fragment>
3575	#include <alphatest_fragment>
3576	#include <alphahash_fragment>
3577	outgoingLight = diffuseColor.rgb;
3578	#include <opaque_fragment>
3579	#include <tonemapping_fragment>
3580	#include <colorspace_fragment>
3581	#include <fog_fragment>
3582	#include <premultiplied_alpha_fragment>
3583}`,Tf=`#include <common>
3584#include <batching_pars_vertex>
3585#include <fog_pars_vertex>
3586#include <morphtarget_pars_vertex>
3587#include <skinning_pars_vertex>
3588#include <logdepthbuf_pars_vertex>
3589#include <shadowmap_pars_vertex>
3590void main() {
3591	#include <batching_vertex>
3592	#include <beginnormal_vertex>
3593	#include <morphinstance_vertex>
3594	#include <morphnormal_vertex>
3595	#include <skinbase_vertex>
3596	#include <skinnormal_vertex>
3597	#include <defaultnormal_vertex>
3598	#include <begin_vertex>
3599	#include <morphtarget_vertex>
3600	#include <skinning_vertex>
3601	#include <project_vertex>
3602	#include <logdepthbuf_vertex>
3603	#include <worldpos_vertex>
3604	#include <shadowmap_vertex>
3605	#include <fog_vertex>
3606}`,Af=`uniform vec3 color;
3607uniform float opacity;
3608#include <common>
3609#include <fog_pars_fragment>
3610#include <bsdfs>
3611#include <lights_pars_begin>
3612#include <logdepthbuf_pars_fragment>
3613#include <shadowmap_pars_fragment>
3614#include <shadowmask_pars_fragment>
3615void main() {
3616	#include <logdepthbuf_fragment>
3617	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3618	#include <tonemapping_fragment>
3619	#include <colorspace_fragment>
3620	#include <fog_fragment>
3621	#include <premultiplied_alpha_fragment>
3622}`,wf=`uniform float rotation;
3623uniform vec2 center;
3624#include <common>
3625#include <uv_pars_vertex>
3626#include <fog_pars_vertex>
3627#include <logdepthbuf_pars_vertex>
3628#include <clipping_planes_pars_vertex>
3629void main() {
3630	#include <uv_vertex>
3631	vec4 mvPosition = modelViewMatrix[ 3 ];
3632	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3633	#ifndef USE_SIZEATTENUATION
3634		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3635		if ( isPerspective ) scale *= - mvPosition.z;
3636	#endif
3637	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3638	vec2 rotatedPosition;
3639	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3640	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3641	mvPosition.xy += rotatedPosition;
3642	gl_Position = projectionMatrix * mvPosition;
3643	#include <logdepthbuf_vertex>
3644	#include <clipping_planes_vertex>
3645	#include <fog_vertex>
3646}`,Cf=`uniform vec3 diffuse;
3647uniform float opacity;
3648#include <common>
3649#include <uv_pars_fragment>
3650#include <map_pars_fragment>
3651#include <alphamap_pars_fragment>
3652#include <alphatest_pars_fragment>
3653#include <alphahash_pars_fragment>
3654#include <fog_pars_fragment>
3655#include <logdepthbuf_pars_fragment>
3656#include <clipping_planes_pars_fragment>
3657void main() {
3658	vec4 diffuseColor = vec4( diffuse, opacity );
3659	#include <clipping_planes_fragment>
3660	vec3 outgoingLight = vec3( 0.0 );
3661	#include <logdepthbuf_fragment>
3662	#include <map_fragment>
3663	#include <alphamap_fragment>
3664	#include <alphatest_fragment>
3665	#include <alphahash_fragment>
3666	outgoingLight = diffuseColor.rgb;
3667	#include <opaque_fragment>
3668	#include <tonemapping_fragment>
3669	#include <colorspace_fragment>
3670	#include <fog_fragment>
3671}
3671`,Zt={alphahash_fragment:Zh,alphahash_pars_fragment:Jh,alphamap_fragment:$h,alphamap_pars_fragment:Kh,alphatest_fragment:Qh,alphatest_pars_fragment:jh,aomap_fragment:tu,aomap_pars_fragment:eu,batching_pars_vertex:nu,batching_vertex:iu,begin_vertex:su,beginnormal_vertex:ru,bsdfs:au,iridescence_fragment:ou,bumpmap_pars_fragment:lu,clipping_planes_fragment:cu,clipping_planes_pars_fragment:hu,clipping_planes_pars_vertex:uu,clipping_planes_vertex:du,color_fragment:fu,color_pars_fragment:pu,color_pars_vertex:mu,color_vertex:gu,common:_u,cube_uv_reflection_fragment:xu,defaultnormal_vertex:vu,displacementmap_pars_vertex:yu,displacementmap_vertex:Mu,emissivemap_fragment:Su,emissivemap_pars_fragment:bu,colorspace_fragment:Eu,colorspace_pars_fragment:Tu,envmap_fragment:Au,envmap_common_pars_fragment:wu,envmap_pars_fragment:Cu,envmap_pars_vertex:Ru,envmap_physical_pars_fragment:Vu,envmap_vertex:Iu,fog_vertex:Pu,fog_pars_vertex:Lu,fog_fragment:Du,fog_pars_fragment:Nu,gradientmap_pars_fragment:Uu,lightmap_pars_fragment:Fu,lights_lambert_fragment:Ou,lights_lambert_pars_fragment:Bu,lights_pars_begin:zu,lights_toon_fragment:ku,lights_toon_pars_fragment:Gu,lights_phong_fragment:Hu,lights_phong_pars_fragment:Wu,lights_physical_fragment:Xu,lights_physical_pars_fragment:qu,lights_fragment_begin:Yu,lights_fragment_maps:Zu,lights_fragment_end:Ju,lightprobes_pars_fragment:$u,logdepthbuf_fragment:Ku,logdepthbuf_pars_fragment:Qu,logdepthbuf_pars_vertex:ju,logdepthbuf_vertex:td,map_fragment:ed,map_pars_fragment:nd,map_particle_fragment:id,map_particle_pars_fragment:sd,metalnessmap_fragment:rd,metalnessmap_pars_fragment:ad,morphinstance_vertex:od,morphcolor_vertex:ld,morphnormal_vertex:cd,morphtarget_pars_vertex:hd,morphtarget_vertex:ud,normal_fragment_begin:dd,normal_fragment_maps:fd,normal_pars_fragment:pd,normal_pars_vertex:md,normal_vertex:gd,normalmap_pars_fragment:_d,clearcoat_normal_fragment_begin:xd,clearcoat_normal_fragment_maps:vd,clearcoat_pars_fragment:yd,iridescence_pars_fragment:Md,opaque_fragment:Sd,packing:bd,premultiplied_alpha_fragment:Ed,project_vertex:Td,dithering_fragment:Ad,dithering_pars_fragment:wd,roughnessmap_fragment:Cd,roughnessmap_pars_fragment:Rd,shadowmap_pars_fragment:Id,shadowmap_pars_vertex:Pd,shadowmap_vertex:Ld,shadowmask_pars_fragment:Dd,skinbase_vertex:Nd,skinning_pars_vertex:Ud,skinning_vertex:Fd,skinnormal_vertex:Od,specularmap_fragment:Bd,specularmap_pars_fragment:zd,tonemapping_fragment:Vd,tonemapping_pars_fragment:kd,transmission_fragment:Gd,transmission_pars_fragment:Hd,uv_pars_fragment:Wd,uv_pars_vertex:Xd,uv_vertex:qd,worldpos_vertex:Yd,background_vert:Zd,background_frag:Jd,backgroundCube_vert:$d,backgroundCube_frag:Kd,cube_vert:Qd,cube_frag:jd,depth_vert:tf,depth_frag:ef,distance_vert:nf,distance_frag:sf,equirect_vert:rf,equirect_frag:af,linedashed_vert:of,linedashed_frag:lf,meshbasic_vert:cf,meshbasic_frag:hf,meshlambert_vert:uf,meshlambert_frag:df,meshmatcap_vert:ff,meshmatcap_frag:pf,meshnormal_vert:mf,meshnormal_frag:gf,meshphong_vert:_f,meshphong_frag:xf,meshphysical_vert:vf,meshphysical_frag:yf,meshtoon_vert:Mf,meshtoon_frag:Sf,points_vert:bf,points_frag:Ef,shadow_vert:Tf,shadow_frag:Af,sprite_vert:wf,sprite_frag:Cf},_t={common:{diffuse:{value:new Xt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new kt},alphaMap:{value:null},alphaMapTransform:{value:new kt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new kt}},envmap:{envMap:{value:null},envMapRotation:{value:new kt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new kt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new kt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new kt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new kt},normalScale:{value:new jt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new kt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new kt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new kt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new kt}},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:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new F},probesMax:{value:new F},probesResolution:{value:new F}},points:{diffuse:{value:new Xt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new kt},alphaTest:{value:0},uvTransform:{value:new kt}},sprite:{diffuse:{value:new Xt(16777215)},opacity:{value:1},center:{value:new jt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new kt},alphaMap:{value:null},alphaMapTransform:{value:new kt},alphaTest:{value:0}}},kn={basic:{uniforms:Xe([_t.common,_t.specularmap,_t.envmap,_t.aomap,_t.lightmap,_t.fog]),vertexShader:Zt.meshbasic_vert,fragmentShader:Zt.meshbasic_frag},lambert:{uniforms:Xe([_t.common,_t.specularmap,_t.envmap,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.fog,_t.lights,{emissive:{value:new Xt(0)},envMapIntensity:{value:1}}]),vertexShader:Zt.meshlambert_vert,fragmentShader:Zt.meshlambert_frag},phong:{uniforms:Xe([_t.common,_t.specularmap,_t.envmap,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.fog,_t.lights,{emissive:{value:new Xt(0)},specular:{value:new Xt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Zt.meshphong_vert,fragmentShader:Zt.meshphong_frag},standard:{uniforms:Xe([_t.common,_t.envmap,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.roughnessmap,_t.metalnessmap,_t.fog,_t.lights,{emissive:{value:new Xt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Zt.meshphysical_vert,fragmentShader:Zt.meshphysical_frag},toon:{uniforms:Xe([_t.common,_t.aomap,_t.lightmap,_t.emissivemap,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.gradientmap,_t.fog,_t.lights,{emissive:{value:new Xt(0)}}]),vertexShader:Zt.meshtoon_vert,fragmentShader:Zt.meshtoon_frag},matcap:{uniforms:Xe([_t.common,_t.bumpmap,_t.normalmap,_t.displacementmap,_t.fog,{matc
vendor: 5,184 bytes, line 3671
3671ap:{value:null}}]),vertexShader:Zt.meshmatcap_vert,fragmentShader:Zt.meshmatcap_frag},points:{uniforms:Xe([_t.points,_t.fog]),vertexShader:Zt.points_vert,fragmentShader:Zt.points_frag},dashed:{uniforms:Xe([_t.common,_t.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Zt.linedashed_vert,fragmentShader:Zt.linedashed_frag},depth:{uniforms:Xe([_t.common,_t.displacementmap]),vertexShader:Zt.depth_vert,fragmentShader:Zt.depth_frag},normal:{uniforms:Xe([_t.common,_t.bumpmap,_t.normalmap,_t.displacementmap,{opacity:{value:1}}]),vertexShader:Zt.meshnormal_vert,fragmentShader:Zt.meshnormal_frag},sprite:{uniforms:Xe([_t.sprite,_t.fog]),vertexShader:Zt.sprite_vert,fragmentShader:Zt.sprite_frag},background:{uniforms:{uvTransform:{value:new kt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Zt.background_vert,fragmentShader:Zt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new kt}},vertexShader:Zt.backgroundCube_vert,fragmentShader:Zt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Zt.cube_vert,fragmentShader:Zt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Zt.equirect_vert,fragmentShader:Zt.equirect_frag},distance:{uniforms:Xe([_t.common,_t.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Zt.distance_vert,fragmentShader:Zt.distance_frag},shadow:{uniforms:Xe([_t.lights,_t.fog,{color:{value:new Xt(0)},opacity:{value:1}}]),vertexShader:Zt.shadow_vert,fragmentShader:Zt.shadow_frag}};kn.physical={uniforms:Xe([kn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new kt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new kt},clearcoatNormalScale:{value:new jt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new kt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new kt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new kt},sheen:{value:0},sheenColor:{value:new Xt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new kt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new kt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new kt},transmissionSamplerSize:{value:new jt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new kt},attenuationDistance:{value:0},attenuationColor:{value:new Xt(0)},specularColor:{value:new Xt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new kt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new kt},anisotropyVector:{value:new jt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new kt}}]),vertexShader:Zt.meshphysical_vert,fragmentShader:Zt.meshphysical_frag};var io={r:0,b:0,g:0},Rf=new de,rh=new kt;rh.set(-1,0,0,0,1,0,0,0,1);function If(i,t,e,n,s,r){let a=new Xt(0),o=s===!0?0:1,c,l,u=null,p=0,h=null;function g(T){let w=T.isScene===!0?T.background:null;if(w&&w.isTexture){let M=T.backgroundBlurriness>0;w=t.get(w,M)}return w}function x(T){let w=!1,M=g(T);M===null?m(a,o):M&&M.isColor&&(m(M,1),w=!0);let A=i.xr.getEnvironmentBlendMode();A==="additive"?e.buffers.color.setClear(0,0,0,1,r):A==="alpha-blend"&&e.buffers.color.setClear(0,0,0,0,r),(i.autoClear||w)&&(e.buffers.depth.setTest(!0),e.buffers.depth.setMask(!0),e.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function y(T,w){let M=g(w);M&&(M.isCubeTexture||M.mapping===Ks)?(l===void 0&&(l=new We(new pi(1,1,1),new ln({name:"BackgroundCubeMaterial",uniforms:ki(kn.backgroundCube.uniforms),vertexShader:kn.backgroundCube.vertexShader,fragmentShader:kn.backgroundCube.fragmentShader,side:Ye,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(A,b,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=M,l.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Rf.makeRotationFromEuler(w.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(rh),l.material.toneMapped=$t.getTransfer(M.colorSpace)!==oe,(u!==M||p!==M.version||h!==i.toneMapping)&&(l.material.needsUpdate=!0,u=M,p=M.version,h=i.toneMapping),l.layers.enableAll(),T.unshift(l,l.geometry,l.material,0,0,null)):M&&M.isTexture&&(c===void 0&&(c=new We(new Bi(2,2),new ln({name:"Backgroun
3671dMaterial",uniforms:ki(kn.background.uniforms),vertexShader:kn.background.vertexShader,fragmentShader:kn.background.fragmentShader,side:Jn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=M,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=$t.getTransfer(M.colorSpace)!==oe,M.matrixAutoUpdate===!0&&M.updateMatrix(),c.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||p!==M.version||h!==i.toneMapping)&&(c.material.needsUpdate=!0,u=M,p=M.version,h=i.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null))}function m(T,w){T.getRGB(io,ul(i)),e.buffers.color.setClear(io.r,io.g,io.b,w,r)}function d(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(T,w=1){a.set(T),o=w,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(T){o=T,m(a,o)},render:x,addToRenderList:y,dispose:d}}function Pf(i,t){let e=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},s=h(null),r=s,a=!1;function o(I,O,q,Y,z){let X=!1,G=p(I,Y,q,O);r!==G&&(r=G,l(r.object)),X=g(I,Y,q,z),X&&x(I,Y,q,z),z!==null&&t.update(z,i.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,M(I,O,q,Y),z!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function c(){return i.createVertexArray()}function l(I){return i.bindVertexArray(I)}function u(I){return i.deleteVertexArray(I)}function p(I,O,q,Y){let z=Y.wireframe===!0,X=n[O.id];X===void 0&&(X={},n[O.id]=X);let G=I.isInstancedMesh===!0?I.id:0,K=X[G];K===void 0&&(K={},X[G]=K);let tt=K[q.id];tt===void 0&&(tt={},K[q.id]=tt);let ft=tt[z];return ft===void 0&&(ft=h(c()),tt[z]=ft),ft}function h(I){let O=[],q=[],Y=[];for(let z=0;z<e;z++)O[z]=0,q[z]=0,Y[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:q,attributeDivisors:Y,object:I,attributes:{},index:null}}function g(I,O,q,Y){let z=r.attributes,X=O.attributes,G=0,K=q.getAttributes();for(let tt in K)if(K[tt].location>=0){let xt=z[tt],Mt=X[tt];if(Mt===void 0&&(tt==="instanceMatrix"&&I.instanceMatrix&&(Mt=I.instanceMatrix),tt==="instanceColor"&&I.instanceColor&&(Mt=I.instanceColor)),xt===void 0||xt.attribute!==Mt||Mt&&xt.data!==Mt.data)return!0;G++}return r.attributesNum!==G||r.index!==Y}function x(I,O,q,Y){let z={},X=O.attributes,G=0,K=q.getAttributes();for(let tt in K)if(K[tt].location>=0){let xt=X[tt];xt===void 0&&(tt==="instanceMatrix"&&I.instanceMatrix&&(xt=I.instanceMatrix),tt==="instanceColor"&&I.instanceColor&&(xt=I.instanceColor));let Mt={};Mt.attribute=xt,xt&&xt.data&&(Mt.data=xt.data),z[tt]=Mt,G++}r.attributes=z,r.attributesNum=G,r.index=Y}function y(){let I=r.newAttributes;for(let O=0,q=I.length;O<q;O++)I[O]=0}function m(I){d(I,0)}function d(I,O){let q=r.newAttributes,Y=r.enabledAttributes,z=r.attributeDivisors;q[I]=1,Y[I]===0&&(i.enableVertexAttribArray(I),Y[I]=1),z[I]!==O&&(i.vertexAttribDivisor(I,O),z[I]=O)}function T(){let I=r.newAttributes,O=r.enabledAttributes;for(let q=0,Y=O.length;q<Y;q++)O[q]!==I[q]&&(i.disableVertexAttribArray(q),O[q]=0)}function w(I,O,q,Y,z,X,G){G===!0?i.vertexAttribIPointer(I,O,q,z,X):i.vertexAttribPointer(I,O,q,Y,z,X)}function M(I,O,q,Y){y();let z=Y.attributes,X=q.getAttributes(),G=O.defaultAttributeValues;for(let K in X){let tt=X[K];if(tt.location>=0){let ft=z[K];if(ft===void 0&&(K==="instanceMatrix"&&I.instanceMatrix&&(ft=I.instanceMatrix),K==="instanceColor"&&I.instanceColor&&(ft=I.instanceColor)),ft!==void 0){let xt=ft.normalized,Mt=ft.itemSize,te=t.get(ft);if(te===void 0)continue;let Qt=te.buffer,Ft=te.type,Z=te.bytesPerElement,st=Ft===i.INT||Ft===i.UNSIGNED_INT||ft.gpuType===_a;if(ft.isInterleavedBufferAttribute){let et=ft.data,Nt=et.stride,Ot=ft.offset;if(et.isInstancedInterleavedBuffer){for(let Lt=0;Lt<tt.locationSize;Lt++)d(tt.location+Lt,et.meshPerAttribute);I.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=et.meshPerAttribute*et.count)}else for(let Lt=0;Lt<tt.locationSize;Lt++)m(tt.location+Lt);i.bindBuffer(i.ARRAY_BUFFER,Qt);for(let Lt=0;Lt<tt.locationSize;Lt++)w(tt.location+Lt,Mt/tt.locationSize,Ft,xt,Nt*Z,(Ot+Mt/tt.locationSize*Lt)*Z,st)}else{if(ft.isInstancedBufferAttribute){for(let et=0;et<tt.locationSize;et++)d(tt.location+et,ft.meshPerAttribute);I.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=ft.meshPerAttribute*ft.count)}else for(let et=0;et<tt.locationSize;et++)m(tt.location+et);i.bindBuffer(i.ARRAY_BUFFER,Qt);for(let et=0;et<tt.locationSize;et++)w(tt.location+et,Mt/tt.locationSize,Ft,xt,Mt*Z,Mt/tt.locationSize*et*Z,st)}}else if(G!==void 0){let xt=G[K];if(xt!==void 0)switch(xt.length){case 2:i.vertexAttrib2fv(tt.location,xt);break;case 3:i.vertexAttrib3fv(tt.location,xt);break;case 4:i.vertexAttrib4fv(tt.location,xt);break;default:i.vertexAttrib1fv(tt.location,xt)}}}}T()}function A(){E();for(let I in n){let O=n[I];for(let q in O){let Y=O[q];for(let z in Y){let X=Y[z];for(let G in X)u(X[G].object),delete X[G];delete Y[z]}}delete n[I]}}function b(I){if(n[I.id]===void 0)return;let O=n[I.id];for(let q in O){let Y=O[q];for(let z in Y){let X=Y[z];for(let G in X)u(X[G].object),delete X[G];delete Y[z]}}delete n[I.id]}function C(I){for(let O in n){let q=n[O];for(let Y in q){let z=q[Y];if(z[I.id]===void 0)continue;let X=z[I.id];for(let G in X)u(X[G].object),delete X[G];delete z[I.id]}}}function _(I){for(let O in n){let q=n[O],Y=I.isInstancedMesh===!0?I.id:0,z=q[Y];if(z!==void 0){for(let X in z){let G=z[X];for(let K in G)u(G[K].object),delete G[K];delete z[X]}delete q[Y],Object.keys(q).length===0&&delete n[O]}}}function E(){D(),a=!0,r!==s&&(r=s,l(r.object))}
vendor: 1,063 bytes, line 3671
3671function D(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:o,reset:E,resetDefaultState:D,dispose:A,releaseStatesOfGeometry:b,releaseStatesOfObject:_,releaseStatesOfProgram:C,initAttributes:y,enableAttribute:m,disableUnusedAttributes:T}}function Lf(i,t,e){let n;function s(c){n=c}function r(c,l){i.drawArrays(n,c,l),e.update(l,n,1)}function a(c,l,u){u!==0&&(i.drawArraysInstanced(n,c,l,u),e.update(l,n,u))}function o(c,l,u){if(u===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,l,0,u);let h=0;for(let g=0;g<u;g++)h+=l[g];e.update(h,n,1)}this.setMode=s,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function Df(i,t,e,n){let s;function r(){if(s!==void 0)return s;if(t.has("EXT_texture_filter_anisotropic")===!0){let C=t.get("EXT_texture_filter_anisotropic");s=i.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function a(C){return!(C!==xn&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){let _=C===_n&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));
vendor: 6,112 bytes, line 3671
3671return!(C!==hn&&n.convert(C)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==gn&&!_)}function c(C){if(C==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=e.precision!==void 0?e.precision:"highp",u=c(l);u!==l&&(Dt("WebGLRenderer:",l,"not supported, using",u,"instead."),l=u);let p=e.logarithmicDepthBuffer===!0,h=e.reversedDepthBuffer===!0&&t.has("EXT_clip_control");e.reversedDepthBuffer===!0&&h===!1&&Dt("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let g=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),x=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_TEXTURE_SIZE),m=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),d=i.getParameter(i.MAX_VERTEX_ATTRIBS),T=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),w=i.getParameter(i.MAX_VARYING_VECTORS),M=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),A=i.getParameter(i.MAX_SAMPLES),b=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:p,reversedDepthBuffer:h,maxTextures:g,maxVertexTextures:x,maxTextureSize:y,maxCubemapSize:m,maxAttributes:d,maxVertexUniforms:T,maxVaryings:w,maxFragmentUniforms:M,maxSamples:A,samples:b}}function Nf(i){let t=this,e=null,n=0,s=!1,r=!1,a=new Dn,o=new kt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(p,h){let g=p.length!==0||h||n!==0||s;return s=h,n=p.length,g},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(p,h){e=u(p,h,0)},this.setState=function(p,h,g){let x=p.clippingPlanes,y=p.clipIntersection,m=p.clipShadows,d=i.get(p);if(!s||x===null||x.length===0||r&&!m)r?u(null):l();else{let T=r?0:n,w=T*4,M=d.clippingState||null;c.value=M,M=u(x,h,w,g);for(let A=0;A!==w;++A)M[A]=e[A];d.clippingState=M,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=T}};function l(){c.value!==e&&(c.value=e,c.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function u(p,h,g,x){let y=p!==null?p.length:0,m=null;if(y!==0){if(m=c.value,x!==!0||m===null){let d=g+y*4,T=h.matrixWorldInverse;o.getNormalMatrix(T),(m===null||m.length<d)&&(m=new Float32Array(d));for(let w=0,M=g;w!==y;++w,M+=4)a.copy(p[w]).applyMatrix4(T,o),a.normal.toArray(m,M),m[M+3]=a.constant}c.value=m,c.needsUpdate=!0}return t.numPlanes=y,t.numIntersection=0,m}}var Si=4,Fc=[.125,.215,.35,.446,.526,.582],Gi=20,Uf=256,ar=new zi,Oc=new Xt,ml=null,gl=0,_l=0,xl=!1,Ff=new F,ro=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(t,e=0,n=.1,s=100,r={}){let{size:a=256,position:o=Ff}=r;ml=this._renderer.getRenderTarget(),gl=this._renderer.getActiveCubeFace(),_l=this._renderer.getActiveMipmapLevel(),xl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(t,n,s,c,o),e>0&&this._blur(c,0,0,e),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Vc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=zc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.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._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(ml,gl,_l),this._renderer.xr.enabled=xl,t.scissorTest=!1,ds(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===xi||t.mapping===Vi?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ml=this._renderer.getRenderTarget(),gl=this._renderer.getActiveCubeFace(),_l=this._renderer.getActiveMipmapLevel(),xl=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:Oe,minFilter:Oe,generateMipmaps:!1,type:_n,format:xn,colorSpace:Is,depthBuffer:!1},s=Bc(t,e,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Bc(t,e,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Of(r)),this._blurMaterial=zf(r,t,e),this._ggxMaterial=Bf(r,t,e)}return s}_compileMaterial(t){let e=new We(new An,t);this._renderer.compile(e,ar)}_sceneToCubeUV(t,e,n,s,r){let c=new Ke(90,1,e,n),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],p=this._renderer,h=p.autoClear,g=p.toneMapping;p.getClearColor(Oc),p.toneMapping=wn,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(s),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new We(new pi,new Oi({name:"PMREM.Backgroun
3671d",side:Ye,depthWrite:!1,depthTest:!1})));let y=this._backgroundBox,m=y.material,d=!1,T=t.background;T?T.isColor&&(m.color.copy(T),t.background=null,d=!0):(m.color.copy(Oc),d=!0);for(let w=0;w<6;w++){let M=w%3;M===0?(c.up.set(0,l[w],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x+u[w],r.y,r.z)):M===1?(c.up.set(0,0,l[w]),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y+u[w],r.z)):(c.up.set(0,l[w],0),c.position.set(r.x,r.y,r.z),c.lookAt(r.x,r.y,r.z+u[w]));let A=this._cubeSize;ds(s,M*A,w>2?A:0,A,A),p.setRenderTarget(s),d&&p.render(y,c),p.render(t,c)}p.toneMapping=g,p.autoClear=h,t.background=T}_textureToCubeUV(t,e){let n=this._renderer,s=t.mapping===xi||t.mapping===Vi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Vc()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=zc());let r=s?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;let o=r.uniforms;o.envMap.value=t;let c=this._cubeSize;ds(e,0,0,3*c,2*c),n.setRenderTarget(e),n.render(a,ar)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let s=this._lodMeshes.length;for(let r=1;r<s;r++)this._applyGGXFilter(t,r-1,r);e.autoClear=n}_applyGGXFilter(t,e,n){let s=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let c=a.uniforms,l=n/(this._lodMeshes.length-1),u=e/(this._lodMeshes.length-1),p=Math.sqrt(l*l-u*u),h=0+l*1.25,g=p*h,{_lodMax:x}=this,y=this._sizeLods[n],m=3*y*(n>x-Si?n-x+Si:0),d=4*(this._cubeSize-y);c.envMap.value=t.texture,c.roughness.value=g,c.mipInt.value=x-e,ds(r,m,d,3*y,2*y),s.setRenderTarget(r),s.render(o,ar),c.envMap.value=r.texture,c.roughness.value=0,c.mipInt.value=x-n,ds(t,m,d,3*y,2*y),s.setRenderTarget(t),s.render(o,ar)}_blur(t,e,n,s,r){let a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,s,"latitudinal",r),this._halfBlur(a,t,n,n,s,"longitudinal",r)}_halfBlur(t,e,n,s,r,a,o){let c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ut("blur direction must be either latitudinal or longitudinal!");let u=3,p=this._lodMeshes[s];p.material=l;let h=l.uniforms,g=this._sizeLods[n]-1,x=isFinite(r)?Math.PI/(2*g):2*Math.PI/(2*Gi-1),y=r/x,m=isFinite(r)?1+Math.floor(u*y):Gi;m>Gi&&Dt(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Gi}`);let d=[],T=0;for(let C=0;C<Gi;++C){let _=C/y,E=Math.exp(-_*_/2);d.push(E),C===0?T+=E:C<m&&(T+=2*E)}for(let C=0;C<d.length;C++)d[C]=d[C]/T;h.envMap.value=t.texture,h.samples.value=m,h.weights.value=d,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);let{_lodMax:w}=this;h.dTheta.value=x,h.mipInt.value=w-n;let M=this._sizeLods[s],A=3*M*(s>w-Si?s-w+Si:0),b=4*(this._cubeSize-M);ds(e,A,b,3*M,2*M),c.setRenderTarget(e),c.render(p,ar)}};function Of(i){let t=[],e=[],n=[],s=i,r=i-Si+1+Fc.length;for(let a=0;a<r;a++){let o=Math.pow(2,s);t.push(o);let c=1/o;a>i-Si?c=Fc[a-i+Si-1]:a===0&&(c=0),e.push(c);let l=1/(o-2),u=-l,p=1+l,h=[u,u,p,u,p,p,u,u,p,p,u,p],g=6,x=6,y=3,m=2,d=1,T=new Float32Array(y*x*g),w=new Float32Array(m*x*g),M=new Float32Array(d*x*g);for(let b=0;b<g;b++){let C=b%3*2/3-1,_=b>2?0:-1,E=[C,_,0,C+2/3,_,0,C+2/3,_+1,0,C,_,0,C+2/3,_+1,0,C,_+1,0];T.set(E,y*x*b),w.set(h,m*x*b);let D=[b,b,b,b,b,b];M.set(D,d*x*b)}let A=new An;A.setAttribute("position",new Qe(T,y)),A.setAttribute("uv",new Qe(w,m)),A.setAttribute("faceIndex",new Qe(M,d)),n.push(new We(A,null)),s>Si&&s--}return{lodMeshes:n,sizeLods:t,sigmas:e}}function Bc(i,t,e){let n=new an(i,t,e);return n.texture.mapping=Ks,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ds(i,t,e,n,s){i.viewport.set(t,e,n,s),i.scissor.set(t,e,n,s)}function Bf(i,t,e){return new ln({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Uf,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:oo(),fragmentShader:`
3672
3673			precision highp float;
3674			precision highp int;
3675
3676			varying vec3 vOutputDirection;
3677
3678			uniform sampler2D envMap;
3679			uniform float roughness;
3680			uniform float mipInt;
3681
3682			#define ENVMAP_TYPE_CUBE_UV
3683			#include <cube_uv_reflection_fragment>
3684
3685			#define PI 3.14159265359
3686
3687			// Van der Corput radical inverse
3688			float radicalInverse_VdC(uint bits) {
3689				bits = (bits << 16u) | (bits >> 16u);
3690				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3691				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3692				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3693				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3694				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3695			}
3696
3697			// Hammersley sequence
3698			vec2 hammersley(uint i, uint N) {
3699				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3700			}
3701
3702			// GGX VNDF importance sampling (Eric Heitz 2018)
3703			// "Sampling the GGX Distribution of Visible Normals"
3704			// https://jcgt.org/published/0007/04/01/
3705			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3706				float alpha = roughness * roughness;
3707
3708				// Section 4.1: Orthonormal basis
3709				vec3 T1 = vec3(1.0, 0.0, 0.0);
3710				vec3 T2 = cross(V, T1);
3711
3712				// Section 4.2: Parameterization of projected area
3713				float r = sqrt(Xi.x);
3714				float phi = 2.0 * PI * Xi.y;
3715				float t1 = r * cos(phi);
3716				float t2 = r * sin(phi);
3717				float s = 0.5 * (1.0 + V.z);
3718				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3719
3720				// Section 4.3: Reprojection onto hemisphere
3721				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3722
3723				// Section 3.4: Transform back to ellipsoid configuration
3724				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3725			}
3726
3727			void main() {
3728				vec3 N = normalize(vOutputDirection);
3729				vec3 V = N; // Assume view direction equals normal for pre-filtering
3730
3731				vec3 prefilteredColor = vec3(0.0);
3732				float totalWeight = 0.0;
3733
3734				// For very low roughness, just sample the environment directly
3735				if (roughness < 0.001) {
3736					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3737					return;
3738				}
3739
3740				// Tangent space basis for VNDF sampling
3741				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3742				vec3 tangent = normalize(cross(up, N));
3743				vec3 bitangent = cross(N, tangent);
3744
3745				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3746					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3747
3748					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3749					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3750
3751					// Transform H back to world space
3752					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3753					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3754
3755					float NdotL = max(dot(N, L), 0.0);
3756
3757					if(NdotL > 0.0) {
3758						// Sample environment at fixed mip level
3759						// VNDF importance sampling handles the distribution filtering
3760						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3761
3762						// Weight by NdotL for the split-sum approximation
3763						// VNDF PDF naturally accounts for the visible microfacet distribution
3764						prefilteredColor += sampleColor * NdotL;
3765						totalWeight += NdotL;
3766					}
3767				}
3768
3769				if (totalWeight > 0.0) {
3770					prefilteredColor = prefilteredColor / totalWeight;
3771				}
3772
3773				gl_FragColor = vec4(prefilteredColor, 1.0);
3774			}
3775		`,blending:zn,depthTest:!1,depthWrite:!1})}function zf(i,t,e){let n=new Float32Array(Gi),s=new F(0,1,0);return new ln({name:"SphericalGaussianBlur",defines:{n:Gi,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:oo(),fragmentShader:`
3776
3777			precision mediump float;
3778			precision mediump int;
3779
3780			varying vec3 vOutputDirection;
3781
3782			uniform sampler2D envMap;
3783			uniform int samples;
3784			uniform float weights[ n ];
3785			uniform bool latitudinal;
3786			uniform float dTheta;
3787			uniform float mipInt;
3788			uniform vec3 poleAxis;
3789
3790			#define ENVMAP_TYPE_CUBE_UV
3791			#include <cube_uv_reflection_fragment>
3792
3793			vec3 getSample( float theta, vec3 axis ) {
3794
3795				float cosTheta = cos( theta );
3796				// Rodrigues' axis-angle rotation
3797				vec3 sampleDirection = vOutputDirection * cosTheta
3798					+ cross( axis, vOutputDirection ) * sin( theta )
3799					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3800
3801				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3802
3803			}
3804
3805			void main() {
3806
3807				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3808
3809				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3810
3811					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3812
3813				}
3814
3815				axis = normalize( axis );
3816
3817				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3818				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3819
3820				for ( int i = 1; i < n; i++ ) {
3821
3822					if ( i >= samples ) {
3823
3824						break;
3825
3826					}
3827
3828					float theta = dTheta * float( i );
3829					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3830					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3831
3832				}
3833
3834			}
3835		`,blending:zn,depthTest:!1,depthWrite:!1})}function zc(){return new ln({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:oo(),fragmentShader:`
3836
3837			precision mediump float;
3838			precision mediump int;
3839
3840			varying vec3 vOutputDirection;
3841
3842			uniform sampler2D envMap;
3843
3844			#include <common>
3845
3846			void main() {
3847
3848				vec3 outputDirection = normalize( vOutputDirection );
3849				vec2 uv = equirectUv( outputDirection );
3850
3851				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3852
3853			}
3854		`,blending:zn,depthTest:!1,depthWrite:!1})}function Vc(){return new ln({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:oo(),fragmentShader:`
3855
3856			precision mediump float;
3857			precision mediump int;
3858
3859			uniform float flipEnvMap;
3860
3861			varying vec3 vOutputDirection;
3862
3863			uniform samplerCube envMap;
3864
3865			void main() {
3866
3867				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3868
3869			}
3870		`,blending:zn,depthTest:!1,depthWrite:!1})}function oo(){return`
3871
3872		precision mediump float;
3873		precision mediump int;
3874
3875		attribute float faceIndex;
3876
3877		varying vec3 vOutputDirection;
3878
3879		// RH coordinate system; PMREM face-indexing convention
3880		vec3 getDirection( vec2 uv, float face ) {
3881
3882			uv = 2.0 * uv - 1.0;
3883
3884			vec3 direction = vec3( uv, 1.0 );
3885
3886			if ( face == 0.0 ) {
3887
3888				direction = direction.zyx; // ( 1, v, u ) pos x
3889
3890			} else if ( face == 1.0 ) {
3891
3892				direction = direction.xzy;
3893				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3894
3895			} else if ( face == 2.0 ) {
3896
3897				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3898
3899			} else if ( face == 3.0 ) {
3900
3901				direction = direction.zyx;
3902				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3903
3904			} else if ( face == 4.0 ) {
3905
3906				direction = direction.xzy;
3907				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3908
3909			} else if ( face == 5.0 ) {
3910
3911				direction.z *= -1.0; // ( u, v, -1 ) neg z
3912
3913			}
3914
3915			return direction;
3916
3917		}
3918
3919		void main() {
3920
3921			vOutputDirection = getDirection( uv, faceIndex );
3922			gl_Position = vec4( position, 1.0 );
3923
3924		}
3925	`}var ps=class extends an{constructor(t=1,e={}
vendor: 32,038 bytes, lines 3925-4043
3925){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},s=[n,n,n,n,n,n];this.texture=new Gs(s),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
3926
3927				varying vec3 vWorldDirection;
3928
3929				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3930
3931					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3932
3933				}
3934
3935				void main() {
3936
3937					vWorldDirection = transformDirection( position, modelMatrix );
3938
3939					#include <begin_vertex>
3940					#include <project_vertex>
3941
3942				}
3943			`,fragmentShader:`
3944
3945				uniform sampler2D tEquirect;
3946
3947				varying vec3 vWorldDirection;
3948
3949				#include <common>
3950
3951				void main() {
3952
3953					vec3 direction = normalize( vWorldDirection );
3954
3955					vec2 sampleUV = equirectUv( direction );
3956
3957					gl_FragColor = texture2D( tEquirect, sampleUV );
3958
3959				}
3960			`},s=new pi(5,5,5),r=new ln({name:"CubemapFromEquirect",uniforms:ki(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ye,blending:zn});r.uniforms.tEquirect.value=e;let a=new We(s,r),o=e.minFilter;return e.minFilter===vi&&(e.minFilter=Oe),new ls(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e=!0,n=!0,s=!0){let r=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,s);t.setRenderTarget(r)}};function Vf(i){let t=new WeakMap,e=new WeakMap,n=null;function s(h,g=!1){return h==null?null:g?a(h):r(h)}function r(h){if(h&&h.isTexture){let g=h.mapping;if(g===pa||g===ma)if(t.has(h)){let x=t.get(h).texture;return o(x,h.mapping)}else{let x=h.image;if(x&&x.height>0){let y=new ps(x.height);return y.fromEquirectangularTexture(i,h),t.set(h,y),h.addEventListener("dispose",l),o(y.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){let g=h.mapping,x=g===pa||g===ma,y=g===xi||g===Vi;if(x||y){let m=e.get(h),d=m!==void 0?m.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==d)return n===null&&(n=new ro(i)),m=x?n.fromEquirectangular(h,m):n.fromCubemap(h,m),m.texture.pmremVersion=h.pmremVersion,e.set(h,m),m.texture;if(m!==void 0)return m.texture;{let T=h.image;return x&&T&&T.height>0||y&&T&&c(T)?(n===null&&(n=new ro(i)),m=x?n.fromEquirectangular(h):n.fromCubemap(h),m.texture.pmremVersion=h.pmremVersion,e.set(h,m),h.addEventListener("dispose",u),m.texture):null}}}return h}function o(h,g){return g===pa?h.mapping=xi:g===ma&&(h.mapping=Vi),h}function c(h){let g=0,x=6;for(let y=0;y<x;y++)h[y]!==void 0&&g++;return g===x}function l(h){let g=h.target;g.removeEventListener("dispose",l);let x=t.get(g);x!==void 0&&(t.delete(g),x.dispose())}function u(h){let g=h.target;g.removeEventListener("dispose",u);let x=e.get(g);x!==void 0&&(e.delete(g),x.dispose())}function p(){t=new WeakMap,e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:s,dispose:p}}function kf(i){let t={};function e(n){if(t[n]!==void 0)return t[n];let s=i.getExtension(n);return t[n]=s,s}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){let s=e(n);return s===null&&Ni("WebGLRenderer: "+n+" extension not supported."),s}}}function Gf(i,t,e,n){let s={},r=new WeakMap;function a(p){let h=p.target;h.index!==null&&t.remove(h.index);for(let x in h.attributes)t.remove(h.attributes[x]);h.removeEventListener("dispose",a),delete s[h.id];let g=r.get(h);g&&(t.remove(g),r.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,e.memory.geometries--}function o(p,h){return s[h.id]===!0||(h.addEventListener("dispose",a),s[h.id]=!0,e.memory.geometries++),h}function c(p){let h=p.attributes;for(let g in h)t.update(h[g],i.ARRAY_BUFFER)}function l(p){let h=[],g=p.index,x=p.attributes.position,y=0;if(x===void 0)return;if(g!==null){let T=g.array;y=g.version;for(let w=0,M=T.length;w<M;w+=3){let A=T[w+0],b=T[w+1],C=T[w+2];h.push(A,b,b,C,C,A)}}else{let T=x.array;y=x.version;for(let w=0,M=T.length/3-1;w<M;w+=3){let A=w+0,b=w+1,C=w+2;h.push(A,b,b,C,C,A)}}let m=new(x.count>=65535?Os:Fs)(h,1);m.version=y;let d=r.get(p);d&&t.remove(d),r.set(p,m)}function u(p){let h=r.get(p);if(h){let g=p.index;g!==null&&h.version<g.version&&l(p)}else l(p);return r.get(p)}return{get:o,update:c,getWireframeAttribute:u}}function Hf(i,t,e){let n;function s(p){n=p}let r,a;function o(p){r=p.type,a=p.bytesPerElement}function c(p,h){i.drawElements(n,h,r,p*a),e.update(h,n,1)}function l(p,h,g){g!==0&&(i.drawElementsInstanced(n,h,r,p*a,g),e.update(h,n,g))}function u(p,h,g){if(g===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,h,0,r,p,0,g);let y=0;for(let m=0;m<g;m++)y+=h[m];e.update(y,n,1)}this.setMode=s,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function Wf(i){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(e.calls++,a){case i.TRIANGLES:e.triangles+=o*(r/3);break;case i.LINES:e.lines+=o*(r/2);break;case i.LINE_STRIP:e.lines+=o*(r-1);break;case i.LINE_LOOP:e.lines+=o*r;break;case i.POINTS:e.points+=o*r;break;default:Ut("WebGLInfo: Unknown draw mode:",a);break}}function s(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:s,update:n}}function Xf(i,t,e){let n=new WeakMap,s=new Ee;function r(a,o,c){let l=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,p=u!==void 0?u.length:0,h=n.get(o);if(h===void 0||h.count!==p){let E=function(){C.dispose(),n.delete(o),o.removeEventListener("dispose",E)};h!==void 0&&h.texture.dispose();let g=o.morphAttributes.position!==void 0,x=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],d=o.morphAttributes.normal||[],T=o.morphAttributes.color||[],w=0;g===!0&&(w=1),x===!0&&(w=2),y===!0&&(w=3);let M=o.attributes.position.count*w,A=1;M>t.maxTextureSize&&(A=Math.ceil(M/t.maxTextureSize),M=t.maxTextureSize);let b=new Float32Array(M*A*4*p),C=new Ns(b,M,A,p);C.type=gn,C.needsUpdate=!0;let _=w*4;for(let D=0;D<p;D++){let I=m[D],O=d[D],q=T[D],Y=M*A*4*D;for(let z=0;z<I.count;z++){let X=z*_;g===!0&&(s.fromBufferAttribute(I,z),b[Y+X+0]=s.x,b[Y+X+1]=s.y,b[Y+X+2]=s.z,b[Y+X+3]=0),x===!0&&(s.fromBufferAttribute(O,z),b[Y+X+4]=s.x,b[Y+X+5]=s.y,b[Y+X+6]=s.z,b[Y+X+7]=0),y===!0&&(s.fromBufferAttribute(q,z),b[Y+X+8]=s.x,b[Y+X+9]=s.y,b[Y+X+10]=s.z,b[Y+X+11]=q.itemSize===4?s.w:1)}}h={count:p,texture:C,size:new jt(M,A)},n.set(o,h),o.addEventListener("dispose",E)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(i,"morphTexture",a.morphTexture,e);else{let g=0;for(let y=0;y<l.length;y++)g+=l[y];let x=o.morphTargetsRelative?1:1-g;c.getUniforms().setValue(i,"morphTargetBaseInfluence",x),c.getUniforms().setValue(i,"morphTargetInfluences",l)}c.getUniforms().setValue(i,"morphTargetsTexture",h.texture,e),c.getUniforms().setValue(i,"morphTargetsTextureSize",h.size)}return{update:r}}function qf(i,t,e,n,s){let r=new WeakMap;function a(l){let u=s.render.frame,p=l.geometry,h=t.get(l,p);if(r.get(h)!==u&&(t.update(h),r.set(h,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),r.get(l)!==u&&(e.update(l.instanceMatrix,i.ARRAY_BUFFER),l.instanceColor!==null&&e.update(l.instanceColor,i.ARRAY_BUFFER),r.set(l,u))),l.isSkinnedMesh){let g=l.skeleton;r.get(g)!==u&&(g.update(),r.set(g,u))}return h}function o(){r=new WeakMap}function c(l){let u=l.target;u.removeEventListener("dispose",c),n.releaseStatesOfObject(u),e.remove(u.instanceMatrix),u.instanceColor!==null&&e.remove(u.instanceColor)}return{update:a,dispose:o}}var Yf={[$o]:"LINEAR_TONE_MAPPING",[Ko]:"REINHARD_TONE_MAPPING",[Qo]:"CINEON_TONE_MAPPING",[$s]:"ACES_FILMIC_TONE_MAPPING",[tl]:"AGX_TONE_MAPPING",[el]:"NEUTRAL_TONE_MAPPING",[jo]:"CUSTOM_TONE_MAPPING"};function Zf(i,t,e,n,s,r){let a=new an(t,e,{type:i,depthBuffer:s,stencilBuffer:r,samples:n?4:0,depthTexture:s?new Kn(t,e):void 0}),o=new an(t,e,{type:_n,depthBuffer:!1,stencilBuffer:!1}),c=new An;c.setAttribute("position",new qe([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new qe([0,2,0,0,2,0],2));let l=new Qr({uniforms:{tDiffuse:{value:null}},vertexShader:`
3961			precision highp float;
3962
3963			uniform mat4 modelViewMatrix;
3964			uniform mat4 projectionMatrix;
3965
3966			attribute vec3 position;
3967			attribute vec2 uv;
3968
3969			varying vec2 vUv;
3970
3971			void main() {
3972				vUv = uv;
3973				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3974			}`,fragmentShader:`
3975			precision highp float;
3976
3977			uniform sampler2D tDiffuse;
3978
3979			varying vec2 vUv;
3980
3981			#include <tonemapping_pars_fragment>
3982			#include <colorspace_pars_fragment>
3983
3984			void main() {
3985				gl_FragColor = texture2D( tDiffuse, vUv );
3986
3987				#ifdef LINEAR_TONE_MAPPING
3988					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3989				#elif defined( REINHARD_TONE_MAPPING )
3990					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3991				#elif defined( CINEON_TONE_MAPPING )
3992					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3993				#elif defined( ACES_FILMIC_TONE_MAPPING )
3994					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3995				#elif defined( AGX_TONE_MAPPING )
3996					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
3997				#elif defined( NEUTRAL_TONE_MAPPING )
3998					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
3999				#elif defined( CUSTOM_TONE_MAPPING )
4000					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4001				#endif
4002
4003				#ifdef SRGB_TRANSFER
4004					gl_FragColor = sRGBTransferOETF( gl_FragColor );
4005				#endif
4006			}`,depthTest:!1,depthWrite:!1}),u=new We(c,l),p=new zi(-1,1,1,-1,0,1),h=null,g=null,x=!1,y,m=null,d=[],T=!1;this.setSize=function(w,M){a.setSize(w,M),o.setSize(w,M);for(let A=0;A<d.length;A++){let b=d[A];b.setSize&&b.setSize(w,M)}},this.setEffects=function(w){d=w,T=d.length>0&&d[0].isRenderPass===!0;let M=a.width,A=a.height;for(let b=0;b<d.length;b++){let C=d[b];C.setSize&&C.setSize(M,A)}},this.begin=function(w,M){if(x||w.toneMapping===wn&&d.length===0)return!1;if(m=M,M!==null){let A=M.width,b=M.height;(a.width!==A||a.height!==b)&&this.setSize(A,b)}return T===!1&&w.setRenderTarget(a),y=w.toneMapping,w.toneMapping=wn,!0},this.hasRenderPass=function(){return T},this.end=function(w,M){w.toneMapping=y,x=!0;let A=a,b=o;for(let C=0;C<d.length;C++){let _=d[C];if(_.enabled!==!1&&(_.render(w,b,A,M),_.needsSwap!==!1)){let E=A;A=b,b=E}}if(h!==w.outputColorSpace||g!==w.toneMapping){h=w.outputColorSpace,g=w.toneMapping,l.defines={},$t.getTransfer(h)===oe&&(l.defines.SRGB_TRANSFER="");let C=Yf[g];C&&(l.defines[C]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=A.texture,w.setRenderTarget(m),w.render(u,p),m=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){a.depthTexture&&a.depthTexture.dispose(),a.dispose(),o.dispose(),c.dispose(),l.dispose()}}var ah=new je,Ml=new Kn(1,1),oh=new Ns,lh=new Jr,ch=new Gs,kc=[],Gc=[],Hc=new Float32Array(16),Wc=new Float32Array(9),Xc=new Float32Array(4);function ms(i,t,e){let n=i[0];if(n<=0||n>0)return i;let s=t*e,r=kc[s];if(r===void 0&&(r=new Float32Array(s),kc[s]=r),t!==0){n.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=e,i[a].toArray(r,o)}return r}function Le(i,t){if(i.length!==t.length)return!1;for(let e=0,n=i.length;e<n;e++)if(i[e]!==t[e])return!1;return!0}function De(i,t){for(let e=0,n=t.length;e<n;e++)i[e]=t[e]}function lo(i,t){let e=Gc[t];e===void 0&&(e=new Int32Array(t),Gc[t]=e);for(let n=0;n!==t;++n)e[n]=i.allocateTextureUnit();return e}function Jf(i,t){let e=this.cache;e[0]!==t&&(i.uniform1f(this.addr,t),e[0]=t)}function $f(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Le(e,t))return;i.uniform2fv(this.addr,t),De(e,t)}}function Kf(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.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)&&(i.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(Le(e,t))return;i.uniform3fv(this.addr,t),De(e,t)}}function Qf(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.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(Le(e,t))return;i.uniform4fv(this.addr,t),De(e,t)}}function jf(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Le(e,t))return;i.uniformMatrix2fv(this.addr,!1,t),De(e,t)}else{if(Le(e,n))return;Xc.set(n),i.uniformMatrix2fv(this.addr,!1,Xc),De(e,n)}}function tp(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Le(e,t))return;i.uniformMatrix3fv(this.addr,!1,t),De(e,t)}else{if(Le(e,n))return;Wc.set(n),i.uniformMatrix3fv(this.addr,!1,Wc),De(e,n)}}function ep(i,t){let e=this.cache,n=t.elements;if(n===void 0){if(Le(e,t))return;i.uniformMatrix4fv(this.addr,!1,t),De(e,t)}else{if(Le(e,n))return;Hc.set(n),i.uniformMatrix4fv(this.addr,!1,Hc),De(e,n)}}function np(i,t){let e=this.cache;e[0]!==t&&(i.uniform1i(this.addr,t),e[0]=t)}function ip(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Le(e,t))return;i.uniform2iv(this.addr,t),De(e,t)}}function sp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Le(e,t))return;i.uniform3iv(this.addr,t),De(e,t)}}function rp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.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(Le(e,t))return;i.uniform4iv(this.addr,t),De(e,t)}}function ap(i,t){let e=this.cache;e[0]!==t&&(i.uniform1ui(this.addr,t),e[0]=t)}function op(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(i.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(Le(e,t))return;i.uniform2uiv(this.addr,t),De(e,t)}}function lp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(i.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(Le(e,t))return;i.uniform3uiv(this.addr,t),De(e,t)}}function cp(i,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(i.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(Le(e,t))return;i.uniform4uiv(this.addr,t),De(e,t)}}function hp(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s);let r;this.type===i.SAMPLER_2D_SHADOW?(Ml.compareFunction=e.isReversedDepthBuffer()?no:eo,r=Ml):r=ah,e.setTexture2D(t||r,s)}function up(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture3D(t||lh,s)}function dp(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTextureCube(t||ch,s)}function fp(i,t,e){let n=this.cache,s=e.allocateTextureUnit();n[0]!==s&&(i.uniform1i(this.addr,s),n[0]=s),e.setTexture2DArray(t||oh,s)}function pp(i){switch(i){case 5126:return Jf;case 35664:return $f;case 35665:return Kf;case 35666:return Qf;case 35674:return jf;case 35675:return tp;case 35676:return ep;case 5124:case 35670:return np;case 35667:case 35671:return ip;case 35668:case 35672:return sp;case 35669:case 35673:return rp;case 5125:return ap;case 36294:return op;case 36295:return lp;case 36296:return cp;case 35678:case 36198:case 36298:case 36306:case 35682:return hp;case 35679:case 36299:case 36307:return up;case 35680:case 36300:case 36308:case 36293:return dp;case 36289:case 36303:case 36311:case 36292:return fp}}function mp(i,t){i.uniform1fv(this.addr,t)}function gp(i,t){let e=ms(t,this.size,2);i.uniform2fv(this.addr,e)}function _p(i,t){let e=ms(t,this.size,3);i.uniform3fv(this.addr,e)}function xp(i,t){let e=ms(t,this.size,4);i.uniform4fv(this.addr,e)}function vp(i,t){let e=ms(t,this.size,4);i.uniformMatrix2fv(this.addr,!1,e)}function yp(i,t){let e=ms(t,this.size,9);i.uniformMatrix3fv(this.addr,!1,e)}function Mp(i,t){let e=ms(t,this.size,16);i.uniformMatrix4fv(this.addr,!1,e)}function Sp(i,t){i.uniform1iv(this.addr,t)}function bp(i,t){i.uniform2iv(this.addr,t)}function Ep(i,t){i.uniform3iv(this.addr,t)}function Tp(i,t){i.uniform4iv(this.addr,t)}function Ap(i,t){i.uniform1uiv(this.addr,t)}function wp(i,t){i.uniform2uiv(this.addr,t)}function Cp(i,t){i.uniform3uiv(this.addr,t)}function Rp(i,t){i.uniform4uiv(this.addr,t)}function Ip(i,t,e){let n=this.cache,s=t.length,r=lo(e,s);Le(n,r)||(i.uniform1iv(this.addr,r),De(n,r));let a;this.type===i.SAMPLER_2D_SHADOW?a=Ml:a=ah;for(let o=0;o!==s;++o)e.setTexture2D(t[o]||a,r[o])}function Pp(i,t,e){let n=this.cache,s=t.length,r=lo(e,s);Le(n,r)||(i.uniform1iv(this.addr,r),De(n,r));for(let a=0;a!==s;++a)e.setTexture3D(t[a]||lh,r[a])}function Lp(i,t,e){let n=this.cache,s=t.length,r=lo(e,s);Le(n,r)||(i.uniform1iv(this.addr,r),De(n,r));for(let a=0;a!==s;++a)e.setTextureCube(t[a]||ch,r[a])}function Dp(i,t,e){let n=this.cache,s=t.length,r=lo(e,s);Le(n,r)||(i.uniform1iv(this.addr,r),De(n,r));for(let a=0;a!==s;++a)e.setTexture2DArray(t[a]||oh,r[a])}function Np(i){switch(i){case 5126:return mp;case 35664:return gp;case 35665:return _p;case 35666:return xp;case 35674:return vp;case 35675:return yp;case 35676:return Mp;case 5124:case 35670:return Sp;case 35667:case 35671:return bp;case 35668:case 35672:return Ep;case 35669:case 35673:return Tp;case 5125:return Ap;case 36294:return wp;case 36295:return Cp;case 36296:return Rp;case 35678:case 36198:case 36298:case 36306:case 35682:return Ip;case 35679:case 36299:case 36307:return Pp;case 35680:case 36300:case 36308:case 36293:return Lp;case 36289:case 36303:case 36311:case 36292:return Dp}}var Sl=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=pp(e.type)}},bl=class{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=Np(e.type)}},El=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){let s=this.seq;for(let r=0,a=s.length;r!==a;++r){let o=s[r];o.setValue(t,e[o.id],n)}}},vl=/(\w+)(\])?(\[|\.)?/g;function qc(i,t){i.seq.push(t),i.map[t.id]=t}function Up(i,t,e){let n=i.name,s=n.length;for(vl.lastIndex=0;;){let r=vl.exec(n),a=vl.lastIndex,o=r[1],c=r[2]==="]",l=r[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===s){qc(e,l===void 0?new Sl(o,i,t):new bl(o,i,t));break}else{let p=e.map[o];p===void 0&&(p=new El(o),qc(e,p)),e=p}}}var fs=class{constructor(t,e){this.seq=[],this.map={};let n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){let o=t.getActiveUniform(e,a),c=t.getUniformLocation(e,o.name);Up(o,c,this)}let s=[],r=[];for(let a of this.seq)a.type===t.SAMPLER_2D_SHADOW||a.type===t.SAMPLER_CUBE_SHADOW||a.type===t.SAMPLER_2D_ARRAY_SHADOW?s.push(a):r.push(a);s.length>0&&(this.seq=s.concat(r))}setValue(t,e,n,s){let r=this.map[e];r!==void 0&&r.setValue(t,n,s)}setOptional(t,e,n){let s=e[n];s!==void 0&&this.setValue(t,n,s)}static upload(t,e,n,s){for(let r=0,a=e.length;r!==a;++r){let o=e[r],c=n[o.id];c.needsUpdate!==!1&&o.setValue(t,c.value,s)}}static seqWithValue(t,e){let n=[];for(let s=0,r=t.length;s!==r;++s){let a=t[s];a.id in e&&n.push(a)}return n}};function Yc(i,t,e){let n=i.createShader(t);return i.shaderSource(n,e),i.compileShader(n),n}var Fp=37297,Op=0;function Bp(i,t){let e=i.split(`
4007`),n=[],s=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let a=s;a<r;a++){let o=a+1;n.push(`${o===t?">":" "} ${o}: ${e[a]}`)}return n.join(`
4008`)}var Zc=new kt;function zp(i){$t._getMatrix(Zc,$t.workingColorSpace,i);let t=`mat3( ${Zc.elements.map(e=>e.toFixed(4))} )`;switch($t.getTransfer(i)){case Ps:return[t,"LinearTransferOETF"];case oe:return[t,"sRGBTransferOETF"];default:return Dt("WebGLProgram: Unsupported color space: ",i),[t,"LinearTransferOETF"]}}function Jc(i,t,e){let n=i.getShaderParameter(t,i.COMPILE_STATUS),r=(i.getShaderInfoLog(t)||"").trim();if(n&&r==="")return"";let a=/ERROR: 0:(\d+)/.exec(r);if(a){let o=parseInt(a[1]);return e.toUpperCase()+`
4009
4010`+r+`
4011
4012`+Bp(i.getShaderSource(t),o)}else return r}function Vp(i,t){let e=zp(t);return[`vec4 ${i}( vec4 value ) {`,`	return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
4013`)}var kp={[$o]:"Linear",[Ko]:"Reinhard",[Qo]:"Cineon",[$s]:"ACESFilmic",[tl]:"AgX",[el]:"Neutral",[jo]:"Custom"};function Gp(i,t){let e=kp[t];return e===void 0?(Dt("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var so=new F;function Hp(){$t.getLuminanceCoefficients(so);let i=so.x.toFixed(4),t=so.y.toFixed(4),e=so.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${t}, ${e} );`,"	return dot( weights, rgb );","}"].join(`
4014`)}function Wp(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(lr).join(`
4015`)}function Xp(i){let t=[];for(let e in i){let n=i[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(`
4016`)}function qp(i,t){let e={},n=i.getProgramParameter(t,i.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){let r=i.getActiveAttrib(t,s),a=r.name,o=1;r.type===i.FLOAT_MAT2&&(o=2),r.type===i.FLOAT_MAT3&&(o=3),r.type===i.FLOAT_MAT4&&(o=4),e[a]={type:r.type,location:i.getAttribLocation(t,a),locationSize:o}}return e}function lr(i){return i!==""}function $c(i,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return i.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 Kc(i,t){return i.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Yp=/^[ \t]*#include +<([\w\d./]+)>/gm;function Tl(i){return i.replace(Yp,Jp)}var Zp=new Map;function Jp(i,t){let e=Zt[t];if(e===void 0){let n=Zp.get(t);if(n!==void 0)e=Zt[n],Dt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return Tl(e)}var $p=/#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 Qc(i){return i.replace($p,Kp)}function Kp(i,t,e,n){let s="";for(let r=parseInt(t);r<parseInt(e);r++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function jc(i){let t=`precision ${i.precision} float;
4017	precision ${i.precision} int;
4018	precision ${i.precision} sampler2D;
4019	precision ${i.precision} samplerCube;
4020	precision ${i.precision} sampler3D;
4021	precision ${i.precision} sampler2DArray;
4022	precision ${i.precision} sampler2DShadow;
4023	precision ${i.precision} samplerCubeShadow;
4024	precision ${i.precision} sampler2DArrayShadow;
4025	precision ${i.precision} isampler2D;
4026	precision ${i.precision} isampler3D;
4027	precision ${i.precision} isamplerCube;
4028	precision ${i.precision} isampler2DArray;
4029	precision ${i.precision} usampler2D;
4030	precision ${i.precision} usampler3D;
4031	precision ${i.precision} usamplerCube;
4032	precision ${i.precision} usampler2DArray;
4033	`;return i.precision==="highp"?t+=`
4034#define HIGH_PRECISION`:i.precision==="mediump"?t+=`
4035#define MEDIUM_PRECISION`:i.precision==="lowp"&&(t+=`
4036#define LOW_PRECISION`),t}var Qp={[Js]:"SHADOWMAP_TYPE_PCF",[cs]:"SHADOWMAP_TYPE_VSM"};function jp(i){return Qp[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var tm={[xi]:"ENVMAP_TYPE_CUBE",[Vi]:"ENVMAP_TYPE_CUBE",[Ks]:"ENVMAP_TYPE_CUBE_UV"};function em(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":tm[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var nm={[Vi]:"ENVMAP_MODE_REFRACTION"};function im(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":nm[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var sm={[Jo]:"ENVMAP_BLENDING_MULTIPLY",[xc]:"ENVMAP_BLENDING_MIX",[vc]:"ENVMAP_BLENDING_ADD"};function rm(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":sm[i.combine]||"ENVMAP_BLENDING_NONE"}function am(i){let t=i.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,n=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:n,maxMip:e}}function om(i,t,e,n){let s=i.getContext(),r=e.defines,a=e.vertexShader,o=e.fragmentShader,c=jp(e),l=em(e),u=im(e),p=rm(e),h=am(e),g=Wp(e),x=Xp(r),y=s.createProgram(),m,d,T=e.glslVersion?"#version "+e.glslVersion+`
4037`:"";e.isRawShaderMaterial?(m=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,x].filter(lr).join(`
4038`),m.length>0&&(m+=`
4039`),d=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,x].filter(lr).join(`
4040`),d.length>0&&(d+=`
4041`)):(m=[jc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,x,e.extensionClipCullDistance?"#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 "+u:"",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.vertexNormals?"#define HAS_NORMAL":"",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 "+c:"",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",`
4042`].filter(lr).join(`
4043`),d=[jc(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,x,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 "+l:"",e.envMap?"#define "+u:"",e.envMap?"#define "+p:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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
4043IDESCENCE":"",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?"#define USE_COLOR":"",e.vertexAlphas||e.batchingColor?"#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 "+c:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",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!==wn?"#define TONE_MAPPING":"",e.toneMapping!==wn?Zt.tonemapping_pars_fragment:"",e.toneMapping!==wn?Gp("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Zt.colorspace_pars_fragment,Vp("linearToOutputTexel",e.outputColorSpace),Hp(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
4044`].filter(lr).join(`
4045`)),a=Tl(a),a=$c(a,e),a=Kc(a,e),o=Tl(o),o=$c(o,e),o=Kc(o,e),a=Qc(a),o=Qc(o),e.isRawShaderMaterial!==!0&&(T=`#version 300 es
4046`,m=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4047`)+`
4048`+m,d=["#define varying in",e.glslVersion===cl?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===cl?"":"#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(`
4049`)+`
4050`+d);let w=T+m+a,M=T+d+o,A=Yc(s,s.VERTEX_SHADER,w),b=Yc(s,s.FRAGMENT_SHADER,M);s.attachShader(y,A),s.attachShader(y,b),e.index0AttributeName!==void 0?s.bindAttribLocation(y,0,e.index0AttributeName):e.hasPositionAttribute===!0&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y);function C(I){if(i.debug.checkShaderErrors){let O=s.getProgramInfoLog(y)||"",q=s.getShaderInfoLog(A)||"",Y=s.getShaderInfoLog(b)||"",z=O.trim(),X=q.trim(),G=Y.trim(),K=!0,tt=!0;if(s.getProgramParameter(y,s.LINK_STATUS)===!1)if(K=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(s,y,A,b);else{let ft=Jc(s,A,"vertex"),xt=Jc(s,b,"fragment");Ut("WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(y,s.VALIDATE_STATUS)+`
4051
4052Material Name: `+I.name+`
4053Material Type: `+I.type+`
4054
4055Program Info Log: `+z+`
4056`+ft+`
4057`+xt)}else z!==""?Dt("WebGLProgram: Program Info Log:",z):(X===""||G==="")&&(tt=!1);tt&&(I.diagnostics={runnable:K,programLog:z,vertexShader:{log:X,prefix:m},fragmentShader:{log:G,prefix:d}})}s.deleteShader(A),s.deleteShader(b),_=new fs(s,y),E=qp(s,y)}let _;this.getUniforms=function(){return _===void 0&&C(this),_};let E;this.getAttributes=function(){return E===void 0&&C(this),E};let D=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=s.getProgramParameter(y,Fp)),D},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=Op++,this.cacheKey=t,this.usedTimes=1,this.program=y,this.vertexShader=A,this.fragmentShader=b,this}var lm=0,Al=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t,e,n){let s=this._getShaderCacheForMaterial(t);return s.has(e)===!1&&(s.add(e),e.usedTimes++),s.has(n)===!1&&(s.add(n),n.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderStage(t){return this._getShaderStage(t.vertexShader)}getFragmentShaderStage(t){return this._getShaderStage(t.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new wl(t),e.set(t,n)),n}},wl=class{constructor(t){this.id=lm++,this.code=t,this.usedTimes=0}};function cm(i){return i===Mi||i===ir||i===sr}function hm(i,t,e,n,s,r){let a=new Us,o=new Al,c=new Set,l=[],u=new Map,p=n.logarithmicDepthBuffer,h=n.precision,g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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 x(_){return c.add(_),_===0?"uv":`uv${_}`}function y(_,E,D,I,O,q){let Y=I.fog,z=O.geometry,X=_.isMeshStandardMaterial||_.isMeshLambertMaterial||_.isMeshPhongMaterial?I.environment:null,G=_.isMeshStandardMaterial||_.isMeshLambertMaterial&&!_.envMap||_.isMeshPhongMaterial&&!_.envMap,K=t.get(_.envMap||X,G),tt=K&&K.mapping===Ks?K.image.height:null,ft=g[_.type];_.precision!==null&&(h=n.getMaxPrecision(_.precision),h!==_.precision&&Dt("WebGLProgram.getParameters:",_.precision,"not supported, using",h,"instead."));let xt=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,Mt=xt!==void 0?xt.length:0,te=0;z.morphAttributes.position!==void 0&&(te=1),z.morphAttributes.normal!==void 0&&(te=2),z.morphAttributes.color!==void 0&&(te=3);let Qt,Ft,Z,st;if(ft){let bt=kn[ft];Qt=bt.vertexShader,Ft=bt.fragmentShader}else{Qt=_.vertexShader,Ft=_.fragmentShader;let bt=o.getVertexShaderStage(_),Me=o.getFragmentShaderStage(_);o.update(_,bt,Me),Z=bt.id,st=Me.id}let et=i.getRenderTarget(),Nt=i.state.buffers.depth.getReversed(),Ot=O.isInstancedMesh===!0,Lt=O.
vendor: 70,567 bytes, lines 4057-4084
4057isBatchedMesh===!0,pe=!!_.map,Ht=!!_.matcap,le=!!K,ee=!!_.aoMap,Jt=!!_.lightMap,fe=!!_.bumpMap&&_.wireframe===!1,Ae=!!_.normalMap,we=!!_.displacementMap,Pe=!!_.emissiveMap,ye=!!_.metalnessMap,Te=!!_.roughnessMap,P=_.anisotropy>0,Be=_.clearcoat>0,ie=_.dispersion>0,S=_.iridescence>0,f=_.sheen>0,N=_.transmission>0,V=P&&!!_.anisotropyMap,H=Be&&!!_.clearcoatMap,nt=Be&&!!_.clearcoatNormalMap,at=Be&&!!_.clearcoatRoughnessMap,W=S&&!!_.iridescenceMap,$=S&&!!_.iridescenceThicknessMap,ot=f&&!!_.sheenColorMap,At=f&&!!_.sheenRoughnessMap,pt=!!_.specularMap,it=!!_.specularColorMap,Rt=!!_.specularIntensityMap,Pt=N&&!!_.transmissionMap,Gt=N&&!!_.thicknessMap,R=!!_.gradientMap,lt=!!_.alphaMap,J=_.alphaTest>0,ct=!!_.alphaHash,ut=!!_.extensions,Q=wn;_.toneMapped&&(et===null||et.isXRRenderTarget===!0)&&(Q=i.toneMapping);let Et={shaderID:ft,shaderType:_.type,shaderName:_.name,vertexShader:Qt,fragmentShader:Ft,defines:_.defines,customVertexShaderID:Z,customFragmentShaderID:st,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:h,batching:Lt,batchingColor:Lt&&O._colorsTexture!==null,instancing:Ot,instancingColor:Ot&&O.instanceColor!==null,instancingMorph:Ot&&O.morphTexture!==null,outputColorSpace:et===null?i.outputColorSpace:et.isXRRenderTarget===!0?et.texture.colorSpace:$t.workingColorSpace,alphaToCoverage:!!_.alphaToCoverage,map:pe,matcap:Ht,envMap:le,envMapMode:le&&K.mapping,envMapCubeUVHeight:tt,aoMap:ee,lightMap:Jt,bumpMap:fe,normalMap:Ae,displacementMap:we,emissiveMap:Pe,normalMapObjectSpace:Ae&&_.normalMapType===Sc,normalMapTangentSpace:Ae&&_.normalMapType===to,packedNormalMap:Ae&&_.normalMapType===to&&cm(_.normalMap.format),metalnessMap:ye,roughnessMap:Te,anisotropy:P,anisotropyMap:V,clearcoat:Be,clearcoatMap:H,clearcoatNormalMap:nt,clearcoatRoughnessMap:at,dispersion:ie,iridescence:S,iridescenceMap:W,iridescenceThicknessMap:$,sheen:f,sheenColorMap:ot,sheenRoughnessMap:At,specularMap:pt,specularColorMap:it,specularIntensityMap:Rt,transmission:N,transmissionMap:Pt,thicknessMap:Gt,gradientMap:R,opaque:_.transparent===!1&&_.blending===Ui&&_.alphaToCoverage===!1,alphaMap:lt,alphaTest:J,alphaHash:ct,combine:_.combine,mapUv:pe&&x(_.map.channel),aoMapUv:ee&&x(_.aoMap.channel),lightMapUv:Jt&&x(_.lightMap.channel),bumpMapUv:fe&&x(_.bumpMap.channel),normalMapUv:Ae&&x(_.normalMap.channel),displacementMapUv:we&&x(_.displacementMap.channel),emissiveMapUv:Pe&&x(_.emissiveMap.channel),metalnessMapUv:ye&&x(_.metalnessMap.channel),roughnessMapUv:Te&&x(_.roughnessMap.channel),anisotropyMapUv:V&&x(_.anisotropyMap.channel),clearcoatMapUv:H&&x(_.clearcoatMap.channel),clearcoatNormalMapUv:nt&&x(_.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:at&&x(_.clearcoatRoughnessMap.channel),iridescenceMapUv:W&&x(_.iridescenceMap.channel),iridescenceThicknessMapUv:$&&x(_.iridescenceThicknessMap.channel),sheenColorMapUv:ot&&x(_.sheenColorMap.channel),sheenRoughnessMapUv:At&&x(_.sheenRoughnessMap.channel),specularMapUv:pt&&x(_.specularMap.channel),specularColorMapUv:it&&x(_.specularColorMap.channel),specularIntensityMapUv:Rt&&x(_.specularIntensityMap.channel),transmissionMapUv:Pt&&x(_.transmissionMap.channel),thicknessMapUv:Gt&&x(_.thicknessMap.channel),alphaMapUv:lt&&x(_.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(Ae||P),vertexNormals:!!z.attributes.normal,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!z.attributes.uv&&(pe||lt),fog:!!Y,useFog:_.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:_.wireframe===!1&&(_.flatShading===!0||z.attributes.normal===void 0&&Ae===!1&&(_.isMeshLambertMaterial||_.isMeshPhongMaterial||_.isMeshStandardMaterial||_.isMeshPhysicalMaterial)),sizeAttenuation:_.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:Nt,skinning:O.isSkinnedMesh===!0,hasPositionAttribute:z.attributes.position!==void 0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:Mt,morphTextureStride:te,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numLightProbes:E.numLightProbes,numLightProbeGrids:q.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:_.dithering,shadowMapEnabled:i.shadowMap.enabled&&D.length>0,shadowMapType:i.shadowMap.type,toneMapping:Q,decodeVideoTexture:pe&&_.map.isVideoTexture===!0&&$t.getTransfer(_.map.colorSpace)===oe,decodeVideoTextureEmissive:Pe&&_.emissiveMap.isVideoTexture===!0&&$t.getTransfer(_.emissiveMap.colorSpace)===oe,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===mn,flipSided:_.side===Ye,useDepthPacking:_.depthPacking>=0,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionClipCullDistance:ut&&_.extensions.clipCullDistance===!0&&e.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ut&&_.extensions.multiDraw===!0||Lt)&&e.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:e.has("KHR_parallel_shader_compile"),customProgramCacheKey:_.customProgramCacheKey()};return Et.vertexUv1s=c.has(1),Et.vertexUv2s=c.has(2),Et.vertexUv3s=c.has(3),c.clear(),Et}function m(_){let E=[];if(_.shaderID?E.push(_.shaderID):(E.push(_.customVertexShaderID),E.push(_.customFragmentShaderID)),_.defines!==void 0)for(let D in _.defines)E.push(D),E.push(_.defines[D]);return _.isRawShaderMaterial===!1&&(d(E,_),T(E,_),E.push(i.outputColorSpace)),E.push(_.customProgramCacheKey),E.join()}function d(_,E){_.push(E.precision),_.push(E.outputColorSpace),_.push(E.envMapMode),_.push(E.envMapCubeUVHeight),_.push(E.mapUv),_.push(E.alphaMapUv),_.push(E.lightMapUv),_.push(E.aoMapUv),_.push(E.bumpMapUv),_.push(E.normalMapUv),_.push(E.displacementMapUv),_.push(E.emissiveMapUv),_.push(E.metalnessMapUv),_.push(E.roughnessMapUv),_.push(E.anisotropyMapUv),_.push(E.clearcoatMapUv),_.push(E.clearcoatNormalMapUv),_.push(E.clearcoatRoughnessMapUv),_.push(E.iridescenceMapUv),_.push(E.iridescenceThicknessMapUv),_.push(E.sheenColorMapUv),_.push(E.sheenRoughnessMapUv),_.push(E.specularMapUv),_.push(E.specularColorMapUv),_.push(E.specularIntensityMapUv),_.push(E.transmissionMapUv),_.push(E.thicknessMapUv),_.push(E.combine),_.push(E.fogExp2),_.push(E.sizeAttenuation),_.push(E.morphTargetsCount),_.push(E.morphAttributeCount),_.push(E.numDirLights),_.push(E.numPointLights),_.push(E.numSpotLights),_.push(E.numSpotLightMaps),_.push(E.numHemiLights),_.push(E.numRectAreaLights),_.push(E.numDirLightShadows),_.push(E.numPointLightShadows),_.push(E.numSpotLightShadows),_.push(E.numSpotLightShadowsWithMaps),_.push(E.numLightProbes),_.push(E.shadowMapType),_.push(E.toneMapping),_.push(E.numClippingPlanes),_.push(E.numClipIntersection),_.push(E.depthPacking)}function T(_,E){a.disableAll(),E.instancing&&a.enable(0),E.instancingColor&&a.enable(1),E.instancingMorph&&a.enable(2),E.matcap&&a.enable(3),E.envMap&&a.enable(4),E.normalMapObjectSpace&&a.enable(5),E.normalMapTangentSpace&&a.enable(6),E.clearcoat&&a.enable(7),E.iridescence&&a.enable(8),E.alphaTest&&a.enable(9),E.vertexColors&&a.enable(10),E.vertexAlphas&&a.enable(11),E.vertexUv1s&&a.enable(12),E.vertexUv2s&&a.enable(13),E.vertexUv3s&&a.enable(14),E.vertexTangents&&a.enable(15),E.anisotropy&&a.enable(16),E.alphaHash&&a.enable(17),E.batching&&a.enable(18),E.dispersion&&a.enable(19),E.batchingColor&&a.enable(20),E.gradientMap&&a.enable(21),E.packedNormalMap&&a.enable(22),E.vertexNormals&&a.enable(23),_.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.reversedDepthBuffer&&a.enable(4),E.skinning&&a.enable(5),E.morphTargets&&a.enable(6),E.morphNormals&&a.enable(7),E.morphColors&&a.enable(8),E.premultipliedAlpha&&a.enable(9),E.shadowMapEnabled&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),E.decodeVideoTexture&&a.enable(19),E.decodeVideoTextureEmissive&&a.enable(20),E.alphaToCoverage&&a.enable(21),E.numLightProbeGrids>0&&a.enable(22),E.hasPositionAttribute&&a.enable(23),_.push(a.mask)}function w(_){let E=g[_.type],D;if(E){let I=kn[E];D=Nc.clone(I.uniforms)}else D=_.uniforms;return D}function M(_,E){let D=u.get(E);return D!==void 0?++D.usedTimes:(D=new om(i,E,_,s),l.push(D),u.set(E,D)),D}function A(_){if(--_.usedTimes===0){let E=l.indexOf(_);l[E]=l[l.length-1],l.pop(),u.delete(_.cacheKey),_.destroy()}}function b(_){o.remove(_)}function C(){o.dispose()}return{getParameters:y,getProgramCacheKey:m,getUniforms:w,acquireProgram:M,releaseProgram:A,releaseShaderCache:b,programs:l,dispose:C}}function um(){let i=new WeakMap;function t(a){return i.has(a)}function e(a){let o=i.get(a);return o===void 0&&(o={},i.set(a,o)),o}function n(a){i.delete(a)}function s(a,o,c){i.get(a)[o]=c}function r(){i=new WeakMap}return{has:t,get:e,remove:n,update:s,dispose:r}}function dm(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.material.id!==t.material.id?i.material.id-t.material.id:i.materialVariant!==t.materialVariant?i.materialVariant-t.materialVariant:i.z!==t.z?i.z-t.z:i.id-t.id}function th(i,t){return i.groupOrder!==t.groupOrder?i.groupOrder-t.groupOrder:i.renderOrder!==t.renderOrder?i.renderOrder-t.renderOrder:i.z!==t.z?t.z-i.z:i.id-t.id}function eh(){let i=[],t=0,e=[],n=[],s=[];function r(){t=0,e.length=0,n.length=0,s.length=0}function a(h){let g=0;return h.isInstancedMesh&&(g+=2),h.isSkinnedMesh&&(g+=1),g}function o(h,g,x,y,m,d){let T=i[t];return T===void 0?(T={id:h.id,object:h,geometry:g,material:x,materialVariant:a(h),groupOrder:y,renderOrder:h.renderOrder,z:m,group:d},i[t]=T):(T.id=h.id,T.object=h,T.geometry=g,T.material=x,T.materialVariant=a(h),T.groupOrder=y,T.renderOrder=h.renderOrder,T.z=m,T.group=d),t++,T}function c(h,g,x,y,m,d){let T=o(h,g,x,y,m,d);x.transmission>0?n.push(T):x.transparent===!0?s.push(T):e.push(T)}function l(h,g,x,y,m,d){let T=o(h,g,x,y,m,d);x.transmission>0?n.unshift(T):x.transparent===!0?s.unshift(T):e.unshift(T)}function u(h,g,x){e.length>1&&e.sort(h||dm),n.length>1&&n.sort(g||th),s.length>1&&s.sort(g||th),x&&(e.reverse(),n.reverse(),s.reverse())}function p(){for(let h=t,g=i.length;h<g;h++){let x=i[h];if(x.id===null)break;x.id=null,x.object=null,x.geometry=null,x.material=null,x.group=null}}return{opaque:e,transmissive:n,transparent:s,init:r,push:c,unshift:l,finish:p,sort:u}}function fm(){let i=new WeakMap;function t(n,s){let r=i.get(n),a;return r===void 0?(a=new eh,i.set(n,[a])):s>=r.length?(a=new eh,r.push(a)):a=r[s],a}function e(){i=new WeakMap}return{get:t,dispose:e}}function pm(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new F,color:new Xt};break;case"SpotLight":e={position:new F,direction:new F,color:new Xt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new F,color:new Xt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new F,skyColor:new Xt,groundColor:new Xt};break;case"RectAreaLight":e={color:new Xt,position:new F,halfWidth:new F,halfHeight:new F};break}return i[t.id]=e,e}}}function mm(){let i={};return{get:function(t){if(i[t.id]!==void 0)return i[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[t.id]=e,e}}}var gm=0;function _m(i,t){return(t.castShadow?2:0)-(i.castShadow?2:0)+(t.map?1:0)-(i.map?1:0)}function xm(i){let t=new pm,e=mm(),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 l=0;l<9;l++)n.probe.push(new F);let s=new F,r=new de,a=new de;function o(l){let u=0,p=0,h=0;for(let E=0;E<9;E++)n.probe[E].set(0,0,0);let g=0,x=0,y=0,m=0,d=0,T=0,w=0,M=0,A=0,b=0,C=0;l.sort(_m);for(let E=0,D=l.length;E<D;E++){let I=l[E],O=I.color,q=I.intensity,Y=I.distance,z=null;if(I.shadow&&I.shadow.map&&(I.shadow.map.texture.format===Mi?z=I.shadow.map.texture:z=I.shadow.map.depthTexture||I.shadow.map.texture),I.isAmbientLight)u+=O.r*q,p+=O.g*q,h+=O.b*q;else if(I.isLightProbe){for(let X=0;X<9;X++)n.probe[X].addScaledVector(I.sh.coefficients[X],q);C++}else if(I.isDirectionalLight){let X=t.get(I);if(X.color.copy(I.color).multiplyScalar(I.intensity),I.castShadow){let G=I.shadow,K=e.get(I);K.shadowIntensity=G.intensity,K.shadowBias=G.bias,K.shadowNormalBias=G.normalBias,K.shadowRadius=G.radius,K.shadowMapSize=G.mapSize,n.directionalShadow[g]=K,n.directionalShadowMap[g]=z,n.directionalShadowMatrix[g]=I.shadow.matrix,T++}n.directional[g]=X,g++}else if(I.isSpotLight){let X=t.get(I);X.position.setFromMatrixPosition(I.matrixWorld),X.color.copy(O).multiplyScalar(q),X.distance=Y,X.coneCos=Math.cos(I.angle),X.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),X.decay=I.decay,n.spot[y]=X;let G=I.shadow;if(I.map&&(n.spotLightMap[A]=I.map,A++,G.updateMatrices(I),I.castShadow&&b++),n.spotLightMatrix[y]=G.matrix,I.castShadow){let K=e.get(I);K.shadowIntensity=G.intensity,K.shadowBias=G.bias,K.shadowNormalBias=G.normalBias,K.shadowRadius=G.radius,K.shadowMapSize=G.mapSize,n.spotShadow[y]=K,n.spotShadowMap[y]=z,M++}y++}else if(I.isRectAreaLight){let X=t.get(I);X.color.copy(O).multiplyScalar(q),X.halfWidth.set(I.width*.5,0,0),X.halfHeight.set(0,I.height*.5,0),n.rectArea[m]=X,m++}else if(I.isPointLight){let X=t.get(I);if(X.color.copy(I.color).multiplyScalar(I.intensity),X.distance=I.distance,X.decay=I.decay,I.castShadow){let G=I.shadow,K=e.get(I);K.shadowIntensity=G.intensity,K.shadowBias=G.bias,K.shadowNormalBias=G.normalBias,K.shadowRadius=G.radius,K.shadowMapSize=G.mapSize,K.shadowCameraNear=G.camera.near,K.shadowCameraFar=G.camera.far,n.pointShadow[x]=K,n.pointShadowMap[x]=z,n.pointShadowMatrix[x]=I.shadow.matrix,w++}n.point[x]=X,x++}else if(I.isHemisphereLight){let X=t.get(I);X.skyColor.copy(I.color).multiplyScalar(q),X.groundColor.copy(I.groundColor).multiplyScalar(q),n.hemi[d]=X,d++}}m>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=_t.LTC_FLOAT_1,n.rectAreaLTC2=_t.LTC_FLOAT_2):(n.rectAreaLTC1=_t.LTC_HALF_1,n.rectAreaLTC2=_t.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=p,n.ambient[2]=h;let _=n.hash;(_.directionalLength!==g||_.pointLength!==x||_.spotLength!==y||_.rectAreaLength!==m||_.hemiLength!==d||_.numDirectionalShadows!==T||_.numPointShadows!==w||_.numSpotShadows!==M||_.numSpotMaps!==A||_.numLightProbes!==C)&&(n.directional.length=g,n.spot.length=y,n.rectArea.length=m,n.point.length=x,n.hemi.length=d,n.directionalShadow.length=T,n.directionalShadowMap.length=T,n.pointShadow.length=w,n.pointShadowMap.length=w,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=T,n.pointShadowMatrix.length=w,n.spotLightMatrix.length=M+A-b,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=C,_.directionalLength=g,_.pointLength=x,_.spotLength=y,_.rectAreaLength=m,_.hemiLength=d,_.numDirectionalShadows=T,_.numPointShadows=w,_.numSpotShadows=M,_.numSpotMaps=A,_.numLightProbes=C,n.version=gm++)}function c(l,u){let p=0,h=0,g=0,x=0,y=0,m=u.matrixWorldInverse;for(let d=0,T=l.length;d<T;d++){let w=l[d];if(w.isDirectionalLight){let M=n.directional[p];M.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(m),p++}else if(w.isSpotLight){let M=n.spot[g];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),M.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(m),g++}else if(w.isRectAreaLight){let M=n.rectArea[x];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),a.identity(),r.copy(w.matrixWorld),r.premultiply(m),a.extractRotation(r),M.halfWidth.set(w.width*.5,0,0),M.halfHeight.set(0,w.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),x++}else if(w.isPointLight){let M=n.point[h];M.position.setFromMatrixPosition(w.matrixWorld),M.position.applyMatrix4(m),h++}else if(w.isHemisphereLight){let M=n.hemi[y];M.direction.setFromMatrixPosition(w.matrixWorld),M.direction.transformDirection(m),y++}}}return{setup:o,setupView:c,state:n}}function nh(i){let t=new xm(i),e=[],n=[],s=[];function r(h){p.camera=h,e.length=0,n.length=0,s.length=0}function a(h){e.push(h)}function o(h){n.push(h)}function c(h){s.push(h)}function l(){t.setup(e)}function u(h){t.setupView(e,h)}let p={lightsArray:e,shadowsArray:n,lightProbeGridArray:s,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:p,setupLights:l,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:c}}function vm(i){let t=new WeakMap;function e(s,r=0){let a=t.get(s),o;return a===void 0?(o=new nh(i),t.set(s,[o])):r>=a.length?(o=new nh(i),a.push(o)):o=a[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}var ym=`void main() {
4058	gl_Position = vec4( position, 1.0 );
4059}`,Mm=`uniform sampler2D shadow_pass;
4060uniform vec2 resolution;
4061uniform float radius;
4062void main() {
4063	const float samples = float( VSM_SAMPLES );
4064	float mean = 0.0;
4065	float squared_mean = 0.0;
4066	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4067	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4068	for ( float i = 0.0; i < samples; i ++ ) {
4069		float uvOffset = uvStart + i * uvStride;
4070		#ifdef HORIZONTAL_PASS
4071			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4072			mean += distribution.x;
4073			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4074		#else
4075			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4076			mean += depth;
4077			squared_mean += depth * depth;
4078		#endif
4079	}
4080	mean = mean / samples;
4081	squared_mean = squared_mean / samples;
4082	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4083	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4084}`,Sm=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],bm=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],ih=new de,or=new F,yl=new F;function Em(i,t,e){let n=new ks,s=new jt,r=new jt,a=new Ee,o=new ta,c=new ea,l={},u=e.maxTextureSize,p={[Jn]:Ye,[Ye]:Jn,[mn]:mn},h=new ln({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new jt},radius:{value:4}},vertexShader:ym,fragmentShader:Mm}),g=h.clone();g.defines.HORIZONTAL_PASS=1;let x=new An;x.setAttribute("position",new Qe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new We(x,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Js;let d=this.type;this.render=function(b,C,_){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||b.length===0)return;this.type===jl&&(Dt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Js);let E=i.getRenderTarget(),D=i.getActiveCubeFace(),I=i.getActiveMipmapLevel(),O=i.state;O.setBlending(zn),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);let q=d!==this.type;q&&C.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(z=>z.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,z=b.length;Y<z;Y++){let X=b[Y],G=X.shadow;if(G===void 0){Dt("WebGLShadowMap:",X,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;s.copy(G.mapSize);let K=G.getFrameExtents();s.multiply(K),r.copy(G.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/K.x),s.x=r.x*K.x,G.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/K.y),s.y=r.y*K.y,G.mapSize.y=r.y));let tt=i.state.buffers.depth.getReversed();if(G.camera._reversedDepth=tt,G.map===null||q===!0){if(G.map!==null&&(G.map.depthTexture!==null&&(G.map.depthTexture.dispose(),G.map.depthTexture=null),G.map.dispose()),this.type===cs){if(X.isPointLight){Dt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}G.map=new an(s.x,s.y,{format:Mi,type:_n,minFilter:Oe,magFilter:Oe,generateMipmaps:!1}),G.map.texture.name=X.name+".shadowMap",G.map.depthTexture=new Kn(s.x,s.y,gn),G.map.depthTexture.name=X.name+".shadowMapDepth",G.map.depthTexture.format=Un,G.map.depthTexture.compareFunction=null,G.map.depthTexture.minFilter=Fe,G.map.depthTexture.magFilter=Fe}else X.isPointLight?(G.map=new ps(s.x),G.map.depthTexture=new Kr(s.x,Cn)):(G.map=new an(s.x,s.y),G.map.depthTexture=new Kn(s.x,s.y,Cn)),G.map.depthTexture.name=X.name+".shadowMap",G.map.depthTexture.format=Un,this.type===Js?(G.map.depthTexture.compareFunction=tt?no:eo,G.map.depthTexture.minFilter=Oe,G.map.depthTexture.magFilter=Oe):(G.map.depthTexture.compareFunction=null,G.map.depthTexture.minFilter=Fe,G.map.depthTexture.magFilter=Fe);G.camera.updateProjectionMatrix()}let ft=G.map.isWebGLCubeRenderTarget?6:1;for(let xt=0;xt<ft;xt++){if(G.map.isWebGLCubeRenderTarget)i.setRenderTarget(G.map,xt),i.clear();else{xt===0&&(i.setRenderTarget(G.map),i.clear());let Mt=G.getViewport(xt);a.set(r.x*Mt.x,r.y*Mt.y,r.x*Mt.z,r.y*Mt.w),O.viewport(a)}if(X.isPointLight){let Mt=G.camera,te=G.matrix,Qt=X.distance||Mt.far;Qt!==Mt.far&&(Mt.far=Qt,Mt.updateProjectionMatrix()),or.setFromMatrixPosition(X.matrixWorld),Mt.position.copy(or),yl.copy(Mt.position),yl.add(Sm[xt]),Mt.up.copy(bm[xt]),Mt.lookAt(yl),Mt.updateMatrixWorld(),te.makeTranslation(-or.x,-or.y,-or.z),ih.multiplyMatrices(Mt.projectionMatrix,Mt.matrixWorldInverse),G._frustum.setFromProjectionMatrix(ih,Mt.coordinateSystem,Mt.reversedDepth)}else G.updateMatrices(X);n=G.getFrustum(),M(C,_,G.camera,X,this.type)}G.isPointLightShadow!==!0&&this.type===cs&&T(G,_),G.needsUpdate=!1}d=this.type,m.needsUpdate=!1,i.setRenderTarget(E,D,I)};function T(b,C){let _=t.update(y);h.defines.VSM_SAMPLES!==b.blurSamples&&(h.defines.VSM_SAMPLES=b.blurSamples,g.defines.VSM_SAMPLES=b.blurSamples,h.needsUpdate=!0,g.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new an(s.x,s.y,{format:Mi,type:_n})),h.uniforms.shadow_pass.value=b.map.depthTexture,h.uniforms.resolution.value=b.mapSize,h.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(C,null,_,h,y,null),g.uniforms.shadow_pass.value=b.mapPass.texture,g.uniforms.resolution.value=b.mapSize,g.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(C,null,_,g,y,null)}function w(b,C,_,E){let D=null,I=_.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(I!==void 0)D=I;else if(D=_.isPointLight===!0?c:o,i.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){let O=D.uuid,q=C.uuid,Y=l[O];Y===void 0&&(Y={},l[O]=Y);let z=Y[q];z===void 0&&(z=D.clone(),Y[q]=z,C.addEventListener("dispose",A)),D=z}if(D.visible=C.visible,D.wireframe=C.wireframe,E===cs?D.side=C.shadowSide!==null?C.shadowSide:C.side:D.side=C.shadowSide!==null?C.shadowSide:p[C.side],D.alphaMap=C.alphaMap,D.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,D.map=C.map,D.clipShadows=C.clipShadows,D.clippingPlanes=C.clippingPlanes,D.clipIntersection=C.clipIntersection,D.displacementMap=C.displacementMap,D.displacementScale=C.displacementScale,D.displacementBias=C.displacementBias,D.wireframeLinewidth=C.wireframeLinewidth,D.linewidth=C.linewidth,_.isPointLight===!0&&D.isMeshDistanceMaterial===!0){let O=i.properties.get(D);O.light=_}return D}function M(b,C,_,E,D){if(b.visible===!1)return;if(b.layers.test(C.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&D===cs)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(_.matrixWorldInverse,b.matrixWorld);let q=t.update(b),Y=b.material;if(Array.isArray(Y)){let z=q.groups;for(let X=0,G=z.length;X<G;X++){let K=z[X],tt=Y[K.materialIndex];if(tt&&tt.visible){let ft=w(b,tt,E,D);b.onBeforeShadow(i,b,C,_,q,ft,K),i.renderBufferDirect(_,null,q,ft,b,K),b.onAfterShadow(i,b,C,_,q,ft,K)}}}else if(Y.visible){let z=w(b,Y,E,D);b.onBeforeShadow(i,b,C,_,q,z,null),i.renderBufferDirect(_,null,q,z,b,null),b.onAfterShadow(i,b,C,_,q,z,null)}}let O=b.children;for(let q=0,Y=O.length;q<Y;q++)M(O[q],C,_,E,D)}function A(b){b.target.removeEventListener("dispose",A);for(let _ in l){let E=l[_],D=b.target.uuid;D in E&&(E[D].dispose(),delete E[D])}}}function Tm(i,t){function e(){let R=!1,lt=new Ee,J=null,ct=new Ee(0,0,0,0);return{setMask:function(ut){J!==ut&&!R&&(i.colorMask(ut,ut,ut,ut),J=ut)},setLocked:function(ut){R=ut},setClear:function(ut,Q,Et,bt,Me){Me===!0&&(ut*=bt,Q*=bt,Et*=bt),lt.set(ut,Q,Et,bt),ct.equals(lt)===!1&&(i.clearColor(ut,Q,Et,bt),ct.copy(lt))},reset:function(){R=!1,J=null,ct.set(-1,0,0,0)}}}function n(){let R=!1,lt=!1,J=null,ct=null,ut=null;return{setReversed:function(Q){if(lt!==Q){let Et=t.get("EXT_clip_control");Q?Et.clipControlEXT(Et.LOWER_LEFT_EXT,Et.ZERO_TO_ONE_EXT):Et.clipControlEXT(Et.LOWER_LEFT_EXT,Et.NEGATIVE_ONE_TO_ONE_EXT),lt=Q;let bt=ut;ut=null,this.setClear(bt)}},getReversed:function(){return lt},setTest:function(Q){Q?et(i.DEPTH_TEST):Nt(i.DEPTH_TEST)},setMask:function(Q){J!==Q&&!R&&(i.depthMask(Q),J=Q)},setFunc:function(Q){if(lt&&(Q=Lc[Q]),ct!==Q){switch(Q){case Fr:i.depthFunc(i.NEVER);break;case Or:i.depthFunc(i.ALWAYS);break;case Br:i.depthFunc(i.LESS);break;case Fi:i.depthFunc(i.LEQUAL);break;case zr:i.depthFunc(i.EQUAL);break;case Vr:i.depthFunc(i.GEQUAL);break;case kr:i.depthFunc(i.GREATER);break;case Gr:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}ct=Q}},setLocked:function(Q){R=Q},setClear:function(Q){ut!==Q&&(ut=Q,lt&&(Q=1-Q),i.clearDepth(Q))},reset:function(){R=!1,J=null,ct=null,ut=null,lt=!1}}}function s(){let R=!1,lt=null,J=null,ct=null,ut=null,Q=null,Et=null,bt=null,Me=null;return{setTest:function(se){R||(se?et(i.STENCIL_TEST):Nt(i.STENCIL_TEST))},setMask:function(se){lt!==se&&!R&&(i.stencilMask(se),lt=se)},setFunc:function(se,un,ze){(J!==se||ct!==un||ut!==ze)&&(i.stencilFunc(se,un,ze),J=se,ct=un,ut=ze)},setOp:function(se,un,ze){(Q!==se||Et!==un||bt!==ze)&&(i.stencilOp(se,un,ze),Q=se,Et=un,bt=ze)},setLocked:function(se){R=se},setClear:function(se){Me!==se&&(i.clearStencil(se),Me=se)},reset:function(){R=!1,lt=null,J=null,ct=null,ut=null,Q=null,Et=null,bt=null,Me=null}}}let r=new e,a=new n,o=new s,c=new WeakMap,l=new WeakMap,u={},p={},h={},g=new WeakMap,x=[],y=null,m=!1,d=null,T=null,w=null,M=null,A=null,b=null,C=null,_=new Xt(0,0,0),E=0,D=!1,I=null,O=null,q=null,Y=null,z=null,X=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),G=!1,K=0,tt=i.getParameter(i.VERSION);tt.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(tt)[1]),G=K>=1):tt.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(tt)[1]),G=K>=2);let ft=null,xt={},Mt=i.getParameter(i.SCISSOR_BOX),te=i.getParameter(i.VIEWPORT),Qt=new Ee().fromArray(Mt),Ft=new Ee().fromArray(te);function Z(R,lt,J,ct){let ut=new Uint8Array(4),Q=i.createTexture();i.bindTexture(R,Q),i.texParameteri(R,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(R,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Et=0;Et<J;Et++)R===i.TEXTURE_3D||R===i.TEXTURE_2D_ARRAY?i.texImage3D(lt,0,i.RGBA,1,1,ct,0,i.RGBA,i.UNSIGNED_BYTE,ut):i.texImage2D(lt+Et,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,ut);return Q}let st={};st[i.TEXTURE_2D]=Z(i.TEXTURE_2D,i.TEXTURE_2D,1),st[i.TEXTURE_CUBE_MAP]=Z(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),st[i.TEXTURE_2D_ARRAY]=Z(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),st[i.TEXTURE_3D]=Z(i.TEXTURE_3D,i.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),et(i.DEPTH_TEST),a.setFunc(Fi),fe(!1),Ae(Xo),et(i.CULL_FACE),ee(zn);function et(R){u[R]!==!0&&(i.enable(R),u[R]=!0)}function Nt(R){u[R]!==!1&&(i.disable(R),u[R]=!1)}function Ot(R,lt){return h[R]!==lt?(i.bindFramebuffer(R,lt),h[R]=lt,R===i.DRAW_FRAMEBUFFER&&(h[i.FRAMEBUFFER]=lt),R===i.FRAMEBUFFER&&(h[i.DRAW_FRAMEBUFFER]=lt),!0):!1}function Lt(R,lt){let J=x,ct=!1;if(R){J=g.get(lt),J===void 0&&(J=[],g.set(lt,J));let ut=R.textures;if(J.length!==ut.length||J[0]!==i.COLOR_ATTACHMENT0){for(let Q=0,Et=ut.length;Q<Et;Q++)J[Q]=i.COLOR_ATTACHMENT0+Q;J.length=ut.length,ct=!0}}else J[0]!==i.BACK&&(J[0]=i.BACK,ct=!0);ct&&i.drawBuffers(J)}function pe(R){return y!==R?(i.useProgram(R),y=R,!0):!1}let Ht={[ui]:i.FUNC_ADD,[ec]:i.FUNC_SUBTRACT,[nc]:i.FUNC_REVERSE_SUBTRACT};Ht[ic]=i.MIN,Ht[sc]=i.MAX;let le={[rc]:i.ZERO,[ac]:i.ONE,[oc]:i.SRC_COLOR,[Nr]:i.SRC_ALPHA,[fc]:i.SRC_ALPHA_SATURATE,[uc]:i.DST_COLOR,[cc]:i.DST_ALPHA,[lc]:i.ONE_MINUS_SRC_COLOR,[Ur]:i.ONE_MINUS_SRC_ALPHA,[dc]:i.ONE_MINUS_DST_COLOR,[hc]:i.ONE_MINUS_DST_ALPHA,[pc]:i.CONSTANT_COLOR,[mc]:i.ONE_MINUS_CONSTANT_COLOR,[gc]:i.CONSTANT_ALPHA,[_c]:i.ONE_MINUS_CONSTANT_ALPHA};function ee(R,lt,J,ct,ut,Q,Et,bt,Me,se){if(R===zn){m===!0&&(Nt(i.BLEND),m=!1);return}if(m===!1&&(et(i.BLEND),m=!0),R!==tc){if(R!==d||se!==D){if((T!==ui||A!==ui)&&(i.blendEquation(i.FUNC_ADD),T=ui,A=ui),se)switch(R){case Ui:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case qo:i.blendFunc(i.ONE,i.ONE);break;case Yo:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Zo:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ut("WebGLState: Invalid blending: ",R);break}else switch(R){case Ui:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case qo:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Yo:Ut("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Zo:Ut("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ut("WebGLState: Invalid blending: ",R);break}w=null,M=null,b=null,C=null,_.set(0,0,0),E=0,d=R,D=se}return}ut=ut||lt,Q=Q||J,Et=Et||ct,(lt!==T||ut!==A)&&(i.blendEquationSeparate(Ht[lt],Ht[ut]),T=lt,A=ut),(J!==w||ct!==M||Q!==b||Et!==C)&&(i.blendFuncSeparate(le[J],le[ct],le[Q],le[Et]),w=J,M=ct,b=Q,C=Et),(bt.equals(_)===!1||Me!==E)&&(i.blendColor(bt.r,bt.g,bt.b,Me),_.copy(bt),E=Me),d=R,D=!1}function Jt(R,lt){R.side===mn?Nt(i.CULL_FACE):et(i.CULL_FACE);let J=R.side===Ye;lt&&(J=!J),fe(J),R.blending===Ui&&R.transparent===!1?ee(zn):ee(R.blending,R.blendEquation,R.blendSrc,R.blendDst,R.blendEquationAlpha,R.blendSrcAlpha,R.blendDstAlpha,R.blendColor,R.blendAlpha,R.premultipliedAlpha),a.setFunc(R.depthFunc),a.setTest(R.depthTest),a.setMask(R.depthWrite),r.setMask(R.colorWrite);let ct=R.stencilWrite;o.setTest(ct),ct&&(o.setMask(R.stencilWriteMask),o.setFunc(R.stencilFunc,R.stencilRef,R.stencilFuncMask),o.setOp(R.stencilFail,R.stencilZFail,R.stencilZPass)),Pe(R.polygonOffset,R.polygonOffsetFactor,R.polygonOffsetUnits),R.alphaToCoverage===!0?et(i.SAMPLE_ALPHA_TO_COVERAGE):Nt(i.SAMPLE_ALPHA_TO_COVERAGE)}function fe(R){I!==R&&(R?i.frontFace(i.CW):i.frontFace(i.CCW),I=R)}function Ae(R){R!==Kl?(et(i.CULL_FACE),R!==O&&(R===Xo?i.cullFace(i.BACK):R===Ql?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Nt(i.CULL_FACE),O=R}function we(R){R!==q&&(G&&i.lineWidth(R),q=R)}function Pe(R,lt,J){R?(et(i.POLYGON_OFFSET_FILL),(Y!==lt||z!==J)&&(Y=lt,z=J,a.getReversed()&&(lt=-lt),i.polygonOffset(lt,J))):Nt(i.POLYGON_OFFSET_FILL)}function ye(R){R?et(i.SCISSOR_TEST):Nt(i.SCISSOR_TEST)}function Te(R){R===void 0&&(R=i.TEXTURE0+X-1),ft!==R&&(i.activeTexture(R),ft=R)}function P(R,lt,J){J===void 0&&(ft===null?J=i.TEXTURE0+X-1:J=ft);let ct=xt[J];ct===void 0&&(ct={type:void 0,texture:void 0},xt[J]=ct),(ct.type!==R||ct.texture!==lt)&&(ft!==J&&(i.activeTexture(J),ft=J),i.bindTexture(R,lt||st[R]),ct.type=R,ct.texture=lt)}function Be(){let R=xt[ft];R!==void 0&&R.type!==void 0&&(i.bindTexture(R.type,null),R.type=void 0,R.texture=void 0)}function ie(){try{i.compressedTexImage2D(...arguments)}catch(R){Ut("WebGLState:",R)}}function S(){try{i.compressedTexImage3D(...arguments)}catch(R){Ut("WebGLState:",R)}}function f(){try{i.texSubImage2D(...arguments)}catch(R){Ut("WebGLState:",R)}}function N(){try{i.texSubImage3D(...arguments)}catch(R){Ut("WebGLState:",R)}}function V(){try{i.compressedTexSubImage2D(...arguments)}catch(R){Ut("WebGLState:",R)}}function H(){try{i.compressedTexSubImage3D(...arguments)}catch(R){Ut("WebGLState:",R)}}function nt(){try{i.texStorage2D(...arguments)}catch(R){Ut("WebGLState:",R)}}function at(){try{i.texStorage3D(...arguments)}catch(R){Ut("WebGLState:",R)}}function W(){try{i.texImage2D(...arguments)}catch(R){Ut("WebGLState:",R)}}function $(){try{i.texImage3D(...arguments)}catch(R){Ut("WebGLState:",R)}}function ot(R){return p[R]!==void 0?p[R]:i.getParameter(R)}function At(R,lt){p[R]!==lt&&(i.pixelStorei(R,lt),p[R]=lt)}function pt(R){Qt.equals(R)===!1&&(i.scissor(R.x,R.y,R.z,R.w),Qt.copy(R))}function it(R){Ft.equals(R)===!1&&(i.viewport(R.x,R.y,R.z,R.w),Ft.copy(R))}function Rt(R,lt){let J=l.get(lt);J===void 0&&(J=new WeakMap,l.set(lt,J));let ct=J.get(R);ct===void 0&&(ct=i.getUniformBlockIndex(lt,R.name),J.set(R,ct))}function Pt(R,lt){let ct=l.get(lt).get(R);c.get(lt)!==ct&&(i.uniformBlockBinding(lt,ct,R.__bindingPointIndex),c.set(lt,ct))}function Gt(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),a.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},p={},ft=null,xt={},h={},g=new WeakMap,x=[],y=null,m=!1,d=null,T=null,w=null,M=null,A=null,b=null,C=null,_=new Xt(0,0,0),E=0,D=!1,I=null,O=null,q=null,Y=null,z=null,Qt.set(0,0,i.canvas.width,i.canvas.height),Ft.set(0,0,i.canvas.width,i.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:et,disable:Nt,bindFramebuffer:Ot,drawBuffers:Lt,useProgram:pe,setBlending:ee,setMaterial:Jt,setFlipSided:fe,setCullFace:Ae,setLineWidth:we,setPolygonOffset:Pe,setScissorTest:ye,activeTexture:Te,bindTexture:P,unbindTexture:Be,compressedTexImage2D:ie,compressedTexImage3D:S,texImage2D:W,texImage3D:$,pixelStorei:At,getParameter:ot,updateUBOMapping:Rt,uniformBlockBinding:Pt,texStorage2D:nt,texStorage3D:at,texSubImage2D:f,texSubImage3D:N,compressedTexSubImage2D:V,compressedTexSubImage3D:H,scissor:pt,viewport:it,reset:Gt}}function Am(i,t,e,n,s,r,a){let o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new jt,u=new WeakMap,p=new Set,h,g=new WeakMap,x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(S,f){return x?new OffscreenCanvas(S,f):Ds("canvas")}function m(S,f,N){let V=1,H=ie(S);if((H.width>N||H.height>N)&&(V=N/Math.max(H.width,H.height)),V<1)if(typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&S instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&S instanceof ImageBitmap||typeof VideoFrame<"u"&&S instanceof VideoFrame){let nt=Math.floor(V*H.width),at=Math.floor(V*H.height);h===void 0&&(h=y(nt,at));let W=f?y(nt,at):h;return W.width=nt,W.height=at,W.getContext("2d").drawImage(S,0,0,nt,at),Dt("WebGLRenderer: Texture has been resized from ("+H.width+"x"+H.height+") to ("+nt+"x"+at+")."),W}else return"data"in S&&Dt("WebGLRenderer: Image in DataTexture is too big ("+H.width+"x"+H.height+")."),S;return S}function d(S){return S.generateMipmaps}function T(S){i.generateMipmap(S)}function w(S){return S.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?i.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function M(S,f,N,V,H,nt=!1){if(S!==null){if(i[S]!==void 0)return i[S];Dt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let at;V&&(at=t.get("EXT_texture_norm16"),at||Dt("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let W=f;if(f===i.RED&&(N===i.FLOAT&&(W=i.R32F),N===i.HALF_FLOAT&&(W=i.R16F),N===i.UNSIGNED_BYTE&&(W=i.R8),N===i.UNSIGNED_SHORT&&at&&(W=at.R16_EXT),N===i.SHORT&&at&&(W=at.R16_SNORM_EXT)),f===i.RED_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.R8UI),N===i.UNSIGNED_SHORT&&(W=i.R16UI),N===i.UNSIGNED_INT&&(W=i.R32UI),N===i.BYTE&&(W=i.R8I),N===i.SHORT&&(W=i.R16I),N===i.INT&&(W=i.R32I)),f===i.RG&&(N===i.FLOAT&&(W=i.RG32F),N===i.HALF_FLOAT&&(W=i.RG16F),N===i.UNSIGNED_BYTE&&(W=i.RG8),N===i.UNSIGNED_SHORT&&at&&(W=at.RG16_EXT),N===i.SHORT&&at&&(W=at.RG16_SNORM_EXT)),f===i.RG_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.RG8UI),N===i.UNSIGNED_SHORT&&(W=i.RG16UI),N===i.UNSIGNED_INT&&(W=i.RG32UI),N===i.BYTE&&(W=i.RG8I),N===i.SHORT&&(W=i.RG16I),N===i.INT&&(W=i.RG32I)),f===i.RGB_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.RGB8UI),N===i.UNSIGNED_SHORT&&(W=i.RGB16UI),N===i.UNSIGNED_INT&&(W=i.RGB32UI),N===i.BYTE&&(W=i.RGB8I),N===i.SHORT&&(W=i.RGB16I),N===i.INT&&(W=i.RGB32I)),f===i.RGBA_INTEGER&&(N===i.UNSIGNED_BYTE&&(W=i.RGBA8UI),N===i.UNSIGNED_SHORT&&(W=i.RGBA16UI),N===i.UNSIGNED_INT&&(W=i.RGBA32UI),N===i.BYTE&&(W=i.RGBA8I),N===i.SHORT&&(W=i.RGBA16I),N===i.INT&&(W=i.RGBA32I)),f===i.RGB&&(N===i.UNSIGNED_SHORT&&at&&(W=at.RGB16_EXT),N===i.SHORT&&at&&(W=at.RGB16_SNORM_EXT),N===i.UNSIGNED_INT_5_9_9_9_REV&&(W=i.RGB9_E5),N===i.UNSIGNED_INT_10F_11F_11F_REV&&(W=i.R11F_G11F_B10F)),f===i.RGBA){let $=nt?Ps:$t.getTransfer(H);N===i.FLOAT&&(W=i.RGBA32F),N===i.HALF_FLOAT&&(W=i.RGBA16F),N===i.UNSIGNED_BYTE&&(W=$===oe?i.SRGB8_ALPHA8:i.RGBA8),N===i.UNSIGNED_SHORT&&at&&(W=at.RGBA16_EXT),N===i.SHORT&&at&&(W=at.RGBA16_SNORM_EXT),N===i.UNSIGNED_SHORT_4_4_4_4&&(W=i.RGBA4),N===i.UNSIGNED_SHORT_5_5_5_1&&(W=i.RGB5_A1)}return(W===i.R16F||W===i.R32F||W===i.RG16F||W===i.RG32F||W===i.RGBA16F||W===i.RGBA32F)&&t.get("EXT_color_buffer_float"),W}function A(S,f){let N;return S?f===null||f===Cn||f===us?N=i.DEPTH24_STENCIL8:f===gn?N=i.DEPTH32F_STENCIL8:f===hs&&(N=i.DEPTH24_STENCIL8,Dt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):f===null||f===Cn||f===us?N=i.DEPTH_COMPONENT24:f===gn?N=i.DEPTH_COMPONENT32F:f===hs&&(N=i.DEPTH_COMPONENT16),N}function b(S,f){return d(S)===!0||S.isFramebufferTexture&&S.minFilter!==Fe&&S.minFilter!==Oe?Math.log2(Math.max(f.width,f.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?f.mipmaps.length:1}function C(S){let f=S.target;f.removeEventListener("dispose",C),E(f),f.isVideoTexture&&u.delete(f),f.isHTMLTexture&&p.delete(f)}function _(S){let f=S.target;f.removeEventListener("dispose",_),I(f)}function E(S){let f=n.get(S);if(f.__webglInit===void 0)return;let N=S.source,V=g.get(N);if(V){let H=V[f.__cacheKey];H.usedTimes--,H.usedTimes===0&&D(S),Object.keys(V).length===0&&g.delete(N)}n.remove(S)}function D(S){let f=n.get(S);i.deleteTexture(f.__webglTexture);let N=S.source,V=g.get(N);delete V[f.__cacheKey],a.memory.textures--}function I(S){let f=n.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),n.remove(S.depthTexture)),S.isWebGLCubeRenderTarget)for(let V=0;V<6;V++){if(Array.isArray(f.__webglFramebuffer[V]))for(let H=0;H<f.__webglFramebuffer[V].length;H++)i.deleteFramebuffer(f.__webglFramebuffer[V][H]);else i.deleteFramebuffer(f.__webglFramebuffer[V]);f.__webglDepthbuffer&&i.deleteRenderbuffer(f.__webglDepthbuffer[V])}else{if(Array.isArray(f.__webglFramebuffer))for(let V=0;V<f.__webglFramebuffer.length;V++)i.deleteFramebuffer(f.__webglFramebuffer[V]);else i.deleteFramebuffer(f.__webglFramebuffer);if(f.__webglDepthbuffer&&i.deleteRenderbuffer(f.__webglDepthbuffer),f.__webglMultisampledFramebuffer&&i.deleteFramebuffer(f.__webglMultisampledFramebuffer),f.__webglColorRenderbuffer)for(let V=0;V<f.__webglColorRenderbuffer.length;V++)f.__webglColorRenderbuffer[V]&&i.deleteRenderbuffer(f.__webglColorRenderbuffer[V]);f.__webglDepthRenderbuffer&&i.deleteRenderbuffer(f.__webglDepthRenderbuffer)}let N=S.textures;for(let V=0,H=N.length;V<H;V++){let nt=n.get(N[V]);nt.__webglTexture&&(i.deleteTexture(nt.__webglTexture),a.memory.textures--),n.remove(N[V])}n.remove(S)}let O=0;function q(){O=0}function Y(){return O}function z(S){O=S}function X(){let S=O;return S>=s.maxTextures&&Dt("WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+s.maxTextures),O+=1,S}function G(S){let f=[];return f.push(S.wrapS),f.push(S.wrapT),f.push(S.wrapR||0),f.push(S.magFilter),f.push(S.minFilter),f.push(S.anisotropy),f.push(S.internalFormat),f.push(S.format),f.push(S.type),f.push(S.generateMipmaps),f.push(S.premultiplyAlpha),f.push(S.flipY),f.push(S.unpackAlignment),f.push(S.colorSpace),f.join()}function K(S,f){let N=n.get(S);if(S.isVideoTexture&&P(S),S.isRenderTargetTexture===!1&&S.isExternalTexture!==!0&&S.version>0&&N.__version!==S.version){let V=S.image;if(V===null)Dt("WebGLRenderer: Texture marked for update but no image data found.");else if(V.complete===!1)Dt("WebGLRenderer: Texture marked for update but image is incomplete");else{Nt(N,S,f);return}}else S.isExternalTexture&&(N.__webglTexture=S.sourceTexture?S.sourceTexture:null);e.bindTexture(i.TEXTURE_2D,N.__webglTexture,i.TEXTURE0+f)}function tt(S,f){let N=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&N.__version!==S.version){Nt(N,S,f);return}else S.isExternalTexture&&(N.__webglTexture=S.sourceTexture?S.sourceTexture:null);e.bindTexture(i.TEXTURE_2D_ARRAY,N.__webglTexture,i.TEXTURE0+f)}function ft(S,f){let N=n.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&N.__version!==S.version){Nt(N,S,f);return}e.bindTexture(i.TEXTURE_3D,N.__webglTexture,i.TEXTURE0+f)}function xt(S,f){let N=n.get(S);if(S.isCubeDepthTexture!==!0&&S.version>0&&N.__version!==S.version){Ot(N,S,f);return}e.bindTexture(i.TEXTURE_CUBE_MAP,N.__webglTexture,i.TEXTURE0+f)}let Mt={[Hr]:i.REPEAT,[Nn]:i.CLAMP_TO_EDGE,[Wr]:i.MIRRORED_REPEAT},te={[Fe]:i.NEAREST,[yc]:i.NEAREST_MIPMAP_NEAREST,[Qs]:i.NEAREST_MIPMAP_LINEAR,[Oe]:i.LINEAR,[ga]:i.LINEAR_MIPMAP_NEAREST,[vi]:i.LINEAR_MIPMAP_LINEAR},Qt={[bc]:i.NEVER,[Cc]:i.ALWAYS,[Ec]:i.LESS,[eo]:i.LEQUAL,[Tc]:i.EQUAL,[no]:i.GEQUAL,[Ac]:i.GREATER,[wc]:i.NOTEQUAL};function Ft(S,f){if(f.type===gn&&t.has("OES_texture_float_linear")===!1&&(f.magFilter===Oe||f.magFilter===ga||f.magFilter===Qs||f.magFilter===vi||f.minFilter===Oe||f.minFilter===ga||f.minFilter===Qs||f.minFilter===vi)&&Dt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(S,i.TEXTURE_WRAP_S,Mt[f.wrapS]),i.texParameteri(S,i.TEXTURE_WRAP_T,Mt[f.wrapT]),(S===i.TEXTURE_3D||S===i.TEXTURE_2D_ARRAY)&&i.texParameteri(S,i.TEXTURE_WRAP_R,Mt[f.wrapR]),i.texParameteri(S,i.TEXTURE_MAG_FILTER,te[f.magFilter]),i.texParameteri(S,i.TEXTURE_MIN_FILTER,te[f.minFilter]),f.compareFunction&&(i.texParameteri(S,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(S,i.TEXTURE_COMPARE_FUNC,Qt[f.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(f.magFilter===Fe||f.minFilter!==Qs&&f.minFilter!==vi||f.type===gn&&t.has("OES_texture_float_linear")===!1)return;if(f.anisotropy>1||n.get(f).__currentAnisotropy){let N=t.get("EXT_texture_filter_anisotropic");i.texParameterf(S,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(f.anisotropy,s.getMaxAnisotropy())),n.get(f).__currentAnisotropy=f.anisotropy}}}function Z(S,f){let N=!1;S.__webglInit===void 0&&(S.__webglInit=!0,f.addEventListener("dispose",C));let V=f.source,H=g.get(V);H===void 0&&(H={},g.set(V,H));let nt=G(f);if(nt!==S.__cacheKey){H[nt]===void 0&&(H[nt]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,N=!0),H[nt].usedTimes++;let at=H[S.__cacheKey];at!==void 0&&(H[S.__cacheKey].usedTimes--,at.usedTimes===0&&D(f)),S.__cacheKey=nt,S.__webglTexture=H[nt].texture}return N}function st(S,f,N){return Math.floor(Math.floor(S/N)/f)}function et(S,f,N,V){let nt=S.updateRanges;if(nt.length===0)e.texSubImage2D(i.TEXTURE_2D,0,0,0,f.width,f.height,N,V,f.data);else{nt.sort((At,pt)=>At.start-pt.start);let at=0;for(let At=1;At<nt.length;At++){let pt=nt[at],it=nt[At],Rt=pt.start+pt.count,Pt=st(it.start,f.width,4),Gt=st(pt.start,f.width,4);it.start<=Rt+1&&Pt===Gt&&st(it.start+it.count-1,f.width,4)===Pt?pt.count=Math.max(pt.count,it.start+it.count-pt.start):(++at,nt[at]=it)}nt.length=at+1;let W=e.getParameter(i.UNPACK_ROW_LENGTH),$=e.getParameter(i.UNPACK_SKIP_PIXELS),ot=e.getParameter(i.UNPACK_SKIP_ROWS);e.pixelStorei(i.UNPACK_ROW_LENGTH,f.width);for(let At=0,pt=nt.length;At<pt;At++){let it=nt[At],Rt=Math.floor(it.start/4),Pt=Math.ceil(it.count/4),Gt=Rt%f.width,R=Math.floor(Rt/f.width),lt=Pt,J=1;e.pixelStorei(i.UNPACK_SKIP_PIXELS,Gt),e.pixelStorei(i.UNPACK_SKIP_ROWS,R),e.texSubImage2D(i.TEXTURE_2D,0,Gt,R,lt,J,N,V,f.data)}S.clearUpdateRanges(),e.pixelStorei(i.UNPACK_ROW_LENGTH,W),e.pixelStorei(i.UNPACK_SKIP_PIXELS,$),e.pixelStorei(i.UNPACK_SKIP_ROWS,ot)}}function Nt(S,f,N){let V=i.TEXTURE_2D;(f.isDataArrayTexture||f.isCompressedArrayTexture)&&(V=i.TEXTURE_2D_ARRAY),f.isData3DTexture&&(V=i.TEXTURE_3D);let H=Z(S,f),nt=f.source;e.bindTexture(V,S.__webglTexture,i.TEXTURE0+N);let at=n.get(nt);if(nt.version!==at.__version||H===!0){if(e.activeTexture(i.TEXTURE0+N),(typeof ImageBitmap<"u"&&f.image instanceof ImageBitmap)===!1){let J=$t.getPrimaries($t.workingColorSpace),ct=f.colorSpace===Qn?null:$t.getPrimaries(f.colorSpace),ut=f.colorSpace===Qn||J===ct?i.NONE:i.BROWSER_DEFAULT_WEBGL;e.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f.flipY),e.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),e.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,ut)}e.pixelStorei(i.UNPACK_ALIGNMENT,f.unpackAlignment);let $=m(f.image,!1,s.maxTextureSize);$=Be(f,$);let ot=r.convert(f.format,f.colorSpace),At=r.convert(f.type),pt=M(f.internalFormat,ot,At,f.normalized,f.colorSpace,f.isVideoTexture);Ft(V,f);let it,Rt=f.mipmaps,Pt=f.isVideoTexture!==!0,Gt=at.__version===void 0||H===!0,R=nt.dataReady,lt=b(f,$);if(f.isDepthTexture)pt=A(f.format===yi,f.type),Gt&&(Pt?e.texStorage2D(i.TEXTURE_2D,1,pt,$.width,$.height):e.texImage2D(i.TEXTURE_2D,0,pt,$.width,$.height,0,ot,At,null));else if(f.isDataTexture)if(Rt.length>0){Pt&&Gt&&e.texStorage2D(i.TEXTURE_2D,lt,pt,Rt[0].width,Rt[0].height);for(let J=0,ct=Rt.length;J<ct;J++)it=Rt[J],Pt?R&&e.texSubImage2D(i.TEXTURE_2D,J,0,0,it.width,it.height,ot,At,it.data):e.texImage2D(i.TEXTURE_2D,J,pt,it.width,it.height,0,ot,At,it.data);f.generateMipmaps=!1}else Pt?(Gt&&e.texStorage2D(i.TEXTURE_2D,lt,pt,$.width,$.height),R&&et(f,$,ot,At)):e.texImage2D(i.TEXTURE_2D,0,pt,$.width,$.height,0,ot,At,$.data);else if(f.isCompressedTexture)if(f.isCompressedArrayTexture){Pt&&Gt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,lt,pt,Rt[0].width,Rt[0].height,$.depth);for(let J=0,ct=Rt.length;J<ct;J++)if(it=Rt[J],f.format!==xn)if(ot!==null)if(Pt){if(R)if(f.layerUpdates.size>0){let ut=pl(it.width,it.height,f.format,f.type);for(let Q of f.layerUpdates){let Et=it.data.subarray(Q*ut/it.data.BYTES_PER_ELEMENT,(Q+1)*ut/it.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,Q,it.width,it.height,1,ot,Et)}f.clearLayerUpdates()}else e.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,0,it.width,it.height,$.depth,ot,it.data)}else e.compressedTexImage3D(i.TEXTURE_2D_ARRAY,J,pt,it.width,it.height,$.depth,0,it.data,0,0);else Dt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Pt?R&&e.texSubImage3D(i.TEXTURE_2D_ARRAY,J,0,0,0,it.width,it.height,$.depth,ot,At,it.data):e.texImage3D(i.TEXTURE_2D_ARRAY,J,pt,it.width,it.height,$.depth,0,ot,At,it.data)}else{Pt&&Gt&&e.texStorage2D(i.TEXTURE_2D,lt,pt,Rt[0].width,Rt[0].height);for(let J=0,ct=Rt.length;J<ct;J++)it=Rt[J],f.format!==xn?ot!==null?Pt?R&&e.compressedTexSubImage2D(i.TEXTURE_2D,J,0,0,it.width,it.height,ot,it.data):e.compressedTexImage2D(i.TEXTURE_2D,J,pt,it.width,it.height,0,it.data):Dt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Pt?R&&e.texSubImage2D(i.TEXTURE_2D,J,0,0,it.width,it.height,ot,At,it.data):e.texImage2D(i.TEXTURE_2D,J,pt,it.width,it.height,0,ot,At,it.data)}else if(f.isDataArrayTexture)if(Pt){if(Gt&&e.texStorage3D(i.TEXTURE_2D_ARRAY,lt,pt,$.width,$.height,$.depth),R)if(f.layerUpdates.size>0){let J=pl($.width,$.height,f.format,f.type);for(let ct of f.layerUpdates){let ut=$.data.subarray(ct*J/$.data.BYTES_PER_ELEMENT,(ct+1)*J/$.data.BYTES_PER_ELEMENT);e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,ct,$.width,$.height,1,ot,At,ut)}f.clearLayerUpdates()}else e.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,$.width,$.height,$.depth,ot,At,$.data)}else e.texImage3D(i.TEXTURE_2D_ARRAY,0,pt,$.width,$.height,$.depth,0,ot,At,$.data);else if(f.isData3DTexture)Pt?(Gt&&e.texStorage3D(i.TEXTURE_3D,lt,pt,$.width,$.height,$.depth),R&&e.texSubImage3D(i.TEXTURE_3D,0,0,0,0,$.width,$.height,$.depth,ot,At,$.data)):e.texImage3D(i.TEXTURE_3D,0,pt,$.width,$.height,$.depth,0,ot,At,$.data);else if(f.isFramebufferTexture){if(Gt)if(Pt)e.texStorage2D(i.TEXTURE_2D,lt,pt,$.width,$.height);else{let J=$.width,ct=$.height;for(let ut=0;ut<lt;ut++)e.texImage2D(i.TEXTURE_2D,ut,pt,J,ct,0,ot,At,null),J>>=1,ct>>=1}}else if(f.isHTMLTexture){if("texElementImage2D"in i){let J=i.canvas;if(J.hasAttribute("layoutsubtree")||J.setAttribute("layoutsubtree","true"),$.parentNode!==J){J.appendChild($),p.add(f),J.onpaint=ct=>{let ut=ct.changedElements;for(let Q of p)ut.includes(Q.image)&&(Q.needsUpdate=!0)},J.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,$);else{let ut=i.RGBA,Q=i.RGBA,Et=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,ut,Q,Et,$)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Rt.length>0){if(Pt&&Gt){let J=ie(Rt[0]);e.texStorage2D(i.TEXTURE_2D,lt,pt,J.width,J.height)}for(let J=0,ct=Rt.length;J<ct;J++)it=Rt[J],Pt?R&&e.texSubImage2D(i.TEXTURE_2D,J,0,0,ot,At,it):e.texImage2D(i.TEXTURE_2D,J,pt,ot,At,it);f.generateMipmaps=!1}else if(Pt){if(Gt){let J=ie($);e.texStorage2D(i.TEXTURE_2D,lt,pt,J.width,J.height)}R&&e.texSubImage2D(i.TEXTURE_2D,0,0,0,ot,At,$)}else e.texImage2D(i.TEXTURE_2D,0,pt,ot,At,$);d(f)&&T(V),at.__version=nt.version,f.onUpdate&&f.onUpdate(f)}S.__version=f.version}function Ot(S,f,N){if(f.image.length!==6)return;let V=Z(S,f),H=f.source;e.bindTexture(i.TEXTURE_CUBE_MAP,S.__webglTexture,i.TEXTURE0+N);let nt=n.get(H);if(H.version!==nt.__version||V===!0){e.activeTexture(i.TEXTURE0+N);let at=$t.getPrimaries($t.workingColorSpace),W=f.colorSpace===Qn?null:$t.getPrimaries(f.colorSpace),$=f.colorSpace===Qn||at===W?i.NONE:i.BROWSER_DEFAULT_WEBGL;e.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,f.flipY),e.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),e.pixelStorei(i.UNPACK_ALIGNMENT,f.unpackAlignment),e.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,$);let ot=f.isCompressedTexture||f.image[0].isCompressedTexture,At=f.image[0]&&f.image[0].isDataTexture,pt=[];for(let Q=0;Q<6;Q++)!ot&&!At?pt[Q]=m(f.image[Q],!0,s.maxCubemapSize):pt[Q]=At?f.image[Q].image:f.image[Q],pt[Q]=Be(f,pt[Q]);let it=pt[0],Rt=r.convert(f.format,f.colorSpace),Pt=r.convert(f.type),Gt=M(f.internalFormat,Rt,Pt,f.normalized,f.colorSpace),R=f.isVideoTexture!==!0,lt=nt.__version===void 0||V===!0,J=H.dataReady,ct=b(f,it);Ft(i.TEXTURE_CUBE_MAP,f);let ut;if(ot){R&&lt&&e.texStorage2D(i.TEXTURE_CUBE_MAP,ct,Gt,it.width,it.height);for(let Q=0;Q<6;Q++){ut=pt[Q].mipmaps;for(let Et=0;Et<ut.length;Et++){let bt=ut[Et];f.format!==xn?Rt!==null?R?J&&e.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et,0,0,bt.width,bt.height,Rt,bt.data):e.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et,Gt,bt.width,bt.height,0,bt.data):Dt("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):R?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et,0,0,bt.width,bt.height,Rt,Pt,bt.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et,Gt,bt.width,bt.height,0,Rt,Pt,bt.data)}}}else{if(ut=f.mipmaps,R&&lt){ut.length>0&&ct++;let Q=ie(pt[0]);e.texStorage2D(i.TEXTURE_CUBE_MAP,ct,Gt,Q.width,Q.height)}for(let Q=0;Q<6;Q++)if(At){R?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,pt[Q].width,pt[Q].height,Rt,Pt,pt[Q].data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,Gt,pt[Q].width,pt[Q].height,0,Rt,Pt,pt[Q].data);for(let Et=0;Et<ut.length;Et++){let Me=ut[Et].image[Q].image;R?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et+1,0,0,Me.width,Me.height,Rt,Pt,Me.data):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et+1,Gt,Me.width,Me.height,0,Rt,Pt,Me.data)}}else{R?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,Rt,Pt,pt[Q]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,Gt,Rt,Pt,pt[Q]);for(let Et=0;Et<ut.length;Et++){let bt=ut[Et];R?J&&e.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et+1,0,0,Rt,Pt,bt.image[Q]):e.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Q,Et+1,Gt,Rt,Pt,bt.image[Q])}}}d(f)&&T(i.TEXTURE_CUBE_MAP),nt.__version=H.version,f.onUpdate&&f.onUpdate(f)}S.__version=f.version}function Lt(S,f,N,V,H,nt){let at=r.convert(N.format,N.colorSpace),W=r.convert(N.type),$=M(N.internalFormat,at,W,N.normalized,N.colorSpace),ot=n.get(f),At=n.get(N);if(At.__renderTarget=f,!ot.__hasExternalTextures){let pt=Math.max(1,f.width>>nt),it=Math.max(1,f.height>>nt);H===i.TEXTURE_3D||H===i.TEXTURE_2D_ARRAY?e.texImage3D(H,nt,$,pt,it,f.depth,0,at,W,null):e.texImage2D(H,nt,$,pt,it,0,at,W,null)}e.bindFramebuffer(i.FRAMEBUFFER,S),Te(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,V,H,At.__webglTexture,0,ye(f)):(H===i.TEXTURE_2D||H>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&H<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,V,H,At.__webglTexture,nt),e.bindFramebuffer(i.FRAMEBUFFER,null)}function pe(S,f,N){if(i.bindRenderbuffer(i.RENDERBUFFER,S),f.depthBuffer){let V=f.depthTexture,H=V&&V.isDepthTexture?V.type:null,nt=A(f.stencilBuffer,H),at=f.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Te(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ye(f),nt,f.width,f.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,ye(f),nt,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,nt,f.width,f.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,at,i.RENDERBUFFER,S)}else{let V=f.textures;for(let H=0;H<V.length;H++){let nt=V[H],at=r.convert(nt.format,nt.colorSpace),W=r.convert(nt.type),$=M(nt.internalFormat,at,W,nt.normalized,nt.colorSpace);Te(f)?o.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ye(f),$,f.width,f.height):N?i.renderbufferStorageMultisample(i.RENDERBUFFER,ye(f),$,f.width,f.height):i.renderbufferStorage(i.RENDERBUFFER,$,f.width,f.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Ht(S,f,N){let V=f.isWebGLCubeRenderTarget===!0;if(e.bindFramebuffer(i.FRAMEBUFFER,S),!(f.depthTexture&&f.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let H=n.get(f.depthTexture);if(H.__renderTarget=f,(!H.__webglTexture||f.depthTexture.image.width!==f.width||f.depthTexture.image.height!==f.height)&&(f.depthTexture.image.width=f.width,f.depthTexture.image.height=f.height,f.depthTexture.needsUpdate=!0),V){if(H.__webglInit===void 0&&(H.__webglInit=!0,f.depthTexture.addEventListener("dispose",C)),H.__webglTexture===void 0){H.__webglTexture=i.createTexture(),e.bindTexture(i.TEXTURE_CUBE_MAP,H.__webglTexture),Ft(i.TEXTURE_CUBE_MAP,f.depthTexture);let ot=r.convert(f.depthTexture.format),At=r.convert(f.depthTexture.type),pt;f.depthTexture.format===Un?pt=i.DEPTH_COMPONENT24:f.depthTexture.format===yi&&(pt=i.DEPTH24_STENCIL8);for(let it=0;it<6;it++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+it,0,pt,f.width,f.height,0,ot,At,null)}}else K(f.depthTexture,0);let nt=H.__webglTexture,at=ye(f),W=V?i.TEXTURE_CUBE_MAP_POSITIVE_X+N:i.TEXTURE_2D,$=f.depthTexture.format===yi?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(f.depthTexture.format===Un)Te(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,$,W,nt,0,at):i.framebufferTexture2D(i.FRAMEBUFFER,$,W,nt,0);else if(f.depthTexture.format===yi)Te(f)?o.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,$,W,nt,0,at):i.framebufferTexture2D(i.FRAMEBUFFER,$,W,nt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function le(S){let f=n.get(S),N=S.isWebGLCubeRenderTarget===!0;if(f.__boundDepthTexture!==S.depthTexture){let V=S.depthTexture;if(f.__depthDisposeCallback&&f.__depthDisposeCallback(),V){let H=()=>{delete f.__boundDepthTexture,delete f.__depthDisposeCallback,V.removeEventListener("dispose",H)};V.addEventListener("dispose",H),f.__depthDisposeCallback=H}f.__boundDepthTexture=V}if(S.depthTexture&&!f.__autoAllocateDepthBuffer)if(N)for(let V=0;V<6;V++)Ht(f.__webglFramebuffer[V],S,V);else{let V=S.texture.mipmaps;V&&V.length>0?Ht(f.__webglFramebuffer[0],S,0):Ht(f.__webglFramebuffer,S,0)}else if(N){f.__webglDepthbuffer=[];for(let V=0;V<6;V++)if(e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[V]),f.__webglDepthbuffer[V]===void 0)f.__webglDepthbuffer[V]=i.createRenderbuffer(),pe(f.__webglDepthbuffer[V],S,!1);else{let H=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,nt=f.__webglDepthbuffer[V];i.bindRenderbuffer(i.RENDERBUFFER,nt),i.framebufferRenderbuffer(i.FRAMEBUFFER,H,i.RENDERBUFFER,nt)}}else{let V=S.texture.mipmaps;if(V&&V.length>0?e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer[0]):e.bindFramebuffer(i.FRAMEBUFFER,f.__webglFramebuffer),f.__webglDepthbuffer===void 0)f.__webglDepthbuffer=i.createRenderbuffer(),pe(f.__webglDepthbuffer,S,!1);else{let H=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,nt=f.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,nt),i.framebufferRenderbuffer(i.FRAMEBUFFER,H,i.RENDERBUFFER,nt)}}e.bindFramebuffer(i.FRAMEBUFFER,null)}function ee(S,f,N){let V=n.get(S);f!==void 0&&Lt(V.__webglFramebuffer,S,S.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),N!==void 0&&le(S)}function Jt(S){let f=S.texture,N=n.get(S),V=n.get(f);S.addEventListener("dispose",_);let H=S.textures,nt=S.isWebGLCubeRenderTarget===!0,at=H.length>1;if(at||(V.__webglTexture===void 0&&(V.__webglTexture=i.createTexture()),V.__version=f.version,a.memory.textures++),nt){N.__webglFramebuffer=[];for(let W=0;W<6;W++)if(f.mipmaps&&f.mipmaps.length>0){N.__webglFramebuffer[W]=[];for(let $=0;$<f.mipmaps.length;$++)N.__webglFramebuffer[W][$]=i.createFramebuffer()}else N.__webglFramebuffer[W]=i.createFramebuffer()}else{if(f.mipmaps&&f.mipmaps.length>0){N.__webglFramebuffer=[];for(let W=0;W<f.mipmaps.length;W++)N.__webglFramebuffer[W]=i.createFramebuffer()}else N.__webglFramebuffer=i.createFramebuffer();if(at)for(let W=0,$=H.length;W<$;W++){let ot=n.get(H[W]);ot.__webglTexture===void 0&&(ot.__webglTexture=i.createTexture(),a.memory.textures++)}if(S.samples>0&&Te(S)===!1){N.__webglMultisampledFramebuffer=i.createFramebuffer(),N.__webglColorRenderbuffer=[],e.bindFramebuffer(i.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let W=0;W<H.length;W++){let $=H[W];N.__webglColorRenderbuffer[W]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,N.__webglColorRenderbuffer[W]);let ot=r.convert($.format,$.colorSpace),At=r.convert($.type),pt=M($.internalFormat,ot,At,$.normalized,$.colorSpace,S.isXRRenderTarget===!0),it=ye(S);i.renderbufferStorageMultisample(i.RENDERBUFFER,it,pt,S.width,S.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+W,i.RENDERBUFFER,N.__webglColorRenderbuffer[W])}i.bindRenderbuffer(i.RENDERBUFFER,null),S.depthBuffer&&(N.__webglDepthRenderbuffer=i.createRenderbuffer(),pe(N.__webglDepthRenderbuffer,S,!0)),e.bindFramebuffer(i.FRAMEBUFFER,null)}}if(nt){e.bindTexture(i.TEXTURE_CUBE_MAP,V.__webglTexture),Ft(i.TEXTURE_CUBE_MAP,f);for(let W=0;W<6;W++)if(f.mipmaps&&f.mipmaps.length>0)for(let $=0;$<f.mipmaps.length;$++)Lt(N.__webglFramebuffer[W][$],S,f,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,$);else Lt(N.__webglFramebuffer[W],S,f,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+W,0);d(f)&&T(i.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(at){for(let W=0,$=H.length;W<$;W++){let ot=H[W],At=n.get(ot),pt=i.TEXTURE_2D;(S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(pt=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(pt,At.__webglTexture),Ft(pt,ot),Lt(N.__webglFramebuffer,S,ot,i.COLOR_ATTACHMENT0+W,pt,0),d(ot)&&T(pt)}e.unbindTexture()}else{let W=i.TEXTURE_2D;if((S.isWebGL3DRenderTarget||S.isWebGLArrayRenderTarget)&&(W=S.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),e.bindTexture(W,V.__webglTexture),Ft(W,f),f.mipmaps&&f.mipmaps.length>0)for(let $=0;$<f.mipmaps.length;$++)Lt(N.__webglFramebuffer[$],S,f,i.COLOR_ATTACHMENT0,W,$);else Lt(N.__webglFramebuffer,S,f,i.COLOR_ATTACHMENT0,W,0);d(f)&&T(W),e.unbindTexture()}S.depthBuffer&&le(S)}function fe(S){let f=S.textures;for(let N=0,V=f.length;N<V;N++){let H=f[N];if(d(H)){let nt=w(S),at=n.get(H).__webglTexture;e.bindTexture(nt,at),T(nt),e.unbindTexture()}}}let Ae=[],we=[];function Pe(S){if(S.samples>0){if(Te(S)===!1){let f=S.textures,N=S.width,V=S.height,H=i.COLOR_BUFFER_BIT,nt=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,at=n.get(S),W=f.length>1;if(W)for(let ot=0;ot<f.length;ot++)e.bindFramebuffer(i.FRAMEBUFFER,at.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.RENDERBUFFER,null),e.bindFramebuffer(i.FRAMEBUFFER,at.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.TEXTURE_2D,null,0);e.bindFramebuffer(i.READ_FRAMEBUFFER,at.__webglMultisampledFramebuffer);let $=S.texture.mipmaps;$&&$.length>0?e.bindFramebuffer(i.DRAW_FRAMEBUFFER,at.__webglFramebuffer[0]):e.bindFramebuffer(i.DRAW_FRAMEBUFFER,at.__webglFramebuffer);for(let ot=0;ot<f.length;ot++){if(S.resolveDepthBuffer&&(S.depthBuffer&&(H|=i.DEPTH_BUFFER_BIT),S.stencilBuffer&&S.resolveStencilBuffer&&(H|=i.STENCIL_BUFFER_BIT)),W){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,at.__webglColorRenderbuffer[ot]);let At=n.get(f[ot]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,At,0)}i.blitFramebuffer(0,0,N,V,0,0,N,V,H,i.NEAREST),c===!0&&(Ae.length=0,we.length=0,Ae.push(i.COLOR_ATTACHMENT0+ot),S.depthBuffer&&S.resolveDepthBuffer===!1&&(Ae.push(nt),we.push(nt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,we)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,Ae))}if(e.bindFramebuffer(i.READ_FRAMEBUFFER,null),e.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),W)for(let ot=0;ot<f.length;ot++){e.bindFramebuffer(i.FRAMEBUFFER,at.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.RENDERBUFFER,at.__webglColorRenderbuffer[ot]);let At=n.get(f[ot]).__webglTexture;e.bindFramebuffer(i.FRAMEBUFFER,at.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+ot,i.TEXTURE_2D,At,0)}e.bindFramebuffer(i.DRAW_FRAMEBUFFER,at.__webglMultisampledFramebuffer)}else if(S.depthBuffer&&S.resolveDepthBuffer===!1&&c){let f=S.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[f])}}}function ye(S){return Math.min(s.maxSamples,S.samples)}function Te(S){let f=n.get(S);return S.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&f.__useRenderToTexture!==!1}function P(S){let f=a.render.frame;u.get(S)!==f&&(u.set(S,f),S.update())}function Be(S,f){let N=S.colorSpace,V=S.format,H=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||N!==Is&&N!==Qn&&($t.getTransfer(N)===oe?(V!==xn||H!==hn)&&Dt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ut("WebGLTextures: Unsupported texture color space:",N)),f}function ie(S){return typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement?(l.width=S.naturalWidth||S.width,l.height=S.naturalHeight||S.height):typeof VideoFrame<"u"&&S instanceof VideoFrame?(l.width=S.displayWidth,l.height=S.displayHeight):(l.width=S.width,l.height=S.height),l}this.allocateTextureUnit=X,this.resetTextureUnits=q,this.getTextureUnits=Y,this.setTextureUnits=z,this.setTexture2D=K,this.setTexture2DArray=tt,this.setTexture3D=ft,this.setTextureCube=xt,this.rebindTextures=ee,this.setupRenderTarget=Jt,this.updateRenderTargetMipmap=fe,this.updateMultisampleRenderTarget=Pe,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=Lt,this.useMultisampledRTT=Te,this.isReversedDepthBuffer=function(){return e.buffers.depth.getReversed()}}function wm(i,t){function e(n,s=Qn){let r,a=$t.getTransfer(s);if(n===hn)return i.UNSIGNED_BYTE;if(n===xa)return i.UNSIGNED_SHORT_4_4_4_4;if(n===va)return i.UNSIGNED_SHORT_5_5_5_1;if(n===rl)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===al)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===il)return i.BYTE;if(n===sl)return i.SHORT;if(n===hs)return i.UNSIGNED_SHORT;if(n===_a)return i.INT;if(n===Cn)return i.UNSIGNED_INT;if(n===gn)return i.FLOAT;if(n===_n)return i.HALF_FLOAT;if(n===ol)return i.ALPHA;if(n===ll)return i.RGB;if(n===xn)return i.RGBA;if(n===Un)return i.DEPTH_COMPONENT;if(n===yi)return i.DEPTH_STENCIL;if(n===ya)return i.RED;if(n===Ma)return i.RED_INTEGER;if(n===Mi)return i.RG;if(n===Sa)return i.RG_INTEGER;if(n===ba)return i.RGBA_INTEGER;if(n===js||n===tr||n===er||n===nr)if(a===oe)if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===js)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===tr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===er)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===nr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===js)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===tr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===er)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===nr)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Ea||n===Ta||n===Aa||n===wa)if(r=t.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Ea)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ta)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Aa)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===wa)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Ca||n===Ra||n===Ia||n===Pa||n===La||n===ir||n===Da)if(r=t.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Ca||n===Ra)return a===oe?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Ia)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Pa)return r.COMPRESSED_R11_EAC;if(n===La)return r.COMPRESSED_SIGNED_R11_EAC;if(n===ir)return r.COMPRESSED_RG11_EAC;if(n===Da)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Na||n===Ua||n===Fa||n===Oa||n===Ba||n===za||n===Va||n===ka||n===Ga||n===Ha||n===Wa||n===Xa||n===qa||n===Ya)if(r=t.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Na)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Ua)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Fa)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Oa)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ba)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===za)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Va)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ka)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ga)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ha)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Wa)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Xa)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===qa)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ya)return a===oe?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Za||n===Ja||n===$a)if(r=t.get("EXT_texture_compression_bptc"),r!==null){if(n===Za)return a===oe?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ja)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===$a)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Ka||n===Qa||n===sr||n===ja)if(r=t.get("EXT_texture_compression_rgtc"),r!==null){if(n===Ka)return r.COMPRESSED_RED_RGT
vendor: 5,910 bytes, lines 4084-4108
4084C1_EXT;if(n===Qa)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===sr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ja)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===us?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:e}}var Cm=`
4085void main() {
4086
4087	gl_Position = vec4( position, 1.0 );
4088
4089}`,Rm=`
4090uniform sampler2DArray depthColor;
4091uniform float depthWidth;
4092uniform float depthHeight;
4093
4094void main() {
4095
4096	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4097
4098	if ( coord.x >= 1.0 ) {
4099
4100		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4101
4102	} else {
4103
4104		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4105
4106	}
4107
4108}`,Cl=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new Hs(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){let e=t.cameras[0].viewport,n=new ln({vertexShader:Cm,fragmentShader:Rm,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new We(new Bi(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Rl=class extends Fn{constructor(t,e){super();let n=this,s=null,r=1,a=null,o="local-floor",c=1,l=null,u=null,p=null,h=null,g=null,x=null,y=typeof XRWebGLBinding<"u",m=new Cl,d={},T=e.getContextAttributes(),w=null,M=null,A=[],b=[],C=new jt,_=null,E=new Ke;E.viewport=new Ee;let D=new Ke;D.viewport=new Ee;let I=[E,D],O=new fa,q=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let st=A[Z];return st===void 0&&(st=new as,A[Z]=st),st.getTargetRaySpace()},this.getControllerGrip=function(Z){let st=A[Z];return st===void 0&&(st=new as,A[Z]=st),st.getGripSpace()},this.getHand=function(Z){let st=A[Z];return st===void 0&&(st=new as,A[Z]=st),st.getHandSpace()};function z(Z){let st=b.indexOf(Z.inputSource);if(st===-1)return;let et=A[st];et!==void 0&&(et.update(Z.inputSource,Z.frame,l||a),et.dispatchEvent({type:Z.type,data:Z.inputSource}))}function X(){s.removeEventListener("select",z),s.removeEventListener("selectstart",z),s.removeEventListener("selectend",z),s.removeEventListener("squeeze",z),s.removeEventListener("squeezestart",z),s.removeEventListener("squeezeend",z),s.removeEventListener("end",X),s.removeEventListener("inputsourceschange",G);for(let Z=0;Z<A.length;Z++){let st=b[Z];st!==null&&(b[Z]=null,A[Z].disconnect(st))}q=null,Y=null,m.reset();for(let Z in d)delete d[Z];t.setRenderTarget(w),g=null,h=null,p=null,s=null,M=null,Ft.stop(),n.isPresenting=!1,t.setPixelRatio(_),t.setSize(C.width,C.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){r=Z,n.isPresenting===!0&&Dt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,n.isPresenting===!0&&Dt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(Z){l=Z},this.getBaseLayer=function(){return h!==null?h:g},this.getBinding=function(){return p===null&&y&&(p=new XRWebGLBinding(s,e)),p},this.getFrame=function(){return x},this.getSession=function(){return s},this.setSession=async function(Z){if(s=Z,s!==null){if(w=t.getRenderTarget(),s.addEventListener("select",z),s.addEventListener("selectstart",z),s.addEventListener("selectend",z),s.addEventListener("squeeze",z),s.addEventListener("squeezestart",z),s.addEventListener("squeezeend",z),s.addEventListener("end",X),s.addEventListener("inputsourceschange",G),T.xrCompatible!==!0&&await e.makeXRCompatible(),_=t.getPixelRatio(),t.getSize(C),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let et=null,Nt=null,Ot=null;T.depth&&(Ot=T.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,et=T.stencil?yi:Un,Nt=T.stencil?us:Cn);let Lt={colorFormat:e.RGBA8,depthFormat:Ot,scaleFactor:r};p=this.getBinding(),h=p.createProjectionLayer(Lt),s.updateRenderState({layers:[h]}),t.setPixelRatio(1),t.setSize(h.textureWidth,h.textureHeight,!1),M=new an(h.textureWidth,h.textureHeight,{format:xn,type:hn,depthTexture:new Kn(h.textureWidth,h.textureHeight,Nt,void 0,void 0,void 0,void 0,void 0,void 0,et),stencilBuffer:T.stencil,colorSpace:t.outputColorSpace,samples:T.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{let et={antialias:T.antialias,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:r};g=new XRWebGLLayer(s,e,et),s.updateRenderState({baseLayer:g}),t.setPixelRatio(1),t.setSize(g.framebufferWidth,g.framebufferHeight,!1),M=new an(g.framebufferWidth,g.framebufferHeight,{format:xn,type:hn,colorSpace:t.outputColorSpace,stencilBuffer:T.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await s.requestReferenceSpace(o),Ft.setContext(s),Ft.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function G(Z){for(let st=0;st<Z.removed.length;st++){let et=Z.removed[st],Nt=b.indexOf(et);Nt>=0&&(b[Nt]=null,A[Nt].disconnect(et))}for(let st=0;st<Z.added.length;st++){let et=Z.added[st],Nt=b.indexOf(et);if(Nt===-1){for(let Lt=0;Lt<A.length;Lt++)if(Lt>=b.length){b.push(et),Nt=Lt;break}else if(b[Lt]===null){b[Lt]=et,Nt=Lt;break}if(Nt===-1)break}let Ot=A[Nt];Ot&&Ot.connect(et)}}let K=new F,tt=new F;function ft(Z,st,et){K.setFromMatrixPosition(st.matrixWorld),tt.setFromMatrixPosition(et.matrixWorld);let Nt=K.distanceTo(tt),Ot=st.projectionMatrix.elements,Lt=et.projectionMatrix.elements,pe
4108=Ot[14]/(Ot[10]-1),Ht=Ot[14]/(Ot[10]+1),le=(Ot[9]+1)/Ot[5],ee=(Ot[9]-1)/Ot[5],Jt=(Ot[8]-1)/Ot[0],fe=(Lt[8]+1)/Lt[0],Ae=pe*Jt,we=pe*fe,Pe=Nt/(-Jt+fe),ye=Pe*-Jt;if(st.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(ye),Z.translateZ(Pe),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Ot[10]===-1)Z.projectionMatrix.copy(st.projectionMatrix),Z.projectionMatrixInverse.copy(st.projectionMatrixInverse);else{let Te=pe+Pe,P=Ht+Pe,Be=Ae-ye,ie=we+(Nt-ye),S=le*Ht/P*Te,f=ee*Ht/P*Te;Z.projectionMatrix.makePerspective(Be,ie,S,f,Te,P),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function xt(Z,st){st===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(st.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(s===null)return;let st=Z.near,et=Z.far;m.texture!==null&&(m.depthNear>0&&(st=m.depthNear),m.depthFar>0&&(et=m.depthFar)),O.near=D.near=E.near=st,O.far=D.far=E.far=et,(q!==O.near||Y!==O.far)&&(s.updateRenderState({depthNear:O.near,depthFar:O.far}),q=O.near,Y=O.far),O.layers.mask=Z.layers.mask|6,E.layers.mask=O.layers.mask&-5,D.layers.mask=O.layers.mask&-3;let Nt=Z.parent,Ot=O.cameras;xt(O,Nt);for(let Lt=0;Lt<Ot.length;Lt++)xt(Ot[Lt],Nt);Ot.length===2?ft(O,E,D):O.projectionMatrix.copy(E.projectionMatrix),Mt(Z,O,Nt)};function Mt(Z,st,et){et===null?Z.matrix.copy(st.matrixWorld):(Z.matrix.copy(et.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(st.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(st.projectionMatrix),Z.projectionMatrixInverse.copy(st.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=qr*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(h===null&&g===null))return c},this.setFoveation=function(Z){c=Z,h!==null&&(h.fixedFoveation=Z),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=Z)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(O)},this.getCameraTexture=function(Z){return d[Z]};let te=null;function Qt(Z,st){if(u=st.getViewerPose(l||a),x=st,u!==null){let et=u.views;g!==null&&(t.setRenderTargetFramebuffer(M,g.framebuffer),t.setRenderTarget(M));let Nt=!1;et.length!==O.cameras.length&&(O.cameras.length=0,Nt=!0);for(let Ht=0;Ht<et.length;Ht++){let le=et[Ht],ee=null;if(g!==null)ee=g.getViewport(le);else{let fe=p.getViewSubImage(h,le);ee=fe.viewport,Ht===0&&(t.setRenderTargetTextures(M,fe.colorTexture,fe.depthStencilTexture),t.setRenderTarget(M))}let Jt=I[Ht];Jt===void 0&&(Jt=new Ke,Jt.layers.enable(Ht),Jt.viewport=new Ee,I[Ht]=Jt),Jt.matrix.fromArray(le.transform.matrix),Jt.matrix.decompose(Jt.position,Jt.quaternion,Jt.scale),Jt.projectionMatrix.fromArray(le.projectionMatrix),Jt.projectionMatrixInverse.copy(Jt.projectionMatrix).invert(),Jt.viewport.set(ee.x,ee.y,ee.width,ee.height),Ht===0&&(O.matrix.copy(Jt.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),Nt===!0&&O.cameras.push(Jt)}let Ot=s.enabledFeatures;if(Ot&&Ot.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&y){p=n.getBinding();let Ht=p.getDepthInformation(et[0]);Ht&&Ht.isValid&&Ht.texture&&m.init(Ht,s.renderState)}if(Ot&&Ot.includes("camera-access")&&y){t.state.unbindTexture(),p=n.getBinding();for(let Ht=0;Ht<et.length;Ht++){let le=et[Ht].camera;if(le){let ee=d[le];ee||(ee=new Hs,d[le]=ee);let Jt=p.getCameraImage(le);ee.sourceTexture=Jt}}}}for(let et=0;et<A.length;et++){let Nt=b[et],Ot=A[et];Nt!==null&&Ot!==void 0&&Ot.update(Nt,st,l||a)}te&&te(Z,st),st.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:st}),x=null}let Ft=new sh;Ft.setAnimationLoop(Qt),this.setAnimationLoop=function(Z){te=Z},this.dispose=function(){}}},Im=new de,hh=new kt;hh.set(-1,0,0,0,1,0,0,0,1);function Pm(i,t){function e(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,ul(i)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function s(m,d,T,w,M){d.isNodeMaterial?d.uniformsNeedUpdate=!1:d.isMeshBasicMaterial?r(m,d):d.isMeshLambertMaterial?(r(m,d),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)):d.isMeshToonMaterial?(r(m,d),p(m,d)):d.isMeshPhongMaterial?(r(m,d),u(m,d),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)):d.isMeshStandardMaterial?(r(m,d),h(m,d),d.isMeshPhysicalMaterial&&g(m,d,M)):d.isMeshMat
vendor: 4,299 bytes, line 4108
4108capMaterial?(r(m,d),x(m,d)):d.isMeshDepthMaterial?r(m,d):d.isMeshDistanceMaterial?(r(m,d),y(m,d)):d.isMeshNormalMaterial?r(m,d):d.isLineBasicMaterial?(a(m,d),d.isLineDashedMaterial&&o(m,d)):d.isPointsMaterial?c(m,d,T,w):d.isSpriteMaterial?l(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function r(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,e(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,e(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,e(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===Ye&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,e(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===Ye&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,e(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,e(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,e(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);let T=t.get(d),w=T.envMap,M=T.envMapRotation;w&&(m.envMap.value=w,m.envMapRotation.value.setFromMatrix4(Im.makeRotationFromEuler(M)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(hh),m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap&&(m.lightMap.value=d.lightMap,m.lightMapIntensity.value=d.lightMapIntensity,e(d.lightMap,m.lightMapTransform)),d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,e(d.aoMap,m.aoMapTransform))}function a(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,e(d.map,m.mapTransform))}function o(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function c(m,d,T,w){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*T,m.scale.value=w*.5,d.map&&(m.map.value=d.map,e(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,e(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function l(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,e(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,e(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function p(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,e(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,e(d.roughnessMap,m.roughnessMapTransform)),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function g(m,d,T){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,e(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,e(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,e(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,e(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,e(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Ye&&m.clearcoatNormalScale.value.negate())),d.dispersion>0&&(m.dispersion.value=d.dispersion),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.
4108iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,e(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,e(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=T.texture,m.transmissionSamplerSize.value.set(T.width,T.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,e(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,e(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(m.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(m.anisotropyMap.value=d.anisotropyMap,e(d.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,e(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,e(d.specularIntensityMap,m.specularIntensityMapTransform))}function x(m,d){d.matcap&&(m.matcap.value=d.matcap)}function y(m,d){let T=t.get(d).light;m.referencePosition.value.setFromMatrixPosition(T.matrixWorld),m.nearDistance.value=T.shadow.camera.near,m.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:s}}function Lm(i,t,e,n){let s={},r={},a=[],o=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(M,A){let b=A.program;n.uniformBlockBinding(M,b)}function l(M,A){let b=s[M.id];b===void 0&&(m(M),b=u(M),s[M.id]=b,M.addEventListener("dispose",T));let C=A.program;n.updateUBOMapping(M,C);let _=t.render.frame;r[M.id]!==_&&(h(M),r[M.id]=_)}function u(M){let A=p();M.__bindingPointIndex=A;let b=i.createBuffer(),C=M.__size,_=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,b),i.bufferData(i.UNIFORM_BUFFER,C,_),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,A,b),b}function p(){for(let M=0;M<o;M++)if(a.indexOf(M)===-1)return a.push(M),M;return Ut("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(M){let A=s[M.id],b=M.uniforms,C=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,A);for(let _=0,E=b.length;_<E;_++){let D=b[_];if(Array.isArray(D))for(let I=0,O=D.length;I<O;I++)g(D[I],_,I,C);else g(D,_,0,C)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function g(M,A,b,C){if(y(M,A,b,C)===!0){let _=M.__offset,E=M.value;if(Array.isArray(E)){let D=0;for(let I=0;I<E.length;I++){let O=E[I],q=d(O);x(O,M.__data,D),typeof O!="number"&&typeof O!="boolean"&&!O.isMatrix3&&!ArrayBuffer.isView(O)&&(D+=q.storage/Float32Array.BYTES_PER_ELEMENT)}}else x(E,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,_,M.__data)}}function x(M,A,b){typeof M=="number"||typeof M=="boolean"?A[0]=M:M.isMatrix3?(A[0]=M.elements[0],A[1]=M.elements[1],A[2]=M.elements[2],A[3]=0,A[4]=M.elements[3],A[5]=M.elements[4],A[6]=M.elements[5],A[7]=0,A[8]=M.elements[6],A[9]=M.elements[7],A[10]=M.elements[8],A[11]=0):ArrayBuffer.isView(M)?A.set(new M.constructor(M.buffer,M.byteOffset,A.length)):M.toArray(A,b)}function y(M,A,b,C){let _=M.value,E=A+"_"+b;if(C[E]===void 0)return typeof _=="number"||typeof _=="boolean"?C[E]=_:ArrayBuffer.isView(_)?C[E]=_.slice():C[E]=_.clone(),!0;{let D=C[E];if(typeof _=="number"||typeof _=="boolean"){if(D!==_)return C[E]=_,!0}else{if(ArrayBuffer.isView(_))return!0;if(D.equals(_)===!1)return D.copy(_),!0}}return!1}function m(M){let A=M.uniforms,b=0,C=16;for(let E=0,D=A.length;E<D;E++){let I=Array.isArray(A[E])?A[E]:[A[E]];for(let O=0,q=I.length;O<q;O++){let Y=I[O],z=Array.isArray(Y.value)?Y.value:[Y.value];for(let X=0,G=z.length;X<G;X++){let K=z[X],tt=d(K),ft=b%C,xt=ft%tt.boundary,Mt=ft+xt;b+=xt,Mt!==0&&C-Mt<tt.storage&&(b+=C-Mt),Y.__data=new Float32Array(tt.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=b,b+=tt.storage}}}let _=b%C;return _>0&&(b+=C-_),M.__size=b,M.__cache={},this}function d(M){let A={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(A.boundary=4,A.storage=4):M.isVector2?(A.boundary=8,A.storage=8):M.isVector3||M.isColor?(A.boundary=16,A.storage=12):M.isVector4?(A.boundary=16,A.storage=16):M.isMatrix3?(A.boundary=48,A.storage=48):M.isMatrix4?(A.boundary=64,A.storage=64):M.isTexture?Dt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(A.boundary=16,A.storage=M.byteLength):Dt("WebGLRenderer: Unsupported uniform value type.",M),A}function T(M){let A=M.target;A.removeEventListener("dispose",T);let b=a.indexOf(A.__bindingPointIndex);a.splice(b,1),i.deleteBuffer(s[A.id]),delete s[A.id],delete r[A.id]}function w(){for(let M in s)i.deleteBuffer(s[M]);a=[],s={},r={}}return{bind:c,update:l,dispose:w}}
4108var Dm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
vendor: 35,328 bytes, line 4108
410814942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Vn=null;function Nm(){return Vn===null&&(Vn=new Bs(Dm,16,16,Mi,_n),Vn.name="DFG_LUT",Vn.minFilter=Oe,Vn.magFilter=Oe,Vn.wrapS=Nn,Vn.wrapT=Nn,Vn.generateMipmaps=!1,Vn.needsUpdate=!0),Vn}var ao=class{constructor(t={}){let{canvas:e=Rc(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:h=!1,outputBufferType:g=hn}=t;this.isWebGLRenderer=!0;let x;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");x=n.getContextAttributes().alpha}else x=a;let y=g,m=new Set([ba,Sa,Ma]),d=new Set([hn,Cn,hs,us,xa,va]),T=new Uint32Array(4),w=new Int32Array(4),M=new F,A=null,b=null,C=[],_=[],E=null;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=wn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let D=this,I=!1,O=null,q=null,Y=null,z=null;this._outputColorSpace=rn;let X=0,G=0,K=null,tt=-1,ft=null,xt=new Ee,Mt=new Ee,te=null,Qt=new Xt(0),Ft=0,Z=e.width,st=e.height,et=1,Nt=null,Ot=null,Lt=new Ee(0,0,Z,st),pe=new Ee(0,0,Z,st),Ht=!1,le=new ks,ee=!1,Jt=!1,fe=new de,Ae=new F,we=new Ee,Pe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ye=!1;function Te(){return K===null?et:1}let P=n;function Be(v,L){return e.getContext(v,L)}try{let v={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:p};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"}`),e.addEventListener("webglcontextlost",Me,!1),e.addEventListener("webglcontextrestored",se,!1),e.addEventListener("webglcontextcreationerror",un,!1),P===null){let L="webgl2";if(P=Be(L,v),P===null)throw Be(L)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(v){throw Ut("WebGLRenderer: "+v.message),v}let ie,S,f,N,V,H,nt,at,W,$,ot,At,pt,it,Rt,Pt,Gt,R,lt,J,ct,ut,Q;function Et(){ie=new kf(P),ie.init(),ct=new wm(P,ie),S=new Df(P,ie,t,ct),f=new Tm(P,ie),S.reversedDepthBuffer&&h&&f.buffers.depth.setReversed(!0),q=P.createFramebuffer(),Y=P.createFramebuffer(),z=P.createFramebuffer(),N=new Wf(P),V=new um,H=new Am(P,ie,f,V,S,ct,N),nt=new Vf(D),at=new Yh(P),ut=new Pf(P,at),W=new Gf(P,at,N,ut),$=new qf(P,W,at,ut,N),R=new Xf(P,S,H),Rt=new Nf(V),ot=new hm(D,nt,ie,S,ut,Rt),At=new Pm(D,V),pt=new fm,it=new vm(ie),Gt=new If(D,nt,f,$,x,c),Pt=new Em(D,$,S),Q=new Lm(P,N,S,f),lt=new Lf(P,ie,N),J=new Hf(P,ie,N),N.programs=ot.programs,D.capabilities=S,D.extensions=ie,D.properties=V,D.renderLists=pt,D.shadowMap=Pt,D.state=f,D.info=N}Et(),y!==hn&&(E=new Zf(y,e.width,e.height,o,s,r));let bt=new Rl(D,P);this.xr=bt,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let v=ie.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){let v=ie.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return et},this.setPixelRatio=function(v){v!==void 0&&(et=v,this.setSize(Z,st,!1))},this.getSize=function(v){return v.set(Z,st)},this.setSize=function(v,L,k=!0){if(bt.isPresenting){Dt("WebGLRenderer: Can't change size while VR device is presenting.");return}Z=v,st=L,e.width=Math.floor(v*et),e.height=Math.floor(L*et),k===!0&&(e.style.width=v+"px",e.style.height=L+"px"),E!==null&&E.setSize(e.width,e.height),this.setViewport(0,0,v,L)},this.getDrawingBufferSize=function(v){return v.set(Z*et,st*et).floor()},this.setDrawingBufferSize=function(v,L,k){Z=v,st=L,et=k,e.width=Math.floor(v*k),e.height=Math.floor(L*k),this.setViewport(0,0,v,L)},this.setEffects=function(v){if(y===hn){Ut("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(v){for(let L=0;L<v.length;L++)if(v[L].isOutputPass===!0){Dt("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}E.setEffects(v||[])},this.getCurrentViewport=function(v){return v.copy(xt)},this.getViewport=function(v){return v.copy(Lt)},this.setViewport=function(v,L,k,B){v.isVector4?Lt.set(v.x,v.y,v.z,v.w):Lt.set(v,L,k,B),f.viewport(xt.copy(Lt).multiplyScalar(et).round())},this.getScissor=function(v){return v.copy(pe)},this.setScissor=function(v,L,k,B){v.isVector4?pe.set(v.x,v.y,v.z,v.w):pe.set(v,L,k,B),f.scissor(Mt.copy(pe).multiplyScalar(et).round())},this.getScissorTest=function(){return Ht},this.setScissorTest=function(v){f.setScissorTest(Ht=v)},this.setOpaqueSort=function(v){Nt=v},this.setTransparentSort=function(v){Ot=v},this.getClearColor=function(v){return v.copy(Gt.getClearColor())},this.setClearColor=function(){Gt.setClearColor(...arguments)},this.getClearAlpha=function(){return Gt.getClearAlpha()},this.setClearAlpha=function(){Gt.setClearAlpha(...arguments)},this.clear=function(v=!0,L=!0,k=!0){let B=0;if(v){let U=!1;if(K!==null){let ht=K.texture.format;U=m.has(ht)}if(U){let ht=K.texture.type,vt=d.has(ht),dt=Gt.getClearColor(),Tt=Gt.getClearAlpha(),wt=dt.r,Bt=dt.g,Wt=dt.b;vt?(T[0]=wt,T[1]=Bt,T[2]=Wt,T[3]=Tt,P.clearBufferuiv(P.COLOR,0,T)):(w[0]=wt,w[1]=Bt,w[2]=Wt,w[3]=Tt,P.clearBufferiv(P.COLOR,0,w))}else B|=P.COLOR_BUFFER_BIT}L&&(B|=P.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),k&&(B|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),B!==0&&P.clear(B)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(v){v.setRenderer(this),O=v},this.dispose=function(){e.removeEventListener("webglcontextlost",Me,!1),e.removeEventListener("webglcontextrestored",se,!1),e.removeEventListener("webglcontextcreationerror",un,!1),Gt.dispose(),pt.dispose(),it.dispose(),V.dispose(),nt.dispose(),$.dispose(),ut.dispose(),Q.dispose(),ot.dispose(),bt.dispose(),bt.removeEventListener("sessionstart",Ze),bt.removeEventListener("sessionend",tn),yn.stop()};function Me(v){v.preventDefault(),hl("WebGLRenderer: Context Lost."),I=!0}function se(){hl("WebGLRenderer: Context Restored."),I=!1;let v=N.autoReset,L=Pt.enabled,k=Pt.autoUpdate,B=Pt.needsUpdate,U=Pt.type;Et(),N.autoReset=v,Pt.enabled=L,Pt.autoUpdate=k,Pt.needsUpdate=B,Pt.type=U}function un(v){Ut("WebGLRenderer: A WebGL context could not be created. Reason: ",v.statusMessage)}function ze(v){let L=v.target;L.removeEventListener("dispose",ze),gs(L)}function gs(v){_s(v),V.remove(v)}function _s(v){let L=V.get(v).programs;L!==void 0&&(L.forEach(function(k){ot.releaseProgram(k)}),v.isShaderMaterial&&ot.releaseShaderCache(v))}this.renderBufferDirect=function(v,L,k,B,U,ht){L===null&&(L=Pe);let vt=U.isMesh&&U.matrixWorld.determinantAffine()<0,dt=ho(v,L,k,B,U);f.setMaterial(B,vt);let Tt=k.index,wt=1;if(B.wireframe===!0){if(Tt=W.getWireframeAttribute(k),Tt===void 0)return;wt=2}let Bt=k.drawRange,Wt=k.attributes.position,Ct=Bt.start*wt,qt=(Bt.start+Bt.count)*wt;ht!==null&&(Ct=Math.max(Ct,ht.start*wt),qt=Math.min(qt,(ht.start+ht.count)*wt)),Tt!==null?(Ct=Math.max(Ct,0),qt=Math.min(qt,Tt.count)):Wt!=null&&(Ct=Math.max(Ct,0),qt=Math.min(qt,Wt.count));let ce=qt-Ct;if(ce<0||ce===1/0)return;ut.setup(U,B,dt,k,Tt);let me,re=lt;if(Tt!==null&&(me=at.get(Tt),re=J,re.setIndex(me)),U.isMesh)B.wireframe===!0?(f.setLineWidth(B.wireframeLinewidth*Te()),re.setMode(P.LINES)):re.setMode(P.TRIANGLES);else if(U.isLine){let Ce=B.linewidth;Ce===void 0&&(Ce=1),f.setLineWidth(Ce*Te()),U.isLineSegments?re.setMode(P.LINES):U.isLineLoop?re.setMode(P.LINE_LOOP):re.setMode(P.LINE_STRIP)}else U.isPoints?re.setMode(P.POINTS):U.isSprite&&re.setMode(P.TRIANGLES);if(U.isBatchedMesh)if(ie.get("WEBGL_multi_draw"))re.renderMultiDraw(U._multiDrawStarts,U._multiDrawCounts,U._multiDrawCount);else{let Ce=U._multiDrawStarts,mt=U._multiDrawCounts,Re=U._multiDrawCount,Yt=Tt?at.get(Tt).bytesPerElement:1,ke=V.get(B).currentProgram.getUniforms();for(let Je=0;Je<Re;Je++)ke.setValue(P,"_gl_DrawID",Je),re.render(Ce[Je]/Yt,mt[Je])}else if(U.isInstancedMesh)re.renderInstances(Ct,ce,U.count);else if(k.isInstancedBufferGeometry){let Ce=k._maxInstanceCount!==void 0?k._maxInstanceCount:1/0,mt=Math.min(k.instanceCount,Ce);re.renderInstances(Ct,ce,mt)}else re.render(Ct,ce)};function jn(v,L,k){v.transparent===!0&&v.side===mn&&v.forceSinglePass===!1?(v.side=Ye,v.needsUpdate=!0,Ti(v,L,k),v.side=Jn,v.needsUpdate=!0,Ti(v,L,k),v.side=mn):Ti(v,L,k)}this.compile=function(v,L,k=null){k===null&&(k=v),b=it.get(k),b.init(L),_.push(b),k.traverseVisible(function(U){U.isLight&&U.layers.test(L.layers)&&(b.pushLight(U),U.castShadow&&b.pushShadow(U))}),v!==k&&v.traverseVisible(function(U){U.isLight&&U.layers.test(L.layers)&&(b.pushLight(U),U.castShadow&&b.pushShadow(U))}),b.setupLights();let B=new Set;return v.traverse(function(U){if(!(U.isMesh||U.isPoints||U.isLine||U.isSprite))return;let ht=U.material;if(ht)if(Array.isArray(ht))for(let vt=0;vt<ht.length;vt++){let dt=ht[vt];jn(dt,k,U),B.add(dt)}else jn(ht,k,U),B.add(ht)}),b=_.pop(),B},this.compileAsync=function(v,L,k=null){let B=this.compile(v,L,k);return new Promise(U=>{function ht(){if(B.forEach(function(vt){V.get(vt).currentProgram.isReady()&&B.delete(vt)}),B.size===0){U(v);return}setTimeout(ht,10)}ie.get("KHR_parallel_shader_compile")!==null?ht():setTimeout(ht,10)})};let Ve=null;function ti(v){Ve&&Ve(v)}function Ze(){yn.stop()}function tn(){yn.start()}let yn=new sh;yn.setAnimationLoop(ti),typeof self<"u"&&yn.setContext(self),this.setAnimationLoop=function(v){Ve=v,bt.setAnimationLoop(v),v===null?yn.stop():yn.start()},bt.addEventListener("sessionstart",Ze),bt.addEventListener("sessionend",tn),this.render=function(v,L){if(L!==void 0&&L.isCamera!==!0){Ut("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;O!==null&&O.renderStart(v,L);let k=bt.enabled===!0&&bt.isPresenting===!0,B=E!==null&&(K===null||k)&&E.begin(D,K);if(v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),L.parent===null&&L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),bt.enabled===!0&&bt.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(bt.cameraAutoUpdate===!0&&bt.updateCamera(L),L=bt.getCamera()),v.isScene===!0&&v.onBeforeRender(D,v,L,K),b=it.get(v,_.length),b.init(L),b.state.textureUnits=H.getTextureUnits(),_.push(b),fe.multiplyMatrices(L.projectionMatrix,L.matrixWorldInverse),le.setFromProjectionMatrix(fe,Tn,L.reversedDepth),Jt=this.localClippingEnabled,ee=Rt.init(this.clippingPlanes,Jt),A=pt.get(v,C.length),A.init(),C.push(A),bt.enabled===!0&&bt.isPresenting===!0){let vt=D.xr.getDepthSensingMesh();vt!==null&&bi(vt,L,-1/0,D.sortObjects)}bi(v,L,0,D.sortObjects),A.finish(),D.sortObjects===!0&&A.sort(Nt,Ot,L.reversedDepth),ye=bt.enabled===!1||bt.isPresenting===!1||bt.hasDepthSensing()===!1,ye&&Gt.addToRenderList(A,v),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ee===!0&&Rt.beginShadows();let U=b.state.shadowsArray;if(Pt.render(U,v,L),ee===!0&&Rt.endShadows(),(B&&E.hasRenderPass())===!1){let vt=A.opaque,dt=A.transmissive;if(b.setupLights(),L.isArrayCamera){let Tt=L.cameras;if(dt.length>0)for(let wt=0,Bt=Tt.length;wt<Bt;wt++){let Wt=Tt[wt];Hi(vt,dt,v,Wt)}ye&&Gt.render(v);for(let wt=0,Bt=Tt.length;wt<Bt;wt++){let Wt=Tt[wt];xs(A,v,Wt,Wt.viewport)}}else dt.length>0&&Hi(vt,dt,v,L),ye&&Gt.render(v),xs(A,v,L)}K!==null&&G===0&&(H.updateMultisampleRenderTarget(K),H.updateRenderTargetMipmap(K)),B&&E.end(D),v.isScene===!0&&v.onAfterRender(D,v,L),ut.resetDefaultState(),tt=-1,ft=null,_.pop(),_.length>0?(b=_[_.length-1],H.setTextureUnits(b.state.textureUnits),ee===!0&&Rt.setGlobalState(D.clippingPlanes,b.state.camera)):b=null,C.pop(),C.length>0?A=C[C.length-1]:A=null,O!==null&&O.renderEnd()};function bi(v,L,k,B){if(v.visible===!1)return;if(v.layers.test(L.layers)){if(v.isGroup)k=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(L);else if(v.isLightProbeGrid)b.pushLightProbeGrid(v);else if(v.isLight)b.pushLight(v),v.castShadow&&b.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||le.intersectsSprite(v)){B&&we.setFromMatrixPosition(v.matrixWorld).applyMatrix4(fe);let vt=$.update(v),dt=v.material;dt.visible&&A.push(v,vt,dt,k,we.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(!v.frustumCulled||le.intersectsObject(v))){let vt=$.update(v),dt=v.material;if(B&&(v.boundingSphere!==void 0?(v.boundingSphere===null&&v.computeBoundingSphere(),we.copy(v.boundingSphere.center)):(vt.boundingSphere===null&&vt.computeBoundingSphere(),we.copy(vt.boundingSphere.center)),we.applyMatrix4(v.matrixWorld).applyMatrix4(fe)),Array.isArray(dt)){let Tt=vt.groups;for(let wt=0,Bt=Tt.length;wt<Bt;wt++){let Wt=Tt[wt],Ct=dt[Wt.materialIndex];Ct&&Ct.visible&&A.push(v,vt,Ct,k,we.z,Wt)}}else dt.visible&&A.push(v,vt,dt,k,we.z,null)}}let ht=v.children;for(let vt=0,dt=ht.length;vt<dt;vt++)bi(ht[vt],L,k,B)}function xs(v,L,k,B){let{opaque:U,transmissive:ht,transparent:vt}=v;b.setupLightsView(k),ee===!0&&Rt.setGlobalState(D.clippingPlanes,k),B&&f.viewport(xt.copy(B)),U.length>0&&Ei(U,L,k),ht.length>0&&Ei(ht,L,k),vt.length>0&&Ei(vt,L,k),f.buffers.depth.setTest(!0),f.buffers.depth.setMask(!0),f.buffers.color.setMask(!0),f.setPolygonOffset(!1)}function Hi(v,L,k,B){if((k.isScene===!0?k.overrideMaterial:null)!==null)return;if(b.state.transmissionRenderTarget[B.id]===void 0){let Ct=ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float");b.state.transmissionRenderTarget[B.id]=new an(1,1,{generateMipmaps:!0,type:Ct?_n:hn,minFilter:vi,samples:Math.max(4,S.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:$t.workingColorSpace})}let ht=b.state.transmissionRenderTarget[B.id],vt=B.viewport||xt;ht.setSize(vt.z*D.transmissionResolutionScale,vt.w*D.transmissionResolutionScale);let dt=D.getRenderTarget(),Tt=D.getActiveCubeFace(),wt=D.getActiveMipmapLevel();D.setRenderTarget(ht),D.getClearColor(Qt),Ft=D.getClearAlpha(),Ft<1&&D.setClearColor(16777215,.5),D.clear(),ye&&Gt.render(k);let Bt=D.toneMapping;D.toneMapping=wn;let Wt=B.viewport;if(B.viewport!==void 0&&(B.viewport=void 0),b.setupLightsView(B),ee===!0&&Rt.setGlobalState(D.clippingPlanes,B),Ei(v,k,B),H.updateMultisampleRenderTarget(ht),H.updateRenderTargetMipmap(ht),ie.has("WEBGL_multisampled_render_to_texture")===!1){let Ct=!1;for(let qt=0,ce=L.length;qt<ce;qt++){let me=L[qt],{object:re,geometry:Ce,material:mt,group:Re}=me;if(mt.side===mn&&re.layers.test(B.layers)){let Yt=mt.side;mt.side=Ye,mt.needsUpdate=!0,ei(re,k,B,Ce,mt,Re),mt.side=Yt,mt.needsUpdate=!0,Ct=!0}}Ct===!0&&(H.updateMultisampleRenderTarget(ht),H.updateRenderTargetMipmap(ht))}D.setRenderTarget(dt,Tt,wt),D.setClearColor(Qt,Ft),Wt!==void 0&&(B.viewport=Wt),D.toneMapping=Bt}function Ei(v,L,k){let B=L.isScene===!0?L.overrideMaterial:null;for(let U=0,ht=v.length;U<ht;U++){let vt=v[U],{object:dt,geometry:Tt,group:wt}=vt,Bt=vt.material;Bt.allowOverride===!0&&B!==null&&(Bt=B),dt.layers.test(k.layers)&&ei(dt,L,k,Tt,Bt,wt)}}function ei(v,L,k,B,U,ht){v.onBeforeRender(D,L,k,B,U,ht),v.modelViewMatrix.multiplyMatrices(k.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),U.onBeforeRender(D,L,k,B,v,ht),U.transparent===!0&&U.side===mn&&U.forceSinglePass===!1?(U.side=Ye,U.needsUpdate=!0,D.renderBufferDirect(k,L,B,U,v,ht),U.side=Jn,U.needsUpdate=!0,D.renderBufferDirect(k,L,B,U,v,ht),U.side=mn):D.renderBufferDirect(k,L,B,U,v,ht),v.onAfterRender(D,L,k,B,U,ht)}function Ti(v,L,k){L.isScene!==!0&&(L=Pe);let B=V.get(v),U=b.state.lights,ht=b.state.shadowsArray,vt=U.state.version,dt=ot.getParameters(v,U.state,ht,L,k,b.state.lightProbeGridArray),Tt=ot.getProgramCacheKey(dt),wt=B.programs;B.environment=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?L.environment:null,B.fog=L.fog;let Bt=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap;B.envMap=nt.get(v.envMap||B.environment,Bt),B.envMapRotation=B.environment!==null&&v.envMap===null?L.environmentRotation:v.envMapRotation,wt===void 0&&(v.addEventListener("dispose",ze),wt=new Map,B.programs=wt);let Wt=wt.get(Tt);if(Wt!==void 0){if(B.currentProgram===Wt&&B.lightsStateVersion===vt)return hr(v,dt),Wt}else dt.uniforms=ot.getUniforms(v),O!==null&&v.isNodeMaterial&&O.build(v,k,dt),v.onBeforeCompile(dt,D),Wt=ot.acquireProgram(dt,Tt),wt.set(Tt,Wt),B.uniforms=dt.uniforms;let Ct=B.uniforms;return(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(Ct.clippingPlanes=Rt.uniform),hr(v,dt),B.needsLights=fo(v),B.lightsStateVersion=vt,B.needsLights&&(Ct.ambientLightColor.value=U.state.ambient,Ct.lightProbe.value=U.state.probe,Ct.directionalLights.value=U.state.directional,Ct.directionalLightShadows.value=U.state.directionalShadow,Ct.spotLights.value=U.state.spot,Ct.spotLightShadows.value=U.state.spotShadow,Ct.rectAreaLights.value=U.state.rectArea,Ct.ltc_1.value=U.state.rectAreaLTC1,Ct.ltc_2.value=U.state.rectAreaLTC2,Ct.pointLights.value=U.state.point,Ct.pointLightShadows.value=U.state.pointShadow,Ct.hemisphereLights.value=U.state.hemi,Ct.directionalShadowMatrix.value=U.state.directionalShadowMatrix,Ct.spotLightMatrix.value=U.state.spotLightMatrix,Ct.spotLightMap.value=U.state.spotLightMap,Ct.pointShadowMatrix.value=U.state.pointShadowMatrix),B.lightProbeGrid=b.state.lightProbeGridArray.length>0,B.currentProgram=Wt,B.uniformsList=null,Wt}function vs(v){if(v.uniformsList===null){let L=v.currentProgram.getUniforms();v.uniformsList=fs.seqWithValue(L.seq,v.uniforms)}return v.uniformsList}function hr(v,L){let k=V.get(v);k.outputColorSpace=L.outputColorSpace,k.batching=L.batching,k.batchingColor=L.batchingColor,k.instancing=L.instancing,k.instancingColor=L.instancingColor,k.instancingMorph=L.instancingMorph,k.skinning=L.skinning,k.morphTargets=L.morphTargets,k.morphNormals=L.morphNormals,k.morphColors=L.morphColors,k.morphTargetsCount=L.morphTargetsCount,k.numClippingPlanes=L.numClippingPlanes,k.numIntersection=L.numClipIntersection,k.vertexAlphas=L.vertexAlphas,k.vertexTangents=L.vertexTangents,k.toneMapping=L.toneMapping}function Ai(v,L){if(v.length===0)return null;if(v.length===1)return v[0].texture!==null?v[0]:null;M.setFromMatrixPosition(L.matrixWorld);for(let k=0,B=v.length;k<B;k++){let U=v[k];if(U.texture!==null&&U.boundingBox.containsPoint(M))return U}return null}function ho(v,L,k,B,U){L.isScene!==!0&&(L=Pe),H.resetTextureUnits();let ht=L.fog,vt=B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial?L.environment:null,dt=K===null?D.outputColorSpace:K.isXRRenderTarget===!0?K.texture.colorSpace:$t.workingColorSpace,Tt=B.isMeshStandardMaterial||B.isMeshLambertMaterial&&!B.envMap||B.isMeshPhongMaterial&&!B.envMap,wt=nt.get(B.envMap||vt,Tt),Bt=B.vertexColors===!0&&!!k.attributes.color&&k.attributes.color.itemSize===4,Wt=!!k.attributes.tangent&&(!!B.normalMap||B.anisotropy>0),Ct=!!k.morphAttributes.position,qt=!!k.morphAttributes.normal,ce=!!k.morphAttributes.color,me=wn;B.toneMapped&&(K===null||K.isXRRenderTarget===!0)&&(me=D.toneMapping);let re=k.morphAttributes.position||k.morphAttributes.normal||k.morphAttributes.color,Ce=re!==void 0?re.length:0,mt=V.get(B),Re=b.state.lights;if(ee===!0&&(Jt===!0||v!==ft)){let he=v===ft&&B.id===tt;Rt.setState(B,v,he)}let Yt=!1;B.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==Re.state.version||mt.outputColorSpace!==dt||U.isBatchedMesh&&mt.batching===!1||!U.isBatchedMesh&&mt.batching===!0||U.isBatchedMesh&&mt.batchingColor===!0&&U.colorTexture===null||U.isBatchedMesh&&mt.batchingColor===!1&&U.colorTexture!==null||U.isInstancedMesh&&mt.instancing===!1||!U.isInstancedMesh&&mt.instancing===!0||U.isSkinnedMesh&&mt.skinning===!1||!U.isSkinnedMesh&&mt.skinning===!0||U.isInstancedMesh&&mt.instancingColor===!0&&U.instanceColor===null||U.isInstancedMesh&&mt.instancingColor===!1&&U.instanceColor!==null||U.isInstancedMesh&&mt.instancingMorph===!0&&U.morphTexture===null||U.isInstancedMesh&&mt.instancingMorph===!1&&U.morphTexture!==null||mt.envMap!==wt||B.fog===!0&&mt.fog!==ht||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Rt.numPlanes||mt.numIntersection!==Rt.numIntersection)||mt.vertexAlphas!==Bt||mt.vertexTangents!==Wt||mt.morphTargets!==Ct||mt.morphNormals!==qt||mt.morphColors!==ce||mt.toneMapping!==me||mt.morphTargetsCount!==Ce||!!mt.lightProbeGrid!=b.state.lightProbeGridArray.length>0)&&(Yt=!0):(Yt=!0,mt.__version=B.version);let ke=mt.currentProgram;Yt===!0&&(ke=Ti(B,L,U),O&&B.isNodeMaterial&&O.onUpdateProgram(B,ke,mt));let Je=!1,Mn=!1,Rn=!1,ne=ke.getUniforms(),Se=mt.uniforms;if(f.useProgram(ke.program)&&(Je=!0,Mn=!0,Rn=!0),B.id!==tt&&(tt=B.id,Mn=!0),mt.needsLights){let he=Ai(b.state.lightProbeGridArray,U);mt.lightProbeGrid!==he&&(mt.lightProbeGrid=he,Mn=!0)}if(Je||ft!==v){f.buffers.depth.getReversed()&&v.reversedDepth!==!0&&(v._reversedDepth=!0,v.updateProjectionMatrix()),ne.setValue(P,"projectionMatrix",v.projectionMatrix),ne.setValue(P,"viewMatrix",v.matrixWorldInverse);let Pn=ne.map.cameraPosition;Pn!==void 0&&Pn.setValue(P,Ae.setFromMatrixPosition(v.matrixWorld)),S.logarithmicDepthBuffer&&ne.setValue(P,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&ne.setValue(P,"isOrthographic",v.isOrthographicCamera===!0),ft!==v&&(ft=v,Mn=!0,Rn=!0)}if(mt.needsLights&&(Re.state.directionalShadowMap.length>0&&ne.setValue(P,"directionalShadowMap",Re.state.directionalShadowMap,H),Re.state.spotShadowMap.length>0&&ne.setValue(P,"spotShadowMap",Re.state.spotShadowMap,H),Re.state.pointShadowMap.length>0&&ne.setValue(P,"pointShadowMap",Re.state.pointShadowMap,H)),U.isSkinnedMesh){ne.setOptional(P,U,"bindMatrix"),ne.setOptional(P,U,"bindMatrixInverse");let he=U.skeleton;he&&(he.boneTexture===null&&he.computeBoneTexture(),ne.setValue(P,"boneTexture",he.boneTexture,H))}U.isBatchedMesh&&(ne.setOptional(P,U,"batchingTexture"),ne.setValue(P,"batchingTexture",U._matricesTexture,H),ne.setOptional(P,U,"batchingIdTexture"),ne.setValue(P,"batchingIdTexture",U._indirectTexture,H),ne.setOptional(P,U,"batchingColorTexture"),U._colorsTexture!==null&&ne.setValue(P,"batchingColorTexture",U._colorsTexture,H));let In=k.morphAttributes;if((In.position!==void 0||In.normal!==void 0||In.color!==void 0)&&R.update(U,k,ke),(Mn||mt.receiveShadow!==U.receiveShadow)&&(mt.receiveShadow=U.receiveShadow,ne.setValue(P,"receiveShadow",U.receiveShadow)),(B.isMeshStandardMaterial||B.isMeshLambertMaterial||B.isMeshPhongMaterial)&&B.envMap===null&&L.environment!==null&&(Se.envMapIntensity.value=L.environmentIntensity),Se.dfgLUT!==void 0&&(Se.dfgLUT.value=Nm()),Mn){if(ne.setValue(P,"toneMappingExposure",D.toneMappingExposure),mt.needsLights&&uo(Se,Rn),ht&&B.fog===!0&&At.refreshFogUniforms(Se,ht),At.refreshMaterialUniforms(Se,B,et,st,b.state.transmissionRenderTarget[v.id]),mt.needsLights&&mt.lightProbeGrid){let he=mt.lightProbeGrid;Se.probesSH.value=he.texture,Se.probesMin.value.copy(he.boundingBox.min),Se.probesMax.value.copy(he.boundingBox.max),Se.probesResolution.value.copy(he.resolution)}fs.upload(P,vs(mt),Se,H)}if(B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(fs.upload(P,vs(mt),Se,H),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&ne.setValue(P,"center",U.center),ne.setValue(P,"modelViewMatrix",U.modelViewMatrix),ne.setValue(P,"normalMatrix",U.normalMatrix),ne.setValue(P,"modelMatrix",U.matrixWorld),B.uniformsGroups!==void 0){let he=B.uniformsGroups;for(let Pn=0,Gn=he.length;Pn<Gn;Pn++){let j=he[Pn];Q.update(j,ke),Q.bind(j,ke)}}return ke}function uo(v,L){v.ambientLightColor.needsUpdate=L,v.lightProbe.needsUpdate=L,v.directionalLights.needsUpdate=L,v.directionalLightShadows.needsUpdate=L,v.pointLights.needsUpdate=L,v.pointLightShadows.needsUpdate=L,v.spotLights.needsUpdate=L,v.spotLightShadows.needsUpdate=L,v.rectAreaLights.needsUpdate=L,v.hemisphereLights.needsUpdate=L}function fo(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return X},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return K},this.setRenderTargetTextures=function(v,L,k){let B=V.get(v);B.__autoAllocateDepthBuffer=v.resolveDepthBuffer===!1,B.__autoAllocateDepthBuffer===!1&&(B.__useRenderToTexture=!1),V.get(v.texture).__webglTexture=L,V.get(v.depthTexture).__webglTexture=B.__autoAllocateDepthBuffer?void 0:k,B.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(v,L){let k=V.get(v);k.__webglFramebuffer=L,k.__useDefaultFramebuffer=L===void 0},this.setRenderTarget=function(v,L=0,k=0){K=v,X=L,G=k;let B=null,U=!1,ht=!1;if(v){let dt=V.get(v);if(dt.__useDefaultFramebuffer!==void 0){f.bindFramebuffer(P.FRAMEBUFFER,dt.__webglFramebuffer),xt.copy(v.viewport),Mt.copy(v.scissor),te=v.scissorTest,f.viewport(xt),f.scissor(Mt),f.setScissorTest(te),tt=-1;return}else if(dt.__webglFramebuffer===void 0)H.setupRenderTarget(v);else if(dt.__hasExternalTextures)H.rebindTextures(v,V.get(v.texture).__webglTexture,V.get(v.depthTexture).__webglTexture);else if(v.depthBuffer){let Bt=v.depthTexture;if(dt.__boundDepthTexture!==Bt){if(Bt!==null&&V.has(Bt)&&(v.width!==Bt.image.width||v.height!==Bt.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");H.setupDepthRenderbuffer(v)}}let Tt=v.texture;(Tt.isData3DTexture||Tt.isDataArrayTexture||Tt.isCompressedArrayTexture)&&(ht=!0);let wt=V.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(Array.isArray(wt[L])?B=wt[L][k]:B=wt[L],U=!0):v.samples>0&&H.useMultisampledRTT(v)===!1?B=V.get(v).__webglMultisampledFramebuffer:Array.isArray(wt)?B=wt[k]:B=wt,xt.copy(v.viewport),Mt.copy(v.scissor),te=v.scissorTest}else xt.copy(Lt).multiplyScalar(et).floor(),Mt.copy(pe).multiplyScalar(et).floor(),te=Ht;if(k!==0&&(B=q),f.bindFramebuffer(P.FRAMEBUFFER,B)&&f.drawBuffers(v,B),f.viewport(xt),f.scissor(Mt),f.setScissorTest(te),U){let dt=V.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+L,dt.__webglTexture,k)}else if(ht){let dt=L;for(let Tt=0;Tt<v.textures.length;Tt++){let wt=V.get(v.textures[Tt]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Tt,wt.__webglTexture,k,dt)}}else if(v!==null&&k!==0){let dt=V.get(v.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,dt.__webglTexture,k)}tt=-1},this.readRenderTargetPixels=function(v,L,k,B,U,ht,vt,dt=0){if(!(v&&v.isWebGLRenderTarget)){Ut("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Tt=V.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&vt!==void 0&&(Tt=Tt[vt]),Tt){f.bindFramebuffer(P.FRAMEBUFFER,Tt);try{let wt=v.textures[dt],Bt=wt.format,Wt=wt.type;if(v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+dt),!S.textureFormatReadable(Bt)){Ut("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!S.textureTypeReadable(Wt)){Ut("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}L>=0&&L<=v.width-B&&k>=0&&k<=v.height-U&&P.readPixels(L,k,B,U,ct.convert(Bt),ct.convert(Wt),ht)}finally{let wt=K!==null?V.get(K).__webglFramebuffer:null;f.bindFramebuffer(P.FRAMEBUFFER,wt)}}},this.readRenderTargetPixelsAsync=async function(v,L,k,B,U,ht,vt,dt=0){if(!(v&&v.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Tt=V.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&vt!==void 0&&(Tt=Tt[vt]),Tt)if(L>=0&&L<=v.width-B&&k>=0&&k<=v.height-U){f.bindFramebuffer(P.FRAMEBUFFER,Tt);let wt=v.textures[dt],Bt=wt.format,Wt=wt.type;if(v.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+dt),!S.textureFormatReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!S.textureTypeReadable(Wt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let Ct=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,Ct),P.bufferData(P.PIXEL_PACK_BUFFER,ht.byteLength,P.STREAM_READ),P.readPixels(L,k,B,U,ct.convert(Bt),ct.convert(Wt),0);let qt=K!==null?V.get(K).__webglFramebuffer:null;f.bindFramebuffer(P.FRAMEBUFFER,qt);let ce=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Pc(P,ce,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,Ct),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,ht),P.deleteBuffer(Ct),P.deleteSync(ce),ht}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(v,L=null,k=0){let B=Math.pow(2,-k),U=Math.floor(v.image.width*B),ht=Math.floor(v.image.height*B),vt=L!==null?L.x:0,dt=L!==null?L.y:0;H.setTexture2D(v,0),P.copyTexSubImage2D(P.TEXTURE_2D,k,0,0,vt,dt,U,ht),f.unbindTexture()},this.copyTextureToTexture=function(v,L,k=null,B=null,U=0,ht=0){let vt,dt,Tt,wt,Bt,Wt,Ct,qt,ce,me=v.isCompressedTexture?v.mipmaps[ht]:v.image;if(k!==null)vt=k.max.x-k.min.x,dt=k.max.y-k.min.y,Tt=k.isBox3?k.max.z-k.min.z:1,wt=k.min.x,Bt=k.min.y,Wt=k.isBox3?k.min.z:0;else{let Se=Math.pow(2,-U);vt=Math.floor(me.width*Se),dt=Math.floor(me.height*Se),v.isDataArrayTexture?Tt=me.depth:v.isData3DTexture?Tt=Math.floor(me.depth*Se):Tt=1,wt=0,Bt=0,Wt=0}B!==null?(Ct=B.x,qt=B.y,ce=B.z):(Ct=0,qt=0,ce=0);let re=ct.convert(L.format),Ce=ct.convert(L.type),mt;L.isData3DTexture?(H.setTexture3D(L,0),mt=P.TEXTURE_3D):L.isDataArrayTexture||L.isCompressedArrayTexture?(H.setTexture2DArray(L,0),mt=P.TEXTURE_2D_ARRAY):(H.setTexture2D(L,0),mt=P.TEXTURE_2D),f.activeTexture(P.TEXTURE0),f.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,L.flipY),f.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),f.pixelStorei(P.UNPACK_ALIGNMENT,L.unpackAlignment);let Re=f.getParameter(P.UNPACK_ROW_LENGTH),Yt=f.getParameter(P.UNPACK_IMAGE_HEIGHT),ke=f.getParameter(P.UNPACK_SKIP_PIXELS),Je=f.getParameter(P.UNPACK_SKIP_ROWS),Mn=f.getParameter(P.UNPACK_SKIP_IMAGES);f.pixelStorei(P.UNPACK_ROW_LENGTH,me.width),f.pixelStorei(P.UNPACK_IMAGE_HEIGHT,me.height),f.pixelStorei(P.UNPACK_SKIP_PIXELS,wt),f.pixelStorei(P.UNPACK_SKIP_ROWS,Bt),f.pixelStorei(P.UNPACK_SKIP_IMAGES,Wt);let Rn=v.isDataArrayTexture||v.isData3DTexture,ne=L.isDataArrayTexture||L.isData3DTexture;if(v.isDepthTexture){let Se=V.get(v),In=V.get(L),he=V.get(Se.__renderTarget),Pn=V.get(In.__renderTarget);f.bindFramebuffer(P.READ_FRAMEBUFFER,he.__webglFramebuffer),f.bindFramebuffer(P.DRAW_FRAMEBUFFER,Pn.__webglFramebuffer);for(let Gn=0;Gn<Tt;Gn++)Rn&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,V.get(v).__webglTexture,U,Wt+Gn),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,V.get(L).__webglTexture,ht,ce+Gn)),P.blitFramebuffer(wt,Bt,vt,dt,Ct,qt,vt,dt,P.DEPTH_BUFFER_BIT,P.NEAREST);f.bindFramebuffer(P.READ_FRAMEBUFFER,null),f.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(U!==0||v.isRenderTargetTexture||V.has(v)){let Se=V.get(v),In=V.get(L);f.bindFramebuffer(P.READ_FRAMEBUFFER,Y),f.bindFramebuffer(P.DRAW_FRAMEBUFFER,z);for(let he=0;he<Tt;he++)Rn?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,Se.__webglTexture,U,Wt+he):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,Se.__webglTexture,U),ne?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,In.__webglTexture,ht,ce+he):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,In.__webglTexture,ht),U!==0?P.blitFramebuffer(wt,Bt,vt,dt,Ct,qt,vt,dt,P.COLOR_BUFFER_BIT,P.NEAREST):ne?P.copyTexSubImage3D(mt,ht,Ct,qt,ce+he,wt,Bt,vt,dt):P.copyTexSubImage2D(mt,ht,Ct,qt,wt,Bt,vt,dt);f.bindFramebuffer(P.READ_FRAMEBUFFER,null),f.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else ne?v.isDataTexture||v.isData3DTexture?P.texSubImage3D(mt,ht,Ct,qt,ce,vt,dt,Tt,re,Ce,me.data):L.isCompressedArrayTexture?P.compressedTexSubImage3D(mt,ht,Ct,qt,ce,vt,dt,Tt,re,me.data):P.texSubImage3D(mt,ht,Ct,qt,ce,vt,dt,Tt,re,Ce,me):v.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,ht,Ct,qt,vt,dt,re,Ce,me.data):v.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,ht,Ct,qt,me.width,me.height,re,me.data):P.texSubImage2D(P.TEXTURE_2D,ht,Ct,qt,vt,dt,re,Ce,me);f.pixelStorei(P.UNPACK_ROW_LENGTH,Re),f.pixelStorei(P.UNPACK_IMAGE_HEIGHT,Yt),f.pixelStorei(P.UNPACK_SKIP_PIXELS,ke),f.pixelStorei(P.UNPACK_SKIP_ROWS,Je),f.pixelStorei(P.UNPACK_SKIP_IMAGES,Mn),ht===0&&L.generateMipmaps&&P.generateMipmap(mt),f.unbindTexture()},this.initRenderTarget=function(v){V.get(v).__webglFramebuffer===void 0&&H.setupRenderTarget(v)},this.initTexture=function(v){v.isCubeTexture?H.setTextureCube(v,0):v.isData3DTexture?H.setTexture3D(v,0):v.isDataArrayTexture||v.isCompressedArrayTexture?H.setTexture2DArray(v,0):H.setTexture2D(v,0),f.unbindTexture()},this.resetState=function(){X=0,G=0,K=null,f.reset(),ut.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Tn}get outputColorSpace(){return this._outputColorSpace}
4108set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=$t._getDrawingBufferColorSpace(t),e.unpackColorSpace=$t._getUnpackColorSpace()}};var cr=new F;function vn(i,t,e,n,s,r){let a=2*Math.PI*s/4,o=Math.max(r-2*s,0),c=Math.PI/4;cr.copy(t),cr[n]=0,cr.normalize();let l=.5*a/(a+o),u=1-cr.angleTo(i)/c;return Math.sign(cr[e])===1?u*l:o/(a+o)+l+l*(1-u)}var co=class i extends pi{constructor(t=1,e=1,n=1,s=2,r=.1){let a=s*2+1;if(r=Math.min(t/2,e/2,n/2,r),super(1,1,1,a,a,a),this.type="RoundedBoxGeometry",this.parameters={width:t,height:e,depth:n,segments:s,radius:r},a===1)return;let o=this.toNonIndexed();this.index=null,this.attributes.position=o.attributes.position,this.attributes.normal=o.attributes.normal,this.attributes.uv=o.attributes.uv;let c=new F,l=new F,u=new F(t,e,n).divideScalar(2).subScalar(r),p=this.attributes.position.array,h=this.attributes.normal.array,g=this.attributes.uv.array,x=p.length/6,y=new F,m=.5/a;for(let d=0,T=0;d<p.length;d+=3,T+=2)switch(c.fromArray(p,d),l.copy(c),l.x-=Math.sign(l.x)*m,l.y-=Math.sign(l.y)*m,l.z-=Math.sign(l.z)*m,l.normalize(),p[d+0]=u.x*Math.sign(c.x)+l.x*r,p[d+1]=u.y*Math.sign(c.y)+l.y*r,p[d+2]=u.z*Math.sign(c.z)+l.z*r,h[d+0]=l.x,h[d+1]=l.y,h[d+2]=l.z,Math.floor(d/x)){case 0:y.set(1,0,0),g[T+0]=vn(y,l,"z","y",r,n),g[T+1]=1-vn(y,l,"y","z",r,e);break;case 1:y.set(-1,0,0),g[T+0]=1-vn(y,l,"z","y",r,n),g[T+1]=1-vn(y,l,"y","z",r,e);break;case 2:y.set(0,1,0),g[T+0]=1-vn(y,l,"x","z",r,t),g[T+1]=vn(y,l,"z","x",r,n);break;case 3:y.set(0,-1,0),g[T+0]=1-vn(y,l,"x","z",r,t),g[T+1]=1-vn(y,l,"z","x",r,n);break;case 4:y.set(0,0,1),g[T+0]=1-vn(y,l,"x","y",r,t),g[T+1]=1-vn(y,l,"y","x",r,e);break;case 5:y.set(0,0,-1),g[T+0]=vn(y,l,"x","y",r,t),g[T+1]=1-vn(y,l,"y","x",r,e);break}}static fromJSON(t){return new i(t.width,t.height,t.depth,t.segments,t.radius)}};(function(){"use strict";let i=document.getElementById("max-page");if(!i)return;"scrollRestoration"in history&&(history.scrollRestoration="manual"),window.scrollTo(0,0),window.addEventListener("load",()=>window.scrollTo(0,0),{once:!0});let t=window.matchMedia("(prefers-reduced-motion: reduce)").matches,e=j=>Math.min(1,Math.max(0,j)),n=(j,gt,rt)=>j+(gt-j)*rt;function s(j,gt,rt){if(j<=gt[0])return rt[0];for(let yt=0;yt<gt.length-1;yt++)if(j<gt[yt+1]){let St=(j-gt[yt])/(gt[yt+1]-gt[yt]);return n(rt[yt],rt[yt+1],St)}return rt[rt.length-1]}class r{constructor(gt,rt,yt,St=0){this.stiffness=gt,this.damping=rt,this.mass=yt,this.target=St,this.value=St,this.velocity=0}step(gt){let rt=Math.max(1,Math.ceil(gt/.008)),yt=gt/rt;for(let St=0;St<rt;St++){let It=((this.target-this.value)*this.stiffness-this.damping*this.velocity)/this.mass;this.velocity+=It*yt,this.value+=this.velocity*yt}return this.value}}function a(j,gt,rt,yt){let St=3*j,It=3*(rt-j)-St,zt=1-St-It,ge=3*gt,Vt=3*(yt-gt)-ge,ue=1-ge-Vt,ae=_e=>((zt*_e+It)*_e+St)*_e,be=_e=>((ue*_e+Vt)*_e+ge)*_e,xe=_e=>(3*zt*_e+2*It)*_e+St;return _e=>{let en=_e;for(let ni=0;ni<6;ni++){let Ne=ae(en)-_e,dn=xe(en);if(Math.abs(Ne)<1e-5||dn===0)break;en-=Ne/dn}return be(Math.min(1,Math.max(0,en)))}}let o=document.getElementById("max-hero"),c=document.getElementById("quote-section"),l=document.getElementById("badge-cutout"),u=window.innerWidth<768,p=document.documentElement.clientHeight,h=window.innerWidth,g={stiffness:120,damping:30,mass:.4},x={stiffness:200,damping:30,mass:.25},y=new r(g.stiffness,g.damping,g.mass),m=new r(140,30,.4),d=new r(120,30,.4);function T(){let j=u?x:g;y.stiffness=j.stiffness,y.damping=j.damping,y.mass=j.mass}T();let w=0,M=!1,A=0,b=0,C=!1;function _(){if(performance.now()<b)return;if(o){let gt=o.getBoundingClientRect(),rt=o.offsetHeight-p;y.target=rt>0?e(-gt.top/rt):0,Math.abs(y.target-A)>.25&&(M=!0),A=y.target}let j=document.documentElement.clientHeight||1;if(c&&(w=e(1-c.getBoundingClientRect().top/j),m.target=w),l){let gt=l.getBoundingClientRect().top;d.target=e((j-gt)/(j*.7))}}window.addEventListener("scroll",_,{passive:!0});let E=window.matchMedia("(hover: none) and (pointer: coarse)").matches;function D(){let j=window.innerWidth!==h;j&&(h=window.innerWidth,p=document.documentElement.clientHeight,u=window.innerWidth<768,T()),(j||!E)&&(b=performance.now()+180)}
4108window.addEventListener("resize",D),window.visualViewport&&window.visualViewport.addEventListener("resize",D),_(),y.value=y.target,m.value=m.target,d.value=d.target;let I=document.getElementById("max-intro"),O=!0;function q(){if(!o||!I||performance.now()<b)return;let j=Math.max(0,o.offsetHeight-document.documentElement.clientHeight),gt=o.getBoundingClientRect().top+window.scrollY,rt=window.scrollY-gt;rt>j*.14?O=!1:rt<j*.1&&(O=!0),I.style.opacity=O?"1":"0"}window.addEventListener("scroll",q,{passive:!0}),window.addEventListener("resize",q);let Y=document.querySelector("header.nav")||document.querySelector(".nav"),z=!0;Y&&Y.classList.add("is-max-nav-over-dark"),q();let X=[{growStart:.1,growEnd:.54,growTo:2.2,pulsePeriod:11,pulseAmp:.05,phase:0,driftAmp:-18,rgb:[1,26,72],sizeX:1.4,sizeY:1.2,originY:1,delay:0},{growStart:.08,growEnd:.52,growTo:2.6,pulsePeriod:9.5,pulseAmp:.06,phase:1.1,driftAmp:14,rgb:[20,91,168],sizeX:1.2,sizeY:1,originY:1,delay:.12},{growStart:.06,growEnd:.5,growTo:3,pulsePeriod:8,pulseAmp:.07,phase:2.3,driftAmp:-12,rgb:[27,117,205],sizeX:1,sizeY:.85,originY:1,delay:.24},{growStart:.05,growEnd:.48,growTo:3.6,pulsePeriod:7,pulseAmp:.08,phase:3.5,driftAmp:16,rgb:[227,192,206],sizeX:.85,sizeY:.68,originY:1.02,delay:.36},{growStart:.04,growEnd:.46,growTo:4.4,pulsePeriod:6,pulseAmp:.1,phase:4.7,driftAmp:-10,rgb:[253,135,1],sizeX:.7,sizeY:.52,originY:1.04,delay:.48},{growStart:.02,growEnd:.44,growTo:5.2,pulsePeriod:5,pulseAmp:.12,phase:5.6,driftAmp:12,rgb:[253,154,1],sizeX:.52,sizeY:.4,originY:1.06,delay:.6}],G=[[0,1],[.48,.226],[.55,.113],[.61,.035],[.68,0]],K=[[0,1],[.4,.85],[.6,.24],[.65,.09],[.68,.03],[.74,0]],tt=1.5,ft=2.2,xt=.42,Mt=a(.22,1,.36,1),te=.5,Qt=document.getElementById("max-sky"),Ft=Qt?Qt.getContext("2d"):null,Z=0,st=0,et=document.getElementById("max-glow");function Nt(){if(!Qt||!Ft)return;let j=Qt.clientWidth,gt=Qt.clientHeight;if(j<1||gt<1)return;Z=j,st=gt;let rt=Math.max(2,Math.round(j*te)),yt=Math.max(2,Math.round(gt*te));(Qt.width!==rt||Qt.height!==yt)&&(Qt.width=rt,Qt.height=yt),Ft.setTransform(rt/j,0,0,yt/gt,0,0)}function Ot(j,gt,rt,yt,St,It,zt){if(!Ft||rt<=.01||yt<=.01||zt<=.001)return;Ft.save(),Ft.translate(j,gt),Ft.scale(rt,yt);let ge=Ft.createRadialGradient(0,0,0,0,0,1);for(let ae=0;ae<It.length;ae++){let be=It[ae][1]*zt;ge.addColorStop(It[ae][0],`rgba(${St[0]}, ${St[1]}, ${St[2]}, ${be.toFixed(4)})`)}Ft.fillStyle=ge;let Vt=-j/rt,ue=-gt/yt;Ft.fillRect(Vt,ue,(Z-j)/rt-Vt,(st-gt)/yt-ue),Ft.restore()}function Lt(j,gt,rt){if(!Qt||!Ft||(!rt&&(Qt.clientWidth!==Z||Qt.clientHeight!==st)&&Nt(),Z<1||st<1))return;let yt=Z,St=st,It=yt*tt,zt=St*tt,ge=St*1.25;Ft.clearRect(0,0,yt,St);let Vt=gt/1e3;for(let be=0;be<X.length;be++){let xe=X[be],_e=0,en=0;if(jn!==0){let fn=(gt-jn)/1e3-xe.delay;_e=t?1:fn<=0?0:fn>=ft?1:Mt(fn/ft),en=(1-_e)*xt*St}if(_e<=.001)continue;let ni=s(j,[xe.growStart,xe.growEnd],[1,xe.growTo]),Ne=t?0:Math.sin(Vt*(2*Math.PI/xe.pulsePeriod)+xe.phase),dn=ni*(1+Ne*xe.pulseAmp),ii=Ne*xe.driftAmp;Ot(yt*.5+ii,ge+dn*(zt*(xe.originY-1)+en),dn*xe.sizeX*It,dn*xe.sizeY*zt,xe.rgb,G,_e)}let ue=s(j,[.2,.34],[0,1]);if(ue>.001){let be=s(j,[.2,.52],[.45,5]);Ot(yt*.5,ge+be*zt*.02,be*1.1*It,be*.95*zt,[255,255,255],K,ue)}let ae=s(j,[.46,.56],[0,1]);ae>.001&&(Ft.fillStyle=`rgba(255, 255, 255, ${ae.toFixed(4)})`,Ft.fillRect(0,0,yt,St))}Nt();let pe=[0,.18,.36,.52],Ht=[[20,91,168,.18],[253,135,1,.28],[227,192,206,.4],[255,255,255,.55]];function le(j){let gt=s(j,pe,Ht.map(zt=>zt[0])).toFixed(0),rt=s(j,pe,Ht.map(zt=>zt[1])).toFixed(0),yt=s(j,pe,Ht.map(zt=>zt[2])).toFixed(0),St=s(j,pe,Ht.map(zt=>zt[3])),It=zt=>`rgba(${gt}, ${rt}, ${yt}, ${(St*zt).toFixed(3)})`;return`radial-gradient(circle closest-side, ${It(1)} 0%, ${It(1)} 40%, ${It(.62)} 63%, ${It(.5)} 70%, ${It(.26)} 80%, ${It(.1)} 89%, transparent 100%)`}let ee="",Jt=["$","\u20AC","\xA3","\xA5","\u20A3","\u20B9","\u20A9","\u20BF","\u20BA","\u20B4","\u20A6","\u20B1","\u20B2","\u20B5","\u20B8","\u20BC","\uFDFC","\u09F3","\u0E3F","\u20AB","kr","\xA2"],fe=20,Ae=12,we=30,Pe=.6,ye=.5,Te=1.02,P=7,Be=1.1,ie=4,S=document.getElementById("max-digit-field"),f=document.getElementById("max-digit-canvas"),N=f?f.getContext("2d"):null,V=[],H=0;function nt(j,gt){let rt=(j-.5)*1.35,yt=(gt-1.02)*1,St=Math.sqrt(rt*rt+yt*yt),It=Math.max(0,1-St/.78);return Math.pow(It,1.3)}let at=1.5;function W(){if(!f||!N)return;let j=Math.min(window.devicePixelRatio||1,at),gt=f.clientWidth,rt=f.clientHeight;f.width=Math.round(gt*j),f.height=Math.round(rt*j),N.setTransform(j,0,0,j,0,0),N.font=`${Ae}px monospace`,N.textAlign="center",N.textBaseline="middle",V=[];let yt=Math.ceil(gt/fe),St=Math.ceil(rt/fe),It=performance.now();for(let zt=0;zt<St;zt++)for(let ge=0;ge<yt;ge++){let Vt=(ge+.5)/yt,ue=(zt+.5)/St,ae=nt(Vt,ue);if(ae<.05||Math.random()>ae*.9+.45)continue;let xe=(Vt-ye)*1.35,_e=ue-Te;V.push({x:ge*fe+fe/2,y:zt*fe+fe/2,char:Jt[Math.floor(Math.random()*Jt.length)],nextSwap:It+1e3+Math.random()*6e3,mask:ae,seed:Math.random()*Math.PI*2,dist:Math.sqrt(xe*xe+_e*_e)})}}function $(j){if(!f||!N||j-H<1e3/we)return;H=j;let gt=f.clientWidth,rt=f.clientHeight,yt=Math.min(window.devicePixelRatio||1,at);(f.width!==Math.round(gt*yt)||f.height!==Math.round(rt*yt))&&W(),N.clearRect(0,0,gt,rt);let St=j/1e3;for(let It of V){!t&&j>=It.nextSwap&&(It.char=Jt[Math.floor(Math.random()*Jt.length)],It.nextSwap=j+200+Math.random()*800);let zt=.5+.5*Math.sin(It.dist*P-St*Be),ge=t?.6:Math.pow(zt,ie),Vt=t?.85:.78+.22*Math.sin(St*.7+It.seed),ue=It.mask*Vt*ge*Pe;ue<.008||(N.fillStyle=`rgba(255, 244, 224, ${ue})`,N.fillText(It.char,It.x,It.y))}}W(),window.addEventListener("resize",W);let ot=document.getElementById("max-center"),At=Array.from(i.querySelectorAll(".max-prompt")),pt=[[-1,-1],[1,-1],[1,-.4],[1,1],[.4,1],[
4108-1,1],[-1,0],[-.5,-1],[.4,-1],[-.6,1]],it=document.getElementById("max-persistent-box"),Rt=document.getElementById("max-tint"),Pt=document.getElementById("max-feature-last"),Gt=3,R=1500,lt=.35,J=14,ct=2.2,ut=1,Q=0,Et=window.scrollY,bt={fins:120,loopRadius:1.35,finLength:.95,finWidth:.05,finDepth:.18,twistTurns:1,bevel:.012},Me=3.65,se={duration:3.5,spinLag:.16,rippleAngle:90,spinDrift:10},un=-10,ze=document.getElementById("max-canvas"),gs=!1;function _s(){gs||(gs=!0,i.classList.add("is-ready","is-started"),jn=performance.now())}let jn=0;setTimeout(_s,4e3);let Ve=null,ti=null,Ze=null,tn=null,yn=null,bi=[],xs=0,Hi=0,Ei=0,ei=!0,Ti=new de,vs=new de;function hr(){if(!ze)return;let j=null;try{j=ze.getContext("webgl2")||ze.getContext("webgl")}catch{j=null}if(!j){i.classList.add("no-webgl"),_s();return}Ve=new ao({canvas:ze,antialias:E,alpha:!0,powerPreference:"high-performance"}),Ve.toneMapping=$s,Ve.toneMappingExposure=1.05,ti=new os,Ze=new zi(-1,1,1,-1,.1,100),Ze.position.set(0,0,10),ti.add(new Zs(16777215,.08));let gt=new os,rt=(Ne,dn,ii,fn,ys)=>{let ur=Ne==="ring"?new Ws(.25,.5,64):new Bi(1,1),Ms=new Oi({side:mn,toneMapped:!1});Ms.color.set(dn).multiplyScalar(ii);let wi=new We(ur,Ms);wi.position.set(fn[0],fn[1],fn[2]),wi.scale.set(ys[0],ys[1],ys[2]),wi.lookAt(0,0,0),gt.add(wi)};rt("rect","#ffffff",2.2,[0,4,3],[10,6,1]),rt("rect","#e8edf5",1.1,[-5,0,2],[6,8,1]),rt("rect","#cdd6e6",.7,[5,1,-2],[6,8,1]),rt("ring","#ffffff",1.6,[0,0,5],[3,3,1]);let yt=new ps(256);yt.texture.type=_n;let St=new ls(.1,1e3,yt),It=Ve.autoClear;Ve.autoClear=!0,St.update(Ve,gt),Ve.autoClear=It,ti.environment=yt.texture;let{fins:zt,loopRadius:ge,finLength:Vt,finWidth:ue,finDepth:ae,twistTurns:be,bevel:xe}=bt,_e=new co(ue,Vt,ae,2,Math.min(xe,ue*.49,ae*.49)),en=new Xs({color:"#c4c8cd",metalness:1,roughness:.22,clearcoat:1,clearcoatRoughness:.12,emissive:"#000000",emissiveIntensity:.45,envMapIntensity:2.2});en.onBeforeCompile=Ne=>{Ne.fragmentShader=Ne.fragmentShader.replace("#include <color_fragment>","").replace("vec3 totalEmissiveRadiance = emissive;","vec3 totalEmissiveRadiance = emissive * vColor.rgb;")},yn=en,tn=new Vs(_e,en,zt),bi=[];let ni=new Xt(1,1,1);for(let Ne=0;Ne<zt;Ne++){let dn=Ne/zt*Math.PI*2,ii=Math.cos(dn),fn=Math.sin(dn),ys=new F(ii*ge,fn*ge,0),ur=new F(-fn,ii,0).normalize(),Ms=dn*be,wi=new F(ii,fn,0).multiplyScalar(Math.cos(Ms)).addScaledVector(new F(0,0,1),Math.sin(Ms)).normalize(),uh=new F().crossVectors(ur,wi).normalize(),Il=new de().makeBasis(ur,wi,uh).setPosition(ys);bi.push({radialDir:new F(ii,fn,0),base:Il}),tn.setMatrixAt(Ne,Il),tn.setColorAt(Ne,ni)}tn.instanceColor&&(tn.instanceColor.needsUpdate=!0),ti.add(tn),ze.addEventListener("webglcontextlost",Ne=>Ne.preventDefault(),!1),Ai(),window.addEventListener("resize",Ai),typeof ResizeObserver<"u"&&it&&new ResizeObserver(Ai).observe(it)}function Ai(){if(!Ve||!Ze||!it)return;let j=it.offsetWidth,gt=it.offsetHeight;if(j<1||gt<1)return;let rt=window.devicePixelRatio||1,yt=u&&ei,St=u?yt?2.5:2:1.75,It=u?yt?5:4:3,zt=Math.min(rt*St,It,2048/Math.max(j,gt));Ve.setPixelRatio(zt),Ve.setSize(j,gt,!1),Ze.left=-j/2,Ze.right=j/2,Ze.top=gt/2,Ze.bottom=-gt/2,Ze.zoom=Math.min(j,gt)*.76/Me,Ze.updateProjectionMatrix()}let ho=.85,uo=2.2;function fo(j,gt){if(!Ve||!ti||!Ze||!tn)return;yn&&(yn.envMapIntensity=s(gt,[0,.3],[ho,uo]));let rt=Math.PI/180;xs+=j,Hi+=j*ut;let{fins:yt}=bt,St=(xs/se.duration%1+1)%1,It=se.rippleAngle*rt,zt=Hi*(se.spinDrift*rt),ge=se.spinLag;tn.rotation.z=Hi*(un*rt);for(let Vt=0;Vt<yt;Vt++){let ue=Vt/yt,ae=Math.abs(ue-St);ae=Math.min(ae,1-ae);let be=Math.exp(-(ae/ge*(ae/ge))*4),xe=It*be+zt;vs.makeRotationX(xe),Ti.copy(bi[Vt].base).multiply(vs),tn.setMatrixAt(Vt,Ti)}tn.instanceMatrix.needsUpdate=!0,Ve.render(ti,Ze),Ei+=1,Ei===3&&_s()}let v=document.getElementById("max-drum-stage"),L=document.getElementById("max-drum"),k=Array.from(i.querySelectorAll(".max-quote-card")),B=k.length,U=22,ht=B*U,vt=8,dt=2200,Tt=1.5,wt=a(.65,0,.35,1),Bt=2.4,Wt=.16,Ct=90,qt=0,ce=0,me=!1,re=0,Ce=performance.now()+dt,mt=null,Re=null,Yt=!1,ke=0,Je=0,Mn=0,Rn=0;function ne(){let j=k[0];if(!j)return;let gt=j.offsetWidth;gt<1||(ce=(gt+vt)/(2*Math.sin(U*Math.PI/360)),L&&(L.style.transform=`translateZ(${(-ce).toFixed(1)}px)`))}if(v&&B){requestAnimationFrame(ne),typeof ResizeObserver<"u"&&new ResizeObserver(ne).observe(k[0]),window.addEventListener("resize",ne),window.addEventListener("orientationchange",ne),typeof IntersectionObserver<"u"?new IntersectionObserver(([gt])=>{me=gt.isIntersecting&&document.visibilityState==="visible"},{rootMargin:"20% 0px"}).observe(c||v):me=!0,v.addEventListener("pointerdown",gt=>{Yt=!0,mt=null,Re=null,ke=gt.clientX,Rn=gt.clientX,Je=qt,Mn=performance.now(),v.setPointerCapture(gt.pointerId)}),v.addEventListener("pointermove",gt=>{if(!Yt||ce===0)return;let rt=180/(Math.PI*ce)*Bt;qt=Je+(gt.clientX-ke)*rt,Rn=gt.clientX});let j=gt=>{if(!Yt)return;Yt=!1;try{v.releasePointerCapture(gt.pointerId)}catch{}let rt=Rn-ke,yt=Math.max(1,performance.now()-Mn),St=180/(Math.PI*ce)*Bt,It=rt/yt*St*1e3,zt=Math.round(Je/U)*U,ge=qt+It*Wt,Vt=Math.round(ge/U)*U;Math.abs(It)>Ct&&Vt===zt&&(Vt=zt+(It>0?U:-U)),re=Date.now()+1500,Re={target:Vt,velocity:It}};v.addEventListener("pointerup",j),v.addEventListener("pointercancel",j),v.addEventListener("pointerleave",j)}function Se(j,gt){if(!(!L||ce===0||!me)){if(!Yt&&!Re&&!t&&Date.now()>=re)if(mt){let rt=e((j-mt.start)/(Tt*1e3));qt=n(mt.from,mt.to,wt(rt)),rt>=1&&(mt=null,Ce=j+dt)}else j>=Ce&&(mt={from:qt,to:Math.round(qt/U)*U+U,start:j});if(Re&&!Yt){let rt=Re,yt=Math.max(1,Math.ceil(gt/.008)),St=gt/yt;for(let It=0;It<yt;It++){let zt=(rt.target-qt)*100-24*rt.velocity;
4108rt.velocity+=zt*St,qt+=rt.velocity*St}Math.abs(rt.target-qt)<.4&&Math.abs(rt.velocity)<1&&(qt=rt.target,Re=null,Ce=j+dt)}for(let rt=0;rt<B;rt++){let yt=k[rt],St=(-rt*U+qt)%ht;St>ht/2&&(St-=ht),St<-ht/2&&(St+=ht),yt.style.transform=`rotateY(${St.toFixed(2)}deg) translateZ(${ce.toFixed(1)}px)`;let It=Math.abs(St)/U,zt=It<2.6;yt.style.opacity=zt?(1-Math.min(It/2.6,1)*.55).toFixed(3):"0",yt.style.zIndex=String(200-Math.round(It*10)),yt.style.pointerEvents=It<.5?"auto":"none"}}}let In=()=>u?.56:.44,he=performance.now(),Pn=performance.now()+1500;function Gn(j){requestAnimationFrame(Gn);let gt=(j-he)/1e3;he=j;let rt=Math.min(gt,.05);if(document.visibilityState!=="visible")return;gs&&!i.classList.contains("is-started")&&i.classList.add("is-ready","is-started");let yt=j<b;C&&!yt&&(M=!0,q()),C=yt,_(),(j<Pn||M)&&(y.value=y.target,y.velocity=0,m.value=m.target,m.velocity=0,d.value=d.target,d.velocity=0,Et=window.scrollY,Q=0,M=!1);let St=y.step(rt),It=m.step(rt),zt=d.step(rt),ge=j/1e3;u&&(ei&&St>.52?(ei=!1,Ai()):!ei&&St<.44&&(ei=!0,Ai()));{let Vt=window.scrollY,ue=yt?0:Math.abs(Vt-Et)/Math.max(rt,.001);if(Et=Vt,t)ut=1;else{Q=Math.min(R,Math.max(ue,Q*Math.exp(-rt/lt)));let ae=1+Math.min(1,Q/R)*(Gt-1),be=ae>ut?J:ct;ut+=(ae-ut)*(1-Math.exp(-rt*be))}}if(Lt(St,j,yt),et){let Vt=le(St);Vt!==ee&&(ee=Vt,et.style.background=Vt)}if(S){let Vt=s(St,[.04,.36],[1,0]),ue=jn===0?0:e((j-jn-1600)/2400);S.style.opacity=(Vt*ue).toFixed(3),Vt*ue>.01&&$(j)}ot&&(ot.style.opacity=s(St,[.3,.38,.5,.58],[0,1,1,0]).toFixed(3),ot.style.transform=`translateY(${s(St,[.3,.4],[10,0]).toFixed(2)}%)`);for(let Vt=0;Vt<At.length;Vt++){let ue=Math.min(.7,.52+Vt*.022),ae=At[Vt];if(ae.style.opacity=s(St,[ue,ue+.025,.74,.82],[0,1,1,0]).toFixed(3),!t){let be=6+Vt*.4,xe=Math.max(0,ge-Vt*.25)/be,_e=.5*(1-Math.cos(2*Math.PI*xe)),[en,ni]=pt[Vt]||[0,0];ae.style.transform=`translate(${(en*10*_e).toFixed(2)}px, ${(ni*10*_e).toFixed(2)}px)`}}if(Rt&&(Rt.style.opacity=It.toFixed(3)),Pt&&Pt.style.setProperty("--max-blend",w.toFixed(3)),Y&&(z&&St>.34?(z=!1,Y.classList.remove("is-max-nav-over-dark")):!z&&St<.3&&(z=!0,Y.classList.add("is-max-nav-over-dark"))),it){let Vt=s(St,[0,.4],[u?3.5:3,.72]),ue=Vt+(In()-Vt)*zt,ae=s(St,[0,.4],[u?148:108,0]),be=s(St,[.85,1],[1,.25]),xe=be+(1-be)*zt;it.style.transform=`translateY(${ae.toFixed(2)}%) scale(${ue.toFixed(4)})`,it.style.opacity=xe.toFixed(3)}fo(t?0:rt,St),Se(j,rt)}hr(),requestAnimationFrame(Gn)})();})();
4109/*! Bundled license information:
4110
4111three/build/three.core.js:
4112three/build/three.module.js:
4113  (**
4114   * @license
4115   * Copyright 2010-2026 Three.js Authors
4116   * SPDX-License-Identifier: MIT
4117   *)
4118*/
4119//# sourceMappingURL=max.js.map

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.